LeechCraft  %{LEECHCRAFT_VERSION}
Modular cross-platform feature rich live environment.
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Modules Pages
colorthemeproxy.h
Go to the documentation of this file.
1 /**********************************************************************
2  * LeechCraft - modular cross-platform feature rich internet client.
3  * Copyright (C) 2006-2014 Georg Rudoy
4  *
5  * Boost Software License - Version 1.0 - August 17th, 2003
6  *
7  * Permission is hereby granted, free of charge, to any person or organization
8  * obtaining a copy of the software and accompanying documentation covered by
9  * this license (the "Software") to use, reproduce, display, distribute,
10  * execute, and transmit the Software, and to prepare derivative works of the
11  * Software, and to permit third-parties to whom the Software is furnished to
12  * do so, all subject to the following:
13  *
14  * The copyright notices in the Software and this entire statement, including
15  * the above license grant, this restriction and the following disclaimer,
16  * must be included in all copies of the Software, in whole or in part, and
17  * all derivative works of the Software, unless such copies or derivative
18  * works are solely in the form of machine-executable object code generated by
19  * a source language processor.
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, TITLE AND NON-INFRINGEMENT. IN NO EVENT
24  * SHALL THE COPYRIGHT HOLDERS OR ANYONE DISTRIBUTING THE SOFTWARE BE LIABLE
25  * FOR ANY DAMAGES OR OTHER LIABILITY, WHETHER IN CONTRACT, TORT OR OTHERWISE,
26  * ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
27  * DEALINGS IN THE SOFTWARE.
28  **********************************************************************/
29 
30 #pragma once
31 
32 #include <QObject>
33 #include <QColor>
34 #include "qmlconfig.h"
35 
36 class IColorThemeManager;
37 
38 namespace LeechCraft
39 {
40 namespace Util
41 {
126  class UTIL_QML_API ColorThemeProxy : public QObject
127  {
128  Q_OBJECT
129 
130  IColorThemeManager *Manager_;
131  public:
138  ColorThemeProxy (IColorThemeManager *manager, QObject *parent);
139 
140 #ifdef GEN_RUN
141 #define DECL_PROP(group,col) \
142  Q_PROPERTY(QColor color_##group##_##col READ Get##group##col NOTIFY colorsChanged) \
143  QColor Get##group##col () const { return GetColor (#group, #col); }
144 
145  DECL_PROP(TextView, TopColor)
146  DECL_PROP(TextView, BottomColor)
147  DECL_PROP(TextView, TitleTextColor)
148  DECL_PROP(TextView, TextColor)
149  DECL_PROP(TextView, Aux1TextColor)
150  DECL_PROP(TextView, Aux2TextColor)
151  DECL_PROP(TextView, Aux3TextColor)
152 
153  DECL_PROP(TextBox, TopColor)
154  DECL_PROP(TextBox, BottomColor)
155  DECL_PROP(TextBox, BorderColor)
156  DECL_PROP(TextBox, HighlightTopColor)
157  DECL_PROP(TextBox, HighlightBottomColor)
158  DECL_PROP(TextBox, HighlightBorderColor)
159  DECL_PROP(TextBox, TitleTextColor)
160  DECL_PROP(TextBox, TextColor)
161  DECL_PROP(TextBox, Aux1TextColor)
162  DECL_PROP(TextBox, Aux2TextColor)
163  DECL_PROP(TextBox, Aux3TextColor)
164 
165  DECL_PROP(ToolButton, TopColor)
166  DECL_PROP(ToolButton, BottomColor)
167  DECL_PROP(ToolButton, BorderColor)
168  DECL_PROP(ToolButton, SelectedTopColor)
169  DECL_PROP(ToolButton, SelectedBottomColor)
170  DECL_PROP(ToolButton, SelectedBorderColor)
171  DECL_PROP(ToolButton, HoveredTopColor)
172  DECL_PROP(ToolButton, HoveredBottomColor)
173  DECL_PROP(ToolButton, HoveredBorderColor)
174  DECL_PROP(ToolButton, PressedBorderColor)
175  DECL_PROP(ToolButton, TextColor)
176 
177  DECL_PROP(Panel, TopColor)
178  DECL_PROP(Panel, BottomColor)
179  DECL_PROP(Panel, TextColor)
180 #else
181  Q_PROPERTY(QColor color_TextView_TopColor READ GetTextViewTopColor NOTIFY colorsChanged) QColor GetTextViewTopColor () const { return GetColor ("TextView", "TopColor"); }
182  Q_PROPERTY(QColor color_TextView_BottomColor READ GetTextViewBottomColor NOTIFY colorsChanged) QColor GetTextViewBottomColor () const { return GetColor ("TextView", "BottomColor"); }
183  Q_PROPERTY(QColor color_TextView_TitleTextColor READ GetTextViewTitleTextColor NOTIFY colorsChanged) QColor GetTextViewTitleTextColor () const { return GetColor ("TextView", "TitleTextColor"); }
184  Q_PROPERTY(QColor color_TextView_TextColor READ GetTextViewTextColor NOTIFY colorsChanged) QColor GetTextViewTextColor () const { return GetColor ("TextView", "TextColor"); }
185  Q_PROPERTY(QColor color_TextView_Aux1TextColor READ GetTextViewAux1TextColor NOTIFY colorsChanged) QColor GetTextViewAux1TextColor () const { return GetColor ("TextView", "Aux1TextColor"); }
186  Q_PROPERTY(QColor color_TextView_Aux2TextColor READ GetTextViewAux2TextColor NOTIFY colorsChanged) QColor GetTextViewAux2TextColor () const { return GetColor ("TextView", "Aux2TextColor"); }
187  Q_PROPERTY(QColor color_TextView_Aux3TextColor READ GetTextViewAux3TextColor NOTIFY colorsChanged) QColor GetTextViewAux3TextColor () const { return GetColor ("TextView", "Aux3TextColor"); }
188 
189  Q_PROPERTY(QColor color_TextBox_TopColor READ GetTextBoxTopColor NOTIFY colorsChanged) QColor GetTextBoxTopColor () const { return GetColor ("TextBox", "TopColor"); }
190  Q_PROPERTY(QColor color_TextBox_BottomColor READ GetTextBoxBottomColor NOTIFY colorsChanged) QColor GetTextBoxBottomColor () const { return GetColor ("TextBox", "BottomColor"); }
191  Q_PROPERTY(QColor color_TextBox_BorderColor READ GetTextBoxBorderColor NOTIFY colorsChanged) QColor GetTextBoxBorderColor () const { return GetColor ("TextBox", "BorderColor"); }
192  Q_PROPERTY(QColor color_TextBox_HighlightTopColor READ GetTextBoxHighlightTopColor NOTIFY colorsChanged) QColor GetTextBoxHighlightTopColor () const { return GetColor ("TextBox", "HighlightTopColor"); }
193  Q_PROPERTY(QColor color_TextBox_HighlightBottomColor READ GetTextBoxHighlightBottomColor NOTIFY colorsChanged) QColor GetTextBoxHighlightBottomColor () const { return GetColor ("TextBox", "HighlightBottomColor"); }
194  Q_PROPERTY(QColor color_TextBox_HighlightBorderColor READ GetTextBoxHighlightBorderColor NOTIFY colorsChanged) QColor GetTextBoxHighlightBorderColor () const { return GetColor ("TextBox", "HighlightBorderColor"); }
195  Q_PROPERTY(QColor color_TextBox_TitleTextColor READ GetTextBoxTitleTextColor NOTIFY colorsChanged) QColor GetTextBoxTitleTextColor () const { return GetColor ("TextBox", "TitleTextColor"); }
196  Q_PROPERTY(QColor color_TextBox_TextColor READ GetTextBoxTextColor NOTIFY colorsChanged) QColor GetTextBoxTextColor () const { return GetColor ("TextBox", "TextColor"); }
197  Q_PROPERTY(QColor color_TextBox_Aux1TextColor READ GetTextBoxAux1TextColor NOTIFY colorsChanged) QColor GetTextBoxAux1TextColor () const { return GetColor ("TextBox", "Aux1TextColor"); }
198  Q_PROPERTY(QColor color_TextBox_Aux2TextColor READ GetTextBoxAux2TextColor NOTIFY colorsChanged) QColor GetTextBoxAux2TextColor () const { return GetColor ("TextBox", "Aux2TextColor"); }
199  Q_PROPERTY(QColor color_TextBox_Aux3TextColor READ GetTextBoxAux3TextColor NOTIFY colorsChanged) QColor GetTextBoxAux3TextColor () const { return GetColor ("TextBox", "Aux3TextColor"); }
200 
201  Q_PROPERTY(QColor color_ToolButton_TopColor READ GetToolButtonTopColor NOTIFY colorsChanged) QColor GetToolButtonTopColor () const { return GetColor ("ToolButton", "TopColor"); }
202  Q_PROPERTY(QColor color_ToolButton_BottomColor READ GetToolButtonBottomColor NOTIFY colorsChanged) QColor GetToolButtonBottomColor () const { return GetColor ("ToolButton", "BottomColor"); }
203  Q_PROPERTY(QColor color_ToolButton_BorderColor READ GetToolButtonBorderColor NOTIFY colorsChanged) QColor GetToolButtonBorderColor () const { return GetColor ("ToolButton", "BorderColor"); }
204  Q_PROPERTY(QColor color_ToolButton_SelectedTopColor READ GetToolButtonSelectedTopColor NOTIFY colorsChanged) QColor GetToolButtonSelectedTopColor () const { return GetColor ("ToolButton", "SelectedTopColor"); }
205  Q_PROPERTY(QColor color_ToolButton_SelectedBottomColor READ GetToolButtonSelectedBottomColor NOTIFY colorsChanged) QColor GetToolButtonSelectedBottomColor () const { return GetColor ("ToolButton", "SelectedBottomColor"); }
206  Q_PROPERTY(QColor color_ToolButton_SelectedBorderColor READ GetToolButtonSelectedBorderColor NOTIFY colorsChanged) QColor GetToolButtonSelectedBorderColor () const { return GetColor ("ToolButton", "SelectedBorderColor"); }
207  Q_PROPERTY(QColor color_ToolButton_HoveredTopColor READ GetToolButtonHoveredTopColor NOTIFY colorsChanged) QColor GetToolButtonHoveredTopColor () const { return GetColor ("ToolButton", "HoveredTopColor"); }
208  Q_PROPERTY(QColor color_ToolButton_HoveredBottomColor READ GetToolButtonHoveredBottomColor NOTIFY colorsChanged) QColor GetToolButtonHoveredBottomColor () const { return GetColor ("ToolButton", "HoveredBottomColor"); }
209  Q_PROPERTY(QColor color_ToolButton_HoveredBorderColor READ GetToolButtonHoveredBorderColor NOTIFY colorsChanged) QColor GetToolButtonHoveredBorderColor () const { return GetColor ("ToolButton", "HoveredBorderColor"); }
210  Q_PROPERTY(QColor color_ToolButton_PressedBorderColor READ GetToolButtonPressedBorderColor NOTIFY colorsChanged) QColor GetToolButtonPressedBorderColor () const { return GetColor ("ToolButton", "PressedBorderColor"); }
211  Q_PROPERTY(QColor color_ToolButton_TextColor READ GetToolButtonTextColor NOTIFY colorsChanged) QColor GetToolButtonTextColor () const { return GetColor ("ToolButton", "TextColor"); }
212 
213  Q_PROPERTY(QColor color_Panel_TopColor READ GetPanelTopColor NOTIFY colorsChanged) QColor GetPanelTopColor () const { return GetColor ("Panel", "TopColor"); }
214  Q_PROPERTY(QColor color_Panel_BottomColor READ GetPanelBottomColor NOTIFY colorsChanged) QColor GetPanelBottomColor () const { return GetColor ("Panel", "BottomColor"); }
215  Q_PROPERTY(QColor color_Panel_TextColor READ GetPanelTextColor NOTIFY colorsChanged) QColor GetPanelTextColor () const { return GetColor ("Panel", "TextColor"); }
216 #endif
217  public slots:
224  QColor setAlpha (QColor color, qreal alpha);
225  private:
226  QColor GetColor (const QString&, const QString&) const;
227  signals:
233  void colorsChanged ();
234  };
235 }
236 }
QColor GetToolButtonPressedBorderColor() const
QColor GetToolButtonHoveredBottomColor() const
QColor GetTextBoxHighlightBorderColor() const
QColor GetToolButtonSelectedBorderColor() const
QColor GetToolButtonHoveredBorderColor() const
QColor GetToolButtonHoveredTopColor() const
#define UTIL_QML_API
Definition: qmlconfig.h:37
Proxy class to the color theme management engine.
QColor GetToolButtonSelectedTopColor() const
Proxy for QML files to use colors from current color theme.
QColor GetTextBoxHighlightBottomColor() const
QColor GetToolButtonSelectedBottomColor() const