adonthell-commits
[Top][All Lists]
Advanced

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

[Adonthell-commits] CVS: adonthell/src/gui object_template.cc,NONE,1.1.2


From: VENNIN Joel <address@hidden>
Subject: [Adonthell-commits] CVS: adonthell/src/gui object_template.cc,NONE,1.1.2.1 object_template.h,NONE,1.1.2.1 Makefile.am,1.1.2.3,1.1.2.4 bin.cc,1.1.2.2,1.1.2.3 bin.h,1.1.2.2,1.1.2.3 border_template.cc,1.1.2.1,1.1.2.2 border_template.h,1.1.2.1,1.1.2.2 box.cc,1.1.2.2,1.1.2.3 button.cc,1.1.2.1,1.1.2.2 button_template.cc,1.1.2.1,1.1.2.2 button_template.h,1.1.2.1,1.1.2.2 container.cc,1.1.2.2,1.1.2.3 container.h,1.1.2.2,1.1.2.3 font.cc,1.1.2.1,1.1.2.2 font.h,1.1.2.1,1.1.2.2 theme.cc,1.1.2.1,1.1.2.2 theme.h,1.1.2.1,1.1.2.2 widget.cc,1.1.2.2,1.1.2.3 widget.h,1.1.2.2,1.1.2.3 window.cc,1.1.2.2,1.1.2.3
Date: Fri, 18 Oct 2002 18:58:31 -0400

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

Modified Files:
      Tag: Branch_road_to_0-4
        Makefile.am bin.cc bin.h border_template.cc border_template.h 
        box.cc button.cc button_template.cc button_template.h 
        container.cc container.h font.cc font.h theme.cc theme.h 
        widget.cc widget.h window.cc 
Added Files:
      Tag: Branch_road_to_0-4
        object_template.cc object_template.h 
Log Message:
Change lot of thing in the gui stuff...
I have added button in the theme management.
Now the new gui is ready for utf8, so now we must use utf8 



--- NEW FILE ---
#include "object_template.h"

using namespace gui;


std::string object_template::get_name () const
{
    return my_name; 
}


void object_template::set_name (const std::string & name)
{
    my_name =  name; 
}




--- NEW FILE ---
#ifndef OBJECT_TEMPLATE_H_
#define OBJECT_TEMPLATE_H_

#include<string>
#include "fileops.h"

namespace gui
{ 
  class object_template
    {
    public:
      
      /**
       * read a stream to load image
       */
      virtual void load (igzstream & is) = 0;  
      
      
      /**
       * write image into the stream
       */
      virtual void save (ogzstream & os) = 0; 
      
      /**
       * get name of the border
       * @return name of the border
       */
      std::string get_name () const;
      
      /**
       * set name of the border
       * @param name :  name of the border
       */
      void set_name (const std::string & name); 
                
                
      /**
       * Build is automaticly call when you load a border
       */
      virtual void build() = 0;


      /**
       * write in standart ouput border information 
       */
      virtual  void display_info ()= 0;
      
      
      virtual ~object_template () {};

    protected:
      
      /* name of the template */
      std::string my_name;

    };          
}
#endif

Index: Makefile.am
===================================================================
RCS file: /cvsroot/adonthell/adonthell/src/gui/Attic/Makefile.am,v
retrieving revision 1.1.2.3
retrieving revision 1.1.2.4
diff -C2 -r1.1.2.3 -r1.1.2.4
*** Makefile.am 19 Sep 2002 20:36:49 -0000      1.1.2.3
--- Makefile.am 18 Oct 2002 22:58:28 -0000      1.1.2.4
***************
*** 6,10 ****
        border_ui.cc theme.cc background_template.cc \
        button_template.cc button.cc button_ui.cc \
!       background_ui.cc \
        box.h misc.h container.h label.h \
        font.h widget.h fixed.h \
--- 6,10 ----
        border_ui.cc theme.cc background_template.cc \
        button_template.cc button.cc button_ui.cc \
!       background_ui.cc object_template.cc\
        box.h misc.h container.h label.h \
        font.h widget.h fixed.h \
***************
*** 12,16 ****
        border_ui.h theme.h background_template.h \
        button_template.h button.h button_ui.h \
!       background_ui.h 
  
  
--- 12,16 ----
        border_ui.h theme.h background_template.h \
        button_template.h button.h button_ui.h \
!       background_ui.h object_template.h
  
  

