ClanLib  2.3.7
gui_theme.h
Go to the documentation of this file.
1 /*
2 ** ClanLib SDK
3 ** Copyright (c) 1997-2011 The ClanLib Team
4 **
5 ** This software is provided 'as-is', without any express or implied
6 ** warranty. In no event will the authors be held liable for any damages
7 ** arising from the use of this software.
8 **
9 ** Permission is granted to anyone to use this software for any purpose,
10 ** including commercial applications, and to alter it and redistribute it
11 ** freely, subject to the following restrictions:
12 **
13 ** 1. The origin of this software must not be misrepresented; you must not
14 ** claim that you wrote the original software. If you use this software
15 ** in a product, an acknowledgment in the product documentation would be
16 ** appreciated but is not required.
17 ** 2. Altered source versions must be plainly marked as such, and must not be
18 ** misrepresented as being the original software.
19 ** 3. This notice may not be removed or altered from any source distribution.
20 **
21 ** Note: Some of the libraries ClanLib may link to may have additional
22 ** requirements or restrictions.
23 **
24 ** File Author(s):
25 **
26 ** Magnus Norddahl
27 ** Harry Storbacka
28 ** Kenneth Gangstoe
29 ** Mark Page
30 */
31 
34 
35 #pragma once
36 
37 #include "api_gui.h"
38 #include "../Core/System/sharedptr.h"
39 
40 class CL_GUIThemePart;
41 class CL_GraphicContext;
42 class CL_ResourceManager;
43 class CL_GUIComponent;
44 class CL_Colorf;
45 class CL_Size;
46 class CL_Rect;
47 class CL_Font;
48 class CL_GUITheme_Impl;
50 
55 {
58 
59 public:
64 
65  ~CL_GUITheme();
66 
70 
71 public:
72 
76  bool is_null() const;
77 
79  CL_GUIThemeProvider *get_provider() const;
80 
88  CL_StringRef get_property(
89  const CL_GUIThemePart &part,
90  const CL_StringRef &name,
91  const CL_StringRef &css_value);
92 
94  CL_ResourceManager get_resources() const;
95 
99 
100 public:
102  void set_resources(CL_ResourceManager resources);
103 
105  void add_resources(CL_ResourceManager resources);
106 
108  void render_box(
109  CL_GraphicContext &gc,
110  CL_GUIThemePart &part,
111  const CL_Rect &rect,
112  const CL_Rect &clip_rect);
113 
114  CL_Rect render_text(
115  CL_GraphicContext &gc,
116  CL_GUIThemePart &part,
117  CL_Font &font,
118  const CL_StringRef &text,
119  const CL_Rect &content_rect,
120  const CL_Rect &clip_rect);
121 
124  // This notification allows a theme to clean up cached theme part
125  // resources used by the component.
126  void component_destroyed(CL_GUIComponent *component);
127 
131 
132 private:
133  CL_SharedPtr<CL_GUITheme_Impl> impl;
135 };
136