• Skip to content
  • Skip to link menu
Trinity API Reference
  • Trinity API Reference
  • kwin/lib
 

kwin/lib

Public Types | Public Slots | Public Member Functions

KCommonDecoration Class Reference

This class eases development of decorations by implementing parts of KDecoration which are error prone and common for most decorations. More...

#include <kcommondecoration.h>

Inheritance diagram for KCommonDecoration:
KDecoration KDecorationDefines

List of all members.

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, LM_RightButtonsMarginTop
}
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 TQString visibleName () const =0
virtual TQString defaultButtonsLeft () const =0
virtual TQString 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 TQRegion cornerShape (WindowCorner corner)
virtual void updateWindowShape ()
virtual void paintEvent (TQPaintEvent *e)=0
virtual void updateCaption ()
int buttonsLeftWidth () const
int buttonsRightWidth () const
void updateLayout () const
void updateButtons () const
void resetButtons () const
bool isToolWindow () const
TQRect 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 TQSize &s)
virtual TQSize minimumSize () const
virtual void maximizeChange ()
virtual void desktopChange ()
virtual void shadeChange ()
virtual void iconChange ()
virtual void activeChange ()
virtual void captionChange ()
virtual Position mousePosition (const TQPoint &point) const
virtual bool eventFilter (TQObject *o, TQEvent *e)
virtual void resizeEvent (TQResizeEvent *e)
virtual void mouseDoubleClickEvent (TQMouseEvent *e)
virtual void wheelEvent (TQWheelEvent *e)

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.


Member Enumeration Documentation

enum KCommonDecoration::DecorationBehaviour
Enumerator:
DB_MenuClose 

Close window on double clicking the menu.

DB_WindowMask 

Set a mask on the window.

DB_ButtonHide 

Hide buttons when there is not enough space in the titlebar.

Definition at line 120 of file kcommondecoration.h.

enum KCommonDecoration::LayoutMetric

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 | |________|_________|________|_________|_________________|_________|________|_________|________|

See also:
layoutMetric()

Definition at line 100 of file kcommondecoration.h.


Member Function Documentation

void KCommonDecoration::activeChange (  )  [virtual]

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 581 of file kcommondecoration.cpp.

void KCommonDecoration::borders ( int &  left,
int &  right,
int &  top,
int &  bottom 
) const [virtual]

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.

See also:
KDecorationOptions::moveResizeMaximizedWindows()

Implements KDecoration.

Definition at line 150 of file kcommondecoration.cpp.

void KCommonDecoration::captionChange (  )  [virtual]

This function is called whenever the caption changes.

Use caption() to get it.

Implements KDecoration.

Definition at line 587 of file kcommondecoration.cpp.

TQRegion KCommonDecoration::cornerShape ( WindowCorner  corner  )  [virtual]
Returns:
the mask for the specific window corner.

Definition at line 139 of file kcommondecoration.cpp.

virtual KCommonDecorationButton* KCommonDecoration::createButton ( ButtonType  type  )  [pure virtual]

Create a new title bar button.

KCommonDecoration takes care of memory management.

Returns:
a pointer to the button, or 0 if the button should not be created.
bool KCommonDecoration::decorationBehaviour ( DecorationBehaviour  behaviour  )  const [virtual]

This controls whether some specific behaviour should be enabled or not.

See also:
DecorationBehaviour

Definition at line 63 of file kcommondecoration.cpp.

virtual TQString KCommonDecoration::defaultButtonsLeft (  )  const [pure virtual]

The default title button order on the left.

See also:
KDecoration::titleButtonsLeft()
KDecoration::titleButtonsRight()
virtual TQString KCommonDecoration::defaultButtonsRight (  )  const [pure virtual]

The default title button order on the left.

See also:
KDecoration::titleButtonsLeft()
KDecoration::titleButtonsRight()
void KCommonDecoration::desktopChange (  )  [virtual]

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 549 of file kcommondecoration.cpp.

void KCommonDecoration::iconChange (  )  [virtual]

