]> git.saurik.com Git - wxWidgets.git/blame - include/wx/univ/theme.h
wxCore build fix.
[wxWidgets.git] / include / wx / univ / theme.h
CommitLineData
1e6feb95
VZ
1///////////////////////////////////////////////////////////////////////////////
2// Name: wx/univ/theme.h
3// Purpose: wxTheme class manages all configurable aspects of the
4// application including the look (wxRenderer), feel
5// (wxInputHandler) and the colours (wxColourScheme)
6// Author: Vadim Zeitlin
7// Modified by:
8// Created: 06.08.00
9// RCS-ID: $Id$
442b35b5 10// Copyright: (c) 2000 SciTech Software, Inc. (www.scitechsoft.com)
65571936 11// Licence: wxWindows licence
1e6feb95
VZ
12///////////////////////////////////////////////////////////////////////////////
13
14#ifndef _WX_UNIV_THEME_H_
15#define _WX_UNIV_THEME_H_
16
1e6feb95
VZ
17// ----------------------------------------------------------------------------
18// wxTheme
19// ----------------------------------------------------------------------------
20
21class WXDLLEXPORT wxRenderer;
22class WXDLLEXPORT wxColourScheme;
23class WXDLLEXPORT wxInputHandler;
536b70ac 24class WXDLLEXPORT wxArtProvider;
1e6feb95
VZ
25struct WXDLLEXPORT wxThemeInfo;
26
27class WXDLLEXPORT wxTheme
28{
29public:
30 // static methods
31 // --------------
32
33 // create the default theme
34 static bool CreateDefault();
35
36 // create the theme by name (will return NULL if not found)
37 static wxTheme *Create(const wxString& name);
38
39 // change the current scheme
40 static wxTheme *Set(wxTheme *theme);
41
42 // get the current theme (never NULL)
43 static wxTheme *Get() { return ms_theme; }
44
45 // the theme methods
46 // -----------------
47
48 // get the renderer implementing all the control-drawing operations in
49 // this theme
50 virtual wxRenderer *GetRenderer() = 0;
ef359b43 51
536b70ac
VS
52 // get the art provider to be used together with this theme
53 virtual wxArtProvider *GetArtProvider() = 0;
1e6feb95
VZ
54
55 // get the input handler of the given type
56 virtual wxInputHandler *GetInputHandler(const wxString& handlerType) = 0;
57
58 // get the colour scheme for the control with this name
59 virtual wxColourScheme *GetColourScheme() = 0;
60
61 // implementation only from now on
62 // -------------------------------
63
64 virtual ~wxTheme();
65
66private:
67 // the list of descriptions of all known themes
68 static wxThemeInfo *ms_allThemes;
69
70 // the current theme
71 static wxTheme *ms_theme;
3ad252c9 72 friend struct WXDLLEXPORT wxThemeInfo;
1e6feb95
VZ
73};
74
75// ----------------------------------------------------------------------------
76// dynamic theme creation helpers
77// ----------------------------------------------------------------------------
78
79struct WXDLLEXPORT wxThemeInfo
80{
81 typedef wxTheme *(*Constructor)();
82
83 // theme name and (user readable) description
84 wxString name, desc;
85
86 // the function to create a theme object
87 Constructor ctor;
88
89 // next node in the linked list or NULL
90 wxThemeInfo *next;
91
92 // constructor for the struct itself
93 wxThemeInfo(Constructor ctor, const wxChar *name, const wxChar *desc);
94};
95
96// ----------------------------------------------------------------------------
97// macros
98// ----------------------------------------------------------------------------
99
100// to use a standard theme insert this macro into one of the application files:
101// without it, an over optimizing linker may discard the object module
102// containing the theme implementation entirely
103#define WX_USE_THEME(themename) \
ef359b43 104 extern WXDLLEXPORT_DATA(bool) wxThemeUse##themename; \
1e6feb95
VZ
105 static struct wxThemeUserFor##themename \
106 { \
a290fa5a 107 wxThemeUserFor##themename() { wxThemeUse##themename = true; } \
1e6feb95
VZ
108 } wxThemeDoUse##themename
109
110// to declare a new theme, this macro must be used in the class declaration
111#define WX_DECLARE_THEME(themename) \
112 private: \
113 static wxThemeInfo ms_info##themename; \
114 public: \
115 const wxThemeInfo *GetThemeInfo() const \
116 { return &ms_info##themename; }
117
118// and this one must be inserted in the source file
119#define WX_IMPLEMENT_THEME(classname, themename, themedesc) \
a290fa5a 120 WXDLLEXPORT_DATA(bool) wxThemeUse##themename = true; \
1e6feb95
VZ
121 wxTheme *wxCtorFor##themename() { return new classname; } \
122 wxThemeInfo classname::ms_info##themename(wxCtorFor##themename, \
f63e248e 123 wxT( #themename ), themedesc)
1e6feb95
VZ
124
125#endif // _WX_UNIV_THEME_H_
126