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

twin/lib

  • twin
  • lib
kdecoration.h
1/*****************************************************************
2This file is part of the KDE project.
3
4Copyright (C) 2003 Lubos Lunak <l.lunak@kde.org>
5
6Permission is hereby granted, free of charge, to any person obtaining a
7copy of this software and associated documentation files (the "Software"),
8to deal in the Software without restriction, including without limitation
9the rights to use, copy, modify, merge, publish, distribute, sublicense,
10and/or sell copies of the Software, and to permit persons to whom the
11Software is furnished to do so, subject to the following conditions:
12
13The above copyright notice and this permission notice shall be included in
14all copies or substantial portions of the Software.
15
16THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
17IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
18FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
19THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
20LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
21FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
22DEALINGS IN THE SOFTWARE.
23******************************************************************/
24
25#ifndef KDECORATION_H
26#define KDECORATION_H
27
28#include <tqcolor.h>
29#include <tqfont.h>
30#include <tqobject.h>
31#include <tqiconset.h>
32#include <netwm_def.h>
33#include <tdeversion.h>
34
35class KDecorationOptionsPrivate;
36class KDecorationBridge;
37class KDecorationPrivate;
38class KDecorationFactory;
39
40#define KWIN_EXPORT TDE_EXPORT
41
47class KWIN_EXPORT KDecorationDefines
48{
49public:
53 enum Position
54 { // without prefix, they'd conflict with TQt::TopLeft etc. :(
55 PositionCenter = 0x00,
56 PositionLeft = 0x01,
57 PositionRight = 0x02,
58 PositionTop = 0x04,
59 PositionBottom = 0x08,
60 PositionTopLeft = PositionLeft | PositionTop,
61 PositionTopRight = PositionRight | PositionTop,
62 PositionBottomLeft = PositionLeft | PositionBottom,
63 PositionBottomRight = PositionRight | PositionBottom
64 };
68 // these values are written to session files, don't change the order
69 enum MaximizeMode
70 {
71 MaximizeRestore = 0,
72 MaximizeVertical = 1,
73 MaximizeHorizontal = 2,
75 MaximizeFull = MaximizeVertical | MaximizeHorizontal
76 };
77
78 enum WindowOperation
79 {
80 MaximizeOp = 5000,
81 RestoreOp,
82 MinimizeOp,
83 MoveOp,
84 UnrestrictedMoveOp,
85 ResizeOp,
86 UnrestrictedResizeOp,
87 CloseOp,
88 OnAllDesktopsOp,
89 ShadeOp,
90 KeepAboveOp,
91 KeepBelowOp,
92 OperationsOp,
93 WindowRulesOp,
94 ToggleStoreSettingsOp = WindowRulesOp,
95 HMaximizeOp,
96 VMaximizeOp,
97 LowerOp,
98 FullScreenOp,
99 NoBorderOp,
100 NoOp,
101 SetupWindowShortcutOp,
102 ApplicationRulesOp,
103 ShadowOp,
104 SuspendWindowOp,
105 ResumeWindowOp
106 };
112 enum ColorType
113 {
114 ColorTitleBar,
115 ColorTitleBlend,
116 ColorFont,
117 ColorButtonBg,
118 ColorFrame,
119 ColorHandle,
120 NUM_COLORS
121 };
122
127 enum
128 {
129 SettingDecoration = 1 << 0,
130 SettingColors = 1 << 1,
131 SettingFont = 1 << 2,
132 SettingButtons = 1 << 3,
133 SettingTooltips = 1 << 4,
134 SettingBorder = 1 << 5
135 };
136
141 enum BorderSize
142 {
143 BorderTiny,
144 BorderNormal,
145 BorderLarge,
146 BorderVeryLarge,
147 BorderHuge,
148 BorderVeryHuge,
149 BorderOversized,
150 BordersCount
151 };
152
157 enum Ability
158 {
159 AbilityAnnounceButtons = 0,
160 AbilityButtonMenu = 1000,
161 AbilityButtonOnAllDesktops = 1001,
162 AbilityButtonSpacer = 1002,
163 AbilityButtonHelp = 1003,
164 AbilityButtonMinimize = 1004,
165 AbilityButtonMaximize = 1005,
166 AbilityButtonClose = 1006,
167 AbilityButtonAboveOthers = 1007,
168 AbilityButtonBelowOthers = 1008,
169 AbilityButtonShade = 1009,
170 AbilityButtonResize = 1010,
171 ABILITY_DUMMY = 10000000
172 };
173
174 enum Requirement { REQUIREMENT_DUMMY = 1000000 };
175};
176
177class KDecorationProvides
178 : public KDecorationDefines
179 {
180 public:
181 virtual bool provides( Requirement req ) = 0;
182 };
183
190class KWIN_EXPORT KDecorationOptions : public KDecorationDefines
191 {
192public:
193 KDecorationOptions();
194 virtual ~KDecorationOptions();
202 const TQColor& color(ColorType type, bool active=true) const;
210 const TQColorGroup& colorGroup(ColorType type, bool active=true) const;
218 const TQFont& font(bool active=true, bool small = false) const;
226 bool customButtonPositions() const;
248 TQString titleButtonsLeft() const;
260 TQString titleButtonsRight() const;
261
266 bool showTooltips() const;
267
278 BorderSize preferredBorderSize( KDecorationFactory* factory ) const;
279
280 /*
281 * When this functions returns false, moving and resizing of maximized windows
282 * is not allowed, and therefore the decoration is allowed to turn off (some of)
283 * its borders.
284 * The changed flags for this setting is SettingButtons.
285 */
286 bool moveResizeMaximizedWindows() const;
287
291 WindowOperation operationMaxButtonClick( TQt::ButtonState button ) const;
292
296 virtual unsigned long updateSettings() = 0; // returns SettingXYZ mask
297
298protected:
302 KDecorationOptionsPrivate* d;
303 };
304
305
313class KWIN_EXPORT KDecoration
314 : public TQObject, public KDecorationDefines
315 {
316 TQ_OBJECT
317 public:
323 KDecoration( KDecorationBridge* bridge, KDecorationFactory* factory );
327 virtual ~KDecoration();
328
329 // requests from decoration
330
335 static const KDecorationOptions* options();
339 bool isActive() const;
343 bool isCloseable() const;
347 bool isMaximizable() const;
353 MaximizeMode maximizeMode() const;
357 bool isMinimizable() const;
362 bool providesContextHelp() const;
368 int desktop() const;
373 bool isOnAllDesktops() const; // convenience
377 bool isModal() const;
381 bool isShadeable() const;
390 bool isShade() const;
398 bool isSetShade() const;
402 bool keepAbove() const;
406 bool keepBelow() const;
410 bool isMovable() const;
414 bool isResizable() const;
438 NET::WindowType windowType( unsigned long supported_types ) const;
442 TQIconSet icon() const;
446 TQString caption() const;
473 void showWindowMenu( const TQRect &pos );
474
478 void showWindowMenu( TQPoint pos );
483 void performWindowOperation( WindowOperation op );
492 void setMask( const TQRegion& reg, int mode = 0 );
496 void clearMask(); // convenience
502 bool isPreview() const;
506 TQRect geometry() const;
512 TQRect iconGeometry() const;
521 TQRegion unobscuredRegion( const TQRegion& r ) const;
526 TQWidget* workspaceWidget() const;
540 WId windowId() const;
544 int width() const; // convenience
548 int height() const; // convenience
554 void processMousePressEvent( TQMouseEvent* e );
555
556 // requests to decoration
557
563 virtual void init() = 0; // called once right after created
564
570 virtual Position mousePosition( const TQPoint& p ) const = 0;
571
584 // mustn't do any repaints, resizes or anything like that
585 virtual void borders( int& left, int& right, int& top, int& bottom ) const = 0;
593 virtual void resize( const TQSize& s ) = 0;
599 virtual TQSize minimumSize() const = 0;
604 virtual void activeChange() = 0;
608 virtual void captionChange() = 0;
612 virtual void iconChange() = 0;
617 virtual void maximizeChange() = 0;
623 virtual void desktopChange() = 0;
628 virtual void shadeChange() = 0;
629#if KDE_IS_VERSION( 3, 90, 0 )
630#warning Redo all the XYZChange() virtuals as signals.
631#endif
632 signals:
637 void keepAboveChanged( bool );
642 void keepBelowChanged( bool );
643 public:
657 virtual bool drawbound( const TQRect& geom, bool clear );
668 virtual bool animateMinimize( bool minimize );
672 // TODO position will need also values for top+left+bottom etc. docking ?
673 virtual bool windowDocked( Position side );
680 virtual void reset( unsigned long changed );
681
682 // special
683
690 void setMainWidget( TQWidget* );
700 void createMainWidget( TQt::WFlags flags = 0 );
704 TQWidget* initialParentWidget() const;
711 TQt::WFlags initialWFlags() const;
718 void helperShowHide( bool show );
722 TQWidget* widget();
726 const TQWidget* widget() const;
730 KDecorationFactory* factory() const;
734 void grabXServer();
738 void ungrabXServer();
739 public slots:
740 // requests from decoration
741
749 void closeWindow();
750 /*
751 * Changes the maximize mode of the decorated window. This function should
752 * be preferred to the other maximize() overload for reacting on clicks
753 * on the maximize titlebar button.
754 * NOTE: This function is new in KDE3.3. In order to support also KDE3.2,
755 * it is recommended to use code like this:
756 * \code
757 * ButtonState button = ... ;
758 * #if KDE_IS_VERSION( 3, 3, 0 )
759 * maximize( button );
760 * #else
761 * if( button == MidButton )
762 * maximize( maximizeMode() ^ MaximizeVertical );
763 * else if( button == RightButton )
764 * maximize( maximizeMode() ^ MaximizeHorizontal );
765 * else
766 * maximize( maximizeMode() == MaximizeFull ? MaximizeRestore : MaximizeFull );
767 * #endif
768 * \endcode
769 * @since 3.3
770 */
771#if KDE_IS_VERSION( 3, 90, 0 )
772#warning Update the docs.
773#endif
774 void maximize( ButtonState button );
779 void maximize( MaximizeMode mode );
783 void minimize();
788 void showContextHelp();
793 void setDesktop( int desktop );
797 void toggleOnAllDesktops(); // convenience
802 void titlebarDblClickOperation();
809 void titlebarMouseWheelOperation( int delta );
814 void setShade( bool set );
819 void setKeepAbove( bool set );
824 void setKeepBelow( bool set );
828 void emitKeepAboveChanged( bool above ) { emit keepAboveChanged( above ); }
832 void emitKeepBelowChanged( bool below ) { emit keepBelowChanged( below ); }
833 private:
834 KDecorationBridge* bridge_;
835 TQWidget* w_;
836 KDecorationFactory* factory_;
837 friend class KDecorationOptions; // for options_
838 static KDecorationOptions* options_;
839 KDecorationPrivate* d;
840 };
841
842inline
843KDecorationDefines::MaximizeMode operator^( KDecorationDefines::MaximizeMode m1, KDecorationDefines::MaximizeMode m2 )
844 {
845 return KDecorationDefines::MaximizeMode( int(m1) ^ int(m2) );
846 }
847
848inline
849KDecorationDefines::MaximizeMode operator&( KDecorationDefines::MaximizeMode m1, KDecorationDefines::MaximizeMode m2 )
850 {
851 return KDecorationDefines::MaximizeMode( int(m1) & int(m2) );
852 }
853
854inline
855KDecorationDefines::MaximizeMode operator|( KDecorationDefines::MaximizeMode m1, KDecorationDefines::MaximizeMode m2 )
856 {
857 return KDecorationDefines::MaximizeMode( int(m1) | int(m2) );
858 }
859
860inline TQWidget* KDecoration::widget()
861 {
862 return w_;
863 }
864
865inline const TQWidget* KDecoration::widget() const
866 {
867 return w_;
868 }
869
870inline KDecorationFactory* KDecoration::factory() const
871 {
872 return factory_;
873 }
874
875inline bool KDecoration::isOnAllDesktops() const
876 {
877 return desktop() == NET::OnAllDesktops;
878 }
879
880inline int KDecoration::width() const
881 {
882 return geometry().width();
883 }
884
885inline int KDecoration::height() const
886 {
887 return geometry().height();
888 }
889
890#endif
KDecorationDefines
This class provides a namespace for all decoration related classes.
Definition: kdecoration.h:48
KDecorationDefines::WindowOperation
WindowOperation
Definition: kdecoration.h:79
KDecorationDefines::SuspendWindowOp
@ SuspendWindowOp
Definition: kdecoration.h:104
KDecorationDefines::ShadowOp
@ ShadowOp
Definition: kdecoration.h:103
KDecorationDefines::ApplicationRulesOp
@ ApplicationRulesOp
Definition: kdecoration.h:102
KDecorationDefines::Position
Position
These values represent positions inside an area.
Definition: kdecoration.h:54
KDecorationDefines::ColorType
ColorType
Basic color types that should be recognized by all decoration styles.
Definition: kdecoration.h:113
KDecorationDefines::ColorTitleBar
@ ColorTitleBar
The color for the titlebar.
Definition: kdecoration.h:114
KDecorationDefines::ColorButtonBg
@ ColorButtonBg
The color to use for the titlebar buttons.
Definition: kdecoration.h:117
KDecorationDefines::ColorFont
@ ColorFont
The titlebar text color.
Definition: kdecoration.h:116
KDecorationDefines::ColorFrame
@ ColorFrame
The color for the window frame (border)
Definition: kdecoration.h:118
KDecorationDefines::ColorTitleBlend
@ ColorTitleBlend
The blend color for the titlebar.
Definition: kdecoration.h:115
KDecorationDefines::ColorHandle
@ ColorHandle
The color for the resize handle.
Definition: kdecoration.h:119
KDecorationDefines::Ability
Ability
Used to find out which features the decoration supports.
Definition: kdecoration.h:158
KDecorationDefines::MaximizeMode
MaximizeMode
Maximize mode.
Definition: kdecoration.h:70
KDecorationDefines::BorderSize
BorderSize
Border size.
Definition: kdecoration.h:142
KDecorationDefines::BorderVeryHuge
@ BorderVeryHuge
Very huge borders.
Definition: kdecoration.h:148
KDecorationDefines::BorderOversized
@ BorderOversized
Oversized borders.
Definition: kdecoration.h:149
KDecorationDefines::BorderHuge
@ BorderHuge
Huge borders.
Definition: kdecoration.h:147
KDecorationDefines::BorderVeryLarge
@ BorderVeryLarge
Very large borders.
Definition: kdecoration.h:146
KDecorationDefines::BorderTiny
@ BorderTiny
Minimal borders.
Definition: kdecoration.h:143
KDecorationDefines::BorderNormal
@ BorderNormal
Standard size borders, the default setting.
Definition: kdecoration.h:144
KDecorationDefines::BorderLarge
@ BorderLarge
Larger borders.
Definition: kdecoration.h:145
KDecorationOptions
This class holds various configuration settings for the decoration.
Definition: kdecoration.h:191
KDecoration
This is the base class for a decoration object.
Definition: kdecoration.h:315
KDecoration::iconChange
virtual void iconChange()=0
This function is called whenever the window icon changes.
KDecoration::desktopChange
virtual void desktopChange()=0
This function is called whenever the desktop for the window changes.
KDecoration::resize
virtual void resize(const TQSize &s)=0
This method is called by twin when the style should resize the decoration window.
KDecoration::init
virtual void init()=0
This function is called immediately after the decoration object is created.
KDecoration::geometry
TQRect geometry() const
Returns the geometry of the decoration.
Definition: kdecoration.cpp:209
KDecoration::captionChange
virtual void captionChange()=0
This function is called whenever the caption changes.
KDecoration::height
int height() const
Convenience function that returns the height of the decoration.
Definition: kdecoration.h:885
KDecoration::widget
TQWidget * widget()
Returns the main widget for the decoration.
Definition: kdecoration.h:860
KDecoration::factory
KDecorationFactory * factory() const
Returns the factory that created this decoration.
Definition: kdecoration.h:870
KDecoration::shadeChange
virtual void shadeChange()=0
This function is called whenever the window is shaded or unshaded.
KDecoration::maximizeChange
virtual void maximizeChange()=0
This function is called whenever the maximalization state of the window changes.
KDecoration::activeChange
virtual void activeChange()=0
This function is called whenever the window either becomes or stops being active.
KDecoration::desktop
int desktop() const
Returns the number of the virtual desktop the decorated window is currently on (including NET::OnAllD...
Definition: kdecoration.cpp:114
KDecoration::keepBelowChanged
void keepBelowChanged(bool)
This signal is emitted whenever the window's keep-below state changes.
KDecoration::keepAboveChanged
void keepAboveChanged(bool)
This signal is emitted whenever the window's keep-above state changes.
KDecoration::isOnAllDesktops
bool isOnAllDesktops() const
Convenience function that returns true if the window is on all virtual desktops.
Definition: kdecoration.h:875
KDecoration::width
int width() const
Convenience function that returns the width of the decoration.
Definition: kdecoration.h:880
KDecoration::borders
virtual void borders(int &left, int &right, int &top, int &bottom) const =0
This function should return the distance from each window side to the inner window.
KDecoration::minimumSize
virtual TQSize minimumSize() const =0
This function should return the minimum required size for the decoration.

twin/lib

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

twin/lib

Skip menu "twin/lib"
  • kate
  • libkonq
  • twin
  •   lib
Generated for twin/lib by doxygen 1.9.4
This website is maintained by Timothy Pearson.