• Skip to content
  • Skip to link menu
Trinity API Reference
  • Trinity API Reference
  • tdeui
 

tdeui

  • tdeui
kpanelextension.cpp
1 /*****************************************************************
2 
3 Copyright (c) 2000 Matthias Elter
4 
5 Permission is hereby granted, free of charge, to any person obtaining a copy
6 of this software and associated documentation files (the "Software"), to deal
7 in the Software without restriction, including without limitation the rights
8 to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9 copies of the Software, and to permit persons to whom the Software is
10 furnished to do so, subject to the following conditions:
11 
12 The above copyright notice and this permission notice shall be included in
13 all copies or substantial portions of the Software.
14 
15 THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16 IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17 FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18 AUTHORS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN
19 AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
20 CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
21 
22 ******************************************************************/
23 
24 #include <tqpopupmenu.h>
25 
26 #include <tdeconfig.h>
27 
28 #include "kpanelextension.h"
29 #include "kpanelextension.moc"
30 
31 class KPanelExtensionPrivate
32 {
33 public:
34  KPanelExtensionPrivate()
35  : _size(KPanelExtension::SizeSmall),
36  _customMenu(0),
37  _customSize(30),
38  _reserveStrut(true)
39  {}
40 
41  KPanelExtension::Size _size;
42  TQPopupMenu* _customMenu;
43  int _customSize;
44  bool _reserveStrut;
45 };
46 
47 KPanelExtension::KPanelExtension(const TQString& configFile, Type type,
48  int actions, TQWidget *parent, const char *name)
49  : TQFrame(parent, name)
50  , _type(type)
51  , _position( Top )
52  , _alignment( LeftTop )
53  , _config(0)
54  , _actions(actions)
55 {
56  d = new KPanelExtensionPrivate;
57  setFrameStyle(NoFrame);
58  _config = new TDEConfig(configFile);
59 }
60 
61 KPanelExtension::~KPanelExtension()
62 {
63  delete _config;
64  delete d;
65 }
66 
67 void KPanelExtension::setPosition( Position p )
68 {
69  if( _position == p ) return;
70  _position = p;
71  positionChange( p );
72 }
73 
74 void KPanelExtension::setAlignment( Alignment a )
75 {
76  if( _alignment == a ) return;
77  _alignment = a;
78  alignmentChange( a );
79 }
80 
81 void KPanelExtension::setSize( Size size, int customSize )
82 {
83  if ( d->_size == size && d->_customSize == customSize ) return;
84  d->_size = size;
85  d->_customSize = customSize;
86  emit updateLayout();
87 }
88 
89 void KPanelExtension::action( Action a )
90 {
91  if ( (a & About) )
92  about();
93  if ( (a & Help) )
94  help();
95  if ( (a & Preferences) )
96  preferences();
97  if ( (a & ReportBug) )
98  reportBug();
99 }
100 
101 Qt::Orientation KPanelExtension::orientation()
102 {
103  if (_position == Left || _position == Right)
104  return Qt::Vertical;
105  else
106  return Qt::Horizontal;
107 }
108 
109 KPanelExtension::Size KPanelExtension::sizeSetting() const
110 {
111  return d->_size;
112 }
113 
114 int KPanelExtension::customSize() const
115 {
116  return d->_customSize;
117 }
118 
119 int KPanelExtension::sizeInPixels() const
120 {
121  if (d->_size == SizeTiny)
122  {
123  return 24;
124  }
125  else if (d->_size == SizeSmall)
126  {
127  return 30;
128  }
129  else if (d->_size == SizeNormal)
130  {
131  return 46;
132  }
133  else if (d->_size == SizeLarge)
134  {
135  return 58;
136  }
137 
138  return d->_customSize;
139 }
140 
141 TQPopupMenu* KPanelExtension::customMenu() const
142 {
143  return d->_customMenu;
144 }
145 
146 void KPanelExtension::setCustomMenu(TQPopupMenu* menu)
147 {
148  d->_customMenu = menu;
149 }
150 
151 bool KPanelExtension::reserveStrut() const
152 {
153  return position() == Floating || d->_reserveStrut;
154 }
155 
156 void KPanelExtension::setReserveStrut(bool reserve)
157 {
158  d->_reserveStrut = reserve;
159 }
160 
161 void KPanelExtension::virtual_hook( int, void* )
162 { /*BASE::virtual_hook( id, data );*/ }
163 

tdeui

Skip menu "tdeui"
  • Main Page
  • Namespace List
  • Class Hierarchy
  • Alphabetical List
  • Class List
  • File List
  • Namespace Members
  • Class Members
  • Related Pages

tdeui

Skip menu "tdeui"
  • arts
  • dcop
  • dnssd
  • interfaces
  •   kspeech
  •     interface
  •     library
  •   tdetexteditor
  • kate
  • kded
  • kdoctools
  • kimgio
  • kjs
  • libtdemid
  • libtdescreensaver
  •     tdecore
  • tdeabc
  • tdecmshell
  • tdecore
  • tdefx
  • tdehtml
  • tdeinit
  • tdeio
  •   bookmarks
  •   httpfilter
  •   kpasswdserver
  •   kssl
  • tdeioslave
  •   http
  •   tdefile
  •   tdeio
  •   tdeioexec
  • tdemdi
  •   tdemdi
  • tdenewstuff
  • tdeparts
  • tdeprint
  • tderandr
  • tderesources
  • tdespell2
  • tdesu
  • tdeui
  • tdeunittest
  • tdeutils
  • tdewallet
Generated for tdeui by doxygen 1.8.1.2
This website is maintained by Timothy Pearson.