Index: bin.cc
===================================================================
RCS file: /cvsroot/adonthell/adonthell/src/gui/Attic/bin.cc,v
retrieving revision 1.1.2.2
retrieving revision 1.1.2.3
diff -C2 -r1.1.2.2 -r1.1.2.3
*** bin.cc      26 Sep 2002 11:28:37 -0000      1.1.2.2
--- bin.cc      18 Oct 2002 22:58:28 -0000      1.1.2.3
***************
*** 68,75 ****
  
  
! void bin::set_size (s_int32 length, s_int32 height)
  {
    /* update container size */
!   container::set_size (length, height);
    
    /* if there is a child, we resize it and rebuild it */
--- 68,75 ----
  
  
! void bin::update_size ()
  {
    /* update container size */
!   container::update_size ();
    
    /* if there is a child, we resize it and rebuild it */
***************
*** 77,81 ****
      {
        /* we center the alone child */
-       std::cout << "bin::set_size " << get_border_width () << "  " 
<<(get_border_width()<<1) << std::endl;
        child->set_size (get_length () - ( get_border_width () << 1 ), 
get_height () - ( get_border_width() << 1));
        child->realize ();
--- 77,80 ----
***************
*** 102,111 ****
  
  
- void bin::set_position (s_int16 x, s_int16 y)
- {
-   container::set_position (x, y);
-   if (child) child->set_position (0, 0);
- }
- 
  /**
   * input update function
--- 101,104 ----
***************
*** 116,119 ****
--- 109,113 ----
    /* if this objet is unsensible we return 0 */
    if ( !is_sensible () || child == NULL) return 0;
+   
    /* if there is a child we send the event at the child */
    return child->input_update (ev);

Index: bin.h
===================================================================
RCS file: /cvsroot/adonthell/adonthell/src/gui/Attic/bin.h,v
retrieving revision 1.1.2.2
retrieving revision 1.1.2.3
diff -C2 -r1.1.2.2 -r1.1.2.3
*** bin.h       26 Sep 2002 11:28:37 -0000      1.1.2.2
--- bin.h       18 Oct 2002 22:58:28 -0000      1.1.2.3
***************
*** 66,70 ****
         * update position
         */
!       virtual void update_position (); 
        
        
--- 66,70 ----
         * update position
         */
!       void update_position (); 
        
        
***************
*** 73,85 ****
         * @param height
         */
!       virtual void set_size (s_int32 length, s_int32 height);
!       
!       /**
!        * Set the location of the widget
!        * @param x : 
!        * @param y:
!        */
!       virtual void set_position (s_int16 x, s_int16 y);
!       
        
        /**
--- 73,77 ----
         * @param height
         */
!       void update_size ();
        
        /**

Index: border_template.cc
===================================================================
RCS file: /cvsroot/adonthell/adonthell/src/gui/Attic/border_template.cc,v
retrieving revision 1.1.2.1
retrieving revision 1.1.2.2
diff -C2 -r1.1.2.1 -r1.1.2.2
*** border_template.cc  2 Jul 2002 07:20:30 -0000       1.1.2.1
--- border_template.cc  18 Oct 2002 22:58:28 -0000      1.1.2.2
***************
*** 32,36 ****
      // free memory before
      destroy ();
!     name_ << is ; 
      
      for (int i = 0; i < _LAST; i++)
--- 32,36 ----
      // free memory before
      destroy ();
!     my_name << is ; 
      
      for (int i = 0; i < _LAST; i++)
***************
*** 74,78 ****
  void border_template::save (ogzstream & os)
  {
!     name_ >> os; 
      for (int i = 0; i < _LAST; i++) 
          img_[i]->put (os); 
--- 74,78 ----
  void border_template::save (ogzstream & os)
  {
!     my_name >> os; 
      for (int i = 0; i < _LAST; i++) 
          img_[i]->put (os); 
***************
*** 132,150 ****
  
  
- std::string border_template::get_name () const
- {
-     return name_; 
- }
- 
  
- void border_template::set_name (const std::string & name)
- {
-     name_ =  name; 
- }
  
  
! void border_template::display_info () const
  {
!     std::cout << "border name : " << name_ << std::endl;
      std::cout << "List of image : \n";
  
--- 132,141 ----
  
  
  
  
  
! void border_template::display_info ()
  {
!     std::cout << "border name : " << my_name << std::endl;
      std::cout << "List of image : \n";
  

Index: border_template.h
===================================================================
RCS file: /cvsroot/adonthell/adonthell/src/gui/Attic/border_template.h,v
retrieving revision 1.1.2.1
retrieving revision 1.1.2.2
diff -C2 -r1.1.2.1 -r1.1.2.2
*** border_template.h   2 Jul 2002 07:20:30 -0000       1.1.2.1
--- border_template.h   18 Oct 2002 22:58:29 -0000      1.1.2.2
***************
*** 28,37 ****
  #include "fileops.h"
  #include "gfx/image.h"
! 
  
  namespace gui
  {
  
!   class border_template
      {
        public : 
--- 28,37 ----
  #include "fileops.h"
  #include "gfx/image.h"
! #include "object_template.h"
  
  namespace gui
  {
  
!   class border_template : public object_template
      {
        public : 
***************
*** 41,78 ****
           */
          border_template (); 
!     
!     
        /**
         * read a stream to load image
         */
        void load (igzstream & is);  
!     
!     
        /**
         * write image into the stream
         */
        void save (ogzstream & os); 
-     
-     
-     
-       /**
-        * get name of the border
-        * @return name of the border
-        */
-       std::string get_name () const;
-     
-     
-       /**
-        * set name of the border
-        * @param name :  name of the border
-        */
-       void set_name (const std::string & name); 
-     
  
-       /**
-        * Build is automaticly call when you load a border
-        * build create 4 big border
-        */
-       void build();
  
        /**
--- 41,57 ----
           */
          border_template (); 
!  
!       
        /**
         * read a stream to load image
         */
        void load (igzstream & is);  
!       
!       
        /**
         * write image into the stream
         */
        void save (ogzstream & os); 
  
  
        /**
***************
*** 109,114 ****
         * write in standart ouput border information 
         */
!       void display_info () const;
      
  
        /**
--- 88,99 ----
         * write in standart ouput border information 
         */
!       void display_info ();
      
+               
+       /**
+        * Build is automaticly call when you load a border
+        * build create 4 big border
+        */
+       void build();
  
        /**
***************
*** 139,145 ****
        /* this tab is used to store big border, it is necessary to optimise  
resize and to reduce memory use */
        gfx::image * imgborder_[C_TL];
- 
-       /* name of the border */
-       std::string name_; 
  
        private : 
--- 124,127 ----

Index: box.cc
===================================================================
RCS file: /cvsroot/adonthell/adonthell/src/gui/Attic/box.cc,v
retrieving revision 1.1.2.2
retrieving revision 1.1.2.3
diff -C2 -r1.1.2.2 -r1.1.2.3
*** box.cc      26 Sep 2002 11:28:37 -0000      1.1.2.2
--- box.cc      18 Oct 2002 22:58:29 -0000      1.1.2.3
***************
*** 113,121 ****
  
    /* init value with border width */
!   u_int16 x_tmp = 0; // border_width_;
!   u_int16 y_tmp = 0; // border_width_;
  
    /* calcul the max length for each widget*/
!   u_int16 max_length = (get_length () - ((v_widget_.size () - 1)  * spacing_) 
- (border_width_ << 1) ) / v_widget_.size (); 
    
    for (u_int16 i = 0;i < v_widget_.size (); i++)  
--- 113,121 ----
  
    /* 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++)  
***************
*** 125,129 ****
          if (v_widget_[i]->fill_ == true)
              {
!             v_widget_[i]->widget_->set_size (max_length, get_height () - 
(border_width_ << 1)); 
              v_widget_[i]->widget_->set_position (x_tmp, y_tmp);
              x_tmp += max_length; 
--- 125,129 ----
          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; 
***************
*** 133,137 ****
              // before fill just add padding
              v_widget_[i]->widget_->set_size ( max_length - 
(v_widget_[i]->padding_ << 1), 
!                                               get_height () - (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; 
--- 133,137 ----
              // 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; 
***************
*** 144,148 ****
          
          v_widget_[i]->widget_->set_size ( (v_widget_[i]->widget_->get_length 
() > max_length) ? max_length : v_widget_[i]->widget_->get_length (),
!                                           get_height () - (border_width_ << 
1) );   
          
          x_tmp += v_widget_[i]->widget_->get_length ();
--- 144,148 ----
          
          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 ();
***************
*** 150,154 ****
          /* calcul new max_length */
          if ((v_widget_.size () - i - 1) != 0) 
!           max_length = ((get_length () - ((v_widget_.size () - 1)  * 
spacing_) - border_width_ ) - x_tmp )
              / ( v_widget_.size () - i - 1)   ;
          else
--- 150,154 ----
          /* 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
***************
*** 156,160 ****
              /*this is the last widget*/
              /* we resize the container */
!             set_size (x_tmp + border_width_, get_height ());  
              } 
          }  
--- 156,160 ----
              /*this is the last widget*/
              /* we resize the container */
!             set_size (x_tmp + my_border_width, get_height ());  
              } 
          }  
***************
*** 174,178 ****
    
    /* calcul the max height for each widget*/
!   u_int32 max_height = (get_height () - ((v_widget_.size () - 1)  * spacing_) 
- (border_width_ << 1) ) / v_widget_.size (); 
    
    for (u_int16 i = 0;i < v_widget_.size (); i++)  
