dockable_component.h
1 /*
2 ** ClanLib SDK
3 ** Copyright (c) 1997-2013 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 */
28 
29 
30 #pragma once
31 
32 namespace clan
33 {
36 
37 class EditorMainWindow;
38 class Workspace;
39 class Dock;
40 
42 {
43 public:
45 
46  void set_title(const std::string &title);
47  std::string get_title() const { return title; }
48  void show();
49  void show_as_docked(Dock *dock);
50  void show_as_window();
51  void hide();
52 
53  int get_last_docked_id() const { return last_docked_id; }
54 
55 protected:
56  virtual void on_render(Canvas &canvas, const Rect &update_box) { }
57  virtual void on_resized() { }
58 
59  void set_dockable_window_geometry(Rect new_window_geometry) { window_geometry = new_window_geometry; }
60 
61 private:
62  enum VisibilityState
63  {
64  state_docked = 0,
65  state_window = 1,
66  state_hidden = 2
67  };
68 
69  Dock *dock;
70  VisibilityState visibility;
71  std::string title;
72  Rect window_geometry;
73 
74  VisibilityState last_visibility;
75  int last_docked_id;
76 
77  friend class Workspace;
78 };
79 
80 }
81 
std::string get_title() const
Definition: dockable_component.h:47
2D Graphics Canvas
Definition: canvas.h:70
virtual void on_resized()
Definition: dockable_component.h:57
void set_dockable_window_geometry(Rect new_window_geometry)
Definition: dockable_component.h:59
void show_as_docked(Dock *dock)
void set_title(const std::string &title)
GUI base component class.
Definition: gui_component.h:80
2D (left,top,right,bottom) rectangle structure - Integer
Definition: rect.h:453
int get_last_docked_id() const
Definition: dockable_component.h:53
Definition: dockable_component.h:41
virtual void on_render(Canvas &canvas, const Rect &update_box)
Definition: dockable_component.h:56
friend class Workspace
Definition: dockable_component.h:77