LeechCraft  0.6.70-10870-g558588d6ec
Modular cross-platform feature rich live environment.
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 {
128  class UTIL_QML_API ColorThemeProxy : public QObject
129  {
130  Q_OBJECT
131 
132  IColorThemeManager *Manager_;
133  public:
140  ColorThemeProxy (IColorThemeManager *manager, QObject *parent);
141 
142 #ifdef GEN_RUN
143 #define DECL_PROP(group,col) \
144  Q_PROPERTY(QColor color_##group##_##col READ Get##group##col NOTIFY colorsChanged) \
145  QColor Get##group##col () const { return GetColor (#group, #col); }
146 
147  DECL_PROP(TextView, TopColor)
148  DECL_PROP(TextView, BottomColor)
149  DECL_PROP(TextView, TitleTextColor)
150  DECL_PROP(TextView, TextColor)
151  DECL_PROP(TextView, Aux1TextColor)
152  DECL_PROP(TextView, Aux2TextColor)
153  DECL_PROP(TextView, Aux3TextColor)
154 
155  DECL_PROP(TextBox, TopColor)
156  DECL_PROP(TextBox, BottomColor)
157  DECL_PROP(TextBox, BorderColor)
158  DECL_PROP(TextBox, HighlightTopColor)
159  DECL_PROP(TextBox, HighlightBottomColor)
160  DECL_PROP(TextBox, HighlightBorderColor)
161  DECL_PROP(TextBox, TitleTextColor)
162  DECL_PROP(TextBox, TextColor)
163  DECL_PROP(TextBox, Aux1TextColor)
164  DECL_PROP(TextBox, Aux2TextColor)
165  DECL_PROP(TextBox, Aux3TextColor)
166 
167  DECL_PROP(ToolButton, TopColor)
168  DECL_PROP(ToolButton, BottomColor)
169  DECL_PROP(ToolButton, BorderColor)
170  DECL_PROP(ToolButton, SelectedTopColor)
171  DECL_PROP(ToolButton, SelectedBottomColor)
172  DECL_PROP(ToolButton, SelectedBorderColor)
173  DECL_PROP(ToolButton, HoveredTopColor)
174  DECL_PROP(ToolButton, HoveredBottomColor)
175  DECL_PROP(ToolButton, HoveredBorderColor)
176  DECL_PROP(ToolButton, PressedBorderColor)
177  DECL_PROP(ToolButton, TextColor)
178 
179  DECL_PROP(Panel, TopColor)
180  DECL_PROP(Panel, BottomColor)
181  DECL_PROP(Panel, TextColor)
182 #else
183  Q_PROPERTY(QColor color_TextView_TopColor READ GetTextViewTopColor NOTIFY colorsChanged) QColor GetTextViewTopColor () const { return GetColor ("TextView", "TopColor"); }
184  Q_PROPERTY(QColor color_TextView_BottomColor READ GetTextViewBottomColor NOTIFY colorsChanged) QColor GetTextViewBottomColor () const { return GetColor ("TextView", "BottomColor"); }
185  Q_PROPERTY(QColor color_TextView_TitleTextColor READ GetTextViewTitleTextColor NOTIFY colorsChanged) QColor GetTextViewTitleTextColor () const { return GetColor ("TextView", "TitleTextColor"); }
186  Q_PROPERTY(QColor color_TextView_TextColor READ GetTextViewTextColor NOTIFY colorsChanged) QColor GetTextViewTextColor () const { return GetColor ("TextView", "TextColor"); }
187  Q_PROPERTY(QColor color_TextView_Aux1TextColor READ GetTextViewAux1TextColor NOTIFY colorsChanged) QColor GetTextViewAux1TextColor () const { return GetColor ("TextView", "Aux1TextColor"); }
188  Q_PROPERTY(QColor color_TextView_Aux2TextColor READ GetTextViewAux2TextColor NOTIFY colorsChanged) QColor GetTextViewAux2TextColor () const { return GetColor ("TextView", "Aux2TextColor"); }
189  Q_PROPERTY(QColor color_TextView_Aux3TextColor READ GetTextViewAux3TextColor NOTIFY colorsChanged) QColor GetTextViewAux3TextColor () const { return GetColor ("TextView", "Aux3TextColor"); }
190 
191  Q_PROPERTY(QColor color_TextBox_TopColor READ GetTextBoxTopColor NOTIFY colorsChanged) QColor GetTextBoxTopColor () const { return GetColor ("TextBox", "TopColor"); }
192  Q_PROPERTY(QColor color_TextBox_BottomColor READ GetTextBoxBottomColor NOTIFY colorsChanged) QColor GetTextBoxBottomColor () const { return GetColor ("TextBox", "BottomColor"); }
193  Q_PROPERTY(QColor color_TextBox_BorderColor READ GetTextBoxBorderColor NOTIFY colorsChanged) QColor GetTextBoxBorderColor () const { return GetColor ("TextBox", "BorderColor"); }
194  Q_PROPERTY(QColor color_TextBox_HighlightTopColor READ GetTextBoxHighlightTopColor NOTIFY colorsChanged) QColor GetTextBoxHighlightTopColor () const { return GetColor ("TextBox", "HighlightTopColor"); }
195  Q_PROPERTY(QColor color_TextBox_HighlightBottomColor READ GetTextBoxHighlightBottomColor NOTIFY colorsChanged) QColor GetTextBoxHighlightBottomColor () const { return GetColor ("TextBox", "HighlightBottomColor"); }
196  Q_PROPERTY(QColor color_TextBox_HighlightBorderColor READ GetTextBoxHighlightBorderColor NOTIFY colorsChanged) QColor GetTextBoxHighlightBorderColor () const { return GetColor ("TextBox", "HighlightBorderColor"); }
197  Q_PROPERTY(QColor color_TextBox_TitleTextColor READ GetTextBoxTitleTextColor NOTIFY colorsChanged) QColor GetTextBoxTitleTextColor () const { return GetColor ("TextBox", "TitleTextColor"); }
198  Q_PROPERTY(QColor color_TextBox_TextColor READ GetTextBoxTextColor NOTIFY colorsChanged) QColor GetTextBoxTextColor () const { return GetColor ("TextBox", "TextColor"); }
199  Q_PROPERTY(QColor color_TextBox_Aux1TextColor READ GetTextBoxAux1TextColor NOTIFY colorsChanged) QColor GetTextBoxAux1TextColor () const { return GetColor ("TextBox", "Aux1TextColor"); }
200  Q_PROPERTY(QColor color_TextBox_Aux2TextColor READ GetTextBoxAux2TextColor NOTIFY colorsChanged) QColor GetTextBoxAux2TextColor () const { return GetColor ("TextBox", "Aux2TextColor"); }
201  Q_PROPERTY(QColor color_TextBox_Aux3TextColor READ GetTextBoxAux3TextColor NOTIFY colorsChanged) QColor GetTextBoxAux3TextColor () const { return GetColor ("TextBox", "Aux3TextColor"); }
202 
203  Q_PROPERTY(QColor color_ToolButton_TopColor READ GetToolButtonTopColor NOTIFY colorsChanged) QColor GetToolButtonTopColor () const { return GetColor ("ToolButton", "TopColor"); }
204  Q_PROPERTY(QColor color_ToolButton_BottomColor READ GetToolButtonBottomColor NOTIFY colorsChanged) QColor GetToolButtonBottomColor () const { return GetColor ("ToolButton", "BottomColor"); }
205  Q_PROPERTY(QColor color_ToolButton_BorderColor READ GetToolButtonBorderColor NOTIFY colorsChanged) QColor GetToolButtonBorderColor () const { return GetColor ("ToolButton", "BorderColor"); }
206  Q_PROPERTY(QColor color_ToolButton_SelectedTopColor READ GetToolButtonSelectedTopColor NOTIFY colorsChanged) QColor GetToolButtonSelectedTopColor () const { return GetColor ("ToolButton", "SelectedTopColor"); }
207  Q_PROPERTY(QColor color_ToolButton_SelectedBottomColor READ GetToolButtonSelectedBottomColor NOTIFY colorsChanged) QColor GetToolButtonSelectedBottomColor () const { return GetColor ("ToolButton", "SelectedBottomColor"); }
208  Q_PROPERTY(QColor color_ToolButton_SelectedBorderColor READ GetToolButtonSelectedBorderColor NOTIFY colorsChanged) QColor GetToolButtonSelectedBorderColor () const { return GetColor ("ToolButton", "SelectedBorderColor"); }
209  Q_PROPERTY(QColor color_ToolButton_HoveredTopColor READ GetToolButtonHoveredTopColor NOTIFY colorsChanged) QColor GetToolButtonHoveredTopColor () const { return GetColor ("ToolButton", "HoveredTopColor"); }
210  Q_PROPERTY(QColor color_ToolButton_HoveredBottomColor READ GetToolButtonHoveredBottomColor NOTIFY colorsChanged) QColor GetToolButtonHoveredBottomColor () const { return GetColor ("ToolButton", "HoveredBottomColor"); }
211  Q_PROPERTY(QColor color_ToolButton_HoveredBorderColor READ GetToolButtonHoveredBorderColor NOTIFY colorsChanged) QColor GetToolButtonHoveredBorderColor () const { return GetColor ("ToolButton", "HoveredBorderColor"); }
212  Q_PROPERTY(QColor color_ToolButton_PressedBorderColor READ GetToolButtonPressedBorderColor NOTIFY colorsChanged) QColor GetToolButtonPressedBorderColor () const { return GetColor ("ToolButton", "PressedBorderColor"); }
213  Q_PROPERTY(QColor color_ToolButton_TextColor READ GetToolButtonTextColor NOTIFY colorsChanged) QColor GetToolButtonTextColor () const { return GetColor ("ToolButton", "TextColor"); }
214 
215  Q_PROPERTY(QColor color_Panel_TopColor READ GetPanelTopColor NOTIFY colorsChanged) QColor GetPanelTopColor () const { return GetColor ("Panel", "TopColor"); }
216  Q_PROPERTY(QColor color_Panel_BottomColor READ GetPanelBottomColor NOTIFY colorsChanged) QColor GetPanelBottomColor () const { return GetColor ("Panel", "BottomColor"); }
217  Q_PROPERTY(QColor color_Panel_TextColor READ GetPanelTextColor NOTIFY colorsChanged) QColor GetPanelTextColor () const { return GetColor ("Panel", "TextColor"); }
218 #endif
219  public slots:
226  QColor setAlpha (QColor color, qreal alpha);
227  private:
228  QColor GetColor (const QString&, const QString&) const;
229  signals:
235  void colorsChanged ();
236  };
237 }
238 }
QColor GetToolButtonPressedBorderColor() const
QColor GetToolButtonHoveredBorderColor() const
QColor GetToolButtonSelectedBorderColor() const
QColor GetToolButtonHoveredBottomColor() const
#define UTIL_QML_API
Definition: qmlconfig.h:37
QColor GetToolButtonSelectedBottomColor() const
Proxy class to the color theme management engine.
Proxy for QML files to use colors from current color theme.