--- 174,178 ----
    
    /* 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++)  
***************
*** 184,188 ****
          if (v_widget_[i]->fill_ == true)
              {
!                 v_widget_[i]->widget_->set_size (get_length () - 
(border_width_ << 1),  max_height); 
                  v_widget_[i]->widget_->set_position (x_tmp, y_tmp);
                  y_tmp += max_height; 
--- 184,188 ----
          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; 
***************
*** 191,195 ****
              {
              // before fill just add padding
!             v_widget_[i]->widget_->set_size (get_length () - (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_,
--- 191,195 ----
              {
              // 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_,
***************
*** 203,207 ****
          v_widget_[i]->widget_->set_position (x_tmp, y_tmp); 
          
!         v_widget_[i]->widget_->set_size (get_length () - (border_width_ << 1),
                                           (v_widget_[i]->widget_->get_height 
() > max_height) ? max_height : v_widget_[i]->widget_->get_height ()
                                           );   
--- 203,207 ----
          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 ()
                                           );   
***************
*** 211,215 ****
              /* calcul new max_length */
              if ((v_widget_.size () - i - 1) != 0) 
!                 max_height = ((get_height () - ((v_widget_.size () - 1)  * 
spacing_) - border_width_ ) - y_tmp )
                      / ( v_widget_.size () - i - 1)   ;
              else
--- 211,215 ----
              /* 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
***************
*** 217,221 ****
              /*this is the last widget*/
              /* we resize the container */
!             set_size (get_length (), y_tmp + border_width_);  
              } 
          }  
--- 217,221 ----
              /*this is the last widget*/
              /* we resize the container */
!             set_size (get_length (), y_tmp + my_border_width);  
              } 
          }  

Index: button.cc
===================================================================
RCS file: /cvsroot/adonthell/adonthell/src/gui/Attic/button.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.cc   2 Jul 2002 07:20:30 -0000       1.1.2.1
--- button.cc   18 Oct 2002 22:58:29 -0000      1.1.2.2
***************
*** 22,29 ****
  void button::set_button_ui (button_template * but)
  {
!   if (object_ui_) delete object_ui_;
    
!   object_ui_ = new button_ui (this);
!   ((button_ui*)object_ui_)->set_button (but);
  }
  
--- 22,29 ----
  void button::set_button_ui (button_template * but)
  {
!   if (my_object_ui) delete my_object_ui;
    
!   my_object_ui = new button_ui (this);
!   ((button_ui*)my_object_ui)->set_button (but);
  }
  

Index: button_template.cc
===================================================================
RCS file: /cvsroot/adonthell/adonthell/src/gui/Attic/button_template.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_template.cc  2 Jul 2002 07:20:30 -0000       1.1.2.1
--- button_template.cc  18 Oct 2002 22:58:29 -0000      1.1.2.2
***************
*** 13,21 ****
  */
  
  #include "button_template.h"
  
  using namespace gui;
  
! button_template::button_template():background_(NULL), pressed_border_(NULL), 
released_border_(NULL)
  {
    
--- 13,23 ----
  */
  
+ #include <iostream>
+ 
  #include "button_template.h"
  
  using namespace gui;
  
! button_template::button_template() :  background_(NULL), 
pressed_border_(NULL), released_border_(NULL)
  {
    
***************
*** 29,33 ****
    if (released_border_) delete released_border_;
    
!   name_ << is;
    background_ = new background_template();
    background_->load (is);
--- 31,35 ----
    if (released_border_) delete released_border_;
    
!   my_name << is;
    background_ = new background_template();
    background_->load (is);
***************
*** 36,44 ****
    released_border_ = new border_template();
    released_border_->load (is);
  }
  
  void button_template::save (ogzstream & os)
  {
!   name_ >> os;
    background_->save (os);
    pressed_border_->save (os);
--- 38,48 ----
    released_border_ = new border_template();
    released_border_->load (is);
+ 
+   build ();
  }
  
  void button_template::save (ogzstream & os)
  {
!   my_name >> os;
    background_->save (os);
    pressed_border_->save (os);
***************
*** 46,59 ****
  }
  
- std::string button_template::get_name () const
- {
-   return name_;
- }
- 
- void button_template::set_name (const std::string & name)
- {
-   name_ = name;
- }
- 
  void button_template::set_released (border_template * bd)
  {
--- 50,53 ----
***************
*** 99,100 ****
--- 93,106 ----
  }
  
+ 
+ 
+ void button_template::display_info ()
+ {
+   std::cout << "Button template: " <<  my_name << std::endl;
+ }
+ 
+ 
+ void button_template::build ()
+ {
+   
+ }

Index: button_template.h
===================================================================
RCS file: /cvsroot/adonthell/adonthell/src/gui/Attic/button_template.h,v
retrieving revision 1.1.2.1
retrieving revision 1.1.2.2
diff -C2 -r1.1.2.1 -r1.1.2.2
*** button_template.h   2 Jul 2002 07:20:30 -0000       1.1.2.1
--- button_template.h   18 Oct 2002 22:58:29 -0000      1.1.2.2
***************
*** 29,32 ****
--- 29,33 ----
  #include <string>
  #include "fileops.h"
+ #include "object_template.h"
  #include "border_template.h"
  #include "background_template.h"
***************
*** 35,39 ****
  {
  
!   class button_template
      {
      public:
--- 36,40 ----
  {
  
!   class button_template: public object_template
      {
      public:
***************
*** 57,74 ****
    
        /**
-        * get name of the border
-        * @return name of the border
-        */
-       std::string get_name () const;
-   
-   
-       /**
-        * set name of the border
-        * @param name :  name of the border
-        */
-       void set_name (const std::string & name); 
- 
- 
-       /**
         * set border on released
         */
--- 58,61 ----
***************
*** 105,108 ****
--- 92,106 ----
  
        /**
+        * display some information
+        */
+       void display_info ();
+ 
+       /**
+        * build nothing ...
+        */
+       void build ();
+ 
+ 
+       /**
         * Destructor
         */
***************
*** 118,122 ****
        border_template * released_border_;
    
-       std::string name_;
      };
  
--- 116,119 ----

Index: container.cc
===================================================================
RCS file: /cvsroot/adonthell/adonthell/src/gui/Attic/container.cc,v
retrieving revision 1.1.2.2
retrieving revision 1.1.2.3
diff -C2 -r1.1.2.2 -r1.1.2.3
*** container.cc        26 Sep 2002 11:28:37 -0000      1.1.2.2
--- container.cc        18 Oct 2002 22:58:29 -0000      1.1.2.3
***************
*** 18,22 ****
  using namespace gui;
  
! container::container () : border_width_ (5), object_ui_ (NULL) 
  {  
  }
--- 18,22 ----
  using namespace gui;
  
! container::container () : my_border_width (5), my_object_ui (NULL) 
  {  
  }
***************
*** 25,29 ****
  void container::set_border_width (const u_int16 b)
  {
!   border_width_ = b; 
  }
  
--- 25,29 ----
  void container::set_border_width (const u_int16 b)
  {
!   my_border_width = b; 
  }
  
***************
*** 31,35 ****
  u_int16 container::get_border_width () const
  {
!   return border_width_; 
  }
  
--- 31,35 ----
  u_int16 container::get_border_width () const
  {
!   return my_border_width; 
  }
  
***************
*** 39,43 ****
  {
    /* destroy the decoration */
!   if (object_ui_) delete object_ui_; 
  }
  
--- 39,43 ----
  {
    /* destroy the decoration */
!   if (my_object_ui) delete my_object_ui; 
  }
  
***************
*** 45,51 ****
  void container::set_border_ui (border_template * bd_tmp)
  {
!   if ( object_ui_)  delete object_ui_;
!   object_ui_ = new border_ui (this);
!   ((border_ui*)object_ui_)->set_border (bd_tmp); 
  }
  
--- 45,51 ----
  void container::set_border_ui (border_template * bd_tmp)
  {
!   if ( my_object_ui)  delete my_object_ui;
!   my_object_ui = new border_ui (this);
!   ((border_ui*)my_object_ui)->set_border (bd_tmp); 
  }
  
***************
*** 55,59 ****
      {
        assign_drawing_area (da);
!       if (object_ui_) object_ui_->draw(da, sf);
        detach_drawing_area ();
        return true;
--- 55,59 ----
      {
        assign_drawing_area (da);
!       if (my_object_ui) my_object_ui->draw(da, sf);
        detach_drawing_area ();
        return true;
***************
*** 62,70 ****
  }
  
! 
! void container::set_size (s_int32 length, s_int32 height)
  {
!   widget::set_size (length, height);
!   if (object_ui_) object_ui_->resize();
  }
  
--- 62,70 ----
  }
  
! void container::update_size ()
  {
!   widget::update_size ();
!   
!   if (my_object_ui) my_object_ui->resize();
  }
  
***************
*** 73,77 ****
    widget::update_position();
    /* we move the decoration associated at this container*/
!   if (object_ui_) object_ui_->move();
  }
  
--- 73,77 ----
    widget::update_position();
    /* we move the decoration associated at this container*/
!   if (my_object_ui) my_object_ui->move();
  }
  
***************
*** 81,85 ****
    widget::realize();
    /* we call resize for objet_ui */
!   if (object_ui_) object_ui_->resize ();
  }
  
--- 81,85 ----
    widget::realize();
    /* we call resize for objet_ui */
!   if (my_object_ui) my_object_ui->resize ();
  }
  

