adonthell-commits
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Adonthell-commits] CVS: adonthell/src/gui bin.cc,1.1.2.3,1.1.2.4 border


From: VENNIN Joel <address@hidden>
Subject: [Adonthell-commits] CVS: adonthell/src/gui bin.cc,1.1.2.3,1.1.2.4 border_ui.cc,1.1.2.2,1.1.2.3 box.cc,1.1.2.3,1.1.2.4 box.h,1.1.2.2,1.1.2.3 button.cc,1.1.2.2,1.1.2.3 button_ui.cc,1.1.2.1,1.1.2.2 container.cc,1.1.2.3,1.1.2.4 widget.cc,1.1.2.3,1.1.2.4 widget.h,1.1.2.3,1.1.2.4
Date: Mon, 21 Oct 2002 06:42:51 -0400

Update of /cvsroot/adonthell/adonthell/src/gui
In directory subversions:/tmp/cvs-serv19400/src/gui

Modified Files:
      Tag: Branch_road_to_0-4
        bin.cc border_ui.cc box.cc box.h button.cc button_ui.cc 
        container.cc widget.cc widget.h 
Log Message:
Change box container, because it was difficult to use  ...
Correct some bugs
It's always not usable for now 


Index: bin.cc
===================================================================
RCS file: /cvsroot/adonthell/adonthell/src/gui/Attic/bin.cc,v
retrieving revision 1.1.2.3
retrieving revision 1.1.2.4
diff -C2 -r1.1.2.3 -r1.1.2.4
*** bin.cc      18 Oct 2002 22:58:28 -0000      1.1.2.3
--- bin.cc      21 Oct 2002 10:42:48 -0000      1.1.2.4
***************
*** 77,80 ****
--- 77,81 ----
      {
        /* we center the alone child */
+       child->set_position ( get_border_width (), get_border_width ());
        child->set_size (get_length () - ( get_border_width () << 1 ), 
get_height () - ( get_border_width() << 1));
        child->realize ();
***************
*** 119,126 ****
  {
    container::realize ();
!   //check size and location of children
!   set_position ( get_x(), get_y());
!   set_size (get_length(), get_height());
!   //WARNING : execute child->realize () ??
  }
  
--- 120,132 ----
  {
    container::realize ();
! 
!   /* if there is a child, we resize it and rebuild it */
!   if (child)
!     {
!       /* we center the alone child */
!       child->set_position ( get_border_width (), get_border_width ()); 
!       child->set_size (get_length () - ( get_border_width () << 1 ), 
get_height () - ( get_border_width() << 1));
!       child->realize ();
!     }
  }
  

Index: border_ui.cc
===================================================================
RCS file: /cvsroot/adonthell/adonthell/src/gui/Attic/border_ui.cc,v
retrieving revision 1.1.2.2
retrieving revision 1.1.2.3
diff -C2 -r1.1.2.2 -r1.1.2.3
*** border_ui.cc        26 Sep 2002 11:28:37 -0000      1.1.2.2
--- border_ui.cc        21 Oct 2002 10:42:48 -0000      1.1.2.3
***************
*** 112,117 ****
                                          
(img_[border_template::B_BOTTOM]->height()>>1) + container_->get_height());
  
!   std::cout << "border_ui::move x:" << container_->get_x_real () << " y:" << 
container_->get_y_real () << " l:" 
            << container_->get_length() << " h:" << container_->get_height() << 
std::endl;
  }
  
--- 112,118 ----
                                          
(img_[border_template::B_BOTTOM]->height()>>1) + container_->get_height());
  
!   /*  std::cout << "border_ui::move x:" << container_->get_x_real () << " y:" 
<< container_->get_y_real () << " l:" 
            << container_->get_length() << " h:" << container_->get_height() << 
std::endl;
+   */
  }
  

