Author: matt
Date: 2011-05-30 12:09:38 -0700 (Mon, 30 May 2011)
New Revision: 8769
Log:
123: wrapped Fl_Window and Fl_Group
Modified:
branches/branch-3.0/FL/Fl_Group.H
branches/branch-3.0/FL/Fl_Window.H
branches/branch-3.0/fltk3/Group.h
branches/branch-3.0/fltk3/Window.h
Modified: branches/branch-3.0/FL/Fl_Group.H
===================================================================
--- branches/branch-3.0/FL/Fl_Group.H 2011-05-30 18:30:10 UTC (rev 8768)
+++ branches/branch-3.0/FL/Fl_Group.H 2011-05-30 19:09:38 UTC (rev 8769)
@@ -36,17 +36,31 @@
Fl_Group& operator=(const Fl_Group&); /* empty */
protected:
+
Fl_Group() { /* empty */ }
-#if 0 // FIXME: 123
- void draw();
- void draw_child(Fl_Widget& widget) const;
- void draw_children();
- void draw_outside_label(const Fl_Widget& widget) const ;
- void update_child(Fl_Widget& widget) const;
- int *sizes();
-#endif
+ FLTK3_WRAPPER_VCALLS_OBJECT(Group, draw(), draw(), Draw)
+ void draw_child(Fl_Widget& widget) const {
+ ((fltk3::Group*)_p)->draw_child(*(fltk3::_1to3_widget(&widget)));
+ }
+
+ void draw_children() {
+ ((fltk3::Group*)_p)->draw_children();
+ }
+
+ void draw_outside_label(const Fl_Widget& widget) const {
+
((fltk3::Group*)_p)->draw_outside_label(*(fltk3::_1to3_widget((Fl_Widget*)&widget)));
+ }
+
+ void update_child(Fl_Widget& widget) const {
+ ((fltk3::Group*)_p)->update_child(*(fltk3::_1to3_widget(&widget)));
+ }
+
+ int *sizes() {
+ return ((fltk3::Group*)_p)->sizes();
+ }
+
public:
Fl_Group(int x, int y, int w, int h, const char *label = 0) {
@@ -54,6 +68,14 @@
_p->wrapper(this);
}
+ FLTK3_WRAPPER_VCALLS_OBJECT(Group, resize(int x, int y, int w, int h),
resize(x, y, w, h), Resize)
+
+ FLTK3_WRAPPER_VCALLS_OBJECT(Group, hide(), hide(), Hide)
+
+ FLTK3_WRAPPER_VCALLS_OBJECT(Group, show(), show(), Show)
+
+ FLTK3_WRAPPER_VCALLS_OBJECT_INT(Group, handle(int event), handle(event),
Handle)
+
void begin() {
((fltk3::Group*)_p)->begin();
}
@@ -66,55 +88,107 @@
return fltk3::_3to1_group( fltk3::Group::current() );
}
-#if 0 // FIXME: 123
- int handle(int);
- static void current(Fl_Group *g);
- int children() const {return children_;}
- Fl_Widget* child(int n) const {return array()[n];}
- int find(const Fl_Widget*) const;
- int find(const Fl_Widget& o) const {return find(&o);}
- Fl_Widget* const* array() const;
- void resize(int,int,int,int);
- virtual ~Fl_Group();
- void add(Fl_Widget&);
- void add(Fl_Widget* o) {add(*o);}
- void insert(Fl_Widget&, int i);
- void insert(Fl_Widget& o, Fl_Widget* before) {insert(o,find(before));}
- void remove(int index);
- void remove(Fl_Widget&);
- void remove(Fl_Widget* o) {remove(*o);}
- void clear();
-#endif
+ static void current(Fl_Group *g) {
+ fltk3::Group::current(fltk3::_1to3_group(g));
+ }
+ int children() const {
+ return ((fltk3::Group*)_p)->children();
+ }
+
+ Fl_Widget* child(int n) const {
+ return fltk3::_3to1_widget( ((fltk3::Group*)_p)->child(n) );
+ }
+
+ int find(const Fl_Widget *w) const {
+ return ((fltk3::Group*)_p)->find(fltk3::_1to3_widget((Fl_Widget*)w));
+ }
+
+ int find(const Fl_Widget& o) const {
+ return ((fltk3::Group*)_p)->find(*(fltk3::_1to3_widget((Fl_Widget*)&o)));
+ }
+
+ // FIXME: 123 - can't traslate easily! Fl_Widget* const* array() const;
+
+ void add(Fl_Widget &o) {
+ ((fltk3::Group*)_p)->find(*(fltk3::_1to3_widget(&o)));
+ }
+
+ void add(Fl_Widget* o) {
+ ((fltk3::Group*)_p)->add(fltk3::_1to3_widget(o));
+ }
+
+ void insert(Fl_Widget &o, int i) {
+ ((fltk3::Group*)_p)->insert(*(fltk3::_1to3_widget(&o)), i);
+ }
+
+ void insert(Fl_Widget& o, Fl_Widget* before) {
+ ((fltk3::Group*)_p)->insert(*(fltk3::_1to3_widget(&o)),
fltk3::_1to3_widget((Fl_Widget*)before));
+ }
+
+ void remove(int index) {
+ ((fltk3::Group*)_p)->remove(index);
+ }
+
+ void remove(Fl_Widget &o) {
+ ((fltk3::Group*)_p)->remove(*(fltk3::_1to3_widget(&o)));
+ }
+
+ void remove(Fl_Widget* o) {
+ ((fltk3::Group*)_p)->remove(fltk3::_1to3_widget(o));
+ }
+
+ void clear() {
+ ((fltk3::Group*)_p)->clear();
+ }
+
void resizable(Fl_Widget& o) {
- ((fltk3::Group*)_p)->resizable((fltk3::Widget&)(*o._p));
+ ((fltk3::Group*)_p)->resizable(*(fltk3::_1to3_widget(&o)));
}
void resizable(Fl_Widget* o) {
- ((fltk3::Group*)_p)->resizable((fltk3::Widget*)(o->_p));
+ ((fltk3::Group*)_p)->resizable(fltk3::_1to3_widget(o));
}
Fl_Widget* resizable() const {
return fltk3::_3to1_widget(((fltk3::Group*)_p)->resizable());
}
-#if 0 // FIXME: 123
- void add_resizable(Fl_Widget& o) {resizable_ = &o; add(o);}
- void init_sizes();
- void clip_children(int c) { if (c) set_flag(CLIP_CHILDREN); else
clear_flag(CLIP_CHILDREN); }
- unsigned int clip_children() { return (flags() & CLIP_CHILDREN) != 0; }
+ void add_resizable(Fl_Widget& o) {
+ ((fltk3::Group*)_p)->add_resizable(*(fltk3::_1to3_widget(&o)));
+ }
+
+ void init_sizes() {
+ ((fltk3::Group*)_p)->init_sizes();
+ }
+
+ void clip_children(int c) {
+ ((fltk3::Group*)_p)->clip_children(c);
+ }
+
+ unsigned int clip_children() {
+ return ((fltk3::Group*)_p)->clip_children();
+ }
+
virtual Fl_Group* as_group() { return this; }
- void focus(Fl_Widget* W) {W->take_focus();}
- void forms_end();
-#endif
+ void focus(Fl_Widget* W) {
+ ((fltk3::Group*)_p)->remove(fltk3::_1to3_widget(W));
+ }
+
+ void forms_end() {
+ ((fltk3::Group*)_p)->forms_end();
+ }
+
};
+
class FL_EXPORT Fl_End {
public:
Fl_End() { Fl_Group::current()->end(); }
};
+
#endif
//
Modified: branches/branch-3.0/FL/Fl_Window.H
===================================================================
--- branches/branch-3.0/FL/Fl_Window.H 2011-05-30 18:30:10 UTC (rev 8768)
+++ branches/branch-3.0/FL/Fl_Window.H 2011-05-30 19:09:38 UTC (rev 8769)
@@ -43,16 +43,20 @@
Fl_Window(const Fl_Window&);
Fl_Window& operator=(const Fl_Window&);
-#if 0 // FIXME: 123
-
protected:
- virtual void draw();
- virtual void flush();
- void force_position(int force);
- int force_position() const { return ((flags() & FORCE_POSITION)?1:0); }
-#endif
+ void flush() {
+ ((fltk3::Window*)_p)->flush();
+ }
+ void force_position(int force) {
+ ((fltk3::Window*)_p)->force_position(force);
+ }
+
+ int force_position() const {
+ return ((fltk3::Window*)_p)->force_position();
+ }
+
public:
Fl_Window() {}
@@ -67,70 +71,193 @@
_p->wrapper(this);
}
-#if 0 // FIXME: 123
- virtual ~Fl_Window();
- virtual int handle(int);
- virtual void resize(int,int,int,int);
- void border(int b);
- void clear_border() {set_flag(NOBORDER);}
- unsigned int border() const {return !(flags() & NOBORDER);}
- void set_override() {set_flag(NOBORDER|OVERRIDE);}
- unsigned int override() const { return flags()&OVERRIDE; }
- void set_modal() {set_flag(MODAL);}
- unsigned int modal() const {return flags() & MODAL;}
- void set_non_modal() {set_flag(NON_MODAL);}
- unsigned int non_modal() const {return flags() & (NON_MODAL|MODAL);}
- void set_menu_window() {set_flag(MENU_WINDOW);}
- unsigned int menu_window() const {return flags() & MENU_WINDOW;}
- void set_tooltip_window();
- unsigned int tooltip_window() const {return flags() & TOOLTIP_WINDOW;}
- void hotspot(int x, int y, int offscreen = 0);
- void hotspot(const Fl_Widget*, int offscreen = 0);
- void hotspot(const Fl_Widget& p, int offscreen = 0) {hotspot(&p,offscreen);}
- void free_position() {clear_flag(FORCE_POSITION);}
- void size_range(int a, int b, int c=0, int d=0, int e=0, int f=0, int g=0);
- const char* label() const {return Fl_Widget::label();}
- const char* iconlabel() const {return iconlabel_;}
- void label(const char*);
- void iconlabel(const char*);
- void label(const char* label, const char* iconlabel); // platform dependent
- void copy_label(const char* a);
- static void default_xclass(const char*);
- static const char *default_xclass();
- const char* xclass() const;
- void xclass(const char* c);
- const void* icon() const;
- void icon(const void * ic);
- int shown() {return i != 0;}
- virtual void show();
- virtual void hide();
-#endif
+ FLTK3_WRAPPER_VCALLS_OBJECT(Window, resize(int x, int y, int w, int h),
resize(x, y, w, h), Resize)
+ FLTK3_WRAPPER_VCALLS_OBJECT(Window, hide(), hide(), Hide)
+
+ FLTK3_WRAPPER_VCALLS_OBJECT(Window, show(), show(), Show)
+
+ FLTK3_WRAPPER_VCALLS_OBJECT(Window, draw(), draw(), Draw)
+
+ FLTK3_WRAPPER_VCALLS_OBJECT_INT(Window, handle(int event), handle(event),
Handle)
+
+ void border(int b) {
+ ((fltk3::Window*)_p)->border(b);
+ }
+
+ void clear_border() {
+ ((fltk3::Window*)_p)->clear_border();
+ }
+
+ unsigned int border() const {
+ return ((fltk3::Window*)_p)->border();
+ }
+
+ void set_override() {
+ ((fltk3::Window*)_p)->set_override();
+ }
+
+ unsigned int override() const {
+ return ((fltk3::Window*)_p)->override();
+ }
+
+ void set_modal() {
+ ((fltk3::Window*)_p)->set_modal();
+ }
+
+ unsigned int modal() const {
+ return ((fltk3::Window*)_p)->modal();
+ }
+
+ void set_non_modal() {
+ ((fltk3::Window*)_p)->set_non_modal();
+ }
+
+ unsigned int non_modal() const {
+ return ((fltk3::Window*)_p)->non_modal();
+ }
+
+ void set_menu_window() {
+ ((fltk3::Window*)_p)->set_menu_window();
+ }
+
+ unsigned int menu_window() const {
+ return ((fltk3::Window*)_p)->menu_window();
+ }
+
+ void set_tooltip_window() {
+ ((fltk3::Window*)_p)->set_tooltip_window();
+ }
+
+ unsigned int tooltip_window() const {
+ return ((fltk3::Window*)_p)->tooltip_window();
+ }
+
+ void hotspot(int x, int y, int offscreen = 0) {
+ ((fltk3::Window*)_p)->hotspot(x, y, offscreen);
+ }
+
+ void hotspot(const Fl_Widget *w, int offscreen = 0) {
+ ((fltk3::Window*)_p)->hotspot(fltk3::_1to3_widget((Fl_Widget*)w),
offscreen);
+ }
+
+ void hotspot(const Fl_Widget& p, int offscreen = 0) {
+ ((fltk3::Window*)_p)->hotspot(*fltk3::_1to3_widget((Fl_Widget*)&p),
offscreen);
+ }
+
+ void free_position() {
+ ((fltk3::Window*)_p)->free_position();
+ }
+
+ void size_range(int a, int b, int c=0, int d=0, int e=0, int f=0, int g=0) {
+ ((fltk3::Window*)_p)->size_range(a, b, c, d, e, f, g);
+ }
+
+ const char* label() const {
+ return ((fltk3::Window*)_p)->label();
+ }
+
+ const char* iconlabel() const {
+ return ((fltk3::Window*)_p)->iconlabel();
+ }
+
+ void label(const char *t) {
+ ((fltk3::Window*)_p)->label(t);
+ }
+
+ void iconlabel(const char *t) {
+ ((fltk3::Window*)_p)->iconlabel(t);
+ }
+
+ void label(const char* a, const char* b) {
+ ((fltk3::Window*)_p)->label(a, b);
+ }
+
+ void copy_label(const char* a) {
+ ((fltk3::Window*)_p)->copy_label(a);
+ }
+
+ static void default_xclass(const char *c) {
+ fltk3::Window::default_xclass(c);
+ }
+
+ static const char *default_xclass() {
+ return fltk3::Window::default_xclass();
+ }
+
+ const char* xclass() const {
+ ((fltk3::Window*)_p)->xclass();
+ }
+
+ void xclass(const char* c) {
+ ((fltk3::Window*)_p)->xclass(c);
+ }
+
+ const void* icon() const {
+ return ((fltk3::Window*)_p)->icon();
+ }
+
+ void icon(const void * ic) {
+ ((fltk3::Window*)_p)->icon(ic);
+ }
+
+ int shown() {
+ return ((fltk3::Window*)_p)->shown();
+ }
+
void show(int argc, char **argv) {
((fltk3::Window*)_p)->show(argc, argv);
}
-#if 0 // FIXME: 123
- void fullscreen();
- void fullscreen_off(int,int,int,int);
- void iconize();
- int x_root() const ;
- int y_root() const ;
- static Fl_Window *current();
- void make_current();
+ void fullscreen() {
+ ((fltk3::Window*)_p)->fullscreen();
+ }
+
+ void fullscreen_off(int x, int y, int w, int h) {
+ ((fltk3::Window*)_p)->fullscreen_off(x, y, w, h);
+ }
+
+ void iconize() {
+ ((fltk3::Window*)_p)->iconize();
+ }
+
+ int x_root() const {
+ ((fltk3::Window*)_p)->y_root();
+ }
+
+ int y_root() const {
+ ((fltk3::Window*)_p)->y_root();
+ }
+
+ static Fl_Window *current() {
+ return fltk3::_3to1_window( fltk3::Window::current() );
+ }
+
+ void make_current() {
+ ((fltk3::Window*)_p)->make_current();
+ }
+
virtual Fl_Window* as_window() { return this; }
-#endif
void cursor(Fl_Cursor c, Fl_Color a=FL_BLACK, Fl_Color b=FL_WHITE) {
((fltk3::Window*)_p)->cursor( fltk3::_1to3_cursor(c),
fltk3::_1to3_color(a), fltk3::_1to3_color(b));
}
-#if 0 // FIXME: 123
- void default_cursor(Fl_Cursor, Fl_Color=FL_BLACK, Fl_Color=FL_WHITE);
- static void default_callback(Fl_Window*, void* v);
- int decorated_w();
- int decorated_h();
-#endif
+ void default_cursor(Fl_Cursor c, Fl_Color a=FL_BLACK, Fl_Color b=FL_WHITE) {
+ ((fltk3::Window*)_p)->default_cursor(fltk3::_1to3_cursor(c),
fltk3::_1to3_color(a), fltk3::_1to3_color(b));
+ }
+
+ static void default_callback(Fl_Window *w, void* v) {
+ fltk3::Window::default_callback(fltk3::_1to3_window(w), v);
+ }
+
+ int decorated_w() {
+ ((fltk3::Window*)_p)->decorated_w();
+ }
+
+ int decorated_h() {
+ return ((fltk3::Window*)_p)->decorated_h();
+ }
};
Modified: branches/branch-3.0/fltk3/Group.h
===================================================================
--- branches/branch-3.0/fltk3/Group.h 2011-05-30 18:30:10 UTC (rev 8768)
+++ branches/branch-3.0/fltk3/Group.h 2011-05-30 19:09:38 UTC (rev 8769)
@@ -33,6 +33,8 @@
#include "Widget.h"
+class Fl_Group;
+
namespace fltk3 {
/**
@@ -44,6 +46,8 @@
*/
class FLTK3_EXPORT Group : public Widget {
+ friend class ::Fl_Group;
+
fltk3::Widget** array_;
fltk3::Widget* savedfocus_;
fltk3::Widget* resizable_;
Modified: branches/branch-3.0/fltk3/Window.h
===================================================================
--- branches/branch-3.0/fltk3/Window.h 2011-05-30 18:30:10 UTC (rev 8768)
+++ branches/branch-3.0/fltk3/Window.h 2011-05-30 19:09:38 UTC (rev 8769)
@@ -36,8 +36,10 @@
class Fl_X;
+class Fl_Window;
+
namespace fltk3 {
-
+
const uchar WINDOW = 0xF0; ///< window type id all subclasses have
type() >= this
const uchar DOUBLE_WINDOW = 0xF1; ///< double window type id
@@ -59,6 +61,8 @@
window. fltk3::Window has a default callback that calls
fltk3::Window::hide().
*/
class FLTK3_EXPORT Window : public Group {
+
+ friend class ::Fl_Window;
static char *default_xclass_;
_______________________________________________
fltk-commit mailing list
[email protected]
http://lists.easysw.com/mailman/listinfo/fltk-commit