ClanLib  2.3.7
gui_theme_part.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 */
29 
32 
33 #pragma once
34 
35 #include "api_gui.h"
36 #include "../Core/System/sharedptr.h"
37 
38 class CL_Size;
39 class CL_Rect;
40 class CL_GraphicContext;
41 class CL_Font;
42 
43 class CL_GUIComponent;
45 class CL_GUITheme;
46 class CL_GUIThemePart_Impl;
47 
52 {
55 public:
58 
60  CL_GUIComponent *component,
61  const CL_StringRef &relative_element_name = CL_StringRef());
62 
63  ~CL_GUIThemePart();
64 
68 public:
70  CL_StringRef get_element_name() const;
71 
73  bool get_state(const CL_StringRef &name) const;
74 
76  CL_StringRef get_property(const CL_GUIThemePartProperty &property) const;
77 
79  int get_property_int(const CL_GUIThemePartProperty &property) const;
80 
84  CL_GUIComponent *get_component() const;
85 
87  CL_Rect get_content_box(const CL_Rect &render_box_rect) const;
88 
90  CL_Rect get_content_shrink_box() const;
91 
93  CL_Rect get_render_box(const CL_Rect &content_box_rect) const;
94 
96  CL_Size get_minimum_size() const;
97 
99  int get_minimum_width() const;
100 
102  int get_minimum_height() const;
103 
105  CL_Size get_maximum_size() const;
106 
108  int get_maximum_width() const;
109 
111  int get_maximum_height() const;
112 
114  CL_Size get_preferred_size() const;
115 
117  int get_preferred_width() const;
118 
120  int get_preferred_height() const;
121 
123  CL_Font get_font() const;
124 
126  CL_Size get_text_size(CL_GraphicContext &gc, const CL_StringRef &str) const;
127 
131 public:
133  bool set_state(const CL_StringRef &name, bool flag);
134 
140  void render_box(CL_GraphicContext &gc, const CL_Rect &rect, const CL_Rect &clip_rect);
141 
142  CL_Rect render_text(
143  CL_GraphicContext &gc,
144  const CL_StringRef &text,
145  const CL_Rect &content_rect,
146  const CL_Rect &clip_rect);
147 
149  {
150  float top;
151  float baseline;
152  float bottom;
153  };
154 
156  VerticalTextPosition get_vertical_text_align(CL_GraphicContext &gc, CL_Font &font, const CL_Rect &content_rect);
157 
161 private:
162  CL_SharedPtr<CL_GUIThemePart_Impl> impl;
163 
164  friend class CL_GUIThemePartProperty_Impl;
166 };