Index: box.cc
===================================================================
RCS file: /cvsroot/adonthell/adonthell/src/gui/Attic/box.cc,v
retrieving revision 1.1.2.3
retrieving revision 1.1.2.4
diff -C2 -r1.1.2.3 -r1.1.2.4
*** box.cc      18 Oct 2002 22:58:29 -0000      1.1.2.3
--- box.cc      21 Oct 2002 10:42:48 -0000      1.1.2.4
***************
*** 13,38 ****
  */
  
  #include "box.h"
  
  using namespace gui;
  
! box::box () : geometry_ (box::HORIZONTAL), homogene_ (false), spacing_ (0)
  {
      
  }
  
- 
- void box::set_homogene(const bool b)
- {
-     homogene_ = b; 
- }
- 
- 
- bool box::get_homogene () const
- {
-     return homogene_; 
- }
- 
- 
  void box::set_spacing(const u_int16 b)
  {
--- 13,26 ----
  */
  
+ #include <iostream>
  #include "box.h"
  
  using namespace gui;
  
! box::box () : geometry_ (box::HORIZONTAL), spacing_ (4)
  {
      
  }
  
  void box::set_spacing(const u_int16 b)
  {
***************
*** 50,54 ****
  {
    /* by default add the widget at the end */
!     add_end (w);     
  }
  
--- 38,42 ----
  {
    /* by default add the widget at the end */
!   add_end (w);     
  }
  
***************
*** 56,70 ****
  void box::remove (widget * w)
  {
!     std::deque <box_struct* >::iterator it = v_widget_.begin ();
!     /* find the widget */
!     while (it != v_widget_.end () && (*it)->widget_ != w) it++;
! 
!     /* if there is a widget erase it */
!     if (it != v_widget_.end ()) 
!       {
!         v_widget_.erase (it);
!       /* call the remove method */
!       on_remove (); 
!       }
  }
  
--- 44,58 ----
  void box::remove (widget * w)
  {
!   std::deque <box_struct* >::iterator it = v_widget_.begin ();
!   /* find the widget */
!   while (it != v_widget_.end () && (*it)->widget_ != w) it++;
!   
!   /* if there is a widget erase it */
!   if (it != v_widget_.end ()) 
!     {
!       v_widget_.erase (it);
!       /* call the remove method */
!       on_remove (); 
!     }
  }
  
***************
*** 80,99 ****
    v_widget_.clear (); 
  }
-     
  
! void box::add_start (widget * w, bool expand, bool fill, u_int16 padding)
  {
    box_struct * tmp =  new box_struct;
    
    tmp->widget_ = w;
-   tmp->fill_ = fill;
    tmp->expand_ = expand;
-   tmp->padding_ = padding;
    
    v_widget_.push_front (tmp);  
    w->set_parent (this); 
    
-   update_homogene (); 
-   
    on_add (); 
  }
--- 68,83 ----
    v_widget_.clear (); 
  }
  
! 
! void box::add_start (widget * w, bool expand )
  {
    box_struct * tmp =  new box_struct;
    
    tmp->widget_ = w;
    tmp->expand_ = expand;
    
    v_widget_.push_front (tmp);  
    w->set_parent (this); 
    
    on_add (); 
  }
