24#include <tqpopupmenu.h>
29#include "../q4os/dpi1.cc"
31#include "kpanelextension.h"
32#include "kpanelextension.moc"
34class KPanelExtensionPrivate
37 KPanelExtensionPrivate()
38 : _size(KPanelExtension::SizeSmall),
45 TQPopupMenu* _customMenu;
51 int actions, TQWidget *parent,
const char *name)
52 : TQFrame(parent, name)
55 , _alignment( LeftTop )
59 d =
new KPanelExtensionPrivate;
60 setFrameStyle(NoFrame);
72 if( _position == p )
return;
79 if( _alignment == a )
return;
86 if ( d->_size == size && d->_customSize ==
customSize )
return;
99 if ( (a & Preferences) )
101 if ( (a & ReportBug) )
107 if (_position == Left || _position == Right)
108 return TQt::Vertical;
110 return TQt::Horizontal;
123 return d->_customSize;
128 const int system_dpi = get_q4dpi();
129 if (d->_size == SizeTiny)
131 return recalculate_iconsize_by_dpi( 24, system_dpi );
133 else if (d->_size == SizeSmall)
135 return recalculate_iconsize_by_dpi( 30, system_dpi );
137 else if (d->_size == SizeNormal)
139 return recalculate_iconsize_by_dpi( 46, system_dpi );
141 else if (d->_size == SizeLarge)
143 return recalculate_iconsize_by_dpi( 58, system_dpi );
148 return d->_customSize;
153 return d->_customMenu;
158 d->_customMenu = menu;
163 return position() == Floating || d->_reserveStrut;
168 d->_reserveStrut = reserve;
171void KPanelExtension::virtual_hook(
int,
void* )
void setAlignment(Alignment a)
virtual void preferences()
Is called when the user selects "Preferences" from the extensions RMB menu.
void updateLayout()
Emit this signal to make the panel relayout all extensions in the dock, when you want to change the e...
TQPopupMenu * customMenu() const
virtual void help()
Is called when the user selects "Help" from the extensions RMB menu.
~KPanelExtension()
Destructor.
Position position() const
virtual void alignmentChange(Alignment)
This extension has changed its alignment.
Type
The type of the extension (TODO).
void setReserveStrut(bool shouldUseStrut)
Use this method to set the return value for reserveStrut.
virtual void positionChange(Position)
This extension has changed its position.
Orientation orientation()
void setSize(Size size, int customSize)
Action
An action to be taken sometime.
void setCustomMenu(TQPopupMenu *)
Use this method to set the custom menu for this extensions so that it can be shown at the appropriate...
virtual void about()
Is called when the user selects "About" from the extensions RMB menu.
virtual void action(Action a)
Generic action dispatcher.
void setPosition(Position p)
bool reserveStrut() const
virtual void reportBug()
Is called when the user selects "Report bug" from the applet's RMB menu.
KPanelExtension(const TQString &configFile, Type t=Normal, int actions=0, TQWidget *parent=0, const char *name=0)
Constructs a KPanelExtension just like any other widget.