[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Adonthell-commits] CVS: adonthell/src atk_background_template.cc,NONE,1
From: |
VENNIN Joel <address@hidden> |
Subject: |
[Adonthell-commits] CVS: adonthell/src atk_background_template.cc,NONE,1.1.2.1 atk_background_ui.cc,NONE,1.1.2.1 atk_background_ui.h,NONE,1.1.2.1 atk_button.cc,NONE,1.1.2.1 atk_button.h,NONE,1.1.2.1 atk_button_template.cc,NONE,1.1.2.1 atk_button_template.h,NONE,1.1.2.1 atk_button_ui.cc,NONE,1.1.2.1 atk_button_ui.h,NONE,1.1.2.1 atk_object_ui.h,NONE,1.1.2.1 Makefile.am,1.80.2.30,1.80.2.31 atk_bin.cc,1.1.2.2,1.1.2.3 atk_bin.h,1.1.2.2,1.1.2.3 atk_border_template.cc,1.1.2.2,1.1.2.3 atk_border_template.h,1.1.2.2,1.1.2.3 atk_box.cc,1.1.2.4,1.1.2.5 atk_box.h,1.1.2.4,1.1.2.5 atk_container.cc,1.1.2.3,1.1.2.4 atk_container.h,1.1.2.4,1.1.2.5 atk_fixed.cc,1.1.2.1,1.1.2.2 atk_fixed.h,1.1.2.1,1.1.2.2 atk_font.cc,1.1.2.3,1.1.2.4 atk_font.h,1.1.2.2,1.1.2.3 atk_label.cc,1.1.2.1,1.1.2.2 atk_label.h,1.1.2.1,1.1.2.2 atk_widget.cc,1.1.2.4,1.1.2.5 atk_widget.h,1.1.2.5,1.1.2.6 atk_window.cc,1.1.2.1,1.1.2.2 atk_window.h,1.1.2.2,1.1.2.3 joltest.cc,1.1.2.8,1.1.2.9 |
Date: |
Fri, 28 Jun 2002 05:17:06 -0400 |
Update of /cvsroot/adonthell/adonthell/src
In directory subversions:/tmp/cvs-serv4448
Modified Files:
Tag: Branch_road_to_0-4
Makefile.am atk_bin.cc atk_bin.h atk_border_template.cc
atk_border_template.h atk_box.cc atk_box.h atk_container.cc
atk_container.h atk_fixed.cc atk_fixed.h atk_font.cc
atk_font.h atk_label.cc atk_label.h atk_widget.cc atk_widget.h
atk_window.cc atk_window.h joltest.cc
Added Files:
Tag: Branch_road_to_0-4
atk_background_template.cc atk_background_ui.cc
atk_background_ui.h atk_button.cc atk_button.h
atk_button_template.cc atk_button_template.h atk_button_ui.cc
atk_button_ui.h atk_object_ui.h
Log Message:
Add new file for adonthell tool kit, imposible to use it as for now
--- NEW FILE ---
#include "atk_background_template.h"
atk_background_template::atk_background_template(): imgback_(NULL)
{
type_ = NOTHING;
}
void atk_background_template::load( igzstream & is)
{
if (imgback_)
{
delete imgback_;
imgback_ = NULL;
}
name_ << is;
type_ << is;
switch (type_)
{
case NOTHING:
break;
case COLOR:
r_ << is;
g_ << is;
b_ << is;
break;
case IMAGE:
imgback_ = new image();
imgback_->get (is);
break;
}
}
void atk_background_template::save (ogzstream & os)
{
name_ >> os;
type_ >> os;
if (type_ == COLOR)
{
r_ >> os;
g_ >> os;
b_ >> os;
}
else imgback_->put (os);
}
std::string atk_background_template::get_name () const
{
return name_;
}
void atk_background_template::set_name (const std::string & name)
{
name_ = name;
}
image * atk_background_template::get_image()
{
return imgback_;
}
/*
u_int32 atk_background_template::get_color()
{
return colorback_;
}
*/
u_int8 atk_background_template::get_r()
{
return r_;
}
u_int8 atk_background_template::get_g()
{
return g_;
}
u_int8 atk_background_template::get_b()
{
return b_;
}
void atk_background_template::set_image (image * tmp)
{
if ( imgback_) delete imgback_;
imgback_ = tmp;
if (tmp ) type_= IMAGE;
else type_ = COLOR;
}
void atk_background_template::set_color (u_int8 r, u_int8 g, u_int8 b)
{
type_ = COLOR;
r_ = r;
g_ = g;
b_ = b;
}
u_int8 atk_background_template::get_type()
{
return type_;
}
--- NEW FILE ---
#include <iostream>
#include "atk_background_ui.h"
atk_background_ui::atk_background_ui (atk_container * tmp) : btmpl_ (NULL)
{
container_ = tmp;
}
void atk_background_ui::draw (drawing_area * da = NULL, surface * sf = NULL)
{
if (!container_ || !btmpl_ ) return;
switch (btmpl_->get_type())
{
case atk_background_template::COLOR:
screen::display.fillrect (container_->get_x_real(),
container_->get_y_real(),
container_->get_length(),
container_->get_height(),
btmpl_->get_r(),btmpl_->get_g(),
btmpl_->get_b(), da);
// cout << container_->get_x_real() << " " <<
container_->get_y_real() <<" " << container_->get_length() << " " <<
container_->get_height() << endl;
break;
}
}
void atk_background_ui::resize ()
{
}
void atk_background_ui::move()
{
}
void atk_background_ui::set_background( atk_background_template * btmp)
{
btmpl_ = btmp;
}
***** Error reading new file: [Errno 2] No such file or directory:
'atk_background_ui.h'
--- NEW FILE ---
#include "mouse_event.h"
#include "atk_label.h"
#include "atk_button_ui.h"
#include "atk_button.h"
atk_button::atk_button (): pressed_ (false)
{
set_sensible (true);
set_border_width (0);
}
bool atk_button::get_pressed() const
{
return pressed_;
}
void atk_button::set_button_ui (atk_button_template * but)
{
if (object_ui_) delete object_ui_;
object_ui_ = new atk_button_ui (this);
((atk_button_ui*)object_ui_)->set_button (but);
}
int atk_button::input_update (input_event * ev)
{
if (!is_sensible () ) return 0;
mouse_event * me = (mouse_event *) ev;
/* test if mouse position is inside this button */
if (!point_belong (me->x (), me->y ()))
{
if (pressed_) pressed_ = false;
return 0;
}
/* the mouse is inside the button */
if (me->type () == mouse_event::BUTTON_PUSHED)
{
on_pressed();
pressed_ = true;
}
else if (me->type () == mouse_event::BUTTON_RELEASED)
{
on_released();
if( pressed_ ) on_clicked();
pressed_ = false;
}
return 1;
}
atk_button::~atk_button ()
{
}
void atk_button::set_text (const std::string & text, atk_font * font)
{
/* destroy child */
clear();
atk_label * lab = new atk_label;
lab->set_font (*font);
lab->set_text (text);
lab->set_visible (true);
// lab->set_alignment ( atk_misc::CENTER, atk_misc::CENTER );
add ( lab );
lab->realize();
}
***** Error reading new file: [Errno 2] No such file or directory:
'atk_button.h'
--- NEW FILE ---
#include "atk_button_template.h"
atk_button_template::atk_button_template():background_(NULL),
pressed_border_(NULL), released_border_(NULL)
{
}
void atk_button_template::load (igzstream & is)
{
if (background_) delete background_;
if (pressed_border_) delete pressed_border_;
if (released_border_) delete released_border_;
name_ << is;
background_ = new atk_background_template();
background_->load (is);
pressed_border_ = new atk_border_template();
pressed_border_->load (is);
released_border_ = new atk_border_template();
released_border_->load (is);
}
void atk_button_template::save (ogzstream & os)
{
name_ >> os;
background_->save (os);
pressed_border_->save (os);
released_border_->save (os);
}
std::string atk_button_template::get_name () const
{
return name_;
}
void atk_button_template::set_name (const std::string & name)
{
name_ = name;
}
void atk_button_template::set_released (atk_border_template * bd)
{
if (released_border_) delete released_border_;
released_border_ = bd;
}
void atk_button_template::set_pressed (atk_border_template * bd)
{
if (pressed_border_) delete pressed_border_;
pressed_border_ = bd;
}
void atk_button_template::set_background (atk_background_template * bg)
{
if (background_) delete background_;
background_ = bg;
}
atk_button_template::~atk_button_template()
{
if (background_) delete background_;
if (pressed_border_) delete pressed_border_;
if (released_border_) delete released_border_;
}
atk_border_template * atk_button_template::get_pressed () const
{
return pressed_border_;
}
atk_border_template * atk_button_template::get_released () const
{
return released_border_;
}
atk_background_template * atk_button_template::get_background () const
{
return background_;
}
***** Error reading new file: [Errno 2] No such file or directory:
'atk_button_template.h'
--- NEW FILE ---
#include "atk_button_ui.h"
atk_button_ui::atk_button_ui( atk_button * but): pressed_border_ (NULL),
released_border_ (NULL),background_ (NULL), btempl_ (NULL)
{
button_ = but;
}
void atk_button_ui::draw (drawing_area * da, surface * sf)
{
if (!btempl_ || !button_) return;
if( button_->get_pressed()) pressed_border_->draw(da, sf);
else released_border_->draw(da, sf);
background_->draw (da, sf);
}
void atk_button_ui::resize()
{
if (!btempl_ || !button_) return;
pressed_border_->resize();
released_border_->resize();
background_->resize();
}
void atk_button_ui::move()
{
if (!btempl_ || !button_) return;
pressed_border_->move();
released_border_->move();
background_->move();
}
void atk_button_ui::set_button (atk_button_template * but)
{
if ( pressed_border_ ) delete pressed_border_;
if ( released_border_ ) delete released_border_;
if (background_ ) delete background_;
btempl_ = but;
pressed_border_ = new atk_border_ui (button_);
pressed_border_->set_border (but->get_pressed());
released_border_ = new atk_border_ui (button_);
released_border_->set_border (but->get_released());
background_ = new atk_background_ui (button_);
background_->set_background (but->get_background());
}
atk_button_ui::~atk_button_ui()
{
if ( pressed_border_ ) delete pressed_border_;
if ( released_border_ ) delete released_border_;
if (background_) delete background_;
}
***** Error reading new file: [Errno 2] No such file or directory:
'atk_button_ui.h'
***** Error reading new file: [Errno 2] No such file or directory:
'atk_object_ui.h'
Index: Makefile.am
===================================================================
RCS file: /cvsroot/adonthell/adonthell/src/Makefile.am,v
retrieving revision 1.80.2.30
retrieving revision 1.80.2.31
diff -C2 -r1.80.2.30 -r1.80.2.31
*** Makefile.am 16 Jun 2002 10:59:30 -0000 1.80.2.30
--- Makefile.am 28 Jun 2002 09:17:03 -0000 1.80.2.31
***************
*** 94,105 ****
libgui_a_SOURCES = atk_box.cc atk_misc.cc atk_container.cc atk_label.cc \
! atk_font.cc atk_widget.cc atk_fixed.cc callback_sig.cc \
! atk_bin.cc atk_manager.cc atk_theme.cc\
! callback_slot.h atk_box.h atk_misc.h atk_container.h \
! atk_label.h atk_font.h atk_widget.h atk_fixed.h \
! atk_bin.h atk_window.h atk_manager.h atk_window.cc\
! atk_border_template.h atk_border_template.cc \
! atk_border.cc atk_border.h atk_theme.h\
! callback_sig.h
libgui_LDADD = $(FT2_LIBS)
--- 94,110 ----
libgui_a_SOURCES = atk_box.cc atk_misc.cc atk_container.cc atk_label.cc \
! atk_font.cc atk_widget.cc atk_fixed.cc \
! atk_bin.cc atk_window.cc atk_manager.cc atk_border_template.cc \
! atk_border_ui.cc atk_theme.cc atk_background_template.cc \
! atk_button_template.cc atk_button.cc atk_button_ui.cc \
! atk_background_ui.cc \
! callback_sig.cc \
! atk_box.h atk_misc.h atk_container.h atk_label.h \
! atk_font.h atk_widget.h atk_fixed.h \
! atk_bin.h atk_window.h atk_manager.h atk_border_template.h \
! atk_border_ui.h atk_theme.h atk_background_template.h \
! atk_button_template.h atk_button.h atk_button_ui.h \
! atk_background_ui.h \
! callback_sig.h callback_slot.h
libgui_LDADD = $(FT2_LIBS)
Index: atk_bin.cc
===================================================================
RCS file: /cvsroot/adonthell/adonthell/src/Attic/atk_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
*** atk_bin.cc 5 Apr 2002 19:59:19 -0000 1.1.2.2
--- atk_bin.cc 28 Jun 2002 09:17:03 -0000 1.1.2.3
***************
*** 23,27 ****
void atk_bin::add (atk_widget * w)
{
! if (child) remove (child);
child = w;
--- 23,28 ----
void atk_bin::add (atk_widget * w)
{
! //if (child) remove (child);
! clear();
child = w;
***************
*** 29,34 ****
w->set_position (0, 0);
!
!
on_add ();
}
--- 30,34 ----
w->set_position (0, 0);
!
on_add ();
}
***************
*** 56,66 ****
! void atk_bin::set_position (s_int32 x, s_int32 y)
{
! atk_container::set_position (x, y);
! if (child) child->update_position ();
}
--- 56,103 ----
!
!
! void atk_bin::update_position()
{
! atk_container::update_position();
!
! if (child) child->update_position ();
! }
!
! void atk_bin::set_size (u_int32 length, u_int32 height)
! {
! atk_container::set_size (length, height);
+ if (child)
+ {
+ child->set_size (get_length () -(border_width_ << 1), get_height () -
(border_width_ << 1));
+ child->realize ();
+ }
}
+
+ bool atk_bin::draw (drawing_area * da = NULL, surface * sf = NULL)
+ {
+ if (atk_container::draw (da, sf))
+ {
+ assign_drawing_area(da);
+ /* draw the contain */
+ if (child) child->draw (this, sf);
+ detach_drawing_area();
+ return true;
+ }
+ return false;
+ }
+
+
+ /**
+ * input update function
+ * @return 1 if this object use the event, else return 0
+ */
+ int atk_bin::input_update (input_event * ev)
+ {
+ if (child) return child->input_update (ev);
+ return 0;
+ }
Index: atk_bin.h
===================================================================
RCS file: /cvsroot/adonthell/adonthell/src/Attic/atk_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
*** atk_bin.h 5 Apr 2002 19:59:19 -0000 1.1.2.2
--- atk_bin.h 28 Jun 2002 09:17:03 -0000 1.1.2.3
***************
*** 60,69 ****
void clear ();
! /** set position of this widget (but the layout can change this value) ,
position in his parent
! * @param x
! * @param y
*/
! void set_position (s_int32 x, s_int32 y);
--- 60,89 ----
void clear ();
+ /**
+ * update position
+ */
+ virtual void update_position ();
+
+
+ /** set size of the window
+ * @param length
+ * @param height
+ */
+ virtual void set_size (u_int32 length, u_int32 height);
!
!
! /**
! * draw the window
*/
! bool draw (drawing_area * da = NULL, surface * sf = NULL);
!
!
! /**
! * input update function
! * @return 1 if this object use the event, else return 0
! */
! virtual int input_update (input_event *);
!
Index: atk_border_template.cc
===================================================================
RCS file: /cvsroot/adonthell/adonthell/src/Attic/atk_border_template.cc,v
retrieving revision 1.1.2.2
retrieving revision 1.1.2.3
diff -C2 -r1.1.2.2 -r1.1.2.3
*** atk_border_template.cc 3 May 2002 11:42:53 -0000 1.1.2.2
--- atk_border_template.cc 28 Jun 2002 09:17:03 -0000 1.1.2.3
***************
*** 20,24 ****
--- 20,26 ----
atk_border_template::atk_border_template ()
{
+
for (int i = 0; i < _LAST; i++) img_[i] = NULL;
+ for (int j = 0; j < C_TL; j++) imgborder_[j] = NULL;
}
***************
*** 35,41 ****
--- 37,73 ----
img_[i]->get (is);
}
+
+ for (int i = C_TL; i <_LAST; i++)
+ img_[i]->set_mask (true);
+ build();
+ }
+
+
+ void atk_border_template::build()
+ {
+ if (img_[B_TOP] == NULL) return;
+ if( imgborder_[B_TOP] == NULL)
+ for (int i = 0; i <C_TL; i++)
+ {
+ imgborder_[i] = new image;
+ imgborder_[i]->set_mask (true);
+ }
+
+ /* horizontal bar */
+ imgborder_[B_TOP]->resize (1280, img_[B_TOP]->height());
+ imgborder_[B_TOP]->tile (*(img_[B_TOP]));
+ imgborder_[B_BOTTOM]->resize (1280, img_[B_BOTTOM]->height());
+ imgborder_[B_BOTTOM]->tile (*(img_[B_BOTTOM]));
+
+ /* vertical bar */
+ imgborder_[B_LEFT]->resize (img_[B_LEFT]->length(), 1280);
+ imgborder_[B_LEFT]->tile (*(img_[B_LEFT]));
+ imgborder_[B_RIGHT]->resize (img_[B_RIGHT]->length(), 1280);
+ imgborder_[B_RIGHT]->tile (*(img_[B_RIGHT]));
}
+
+
void atk_border_template::save (ogzstream & os)
{
***************
*** 48,55 ****
image * atk_border_template::get (u_int8 i)
{
! return img_[i];
}
void atk_border_template::set (u_int8 type, image * img)
{
--- 80,96 ----
image * atk_border_template::get (u_int8 i)
{
! if ( i>= _LAST) return NULL;
! return img_[i];
}
+ image * atk_border_template::get_border (u_int8 i)
+ {
+ /* WARNING this test can be removed to optimize more .... */
+ if ( i>= C_TL) return NULL;
+
+ return imgborder_[i];
+ }
+
void atk_border_template::set (u_int8 type, image * img)
{
***************
*** 58,68 ****
}
-
void atk_border_template::set (u_int8 type, std::string filename)
{
! image * img = new image;
! if ( img->load_pnm (filename) < 0)
! std::cout << "Error on load image " << filename << " in
atk_border_template::set \n";
! set (type, img);
}
--- 99,108 ----
}
void atk_border_template::set (u_int8 type, std::string filename)
{
! image * img = new image;
! if ( img->load_pnm (filename) < 0)
! std::cout << "Error on load image " << filename << " in
atk_border_template::set \n";
! set (type, img);
}
***************
*** 72,78 ****
for (int i = 0; i < _LAST; i++)
{
! delete img_[i];
img_[i] = NULL;
}
}
--- 112,124 ----
for (int i = 0; i < _LAST; i++)
{
! if (img_[i]) delete img_[i];
img_[i] = NULL;
}
+
+ for (int j = 0; j < C_TL; j++)
+ {
+ if (imgborder_[j]) delete imgborder_[j];
+ imgborder_[j] = NULL;
+ }
}
Index: atk_border_template.h
===================================================================
RCS file: /cvsroot/adonthell/adonthell/src/Attic/atk_border_template.h,v
retrieving revision 1.1.2.2
retrieving revision 1.1.2.3
diff -C2 -r1.1.2.2 -r1.1.2.3
*** atk_border_template.h 3 May 2002 11:42:53 -0000 1.1.2.2
--- atk_border_template.h 28 Jun 2002 09:17:03 -0000 1.1.2.3
***************
*** 23,28 ****
*/
! #ifndef ATK_BODER_TEMPLATE_H_
! #define ATK_BODER_TEMPLATE_H_
#include "fileops.h"
--- 23,28 ----
*/
! #ifndef ATK_BORDER_TEMPLATE_H_
! #define ATK_BORDER_TEMPLATE_H_
#include "fileops.h"
***************
*** 32,42 ****
class atk_border_template
{
! public :
- /**
- * Default constructor, set all images to null
- */
- atk_border_template ();
-
/**
--- 32,42 ----
class atk_border_template
{
! public :
!
! /**
! * Default constructor, set all images to null
! */
! atk_border_template ();
/**
***************
*** 50,55 ****
*/
void save (ogzstream & os);
!
!
/**
--- 50,55 ----
*/
void save (ogzstream & os);
!
!
/**
***************
*** 58,63 ****
*/
std::string get_name () const;
!
!
/**
* set name of the border
--- 58,63 ----
*/
std::string get_name () const;
!
!
/**
* set name of the border
***************
*** 66,70 ****
void set_name (const std::string & name);
!
/**
* get a image
--- 66,76 ----
void set_name (const std::string & name);
!
! /**
! * Build is automaticly call when you load a border
! * build create 4 big border
! */
! void build();
!
/**
* get a image
***************
*** 76,79 ****
--- 82,91 ----
/**
+ * get a border image
+ * @param the image number {B_TOP,B_BOTTOM, B_LEFT, B_RIGHT }
+ */
+ image * get_border(u_int8);
+
+ /**
* set a image
* @param type of the image (corner, border ...)
***************
*** 108,127 ****
C_TL, C_TR, C_BL, C_BR, C_EXIT, C_RESIZE, _LAST
} border_type;
-
- protected :
!
! /**
! * Destroy all images
! */
void destroy ();
!
!
/* a tab with image */
image * img_[_LAST];
/* name of the border */
std::string name_;
private :
--- 120,143 ----
C_TL, C_TR, C_BL, C_BR, C_EXIT, C_RESIZE, _LAST
} border_type;
!
! protected :
!
! /**
! * Destroy all images
! */
void destroy ();
!
!
/* a tab with image */
image * img_[_LAST];
+ /* this tab is used to store big border, it is necessary to optimise
resize and to reduce memory use */
+ image * imgborder_[C_TL];
+
/* name of the border */
std::string name_;
+
private :
Index: atk_box.cc
===================================================================
RCS file: /cvsroot/adonthell/adonthell/src/Attic/atk_box.cc,v
retrieving revision 1.1.2.4
retrieving revision 1.1.2.5
diff -C2 -r1.1.2.4 -r1.1.2.5
*** atk_box.cc 5 Apr 2002 19:59:19 -0000 1.1.2.4
--- atk_box.cc 28 Jun 2002 09:17:03 -0000 1.1.2.5
***************
*** 100,105 ****
void atk_box::realize ()
{
! if (geometry_ == HORIZONTAL) realize_horizontal ();
! else realize_vertical ();
}
--- 100,106 ----
void atk_box::realize ()
{
! atk_container::realize();
! if (geometry_ == HORIZONTAL) realize_horizontal ();
! else realize_vertical ();
}
***************
*** 116,120 ****
s_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++)
{
--- 117,120 ----
***************
*** 221,224 ****
--- 221,225 ----
+
void atk_box::add_end (atk_widget * w, bool expand = true, bool fill = true,
u_int16 padding = 0)
{
***************
*** 268,279 ****
! void atk_box::draw (drawing_area * da = NULL, surface * sf = NULL)
! {
! if (!is_visible ()) return;
!
! atk_widget::draw (da, sf);
!
! for (std::deque <atk_box_struct* >::iterator it = v_widget_.begin (); it
!= v_widget_.end (); it++)
! (*it)->widget_->draw (da, sf);
}
--- 269,283 ----
! bool atk_box::draw (drawing_area * da = NULL, surface * sf = NULL)
! {
! if (atk_container::draw (da, sf))
! {
! assign_drawing_area (da);
! for (std::deque <atk_box_struct* >::iterator it = v_widget_.begin ();
it != v_widget_.end (); it++)
! (*it)->widget_->draw (this, sf);
! detach_drawing_area();
! return true;
! }
! return false;
}
***************
*** 293,294 ****
--- 297,310 ----
(*it)->widget_->update_position ();
}
+
+
+ int atk_box::input_update (input_event * ev)
+ {
+ int i =0;
+ int ret = 0;
+ while ( i < v_widget_.size() && ret == 0)
+ ret = v_widget_[i++]->widget_->input_update(ev);
+ return ret;
+ }
+
+
Index: atk_box.h
===================================================================
RCS file: /cvsroot/adonthell/adonthell/src/Attic/atk_box.h,v
retrieving revision 1.1.2.4
retrieving revision 1.1.2.5
diff -C2 -r1.1.2.4 -r1.1.2.5
*** atk_box.h 5 Apr 2002 19:59:19 -0000 1.1.2.4
--- atk_box.h 28 Jun 2002 09:17:03 -0000 1.1.2.5
***************
*** 27,30 ****
--- 27,31 ----
#include <deque>
+ #include "input_event.h"
#include "atk_widget.h"
#include "atk_container.h"
***************
*** 107,111 ****
/**draw the widget
*/
! virtual void draw (drawing_area * da = NULL, surface * sf = NULL);
--- 108,112 ----
/**draw the widget
*/
! virtual bool draw (drawing_area * da = NULL, surface * sf = NULL);
***************
*** 121,124 ****
--- 122,132 ----
void update_position ();
+
+ /**
+ * input update function
+ * @return 1 if this object use the event, else return 0
+ */
+ virtual int input_update (input_event *);
+
~atk_box ();
Index: atk_container.cc
===================================================================
RCS file: /cvsroot/adonthell/adonthell/src/Attic/atk_container.cc,v
retrieving revision 1.1.2.3
retrieving revision 1.1.2.4
diff -C2 -r1.1.2.3 -r1.1.2.4
*** atk_container.cc 5 Apr 2002 19:59:19 -0000 1.1.2.3
--- atk_container.cc 28 Jun 2002 09:17:03 -0000 1.1.2.4
***************
*** 13,23 ****
*/
! #include "atk_border.h"
#include "atk_container.h"
! atk_container::atk_container () : border_width_ (5)
! {
! border_ = new atk_border (this);
}
--- 13,22 ----
*/
! #include "atk_border_ui.h"
#include "atk_container.h"
! atk_container::atk_container () : border_width_ (5), object_ui_ (NULL)
! {
}
***************
*** 31,35 ****
u_int16 atk_container::get_border_width () const
{
! return border_width_;
}
--- 30,34 ----
u_int16 atk_container::get_border_width () const
{
! return border_width_;
}
***************
*** 38,46 ****
atk_container::~atk_container ()
{
! delete border_;
}
--- 37,82 ----
atk_container::~atk_container ()
{
! if (object_ui_) delete object_ui_;
}
+ void atk_container::set_border_ui (atk_border_template * bd_tmp)
+ {
+ if ( object_ui_) delete object_ui_;
+ object_ui_ = new atk_border_ui (this);
+ ((atk_border_ui*)object_ui_)->set_border (bd_tmp);
+ }
+
+ bool atk_container::draw (drawing_area * da = NULL, surface * sf = NULL)
+ {
+ if (atk_widget::draw (da, sf) )
+ {
+ assign_drawing_area (da);
+ if (object_ui_) object_ui_->draw(da, sf);
+ detach_drawing_area ();
+ return true;
+ }
+ return false;
+ }
+
+ void atk_container::set_size (s_int32 length, s_int32 height)
+ {
+ atk_widget::set_size (length, height);
+ if (object_ui_) object_ui_->resize();
+ }
+
+ void atk_container::update_position ()
+ {
+ atk_widget::update_position();
+ if (object_ui_) object_ui_->move();
+ }
+
+
+ void atk_container::realize()
+ {
+ atk_widget::realize();
+ if (object_ui_) object_ui_->resize ();
+ }
Index: atk_container.h
===================================================================
RCS file: /cvsroot/adonthell/adonthell/src/Attic/atk_container.h,v
retrieving revision 1.1.2.4
retrieving revision 1.1.2.5
diff -C2 -r1.1.2.4 -r1.1.2.5
*** atk_container.h 5 Apr 2002 19:59:19 -0000 1.1.2.4
--- atk_container.h 28 Jun 2002 09:17:03 -0000 1.1.2.5
***************
*** 31,36 ****
#include "callback_sig.h"
#include "atk_widget.h"
! class atk_border;
/** It's an abstract class, it's can contains lots of widget, there are some
method, add, remove a container...
--- 31,37 ----
#include "callback_sig.h"
#include "atk_widget.h"
+ #include "atk_object_ui.h"
! class atk_border_template;
/** It's an abstract class, it's can contains lots of widget, there are some
method, add, remove a container...
***************
*** 79,87 ****
--- 80,121 ----
virtual void clear () = 0;
+
+ /**
+ * draw the container
+ */
+ virtual bool draw (drawing_area * da = NULL, surface * sf = NULL);
+
+ /**
+ * Destructor
+ */
virtual ~atk_container ();
+
+ /**
+ * Set the border for this container
+ * @param bd_tmp : the border template use to display border
+ */
+ void set_border_ui (atk_border_template * bd_tmp);
+
+
+ /** set the minimum size of a widget
+ * @param length
+ * @param height
+ */
+ virtual void set_size (s_int32 length, s_int32 height);
+
+ /**
+ * update position
+ */
+ virtual void update_position();
+
+ /**
+ * it's used to build the widget.
+ */
+ virtual void realize ();
+
/* call back */
callback_sig on_add;
***************
*** 96,105 ****
/* the border used by this container */
! atk_border * border_;
!
private :
-
-
};
--- 130,138 ----
/* the border used by this container */
! //atk_border_ui * border_;
! atk_object_ui * object_ui_;
!
private :
};
Index: atk_fixed.cc
===================================================================
RCS file: /cvsroot/adonthell/adonthell/src/Attic/atk_fixed.cc,v
retrieving revision 1.1.2.1
retrieving revision 1.1.2.2
diff -C2 -r1.1.2.1 -r1.1.2.2
*** atk_fixed.cc 1 Mar 2002 21:50:32 -0000 1.1.2.1
--- atk_fixed.cc 28 Jun 2002 09:17:03 -0000 1.1.2.2
***************
*** 58,61 ****
--- 58,62 ----
void atk_fixed::realize ()
{
+ atk_container::realize();
}
***************
*** 68,79 ****
! void atk_fixed::draw (drawing_area * da = NULL, surface * sf = NULL)
! {
! if (!is_visible ()) return;
!
! atk_widget::draw (da, sf);
!
! for (std::vector <atk_widget* >::iterator it = v_widget_.begin (); it !=
v_widget_.end (); it++)
! (*it)->draw (da, sf);
}
--- 69,83 ----
! bool atk_fixed::draw (drawing_area * da = NULL, surface * sf = NULL)
! {
! if (atk_container::draw (da, sf))
! {
! assign_drawing_area (da);
! for (std::vector <atk_widget* >::iterator it = v_widget_.begin (); it
!= v_widget_.end (); it++)
! (*it)->draw (this, sf);
! detach_drawing_area();
! return true;
! }
! return false;
}
Index: atk_fixed.h
===================================================================
RCS file: /cvsroot/adonthell/adonthell/src/Attic/atk_fixed.h,v
retrieving revision 1.1.2.1
retrieving revision 1.1.2.2
diff -C2 -r1.1.2.1 -r1.1.2.2
*** atk_fixed.h 1 Mar 2002 21:50:32 -0000 1.1.2.1
--- atk_fixed.h 28 Jun 2002 09:17:03 -0000 1.1.2.2
***************
*** 70,77 ****
/**draw the widget
*/
! virtual void draw (drawing_area * da = NULL, surface * sf = NULL);
!
!
~atk_fixed ();
--- 70,78 ----
/**draw the widget
*/
! virtual bool draw (drawing_area * da = NULL, surface * sf = NULL);
+ /**
+ * destructor
+ */
~atk_fixed ();
Index: atk_font.cc
===================================================================
RCS file: /cvsroot/adonthell/adonthell/src/Attic/atk_font.cc,v
retrieving revision 1.1.2.3
retrieving revision 1.1.2.4
diff -C2 -r1.1.2.3 -r1.1.2.4
*** atk_font.cc 26 Feb 2002 12:44:47 -0000 1.1.2.3
--- atk_font.cc 28 Jun 2002 09:17:03 -0000 1.1.2.4
***************
*** 173,179 ****
}
! void atk_font::draw (const std::string & text, s_int32 x, s_int32 y, surface
* target = NULL)
{
s_int32 tmp_x = x;
for (u_int32 i = 0; i < text.length (); i++)
{
--- 173,180 ----
}
! void atk_font::draw (const std::string & text, s_int32 x, s_int32 y,
drawing_area * da = NULL, surface * target = NULL)
{
s_int32 tmp_x = x;
+ y+= size;
for (u_int32 i = 0; i < text.length (); i++)
{
***************
*** 182,186 ****
if (text[i] != '\n')
{
! chars[text[i]].picture->draw (tmp_x + chars[text[i]].left , y
- chars[text[i]].top, NULL, target );
tmp_x += chars[text[i]].advance_x;
}
--- 183,187 ----
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;
}
Index: atk_font.h
===================================================================
RCS file: /cvsroot/adonthell/adonthell/src/Attic/atk_font.h,v
retrieving revision 1.1.2.2
retrieving revision 1.1.2.3
diff -C2 -r1.1.2.2 -r1.1.2.3
*** atk_font.h 26 Feb 2002 12:44:47 -0000 1.1.2.2
--- atk_font.h 28 Jun 2002 09:17:03 -0000 1.1.2.3
***************
*** 31,34 ****
--- 31,35 ----
#include FT_FREETYPE_H
#include "types.h"
+ #include "drawing_area.h"
#include "surface.h"
#include "image.h"
***************
*** 121,125 ****
* @param target : draw on target, if not target, draw on the screen
*/
! void draw (const std::string & text, s_int32 x, s_int32 y, surface *
target = NULL);
--- 122,126 ----
* @param target : draw on target, if not target, draw on the screen
*/
! void draw (const std::string & text, s_int32 x, s_int32 y,drawing_area *
da, surface * target = NULL);
Index: atk_label.cc
===================================================================
RCS file: /cvsroot/adonthell/adonthell/src/Attic/atk_label.cc,v
retrieving revision 1.1.2.1
retrieving revision 1.1.2.2
diff -C2 -r1.1.2.1 -r1.1.2.2
*** atk_label.cc 25 Feb 2002 10:14:51 -0000 1.1.2.1
--- atk_label.cc 28 Jun 2002 09:17:03 -0000 1.1.2.2
***************
*** 101,114 ****
! void atk_label::draw (surface * target = NULL)
{
! if (!font_) return;
! s_int32 y_to_start;
! s_int32 x_to_start;
!
! // check y position to start draw
! if (get_y_alignment () == TOP) y_to_start = get_y_real () + get_y_padding
();
! else if (get_y_alignment () == BOTTOM) y_to_start = get_y_real () +
get_height () - (font_->get_size () * (line_.size ())) - get_y_padding ();
else y_to_start = get_y_real () + (get_height () - (font_->get_size () *
(line_.size ()))) >> 1;
--- 101,115 ----
! bool atk_label::draw (drawing_area * da = NULL, surface * sf = NULL)
{
! if (!atk_misc::draw (da, sf)) return false;
! if (!font_) return false;
! s_int32 y_to_start;
! s_int32 x_to_start;
!
! // check y position to start draw
! if (get_y_alignment () == TOP) y_to_start = get_y_real () + get_y_padding
();
! else if (get_y_alignment () == BOTTOM) y_to_start = get_y_real () +
get_height () - (font_->get_size () * (line_.size ())) - get_y_padding ();
else y_to_start = get_y_real () + (get_height () - (font_->get_size () *
(line_.size ()))) >> 1;
***************
*** 121,129 ****
// draw each line
! font_->draw (line_[i], x_to_start, y_to_start, target);
// go to next line
y_to_start += font_->get_size ();
}
}
--- 122,131 ----
// draw each line
! font_->draw (line_[i], x_to_start, y_to_start, da, sf);
// go to next line
y_to_start += font_->get_size ();
}
+ return true;
}
Index: atk_label.h
===================================================================
RCS file: /cvsroot/adonthell/adonthell/src/Attic/atk_label.h,v
retrieving revision 1.1.2.1
retrieving revision 1.1.2.2
diff -C2 -r1.1.2.1 -r1.1.2.2
*** atk_label.h 25 Feb 2002 10:14:51 -0000 1.1.2.1
--- atk_label.h 28 Jun 2002 09:17:03 -0000 1.1.2.2
***************
*** 74,82 ****
! /**Draw the label
! * @param the target where draw the label, if null draw on the screen
*/
! void draw (surface * target = NULL);
!
protected :
--- 74,82 ----
! /**
! * draw the label
*/
! virtual bool draw (drawing_area * da = NULL, surface * sf = NULL);
!
protected :
Index: atk_widget.cc
===================================================================
RCS file: /cvsroot/adonthell/adonthell/src/Attic/atk_widget.cc,v
retrieving revision 1.1.2.4
retrieving revision 1.1.2.5
diff -C2 -r1.1.2.4 -r1.1.2.5
*** atk_widget.cc 5 Apr 2002 19:59:19 -0000 1.1.2.4
--- atk_widget.cc 28 Jun 2002 09:17:03 -0000 1.1.2.5
***************
*** 68,75 ****
! void atk_widget::set_size (u_int32 length, u_int32 height)
{
! if (get_length () == length && get_height () == height) return;
! resize (length, height);
}
--- 68,87 ----
! void atk_widget::set_size (s_int32 length, s_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);
}
***************
*** 168,181 ****
! void atk_widget::draw (drawing_area * da = NULL, surface * sf = NULL)
{
! /*need to change this;) */
!
! /* draw box */
! screen::display.draw_line (get_x_real (), get_y_real (),get_x_real () +
get_length (),get_y_real (), 0xFFFFFF);
! screen::display.draw_line (get_x_real (), get_y_real () + get_height ()
,get_x_real () + get_length (),get_y_real () + get_height (), 0xFFFFFF);
!
! screen::display.draw_line (get_x_real (), get_y_real (),get_x_real
(),get_y_real ()+ get_height (), 0xFFFFFF);
! screen::display.draw_line (get_x_real () + get_length (), get_y_real
(),get_x_real () + get_length (),get_y_real () + get_height (), 0xFFFFFF);
}
--- 180,186 ----
! bool atk_widget::draw (drawing_area * da = NULL, surface * sf = NULL)
{
! return visible_;
}
***************
*** 183,187 ****
int atk_widget::input_update (input_event * ev)
{
! return 0;
}
--- 188,192 ----
int atk_widget::input_update (input_event * ev)
{
! return 0;
}
Index: atk_widget.h
===================================================================
RCS file: /cvsroot/adonthell/adonthell/src/Attic/atk_widget.h,v
retrieving revision 1.1.2.5
retrieving revision 1.1.2.6
diff -C2 -r1.1.2.5 -r1.1.2.6
*** atk_widget.h 5 Apr 2002 19:59:19 -0000 1.1.2.5
--- atk_widget.h 28 Jun 2002 09:17:03 -0000 1.1.2.6
***************
*** 50,55 ****
*/
virtual void realize () // = 0;
! {
! }
/** Set the parent of this widget. A widget can have only one parent
--- 50,54 ----
*/
virtual void realize () // = 0;
! {}
/** Set the parent of this widget. A widget can have only one parent
***************
*** 67,71 ****
* draw the widget
*/
! virtual void draw (drawing_area * da = NULL, surface * sf = NULL);
--- 66,70 ----
* draw the widget
*/
! virtual bool draw (drawing_area * da = NULL, surface * sf = NULL);
***************
*** 112,116 ****
* @param height
*/
! virtual void set_size (u_int32 length, u_int32 height);
--- 111,115 ----
* @param height
*/
! virtual void set_size (s_int32 length, s_int32 height);
***************
*** 220,224 ****
-
/*define event */
callback_sig on_show;
--- 219,222 ----
Index: atk_window.cc
===================================================================
RCS file: /cvsroot/adonthell/adonthell/src/Attic/atk_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
*** atk_window.cc 5 Apr 2002 19:59:19 -0000 1.1.2.1
--- atk_window.cc 28 Jun 2002 09:17:03 -0000 1.1.2.2
***************
*** 15,19 ****
#include "mouse_event.h"
! #include "atk_border.h"
#include "atk_window.h"
--- 15,19 ----
#include "mouse_event.h"
! #include "atk_border_ui.h"
#include "atk_window.h"
***************
*** 65,158 ****
int atk_window::input_update (input_event * ev)
{
! if (!is_sensible () ) return 0;
!
mouse_event * me = (mouse_event *) ev;
!
! // check mouse action
if (mouse_action_ == ACTION_MOVE)
! {
! if (me->type () == mouse_event::MOUSE_MOTION)
! {
! set_position (me->x () - mouse_range_x_, me->y () -
mouse_range_y_);
! return 1;
! }
! else if (me->type () == mouse_event::BUTTON_RELEASED)
! {
! cout << "Button Release Move\n";
! mouse_action_ = ACTION_NONE;
! return 1;
! }
! }
if (mouse_action_ == ACTION_RESIZE)
! {
if (me->type () == mouse_event::MOUSE_MOTION)
! {
! set_size (me->x () - get_x_real () , me->y () - get_y_real ()
);
! return 1;
! }
else if (me->type () == mouse_event::BUTTON_RELEASED)
! {
! cout << "Button Release Resize\n";
! mouse_action_ = ACTION_NONE;
return 1;
! }
! }
!
!
! if (point_belong (me->x (), me->y ()))
! {
!
! return 0;
! }
else
! {
! // maybe the mouse cursor is on border
if (deleted_)
! {
! // WARNING ADD CHECK ON BORDER
! if (me->type () == mouse_event::BUTTON_RELEASED &&
! me->x () >= get_x_real () + get_length () - 10 && me->x ()
<= get_x_real () + get_length () &&
! me->y () >= get_y_real () - 10 && me->y () <= get_y_real ()
! )
! {
! on_delete ();
! return 1;
! }
! }
if (moveable_)
! {
! if (mouse_action_ == ACTION_NONE && me->type () ==
mouse_event::BUTTON_PUSHED &&
! me->x () >= get_x_real () && me->x () < get_x_real () +
get_length () - 10 &&
! me->y () >= get_y_real () - 10 && me->y () <= get_y_real ()
! )
! {
! cout << "Button Pushed Move\n";
! 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 () ==
mouse_event::BUTTON_PUSHED &&
! me->x () >= get_x_real () + get_length () - 10 && me->x () <
get_x_real () + get_length () &&
! me->y () >= get_y_real () + get_height () && me->y () <=
get_y_real () + get_height () + 5
! )
! {
! cout << "Button Pushed Resize\n";
! mouse_action_ = ACTION_RESIZE;
return 1;
! }
! }
! }
return 0;
}
--- 65,142 ----
int atk_window::input_update (input_event * ev)
{
! if (!is_sensible () ) return 0;
!
! if (atk_bin::input_update (ev) == 1) return 1;
!
mouse_event * me = (mouse_event *) ev;
!
! /* we check if there is already a mouse actio in progress */
if (mouse_action_ == ACTION_MOVE)
! {
! if (me->type () == mouse_event::MOUSE_MOTION)
! {
! set_position (me->x () - mouse_range_x_, me->y () -
mouse_range_y_);
! return 1;
! }
! else if (me->type () == mouse_event::BUTTON_RELEASED)
! {
! mouse_action_ = ACTION_NONE;
! return 1;
! }
! }
if (mouse_action_ == ACTION_RESIZE)
! {
if (me->type () == mouse_event::MOUSE_MOTION)
! {
! set_size (me->x () - get_x_real () , me->y () - get_y_real () );
! return 1;
! }
else if (me->type () == 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 () ==
mouse_event::BUTTON_PUSHED
! && object_ui_ && ((atk_border_ui*)object_ui_)->is_in_ctr
(me->x(), me->y()))
! {
! on_delete ();
! return 1;
! }
! }
if (moveable_)
! {
! if (mouse_action_ == ACTION_NONE && me->type () ==
mouse_event::BUTTON_PUSHED &&
! object_ui_ && ((atk_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 () ==
mouse_event::BUTTON_PUSHED &&
! object_ui_ && ((atk_border_ui*)object_ui_)->is_in_cbr
(me->x(), me->y ()))
! {
! mouse_action_ = ACTION_RESIZE;
return 1;
! }
! }
! }
return 0;
}
***************
*** 200,253 ****
bool atk_window::is_moveable () const
{
! return moveable_;
}
- void atk_window::draw (drawing_area * da = NULL, surface * sf = NULL)
- {
- /* first draw the background */
-
-
- /* draw the border */
- //WARNING must be move in atk_border or atk_border_template
- if (border_->get_template () == NULL)
- {
- /* top */
- screen::display.draw_line (get_x_real (), get_y_real () - 10
,get_x_real () + get_length (),get_y_real () - 10, 0x000000);
- screen::display.draw_line (get_x_real (), get_y_real (),get_x_real ()
+ get_length (),get_y_real (), 0x000000);
-
- /* bottom */
- screen::display.draw_line (get_x_real (), get_y_real () + get_height
() ,get_x_real () + get_length (),get_y_real () + get_height (), 0x000000);
- screen::display.draw_line (get_x_real (), get_y_real () + get_height
() + 5,get_x_real () + get_length (),get_y_real () + get_height () + 5,
0x000000);
-
- /* left */
- screen::display.draw_line (get_x_real (), get_y_real () - 10
,get_x_real (),get_y_real ()+ get_height () + 5, 0x000000);
-
- /* right */
- screen::display.draw_line (get_x_real () + get_length (), get_y_real
() - 10 ,get_x_real () + get_length (),get_y_real () + get_height () + 5,
0x000000);
-
-
- if (deleted_)
- screen::display.draw_line (get_x_real () + get_length () - 10,
get_y_real () - 10 ,get_x_real () + get_length () - 10,get_y_real (),
0x000000);
-
- if (resizeable_)
- {
- /* last line */
-
-
- /* left */
- screen::display.draw_line (get_x_real () + 10, get_y_real () +
get_height (),get_x_real () + 10,get_y_real () + get_height () + 5, 0x000000);
- /* right */
- screen::display.draw_line (get_x_real () + get_length () - 10,
get_y_real () + get_height (),get_x_real () + get_length () - 10,get_y_real ()
+ get_height () + 5, 0x000000);
- }
- }
- else border_->draw (da, sf);
-
-
- /* draw the contain */
- if (child) child->draw (da, sf);
-
- }
--- 184,192 ----
bool atk_window::is_moveable () const
{
! return moveable_;
}
***************
*** 256,286 ****
void atk_window::realize ()
{
! if (!child) return;
!
! if (child->get_length () != get_length () || child->get_height () !=
get_height ())
{
! // WARNING maybe change and put this system in atk_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 ();
}
}
}
-
- void atk_window::set_size (u_int32 length, u_int32 height)
- {
- atk_container::set_size (length, height);
-
- if (child)
- {
- child->set_size (get_length () -(border_width_ << 1), get_height () -
(border_width_ << 1));
- child->realize ();
- }
- }
--- 195,215 ----
void atk_window::realize ()
{
! atk_bin::realize();
! if (!child) return;
!
! if (child->get_length () != get_length () || child->get_height () !=
get_height ())
{
! // WARNING maybe change and put this system in atk_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 ();
}
}
}
Index: atk_window.h
===================================================================
RCS file: /cvsroot/adonthell/adonthell/src/Attic/atk_window.h,v
retrieving revision 1.1.2.2
retrieving revision 1.1.2.3
diff -C2 -r1.1.2.2 -r1.1.2.3
*** atk_window.h 5 Apr 2002 19:59:19 -0000 1.1.2.2
--- atk_window.h 28 Jun 2002 09:17:03 -0000 1.1.2.3
***************
*** 81,85 ****
void set_deleted (const bool);
-
/**
--- 81,84 ----
***************
*** 89,93 ****
-
/**
* set moveable with mouse
--- 88,91 ----
***************
*** 96,100 ****
void set_moveable (const bool);
-
/**
--- 94,97 ----
***************
*** 104,108 ****
-
/**
* set resizeable with mouse
--- 101,104 ----
***************
*** 111,116 ****
void set_resizeable (const bool);
!
!
/**
* @return if this window can be resized with mouse
--- 107,111 ----
void set_resizeable (const bool);
!
/**
* @return if this window can be resized with mouse
***************
*** 119,123 ****
-
/**
* input update function
--- 114,117 ----
***************
*** 133,142 ****
- /**
- * draw the window
- */
- void draw (drawing_area * da = NULL, surface * sf = NULL);
-
-
/**
* update the widget
--- 127,130 ----
***************
*** 150,161 ****
*/
void realize ();
!
!
! /** set size of the window
! * @param length
! * @param height
! */
! virtual void set_size (u_int32 length, u_int32 height);
!
/* type of the window, use for decoration */
--- 138,142 ----
*/
void realize ();
!
/* type of the window, use for decoration */
Index: joltest.cc
===================================================================
RCS file: /cvsroot/adonthell/adonthell/src/Attic/joltest.cc,v
retrieving revision 1.1.2.8
retrieving revision 1.1.2.9
diff -C2 -r1.1.2.8 -r1.1.2.9
*** joltest.cc 3 May 2002 11:42:53 -0000 1.1.2.8
--- joltest.cc 28 Jun 2002 09:17:03 -0000 1.1.2.9
***************
*** 11,16 ****
--- 11,19 ----
#include "atk_manager.h"
#include "atk_window.h"
+ #include "atk_button_template.h"
#include "atk_border_template.h"
+ #include "atk_background_template.h"
#include "atk_theme.h"
+ #include "atk_button.h"
#include "gametime.h"
***************
*** 22,36 ****
screen::set_video_mode (640, 480, 16);
screen::clear ();
! /*
atk_manager manager;
atk_window * wnd = new atk_window;
wnd->set_visible (true);
wnd->set_position (20, 40);
wnd->set_size (350, 200);
wnd->on_delete.connect (new callback_slot (makeFunctor (manager,
&atk_manager::shutdown)));
--- 25,102 ----
screen::set_video_mode (640, 480, 16);
screen::clear ();
!
! if (argc != 2)
! {
! std::cout << "Please need TTF font as argument\n";
! exit (1);
! }
!
! /**
! * Font
! */
! atk_font font;
! if (!font.load (argv[1]))
! {
! std::cout << "Error in loading font ...\n";
! exit (1);
! }
! font.set_size (12);
! font.build ();
!
!
! atk_theme theme;
! theme.load ("adontest/original.theme");
atk_manager manager;
+
+ /**
+ CREATE BUTTON
+ */
+ atk_border_template * bd_press = new atk_border_template;
+ bd_press->set_name ("pressed");
+ bd_press->set (atk_border_template::B_TOP,
"widgets/button_pressed_top.pnm");
+ bd_press->set (atk_border_template::B_RIGHT,
"widgets/button_pressed_right.pnm");
+ bd_press->set (atk_border_template::B_LEFT,
"widgets/button_pressed_left.pnm");
+ bd_press->set (atk_border_template::B_BOTTOM,
"widgets/button_pressed_bot.pnm");
+ bd_press->set (atk_border_template::C_TL,
"widgets/button_pressed_tl.pnm");
+ bd_press->set (atk_border_template::C_TR,
"widgets/button_pressed_tr.pnm");
+ bd_press->set (atk_border_template::C_BL,
"widgets/button_pressed_bl.pnm");
+ bd_press->set (atk_border_template::C_BR,
"widgets/button_pressed_br.pnm");
+ bd_press->build();
+
+ atk_border_template * bd_released = new atk_border_template;
+ bd_released->set_name ("released");
+ bd_released->set (atk_border_template::B_TOP, "widgets/button_top.pnm");
+ bd_released->set (atk_border_template::B_RIGHT,
"widgets/button_right.pnm");
+ bd_released->set (atk_border_template::B_LEFT, "widgets/button_left.pnm");
+ bd_released->set (atk_border_template::B_BOTTOM,
"widgets/button_bot.pnm");
+ bd_released->set (atk_border_template::C_TL, "widgets/button_tl.pnm");
+ bd_released->set (atk_border_template::C_TR, "widgets/button_tr.pnm");
+ bd_released->set (atk_border_template::C_BL, "widgets/button_bl.pnm");
+ bd_released->set (atk_border_template::C_BR, "widgets/button_br.pnm");
+ bd_released->build();
+
+
+
+ atk_background_template * ba_tmp = new atk_background_template();
+ ba_tmp->set_color (192, 165, 57);
+
+ atk_button_template bt_tmp;
+ bt_tmp.set_released (bd_released);
+ bt_tmp.set_pressed (bd_press);
+ bt_tmp.set_background (ba_tmp);
+
+
atk_window * wnd = new atk_window;
+
wnd->set_visible (true);
wnd->set_position (20, 40);
wnd->set_size (350, 200);
wnd->on_delete.connect (new callback_slot (makeFunctor (manager,
&atk_manager::shutdown)));
+ wnd->set_border_ui (theme.get_border("normal"));
+
***************
*** 42,49 ****
box->set_position (50, 50);
box->set_geometry (atk_box::VERTICAL);
!
atk_widget * wid;
!
wid = new atk_widget;
wid->set_size (30, 50);
--- 108,115 ----
box->set_position (50, 50);
box->set_geometry (atk_box::VERTICAL);
! box->set_border_ui (theme.get_border("mini"));
atk_widget * wid;
!
wid = new atk_widget;
wid->set_size (30, 50);
***************
*** 53,62 ****
! wid = new atk_widget;
wid->set_size (30, 20);
wid->set_visible (true);
wid->realize ();
box->add_start (wid, true, true, 0);
!
wid = new atk_widget;
wid->set_size (10, 50);
--- 119,137 ----
! /*wid = new atk_widget;
wid->set_size (30, 20);
wid->set_visible (true);
wid->realize ();
box->add_start (wid, true, true, 0);
! */
! atk_button * but;
! but = new atk_button;
! but->set_size (30, 20);
! but->set_visible (true);
! but->realize ();
! but->set_button_ui ( &bt_tmp);
! but->set_text ("Quit ", &font);
! box->add_start (but, true, true, 0);
!
wid = new atk_widget;
wid->set_size (10, 50);
***************
*** 66,71 ****
box->realize ();
!
!
wnd->add (box);
--- 141,145 ----
box->realize ();
!
wnd->add (box);
***************
*** 77,186 ****
while (manager.update () )
! {
! input_manager::update();
!
! gametime::update ();
! screen::display.fillrect (0, 0, 640, 480, 127, 127, 127);
! manager.draw ();
! screen::show ();
! screen::clear ();
! }
input_manager::cleanup();
- */
-
- /*
- atk_font font;
- if (!font.load (argv[1])) exit (1);
-
- font.info ();
-
- font.set_size (80);
- font.set_color (0, 0, 0);
- font.build ();
- font.draw ("Adonthell Power !!!", 40, 70);
-
-
- font.set_size (26);
- font.set_color (45, 167, 100);
- font.build ();
- font.draw ("It's working ...", 200, 120);
-
- font.set_size (20);
- font.set_color (145, 200, 45);
- font.build ();
- font.draw ("Kay,\n Ben,\n Alex,\n James\n I know ...", 140,
200);
-
-
- font.set_size (36);
- font.set_color (239, 16, 53);
- font.build ();
- font.draw ("I'm Fired !!!;=) ", 170, 320);
-
- font.set_size (16);
- font.set_color (200, 200, 200);
- font.build ();
- font.draw (", ? ; . : / ! § % ù $ £ ¤ ^ } { # ~ @ µ * - + & ' < > ",
10,350 );
- */
-
-
-
-
-
- /*
- atk_box * box = new atk_box;
-
- atk_fixed * fixed = new atk_fixed;
-
- fixed->set_size (100, 100);
- fixed->set_position (300, 300);
- fixed->set_visible(true);
- fixed->draw ();
-
- box->set_border_width (10);
- box->set_spacing (3);
- box->set_visible (true);
- box->set_size (200, 60);
- box->set_position (50, 50);
- box->set_geometry (atk_box::VERTICAL);
-
- atk_widget * wid;
-
- wid = new atk_widget;
- wid->set_size (30, 50);
- wid->set_visible (true);
- wid->realize ();
- box->add_start (wid, true, true, 0);
-
- wid = new atk_widget;
- wid->set_size (30, 20);
- wid->set_visible (true);
- wid->realize ();
- box->add_start (wid, true, true, 0);
-
- wid = new atk_widget;
- wid->set_size (10, 50);
- wid->set_visible (true);
- wid->realize ();
- box->add_end (wid, true, true, 15) ;
-
-
- box->realize ();
- box->draw ();
-
-
- screen::show ();
-
-
-
- delete box;
- */
-
/**
* SAVE A THEME
--- 151,171 ----
while (manager.update () )
! {
! input_manager::update();
!
! gametime::update ();
! screen::display.fillrect (0, 0, 640, 480, 127, 127, 127);
! manager.draw ();
! screen::show ();
! screen::clear ();
! }
input_manager::cleanup();
/**
* SAVE A THEME
***************
*** 219,222 ****
--- 204,208 ----
theme.add_border (border);
+
theme.save ("adontest/silverleaf.theme");
***************
*** 229,233 ****
* load a theme
**/
!
atk_theme theme;
--- 215,219 ----
* load a theme
**/
! /*
atk_theme theme;
***************
*** 239,245 ****
theme.load ("adontest/silverleaf.theme");
theme.display_info ();
!
return 0;
}
--- 225,232 ----
theme.load ("adontest/silverleaf.theme");
theme.display_info ();
! */
return 0;
+
}
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- [Adonthell-commits] CVS: adonthell/src atk_background_template.cc,NONE,1.1.2.1 atk_background_ui.cc,NONE,1.1.2.1 atk_background_ui.h,NONE,1.1.2.1 atk_button.cc,NONE,1.1.2.1 atk_button.h,NONE,1.1.2.1 atk_button_template.cc,NONE,1.1.2.1 atk_button_template.h,NONE,1.1.2.1 atk_button_ui.cc,NONE,1.1.2.1 atk_button_ui.h,NONE,1.1.2.1 atk_object_ui.h,NONE,1.1.2.1 Makefile.am,1.80.2.30,1.80.2.31 atk_bin.cc,1.1.2.2,1.1.2.3 atk_bin.h,1.1.2.2,1.1.2.3 atk_border_template.cc,1.1.2.2,1.1.2.3 atk_border_template.h,1.1.2.2,1.1.2.3 atk_box.cc,1.1.2.4,1.1.2.5 atk_box.h,1.1.2.4,1.1.2.5 atk_container.cc,1.1.2.3,1.1.2.4 atk_container.h,1.1.2.4,1.1.2.5 atk_fixed.cc,1.1.2.1,1.1.2.2 atk_fixed.h,1.1.2.1,1.1.2.2 atk_font.cc,1.1.2.3,1.1.2.4 atk_font.h,1.1.2.2,1.1.2.3 atk_label.cc,1.1.2.1,1.1.2.2 atk_label.h,1.1.2.1,1.1.2.2 atk_widget.cc,1.1.2.4,1.1.2.5 atk_widget.h,1.1.2.5,1.1.2.6 atk_window.cc,1.1.2.1,1.1.2.2 atk_window.h,1.1.2.2,1.1.2.3 joltest.cc,1.1.2.8,1.1.2.9,
VENNIN Joel <address@hidden> <=
- Prev by Date:
[Adonthell-commits] CVS: adonthell/doc/dlgedit dlgedit.cfg,1.3,1.4 dlgedit.dxt,1.5,1.6 dlgedit.sty,1.3,1.4 dlgedit.tex,1.3,1.4 footer.html,1.1,1.2 step4.eps,1.1,1.2 step4.png,1.1,1.2
- Next by Date:
[Adonthell-commits] CVS: adonthell/src atk_background_template.h,NONE,1.1.2.1 atk_border_ui.cc,NONE,1.1.2.1 atk_border_ui.h,NONE,1.1.2.1
- Previous by thread:
[Adonthell-commits] CVS: adonthell/doc/dlgedit dlgedit.cfg,1.3,1.4 dlgedit.dxt,1.5,1.6 dlgedit.sty,1.3,1.4 dlgedit.tex,1.3,1.4 footer.html,1.1,1.2 step4.eps,1.1,1.2 step4.png,1.1,1.2
- Next by thread:
[Adonthell-commits] CVS: adonthell/src atk_background_template.h,NONE,1.1.2.1 atk_border_ui.cc,NONE,1.1.2.1 atk_border_ui.h,NONE,1.1.2.1
- Index(es):