1 // Copyright (C) 2007-2008 CEA/DEN, EDF R&D, OPEN CASCADE
3 // Copyright (C) 2003-2007 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN,
4 // CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS
6 // This library is free software; you can redistribute it and/or
7 // modify it under the terms of the GNU Lesser General Public
8 // License as published by the Free Software Foundation; either
9 // version 2.1 of the License.
11 // This library is distributed in the hope that it will be useful,
12 // but WITHOUT ANY WARRANTY; without even the implied warranty of
13 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
14 // Lesser General Public License for more details.
16 // You should have received a copy of the GNU Lesser General Public
17 // License along with this library; if not, write to the Free Software
18 // Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
20 // See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
22 // File : Style_Model.h
23 // Author : Vadim SANDLER, Open CASCADE S.A.S (vadim.sandler@opencascade.com)
39 // This class is private for Style package.
40 // Normally it should not be exported.
42 class STYLE_SALOME_EXPORT Style_Model
45 //! Color palette instance enumeration
47 WindowText = QPalette::WindowText, //!< A general foreground color
48 Button = QPalette::Button, //!< The general button background color
49 Light = QPalette::Light, //!< Usually lighter than Button color
50 Midlight = QPalette::Midlight, //!< Usually between Button and Light
51 Dark = QPalette::Dark, //!< Usually darker than Button
52 Mid = QPalette::Mid, //!< Usualliy between Button and Dark
53 Text = QPalette::Text, //!< The foreground color used with Base
54 BrightText = QPalette::BrightText, //!< A text color that is very different from WindowText, and contrasts well with e.g. Dark
55 ButtonText = QPalette::ButtonText, //!< A foreground color used with the Button color
56 Base = QPalette::Base, //!< Used mostly as the background color for text entry widgets
57 Window = QPalette::Window, //!< A general background color
58 Shadow = QPalette::Shadow, //!< Usually a very dark palette color
59 Highlight = QPalette::Highlight, //!< A color to indicate a selected item or the current item
60 HighlightedText = QPalette::HighlightedText, //!< A text color that contrasts with Highlight
61 Link = QPalette::Link, //!< A text color used for unvisited hyperlinks
62 LinkVisited = QPalette::LinkVisited, //!< A text color used for already visited hyperlinks
63 AlternateBase = QPalette::AlternateBase, //!< Used as the alternate background color in views with alternating row colors
64 NoRole = QPalette::NoRole, //!< No role; this special role is often used to indicate that a role has not been assigned
65 ToolTipBase = QPalette::ToolTipBase, //!< Used as the background color for QToolTip and QWhatsThis
66 ToolTipText = QPalette::ToolTipText, //!< Used as the foreground color for QToolTip and QWhatsThis
67 NColorRoles = QPalette::NColorRoles, //!< Used to indicate last standard palette color
68 BorderTop = NColorRoles, //!< Used to draw top-left borders of the widgets
69 BorderBottom, //!< Used to draw bottom-right borders of the widgets
70 TabBorderTop, //!< Used to draw top-left borders of the tab panels
71 TabBorderBottom, //!< Used to draw bottom-right borders of the tab panels
72 FieldLight, //!< Light component of the text entry widgets
73 FieldDark, //!< Dark component of the text entry widgets
74 Slider, //!< Used to draw sliders
75 Lines, //!< Used to draw lines throughout all the widgets
76 HighlightWidget, //!< Used to draw widget background when widget is hovered
77 HighlightBorder, //!< Used to draw widget borders when widget is hovered
78 Header, //!< Used to draw header of tab panels
79 ProgressBar, //!< Main progress bar color
80 Pointer, //!< Used to draw different widgets indicators like spin box arrows etc
81 Checked, //!< Check box indicator color
82 GridLine, //!< Used to draw table widgets grid
83 LastColor //!< Points to the last color; no specific meaning
88 NoLines, //!< Do not draw lines
89 Horizontal, //!< Draw horozontal lines
90 Inclined, //!< Draw inclined lines
95 ButtonRadius, //!< Buttons rounding
96 EditRadius, //!< Text entry widgets rounding
97 FrameRadius, //!< Frames rounding
98 SliderRadius, //!< Sliders rounding
103 NoEffect, //!< Do not use widget effects
104 HighlightEffect, //!< Highlight widget when it is hovered
105 AutoRaiseEffect //!< Raise widget when it is hovered
109 virtual ~Style_Model();
111 void fromApplication( bool = false );
112 void fromResources( QtxResourceMgr*, const QString& = QString() );
114 void save( QtxResourceMgr* = 0, const QString& = QString() );
118 QtxResourceMgr* resourceMgr() const;
119 QString resourceSection() const;
122 QColor color( ColorRole, QPalette::ColorGroup = QPalette::Active ) const;
123 void setColor( ColorRole, const QColor&, const QColor& = QColor(), const QColor& = QColor() );
124 void setColor( ColorRole, QPalette::ColorGroup, const QColor& );
126 bool isAutoPalette() const;
127 void setAutoPalette( bool );
129 LineType linesType() const;
130 void setLinesType( LineType );
132 int linesTransparency() const;
133 void setLinesTransparency( int );
135 QFont applicationFont() const;
136 void setApplicationFont( const QFont& );
138 double widgetRounding( WidgetRounding ) const;
139 void setWidgetRounding( WidgetRounding, double );
141 bool antialiasing() const;
142 void setAntialiasing( bool );
144 WidgetEffect widgetEffect() const;
145 void setWidgetEffect( WidgetEffect );
147 int handleDelta( Qt::Orientation ) const;
148 void setHandleDelta( Qt::Orientation, int );
150 int splitHandleLength() const;
151 void setSplitHandleLength( int );
153 int sliderSize() const;
154 void setSliderSize( int );
158 void readColorValue( ColorRole, const QString& );
159 void writeColorValue( ColorRole, const QString&, QtxResourceMgr*, const QString& ) const;
162 typedef QMap<ColorRole, QColor> ColorMap;
163 typedef QMap<QPalette::ColorGroup, ColorMap> ColorGroupMap;
164 typedef QMap<WidgetRounding, double> RoundMap;
165 typedef QMap<Qt::Orientation, int> DeltaMap;
167 QtxResourceMgr* myResourceMgr;
168 QString myResourceSection;
170 ColorGroupMap myColors;
172 RoundMap myWidgetRounding;
173 DeltaMap myHandleDelta;
175 LineType myLinesType;
176 WidgetEffect myWidgetEffect;
178 int myLinesTransparency;
179 int mySplitHandleLength;
188 static AppData* myAppData;
191 #endif // STYLE_MODEL_H