***************
*** 111,164 ****
  {
    if (v_widget_.size () == 0) return; 
! 
    /* init value with border width */
!   u_int16 x_tmp = 0; // my_border_width;
!   u_int16 y_tmp = 0; // my_border_width;
! 
    /* calcul the max length for each widget*/
!   u_int16 max_length = (get_length () - ((v_widget_.size () - 1)  * spacing_) 
- (my_border_width << 1) ) / v_widget_.size (); 
    
    for (u_int16 i = 0;i < v_widget_.size (); i++)  
!     {
!       if (v_widget_[i]->expand_ == true)
!         {
!         if (v_widget_[i]->fill_ == true)
!             {
!             v_widget_[i]->widget_->set_size (max_length, get_height () - 
(my_border_width << 1)); 
!             v_widget_[i]->widget_->set_position (x_tmp, y_tmp);
!             x_tmp += max_length; 
!             }
!         else
!             {
!             // before fill just add padding
!             v_widget_[i]->widget_->set_size ( max_length - 
(v_widget_[i]->padding_ << 1), 
!                                               get_height () - 
(my_border_width << 1) - (v_widget_[i]->padding_ << 1));
!             v_widget_[i]->widget_->set_position (x_tmp + 
v_widget_[i]->padding_, y_tmp + v_widget_[i]->padding_);
!             x_tmp += max_length; 
!             } 
!         }
!       else
!       {
!         /* move */
!         v_widget_[i]->widget_->set_position (x_tmp, y_tmp); 
!         
!         v_widget_[i]->widget_->set_size ( (v_widget_[i]->widget_->get_length 
() > max_length) ? max_length : v_widget_[i]->widget_->get_length (),
!                                           get_height () - (my_border_width << 
1) );   
!         
!         x_tmp += v_widget_[i]->widget_->get_length ();
!         
!         /* calcul new max_length */
!         if ((v_widget_.size () - i - 1) != 0) 
!           max_length = ((get_length () - ((v_widget_.size () - 1)  * 
spacing_) - my_border_width ) - x_tmp )
!             / ( v_widget_.size () - i - 1)   ;
!         else
!             {
!             /*this is the last widget*/
!             /* we resize the container */
!             set_size (x_tmp + my_border_width, get_height ());  
!             } 
!         }  
!         /*add space between each widget */
!         x_tmp += spacing_; 
      }
  }
--- 95,120 ----
  {
    if (v_widget_.size () == 0) return; 
!   
    /* init value with border width */
!   s_int16 x_tmp = my_border_width;
!   s_int16 y_tmp = my_border_width;
!   
    /* calcul the max length for each widget*/
!   s_int32 max_length = (get_length () - ((v_widget_.size () - 1)  * spacing_) 
- (my_border_width << 1) ) / v_widget_.size (); 
! 
!   std::cout << "Box id:" << get_id () << "  wml:" <<max_length << "  l:" << 
get_length () << " sdfsdfs\n";
    
    for (u_int16 i = 0;i < v_widget_.size (); i++)  
!     {   
!       /*calcul the size for the widget */
!       v_widget_[i]->widget_->set_size (max_length, (s_int32) (get_height () - 
(my_border_width << 1))); 
!       /* define the new position for the widget */
!       v_widget_[i]->widget_->set_position (x_tmp, y_tmp);
!       
!       x_tmp += max_length; 
!       
!       /*add space between each widget */
!       x_tmp += spacing_;
!       x_tmp += spacing_;
      }
  }
***************
*** 170,223 ****
    if (v_widget_.size () == 0) return; 
    
!   s_int32 x_tmp = 0; // not border with because border width is added in 
widget::set_position
!   s_int32 y_tmp = 0; 
    
    /* calcul the max height for each widget*/
