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