ClanLib  2.3.7
push_button.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 ** Harry Storbacka
27 ** Kenneth Gangstoe
28 ** Magnus Norddahl
29 */
30 
33 
34 #pragma once
35 
36 #include "../api_gui.h"
37 #include "../gui_component.h"
38 #include "../../Core/Signals/callback_v0.h"
39 #include "../../Display/Render/graphic_context.h"
40 
41 class CL_Image;
42 class CL_PushButton_Impl;
43 
48 {
51 
52 public:
53 
58 
59  virtual ~CL_PushButton();
60 
64 
65 public:
66 
68 
72  static CL_PushButton *get_named_item(CL_GUIComponent *reference_component, const CL_StringRef &id);
73 
77  bool is_pushed() const;
78 
82  bool is_toggle() const;
83 
87  bool is_flat() const;
88 
92  CL_Image get_icon() const;
93 
95  {
96  icon_left, icon_top, icon_right, icon_bottom
97  };
98 
102  IconPosition get_icon_position() const;
103 
104  const CL_String &get_text() const;
105 
109  CL_Size get_preferred_size() const;
110 
114 
115 public:
116 
120  void set_pushed(bool enable);
121 
125  void set_toggle(bool enable);
126 
130  void set_flat(bool enable);
131 
135  void set_icon(const CL_Image &icon);
136 
140  void set_icon_position(IconPosition pos);
141 
145  void set_text(const CL_StringRef &text);
146 
150 
151 public:
152 
156  CL_Callback_v0 &func_clicked();
157 
161 
162 private:
163  CL_SharedPtr<CL_PushButton_Impl> impl;
165 };
166