KCommonDecoration Class Reference
#include <kcommondecoration.h>
Inheritance diagram for KCommonDecoration:

Detailed Description
This class eases development of decorations by implementing parts of KDecoration which are error prone and common for most decorations.It takes care of the window layout, button/action handling, and window mask creation.
Definition at line 59 of file kcommondecoration.h.
Public Types | |
enum | LayoutMetric { LM_BorderLeft, LM_BorderRight, LM_BorderBottom, LM_TitleHeight, LM_TitleBorderLeft, LM_TitleBorderRight, LM_TitleEdgeLeft, LM_TitleEdgeRight, LM_TitleEdgeTop, LM_TitleEdgeBottom, LM_ButtonWidth, LM_ButtonHeight, LM_ButtonSpacing, LM_ExplicitButtonSpacer, LM_ButtonMarginTop } |
enum | DecorationBehaviour { DB_MenuClose, DB_WindowMask, DB_ButtonHide } |
enum | WindowCorner { WC_TopLeft, WC_TopRight, WC_BottomLeft, WC_BottomRight } |
Public Slots | |
void | keepAboveChange (bool above) |
void | keepBelowChange (bool below) |
void | slotMaximize () |
void | slotShade () |
void | slotKeepAbove () |
void | slotKeepBelow () |
void | menuButtonPressed () |
void | menuButtonReleased () |
Public Member Functions | |
KCommonDecoration (KDecorationBridge *bridge, KDecorationFactory *factory) | |
virtual QString | visibleName () const =0 |
virtual QString | defaultButtonsLeft () const =0 |
virtual QString | defaultButtonsRight () const =0 |
virtual bool | decorationBehaviour (DecorationBehaviour behaviour) const |
virtual int | layoutMetric (LayoutMetric lm, bool respectWindowState=true, const KCommonDecorationButton *button=0) const |
virtual KCommonDecorationButton * | createButton (ButtonType type)=0 |
virtual QRegion | cornerShape (WindowCorner corner) |
virtual void | updateWindowShape () |
virtual void | paintEvent (QPaintEvent *e)=0 |
virtual void | updateCaption () |
int | buttonsLeftWidth () const |
int | buttonsRightWidth () const |
void | updateLayout () const |
void | updateButtons () const |
void | resetButtons () const |
bool | isToolWindow () const |
QRect | titleRect () const |
virtual void | init () |
virtual void | reset (unsigned long changed) |
virtual void | borders (int &left, int &right, int &top, int &bottom) const |
virtual void | show () |
virtual void | resize (const QSize &s) |
virtual QSize | minimumSize () const |
virtual void | maximizeChange () |
virtual void | desktopChange () |
virtual void | shadeChange () |
virtual void | iconChange () |
virtual void | activeChange () |
virtual void | captionChange () |
virtual Position | mousePosition (const QPoint &point) const |
virtual bool | eventFilter (QObject *o, QEvent *e) |
virtual void | resizeEvent (QResizeEvent *e) |
virtual void | mouseDoubleClickEvent (QMouseEvent *e) |
virtual void | wheelEvent (QWheelEvent *e) |
Member Enumeration Documentation
|
Definition at line 119 of file kcommondecoration.h. |
|
Used to calculate the decoration layout. The basic layout looks like this: Window: _______________________________________________________________ | LM_TitleEdgeTop | |_______________________________________________________________| | LM_TitleEdgeLeft | [title] | LM_TitleEdgeRight | |__________________|________________________|___________________| | LM_TitleEdgeBottom | |_______________________________________________________________| | | | | | | | | | | | | |LM_BorderLeft LM_BorderRight| |_|___________________________________________________________|_| | LM_BorderBottom | |_______________________________________________________________| Title: ___________________________________________________________________________________ | LM_ButtonMarginTop | | LM_ButtonMarginTop | |________________________________| |_________________________________| | [Buttons] | LM_TitleBorderLeft | LM_TitleHeight | LM_TitleBorderRight | [Buttons] | |___________|____________________|________________|_____________________|___________| Buttons: _____________________________________________________________________________________________ | button | spacing | button | spacing | explicit spacer | spacing | ... | spacing | button | |________|_________|________|_________|_________________|_________|________|_________|________|
Definition at line 100 of file kcommondecoration.h. |
Member Function Documentation
|
This function is called whenever the window either becomes or stops being active. Use isActive() to find out the current state. Implements KDecoration. Definition at line 556 of file kcommondecoration.cpp. |
|
This function should return the distance from each window side to the inner window. The sizes may depend on the state of the decorated window, such as whether it's shaded. Decorations often turn off their bottom border when the window is shaded, and turn off their left/right/bottom borders when the window is maximized and moving and resizing of maximized windows is disabled. This function mustn't do any repaints or resizes. Also, if the sizes returned by this function don't match the real values, this may result in drawing errors or other problems.
Implements KDecoration. Definition at line 146 of file kcommondecoration.cpp. |
|
This function is called whenever the caption changes. Use caption() to get it. Implements KDecoration. Definition at line 562 of file kcommondecoration.cpp. |
|
Definition at line 135 of file kcommondecoration.cpp. |
|
Create a new title bar button. KCommonDecoration takes care of memory management.
|
|
This controls whether some specific behaviour should be enabled or not.
Definition at line 60 of file kcommondecoration.cpp. |
|
The default title button order on the left.
|
|
The default title button order on the left.
|
|
This function is called whenever the desktop for the window changes. Use desktop() or isOnAllDesktops() to find out the current desktop on which the window is. Implements KDecoration. Definition at line 524 of file kcommondecoration.cpp. |
|
This function is called whenever the window icon changes. Use icon() to get it. Implements KDecoration. Definition at line 547 of file kcommondecoration.cpp. |
|
Handles widget and layout creation, call the base implementation when subclassing this member.
Implements KDecoration. Definition at line 110 of file kcommondecoration.cpp. |
|
Convenience method.
Definition at line 850 of file kcommondecoration.cpp. |
|
This controls the layout of the decoration in various ways. It is possible to have a different layout for different window states.
Definition at line 76 of file kcommondecoration.cpp. |
|
This function is called whenever the maximalization state of the window changes. Use maximizeMode() to get the current state. Implements KDecoration. Definition at line 511 of file kcommondecoration.cpp. |
|
This function should return the minimum required size for the decoration. Note that the returned size shouldn't be too large, because it will be used to keep the decorated window at least as large. Implements KDecoration. Definition at line 500 of file kcommondecoration.cpp. |
|
This function should return mouse cursor position in the decoration. Positions at the edge will result in window resizing with mouse button pressed, center position will result in moving. Implements KDecoration. Definition at line 705 of file kcommondecoration.cpp. |
|
Draw the window decoration.
|
|
Handles SettingButtons, call the base implementation when subclassing this member.
Reimplemented from KDecoration. Definition at line 127 of file kcommondecoration.cpp. |
|
Manually call reset() on each button.
Definition at line 243 of file kcommondecoration.cpp. |
|
This method is called by kwin when the style should resize the decoration window. The usual implementation is to resize the main widget of the decoration to the given size.
Implements KDecoration. Definition at line 495 of file kcommondecoration.cpp. |
|
This function is called whenever the window is shaded or unshaded. Use isShade() to get the current state. Implements KDecoration. Definition at line 535 of file kcommondecoration.cpp. |
|
Convenience method.
Definition at line 856 of file kcommondecoration.cpp. |
|
Makes sure all buttons are repainted.
Definition at line 237 of file kcommondecoration.cpp. |
|
This is used to update the painting of the title bar after the caption has been changed. Reimplement for a more efficient implementation (default calls update() on the whole decoration). Definition at line 140 of file kcommondecoration.cpp. |
|
TODO: remove?
Definition at line 158 of file kcommondecoration.cpp. |
|
This updates the window mask using the information provided by cornerShape(). Edges which are aligned to screen corners are not shaped for better usability (remember to paint these areas in paintEvent(), too). You normally don't want/need to reimplement updateWindowShape().
Definition at line 770 of file kcommondecoration.cpp. |
|
The name of the decoration used in the decoration preview.
|
The documentation for this class was generated from the following files: