Adonthell  0.4
win_container.h
1 /*
2  $Id: win_container.h,v 1.17 2003/02/23 23:14:34 ksterker Exp $
3 
4  (C) Copyright 2000/2001 Joel Vennin
5  Part of the Adonthell Project http://adonthell.linuxgames.com
6 
7  This program is free software; you can redistribute it and/or modify
8  it under the terms of the GNU General Public License.
9  This program is distributed in the hope that it will be useful,
10  but WITHOUT ANY WARRANTY.
11 
12  See the COPYING file for more details
13 */
14 
15 #ifndef _WIN_CONTAINER_H_
16 #define _WIN_CONTAINER_H_
17 
18 #include<list>
19 #include "win_base.h"
20 
21 using namespace std;
22 
23 typedef list<win_base*> lwb;
24 
25 class win_container : public win_base
26 {
27  public:
28 
29  win_container();
30 
31  void move(s_int16, s_int16);
32 
33  void resize(u_int16, u_int16);
34 
35  virtual void add(win_base *);
36 
37  virtual void remove(win_base *);
38 
39  virtual void remove_all();
40 
41  virtual void destroy();
42 
43  virtual ~win_container();
44 
45  virtual bool update();
46 
47  virtual bool input_update();
48 
49  virtual bool draw();
50 
51  void set_visible_all(bool b);
52 
53  virtual void set_brightness(bool b);
54 
55  virtual void set_trans(bool b);
56 
57  virtual void set_space_with_border(u_int16 b){space_with_border_=b;update_layout();}
58 
59  virtual void set_space_with_object(u_int16 o){space_with_object_=o;update_layout();}
60 
61  u_int16 space_with_border(){return space_with_border_;}
62 
63  u_int16 space_with_object(){return space_with_object_;}
64 
65  void set_layout(u_int8 l){layout_=l;update_layout();}
66 
67  void set_focus_object(win_base * f);
68 
69  win_base * focus_object(){return focus_object_;}
70 
71  const static u_int8 SPACE_WITH_BORDER = 10;
72  const static u_int8 SPACE_WITH_OBJECT = 10;
73 
74  const static u_int8 LIST_LAYOUT = 1;
75  const static u_int8 NO_LAYOUT = 0;
76 
77  protected:
78 
79  void update_position();
80  void update_layout();
81 
82  u_int16 space_with_object_;
83  u_int16 space_with_border_;
84  u_int8 layout_;
85 
86  lwb list_wb_;
87 
88  win_base * focus_object_;
89 
90 };
91 
92 
93 /*
94 class win_base;
95 class win_theme;
96 
97 class win_container : public win_base
98 {
99  protected:
100  list<win_base *> list_obj;
101  u_int16 space_between_border_;
102  u_int16 space_between_object_;
103  // u_int8 justify_;
104  u_int8 layout_;
105  void update_layout();
106 
107  public:
108  win_container(s_int16 tx,s_int16 ty,u_int16 tl,u_int16 th,win_theme * wth);
109  ~win_container();
110 
111  //add an object
112  virtual void add(win_base *);
113 
114  //remove an object
115  virtual void remove(win_base *);
116 
117  //remove all, but not in memory
118  virtual void remove_all();
119 
120  //destroy all object of the list and in memory
121  virtual void destroy();
122 
123  //update function
124  bool update();
125 
126  //draw on the screen
127  bool draw();
128 
129  void move(s_int16 tx,s_int16 ty);
130 
131  void resize(u_int16,u_int16);
132 
133 
134  //set the space between object and the border, work if you use layout or justify
135  virtual void set_space_between_border(u_int16);
136 
137  //set the space between object and the border, work if you use layout
138  virtual void set_space_between_object(u_int16);
139 
140  u_int16 space_between_border(){return space_between_border_;}
141  u_int16 space_between_object(){return space_between_object_;}
142 
143  //if true all of this object is in brightness mode
144  void set_draw_brightness(bool b);
145 
146  //bugs in this functions.
147  void set_visible_all(bool);
148 */
149  /*
150 
151  //justify all object : WIN_JUSTIFY_LEFT, WIN_JUSTIFY_RIGHT, WIN_JUSTIFY_CENTER
152  void set_justify(u_int8);
153 
154  //justify an win_base object in this object
155  void set_justify(win_base * wb,u_int8);
156  */
157 /*
158  //align all object
159  void set_align_all(u_int8);
160 
161 
162  //set the layout (like in java i think) Now 2 sort of layout but i can add several if you suggest me. WIN_LAYOUT_NO (no layout: you put your object where you want)
163  //and WIN_LAYOUT_LIST( all object show like a listbox)
164  void set_layout(u_int8 lay);
165 
166  //IMPORTANT: You can use set_justify and layout to do good window
167 
168  void update_real_position();
169 
170  void set_focus(bool b);
171  bool is_focus(){return focus_;}
172 };
173 
174 */
175 #endif
176 
177 
178 
179 
180 
181 
182 
183