This function is called whenever the window icon changes.

Use icon() to get it.

Implements KDecoration.

Definition at line 572 of file kcommondecoration.cpp.

void KCommonDecoration::init (  )  [virtual]

Handles widget and layout creation, call the base implementation when subclassing this member.

Implements KDecoration.

Definition at line 114 of file kcommondecoration.cpp.

bool KCommonDecoration::isToolWindow (  )  const

Convenience method.

Returns:
true if the window type is NET::Toolbar, NET::Utility, or NET::Menu

Definition at line 875 of file kcommondecoration.cpp.

int KCommonDecoration::layoutMetric ( LayoutMetric  lm,
bool  respectWindowState = true,
const KCommonDecorationButton *  button = 0 
) const [virtual]

This controls the layout of the decoration in various ways.

It is possible to have a different layout for different window states.

Parameters:
lm The layout element.
respectWindowState Whether window states should be taken into account or a "default" state should be assumed.
button For LM_ButtonWidth and LM_ButtonHeight, the button.

Definition at line 79 of file kcommondecoration.cpp.

void KCommonDecoration::maximizeChange (  )  [virtual]

This function is called whenever the maximalization state of the window changes.

Use maximizeMode() to get the current state.

Implements KDecoration.

Definition at line 536 of file kcommondecoration.cpp.

TQSize KCommonDecoration::minimumSize (  )  const [virtual]

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 525 of file kcommondecoration.cpp.

KCommonDecoration::Position KCommonDecoration::mousePosition ( const TQPoint &  p  )  const [virtual]

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 730 of file kcommondecoration.cpp.

virtual void KCommonDecoration::paintEvent ( TQPaintEvent *  e  )  [pure virtual]

Draw the window decoration.

void KCommonDecoration::reset ( unsigned long  changed  )  [virtual]

Handles SettingButtons, call the base implementation when subclassing this member.

Reimplemented from KDecoration.

Definition at line 131 of file kcommondecoration.cpp.

void KCommonDecoration::resetButtons (  )  const

Manually call reset() on each button.

Definition at line 248 of file kcommondecoration.cpp.

void KCommonDecoration::resize ( const TQSize &  s  )  [virtual]

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.

Parameters:
s Specifies the new size of the decoration window.

Implements KDecoration.

Definition at line 520 of file kcommondecoration.cpp.

void KCommonDecoration::shadeChange (  )  [virtual]

This function is called whenever the window is shaded or unshaded.

Use isShade() to get the current state.

Implements KDecoration.

Definition at line 560 of file kcommondecoration.cpp.

TQRect KCommonDecoration::titleRect (  )  const

Convenience method.

Returns:
the title rect.

Definition at line 881 of file kcommondecoration.cpp.

void KCommonDecoration::updateButtons (  )  const

Makes sure all buttons are repainted.

Definition at line 242 of file kcommondecoration.cpp.

void KCommonDecoration::updateCaption (  )  [virtual]

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 144 of file kcommondecoration.cpp.

void KCommonDecoration::updateLayout (  )  const

TODO: remove?

Definition at line 162 of file kcommondecoration.cpp.

void KCommonDecoration::updateWindowShape (  )  [virtual]

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().

See also:
cornerShape()

Definition at line 795 of file kcommondecoration.cpp.

virtual TQString KCommonDecoration::visibleName (  )  const [pure virtual]

The name of the decoration used in the decoration preview.


The documentation for this class was generated from the following files:
  • kcommondecoration.h
  • kcommondecoration.cpp

kwin/lib

Skip menu "kwin/lib"
  • Main Page
  • Class Hierarchy
  • Alphabetical List
  • Class List
  • File List
  • Class Members
  • Related Pages

kwin/lib

Skip menu "kwin/lib"
  • kate
  • kwin
  •   lib
  • libkonq
Generated for kwin/lib by doxygen 1.7.1
This website is maintained by Timothy Pearson.
KDE® and the K Desktop Environment® logo are registered trademarks of KDE e.V. |