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