Index: container.h
===================================================================
RCS file: /cvsroot/adonthell/adonthell/src/gui/Attic/container.h,v
retrieving revision 1.1.2.2
retrieving revision 1.1.2.3
diff -C2 -r1.1.2.2 -r1.1.2.3
*** container.h 26 Sep 2002 11:28:37 -0000      1.1.2.2
--- container.h 18 Oct 2002 22:58:29 -0000      1.1.2.3
***************
*** 87,91 ****
         * draw the container
         */
!       virtual bool draw (gfx::drawing_area * da = NULL, gfx::surface * sf = 
NULL); 
        
        
--- 87,91 ----
         * draw the container
         */
!       bool draw (gfx::drawing_area * da = NULL, gfx::surface * sf = NULL); 
        
        
***************
*** 93,97 ****
         * Destructor
         */
!       virtual ~container (); 
        
        
--- 93,97 ----
         * Destructor
         */
!       ~container (); 
        
        
***************
*** 104,112 ****
        
        
!       /** set the minimum size of a widget
!        * @param length
!        * @param height
         */
!       virtual void set_size (s_int32 length, s_int32 height); 
        
        
--- 104,111 ----
        
        
!       /**
!        * update size 
         */
!       virtual void update_size (); 
        
        
***************
*** 116,119 ****
--- 115,119 ----
        virtual void update_position();
        
+       
        /** 
         * it's used to build the widget.
***************
*** 129,139 ****
        protected :
        
!       /* the space between container and widgets childs */
!       u_int16 border_width_; 
        
        
        /* the border used by this container */
!       //border_ui * border_; 
!       object_ui * object_ui_; 
  
        private : 
--- 129,138 ----
        protected :
        
!       /* the space between container and widgets childs */
!       u_int16 my_border_width; 
        
        
        /* the border used by this container */
!       object_ui * my_object_ui; 
  
        private : 