!   u_int32 max_height = (get_height () - ((v_widget_.size () - 1)  * spacing_) 
- (my_border_width << 1) ) / v_widget_.size (); 
    
    for (u_int16 i = 0;i < v_widget_.size (); i++)  
      {
!       //if we set widget size at the box size 
!       if (v_widget_[i]->expand_ == true)
!         {
!         //if fill is false we strect the widget width padding value
!         if (v_widget_[i]->fill_ == true)
!             {
!                 v_widget_[i]->widget_->set_size (get_length () - 
(my_border_width << 1),  max_height); 
!                 v_widget_[i]->widget_->set_position (x_tmp, y_tmp);
!                 y_tmp += max_height; 
!             }
!             else
!             {
!             // before fill just add padding
!             v_widget_[i]->widget_->set_size (get_length () - (my_border_width 
<< 1) - (v_widget_[i]->padding_ << 1),
!                                              max_height - 
(v_widget_[i]->padding_ << 1)); 
!             v_widget_[i]->widget_->set_position (x_tmp + 
v_widget_[i]->padding_,
!                                                  y_tmp + 
v_widget_[i]->padding_);
!             y_tmp += max_height; 
!             } 
!         }
!         else
!         {
!         /* move */
!         v_widget_[i]->widget_->set_position (x_tmp, y_tmp); 
!         
!         v_widget_[i]->widget_->set_size (get_length () - (my_border_width << 
1),
!                                          (v_widget_[i]->widget_->get_height 
() > max_height) ? max_height : v_widget_[i]->widget_->get_height ()
!                                          );   
!             
!             y_tmp += v_widget_[i]->widget_->get_height ();
!             
!             /* calcul new max_length */
!             if ((v_widget_.size () - i - 1) != 0) 
!                 max_height = ((get_height () - ((v_widget_.size () - 1)  * 
spacing_) - my_border_width ) - y_tmp )
!                     / ( v_widget_.size () - i - 1)   ;
!             else
!             {
!             /*this is the last widget*/
!             /* we resize the container */
!             set_size (get_length (), y_tmp + my_border_width);  
!             } 
!         }  
        /*add space between each widget */
        y_tmp += spacing_; 
--- 126,144 ----
    if (v_widget_.size () == 0) return; 
    
!   s_int16 x_tmp = 0; // not border with because border width is added in 
widget::set_position
!   s_int16 y_tmp = 0; 
    
    /* calcul the max height for each widget*/
!   s_int32 max_height = (get_height () - ((v_widget_.size () - 1)  * spacing_) 
- (my_border_width << 1) ) / v_widget_.size (); 
    
+   std::cout << " Box id: " << get_id () << "  wmh:"<< max_height << "  h" << 
get_height () << " sdfsdfs\n";
+ 
    for (u_int16 i = 0;i < v_widget_.size (); i++)  
      {
!       
!       v_widget_[i]->widget_->set_size (get_length () - (my_border_width << 
1),  max_height); 
!       v_widget_[i]->widget_->set_position (x_tmp, y_tmp);
!       y_tmp += max_height; 
!       
        /*add space between each widget */
        y_tmp += spacing_; 
***************
*** 227,245 ****
  
  
! void box::add_end (widget * w, bool expand, bool fill, u_int16 padding)
  {
!     box_struct * tmp =  new box_struct;
! 
!     tmp->widget_ = w;
!     tmp->fill_ = fill;
!     tmp->expand_ = expand;
!     tmp->padding_ = padding;
! 
!     v_widget_.push_back (tmp);  
!     w->set_parent (this);
!     
!     update_homogene (); 
!     
!     on_add (); 
  }
  
--- 148,162 ----
  
  
! void box::add_end (widget * w, bool expand )
  {
!   box_struct * tmp =  new box_struct;
!   
!   tmp->widget_ = w;
!   tmp->expand_ = expand;
!   
!   v_widget_.push_back (tmp);  
!   w->set_parent (this);
!   
!   on_add (); 
  }
  
***************
*** 250,277 ****
  }
  
- 
- void box::update_homogene ()
- {
-     if (!homogene_) return;
- 
-     // WARNING : should be improve with keep in this max_length and max_height
-     // find max length and max height
-     u_int16 max_length = 0;
-     u_int16 max_height = 0;
-     
-     for (std::deque <box_struct* >::iterator it = v_widget_.begin (); it != 
v_widget_.end (); it++)
-     {
-         if (max_length < (*it)->widget_->get_length ()) max_length = 
(*it)->widget_->get_length ();
-         if (max_length < (*it)->widget_->get_height ()) max_height = 
(*it)->widget_->get_height ();
-     }
- 
-     // now resize
-     for (std::deque <box_struct* >::iterator it = v_widget_.begin (); it != 
v_widget_.end (); it++)
-         (*it)->widget_->set_size (max_length, max_height);    
- }
- 
- 
- 
- 
  bool box::draw (gfx::drawing_area * da, gfx::surface * sf)
  {    
--- 167,170 ----
***************
*** 301,304 ****
--- 194,205 ----
      for (std::deque <box_struct* >::iterator it = v_widget_.begin (); it != 
v_widget_.end (); it++)
          (*it)->widget_->update_position ();
+ }
+ 
+ 
+ void box::update_size ()
+ {
+   container::update_size ();
+   
+   realize ();
  }
  

Index: box.h
===================================================================
RCS file: /cvsroot/adonthell/adonthell/src/gui/Attic/box.h,v
retrieving revision 1.1.2.2
retrieving revision 1.1.2.3
diff -C2 -r1.1.2.2 -r1.1.2.3
*** box.h       26 Sep 2002 11:28:37 -0000      1.1.2.2
--- box.h       21 Oct 2002 10:42:48 -0000      1.1.2.3
***************
*** 1,14 ****
  /*
!    $Id$
  
!    (C) Copyright 2002 Joel Vennin
!    Part of the Adonthell Project http://adonthell.linuxgames.com
  
!    This program is free software; you can redistribute it and/or modify
!    it under the terms of the GNU General Public License.
!    This program is distributed in the hope that it will be useful,
!    but WITHOUT ANY WARRANTY.
  
!    See the COPYING file for more details
  */
  
--- 1,14 ----
  /*
!   $Id$
  
!   (C) Copyright 2002 Joel Vennin
!   Part of the Adonthell Project http://adonthell.linuxgames.com
  
!   This program is free software; you can redistribute it and/or modify
!   it under the terms of the GNU General Public License.
!   This program is distributed in the hope that it will be useful,
!   bbut WITHOUT ANY WARRANTY.
  
!   See the COPYING file for more details
  */
  
***************
*** 38,193 ****
     */
    class box : public container
!     {
!       public :
!     
!       /**
!        * Constructor,  initilase to  HORIZONTAL dispoition, homogene is false.
!        */
!       box ();
!     
!     
!       /** Set homogene.
!        * @param true : all widget are the maxlength and max height of another 
one widget;  false : widget keep their size. 
!        */
!       void set_homogene (const bool b); 
!     
!     
!       /** get homogene
!        * @return : return homogene
!        */
!       bool get_homogene () const; 
! 
! 
!       /**
!        * Add a widget in the list,  at the end of the list. It's same than 
add_end () 
!        * on_add event is executed
!        * @param a widget to add
!        */
!       void add (widget * w); 
!     
      
!       /** Remove a widget,  don't delete the object
!        * on_remove event is executed
!        * @param remove the widget
!        */
!       void remove (widget *  w); 
! 
  
!       /** clear all widget of the vector and child,  they are deleted
!        * No event is called
!        */
!       void clear (); 
        
        
!       /** 
!        * It's used to build the widget.
!        */
!       void realize ();
  
      
!       /** add widget at the beginning
!        * @param widget to add,  on_add event is executed
!        */
!       void add_start (widget * w, bool expand = true, bool fill = true, 
u_int16 padding = 0); 
        
        
!       /** add widget at the end
!        * @param widget to add at the end ,  on_add event is executed
!        */
!       void add_end (widget * w, bool expand = true, bool fill = true, u_int16 
padding = 0); 
      
  
!       /** set space between each child
!        * @param space in pixel
!        */
!       void set_spacing (const u_int16 s); 
  
      
!       /** get  space between each object
!        * @return space
!        */
!       u_int16 get_spacing () const; 
        
        
!       /**draw the widget
!        */
!       virtual bool draw (gfx::drawing_area * da = NULL, gfx::surface * sf = 
NULL); 
        
        
!       /**set_geometry
!        * @param g gemotry is VERTICAL or HORIZONTAL (default) .
!        */
!       void set_geometry (const u_int8 g); 
      
  
!       /**
!        * update position
!        */
!       void update_position (); 
        
        
!       /**
!        * input update function
!        * @return 1 if this object use the event,  else return 0
!        */
!       virtual int input_update (input::event *); 
        
        
!       ~box (); 
        
!       static const u_int8 VERTICAL = 0;
!       static const u_int8 HORIZONTAL = 1; 
        
!       protected : 
! 
!     
!       private : 
! 
!       /**homogene update is called when an object is added
!        */
!       void update_homogene (); 
  
      
!       /** build the box in horizontal geometry
!        */
!       void realize_horizontal ();
        
      
!       /** build the box in vertical geometry
!        */
!       void realize_vertical ();
      
  
!       struct box_struct
!       {
!         /* the widget */
!         widget * widget_;
!         
!         /* if true widget is streching to the container size, else container 
is stretch to widget */
!         bool expand_;
! 
!         /* if fill = expand = true so widget is streching to the container 
size,
!            but if fill = false widget is streching to the container size with 
padding */
!         bool fill_;
          
!         u_int16 padding_; 
!       }; 
!       
!       
!       /* HORIZONTAL OR VERTICAL */
!       u_int8 geometry_; 
        
        
!       /* if all widget have same size */
!       bool homogene_; 
        
!     
!       /* space between each widget */
!       u_int16 spacing_; 
        
        
!       /* contains widget */
!       std::deque <box_struct* > v_widget_;   
!     }; 
  };
  
