Fix indenting of decoration files.

svn path=/trunk/KDE/kdebase/workspace/; revision=863806
icc-effect-5.14.5
Lucas Murray 2008-09-23 07:54:28 +00:00
parent 283a16b13b
commit 0cfe3b2c73
6 changed files with 529 additions and 529 deletions

View File

@ -343,116 +343,116 @@ void KCommonDecoration::addButtons(ButtonContainer &btnContainer, const QString&
for (int n=0; n < s.length(); n++) { for (int n=0; n < s.length(); n++) {
KCommonDecorationButton *btn = 0; KCommonDecorationButton *btn = 0;
switch (s[n].toAscii()) { switch (s[n].toAscii()) {
case 'M': // Menu button case 'M': // Menu button
if (!m_button[MenuButton]){ if (!m_button[MenuButton]){
btn = createButton(MenuButton); btn = createButton(MenuButton);
if (!btn) break; if (!btn) break;
btn->setTipText(i18n("Menu") ); btn->setTipText(i18n("Menu") );
btn->setRealizeButtons(Qt::LeftButton|Qt::RightButton); btn->setRealizeButtons(Qt::LeftButton|Qt::RightButton);
connect(btn, SIGNAL(pressed()), SLOT(menuButtonPressed())); connect(btn, SIGNAL(pressed()), SLOT(menuButtonPressed()));
connect(btn, SIGNAL(released()), this, SLOT(menuButtonReleased())); connect(btn, SIGNAL(released()), this, SLOT(menuButtonReleased()));
m_button[MenuButton] = btn; m_button[MenuButton] = btn;
} }
break; break;
case 'S': // OnAllDesktops button case 'S': // OnAllDesktops button
if (!m_button[OnAllDesktopsButton]){ if (!m_button[OnAllDesktopsButton]){
btn = createButton(OnAllDesktopsButton); btn = createButton(OnAllDesktopsButton);
if (!btn) break; if (!btn) break;
const bool oad = isOnAllDesktops(); const bool oad = isOnAllDesktops();
btn->setTipText(oad?i18n("Not on all desktops"):i18n("On all desktops") ); btn->setTipText(oad?i18n("Not on all desktops"):i18n("On all desktops") );
btn->setToggleButton(true); btn->setToggleButton(true);
btn->setOn( oad ); btn->setOn( oad );
connect(btn, SIGNAL(clicked()), SLOT(toggleOnAllDesktops())); connect(btn, SIGNAL(clicked()), SLOT(toggleOnAllDesktops()));
m_button[OnAllDesktopsButton] = btn; m_button[OnAllDesktopsButton] = btn;
} }
break; break;
case 'H': // Help button case 'H': // Help button
if ((!m_button[HelpButton]) && providesContextHelp()){ if ((!m_button[HelpButton]) && providesContextHelp()){
btn = createButton(HelpButton); btn = createButton(HelpButton);
if (!btn) break; if (!btn) break;
btn->setTipText(i18n("Help") ); btn->setTipText(i18n("Help") );
connect(btn, SIGNAL(clicked()), SLOT(showContextHelp())); connect(btn, SIGNAL(clicked()), SLOT(showContextHelp()));
m_button[HelpButton] = btn; m_button[HelpButton] = btn;
} }
break; break;
case 'I': // Minimize button case 'I': // Minimize button
if ((!m_button[MinButton]) && isMinimizable()){ if ((!m_button[MinButton]) && isMinimizable()){
btn = createButton(MinButton); btn = createButton(MinButton);
if (!btn) break; if (!btn) break;
btn->setTipText(i18n("Minimize") ); btn->setTipText(i18n("Minimize") );
connect(btn, SIGNAL(clicked()), SLOT(minimize())); connect(btn, SIGNAL(clicked()), SLOT(minimize()));
m_button[MinButton] = btn; m_button[MinButton] = btn;
} }
break; break;
case 'A': // Maximize button case 'A': // Maximize button
if ((!m_button[MaxButton]) && isMaximizable()){ if ((!m_button[MaxButton]) && isMaximizable()){
btn = createButton(MaxButton); btn = createButton(MaxButton);
if (!btn) break; if (!btn) break;
btn->setRealizeButtons(Qt::LeftButton|Qt::MidButton|Qt::RightButton); btn->setRealizeButtons(Qt::LeftButton|Qt::MidButton|Qt::RightButton);
const bool max = maximizeMode()==MaximizeFull; const bool max = maximizeMode()==MaximizeFull;
btn->setTipText(max?i18n("Restore"):i18n("Maximize") ); btn->setTipText(max?i18n("Restore"):i18n("Maximize") );
btn->setToggleButton(true); btn->setToggleButton(true);
btn->setOn( max ); btn->setOn( max );
connect(btn, SIGNAL(clicked()), SLOT(slotMaximize())); connect(btn, SIGNAL(clicked()), SLOT(slotMaximize()));
m_button[MaxButton] = btn; m_button[MaxButton] = btn;
} }
break; break;
case 'X': // Close button case 'X': // Close button
if ((!m_button[CloseButton]) && isCloseable()){ if ((!m_button[CloseButton]) && isCloseable()){
btn = createButton(CloseButton); btn = createButton(CloseButton);
if (!btn) break; if (!btn) break;
btn->setTipText(i18n("Close") ); btn->setTipText(i18n("Close") );
connect(btn, SIGNAL(clicked()), SLOT(closeWindow())); connect(btn, SIGNAL(clicked()), SLOT(closeWindow()));
m_button[CloseButton] = btn; m_button[CloseButton] = btn;
} }
break; break;
case 'F': // AboveButton button case 'F': // AboveButton button
if (!m_button[AboveButton]){ if (!m_button[AboveButton]){
btn = createButton(AboveButton); btn = createButton(AboveButton);
if (!btn) break; if (!btn) break;
bool above = keepAbove(); bool above = keepAbove();
btn->setTipText(above?i18n("Do not keep above others"):i18n("Keep above others") ); btn->setTipText(above?i18n("Do not keep above others"):i18n("Keep above others") );
btn->setToggleButton(true); btn->setToggleButton(true);
btn->setOn( above ); btn->setOn( above );
connect(btn, SIGNAL(clicked()), SLOT(slotKeepAbove())); connect(btn, SIGNAL(clicked()), SLOT(slotKeepAbove()));
m_button[AboveButton] = btn; m_button[AboveButton] = btn;
} }
break; break;
case 'B': // BelowButton button case 'B': // BelowButton button
if (!m_button[BelowButton]){ if (!m_button[BelowButton]){
btn = createButton(BelowButton); btn = createButton(BelowButton);
if (!btn) break; if (!btn) break;
bool below = keepBelow(); bool below = keepBelow();
btn->setTipText(below?i18n("Do not keep below others"):i18n("Keep below others") ); btn->setTipText(below?i18n("Do not keep below others"):i18n("Keep below others") );
btn->setToggleButton(true); btn->setToggleButton(true);
btn->setOn( below ); btn->setOn( below );
connect(btn, SIGNAL(clicked()), SLOT(slotKeepBelow())); connect(btn, SIGNAL(clicked()), SLOT(slotKeepBelow()));
m_button[BelowButton] = btn; m_button[BelowButton] = btn;
} }
break; break;
case 'L': // Shade button case 'L': // Shade button
if ((!m_button[ShadeButton]) && isShadeable()){ if ((!m_button[ShadeButton]) && isShadeable()){
btn = createButton(ShadeButton); btn = createButton(ShadeButton);
if (!btn) break; if (!btn) break;
bool shaded = isSetShade(); bool shaded = isSetShade();
btn->setTipText(shaded?i18n("Unshade"):i18n("Shade") ); btn->setTipText(shaded?i18n("Unshade"):i18n("Shade") );
btn->setToggleButton(true); btn->setToggleButton(true);
btn->setOn( shaded ); btn->setOn( shaded );
connect(btn, SIGNAL(clicked()), SLOT(slotShade())); connect(btn, SIGNAL(clicked()), SLOT(slotShade()));
m_button[ShadeButton] = btn; m_button[ShadeButton] = btn;
} }
break; break;
case '_': // Spacer item case '_': // Spacer item
btnContainer.append(0); btnContainer.append(0);
} }

View File

@ -225,7 +225,7 @@ class KWIN_EXPORT KCommonDecoration : public QObject, public KDecorationDefines
* Convenience method. * Convenience method.
* @returns the title rect. * @returns the title rect.
*/ */
QRect titleRect() const; QRect titleRect() const;
public: public:
/** /**

View File

@ -59,7 +59,7 @@ KDecorationOptions* KDecoration::options_;
KDecoration::KDecoration( KDecorationBridge* bridge, KDecorationFactory* factory ) KDecoration::KDecoration( KDecorationBridge* bridge, KDecorationFactory* factory )
: bridge_( bridge ), : bridge_( bridge ),
w_( NULL ), w_( NULL ),
factory_( factory ) factory_( factory )
{ {
factory->addDecoration( this ); factory->addDecoration( this );
@ -417,7 +417,7 @@ QPalette KDecorationOptions::palette(ColorType type, bool active) const
#ifdef __GNUC__ #ifdef __GNUC__
#warning KDE4 : why construct the palette this way? #warning KDE4 : why construct the palette this way?
#endif #endif
// TODO: Is this worth 'porting' to Qt4? // TODO: Is this worth 'porting' to Qt4?
// d->pal[idx] = new QPalette(Qt::black, d->colors[idx], d->colors[idx].light(150), // d->pal[idx] = new QPalette(Qt::black, d->colors[idx], d->colors[idx].light(150),
// d->colors[idx].dark(), d->colors[idx].dark(120), // d->colors[idx].dark(), d->colors[idx].dark(120),
// Qt::black, QApplication::palette().active(). // Qt::black, QApplication::palette().active().

View File

@ -74,11 +74,11 @@ public:
// these values are written to session files, don't change the order // these values are written to session files, don't change the order
enum MaximizeMode enum MaximizeMode
{ {
MaximizeRestore = 0, ///< The window is not maximized in any direction. MaximizeRestore = 0, ///< The window is not maximized in any direction.
MaximizeVertical = 1, ///< The window is maximized vertically. MaximizeVertical = 1, ///< The window is maximized vertically.
MaximizeHorizontal = 2, ///< The window is maximized horizontally. MaximizeHorizontal = 2, ///< The window is maximized horizontally.
/// Equal to @p MaximizeVertical | @p MaximizeHorizontal /// Equal to @p MaximizeVertical | @p MaximizeHorizontal
MaximizeFull = MaximizeVertical | MaximizeHorizontal MaximizeFull = MaximizeVertical | MaximizeHorizontal
}; };
enum WindowOperation enum WindowOperation
@ -113,15 +113,15 @@ public:
* are implemented the color setting for them should be obeyed. * are implemented the color setting for them should be obeyed.
*/ */
enum ColorType enum ColorType
{ {
ColorTitleBar, ///< The color for the titlebar ColorTitleBar, ///< The color for the titlebar
ColorTitleBlend, ///< The blend color for the titlebar ColorTitleBlend, ///< The blend color for the titlebar
ColorFont, ///< The titlebar text color ColorFont, ///< The titlebar text color
ColorButtonBg, ///< The color to use for the titlebar buttons ColorButtonBg, ///< The color to use for the titlebar buttons
ColorFrame, ///< The color for the window frame (border) ColorFrame, ///< The color for the window frame (border)
ColorHandle, ///< The color for the resize handle ColorHandle, ///< The color for the resize handle
NUM_COLORS ///< @internal This value may change, do not use NUM_COLORS ///< @internal This value may change, do not use
}; };
/** /**
* These flags specify which settings changed when rereading settings. * These flags specify which settings changed when rereading settings.
@ -240,59 +240,59 @@ public:
*/ */
QFont font(bool active=true, bool small = false) const; QFont font(bool active=true, bool small = false) const;
/** /**
* Returns @a true if the style should use custom button positions * Returns @a true if the style should use custom button positions
* The changed flags for this setting is SettingButtons. * The changed flags for this setting is SettingButtons.
* *
* @see titleButtonsLeft * @see titleButtonsLeft
* @see titleButtonsRight * @see titleButtonsRight
*/ */
bool customButtonPositions() const; bool customButtonPositions() const;
/** /**
* If customButtonPositions() returns true, titleButtonsLeft * If customButtonPositions() returns true, titleButtonsLeft
* returns which buttons should be on the left side of the titlebar from left * returns which buttons should be on the left side of the titlebar from left
* to right. Characters in the returned string have this meaning : * to right. Characters in the returned string have this meaning :
* @li 'M' menu button * @li 'M' menu button
* @li 'S' on_all_desktops button * @li 'S' on_all_desktops button
* @li 'H' quickhelp button * @li 'H' quickhelp button
* @li 'I' minimize ( iconify ) button * @li 'I' minimize ( iconify ) button
* @li 'A' maximize button * @li 'A' maximize button
* @li 'X' close button * @li 'X' close button
* @li 'F' keep_above_others button * @li 'F' keep_above_others button
* @li 'B' keep_below_others button * @li 'B' keep_below_others button
* @li 'L' shade button * @li 'L' shade button
* @li 'R' resize button * @li 'R' resize button
* @li '_' spacer * @li '_' spacer
* *
* The default ( which is also returned if customButtonPositions returns false ) * The default ( which is also returned if customButtonPositions returns false )
* is "MS". * is "MS".
* Unknown buttons in the returned string must be ignored. * Unknown buttons in the returned string must be ignored.
* The changed flags for this setting is SettingButtons. * The changed flags for this setting is SettingButtons.
*/ */
QString titleButtonsLeft() const; QString titleButtonsLeft() const;
/** /**
* Returns the default left button sequence * Returns the default left button sequence
*/ */
static QString defaultTitleButtonsLeft(); static QString defaultTitleButtonsLeft();
/** /**
* If customButtonPositions() returns true, titleButtonsRight * If customButtonPositions() returns true, titleButtonsRight
* returns which buttons should be on the right side of the titlebar from left * returns which buttons should be on the right side of the titlebar from left
* to right. Characters in the return string have the same meaning like * to right. Characters in the return string have the same meaning like
* in titleButtonsLeft(). * in titleButtonsLeft().
* *
* The default ( which is also returned if customButtonPositions returns false ) * The default ( which is also returned if customButtonPositions returns false )
* is "HIAX". * is "HIAX".
* Unknown buttons in the returned string must be ignored. * Unknown buttons in the returned string must be ignored.
* The changed flags for this setting is SettingButtons. * The changed flags for this setting is SettingButtons.
*/ */
QString titleButtonsRight() const; QString titleButtonsRight() const;
/** /**
* Returns the default right button sequence. * Returns the default right button sequence.
*/ */
static QString defaultTitleButtonsRight(); static QString defaultTitleButtonsRight();
/** /**
* @returns true if the style should use tooltips for window buttons * @returns true if the style should use tooltips for window buttons
* The changed flags for this setting is SettingTooltips. * The changed flags for this setting is SettingTooltips.
*/ */
bool showTooltips() const; bool showTooltips() const;
/** /**
@ -308,11 +308,11 @@ public:
BorderSize preferredBorderSize( KDecorationFactory* factory ) const; BorderSize preferredBorderSize( KDecorationFactory* factory ) const;
/* /*
* When this functions returns false, moving and resizing of maximized windows * When this functions returns false, moving and resizing of maximized windows
* is not allowed, and therefore the decoration is allowed to turn off (some of) * is not allowed, and therefore the decoration is allowed to turn off (some of)
* its borders. * its borders.
* The changed flags for this setting is SettingButtons. * The changed flags for this setting is SettingButtons.
*/ */
bool moveResizeMaximizedWindows() const; bool moveResizeMaximizedWindows() const;
/** /**
@ -359,200 +359,200 @@ class KWIN_EXPORT KDecoration
{ {
Q_OBJECT Q_OBJECT
public: public:
/** /**
* Constructs a KDecoration object. Both the arguments are passed from * Constructs a KDecoration object. Both the arguments are passed from
* KDecorationFactory. Note that the initialization code of the decoration * KDecorationFactory. Note that the initialization code of the decoration
* should be done in the init() method. * should be done in the init() method.
*/ */
KDecoration( KDecorationBridge* bridge, KDecorationFactory* factory ); KDecoration( KDecorationBridge* bridge, KDecorationFactory* factory );
/** /**
* Destroys the KDecoration. * Destroys the KDecoration.
*/ */
virtual ~KDecoration(); virtual ~KDecoration();
// requests from decoration // requests from decoration
/** /**
* Returns the KDecorationOptions object, which is used to access * Returns the KDecorationOptions object, which is used to access
* configuration settings for the decoration. * configuration settings for the decoration.
*/ */
static const KDecorationOptions* options(); static const KDecorationOptions* options();
/** /**
* Returns @a true if the decorated window is currently active. * Returns @a true if the decorated window is currently active.
*/ */
bool isActive() const; bool isActive() const;
/** /**
* Returns @a true if the decoration window can be closed by the user. * Returns @a true if the decoration window can be closed by the user.
*/ */
bool isCloseable() const; bool isCloseable() const;
/** /**
* Returns @a true if the decorated window can be maximized. * Returns @a true if the decorated window can be maximized.
*/ */
bool isMaximizable() const; bool isMaximizable() const;
/** /**
* Returns the current maximization mode of the decorated window. * Returns the current maximization mode of the decorated window.
* Note that only fully maximized windows should be treated * Note that only fully maximized windows should be treated
* as "maximized" (e.g. if the maximize button has only two states). * as "maximized" (e.g. if the maximize button has only two states).
*/ */
MaximizeMode maximizeMode() const; MaximizeMode maximizeMode() const;
/** /**
* Returns @a true if the decorated window can be minimized by the user. * Returns @a true if the decorated window can be minimized by the user.
*/ */
bool isMinimizable() const; bool isMinimizable() const;
/** /**
* Return @a true if the decorated window can show context help * Return @a true if the decorated window can show context help
* (i.e. the decoration should provide the context help button). * (i.e. the decoration should provide the context help button).
*/ */
bool providesContextHelp() const; bool providesContextHelp() const;
/** /**
* Returns the number of the virtual desktop the decorated window * Returns the number of the virtual desktop the decorated window
* is currently on (including NET::OnAllDesktops for being on all * is currently on (including NET::OnAllDesktops for being on all
* desktops). * desktops).
*/ */
int desktop() const; int desktop() const;
/** /**
* Convenience function that returns @a true if the window is on all * Convenience function that returns @a true if the window is on all
* virtual desktops. * virtual desktops.
*/ */
bool isOnAllDesktops() const; // convenience bool isOnAllDesktops() const; // convenience
/** /**
* Returns @a true if the decoration window is modal (usually a modal dialog). * Returns @a true if the decoration window is modal (usually a modal dialog).
*/ */
bool isModal() const; bool isModal() const;
/** /**
* Returns @a true if the decorated window can be shaded. * Returns @a true if the decorated window can be shaded.
*/ */
bool isShadeable() const; bool isShadeable() const;
/** /**
* Returns @a true if the decorated window is currently shaded. * Returns @a true if the decorated window is currently shaded.
* If the window is e.g. hover unshaded, it's not considered to be shaded. * If the window is e.g. hover unshaded, it's not considered to be shaded.
* This function should not be used for the shade titlebar button, use * This function should not be used for the shade titlebar button, use
* @ref isSetShade() instead. * @ref isSetShade() instead.
* *
* @see isSetShade * @see isSetShade
*/ */
bool isShade() const; bool isShade() const;
/** /**
* Returns @a true if the decorated window was set to be shaded. This function * Returns @a true if the decorated window was set to be shaded. This function
* returns also true if the window is e.g. hover unshaded, so it doesn't * returns also true if the window is e.g. hover unshaded, so it doesn't
* always correspond to the actual window state. * always correspond to the actual window state.
* *
* @see isShade * @see isShade
*/ */
bool isSetShade() const; bool isSetShade() const;
/** /**
* Returns @a true if the decorated window should be kept above other windows. * Returns @a true if the decorated window should be kept above other windows.
*/ */
bool keepAbove() const; bool keepAbove() const;
/** /**
* Returns @a true if the decorated window should be kept below other windows. * Returns @a true if the decorated window should be kept below other windows.
*/ */
bool keepBelow() const; bool keepBelow() const;
/** /**
* Returns @a true if the decorated window can be moved by the user. * Returns @a true if the decorated window can be moved by the user.
*/ */
bool isMovable() const; bool isMovable() const;
/** /**
* Returns @a true if the decorated window can be resized by the user. * Returns @a true if the decorated window can be resized by the user.
*/ */
bool isResizable() const; bool isResizable() const;
/** /**
* This function returns the window type of the decorated window. * This function returns the window type of the decorated window.
* The argument to this function is a mask of all window types * The argument to this function is a mask of all window types
* the decoration knows about (as the list of valid window types * the decoration knows about (as the list of valid window types
* is extended over time, and fallback types are specified in order * is extended over time, and fallback types are specified in order
* to support older code). For a description of all window types, * to support older code). For a description of all window types,
* see the definition of the NET::WindowType type. Note that * see the definition of the NET::WindowType type. Note that
* some window types never have decorated windows. * some window types never have decorated windows.
* *
* An example of usage: * An example of usage:
* @code * @code
* const unsigned long supported_types = NET::NormalMask | NET::DesktopMask * const unsigned long supported_types = NET::NormalMask | NET::DesktopMask
* | NET::DockMask | NET::ToolbarMask | NET::MenuMask | NET::DialogMask * | NET::DockMask | NET::ToolbarMask | NET::MenuMask | NET::DialogMask
* | NET::OverrideMask | NET::TopMenuMask | NET::UtilityMask | NET::SplashMask; * | NET::OverrideMask | NET::TopMenuMask | NET::UtilityMask | NET::SplashMask;
* *
* NET::WindowType type = windowType( supported_types ); * NET::WindowType type = windowType( supported_types );
* *
* if( type == NET::Utility || type == NET::Menu || type == NET::Toolbar ) * if( type == NET::Utility || type == NET::Menu || type == NET::Toolbar )
* // ... use smaller decorations for tool window types * // ... use smaller decorations for tool window types
* else * else
* // ... use normal decorations * // ... use normal decorations
* @endcode * @endcode
*/ */
NET::WindowType windowType( unsigned long supported_types ) const; NET::WindowType windowType( unsigned long supported_types ) const;
/** /**
* Returns an icon set with the decorated window's icon. * Returns an icon set with the decorated window's icon.
*/ */
QIcon icon() const; QIcon icon() const;
/** /**
* Returns the decorated window's caption that should be shown in the titlebar. * Returns the decorated window's caption that should be shown in the titlebar.
*/ */
QString caption() const; QString caption() const;
/** /**
* This function invokes the window operations menu. * This function invokes the window operations menu.
* \param pos specifies the place on the screen where the menu should * \param pos specifies the place on the screen where the menu should
* show up. The menu pops up at the bottom-left corner of the specified * show up. The menu pops up at the bottom-left corner of the specified
* rectangle, unless there is no space, in which case the menu is * rectangle, unless there is no space, in which case the menu is
* displayed above the rectangle. * displayed above the rectangle.
* *
* \note Decorations that enable a double-click operation for the menu * \note Decorations that enable a double-click operation for the menu
* button must ensure to call \a showWindowMenu() with the \a pos * button must ensure to call \a showWindowMenu() with the \a pos
* rectangle set to the menu button geometry. * rectangle set to the menu button geometry.
* IMPORTANT: As a result of this function, the decoration object that * IMPORTANT: As a result of this function, the decoration object that
* called it may be destroyed after the function returns. This means * called it may be destroyed after the function returns. This means
* that the decoration object must either return immediately after * that the decoration object must either return immediately after
* calling showWindowMenu(), or it must use * calling showWindowMenu(), or it must use
* KDecorationFactory::exists() to check it's still valid. For example, * KDecorationFactory::exists() to check it's still valid. For example,
* the code handling clicks on the menu button should look similarly * the code handling clicks on the menu button should look similarly
* like this: * like this:
* *
* \code * \code
* KDecorationFactory* f = factory(); // needs to be saved before * KDecorationFactory* f = factory(); // needs to be saved before
* showWindowMenu( button[MenuButton]->mapToGlobal( menuPoint )); * showWindowMenu( button[MenuButton]->mapToGlobal( menuPoint ));
* if( !f->exists( this )) // destroyed, return immediately * if( !f->exists( this )) // destroyed, return immediately
* return; * return;
* button[MenuButton]->setDown(false); * button[MenuButton]->setDown(false);
* \endcode * \endcode
*/ */
void showWindowMenu( const QRect &pos ); void showWindowMenu( const QRect &pos );
/** /**
* Overloaded version of the above. * Overloaded version of the above.
*/ */
void showWindowMenu( QPoint pos ); void showWindowMenu( QPoint pos );
/** /**
* This function performs the given window operation. This function may destroy * This function performs the given window operation. This function may destroy
* the current decoration object, just like showWindowMenu(). * the current decoration object, just like showWindowMenu().
*/ */
void performWindowOperation( WindowOperation op ); void performWindowOperation( WindowOperation op );
/** /**
* If the decoration is non-rectangular, this function needs to be called * If the decoration is non-rectangular, this function needs to be called
* to set the shape of the decoration. * to set the shape of the decoration.
* *
* @param reg The shape of the decoration. * @param reg The shape of the decoration.
* @param mode The X11 values Unsorted, YSorted, YXSorted and YXBanded that specify * @param mode The X11 values Unsorted, YSorted, YXSorted and YXBanded that specify
* the sorting of the rectangles, default value is Unsorted. * the sorting of the rectangles, default value is Unsorted.
*/ */
void setMask( const QRegion& reg, int mode = 0 ); void setMask( const QRegion& reg, int mode = 0 );
/** /**
* This convenience function resets the shape mask. * This convenience function resets the shape mask.
*/ */
void clearMask(); // convenience void clearMask(); // convenience
/** /**
* If this function returns @a true, the decorated window is used as a preview * If this function returns @a true, the decorated window is used as a preview
* e.g. in the configuration module. In such case, the decoration can e.g. * e.g. in the configuration module. In such case, the decoration can e.g.
* show some information in the window area. * show some information in the window area.
*/ */
bool isPreview() const; bool isPreview() const;
/** /**
* Returns the geometry of the decoration. * Returns the geometry of the decoration.
*/ */
QRect geometry() const; QRect geometry() const;
/** /**
* Returns the icon geometry for the window, i.e. the geometry of the taskbar * Returns the icon geometry for the window, i.e. the geometry of the taskbar
* entry. This is used mainly for window minimize animations. Note that * entry. This is used mainly for window minimize animations. Note that
* the geometry may be null. * the geometry may be null.
*/ */
QRect iconGeometry() const; QRect iconGeometry() const;
/** /**
* Returns the intersection of the given region with the region left * Returns the intersection of the given region with the region left
@ -576,28 +576,28 @@ class KWIN_EXPORT KDecoration
* to problems. * to problems.
*/ */
WId windowId() const; WId windowId() const;
/** /**
* Convenience function that returns the width of the decoration. * Convenience function that returns the width of the decoration.
*/ */
int width() const; // convenience int width() const; // convenience
/** /**
* Convenience function that returns the height of the decoration. * Convenience function that returns the height of the decoration.
*/ */
int height() const; // convenience int height() const; // convenience
/** /**
* This function is the default handler for mouse events. All mouse events * This function is the default handler for mouse events. All mouse events
* that are not handled by the decoration itself should be passed to it * that are not handled by the decoration itself should be passed to it
* in order to make work operations like window resizing by dragging borders etc. * in order to make work operations like window resizing by dragging borders etc.
*/ */
void processMousePressEvent( QMouseEvent* e ); void processMousePressEvent( QMouseEvent* e );
// requests to decoration // requests to decoration
/** /**
* This function is called immediately after the decoration object is created. * This function is called immediately after the decoration object is created.
* Due to some technical reasons, initialization should be done here * Due to some technical reasons, initialization should be done here
* instead of in the constructor. * instead of in the constructor.
*/ */
virtual void init() = 0; // called once right after created virtual void init() = 0; // called once right after created
/** /**
@ -605,64 +605,64 @@ class KWIN_EXPORT KDecoration
* Positions at the edge will result in window resizing with mouse button * Positions at the edge will result in window resizing with mouse button
* pressed, center position will result in moving. * pressed, center position will result in moving.
*/ */
virtual Position mousePosition( const QPoint& p ) const = 0; virtual Position mousePosition( const QPoint& p ) const = 0;
/** /**
* This function should return the distance from each window side to the inner * 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 * 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 * 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 * 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. * 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 * 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 * by this function don't match the real values, this may result in drawing errors
* or other problems. * or other problems.
* *
* @see KDecorationOptions::moveResizeMaximizedWindows() * @see KDecorationOptions::moveResizeMaximizedWindows()
*/ */
// mustn't do any repaints, resizes or anything like that // mustn't do any repaints, resizes or anything like that
virtual void borders( int& left, int& right, int& top, int& bottom ) const = 0; virtual void borders( int& left, int& right, int& top, int& bottom ) const = 0;
/** /**
* This method is called by kwin when the style should resize the decoration window. * 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 * The usual implementation is to resize the main widget of the decoration to the
* given size. * given size.
* *
* @param s Specifies the new size of the decoration window. * @param s Specifies the new size of the decoration window.
*/ */
virtual void resize( const QSize& s ) = 0; virtual void resize( const QSize& s ) = 0;
/** /**
* This function should return the minimum required size for the decoration. * 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 * Note that the returned size shouldn't be too large, because it will be
* used to keep the decorated window at least as large. * used to keep the decorated window at least as large.
*/ */
virtual QSize minimumSize() const = 0; virtual QSize minimumSize() const = 0;
/** /**
* This function is called whenever the window either becomes or stops being active. * This function is called whenever the window either becomes or stops being active.
* Use isActive() to find out the current state. * Use isActive() to find out the current state.
*/ */
virtual void activeChange() = 0; virtual void activeChange() = 0;
/** /**
* This function is called whenever the caption changes. Use caption() to get it. * This function is called whenever the caption changes. Use caption() to get it.
*/ */
virtual void captionChange() = 0; virtual void captionChange() = 0;
/** /**
* This function is called whenever the window icon changes. Use icon() to get it. * This function is called whenever the window icon changes. Use icon() to get it.
*/ */
virtual void iconChange() = 0; virtual void iconChange() = 0;
/** /**
* This function is called whenever the maximalization state of the window changes. * This function is called whenever the maximalization state of the window changes.
* Use maximizeMode() to get the current state. * Use maximizeMode() to get the current state.
*/ */
virtual void maximizeChange() = 0; virtual void maximizeChange() = 0;
/** /**
* This function is called whenever the desktop for the window changes. Use * This function is called whenever the desktop for the window changes. Use
* desktop() or isOnAllDesktops() to find out the current desktop * desktop() or isOnAllDesktops() to find out the current desktop
* on which the window is. * on which the window is.
*/ */
virtual void desktopChange() = 0; virtual void desktopChange() = 0;
/** /**
* This function is called whenever the window is shaded or unshaded. Use * This function is called whenever the window is shaded or unshaded. Use
* isShade() to get the current state. * isShade() to get the current state.
*/ */
virtual void shadeChange() = 0; virtual void shadeChange() = 0;
Q_SIGNALS: Q_SIGNALS:
/** /**
@ -674,10 +674,10 @@ class KWIN_EXPORT KDecoration
*/ */
void keepBelowChanged( bool ); void keepBelowChanged( bool );
public: public:
/** /**
* This function may be reimplemented to provide custom bound drawing * This function may be reimplemented to provide custom bound drawing
* for transparent moving or resizing of the window. * for transparent moving or resizing of the window.
* @a False should be returned if the default implementation should be used. * @a False should be returned if the default implementation should be used.
* Note that if you e.g. paint the outline using a 5 pixels wide line, * Note that if you e.g. paint the outline using a 5 pixels wide line,
* you should compensate for the 2 pixels that would make the window * you should compensate for the 2 pixels that would make the window
* look larger. * look larger.
@ -695,68 +695,68 @@ class KWIN_EXPORT KDecoration
* XDrawRectangle( dpy, DefaultRootWindow( dpy ), gc, r.x(), r.y(), r.width(), r.height()); * XDrawRectangle( dpy, DefaultRootWindow( dpy ), gc, r.x(), r.y(), r.width(), r.height());
* XFreeGC( dpy, gc ); * XFreeGC( dpy, gc );
* @endcode * @endcode
* *
* @param geom The geometry at this the bound should be drawn * @param geom The geometry at this the bound should be drawn
* @param clear @a true if the bound should be cleared (when doing the usual XOR * @param clear @a true if the bound should be cleared (when doing the usual XOR
* painting this argument can be simply ignored) * painting this argument can be simply ignored)
* *
* @see geometry() * @see geometry()
*/ */
virtual bool drawbound( const QRect& geom, bool clear ); virtual bool drawbound( const QRect& geom, bool clear );
/** /**
* @internal Reserved. * @internal Reserved.
*/ */
// TODO position will need also values for top+left+bottom etc. docking ? // TODO position will need also values for top+left+bottom etc. docking ?
virtual bool windowDocked( Position side ); virtual bool windowDocked( Position side );
/** /**
* This function is called to reset the decoration on settings changes. * This function is called to reset the decoration on settings changes.
* It is usually invoked by calling KDecorationFactory::resetDecorations(). * It is usually invoked by calling KDecorationFactory::resetDecorations().
* *
* @param changed Specifies which settings were changed, given by the SettingXXX masks * @param changed Specifies which settings were changed, given by the SettingXXX masks
*/ */
virtual void reset( unsigned long changed ); virtual void reset( unsigned long changed );
// special // special
/** /**
* This should be the first function called in init() to specify * This should be the first function called in init() to specify
* the main widget of the decoration. The widget should be created * the main widget of the decoration. The widget should be created
* with parent specified by initialParentWidget() and flags * with parent specified by initialParentWidget() and flags
* specified by initialWFlags(). * specified by initialWFlags().
*/ */
void setMainWidget( QWidget* ); void setMainWidget( QWidget* );
/** /**
* Convenience functions that creates and sets a main widget as necessary. * Convenience functions that creates and sets a main widget as necessary.
* In such case, it's usually needed to install an event filter * In such case, it's usually needed to install an event filter
* on the main widget to receive important events on it. * on the main widget to receive important events on it.
* *
* @param flags Additional widget flags for the main widget. Note that only * @param flags Additional widget flags for the main widget. Note that only
* flags that affect widget drawing are allowed. Window type flags * flags that affect widget drawing are allowed. Window type flags
* like WX11BypassWM or WStyle_NoBorder are forbidden. * like WX11BypassWM or WStyle_NoBorder are forbidden.
*/ */
void createMainWidget( Qt::WFlags flags = 0 ); void createMainWidget( Qt::WFlags flags = 0 );
/** /**
* The parent widget that should be used for the main widget. * The parent widget that should be used for the main widget.
*/ */
QWidget* initialParentWidget() const; QWidget* initialParentWidget() const;
/** /**
* The flags that should be used when creating the main widget. * The flags that should be used when creating the main widget.
* It is possible to add more flags when creating the main widget, but only flags * It is possible to add more flags when creating the main widget, but only flags
* that affect widget drawing are allowed. Window type flags like WX11BypassWM * that affect widget drawing are allowed. Window type flags like WX11BypassWM
* or WStyle_NoBorder are forbidden. * or WStyle_NoBorder are forbidden.
*/ */
Qt::WFlags initialWFlags() const; Qt::WFlags initialWFlags() const;
/** /**
* Returns the main widget for the decoration. * Returns the main widget for the decoration.
*/ */
QWidget* widget(); QWidget* widget();
/** /**
* Returns the main widget for the decoration. * Returns the main widget for the decoration.
*/ */
const QWidget* widget() const; const QWidget* widget() const;
/** /**
* Returns the factory that created this decoration. * Returns the factory that created this decoration.
*/ */
KDecorationFactory* factory() const; KDecorationFactory* factory() const;
/** /**
* Performs X server grab. It is safe to call it several times in a row. * Performs X server grab. It is safe to call it several times in a row.
@ -767,70 +767,70 @@ class KWIN_EXPORT KDecoration
*/ */
void ungrabXServer(); void ungrabXServer();
public Q_SLOTS: public Q_SLOTS:
// requests from decoration // requests from decoration
/** /**
* This function can be called by the decoration to request * This function can be called by the decoration to request
* closing of the decorated window. Note that closing the window * closing of the decorated window. Note that closing the window
* also involves destroying the decoration. * also involves destroying the decoration.
* IMPORTANT: This function may destroy the current decoration object, * IMPORTANT: This function may destroy the current decoration object,
* just like showWindowMenu(). * just like showWindowMenu().
*/ */
void closeWindow(); void closeWindow();
/* /**
* Changes the maximize mode of the decorated window. This function should * Changes the maximize mode of the decorated window. This function should
* be preferred to the other maximize() overload for reacting on clicks * be preferred to the other maximize() overload for reacting on clicks
* on the maximize titlebar button. * on the maximize titlebar button.
*/ */
void maximize( Qt::MouseButtons button ); void maximize( Qt::MouseButtons button );
/** /**
* Set the maximize mode of the decorated window. * Set the maximize mode of the decorated window.
* @param mode The maximization mode to be set. * @param mode The maximization mode to be set.
*/ */
void maximize( MaximizeMode mode ); void maximize( MaximizeMode mode );
/** /**
* Minimize the decorated window. * Minimize the decorated window.
*/ */
void minimize(); void minimize();
/** /**
* Start showing context help in the window (i.e. the mouse will enter * Start showing context help in the window (i.e. the mouse will enter
* the what's this mode). * the what's this mode).
*/ */
void showContextHelp(); void showContextHelp();
/** /**
* Moves the window to the given desktop. Use NET::OnAllDesktops for making * Moves the window to the given desktop. Use NET::OnAllDesktops for making
* the window appear on all desktops. * the window appear on all desktops.
*/ */
void setDesktop( int desktop ); void setDesktop( int desktop );
/** /**
* This function toggles the on-all-desktops state of the decorated window. * This function toggles the on-all-desktops state of the decorated window.
*/ */
void toggleOnAllDesktops(); // convenience void toggleOnAllDesktops(); // convenience
/** /**
* This function performs the operation configured as titlebar double click * This function performs the operation configured as titlebar double click
* operation. * operation.
*/ */
void titlebarDblClickOperation(); void titlebarDblClickOperation();
/** /**
* This function performs the operation configured as titlebar wheel mouse * This function performs the operation configured as titlebar wheel mouse
* operation. * operation.
* @param delta the mouse wheel delta * @param delta the mouse wheel delta
*/ */
void titlebarMouseWheelOperation( int delta ); void titlebarMouseWheelOperation( int delta );
/** /**
* Shades or unshades the decorated window. * Shades or unshades the decorated window.
* @param set Whether the window should be shaded * @param set Whether the window should be shaded
*/ */
void setShade( bool set ); void setShade( bool set );
/** /**
* Sets or reset keeping this window above others. * Sets or reset keeping this window above others.
* @param set Whether to keep the window above others * @param set Whether to keep the window above others
*/ */
void setKeepAbove( bool set ); void setKeepAbove( bool set );
/** /**
* Sets or reset keeping this window below others. * Sets or reset keeping this window below others.
* @param set Whether to keep the window below others * @param set Whether to keep the window below others
*/ */
void setKeepBelow( bool set ); void setKeepBelow( bool set );
/** /**
* @internal * @internal
@ -841,8 +841,8 @@ class KWIN_EXPORT KDecoration
*/ */
void emitKeepBelowChanged( bool below ); void emitKeepBelowChanged( bool below );
private: private:
KDecorationBridge* bridge_; KDecorationBridge* bridge_;
QWidget* w_; QWidget* w_;
KDecorationFactory* factory_; KDecorationFactory* factory_;
friend class KDecorationOptions; // for options_ friend class KDecorationOptions; // for options_
static KDecorationOptions* options_; static KDecorationOptions* options_;

View File

@ -43,12 +43,12 @@ DEALINGS IN THE SOFTWARE.
class KDecorationBridge : public KDecorationDefines class KDecorationBridge : public KDecorationDefines
{ {
public: public:
virtual ~KDecorationBridge(){} virtual ~KDecorationBridge(){}
virtual bool isActive() const = 0; virtual bool isActive() const = 0;
virtual bool isCloseable() const = 0; virtual bool isCloseable() const = 0;
virtual bool isMaximizable() const = 0; virtual bool isMaximizable() const = 0;
virtual MaximizeMode maximizeMode() const = 0; virtual MaximizeMode maximizeMode() const = 0;
virtual bool isMinimizable() const = 0; virtual bool isMinimizable() const = 0;
virtual bool providesContextHelp() const = 0; virtual bool providesContextHelp() const = 0;
virtual int desktop() const = 0; virtual int desktop() const = 0;
virtual bool isModal() const = 0; virtual bool isModal() const = 0;
@ -60,21 +60,21 @@ class KDecorationBridge : public KDecorationDefines
virtual bool isMovable() const = 0; virtual bool isMovable() const = 0;
virtual bool isResizable() const = 0; virtual bool isResizable() const = 0;
virtual NET::WindowType windowType( unsigned long supported_types ) const = 0; virtual NET::WindowType windowType( unsigned long supported_types ) const = 0;
virtual QIcon icon() const = 0; virtual QIcon icon() const = 0;
virtual QString caption() const = 0; virtual QString caption() const = 0;
virtual void processMousePressEvent( QMouseEvent* ) = 0; virtual void processMousePressEvent( QMouseEvent* ) = 0;
virtual void showWindowMenu( const QRect &) = 0; virtual void showWindowMenu( const QRect &) = 0;
virtual void showWindowMenu( const QPoint & ) = 0; virtual void showWindowMenu( const QPoint & ) = 0;
virtual void performWindowOperation( WindowOperation ) = 0; virtual void performWindowOperation( WindowOperation ) = 0;
virtual void setMask( const QRegion&, int ) = 0; virtual void setMask( const QRegion&, int ) = 0;
virtual bool isPreview() const = 0; virtual bool isPreview() const = 0;
virtual QRect geometry() const = 0; virtual QRect geometry() const = 0;
virtual QRect iconGeometry() const = 0; virtual QRect iconGeometry() const = 0;
virtual QRegion unobscuredRegion( const QRegion& r ) const = 0; virtual QRegion unobscuredRegion( const QRegion& r ) const = 0;
virtual WId windowId() const = 0; virtual WId windowId() const = 0;
virtual void closeWindow() = 0; virtual void closeWindow() = 0;
virtual void maximize( MaximizeMode mode ) = 0; virtual void maximize( MaximizeMode mode ) = 0;
virtual void minimize() = 0; virtual void minimize() = 0;
virtual void showContextHelp() = 0; virtual void showContextHelp() = 0;
virtual void setDesktop( int desktop ) = 0; virtual void setDesktop( int desktop ) = 0;
virtual void titlebarDblClickOperation() = 0; virtual void titlebarDblClickOperation() = 0;

View File

@ -38,31 +38,31 @@ class KWIN_EXPORT KDecorationFactory
: public KDecorationDefines : public KDecorationDefines
{ {
public: public:
/** /**
* Constructor. Called after loading the decoration plugin. All global * Constructor. Called after loading the decoration plugin. All global
* initialization of the plugin should be done in the factory constructor. * initialization of the plugin should be done in the factory constructor.
*/ */
KDecorationFactory(); KDecorationFactory();
/** /**
* Destructor. Called before unloading the decoration plugin. All global * Destructor. Called before unloading the decoration plugin. All global
* cleanup of the plugin should be done in the factory destructor. * cleanup of the plugin should be done in the factory destructor.
*/ */
virtual ~KDecorationFactory(); virtual ~KDecorationFactory();
/** /**
* This function must be reimplemented to create decoration objects. * This function must be reimplemented to create decoration objects.
* The argument should be passed to the KDecoration constructor, the second * The argument should be passed to the KDecoration constructor, the second
* KDecoration argument should be this factory object. * KDecoration argument should be this factory object.
*/ */
virtual KDecoration* createDecoration( KDecorationBridge* bridge ) = 0; virtual KDecoration* createDecoration( KDecorationBridge* bridge ) = 0;
/** /**
* This function is called when the configuration settings changed. * This function is called when the configuration settings changed.
* The argument specifies what has changed, using the SettingXXX masks. * The argument specifies what has changed, using the SettingXXX masks.
* It should be determined whether the decorations need to be completely * It should be determined whether the decorations need to be completely
* remade, in which case true should be returned, or whether only e.g. * remade, in which case true should be returned, or whether only e.g.
* a repaint will be sufficient, in which case false should be returned, * a repaint will be sufficient, in which case false should be returned,
* and resetDecorations() can be called to reset all decoration objects. * and resetDecorations() can be called to reset all decoration objects.
* Note that true should be returned only when really necessary. * Note that true should be returned only when really necessary.
*/ */
virtual bool reset( unsigned long changed ); // returns true if the decoration needs to be recreated virtual bool reset( unsigned long changed ); // returns true if the decoration needs to be recreated
/** /**
@ -76,10 +76,10 @@ class KWIN_EXPORT KDecorationFactory
virtual bool supports( Ability ability ) const = 0; virtual bool supports( Ability ability ) const = 0;
virtual void checkRequirements( KDecorationProvides* provides ); virtual void checkRequirements( KDecorationProvides* provides );
/** /**
* Returns the KDecorationOptions object, which is used to access * Returns the KDecorationOptions object, which is used to access
* configuration settings for the decoration. * configuration settings for the decoration.
*/ */
const KDecorationOptions* options(); // convenience const KDecorationOptions* options(); // convenience
/** /**
* Returns true if the given decoration object still exists. This is necessary * Returns true if the given decoration object still exists. This is necessary
@ -97,10 +97,10 @@ class KWIN_EXPORT KDecorationFactory
*/ */
void removeDecoration( KDecoration* ); void removeDecoration( KDecoration* );
protected: protected:
/** /**
* Convenience function that calls KDecoration::reset() for all decoration * Convenience function that calls KDecoration::reset() for all decoration
* objects. * objects.
*/ */
void resetDecorations( unsigned long changed ); // convenience void resetDecorations( unsigned long changed ); // convenience
/** /**
* This function has the same functionality like KDecoration::windowType(). * This function has the same functionality like KDecoration::windowType().