20 #ifndef _MFORMS_VIEW_H_
21 #define _MFORMS_VIEW_H_
23 #include <boost/signals2.hpp>
28 #include "base/geometry.h"
29 #include "base/trackable.h"
30 #include "base/drawing.h"
120 virtual DragOperation drag_over(
View *sender, base::Point p,
const std::vector<std::string> &formats) = 0;
148 #ifndef DOXYGEN_SHOULD_SKIP_THIS
152 void (*destroy)(View *
self);
154 int (*get_width)(View *
self);
155 int (*get_height)(View *
self);
156 int (*get_preferred_width)(View *
self);
157 int (*get_preferred_height)(View *
self);
158 void (*set_size)(View *
self, int, int);
159 void (*set_padding)(View *
self, int, int, int, int);
161 int (*get_x)(View *
self);
162 int (*get_y)(View *
self);
163 void (*set_position)(View *
self, int, int);
164 std::pair<int, int> (*client_to_screen)(View *
self, int, int);
165 std::pair<int, int> (*screen_to_client)(View *
self, int, int);
167 void (*show)(View *
self, bool);
168 bool (*is_shown)(View *
self);
169 bool (*is_fully_visible)(View *
self);
171 void (*set_tooltip)(View *
self,
const std::string&);
172 void (*set_name)(View *
self,
const std::string&);
173 void (*set_font)(View *
self,
const std::string&);
175 void (*set_enabled)(View *
self, bool);
176 bool (*is_enabled)(View *
self);
177 void (*relayout)(View *
self);
178 void (*set_needs_repaint)(View *
self);
180 void (*suspend_layout)(View *
self, bool);
181 void (*set_front_color)(View *
self,
const std::string&);
182 std::string (*get_front_color)(View *
self);
183 void (*set_back_color)(View *
self,
const std::string&);
184 std::string (*get_back_color)(View *
self);
186 void (*set_back_image)(View *
self,
const std::string&,
Alignment alignment);
188 void (*flush_events)(View *
self);
189 void (*focus)(View *
self);
191 void (*register_drop_formats)(View *
self, DropDelegate *target,
const std::vector<std::string>&);
192 DragOperation (*drag_text)(View *
self, DragDetails details,
const std::string &text);
193 DragOperation (*drag_data)(View *
self, DragDetails details,
void *data,
194 const std::string &format);
203 friend class ControlFactory;
218 void cache_view(
View *sv);
219 virtual void remove_from_cache(
View *sv);
220 int get_subview_index(
View *sv);
221 View *get_subview_at_index(
int index);
224 virtual void set_back_image(
const std::string& path,
Alignment alignment);
228 virtual void set_managed();
230 View *find_subview(
const std::string &name);
231 bool contains_subview(
View* subview);
232 void clear_subviews();
234 void set_name(
const std::string &name);
235 void set_tooltip(
const std::string &text);
236 void set_font(
const std::string &fontDescription);
237 std::string get_name();
238 void set_parent(
View *parent);
239 View *get_parent()
const;
240 Form *get_parent_form()
const;
241 virtual int get_width();
242 virtual int get_height();
243 virtual int get_preferred_width();
244 virtual int get_preferred_height();
247 virtual void set_position(
int x,
int y);
248 virtual void set_size(
int width,
int height);
250 std::pair<int, int>client_to_screen(
int x,
int y);
251 std::pair<int, int>screen_to_client(
int x,
int y);
256 void show(
bool flag=
true);
266 bool is_fully_visible();
271 void set_enabled(
bool flag);
281 void set_needs_repaint();
283 virtual void relayout();
284 virtual void set_layout_dirty(
bool value);
285 virtual bool is_layout_dirty();
291 void suspend_layout();
296 void resume_layout();
301 void set_front_color(
const std::string& color);
306 std::string get_front_color();
311 void set_back_color(
const std::string& color);
316 std::string get_back_color();
322 void show_retain_counts(
int depth=0);
343 virtual void flush_events();
348 virtual void focus();
357 void register_drop_formats(
DropDelegate *target,
const std::vector<std::string> &drop_formats);
367 #ifndef DOXYGEN_SHOULD_SKIP_THIS
373 virtual bool mouse_down(
MouseButton button,
int x,
int y) {
return false; }
374 virtual bool mouse_up(
MouseButton button,
int x,
int y) {
return false; }
375 virtual bool mouse_click(
MouseButton button,
int x,
int y) {
return false; }
376 virtual bool mouse_double_click(
MouseButton button,
int x,
int y) {
return false; }
377 virtual bool mouse_enter() {
return false; }
378 virtual bool mouse_leave() {
return false; }
379 virtual bool mouse_move(
MouseButton button,
int x,
int y) {
return false; }
383 void focus_changed();
386 virtual void resize();
TextAttributes(const std::string &c, bool b, bool i)