~ubuntu-branches/ubuntu/utopic/kde-workspace/utopic-proposed

« back to all changes in this revision

Viewing changes to kwin/clients/oxygen/oxygenconfiguration.h

  • Committer: Bazaar Package Importer
  • Author(s): Michał Zając
  • Date: 2011-07-09 08:31:15 UTC
  • Revision ID: james.westby@ubuntu.com-20110709083115-ohyxn6z93mily9fc
Tags: upstream-4.6.90
Import upstream version 4.6.90

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
#ifndef oxygenconfiguration_h
 
2
#define oxygenconfiguration_h
 
3
 
 
4
//////////////////////////////////////////////////////////////////////////////
 
5
// oxygenconfiguration.h
 
6
// decoration configuration
 
7
// -------------------
 
8
//
 
9
// Copyright (c) 2009 Hugo Pereira Da Costa <hugo.pereira@free.fr>
 
10
//
 
11
// Permission is hereby granted, free of charge, to any person obtaining a copy
 
12
// of this software and associated documentation files (the "Software"), to
 
13
// deal in the Software without restriction, including without limitation the
 
14
// rights to use, copy, modify, merge, publish, distribute, sublicense, and/or
 
15
// sell copies of the Software, and to permit persons to whom the Software is
 
16
// furnished to do so, subject to the following conditions:
 
17
//
 
18
// The above copyright notice and this permission notice shall be included in
 
19
// all copies or substantial portions of the Software.
 
20
//
 
21
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
 
22
// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
 
23
// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
 
24
// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
 
25
// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
 
26
// FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS
 
27
// IN THE SOFTWARE.
 
28
//////////////////////////////////////////////////////////////////////////////
 
29
 
 
30
#include <KConfigGroup>
 
31
 
 
32
namespace OxygenConfig
 
33
{
 
34
 
 
35
    static const QString TITLE_ALIGNMENT = "TitleAlignment";
 
36
    static const QString CENTER_TITLE_ON_FULL_WIDTH = "CenterTitleOnFullWidth";
 
37
    static const QString BUTTON_SIZE = "ButtonSize";
 
38
    static const QString DRAW_SEPARATOR = "DrawSeparator";
 
39
    static const QString SEPARATOR_ACTIVE_ONLY = "SeparatorActiveOnly";
 
40
    static const QString DRAW_TITLE_OUTLINE = "DrawTitleOutline";
 
41
    static const QString FRAME_BORDER = "FrameBorder";
 
42
    static const QString BLEND_COLOR = "BlendColor";
 
43
    static const QString SIZE_GRIP_MODE = "SizeGripMode";
 
44
    static const QString HIDE_TITLEBAR = "HideTitleBar";
 
45
    static const QString USE_ANIMATIONS = "UseAnimations";
 
46
    static const QString ANIMATE_TITLE_CHANGE = "AnimateTitleChange";
 
47
    static const QString TABS_ENABLED = "TabsEnabled";
 
48
    static const QString NARROW_BUTTON_SPACING = "UseNarrowButtonSpacing";
 
49
}
 
50
 
 
51
namespace Oxygen
 