Index: font.cc
===================================================================
RCS file: /cvsroot/adonthell/adonthell/src/gui/Attic/font.cc,v
retrieving revision 1.1.2.1
retrieving revision 1.1.2.2
diff -C2 -r1.1.2.1 -r1.1.2.2
*** font.cc     2 Jul 2002 07:20:30 -0000       1.1.2.1
--- font.cc     18 Oct 2002 22:58:29 -0000      1.1.2.2
***************
*** 20,34 ****
  using namespace gui;
  
  font::font ()
  {
      // by default no file,  so no valid font
!     valid = false;  
! 
      // init color
      set_color (0, 0, 0);   
- 
      // set default size
      set_size (12);
- 
      // set_default dpi
      set_dpi (72); 
--- 20,62 ----
  using namespace gui;
  
+ int font::UTF8_to_UNICODE(u_int16 * unicode, const char *utf8, int len)
+ {
+       int i, j;
+       Uint16 ch;
+       
+       for ( i=0, j=0; i < len; ++i, ++j ) {
+               ch = ((const unsigned char *)utf8)[i];
+               if ( ch >= 0xF0 ) {
+                       ch  =  (Uint16)(utf8[i]&0x07) << 18;
+                       ch |=  (Uint16)(utf8[++i]&0x3F) << 12;
+                       ch |=  (Uint16)(utf8[++i]&0x3F) << 6;
+                       ch |=  (Uint16)(utf8[++i]&0x3F);
+               } else
+               if ( ch >= 0xE0 ) {
+                       ch  =  (Uint16)(utf8[i]&0x3F) << 12;
+                       ch |=  (Uint16)(utf8[++i]&0x3F) << 6;
+                       ch |=  (Uint16)(utf8[++i]&0x3F);
+               } else
+               if ( ch >= 0xC0 ) {
+                       ch  =  (Uint16)(utf8[i]&0x3F) << 6;
+                       ch |=  (Uint16)(utf8[++i]&0x3F);
+               }
+               unicode[j] = ch;
+       }
+       unicode[j] = 0;
+ 
+       return j;
+ }
+ 
+ 
+ 
  font::font ()
  {
      // by default no file,  so no valid font
!     my_valid = false;  
      // init color
      set_color (0, 0, 0);   
      // set default size
      set_size (12);
      // set_default dpi
      set_dpi (72); 
***************
*** 39,53 ****
  {
      int error; 
-     
      close (); 
-     free_vector (); 
      
      // copy the new filename
!     this->filename = filename; 
      
!     valid = false; 
      
      // Initialise library
!     error = FT_Init_FreeType( &library ); 
      if (error) 
      {
--- 67,79 ----
  {
      int error; 
      close (); 
      
      // copy the new filename
!     my_filename = filename; 
      
!     my_valid = false; 
      
      // Initialise library
!     error = FT_Init_FreeType( &my_library ); 
      if (error) 
      {
***************
*** 57,61 ****
      
      // load TTF font in face
!     error = FT_New_Face( library, filename.c_str () , 0, &face );
      if ( error == FT_Err_Unknown_File_Format )
      {
--- 83,87 ----
      
      // load TTF font in face
!     error = FT_New_Face( my_library, my_filename.c_str () , 0, &my_face );
      if ( error == FT_Err_Unknown_File_Format )
      {
***************
*** 73,77 ****
      // Check if the font is no scalable
      // WARNING : Implement in the futur
!     if (face->num_fixed_sizes)
      {
          std::cout << "FONT : Fixed font not only supported\n"; 
--- 99,103 ----
      // Check if the font is no scalable
      // WARNING : Implement in the futur
!     if (my_face->num_fixed_sizes)
      {
          std::cout << "FONT : Fixed font not only supported\n"; 
***************
*** 80,138 ****
      }
      
!     valid = true; 
      return true; 
  }
  
  
! inline void font::set_dpi (int i)
! {
!     dpi = i; 
! }
  
! inline void font::set_size (int i)
! {
!     size = i; 
! }
  
  
  bool font::build ()
  {
!     int error;
!     char_info tmp;  
!     
!     if (!valid) return false;
!     
!     // Free memory from vecteur
!     free_vector (); 
!     
!     // set the size
!     FT_Set_Char_Size(face,size << 6,size << 6,dpi,dpi);
!     
!     // copy all characters in the vector
!     for (int i = 0;i < face->num_glyphs; i++)
!     {
!         error = FT_Load_Char( face, i, FT_LOAD_RENDER); 
!         if (error) std::cout << "font : Load char error\n";  
! 
!         // create an image
!         tmp.picture = new gfx::image ();
! 
!         // size the image
!         tmp.picture->resize (face->glyph->bitmap.width, 
face->glyph->bitmap.rows);  
!         
!         // copy bitmap to image
!         copy_bitmap_to_image ( face->glyph->bitmap.buffer, tmp.picture);
! 
!         tmp.picture->set_mask (true); 
!         
!         // set position font
!         tmp.top = face->glyph->bitmap_top;
!         tmp.left = face->glyph->bitmap_left;
!         tmp.advance_x = face->glyph->advance.x >> 6; 
!         
!         // add image to vector
!         chars.push_back (tmp); 
!     }
!     return true; 
  }
  
--- 106,123 ----
      }
      
!     my_valid = true; 
      return true; 
  }
  
  
! inline void font::set_dpi (int i) { my_dpi = i; }
  
! inline void font::set_size (int i) { my_size = i; }
  
  
  bool font::build ()
  {
!   FT_Set_Char_Size( my_face, my_size << 6, my_size << 6, my_dpi, my_dpi);
!   return true; 
  }
  
***************
*** 141,207 ****
  void font::close ()
  {
!     if (!valid) return; 
!     FT_Done_Face(face);
!     FT_Done_FreeType(library); 
  }
  
  
! void font::copy_bitmap_to_image (u_int8 * bitmap_data, gfx::image * dest)
  {
!     u_int8 * pbmp = bitmap_data; 
  
-     
-     dest->lock ();
  
!     u_int32 pixelcol = gfx::screen::display.map_color (r, g, b); 
!     
!     for (int j = 0; j < dest->height (); j++)
!         for (int i = 0; i < dest->length () ; i++)
!         {
!             if (*pbmp > 128) 
!                 dest->put_pix (i, j, pixelcol); 
!             else dest->put_pix (i, j, gfx::screen::trans_col ()); 
              pbmp++; 
!         } 
!     dest->unlock ();  
  }
  
! void font::info ()
! {
!     std::cout << "Filename : " << filename << std::endl;
!     std::cout << "Number face : " << face->num_faces << std::endl; 
!     std::cout << "Num_glyphs : " << face->num_glyphs << std::endl; 
!     std::cout << "Fixed size : " << face->num_fixed_sizes << std::endl;  
! }
!  
! void font::draw (const std::string & text, s_int32 x, s_int32 y, 
gfx::drawing_area * da, gfx::surface * target)
! {
!     s_int32 tmp_x = x; 
!     y+= size;
!     for (u_int32 i = 0; i < text.length (); i++)
!     {
!         if ((unsigned) text[i] < chars.size ()) 
!         {
!             if (text[i] != '\n')
!             {                 
!                 chars[text[i]].picture->draw (tmp_x + chars[text[i]].left , y 
- chars[text[i]].top, da, target ); 
!                 tmp_x += chars[text[i]].advance_x;
!             }
!             else 
!             {
!                 y += size; 
!                 tmp_x = x; 
!             }
!         }
!     } 
! }
  
  u_int32 font::get_length_of (const std::string & text)
  {
!     u_int32 size = 0;
!     for (u_int32 i = 0; i < text.length (); i++)
!         if ((unsigned) text[i] < chars.size ())
!             size += chars[text[i]].advance_x;
!     return size; 
  }
  
--- 126,244 ----
  void font::close ()
  {
!     if (!my_valid) return; 
!     FT_Done_Face(my_face);
!     FT_Done_FreeType(my_library); 
  }
  
  
! void font::copy_bitmap_to_image (u_int8 * bitmap_data, gfx::image * dest, 
s_int16 dx, s_int16 dy)
! {
!   u_int8 * pbmp = bitmap_data; 
!   
!   dest->lock ();
!   
!   u_int32 pixelcol = gfx::screen::display.map_color (my_r, my_g, my_b); 
!   
!   for (int j = 0; j < dest->height (); j++)
!     for (int i = 0; i < dest->length () ; i++)
!       {
!       if (*pbmp > 128)  dest->put_pix (dx + i, dy +j, pixelcol); 
!       else dest->put_pix (dx + i, dy + j, gfx::screen::trans_col ()); 
!       pbmp++; 
!       } 
!   dest->unlock ();  
! }
! 
! void font::info ()
  {
!     std::cout << "Filename : " << my_filename << std::endl;
!     std::cout << "Number face : " << my_face->num_faces << std::endl; 
!     std::cout << "Num_glyphs : " << my_face->num_glyphs << std::endl; 
!     std::cout << "Fixed size : " << my_face->num_fixed_sizes << std::endl;  
!     std::cout << "Num char map: " << my_face->num_charmaps << std::endl;
! }
  
  
! void font::draw (const std::string & text, s_int32 x,  s_int32 y, 
!                gfx::drawing_area * da, gfx::surface * target)
! {
!   FT_GlyphSlot  slot = my_face->glyph; /* the slot */
!   u_int16 *unicode_text; /* the unicode pointer text */
!   FT_UInt  glyph_index;
!   int error;
!   u_int32 pixelcol = gfx::screen::display.map_color (my_r, my_g, my_b);
!   u_int8 * pbmp;
!   
!   /* get the surface */
!   if (target == NULL) target = &(gfx::screen::display);
!   
!   /* translate to unicode */
!   unicode_text = new u_int16[ (text.length()+1)*(sizeof *unicode_text) ];
!   int len = UTF8_to_UNICODE(unicode_text, text.c_str(), text.length());
!   
!   s_int16 txx = x;
!   s_int16 tyy = y;
!   
!   for (int n =0; n < len; n++)
!     {
!       /* retrieve glyph index from character code */
!       glyph_index = FT_Get_Char_Index( my_face, unicode_text[n] );
!       
!       /* load glyph image into the slot (erase previous one) */
!       error = FT_Load_Glyph( my_face, glyph_index, FT_LOAD_DEFAULT );
!       if (error) continue;
!       
!       /* convert to an anti-aliased bitmap */
!       error = FT_Render_Glyph( my_face->glyph, ft_render_mode_normal );
!       if (error) continue;
!       
!       pbmp = slot->bitmap.buffer;
!       for (int j = 0; j < slot->bitmap.rows; j++)
!         for (int i = 0; i < slot->bitmap.width ; i++)
!         {
!             if (*pbmp > 128) target->put_pix (txx + i, tyy + j - 
((slot->metrics.horiBearingY)>>6)
! , pixelcol); 
!           else target->put_pix (txx + i, tyy + j - 
((slot->metrics.horiBearingY)>>6), 
!                                 gfx::screen::trans_col ());
              pbmp++; 
!         }
!       
!       /* must improve this */
!       txx += (slot->metrics.horiAdvance>>6);
!     }
!   /* delete unicode_text */
!   delete [] unicode_text;
  }
  
! 
! 
! 
  
  u_int32 font::get_length_of (const std::string & text)
  {
!   u_int32 size = 0;
!   FT_GlyphSlot  slot = my_face->glyph; /* the slot */
!   u_int16 *unicode_text; /* the unicode pointer text */
!   FT_UInt  glyph_index;
!   int error;
!   
!   /* translate to unicode */
!   unicode_text = new u_int16[ (text.length()+1)*(sizeof *unicode_text) ];
!   int len = UTF8_to_UNICODE(unicode_text, text.c_str(), text.length());
!   
!   for (int n =0; n < len; n++)
!     {
!       /* retrieve glyph index from character code */
!       glyph_index = FT_Get_Char_Index( my_face, unicode_text[n] );
!       
!       /* load glyph image into the slot (erase previous one) */
!       error = FT_Load_Glyph( my_face, glyph_index, FT_LOAD_DEFAULT );
!       if (error) continue;
!       
!       size += (slot->metrics.horiAdvance>>6);
!     }
!   
!   delete [] unicode_text;
!   return size; 
  }
  
***************
*** 209,243 ****
  u_int16 font::get_size()
  {
!   return size;
  }
  
- void font::free_vector ()
- {
-     for (std::vector <char_info>::iterator it = chars.begin (); it != 
chars.end (); it++)
-         delete it->picture; 
-     chars.clear (); 
- }
- 
- 
  font::~font ()
  {
-     free_vector ();
      close (); 
  }
  
- 
- 
  void font::set_color (u_int8 r, u_int8 g, u_int8 b)
  {
!     this->r = r; 
!     this->g = g;
!     this->b = b; 
  }
  
- 
  void font::set_color (u_int32 col)
  {
!     this->r = col & 255; 
!     this->g = (col >> 8) & 255; 
!     this->b = (col >> 16) & 255;
  }
--- 246,268 ----
  u_int16 font::get_size()
  {
!   return my_size;
  }
  
  font::~font ()
  {
      close (); 
  }
  
  void font::set_color (u_int8 r, u_int8 g, u_int8 b)
  {
!   my_r = r; 
!   my_g = g;
!   my_b = b; 
  }
  
  void font::set_color (u_int32 col)
  {
!   my_r = col & 255; 
!   my_g = (col >> 8) & 255; 
!   my_b = (col >> 16) & 255;
  }

Index: font.h
===================================================================
RCS file: /cvsroot/adonthell/adonthell/src/gui/Attic/font.h,v
retrieving revision 1.1.2.1
retrieving revision 1.1.2.2
diff -C2 -r1.1.2.1 -r1.1.2.2
*** font.h      2 Jul 2002 07:20:30 -0000       1.1.2.1
--- font.h      18 Oct 2002 22:58:29 -0000      1.1.2.2
***************
*** 125,132 ****
         * @param target : draw on target,  if not target,  draw on the screen
         */
!       void draw (const std::string & text, s_int32 x, s_int32 y, 
gfx::drawing_area * da, gfx::surface * target = NULL);  
  
! 
!     
        /**
         * length_of calcul and return length of text
--- 125,131 ----
         * @param target : draw on target,  if not target,  draw on the screen
         */
!       void draw (const std::string & text, s_int32 x, s_int32 y, 
gfx::drawing_area * da = NULL, gfx::surface * target = NULL);  
  
!       
        /**
         * length_of calcul and return length of text
***************
*** 138,143 ****
        u_int32 get_length_of (const std::string & text);
    
- 
- 
        /**
         *
--- 137,140 ----
***************
*** 147,196 ****
        private : 
  
- 
-       /* a structure which contain all information and image for a char */
-       struct char_info
-       {
-         s_int32 top;
- 
-         s_int32 left; 
- 
-         s_int32 advance_x;
- 
-         gfx::image * picture; 
-       }; 
-     
-     
-       /* free vector */
-       void free_vector (); 
- 
        /* copy bitmap to image */
!       void copy_bitmap_to_image (u_int8 * bitmap_data, gfx::image * dest); 
! 
        /* close the library and face */
        void close (); 
      
        /* filename of the font */
!       std::string filename; 
      
        /* valid font,  true if valid */
!       bool valid; 
!     
        /* library FT */
!       FT_Library library; 
!     
        /* FT_Face */
!       FT_Face face;
! 
        /* dpi, dots-per-inch */
!       int dpi;
!     
        /* size */
!       u_int16 size;
! 
!       /* contain all characters */
!       std::vector <char_info> chars;       
  
        /* color variable */
!       u_int8 r, g, b;  
      }; 
  };
--- 144,175 ----
        private : 
  
        /* copy bitmap to image */
!       void copy_bitmap_to_image (u_int8 * bitmap_data, gfx::image * dest, 
s_int16 dx, s_int16 dy); 
!       
        /* close the library and face */
        void close (); 
      
+       int UTF8_to_UNICODE(u_int16 * unicode, const char *utf8, int len);
+ 
        /* filename of the font */
!       std::string my_filename; 
      
        /* valid font,  true if valid */
!       bool my_valid; 
!       
        /* library FT */
!       FT_Library my_library; 
!       
        /* FT_Face */
!       FT_Face my_face;
!       
        /* dpi, dots-per-inch */
!       int my_dpi;
!       
        /* size */
!       u_int16 my_size;
  
        /* color variable */
!       u_int8 my_r, my_g, my_b;  
      }; 
  };

Index: theme.cc
===================================================================
RCS file: /cvsroot/adonthell/adonthell/src/gui/Attic/theme.cc,v
retrieving revision 1.1.2.1
retrieving revision 1.1.2.2
diff -C2 -r1.1.2.1 -r1.1.2.2
*** theme.cc    2 Jul 2002 07:20:30 -0000       1.1.2.1
--- theme.cc    18 Oct 2002 22:58:29 -0000      1.1.2.2
***************
*** 27,61 ****
  void theme::load (const std::string & filename)
  {
!     /* init hash_map border */
!     destroy (); 
!     
!     /* open file with gz stream */
!     igzstream fd;
!     
!     if (!fd.open (filename))
      {
!         std::cerr << "error theme::load " <<  filename << std::endl;
          return; 
      }
! 
!     /* load name */
!     name_ <<  fd; 
!     
!     /* start to read number of border */
!     u_int8 nb_border;
!     nb_border << fd; 
! 
!     // std::cout << nb_border << std::endl; 
!     
!     border_template * tmp; 
!     for (u_int8 i = 0; i < nb_border; i++)
      {
!         tmp =  new border_template ();
!         tmp->load (fd);
!         add_border (tmp); 
      }
!     
!     /* close the fd */
!     fd.close (); 
  }
  
--- 27,61 ----
  void theme::load (const std::string & filename)
  {
!   /* init hash_map border */
!   destroy (); 
!   
!   /* open file with gz stream */
!   igzstream fd;
!   
!   if (!fd.open (filename))
      {
!       std::cerr << "error theme::load " <<  filename << std::endl;
          return; 
      }
!   
!   /* load name */
!   my_name <<  fd; 
!   
!   /* start to read number of border */
!   u_int8 nb_border;
!   nb_border << fd; 
!   
!   // std::cout << nb_border << std::endl; 
!   
!   border_template * tmp; 
!   for (u_int8 i = 0; i < nb_border; i++)
      {
!       tmp =  new border_template ();
!       tmp->load (fd);
!       add_border (tmp); 
      }
!   
!   /* close the fd */
!   fd.close (); 
  }
  
***************
*** 64,86 ****
  void theme::save (const std::string & filename)
  {
!     /* open a gz output stream */
!     ogzstream fd;
!     if (!fd.open (filename))
      {
!         std::cerr << "error theme::save " <<  filename << std::endl;
!         return;  
      }
  
!     /* save name */
!     name_ >> fd; 
!     
!     /* save number of border */
!     u_int8 nb_border = border_.size ();
!     nb_border >> fd;
! 
!     for (std::hash_map <std::string, border_template * >::iterator it = 
border_.begin (); it  != border_.end (); it++)
!         it->second->save (fd); 
!     
!     fd.close (); 
  }
  
--- 64,96 ----
  void theme::save (const std::string & filename)
  {
!   /* open a gz output stream */
!   ogzstream fd;
!   if (!fd.open (filename))
      {
!       std::cerr << "error theme::save " <<  filename << std::endl;
!       return;  
      }
+   
+   /* save name */
+   my_name >> fd; 
+   
+   /* save number of border */
+   u_int8 nb_border = my_border.size ();
+   nb_border >> fd;
+   
+   /* save the border */
+   for (std::hash_map <std::string, border_template * >::iterator it = 
my_border.begin (); it  != my_border.end (); it++)
+     it->second->save (fd); 
+   
+ 
+   /* save number of button */
+   u_int8 nb_button = my_button.size ();
+   nb_button >> fd; 
+   
+   /* save the button */
+   for (std::hash_map <std::string, button_template * >::iterator ot = 
my_button.begin (); ot  != my_button.end (); ot++)
+     ot->second->save (fd); 
  
!   fd.close (); 
  }
  
***************
*** 88,92 ****
  std::string theme::get_name () const
  {
!     return name_; 
  }
  
--- 98,102 ----
  std::string theme::get_name () const
  {
!     return my_name; 
  }
  
***************
*** 94,98 ****
  void theme::set_name (const std::string & name)
  {
!     name_ =  name; 
  }
  
--- 104,108 ----
  void theme::set_name (const std::string & name)
  {
!     my_name =  name; 
  }
  
***************
*** 100,104 ****
  void theme::add_border (border_template * border)
  {
!     border_[border->get_name () ] =  border; 
  }
  
--- 110,114 ----
  void theme::add_border (border_template * border)
  {
!     my_border[border->get_name () ] =  border; 
  }
  
***************
*** 106,113 ****
  void theme::remove_border (const std::string & name)
  {
!     std::hash_map <std::string, border_template * >::iterator it = 
border_.find (name);
!     if ( it ==  border_.end ()) return;
      delete it->second;
!     border_.erase (it); 
  }
  
--- 116,123 ----
  void theme::remove_border (const std::string & name)
  {
!     std::hash_map <std::string, border_template * >::iterator it = 
my_border.find (name);
!     if ( it ==  my_border.end ()) return;
      delete it->second;
!     my_border.erase (it); 
  }
  
***************
*** 115,129 ****
  border_template * theme::get_border (const std::string & name)
  {
!   std::hash_map <std::string, border_template * >::iterator it = border_.find 
(name);
!   if ( it ==  border_.end ()) return NULL;
    return it->second;
  }
  
  void theme::destroy ()
  {
       // free border
!     for (std::hash_map <std::string, border_template * >::iterator it = 
border_.begin (); it  != border_.end (); it++)
          delete it->second;
!     border_.clear (); 
  }
  
--- 125,170 ----
  border_template * theme::get_border (const std::string & name)
  {
!   std::hash_map <std::string, border_template * >::iterator it = 
my_border.find (name);
!   if ( it ==  my_border.end ()) return NULL;
!   return it->second;
! }
! 
! 
! void theme::add_button (button_template * button)
! {
!     my_button[button->get_name () ] =  button; 
! }
! 
! 
! void theme::remove_button (const std::string & name)
! {
!     std::hash_map <std::string, button_template * >::iterator it = 
my_button.find (name);
!     if ( it ==  my_button.end ()) return;
!     delete it->second;
!     my_button.erase (it); 
! }
! 
! 
! button_template * theme::get_button (const std::string & name)
! {
!   std::hash_map <std::string, button_template * >::iterator it = 
my_button.find (name);
!   if ( it ==  my_button.end ()) return NULL;
    return it->second;
  }
  
+ 
+ 
  void theme::destroy ()
  {
       // free border
!     for (std::hash_map <std::string, border_template * >::iterator it = 
my_border.begin (); it  != my_border.end (); it++)
!         delete it->second;
!     my_border.clear (); 
! 
!     // free button 
!     for (std::hash_map <std::string, button_template * >::iterator it = 
my_button.begin (); it  != my_button.end (); it++)
          delete it->second;
!     my_button.clear (); 
! 
  }
  
***************
*** 138,147 ****
  void theme::display_info () 
  {
!     std::cout << "Theme name : " << name_ << std::endl;
      std::cout << "List of border : \n"; 
  
       
!     for (std::hash_map <std::string, border_template * >::iterator it = 
border_.begin (); it  != border_.end (); it++)
          it->second->display_info (); 
  }
  
--- 179,193 ----
  void theme::display_info () 
  {
!     std::cout << "Theme name : " << my_name << std::endl;
      std::cout << "List of border : \n"; 
  
       
!     for (std::hash_map <std::string, border_template * >::iterator it = 
my_border.begin (); it  != my_border.end (); it++)
          it->second->display_info (); 
+ 
+     std::cout << "List of button : \n";
+     
+     for (std::hash_map <std::string, button_template * >::iterator it = 
my_button.begin (); it  != my_button.end (); it++)
+       it->second->display_info (); 
  }
  

Index: theme.h
===================================================================
RCS file: /cvsroot/adonthell/adonthell/src/gui/Attic/theme.h,v
retrieving revision 1.1.2.1
retrieving revision 1.1.2.2
diff -C2 -r1.1.2.1 -r1.1.2.2
*** theme.h     2 Jul 2002 07:20:30 -0000       1.1.2.1
--- theme.h     18 Oct 2002 22:58:29 -0000      1.1.2.2
***************
*** 36,41 ****
  
  #include <string> 
- #include "border_template.h"
  
  
  namespace gui
--- 36,42 ----
  
  #include <string> 
  
+ #include "border_template.h"
+ #include "button_template.h"
  
  namespace gui
***************
*** 100,103 ****
--- 101,128 ----
        border_template * get_border( const std::string & name);
  
+       
+       /**
+        * add a button
+        * @param button :  button to add
+        */
+       void add_button (button_template * button);
+       
+       
+       /**
+        * remove a button
+        * @param name :  name of the button to remove
+        */
+       void remove_button (const std::string & name);  
+ 
+ 
+       /**
+        * get button 
+        * @param name : name of the button
+        * @return the button associated with the name
+        */
+       button_template * get_button( const std::string & name);
+ 
+ 
+ 
  
        /**
***************
*** 114,118 ****
        private :
        /**
!        * free memory delete all border from the memory
         */
        void destroy (); 
--- 139,143 ----
        private :
        /**
!        * free memory delete all object from the memory
         */
        void destroy (); 
***************
*** 120,127 ****
  
        /* name of the theme */
!       std::string name_;
  
        /* a hash_map for border */
!       std::hash_map <std::string, border_template* > border_;  
      }; 
  };
