]> git.saurik.com Git - wxWidgets.git/blame - include/wx/univ/theme.h
made the log dialog resizeable (again?)
[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)
1e6feb95
VZ
11// Licence: wxWindows license
12///////////////////////////////////////////////////////////////////////////////
13
14#ifndef _WX_UNIV_THEME_H_
15#define _WX_UNIV_THEME_H_
16
17#ifdef __GNUG__
18 #pragma interface "theme.h"
19#endif
20
21// ----------------------------------------------------------------------------
22// wxTheme
23// ----------------------------------------------------------------------------
24
25class WXDLLEXPORT wxRenderer;
26class WXDLLEXPORT wxColourScheme;
27class WXDLLEXPORT wxInputHandler;
28struct WXDLLEXPORT wxThemeInfo;
29
30class WXDLLEXPORT wxTheme
31{
32public:
33 // static methods
34 // --------------
35
36 // create the default theme
37 static bool CreateDefault();
38
39 // create the theme by name (will return NULL if not found)
40 static wxTheme *Create(const wxString& name);
41
42 // change the current scheme
43 static wxTheme *Set(wxTheme *theme);
44
45 // get the current theme (never NULL)
46 static wxTheme *Get() { return ms_theme; }
47
48 // the theme methods
49 // -----------------
50
51 // get the renderer implementing all the control-drawing operations in
52 // this theme
53 virtual wxRenderer *GetRenderer() = 0;
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;
e766c8a9
SC
72#ifdef __MWERKS__
73 friend class wxThemeInfo;
74#else
1e6feb95 75 friend wxThemeInfo;
e766c8a9 76#endif
1e6feb95
VZ
77};
78
79// ----------------------------------------------------------------------------
80// dynamic theme creation helpers
81// ----------------------------------------------------------------------------
82
83struct WXDLLEXPORT wxThemeInfo
84{
85 typedef wxTheme *(*Constructor)();
86
87 // theme name and (user readable) description
88 wxString name, desc;
89
90 // the function to create a theme object
91 Constructor ctor;
92
93 // next node in the linked list or NULL
94 wxThemeInfo *next;
95
96 // constructor for the struct itself
97 wxThemeInfo(Constructor ctor, const wxChar *name, const wxChar *desc);
98};
99
100// ----------------------------------------------------------------------------
101// macros
102// ----------------------------------------------------------------------------
103
104// to use a standard theme insert this macro into one of the application files:
105// without it, an over optimizing linker may discard the object module
106// containing the theme implementation entirely
107#define WX_USE_THEME(themename) \
108 extern bool wxThemeUse##themename; \
109 static struct wxThemeUserFor##themename \
110 { \
111 wxThemeUserFor##themename() { wxThemeUse##themename = TRUE; } \
112 } wxThemeDoUse##themename
113
114// to declare a new theme, this macro must be used in the class declaration
115#define WX_DECLARE_THEME(themename) \
116 private: \
117 static wxThemeInfo ms_info##themename; \
118 public: \
119 const wxThemeInfo *GetThemeInfo() const \
120 { return &ms_info##themename; }
121
122// and this one must be inserted in the source file
123#define WX_IMPLEMENT_THEME(classname, themename, themedesc) \
124 bool wxThemeUse##themename = TRUE; \
125 wxTheme *wxCtorFor##themename() { return new classname; } \
126 wxThemeInfo classname::ms_info##themename(wxCtorFor##themename, \
127 #themename, themedesc)
128
129#endif // _WX_UNIV_THEME_H_
130