--- 38,169 ----
     */
    class box : public container
!   {
!   public :
!       
!     /**
!      * Constructor,  initilase to  HORIZONTAL dispoition, homogene is false.
!      */
!     box ();
!       
!       
!     /**
!      * Add a widget in the list,  at the end of the list. It's same than 
add_end () 
!      * on_add event is executed
!      * @param a widget to add
!      */
!     void add (widget * w); 
!       
      
!     /** Remove a widget,  don't delete the object
!      * on_remove event is executed
!      * @param remove the widget
!      */
!     void remove (widget *  w); 
!       
  
!     /** clear all widget of the vector and child,  they are deleted
!      * No event is called
!      */
!     void clear (); 
        
        
!     /** 
!      * It's used to build the widget.
!      */
!     void realize ();
  
      
!     /** add widget at the beginning
!      * @param widget to add,  on_add event is executed
!      */
!     void add_start (widget * w, bool expand = true); 
        
        
!     /** add widget at the end
!      * @param widget to add at the end ,  on_add event is executed
!      */
!     void add_end (widget * w, bool expand = true); 
      
  
!     /** set space between each child
!      * @param space in pixel
!      */
!     void set_spacing (const u_int16 s); 
  
      
!     /** get  space between each object
!      * @return space
!      */
!     u_int16 get_spacing () const; 
        
        
!     /**draw the widget
!      */
!     virtual bool draw (gfx::drawing_area * da = NULL, gfx::surface * sf = 
NULL); 
        
        
!     /**set_geometry
!      * @param g gemotry is VERTICAL or HORIZONTAL (default) .
!      */
!     void set_geometry (const u_int8 g); 
      
  
!     /**
!      * update position
!      */
!     void update_position (); 
! 
!     void update_size ();
        
        
!     /**
!      * input update function
!      * @return 1 if this object use the event,  else return 0
!      */
!     virtual int input_update (input::event *); 
        
        
!     ~box (); 
        
!     static const u_int8 VERTICAL = 0;
!     static const u_int8 HORIZONTAL = 1; 
        
!   protected : 
  
      
!   private : 
!       
!       
!     /** build the box in horizontal geometry
!      */
!     void realize_horizontal ();
        
      
!     /** build the box in vertical geometry
!      */
!     void realize_vertical ();
      
  
!     struct box_struct
!     {
!       /* the widget */
!       widget * widget_;
          
!       /* if true widget is streching to the container size, else container is 
stretch to widget */
!       bool expand_;
!     }; 
        
        
!     /* HORIZONTAL OR VERTICAL */
!     u_int8 geometry_; 
        
! 
!     /* space between each widget */
!     u_int16 spacing_; 
        
        
!     /* contains widget */
!     std::deque <box_struct* > v_widget_;   
!   }; 
  };
  

