Adonthell 0.4
win_container.h
00001 /*
00002    $Id: win_container.h,v 1.17 2003/02/23 23:14:34 ksterker Exp $
00003 
00004    (C) Copyright 2000/2001 Joel Vennin
00005    Part of the Adonthell Project http://adonthell.linuxgames.com
00006 
00007    This program is free software; you can redistribute it and/or modify
00008    it under the terms of the GNU General Public License.
00009    This program is distributed in the hope that it will be useful,
00010    but WITHOUT ANY WARRANTY.
00011 
00012    See the COPYING file for more details
00013 */
00014 
00015 #ifndef _WIN_CONTAINER_H_
00016 #define _WIN_CONTAINER_H_
00017 
00018 #include<list>
00019 #include "win_base.h"
00020 
00021 using namespace std;
00022 
00023 typedef list<win_base*> lwb;
00024 
00025 class win_container : public win_base
00026 {
00027  public:
00028   
00029   win_container();
00030   
00031   void move(s_int16, s_int16);
00032   
00033   void resize(u_int16, u_int16);
00034 
00035   virtual void add(win_base *);
00036 
00037   virtual void remove(win_base *);
00038 
00039   virtual void remove_all();
00040 
00041   virtual void destroy();
00042 
00043   virtual ~win_container();
00044   
00045   virtual bool update();
00046 
00047   virtual bool input_update();
00048   
00049   virtual bool draw();
00050   
00051   void set_visible_all(bool b);
00052   
00053   virtual void set_brightness(bool b);
00054 
00055   virtual void set_trans(bool b);
00056 
00057   virtual void set_space_with_border(u_int16 b){space_with_border_=b;update_layout();}
00058   
00059   virtual void set_space_with_object(u_int16 o){space_with_object_=o;update_layout();}
00060   
00061   u_int16 space_with_border(){return space_with_border_;}
00062   
00063   u_int16 space_with_object(){return space_with_object_;}
00064 
00065   void set_layout(u_int8 l){layout_=l;update_layout();}
00066   
00067   void set_focus_object(win_base * f);
00068   
00069   win_base * focus_object(){return focus_object_;}
00070 
00071   const static u_int8 SPACE_WITH_BORDER = 10;
00072   const static u_int8 SPACE_WITH_OBJECT = 10;
00073   
00074   const static u_int8 LIST_LAYOUT = 1;
00075   const static u_int8 NO_LAYOUT = 0;
00076 
00077  protected:
00078   
00079   void update_position();
00080   void update_layout();
00081   
00082   u_int16 space_with_object_;
00083   u_int16 space_with_border_;
00084   u_int8 layout_;
00085 
00086   lwb list_wb_;
00087 
00088   win_base * focus_object_;
00089   
00090 };
00091 
00092 
00093 /*
00094 class win_base;
00095 class win_theme;
00096 
00097 class win_container : public win_base
00098 {
00099  protected:
00100   list<win_base *> list_obj;
00101   u_int16 space_between_border_;
00102   u_int16 space_between_object_;
00103   // u_int8 justify_;
00104   u_int8 layout_;
00105   void update_layout();
00106 
00107  public:
00108   win_container(s_int16 tx,s_int16 ty,u_int16 tl,u_int16 th,win_theme * wth);
00109   ~win_container();
00110 
00111   //add an object
00112   virtual void add(win_base *);
00113 
00114   //remove an object
00115   virtual void remove(win_base *);
00116 
00117   //remove all, but not in memory
00118   virtual void remove_all();
00119 
00120   //destroy all object of the list and in memory
00121   virtual void destroy();
00122 
00123   //update function
00124   bool update();
00125 
00126   //draw on the screen
00127   bool draw();
00128   
00129   void move(s_int16 tx,s_int16 ty);
00130 
00131   void resize(u_int16,u_int16);
00132   
00133 
00134   //set the space between object and the border, work if you use layout or justify
00135   virtual void set_space_between_border(u_int16);
00136   
00137   //set the space between object and the border, work if you use layout
00138   virtual void set_space_between_object(u_int16);
00139 
00140   u_int16 space_between_border(){return space_between_border_;}
00141   u_int16 space_between_object(){return space_between_object_;}
00142 
00143   //if true all of this object is in brightness mode
00144   void set_draw_brightness(bool b);
00145 
00146   //bugs in this functions.
00147   void set_visible_all(bool);
00148 */
00149   /*
00150 
00151   //justify all object : WIN_JUSTIFY_LEFT, WIN_JUSTIFY_RIGHT, WIN_JUSTIFY_CENTER
00152   void set_justify(u_int8);
00153  
00154   //justify an win_base object in this object
00155   void set_justify(win_base * wb,u_int8);
00156   */  
00157 /*
00158   //align all object
00159   void set_align_all(u_int8);
00160 
00161 
00162   //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)
00163   //and WIN_LAYOUT_LIST( all object show like a listbox)
00164   void set_layout(u_int8 lay);
00165 
00166   //IMPORTANT: You can use set_justify and layout to do good window
00167 
00168   void update_real_position();
00169   
00170   void set_focus(bool b);
00171   bool is_focus(){return focus_;}  
00172 };
00173 
00174 */
00175 #endif
00176 
00177 
00178 
00179 
00180 
00181 
00182 
00183