--- 145,155 ----
  
        /* name of the theme */
!       std::string my_name;
  
        /* a hash_map for border */
!       std::hash_map <std::string, border_template* > my_border;  
!       
!       /* a hash_map for button */
!       std::hash_map <std::string, button_template* > my_button;  
      }; 
  };

Index: widget.cc
===================================================================
RCS file: /cvsroot/adonthell/adonthell/src/gui/Attic/widget.cc,v
retrieving revision 1.1.2.2
retrieving revision 1.1.2.3
diff -C2 -r1.1.2.2 -r1.1.2.3
*** widget.cc   26 Sep 2002 11:28:37 -0000      1.1.2.2
--- widget.cc   18 Oct 2002 22:58:29 -0000      1.1.2.3
***************
*** 41,44 ****
--- 41,45 ----
  void widget::update_position ()
  {
+   /* 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_); 
***************
*** 77,80 ****
--- 78,88 ----
    else if (height >= 0 ) drawing_area::resize (0, height);
    else drawing_area::resize (0, 0);
+ 
+   update_size ();
+ }
+ 
+ 
+ void widget::update_size ()
+ {
  }
  

Index: widget.h
===================================================================
RCS file: /cvsroot/adonthell/adonthell/src/gui/Attic/widget.h,v
retrieving revision 1.1.2.2
retrieving revision 1.1.2.3
diff -C2 -r1.1.2.2 -r1.1.2.3
*** widget.h    26 Sep 2002 11:28:37 -0000      1.1.2.2
--- widget.h    18 Oct 2002 22:58:29 -0000      1.1.2.3
***************
*** 60,69 ****
         */ 
        void set_parent (container * parent);  
- 
-       
-       /** Set the parent window, parent window 
-        *
-        */
- 
        
        /**
--- 60,63 ----
***************
*** 77,81 ****
         * @param y
         */
!       virtual void set_position (s_int16 x, s_int16 y); 
        
        
--- 71,75 ----
         * @param y
         */
!       void set_position (s_int16 x, s_int16 y); 
        
        
***************
*** 115,121 ****
         * @param height
         */
!       virtual void set_size (s_int32 length, s_int32 height); 
        
        
        /** get length
         * @return length 
--- 109,121 ----
         * @param height
         */
!       void set_size (s_int32 length, s_int32 height); 
        
        
+       /**
+        * update size
+        */
+       virtual void update_size (); 
+ 
+ 
        /** get length
         * @return length 

Index: window.cc
===================================================================
RCS file: /cvsroot/adonthell/adonthell/src/gui/Attic/window.cc,v
retrieving revision 1.1.2.2
retrieving revision 1.1.2.3
diff -C2 -r1.1.2.2 -r1.1.2.3
*** window.cc   26 Sep 2002 11:28:37 -0000      1.1.2.2
--- window.cc   18 Oct 2002 22:58:29 -0000      1.1.2.3
***************
*** 115,119 ****
        { 
          if (mouse_action_ == ACTION_NONE && me->type () == 
input::mouse_event::BUTTON_PUSHED 
!             && object_ui_ && ((border_ui*)object_ui_)->is_in_ctr (me->x(), 
me->y()))
            {
              on_delete (); 
--- 115,119 ----
        { 
          if (mouse_action_ == ACTION_NONE && me->type () == 
input::mouse_event::BUTTON_PUSHED 
!             && my_object_ui && ((border_ui*)my_object_ui)->is_in_ctr 
(me->x(), me->y()))
            {
              on_delete (); 
***************
*** 125,129 ****
        {
          if (mouse_action_ == ACTION_NONE && me->type () == 
input::mouse_event::BUTTON_PUSHED &&
!             object_ui_ && ((border_ui*)object_ui_)->is_in_bt (me->x(), 
me->y()))
            {
              mouse_action_ = ACTION_MOVE;
--- 125,129 ----
        {
          if (mouse_action_ == ACTION_NONE && me->type () == 
input::mouse_event::BUTTON_PUSHED &&
!             my_object_ui && ((border_ui*)my_object_ui)->is_in_bt (me->x(), 
me->y()))
            {
              mouse_action_ = ACTION_MOVE;
***************
*** 137,141 ****
        {
          if (mouse_action_ == ACTION_NONE && me->type () == 
input::mouse_event::BUTTON_PUSHED &&
!             object_ui_ && ((border_ui*)object_ui_)->is_in_cbr (me->x(), me->y 
())) 
            {
              mouse_action_ = ACTION_RESIZE;
--- 137,141 ----
        {
          if (mouse_action_ == ACTION_NONE && me->type () == 
input::mouse_event::BUTTON_PUSHED &&
!             my_object_ui && ((border_ui*)my_object_ui)->is_in_cbr (me->x(), 
me->y ())) 
            {
              mouse_action_ = ACTION_RESIZE;





reply via email to

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