Index: button.cc
===================================================================
RCS file: /cvsroot/adonthell/adonthell/src/gui/Attic/button.cc,v
retrieving revision 1.1.2.2
retrieving revision 1.1.2.3
diff -C2 -r1.1.2.2 -r1.1.2.3
*** button.cc   18 Oct 2002 22:58:29 -0000      1.1.2.2
--- button.cc   21 Oct 2002 10:42:48 -0000      1.1.2.3
***************
*** 69,73 ****
    clear();
    
!   label * lab = new label;
    lab->set_font (*font);
    lab->set_text (text);
--- 69,73 ----
    clear();
    
!   /*  label * lab = new label;
    lab->set_font (*font);
    lab->set_text (text);
***************
*** 75,79 ****
    //  lab->set_alignment ( misc::CENTER, misc::CENTER );
    add ( lab );
!   lab->realize();
  }
  
--- 75,79 ----
    //  lab->set_alignment ( misc::CENTER, misc::CENTER );
    add ( lab );
!   lab->realize();*/
  }
  

Index: button_ui.cc
===================================================================
RCS file: /cvsroot/adonthell/adonthell/src/gui/Attic/button_ui.cc,v
retrieving revision 1.1.2.1
retrieving revision 1.1.2.2
diff -C2 -r1.1.2.1 -r1.1.2.2
*** button_ui.cc        2 Jul 2002 07:20:30 -0000       1.1.2.1
--- button_ui.cc        21 Oct 2002 10:42:48 -0000      1.1.2.2
***************
*** 13,16 ****
--- 13,18 ----
  */
  
