1
#ifndef oxygenconfiguration_h
2
#define oxygenconfiguration_h
4
//////////////////////////////////////////////////////////////////////////////
5
// oxygenconfiguration.h
6
// decoration configuration
9
// Copyright (c) 2009 Hugo Pereira Da Costa <hugo.pereira@free.fr>
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:
18
// The above copyright notice and this permission notice shall be included in
19
// all copies or substantial portions of the Software.
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
28
//////////////////////////////////////////////////////////////////////////////
30
#include <KConfigGroup>
32
namespace OxygenConfig
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";
54
// forward declaration
57
//! stores all configuration options needed for decoration appearance
63
//! button size enumeration
72
//! frame border enumeration
85
//! blend color enumeration
99
enum ShadowCacheMode {
103
//! shadow cache depends on animation duration
106
//! shadow cache has maximum size
110
//! decide when separator is to be drawn
116
//! active window only
124
//! default constructor
125
Configuration( void );
127
//! constructor from KConfig
128
Configuration( KConfigGroup );
131
virtual ~Configuration( void )
134
//! equal to operator
135
bool operator == ( const Configuration& ) const;
137
//! propagate all features found in exception mask to this configuration
138
void readException( const Exception& );
140
//! write to kconfig group
141
virtual void write( KConfigGroup& ) const;
143
//!@name title alignment
146
static QString titleAlignmentName( Qt::Alignment, bool translated, bool fullWidth = false );
147
static Qt::Alignment titleAlignment( QString, bool translated );
149
virtual Qt::Alignment titleAlignment() const
150
{ return _titleAlignment; }
152
virtual QString titleAlignmentName( bool translated ) const
153
{ return titleAlignmentName( titleAlignment(), translated, centerTitleOnFullWidth() ); }
155
virtual void setTitleAlignment( Qt::Alignment value )
156
{ _titleAlignment = value; }
158
virtual void setTitleAlignment( QString value, bool translated )
159
{ _titleAlignment = titleAlignment( value, translated ); }
161
virtual bool centerTitleOnFullWidth( void ) const
162
{ return _centerTitleOnFullWidth; }
164
virtual void setCenterTitleOnFullWidth( bool value )
165
{ _centerTitleOnFullWidth = value; }
172
static QString buttonSizeName( ButtonSize, bool translated );
173
static ButtonSize buttonSize( QString, bool translated );
174
static int iconScale( ButtonSize );
176
virtual ButtonSize buttonSize( void ) const
177
{ return _buttonSize; }
179
virtual int iconScale( void ) const
180
{ return iconScale( buttonSize() ); }
182
virtual QString buttonSizeName( bool translated ) const
183
{ return buttonSizeName( buttonSize(), translated ); }
185
virtual void setButtonSize( ButtonSize value )
186
{ _buttonSize = value; }
188
virtual bool useNarrowButtonSpacing( void ) const
189
{ return _useNarrowButtonSpacing; }
191
virtual void setUseNarrowButtonSpacing( bool value )
192
{ _useNarrowButtonSpacing = value; }
196
//!@name shadow mode cache mode
199
static QString shadowCacheModeName( ShadowCacheMode, bool translated );
200
static ShadowCacheMode shadowCacheMode( QString, bool translated );
202
QString shadowCacheModeName( bool translated ) const
203
{ return shadowCacheModeName( shadowCacheMode(), translated ); }
205
void setShadowCacheMode( ShadowCacheMode mode )
206
{ _shadowCacheMode = mode; }
208
ShadowCacheMode shadowCacheMode( void ) const
209
{ return _shadowCacheMode; }
213
//!@name frame border
216
static QString frameBorderName( FrameBorder, bool translated );
217
static FrameBorder frameBorder( QString, bool translated );
219
virtual FrameBorder frameBorder() const
220
{ return _frameBorder; }
222
virtual QString frameBorderName( bool translated ) const
223
{ return frameBorderName( frameBorder(), translated ); }
225
virtual void setFrameBorder( FrameBorder value )
226
{ _frameBorder = value; }
228
virtual void setFrameBorder( QString value, bool translated )
229
{ _frameBorder = frameBorder( value, translated ); }
236
static QString blendColorName( BlendColorType, bool translated );
237
static BlendColorType blendColor( QString, bool translated );
239
virtual BlendColorType blendColor( void ) const
240
{ return _blendColor; }
242
virtual QString blendColorName( bool translated ) const
243
{ return blendColorName( blendColor(), translated ); }
245
virtual void setBlendColor( BlendColorType value )
246
{ _blendColor = value; }
248
virtual void setBlendColor( QString value, bool translated )
249
{ _blendColor = blendColor( value, translated ); }
256
static QString sizeGripModeName( SizeGripMode, bool translated );
257
static SizeGripMode sizeGripMode( QString, bool translated );
259
virtual SizeGripMode sizeGripMode( void ) const
260
{ return _sizeGripMode; }
262
virtual QString sizeGripModeName( bool translated ) const
263
{ return sizeGripModeName( sizeGripMode(), translated ); }
265
virtual void setSizeGripMode( SizeGripMode value )
266
{ _sizeGripMode = value; }
268
virtual void setSizeGripMode( QString value, bool translated )
269
{ _sizeGripMode = sizeGripMode( value, translated ); }
272
virtual bool drawSizeGrip( void ) const
273
{ return (sizeGripMode() == SizeGripWhenNeeded && frameBorder() == BorderNone ); }
278
virtual SeparatorMode separatorMode( void ) const
279
{ return _separatorMode; }
282
virtual void setSeparatorMode( SeparatorMode value )
283
{ _separatorMode = value; }
286
virtual bool drawTitleOutline( void ) const
287
{ return _drawTitleOutline; }
290
virtual void setDrawTitleOutline( bool value )
291
{ _drawTitleOutline = value; }
294
virtual bool hideTitleBar( void ) const
295
{ return _hideTitleBar; }
298
virtual void setHideTitleBar( bool value )
299
{ _hideTitleBar = value; }
302
virtual bool useDropShadows( void ) const
303
{ return _useDropShadows; }
306
virtual void setUseDropShadows( bool value )
307
{ _useDropShadows = value; }
310
virtual bool useOxygenShadows( void ) const
311
{ return _useOxygenShadows; }
314
virtual void setUseOxygenShadows( bool value )
315
{ _useOxygenShadows = value; }
318
virtual bool useAnimations( void ) const
319
{ return _useAnimations; }
322
virtual void setUseAnimations( bool value )
323
{ _useAnimations = value; }
326
virtual bool animateTitleChange( void ) const
327
{ return _animateTitleChange; }
330
virtual void setAnimateTitleChange( bool value )
331
{ _animateTitleChange = value; }
334
virtual int animationsDuration( void ) const
335
{ return _animationsDuration; }
338
virtual void setAnimationsDuration( int value )
339
{ _animationsDuration = value; }
342
virtual bool tabsEnabled( void ) const
343
{ return _tabsEnabled; }
346
virtual void setTabsEnabled( bool value )
347
{ _tabsEnabled = value; }
352
Qt::Alignment _titleAlignment;
354
//! full width alignment (makes sense only for Center alignment
355
bool _centerTitleOnFullWidth;
358
ButtonSize _buttonSize;
361
FrameBorder _frameBorder;
364
BlendColorType _blendColor;
367
SizeGripMode _sizeGripMode;
370
SeparatorMode _separatorMode;
372
//! active window title outline
373
bool _drawTitleOutline;
375
//! hide titlebar completely (but not window border)
379
bool _useDropShadows;
382
bool _useOxygenShadows;
388
bool _animateTitleChange;
391
int _animationsDuration;
396
//! narrow button spacing
397
bool _useNarrowButtonSpacing;
399
//! shadow cache mode
400
ShadowCacheMode _shadowCacheMode;