52
{
 
53
 
 
54
    // forward declaration
 
55
    class Exception;
 
56
 
 
57
    //! stores all configuration options needed for decoration appearance
 
58
    class Configuration
 
59
    {
 
60
 
 
61
        public:
 
62
 
 
63
        //! button size enumeration
 
64
        enum ButtonSize {
 
65
            ButtonSmall = 18,
 
66
            ButtonDefault = 20,
 
67
            ButtonLarge = 24,
 
68
            ButtonVeryLarge = 32,
 
69
            ButtonHuge = 48
 
70
        };
 
71
 
 
72
        //! frame border enumeration
 
73
        enum FrameBorder {
 
74
            BorderNone = 0,
 
75
            BorderNoSide = 1,
 
76
            BorderTiny = 2,
 
77
            BorderDefault = 4,
 
78
            BorderLarge = 8,
 
79
            BorderVeryLarge = 12,
 
80
            BorderHuge = 18,
 
81
            BorderVeryHuge = 27,
 
82
            BorderOversized = 40
 
83
        };
 
84
 
 
85
        //! blend color enumeration
 
86
        enum BlendColorType {
 
87
            NoBlending,
 
88
            RadialBlending,
 
89
            BlendFromStyle
 
90
        };
 
91
 
 
92
        //! size grip mode
 
93
        enum SizeGripMode {
 
94
            SizeGripNever,
 
95
            SizeGripWhenNeeded
 
96
        };
 
97
 
 
98
        //! shadow cache mode
 
99
        enum ShadowCacheMode {
 
100
            //! no shadow cache
 
101
            CacheDisabled,
 
102
 
 
103
            //! shadow cache depends on animation duration
 
104
            CacheVariable,
 
105
 
 
106
            //! shadow cache has maximum size
 
107
            CacheMaximum
 
108
        };
 
109
 
 
110
        //! decide when separator is to be drawn
 
111
        enum SeparatorMode {
 
112
 
 
113
            //! never
 
114
            SeparatorNever,
 
115
 
 
116
            //! active window only
 
117
            SeparatorActive,
 
118
 
 
119
            //! always
 
120
            SeparatorAlways
 
121
 
 
122
        };
 
123
 
 
124
        //! default constructor
 
125
        Configuration( void );
 
126
 
 
127
        //! constructor from KConfig
 
128
        Configuration( KConfigGroup );
 
129
 
 
130
        //! destructor
 
131
        virtual ~Configuration( void )
 
132
        {}
 
133
 
 
134
        //! equal to operator
 
135
        bool operator == ( const Configuration& ) const;
 
136
 
 
137
        //! propagate all features found in exception mask to this configuration
 
138
        void readException( const Exception& );
 
139
 
 
140
        //! write to kconfig group
 
141
        virtual void write( KConfigGroup& ) const;
 
142
 
 
143
        //!@name title alignment
 
144
        //@{
 
145
 
 
146
        static QString titleAlignmentName( Qt::Alignment, bool translated, bool fullWidth = false );
 
147
        static Qt::Alignment titleAlignment( QString, bool translated );
 
148
 
 
149
        virtual Qt::Alignment titleAlignment() const
 
150
        { return _titleAlignment; }
 
151
 
 
152
        virtual QString titleAlignmentName( bool translated ) const
 
153
        { return titleAlignmentName( titleAlignment(), translated, centerTitleOnFullWidth() ); }
 
154
 
 
155
        virtual void setTitleAlignment( Qt::Alignment value )
 
156
        { _titleAlignment = value; }
 
157
 
 
158
        virtual void setTitleAlignment( QString value, bool translated )
 
159
        { _titleAlignment = titleAlignment( value, translated ); }
 
160
 
 
161
        virtual bool centerTitleOnFullWidth( void ) const
 
162
        { return _centerTitleOnFullWidth; }
 
163
 
 
164
        virtual void setCenterTitleOnFullWidth( bool value )
 
165
        { _centerTitleOnFullWidth = value; }
 
166
 
 
167
        //@}
 
168
 
 
169
        //!@name button size
 
170
        //@{
 
171
 
 
172
        static QString buttonSizeName( ButtonSize, bool translated );
 
173
        static ButtonSize buttonSize( QString, bool translated );
 
174
        static int iconScale( ButtonSize );
 
175
 
 
176
        virtual ButtonSize buttonSize( void ) const
 
177
        { return _buttonSize; }
 
178
 
 
179
        virtual int iconScale( void ) const
 
180
        { return iconScale( buttonSize() ); }
 
181
 
 
182
        virtual QString buttonSizeName( bool translated ) const
 
183
        { return buttonSizeName( buttonSize(), translated ); }
 
184
 
 
185
        virtual void setButtonSize( ButtonSize value )
 
186
        { _buttonSize = value; }
 
187
 
 
188
        virtual bool useNarrowButtonSpacing( void ) const
 
189
        { return _useNarrowButtonSpacing; }
 
190
 
 
191
        virtual void  setUseNarrowButtonSpacing( bool value )
 
192
        { _useNarrowButtonSpacing = value; }
 
193
 
 
194
        //@}
 
195
 
 
196
        //!@name shadow mode cache mode
 
197
        //@{
 
198
 
 
199
        static QString shadowCacheModeName( ShadowCacheMode, bool translated );
 
200
        static ShadowCacheMode shadowCacheMode( QString, bool translated );
 
201
 
 
202
        QString shadowCacheModeName( bool translated ) const
 
203
        { return shadowCacheModeName( shadowCacheMode(), translated ); }
 
204
 
 
205
        void setShadowCacheMode( ShadowCacheMode mode )
 
206
        { _shadowCacheMode = mode; }
 
207
 
 
208
        ShadowCacheMode shadowCacheMode( void ) const
 
209
        { return _shadowCacheMode; }
 
210
 
 
211
        //@]
 
212
 
 
213
        //!@name frame border
 
214
        //@{
 
215
 
 
216
        static QString frameBorderName( FrameBorder, bool translated );
 
217
        static FrameBorder frameBorder( QString, bool translated );
 
218
 
 
219
        virtual FrameBorder frameBorder() const
 
220
        { return _frameBorder; }
 
221
 
 
222
        virtual QString frameBorderName( bool translated ) const
 
223
        { return frameBorderName( frameBorder(), translated ); }
 
224
 
 
225
        virtual void setFrameBorder( FrameBorder value )
 
226
        { _frameBorder = value; }
 
227
 
 
228
        virtual void setFrameBorder( QString value, bool translated )
 
229
        { _frameBorder = frameBorder( value, translated ); }
 
230
 
 
231
        //@}
 
232
 
 
233
        //!@name blend color
 
234
        //@{
 
235
 
 
236
        static QString blendColorName( BlendColorType, bool translated );
 
237
        static BlendColorType blendColor( QString, bool translated );
 
238
 
 
239
        virtual BlendColorType blendColor( void ) const
 
240
        { return _blendColor; }
 
241
 
 
242
        virtual QString blendColorName( bool translated ) const
 
243
        { return blendColorName( blendColor(), translated ); }
 
244
 
 
245
        virtual void setBlendColor( BlendColorType value )
 
246
        { _blendColor = value; }
 
247
 
 
248
        virtual void setBlendColor( QString value, bool translated )
 
249
        { _blendColor = blendColor( value, translated ); }
 
250
 
 
251
        //@}
 
252
 
 
253
        //!@name size grip
 
254
        //@{
 
255
 
 
256
        static QString sizeGripModeName( SizeGripMode, bool translated );
 
257
        static SizeGripMode sizeGripMode( QString, bool translated );
 
258
 
 
259
        virtual SizeGripMode sizeGripMode( void ) const
 
260
        { return _sizeGripMode; }
 
261
 
 
262
        virtual QString sizeGripModeName( bool translated ) const
 
263
        { return sizeGripModeName( sizeGripMode(), translated ); }
 
264
 
 
265
        virtual void setSizeGripMode( SizeGripMode value )
 
266
        { _sizeGripMode = value; }
 
267
 
 
268
        virtual void setSizeGripMode( QString value, bool translated )
 
269
        { _sizeGripMode = sizeGripMode( value, translated ); }
 
270
 
 
271
        //! draw size grip
 
272
        virtual bool drawSizeGrip( void ) const
 
273
        { return (sizeGripMode() == SizeGripWhenNeeded && frameBorder() == BorderNone ); }
 
274
 
 
275
        //@}
 
276
 
 
277
        //! separator
 
278
        virtual SeparatorMode separatorMode( void ) const
 
279
        { return _separatorMode; }
 
280
 
 
281
        //! separator
 
282
        virtual void setSeparatorMode( SeparatorMode value )
 
283
        { _separatorMode = value; }
 
284
 
 
285
        //! title outline
 
286
        virtual bool drawTitleOutline( void ) const
 
287
        { return _drawTitleOutline; }
 
288
 
 
289
        //! title outline
 
290
        virtual void setDrawTitleOutline( bool value )
 
291
        { _drawTitleOutline = value; }
 
292
 
 
293
        //! hide title bar
 
294
        virtual bool hideTitleBar( void ) const
 
295
        { return _hideTitleBar; }
 
296
 
 
297
        //! hide title bar
 
298
        virtual void setHideTitleBar( bool value )
 
299
        { _hideTitleBar = value; }
 
300
 
 
301
        //! drop shadows
 
302
        virtual bool useDropShadows( void ) const
 
303
        { return _useDropShadows; }
 
304
 
 
305
        //! drop shadows
 
306
        virtual void setUseDropShadows( bool value )
 
307
        { _useDropShadows = value; }
 
308
 
 
309
        //! oxygen shadows
 
310
        virtual bool useOxygenShadows( void ) const
 
311
        { return _useOxygenShadows; }
 
312
 
 
313
        //! oxygen shadows
 
314
        virtual void setUseOxygenShadows( bool value )
 
315
        { _useOxygenShadows = value; }
 
316
 
 
317
        //! animations
 
318
        virtual bool useAnimations( void ) const
 
319
        { return _useAnimations; }
 
320
 
 
321
        //! animations
 
322
        virtual void setUseAnimations( bool value )
 
323
        { _useAnimations = value; }
 
324
 
 
325
        //! animations
 
326
        virtual bool animateTitleChange( void ) const
 
327
        { return _animateTitleChange; }
 
328
 
 
329
        //! animations
 
330
        virtual void setAnimateTitleChange( bool value )
 
331
        { _animateTitleChange = value; }
 
332
 
 
333
        //! animations
 
334
        virtual int animationsDuration( void ) const
 
335
        { return _animationsDuration; }
 
336
 
 
337
        //! animations
 
338
        virtual void setAnimationsDuration( int value )
 
339
        { _animationsDuration = value; }
 
340
 
 
341
        //! tabbing
 
342
        virtual bool tabsEnabled( void ) const
 
343
        { return _tabsEnabled; }
 
344
 
 
345
        //! tabbing
 
346
        virtual void setTabsEnabled( bool value )
 
347
        { _tabsEnabled = value; }
 
348
 
 
349
        private:
 
350
 
 
351
        //! title alignment
 
352
        Qt::Alignment _titleAlignment;
 
353
 
 
354
        //! full width alignment (makes sense only for Center alignment
 
355
        bool _centerTitleOnFullWidth;
 
356
 
 
357
        //! button size
 
358
        ButtonSize _buttonSize;
 
359
 
 
360
        //! blend color
 
361
        FrameBorder _frameBorder;
 
362
 
 
363
        //! frame border
 
364
        BlendColorType _blendColor;
 
365
 
 
366
        //! size grip mode
 
367
        SizeGripMode _sizeGripMode;
 
368
 
 
369
        //! separator
 
370
        SeparatorMode _separatorMode;
 
371
 
 
372
        //! active window title outline
 
373
        bool _drawTitleOutline;
 
374
 
 
375
        //! hide titlebar completely (but not window border)
 
376
        bool _hideTitleBar;
 
377
 
 
378
        //! drop shadows
 
379
        bool _useDropShadows;
 
380
 
 
381
        //! oxygen shadows
 
382
        bool _useOxygenShadows;
 
383
 
 
384
        //! animations
 
385
        bool _useAnimations;
 
386
 
 
387
        //! animations
 
388
        bool _animateTitleChange;
 
389
 
 
390
        //! animations
 
391
        int _animationsDuration;
 
392
 
 
393
        //! tabbing
 
394
        bool _tabsEnabled;
 
395
 
 
396
        //! narrow button spacing
 
397
        bool _useNarrowButtonSpacing;
 
398
 
 
399
        //! shadow cache mode
 
400
        ShadowCacheMode _shadowCacheMode;
 
401
 
 
402
    };
 
403
 
 
404
}
 
405
 
 
406
#endif