Home · All Classes · Main Classes · Grouped Classes · Modules · Functions |
The QDecoration class allows the appearance of top level windows to be customized. More...
#include <QDecoration>
The QDecoration class allows the appearance of top level windows to be customized.
Note that this class is non-portable, and that it is only available in Qtopia Core.
Qtopia Core provides window management of top level windows. The appearance of the borders and buttons (the decoration) around these windows can be customized by deriving from the QDecoration class. Custom decorations can be added by subclassing the QDecorationPlugin class, using the QDecorationFactory class to dynamically load the decoration into the application. To actually apply a decoration to an application, use the QApplication::qwsSetDecoration() function.
The QDecoration class provides the virtual paint() function that can be reimplemented to paint the border and title decoration around a specified widget using a given painter and decoration state.
The DecorationRegion enum is used to specify which region to paint. This enum describes the various regions of the window decoration. The region() function is used to retrieve the actual regions the decoration occupy. It is also possible to determine the type of region containing a given point, using the regionAt() function. The DecorationState enum is used to specify a region's state, e.g. whether it is active or not.
QDecoration also provides the possibility of building the system menu for a given top level widget with its virtual buildSysMenu() function. The menuTriggered() function is called whenever an action in such a widget's menu is triggered.
The virtual regionClicked() and regionDoubleClicked() functions are provided to enable response to mouse clicks. The default implementations responds to (single) clicks on items in a widget's system menu and double clicks on a widget's title.
Finally, the QDecoration class provides a couple of static functions, startMove() and startResize(), which start the move or resize action by making the appropiate decoration region active and grabbing the mouse input.
See also QDecorationFactory, QDecorationPlugin, and QDirectPainter.
This enum describes the various regions of the window decoration.
Constant | Value | Description |
---|---|---|
QDecoration::All | 0x7fffffff | The entire region used by the window decoration. |
QDecoration::Top | 0x0000000002 | The top border used to vertically resize the window. |
QDecoration::Bottom | 0x0000000040 | The bottom border used to vertically resize the window. |
QDecoration::Left | 0x0000000008 | The left border used to horizontally resize the window. |
QDecoration::Right | 0x0000000010 | The right border used to horizontally resize the window. |
QDecoration::TopLeft | 0x0000000001 | The top-left corner of the window used to resize the window both horizontally and vertically. |
QDecoration::TopRight | 0x0000000004 | The top-right corner of the window used to resize the window both horizontally and vertically. |
QDecoration::BottomLeft | 0x0000000020 | The bottom-left corner of the window used to resize the window both horizontally and vertically. |
QDecoration::BottomRight | 0x0000000080 | The bottom-right corner of the window used to resize the window both horizontally and vertically. |
QDecoration::Borders | 0x00000000ff | All the regions used to describe the window border. |
QDecoration::Title | 0x0000000200 | The region containing the window title, used to move the window by dragging with the mouse cursor. |
QDecoration::Close | 0x0000004000 | The region occupied by the close button. Clicking in this region closes the window. |
QDecoration::Minimize | 0x0000000800 | The region occupied by the minimize button. Clicking in this region minimizes the window. |
QDecoration::Maximize | 0x0000001000 | The region occupied by the maximize button. Clicking in this region maximizes the window. |
QDecoration::Normalize | 0x0000002000 | The region occupied by a button used to restore a window's normal size. Clicking in this region restores a maximized window to its previous size. The region used for this button is often also the Maximize region. |
QDecoration::Menu | 0x0000000100 | The region occupied by the window's menu button. Clicking in this region opens the window operations (system) menu. |
QDecoration::Help | 0x0000000400 | The region occupied by the window's help button. Clicking in this region causes the context-sensitive help function to be enabled. |
QDecoration::Resize | 0x0000010000 | The region used to resize the window. |
QDecoration::Move | 0x0000008000 | The region used to move the window. |
QDecoration::None | 0x0000000000 | No region. |
See also region(), regionAt(), and DecorationState.
This enum describes the various states of a decoration region.
Constant | Value | Description |
---|---|---|
QDecoration::Normal | 0x04 | The region is active |
QDecoration::Disabled | 0x08 | The region is inactive. |
QDecoration::Hover | 0x01 | The cursor is hovering over the region. |
QDecoration::Pressed | 0x02 | The region is pressed. |
See also paint() and DecorationRegion.
Constructs a decoration object.
Destroys this decoration object.
Builds the system menu for the given top level widget.
See also menuTriggered().
This function is called whenever an action in a top level widget's menu is triggered. Pointers to the widget and action are passed as arguments.
See also buildSysMenu().
This virtual function allows subclasses of QDecoration to paint the border and title decoration for the specified top level widget using the given painter and state.
The specified decorationRegion is a bitmask of the values described by the DecorationRegion enum.
Returns the region specified by decorationRegion, for the given top level widget.
The rectangle parameter specifies the rectangle the decoration is wrapped around. The decorationRegion is a bitmask of the values described by the DecorationRegion enum.
See also regionAt().
This is an overloaded member function, provided for convenience.
Returns the region specified by decorationRegion containing the given widget. The decorationRegion is a bitmask of the values described by the DecorationRegion enum.
Returns the type of the first region of the specified top level widget containing the given point.
The return value is one of the DecorationRegion enum's values. Use the region() function to retrieve the actual region. If none of the widget's regions contain the point, this function returns None.
See also region().
This function is called whenever a region in a top level widget is clicked. The parameters specifies the widget as well as the region. Note that the region parameter is one of the DecorationRegion values.
The default implementation responds to clicks on items in the system menu, performing the requested actions.
See also regionDoubleClicked().
This function is called whenever a region in a top level widget is double clicked. The parameters specifies the widget as well as the region. Note that the region parameter is one of the DecorationRegion values.
The default implementation responds to a double click on the widget's title, toggling its size between the maximum and its normal size.
See also regionClicked().
Starts to move the given widget by making its Title region active and grabbing the mouse input. The widget must be a top level widget.
See also DecorationRegion.
Starts to resize the given widget by making its BottomRight region active and grabbing the mouse input. The widget must be a top level widget.
See also DecorationRegion.
Copyright © 2006 Trolltech | Trademarks | Qt 4.1.3 |