[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Adonthell-commits] CVS: adonthell/src/gui bin.cc,1.1.2.1,1.1.2.2 bin.h,
From: |
VENNIN Joel <address@hidden> |
Subject: |
[Adonthell-commits] CVS: adonthell/src/gui bin.cc,1.1.2.1,1.1.2.2 bin.h,1.1.2.1,1.1.2.2 border_ui.cc,1.1.2.1,1.1.2.2 box.cc,1.1.2.1,1.1.2.2 box.h,1.1.2.1,1.1.2.2 container.cc,1.1.2.1,1.1.2.2 container.h,1.1.2.1,1.1.2.2 misc.cc,1.1.2.1,1.1.2.2 misc.h,1.1.2.1,1.1.2.2 widget.cc,1.1.2.1,1.1.2.2 widget.h,1.1.2.1,1.1.2.2 window.cc,1.1.2.1,1.1.2.2 window.h,1.1.2.1,1.1.2.2 border.cc,1.1.2.1,NONE border.h,1.1.2.1,NONE |
Date: |
Thu, 26 Sep 2002 07:28:40 -0400 |
Update of /cvsroot/adonthell/adonthell/src/gui
In directory subversions:/tmp/cvs-serv18556
Modified Files:
Tag: Branch_road_to_0-4
bin.cc bin.h border_ui.cc box.cc box.h container.cc
container.h misc.cc misc.h widget.cc widget.h window.cc
window.h
Removed Files:
Tag: Branch_road_to_0-4
border.cc border.h
Log Message:
Clean some code, remove some file, improve some feature, but nothing is done
...
Index: bin.cc
===================================================================
RCS file: /cvsroot/adonthell/adonthell/src/gui/Attic/bin.cc,v
retrieving revision 1.1.2.1
retrieving revision 1.1.2.2
diff -C2 -r1.1.2.1 -r1.1.2.2
*** bin.cc 2 Jul 2002 07:20:30 -0000 1.1.2.1
--- bin.cc 26 Sep 2002 11:28:37 -0000 1.1.2.2
***************
*** 13,16 ****
--- 13,17 ----
*/
+ #include <iostream>
#include "bin.h"
***************
*** 25,37 ****
void bin::add (widget * w)
{
- //if (child) remove (child);
clear();
! child = w;
! w->set_parent (this);
!
! w->set_position (0, 0);
!
! on_add ();
}
--- 26,38 ----
void bin::add (widget * w)
{
clear();
+
+ //this container can contain just one widget
+ child = w;
+
+ /* we set this at the parent for w objet */
+ w->set_parent (this);
! on_add ();
}
***************
*** 40,48 ****
void bin::remove (widget *w)
{
! w->set_parent (NULL);
!
! child = NULL;
!
! on_remove ();
}
--- 41,49 ----
void bin::remove (widget *w)
{
! w->set_parent (NULL);
!
! child = NULL;
!
! on_remove ();
}
***************
*** 50,89 ****
void bin::clear ()
{
! if (child)
{
! delete child;
! child = NULL;
}
}
-
-
void bin::update_position()
{
container::update_position();
if (child) child->update_position ();
}
! void bin::set_size (u_int32 length, u_int32 height)
{
! container::set_size (length, height);
!
! if (child)
{
! child->set_size (get_length () -(border_width_ << 1), get_height () -
(border_width_ << 1));
! child->realize ();
}
}
bool bin::draw (gfx::drawing_area * da, gfx::surface * sf)
{
if (container::draw (da, sf))
{
assign_drawing_area(da);
/* draw the contain */
if (child) child->draw (this, sf);
detach_drawing_area();
return true;
--- 51,98 ----
void bin::clear ()
{
! if (child)
{
! delete child;
! child = NULL;
}
}
void bin::update_position()
{
container::update_position();
+ /* if there is a child update_position of the child */
if (child) child->update_position ();
}
!
! 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 */
! if (child)
{
! /* 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 ();
}
}
+
bool bin::draw (gfx::drawing_area * da, gfx::surface * sf)
{
+ /* draw the container */
if (container::draw (da, sf))
{
+ /* attach the child at the drawing area */
assign_drawing_area(da);
/* draw the contain */
if (child) child->draw (this, sf);
+ /* detach the drawing area */
detach_drawing_area();
return true;
***************
*** 93,112 ****
/**
* input update function
* @return 1 if this object use the event, else return 0
! */
int bin::input_update (input::event * ev)
{
! if (child) return child->input_update (ev);
! return 0;
}
! bin::~bin ()
{
! clear ();
}
!
--- 102,137 ----
+ 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
* @return 1 if this object use the event, else return 0
! */
int bin::input_update (input::event * ev)
{
! /* 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);
}
!
! void bin::realize ()
{
! container::realize ();
! //check size and location of children
! set_position ( get_x(), get_y());
! set_size (get_length(), get_height());
! //WARNING : execute child->realize () ??
}
! bin::~bin ()
! {
! clear ();
! }
Index: bin.h
===================================================================
RCS file: /cvsroot/adonthell/adonthell/src/gui/Attic/bin.h,v
retrieving revision 1.1.2.1
retrieving revision 1.1.2.2
diff -C2 -r1.1.2.1 -r1.1.2.2
*** bin.h 2 Jul 2002 07:20:30 -0000 1.1.2.1
--- bin.h 26 Sep 2002 11:28:37 -0000 1.1.2.2
***************
*** 73,78 ****
* @param height
*/
! virtual void set_size (u_int32 length, u_int32 height);
--- 73,84 ----
* @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);
***************
*** 90,98 ****
/**destructor
* call clear ()
*/
! ~bin ();
protected :
--- 96,110 ----
+ /**
+ * Realize the bin
+ */
+ virtual void realize ();
+
/**destructor
* call clear ()
*/
! virtual ~bin ();
!
protected :
Index: border_ui.cc
===================================================================
RCS file: /cvsroot/adonthell/adonthell/src/gui/Attic/border_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
*** border_ui.cc 2 Jul 2002 07:20:30 -0000 1.1.2.1
--- border_ui.cc 26 Sep 2002 11:28:37 -0000 1.1.2.2
***************
*** 13,17 ****
*/
!
#include "border_ui.h"
--- 13,17 ----
*/
! #include <iostream>
#include "border_ui.h"
***************
*** 30,33 ****
--- 30,35 ----
if (!btempl_ || !container_) return;
+ /* BORDER, to draw border we use the template picture */
+
img_[border_template::B_TOP]->assign_drawing_area(da);
btempl_->get_border (border_template::B_TOP)->draw
(img_[border_template::B_TOP]->x(),
***************
*** 55,58 ****
--- 57,61 ----
+ /* NOW DRAW CORNER */
img_[border_template::C_TL]->assign_drawing_area(da);
btempl_->get (border_template::C_TL)->draw
(img_[border_template::C_TL]->x(),
***************
*** 85,88 ****
--- 88,92 ----
if (!btempl_ || !container_) return;
+ /* move the border */
img_[border_template::B_TOP]->move (container_->get_x_real(),
container_->get_y_real() - img_[border_template::B_TOP]->height());
img_[border_template::B_BOTTOM]->move (container_->get_x_real(),
container_->get_y_real() + container_->get_height());
***************
*** 107,110 ****
--- 111,117 ----
container_->get_y_real() -
(img_[border_template::C_BR]->height()>>1) +
(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.1
retrieving revision 1.1.2.2
diff -C2 -r1.1.2.1 -r1.1.2.2
*** box.cc 2 Jul 2002 07:20:30 -0000 1.1.2.1
--- box.cc 26 Sep 2002 11:28:37 -0000 1.1.2.2
***************
*** 49,54 ****
void box::add (widget * w)
{
! add_end (w);
!
}
--- 49,54 ----
void box::add (widget * w)
{
! /* by default add the widget at the end */
! add_end (w);
}
***************
*** 57,69 ****
{
std::deque <box_struct* >::iterator it = v_widget_.begin ();
!
while (it != v_widget_.end () && (*it)->widget_ != w) it++;
if (it != v_widget_.end ())
! {
v_widget_.erase (it);
!
! on_remove ();
! }
}
--- 57,70 ----
{
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 ();
! }
}
***************
*** 71,98 ****
void box::clear ()
{
! for (std::deque <box_struct* >::iterator it = v_widget_.begin (); it !=
v_widget_.end (); it++)
{
! delete (*it)->widget_;
! delete *it;
}
! 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 ();
}
--- 72,100 ----
void box::clear ()
{
! /* destroy all objet */
! for (std::deque <box_struct* >::iterator it = v_widget_.begin (); it !=
v_widget_.end (); it++)
{
! delete (*it)->widget_;
! delete *it;
}
! 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 ();
}
***************
*** 108,157 ****
void box::realize_horizontal ()
{
! if (v_widget_.size () == 0) return;
!
! /* init value with border width */
! s_int32 x_tmp = 0; // border_width_;
! s_int32 y_tmp = 0; // border_width_;
! /* calcul the max length for each widget*/
! u_int32 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++)
{
! if (v_widget_[i]->expand_ == true)
{
! 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;
}
! else
{
! // 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;
}
}
! 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 () - (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_) - border_width_ ) - x_tmp )
! / ( v_widget_.size () - i - 1) ;
! else
! {
! /*this is the last widget*/
! /* we resize the container */
! set_size (x_tmp + border_width_, get_height ());
}
}
--- 110,160 ----
void box::realize_horizontal ()
{
! if (v_widget_.size () == 0) return;
! /* 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++)
{
! if (v_widget_[i]->expand_ == true)
{
! 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;
}
! else
{
! // 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;
}
}
! 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 () - (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_) - border_width_ ) - x_tmp )
! / ( v_widget_.size () - i - 1) ;
! else
! {
! /*this is the last widget*/
! /* we resize the container */
! set_size (x_tmp + border_width_, get_height ());
}
}
***************
*** 164,181 ****
void box::realize_vertical ()
{
! if (v_widget_.size () == 0) return;
!
! /* init value with border width */
! s_int32 x_tmp = 0; // border_width_;
! s_int32 y_tmp = 0; // border_width_;
!
! /* calcul the max length 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++)
{
! if (v_widget_[i]->expand_ == true)
{
! if (v_widget_[i]->fill_ == true)
{
v_widget_[i]->widget_->set_size (get_length () -
(border_width_ << 1), max_height);
--- 167,186 ----
void box::realize_vertical ()
{
! /* if nothing return */
! 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_)
- (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 () -
(border_width_ << 1), max_height);
***************
*** 185,204 ****
else
{
! // 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_,
! 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 () - (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 ();
--- 190,209 ----
else
{
! // 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_,
! 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 () - (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 ();
***************
*** 210,220 ****
else
{
! /*this is the last widget*/
! /* we resize the container */
! set_size (get_length (), y_tmp + border_width_);
}
}
! /*add space between each widget */
! y_tmp += spacing_;
}
}
--- 215,225 ----
else
{
! /*this is the last widget*/
! /* we resize the container */
! set_size (get_length (), y_tmp + border_width_);
}
}
! /*add space between each widget */
! y_tmp += spacing_;
}
}
Index: box.h
===================================================================
RCS file: /cvsroot/adonthell/adonthell/src/gui/Attic/box.h,v
retrieving revision 1.1.2.1
retrieving revision 1.1.2.2
diff -C2 -r1.1.2.1 -r1.1.2.2
*** box.h 2 Jul 2002 07:20:30 -0000 1.1.2.1
--- box.h 26 Sep 2002 11:28:37 -0000 1.1.2.2
***************
*** 78,84 ****
*/
void clear ();
!
!
! /** It's used to build the widget.
*/
void realize ();
--- 78,85 ----
*/
void clear ();
!
!
! /**
! * It's used to build the widget.
*/
void realize ();
***************
*** 89,94 ****
*/
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
--- 90,95 ----
*/
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
***************
*** 107,117 ****
*/
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) .
--- 108,118 ----
*/
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) .
***************
*** 124,129 ****
*/
void update_position ();
!
!
/**
* input update function
--- 125,130 ----
*/
void update_position ();
!
!
/**
* input update function
***************
*** 131,140 ****
*/
virtual int input_update (input::event *);
!
!
~box ();
!
static const u_int8 VERTICAL = 0;
static const u_int8 HORIZONTAL = 1;
protected :
--- 132,142 ----
*/
virtual int input_update (input::event *);
!
!
~box ();
!
static const u_int8 VERTICAL = 0;
static const u_int8 HORIZONTAL = 1;
+
protected :
***************
*** 150,154 ****
*/
void realize_horizontal ();
!
/** build the box in vertical geometry
--- 152,156 ----
*/
void realize_horizontal ();
!
/** build the box in vertical geometry
***************
*** 156,159 ****
--- 158,162 ----
void realize_vertical ();
+
struct box_struct
{
***************
*** 170,191 ****
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_;
};
-
};
--- 173,193 ----
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_;
};
};
Index: container.cc
===================================================================
RCS file: /cvsroot/adonthell/adonthell/src/gui/Attic/container.cc,v
retrieving revision 1.1.2.1
retrieving revision 1.1.2.2
diff -C2 -r1.1.2.1 -r1.1.2.2
*** container.cc 2 Jul 2002 07:20:30 -0000 1.1.2.1
--- container.cc 26 Sep 2002 11:28:37 -0000 1.1.2.2
***************
*** 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)
{
! border_width_ = b;
}
***************
*** 38,41 ****
--- 38,42 ----
container::~container ()
{
+ /* destroy the decoration */
if (object_ui_) delete object_ui_;
}
***************
*** 71,74 ****
--- 72,76 ----
{
widget::update_position();
+ /* we move the decoration associated at this container*/
if (object_ui_) object_ui_->move();
}
***************
*** 78,81 ****
--- 80,84 ----
{
widget::realize();
+ /* we call resize for objet_ui */
if (object_ui_) object_ui_->resize ();
}
Index: container.h
===================================================================
RCS file: /cvsroot/adonthell/adonthell/src/gui/Attic/container.h,v
retrieving revision 1.1.2.1
retrieving revision 1.1.2.2
diff -C2 -r1.1.2.1 -r1.1.2.2
*** container.h 2 Jul 2002 07:20:30 -0000 1.1.2.1
--- container.h 26 Sep 2002 11:28:37 -0000 1.1.2.2
***************
*** 45,54 ****
{
public :
!
!
! /**Initialize some variable, child to NULL and border_width (6); */
container ();
!
!
/**
* Add a widget in the list.
--- 45,54 ----
{
public :
!
!
! /**Initialize some variable, child to NULL and border_width (5); */
container ();
!
!
/**
* Add a widget in the list.
***************
*** 57,62 ****
*/
virtual void add (widget * w) = 0;
!
!
/** Remove a widget, don't delete the object
* on_remove event is executed
--- 57,62 ----
*/
virtual void add (widget * w) = 0;
!
!
/** Remove a widget, don't delete the object
* on_remove event is executed
***************
*** 70,106 ****
*/
void set_border_width (const u_int16);
!
!
/** get border width
* @return the border width
*/
u_int16 get_border_width () const;
!
!
/** clear all widget of the vector and child, they are deleted
* No event is called
*/
virtual void clear () = 0;
!
!
/**
* draw the container
*/
virtual bool draw (gfx::drawing_area * da = NULL, gfx::surface * sf =
NULL);
!
!
/**
* Destructor
*/
virtual ~container ();
!
!
/**
* Set the border for this container
! * @param bd_tmp : the border template use to display border
*/
void set_border_ui (border_template * bd_tmp);
!
!
/** set the minimum size of a widget
* @param length
--- 70,107 ----
*/
void set_border_width (const u_int16);
!
!
/** get border width
* @return the border width
*/
u_int16 get_border_width () const;
!
!
/** clear all widget of the vector and child, they are deleted
* No event is called
*/
virtual void clear () = 0;
!
!
/**
* draw the container
*/
virtual bool draw (gfx::drawing_area * da = NULL, gfx::surface * sf =
NULL);
!
!
/**
* Destructor
*/
virtual ~container ();
!
!
/**
* Set the border for this container
! * @param bd_tmp : the border template use to display border, this
objet alloc a border but not the template
! * futur change : change set_border in set_ui : ?? maybe
*/
void set_border_ui (border_template * bd_tmp);
!
!
/** set the minimum size of a widget
* @param length
***************
*** 108,118 ****
*/
virtual void set_size (s_int32 length, s_int32 height);
!
!
/**
* update position
*/
virtual void update_position();
!
/**
* it's used to build the widget.
--- 109,119 ----
*/
virtual void set_size (s_int32 length, s_int32 height);
!
!
/**
* update position
*/
virtual void update_position();
!
/**
* it's used to build the widget.
***************
*** 120,135 ****
virtual void realize ();
!
/* call back */
! callback_sig on_add;
! callback_sig on_remove;
!
protected :
!
/* the space between container and widgets childs */
u_int16 border_width_;
!
!
/* the border used by this container */
//border_ui * border_;
--- 121,136 ----
virtual void realize ();
!
/* call back */
! callback_sig on_add; //call when an objet is added
! callback_sig on_remove; //call when an objet is removed
+
protected :
!
/* the space between container and widgets childs */
u_int16 border_width_;
!
!
/* the border used by this container */
//border_ui * border_;
Index: misc.cc
===================================================================
RCS file: /cvsroot/adonthell/adonthell/src/gui/Attic/misc.cc,v
retrieving revision 1.1.2.1
retrieving revision 1.1.2.2
diff -C2 -r1.1.2.1 -r1.1.2.2
*** misc.cc 2 Jul 2002 07:20:30 -0000 1.1.2.1
--- misc.cc 26 Sep 2002 11:28:37 -0000 1.1.2.2
***************
*** 23,27 ****
! void misc::set_padding (const u_int32 xp, const u_int32 yp)
{
x_pad_ = xp;
--- 23,27 ----
! void misc::set_padding (const u_int16 xp, const u_int16 yp)
{
x_pad_ = xp;
Index: misc.h
===================================================================
RCS file: /cvsroot/adonthell/adonthell/src/gui/Attic/misc.h,v
retrieving revision 1.1.2.1
retrieving revision 1.1.2.2
diff -C2 -r1.1.2.1 -r1.1.2.2
*** misc.h 2 Jul 2002 07:20:30 -0000 1.1.2.1
--- misc.h 26 Sep 2002 11:28:37 -0000 1.1.2.2
***************
*** 49,53 ****
* @param yp y pad
*/
! void set_padding (const u_int32 xp, const u_int32 yp);
--- 49,53 ----
* @param yp y pad
*/
! void set_padding (const u_int16 xp, const u_int16 yp);
***************
*** 96,101 ****
/* padding value */
! u_int32 x_pad_;
! u_int32 y_pad_;
/* align value */
--- 96,101 ----
/* padding value */
! u_int16 x_pad_;
! u_int16 y_pad_;
/* align value */
Index: widget.cc
===================================================================
RCS file: /cvsroot/adonthell/adonthell/src/gui/Attic/widget.cc,v
retrieving revision 1.1.2.1
retrieving revision 1.1.2.2
diff -C2 -r1.1.2.1 -r1.1.2.2
*** widget.cc 2 Jul 2002 07:20:30 -0000 1.1.2.1
--- widget.cc 26 Sep 2002 11:28:37 -0000 1.1.2.2
***************
*** 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,
! but WITHOUT ANY WARRANTY.
! See the COPYING file for more details
*/
***************
*** 27,100 ****
void widget::set_parent (container * parent)
{
! parent_ = parent;
}
! void widget::set_position (s_int32 x, s_int32 y)
{
! x_ = x;
! y_ = y;
! update_position ();
}
void widget::update_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_);
}
! s_int32 widget::get_x () const
{
! return x_;
}
! s_int32 widget::get_y () const
{
! return y_;
}
! s_int32 widget::get_x_real () const
{
! return drawing_area::x ();
}
! s_int32 widget::get_y_real () const
{
! return drawing_area::y ();
}
! void widget::set_size (u_int32 length, u_int32 height)
{
- if (length < 0 && height < 0 ) return;
-
- if (length >= 0 && height < 0 )
- {
- drawing_area::resize (length, 0);
- return;
- }
- if (length < 0 && height >= 0)
- {
- drawing_area::resize (0, height);
- return;
- }
if (get_length () == length && get_height () == height) return;
! drawing_area::resize (length, height);
}
! u_int32 widget::get_length () const
{
! return drawing_area::length ();
}
! u_int32 widget::get_height () const
{
! return drawing_area::height ();
}
--- 27,92 ----
void widget::set_parent (container * parent)
{
! parent_ = parent;
}
! void widget::set_position (s_int16 x, s_int16 y)
{
! x_ = x;
! y_ = y;
! update_position ();
}
void widget::update_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_);
}
! s_int16 widget::get_x () const
{
! return x_;
}
! s_int16 widget::get_y () const
{
! return y_;
}
! s_int16 widget::get_x_real () const
{
! return drawing_area::x ();
}
! s_int16 widget::get_y_real () const
{
! return drawing_area::y ();
}
! 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);
! else if (height >= 0 ) drawing_area::resize (0, height);
! else drawing_area::resize (0, 0);
}
! u_int16 widget::get_length () const
{
! return drawing_area::length ();
}
! u_int16 widget::get_height () const
{
! return drawing_area::height ();
}
***************
*** 102,107 ****
void widget::set_visible (const bool b)
{
! if (visible_ = b) on_show ();
! else on_hide ();
}
--- 94,99 ----
void widget::set_visible (const bool b)
{
! if (visible_ = b) on_show ();
! else on_hide ();
}
***************
*** 109,113 ****
bool widget::is_visible () const
{
! return visible_;
}
--- 101,105 ----
bool widget::is_visible () const
{
! return visible_;
}
***************
*** 115,119 ****
void widget::set_sensible (const bool b)
{
! sensible_ = b;
}
--- 107,111 ----
void widget::set_sensible (const bool b)
{
! sensible_ = b;
}
***************
*** 121,125 ****
bool widget::is_sensible () const
{
! return sensible_;
}
--- 113,117 ----
bool widget::is_sensible () const
{
! return sensible_;
}
***************
*** 127,131 ****
void widget::set_can_focus (const bool b)
{
! can_focus_ = b;
}
--- 119,123 ----
void widget::set_can_focus (const bool b)
{
! can_focus_ = b;
}
***************
*** 133,137 ****
bool widget::is_can_focus () const
{
! return can_focus_;
}
--- 125,129 ----
bool widget::is_can_focus () const
{
! return can_focus_;
}
***************
*** 139,144 ****
void widget::set_has_focus (const bool b)
{
! if (has_focus_ = b) on_focus_on ();
! else on_focus_off ();
}
--- 131,136 ----
void widget::set_has_focus (const bool b)
{
! if (has_focus_ = b) on_focus_on ();
! else on_focus_off ();
}
***************
*** 146,150 ****
bool widget::is_has_focus () const
{
! return has_focus_;
}
--- 138,142 ----
bool widget::is_has_focus () const
{
! return has_focus_;
}
***************
*** 152,156 ****
void widget::set_can_default (const bool b)
{
! can_default_ = b;
}
--- 144,148 ----
void widget::set_can_default (const bool b)
{
! can_default_ = b;
}
***************
*** 158,162 ****
bool widget::is_can_default () const
{
! return can_default_;
}
--- 150,154 ----
bool widget::is_can_default () const
{
! return can_default_;
}
***************
*** 164,168 ****
void widget::set_has_default (const bool b)
{
! has_default_ = b;
}
--- 156,160 ----
void widget::set_has_default (const bool b)
{
! has_default_ = b;
}
***************
*** 170,174 ****
bool widget::is_has_default () const
{
! return has_default_;
}
--- 162,166 ----
bool widget::is_has_default () const
{
! return has_default_;
}
***************
*** 176,180 ****
widget::~widget ()
{
! on_destroy ();
}
--- 168,172 ----
widget::~widget ()
{
! on_destroy ();
}
***************
*** 195,198 ****
bool widget::update ()
{
! return true;
}
--- 187,190 ----
bool widget::update ()
{
! return true;
}
Index: widget.h
===================================================================
RCS file: /cvsroot/adonthell/adonthell/src/gui/Attic/widget.h,v
retrieving revision 1.1.2.1
retrieving revision 1.1.2.2
diff -C2 -r1.1.2.1 -r1.1.2.2
*** widget.h 2 Jul 2002 07:20:30 -0000 1.1.2.1
--- widget.h 26 Sep 2002 11:28:37 -0000 1.1.2.2
***************
*** 77,81 ****
* @param y
*/
! virtual void set_position (s_int32 x, s_int32 y);
--- 77,81 ----
* @param y
*/
! virtual void set_position (s_int16 x, s_int16 y);
***************
*** 88,92 ****
* @return x position in his parent
*/
! s_int32 get_x () const;
--- 88,92 ----
* @return x position in his parent
*/
! s_int16 get_x () const;
***************
*** 95,99 ****
* @return y position in his parent
*/
! s_int32 get_y () const;
--- 95,99 ----
* @return y position in his parent
*/
! s_int16 get_y () const;
***************
*** 102,106 ****
* @return real x position in the screen
*/
! s_int32 get_x_real () const;
--- 102,106 ----
* @return real x position in the screen
*/
! s_int16 get_x_real () const;
***************
*** 108,112 ****
* @return real y position in the screen
*/
! s_int32 get_y_real () const;
--- 108,112 ----
* @return real y position in the screen
*/
! s_int16 get_y_real () const;
***************
*** 115,119 ****
* @param height
*/
! virtual void set_size (u_int32 length, u_int32 height);
--- 115,119 ----
* @param height
*/
! virtual void set_size (s_int32 length, s_int32 height);
***************
*** 121,125 ****
* @return length
*/
! u_int32 get_length () const;
--- 121,125 ----
* @return length
*/
! u_int16 get_length () const;
***************
*** 127,131 ****
* @return height
*/
! u_int32 get_height () const;
--- 127,131 ----
* @return height
*/
! u_int16 get_height () const;
***************
*** 249,254 ****
/* position of the widget, position in the parent */
! s_int32 x_;
! s_int32 y_;
--- 249,254 ----
/* position of the widget, position in the parent */
! s_int16 x_;
! s_int16 y_;
***************
*** 277,281 ****
};
!
};
#endif
--- 277,281 ----
};
!
};
#endif
Index: window.cc
===================================================================
RCS file: /cvsroot/adonthell/adonthell/src/gui/Attic/window.cc,v
retrieving revision 1.1.2.1
retrieving revision 1.1.2.2
diff -C2 -r1.1.2.1 -r1.1.2.2
*** window.cc 2 Jul 2002 07:20:30 -0000 1.1.2.1
--- window.cc 26 Sep 2002 11:28:37 -0000 1.1.2.2
***************
*** 22,39 ****
window::window () : alive_ (true)
{
! // modal by default
! set_modal (true);
!
! //sensible by default
! set_sensible (true);
!
! set_resizeable (true);
!
! set_moveable (true);
!
! set_deleted (true);
!
! /* mouse action none at the beginning */
! mouse_action_ = ACTION_NONE;
}
--- 22,39 ----
window::window () : alive_ (true)
{
! // modal by default
! set_modal (true);
!
! //sensible by default
! set_sensible (true);
!
! set_resizeable (true);
!
! set_moveable (true);
!
! set_deleted (true);
!
! /* mouse action none at the beginning */
! mouse_action_ = ACTION_NONE;
}
***************
*** 41,45 ****
void window::set_title (const std::string & t)
{
! title_ = t;
}
--- 41,45 ----
void window::set_title (const std::string & t)
{
! title_ = t;
}
***************
*** 47,51 ****
void window::set_type (const u_int8 t)
{
! type_ = t;
}
--- 47,51 ----
void window::set_type (const u_int8 t)
{
! type_ = t;
}
***************
*** 53,57 ****
bool window::is_modal () const
{
! return modal_;
}
--- 53,57 ----
bool window::is_modal () const
{
! return modal_;
}
***************
*** 59,63 ****
void window::set_modal (const bool m)
{
! modal_ = m;
}
--- 59,63 ----
void window::set_modal (const bool m)
{
! modal_ = m;
}
***************
*** 67,144 ****
{
if (!is_sensible () ) return 0;
! if (bin::input_update (ev) == 1) return 1;
!
! input::mouse_event * me = (input::mouse_event *) ev;
!
! /* we check if there is already a mouse actio in progress */
! if (mouse_action_ == ACTION_MOVE)
! {
! if (me->type () == input::mouse_event::MOUSE_MOTION)
! {
! set_position (me->x () - mouse_range_x_, me->y () -
mouse_range_y_);
! return 1;
! }
! else if (me->type () == input::mouse_event::BUTTON_RELEASED)
! {
! mouse_action_ = ACTION_NONE;
! return 1;
! }
! }
!
!
! if (mouse_action_ == ACTION_RESIZE)
! {
! if (me->type () == input::mouse_event::MOUSE_MOTION)
! {
! set_size (me->x () - get_x_real () , me->y () - get_y_real () );
! return 1;
! }
! else if (me->type () == input::mouse_event::BUTTON_RELEASED)
! {
! mouse_action_ = ACTION_NONE;
! return 1;
! }
! }
!
!
! if (point_belong (me->x (), me->y ())) return 0;
! else
! {
! /* there are no action in progress we check if the cursor is on
special border */
! if (deleted_)
! {
! 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 ();
! return 1;
! }
! }
!
! if (moveable_)
! {
! 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;
! mouse_range_x_ = me->x () - get_x_real ();
! mouse_range_y_ = me->y () - get_y_real ();
! return 1;
! }
! }
!
! if (resizeable_)
! {
! 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;
! return 1;
! }
! }
!
! }
! return 0;
}
--- 67,149 ----
{
if (!is_sensible () ) return 0;
+ /* if the object inside the window keep the event,we return 1 */
+ if (bin::input_update (ev) == 1) return 1;
! /* translate event into mouse_event */
! input::mouse_event * me = (input::mouse_event *) ev;
!
! /* we check if there is already a mouse action in progress */
! if (mouse_action_ == ACTION_MOVE)
! {
! /* if mouse action is move and event is mouse_motion */
! if (me->type () == input::mouse_event::MOUSE_MOTION)
! {
! set_position (me->x () - mouse_range_x_, me->y () - mouse_range_y_);
! return 1;
! }
!
! /* if mouse event is button_RELEASED so the action become none */
! else if (me->type () == input::mouse_event::BUTTON_RELEASED)
! {
! mouse_action_ = ACTION_NONE;
! return 1;
! }
! }
! /* if mouse action is resize */
! else if (mouse_action_ == ACTION_RESIZE)
! {
! /* if mouse event is mouse motion, we resize the objet */
! if (me->type () == input::mouse_event::MOUSE_MOTION)
! {
! set_size ( me->x () - get_x_real (), me->y () - get_y_real ());
! return 1;
! }
! /* if mouse event is mouse released, we set action to none */
! else if (me->type () == input::mouse_event::BUTTON_RELEASED)
! {
! mouse_action_ = ACTION_NONE;
! return 1;
! }
! }
!
! /* if the action is inside the window we return null*/
! if (point_belong (me->x (), me->y ())) return 0;
! else
! {
! /* there are no action in progress we check if the cursor is on special
border */
! if (deleted_)
! {
! 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 ();
! return 1;
! }
! }
!
! if (moveable_)
! {
! 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;
! mouse_range_x_ = me->x () - get_x_real ();
! mouse_range_y_ = me->y () - get_y_real ();
! return 1;
! }
! }
!
! if (resizeable_)
! {
! 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;
! return 1;
! }
! }
!
! }
! return 0;
}
***************
*** 189,197 ****
-
-
-
-
-
void window::realize ()
{
--- 194,197 ----
***************
*** 199,215 ****
if (!child) return;
! if (child->get_length () != get_length () || child->get_height () !=
get_height ())
{
// WARNING maybe change and put this system in bin ? ?
if (resizeable_)
{
set_size (child->get_length () + (border_width_ << 1) ,
child->get_height () + (border_width_ << 1));
! }
else
{
! child->set_size (get_length () -(border_width_ << 1), get_height () -
(border_width_ << 1));
child->realize ();
}
! }
}
--- 199,218 ----
if (!child) return;
! /* if (child->get_length () != get_length () - get_border_width() ||
child->get_height () != get_height () - get_border_width ())
{
// WARNING maybe change and put this system in bin ? ?
+ // if the window is resizable, the window is adapted to the child
if (resizeable_)
{
set_size (child->get_length () + (border_width_ << 1) ,
child->get_height () + (border_width_ << 1));
! child->set_position ( get_border_width(), get_border_width());
! }
else
{
! //if the window is not resizable, we resize the child
! child->set_size (get_length () - (border_width_ << 1),get_height () -
(border_width_ << 1));
child->realize ();
}
! } */
}
Index: window.h
===================================================================
RCS file: /cvsroot/adonthell/adonthell/src/gui/Attic/window.h,v
retrieving revision 1.1.2.1
retrieving revision 1.1.2.2
diff -C2 -r1.1.2.1 -r1.1.2.2
*** window.h 2 Jul 2002 07:20:30 -0000 1.1.2.1
--- window.h 26 Sep 2002 11:28:37 -0000 1.1.2.2
***************
*** 70,75 ****
*/
void set_modal (const bool);
!
!
/**
* is_modal
--- 70,75 ----
*/
void set_modal (const bool);
!
!
/**
* is_modal
***************
*** 77,82 ****
*/
bool is_modal () const;
!
!
/**
* set deleted with mouse
--- 77,82 ----
*/
bool is_modal () const;
!
!
/**
* set deleted with mouse
***************
*** 84,95 ****
*/
void set_deleted (const bool);
!
!
/**
* @return if this window can be deleted with mouse
*/
bool is_deleted () const;
!
!
/**
* set moveable with mouse
--- 84,95 ----
*/
void set_deleted (const bool);
!
!
/**
* @return if this window can be deleted with mouse
*/
bool is_deleted () const;
!
!
/**
* set moveable with mouse
***************
*** 97,102 ****
*/
void set_moveable (const bool);
!
!
/**
* @return if this window can be moved with mouse
--- 97,102 ----
*/
void set_moveable (const bool);
!
!
/**
* @return if this window can be moved with mouse
***************
*** 117,121 ****
bool is_resizeable () const;
!
/**
* input update function
--- 117,121 ----
bool is_resizeable () const;
!
/**
* input update function
***************
*** 123,133 ****
*/
int input_update (input::event *);
!
!
/**
* If this function is call, alive_ variable become false and update
function return false
*/
void shutdown ();
!
/**
--- 123,133 ----
*/
int input_update (input::event *);
!
!
/**
* If this function is call, alive_ variable become false and update
function return false
*/
void shutdown ();
!
/**
***************
*** 189,195 ****
u_int16 mouse_range_x_;
u_int16 mouse_range_y_;
!
!
!
/* mouse status action */
typedef enum
--- 189,193 ----
u_int16 mouse_range_x_;
u_int16 mouse_range_y_;
!
/* mouse status action */
typedef enum
--- border.cc DELETED ---
--- border.h DELETED ---
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- [Adonthell-commits] CVS: adonthell/src/gui bin.cc,1.1.2.1,1.1.2.2 bin.h,1.1.2.1,1.1.2.2 border_ui.cc,1.1.2.1,1.1.2.2 box.cc,1.1.2.1,1.1.2.2 box.h,1.1.2.1,1.1.2.2 container.cc,1.1.2.1,1.1.2.2 container.h,1.1.2.1,1.1.2.2 misc.cc,1.1.2.1,1.1.2.2 misc.h,1.1.2.1,1.1.2.2 widget.cc,1.1.2.1,1.1.2.2 widget.h,1.1.2.1,1.1.2.2 window.cc,1.1.2.1,1.1.2.2 window.h,1.1.2.1,1.1.2.2 border.cc,1.1.2.1,NONE border.h,1.1.2.1,NONE,
VENNIN Joel <address@hidden> <=