+ #include <iostream>
+ 
  #include "button_ui.h"
  
***************
*** 30,34 ****
    if( button_->get_pressed()) pressed_border_->draw(da, sf);
    else released_border_->draw(da, sf);
!   background_->draw (da, sf);
  }
  
--- 32,37 ----
    if( button_->get_pressed()) pressed_border_->draw(da, sf);
    else released_border_->draw(da, sf);
! 
!   //background_->draw (da, sf);
  }
  
***************
*** 41,44 ****
--- 44,50 ----
    released_border_->resize();
    background_->resize();
+ 
+   std::cout << "ID:" << button_->get_id () << 
+     " x:" << button_->get_x() << " y:" << button_->get_y () << " l:" << 
button_->get_length () << "  h:" << button_->get_height () << std::endl;
  }
  

Index: container.cc
===================================================================
RCS file: /cvsroot/adonthell/adonthell/src/gui/Attic/container.cc,v
retrieving revision 1.1.2.3
retrieving revision 1.1.2.4
diff -C2 -r1.1.2.3 -r1.1.2.4
*** container.cc        18 Oct 2002 22:58:29 -0000      1.1.2.3
--- container.cc        21 Oct 2002 10:42:48 -0000      1.1.2.4
***************
*** 35,39 ****
  
  
- 
  container::~container ()
  {
--- 35,38 ----
***************
*** 45,50 ****
--- 44,52 ----
  void container::set_border_ui (border_template * bd_tmp)
  {
+   /* if there is already object remove it */
    if ( my_object_ui)  delete my_object_ui;
+   /* build a new border */
    my_object_ui = new border_ui (this);
+   /* define the new border */
    ((border_ui*)my_object_ui)->set_border (bd_tmp); 
  }
***************
*** 52,62 ****
--- 54,70 ----
  bool container::draw (gfx::drawing_area * da, gfx::surface * sf)
  {
+   /* call the widget draw */
    if (widget::draw (da, sf) )
      {
+       /* attach drawing area */
        assign_drawing_area (da);
+       /* draw the theme */
        if (my_object_ui) my_object_ui->draw(da, sf);
+       /* detach the drawing area */
        detach_drawing_area ();
+       
        return true;
      }
+   
    return false;
  }
***************
*** 64,69 ****
  void container::update_size ()
  {
    widget::update_size ();
!   
    if (my_object_ui) my_object_ui->resize();
  }
--- 72,78 ----
  void container::update_size ()
  {
+   /* update widget size */
    widget::update_size ();
!   /* if there is is a ui object update it */
    if (my_object_ui) my_object_ui->resize();
  }
***************
*** 80,95 ****
  {
    widget::realize();
    /* we call resize for objet_ui */
    if (my_object_ui) my_object_ui->resize ();
  }
- 
- 
- 
- 
- 
- 
- 
- 
- 
- 
- 
--- 89,94 ----
  {
    widget::realize();
+   
    /* we call resize for objet_ui */
    if (my_object_ui) my_object_ui->resize ();
  }

Index: widget.cc
===================================================================
RCS file: /cvsroot/adonthell/adonthell/src/gui/Attic/widget.cc,v
retrieving revision 1.1.2.3
retrieving revision 1.1.2.4
diff -C2 -r1.1.2.3 -r1.1.2.4
*** widget.cc   18 Oct 2002 22:58:29 -0000      1.1.2.3
--- widget.cc   21 Oct 2002 10:42:48 -0000      1.1.2.4
***************
*** 20,27 ****
--- 20,32 ----
  using namespace gui;
  
+ int widget::ID_ = 0;
+ 
  widget::widget () : parent_ (NULL) 
  {    
+   my_ID = ID_++;
  }
  
+ int widget::get_id () const { return my_ID;}
+ 
   
  void widget::set_parent (container * parent)
***************
*** 42,46 ****
  {
    /* if there is a parent, calcul obsolute position with relative position */
!   if (parent_) drawing_area::move (parent_->get_x_real () + x_ + 
parent_->get_border_width (), parent_->get_y_real () + y_ 
+parent_->get_border_width () );
    else drawing_area::move (x_, y_); 
  }
--- 47,51 ----
  {
    /* if there is a parent, calcul obsolute position with relative position */
!   if (parent_) drawing_area::move (parent_->get_x_real () + x_ , 
parent_->get_y_real () + y_ );
    else drawing_area::move (x_, y_); 
  }
***************
*** 72,77 ****
  void widget::set_size (s_int32 length, s_int32 height)
  {
!   if (get_length () == length && get_height () == height) return; 
!   
    if ( length >= 0 && height >=0) drawing_area::resize (length, height); 
    else if (length >= 0 ) drawing_area::resize (length, 0);
--- 77,81 ----
  void widget::set_size (s_int32 length, s_int32 height)
  {
!   if (get_length () == length && get_height () == height); 
    if ( length >= 0 && height >=0) drawing_area::resize (length, height); 
    else if (length >= 0 ) drawing_area::resize (length, 0);
***************
*** 183,186 ****
--- 187,193 ----
  bool widget::draw (gfx::drawing_area * da, gfx::surface * sf)
  {
+   
+   
+ 
    return visible_;
  }

Index: widget.h
===================================================================
RCS file: /cvsroot/adonthell/adonthell/src/gui/Attic/widget.h,v
retrieving revision 1.1.2.3
retrieving revision 1.1.2.4
diff -C2 -r1.1.2.3 -r1.1.2.4
*** widget.h    18 Oct 2002 22:58:29 -0000      1.1.2.3
--- widget.h    21 Oct 2002 10:42:48 -0000      1.1.2.4
***************
*** 217,220 ****
--- 217,223 ----
        virtual bool update (); 
        
+       
+       int get_id () const;
+ 
      
        /** Execute on_destroy callback 
***************
*** 238,243 ****
      
        
-       private : 
-       
        /* get event from this windows */
        // window * parent_window_; 
--- 241,244 ----
***************
*** 276,279 ****
--- 277,285 ----
        bool has_default_;
      
+ 
+       static int ID_;
+ 
+       int my_ID;
+ 
      };  
    





reply via email to

[Prev in Thread] Current Thread [Next in Thread]