diff options
Diffstat (limited to 'fluid')
| -rw-r--r-- | fluid/Fl_Function_Type.cxx | 99 | ||||
| -rw-r--r-- | fluid/Fl_Group_Type.cxx | 60 | ||||
| -rw-r--r-- | fluid/Fl_Menu_Type.cxx | 99 | ||||
| -rw-r--r-- | fluid/Fl_Type.h | 361 | ||||
| -rw-r--r-- | fluid/Fl_Widget_Type.h | 58 | ||||
| -rw-r--r-- | fluid/Fl_Window_Type.cxx | 51 | ||||
| -rw-r--r-- | fluid/Fluid_Image.h | 9 |
7 files changed, 385 insertions, 352 deletions
diff --git a/fluid/Fl_Function_Type.cxx b/fluid/Fl_Function_Type.cxx index 3b19bdb64..08cb46806 100644 --- a/fluid/Fl_Function_Type.cxx +++ b/fluid/Fl_Function_Type.cxx @@ -1,5 +1,5 @@ // -// "$Id: Fl_Function_Type.cxx,v 1.15 1999/02/19 14:53:04 mike Exp $" +// "$Id: Fl_Function_Type.cxx,v 1.15.2.1 1999/03/29 17:39:24 carl Exp $" // // C function type code for the Fast Light Tool Kit (FLTK). // @@ -103,26 +103,6 @@ const char *c_check(const char *c, int type) { //////////////////////////////////////////////////////////////// -class Fl_Function_Type : public Fl_Type { - const char* return_type; - char public_, constructor, havewidgets; -public: - Fl_Type *make(); - void write_declare(); - void write_code1(); - void write_code2(); - void open(); - int ismain() {return name_ == 0;} - virtual const char *type_name() {return "Function";} - virtual const char *title() { - return name() ? name() : "main()"; - } - int is_parent() const {return 1;} - int is_code_block() const {return 1;} - void write_properties(); - void read_property(const char *); -}; - Fl_Type *Fl_Function_Type::make() { Fl_Type *p = Fl_Type::current; while (p && !p->is_decl_block()) p = p->parent; @@ -276,17 +256,6 @@ void Fl_Function_Type::write_code2() { //////////////////////////////////////////////////////////////// -class Fl_Code_Type : public Fl_Type { -public: - Fl_Type *make(); - void write_declare(); - void write_code1(); - void write_code2(); - void open(); - virtual const char *type_name() {return "code";} - int is_code_block() const {return 0;} -}; - Fl_Type *Fl_Code_Type::make() { Fl_Type *p = Fl_Type::current; while (p && !p->is_code_block()) p = p->parent; @@ -337,21 +306,6 @@ void Fl_Code_Type::write_code2() {} //////////////////////////////////////////////////////////////// -class Fl_CodeBlock_Type : public Fl_Type { - const char* after; -public: - Fl_Type *make(); - void write_declare(); - void write_code1(); - void write_code2(); - void open(); - virtual const char *type_name() {return "codeblock";} - int is_code_block() const {return 1;} - int is_parent() const {return 1;} - void write_properties(); - void read_property(const char *); -}; - Fl_Type *Fl_CodeBlock_Type::make() { Fl_Type *p = Fl_Type::current; while (p && !p->is_code_block()) p = p->parent; @@ -427,19 +381,6 @@ void Fl_CodeBlock_Type::write_code2() { //////////////////////////////////////////////////////////////// -class Fl_Decl_Type : public Fl_Type { - char public_; -public: - Fl_Type *make(); - void write_declare(); - void write_code1(); - void write_code2(); - void open(); - virtual const char *type_name() {return "decl";} - void write_properties(); - void read_property(const char *); -}; - Fl_Type *Fl_Decl_Type::make() { Fl_Type *p = Fl_Type::current; while (p && !p->is_decl_block()) p = p->parent; @@ -525,21 +466,6 @@ void Fl_Decl_Type::write_code2() {} //////////////////////////////////////////////////////////////// -class Fl_DeclBlock_Type : public Fl_Type { - const char* after; -public: - Fl_Type *make(); - void write_declare(); - void write_code1(); - void write_code2(); - void open(); - virtual const char *type_name() {return "declblock";} - void write_properties(); - void read_property(const char *); - int is_parent() const {return 1;} - int is_decl_block() const {return 1;} -}; - Fl_Type *Fl_DeclBlock_Type::make() { Fl_Type *p = Fl_Type::current; while (p && !p->is_decl_block()) p = p->parent; @@ -611,27 +537,6 @@ void Fl_DeclBlock_Type::write_code2() { //////////////////////////////////////////////////////////////// -class Fl_Class_Type : public Fl_Type { - const char* subclass_of; - char public_; -public: - // state variables for output: - char write_public_state; // true when public: has been printed - Fl_Class_Type* parent_class; // save class if nested -// - Fl_Type *make(); - void write_declare(); - void write_code1(); - void write_code2(); - void open(); - virtual const char *type_name() {return "class";} - int is_parent() const {return 1;} - int is_decl_block() const {return 1;} - int is_class() const {return 1;} - void write_properties(); - void read_property(const char *); -}; - const char* Fl_Type::class_name() const { Fl_Type* p = parent; while (p) {if (p->is_class()) return p->name(); p = p->parent;} @@ -729,5 +634,5 @@ void Fl_Class_Type::write_code2() { } // -// End of "$Id: Fl_Function_Type.cxx,v 1.15 1999/02/19 14:53:04 mike Exp $". +// End of "$Id: Fl_Function_Type.cxx,v 1.15.2.1 1999/03/29 17:39:24 carl Exp $". // diff --git a/fluid/Fl_Group_Type.cxx b/fluid/Fl_Group_Type.cxx index 842514690..0fac8500a 100644 --- a/fluid/Fl_Group_Type.cxx +++ b/fluid/Fl_Group_Type.cxx @@ -1,5 +1,5 @@ // -// "$Id: Fl_Group_Type.cxx,v 1.4 1999/01/07 19:17:10 mike Exp $" +// "$Id: Fl_Group_Type.cxx,v 1.4.2.1 1999/03/29 17:39:24 carl Exp $" // // Fl_Group object code for the Fast Light Tool Kit (FLTK). // @@ -33,32 +33,12 @@ #include <FL/fl_message.H> #include "Fl_Widget_Type.h" -class igroup : public Fl_Group { -public: - void resize(int,int,int,int); - igroup(int x,int y,int w,int h) : Fl_Group(x,y,w,h) {Fl_Group::current(0);} -}; // Override group's resize behavior to do nothing to children: void igroup::resize(int X, int Y, int W, int H) { Fl_Widget::resize(X,Y,W,H); redraw(); } -class Fl_Group_Type : public Fl_Widget_Type { -public: - virtual const char *type_name() {return "Fl_Group";} - Fl_Widget *widget(int x,int y,int w,int h) { - igroup *g = new igroup(x,y,w,h); Fl_Group::current(0); return g;} - Fl_Widget_Type *_make() {return new Fl_Group_Type();} - Fl_Type *make(); - void write_code1(); - void write_code2(); - void add_child(Fl_Type*, Fl_Type*); - void move_child(Fl_Type*, Fl_Type*); - void remove_child(Fl_Type*); - int is_parent() const {return 1;} - int is_group() const {return 1;} -}; Fl_Group_Type Fl_Group_type; // the "factory" Fl_Type *Fl_Group_Type::make() { @@ -148,31 +128,14 @@ void Fl_Group_Type::write_code2() { //////////////////////////////////////////////////////////////// -#include <FL/Fl_Tabs.H> +const char tabs_type_name[] = "Fl_Tabs"; -class itabs : public Fl_Tabs { -public: - void resize(int,int,int,int); - itabs(int x,int y,int w,int h) : Fl_Tabs(x,y,w,h) {} -}; // Override group's resize behavior to do nothing to children: void itabs::resize(int X, int Y, int W, int H) { Fl_Widget::resize(X,Y,W,H); redraw(); } -static const char tabs_type_name[] = "Fl_Tabs"; - -class Fl_Tabs_Type : public Fl_Group_Type { -public: - virtual const char *type_name() {return tabs_type_name;} - Fl_Widget *widget(int x,int y,int w,int h) { - itabs *g = new itabs(x,y,w,h); Fl_Group::current(0); return g;} - Fl_Widget_Type *_make() {return new Fl_Tabs_Type();} - Fl_Type* click_test(int,int); - void add_child(Fl_Type*, Fl_Type*); - void remove_child(Fl_Type*); -}; Fl_Tabs_Type Fl_Tabs_type; // the "factory" // This is called when user clicks on a widget in the window. See @@ -236,9 +199,9 @@ void Fl_Group_Type::move_child(Fl_Type* cc, Fl_Type* before) { #include <FL/Fl_Scroll.H> -static const char scroll_type_name[] = "Fl_Scroll"; +const char scroll_type_name[] = "Fl_Scroll"; -static Fl_Menu_Item scroll_type_menu[] = { +Fl_Menu_Item scroll_type_menu[] = { {"BOTH", 0, 0, 0/*(void*)Fl_Scroll::BOTH*/}, {"HORIZONTAL", 0, 0, (void*)Fl_Scroll::HORIZONTAL}, {"VERTICAL", 0, 0, (void*)Fl_Scroll::VERTICAL}, @@ -247,25 +210,14 @@ static Fl_Menu_Item scroll_type_menu[] = { {"BOTH_ALWAYS", 0, 0, (void*)Fl_Scroll::BOTH_ALWAYS}, {0}}; -class Fl_Scroll_Type : public Fl_Group_Type { - Fl_Menu_Item *subtypes() {return scroll_type_menu;} -public: - virtual const char *type_name() {return scroll_type_name;} - Fl_Widget_Type *_make() {return new Fl_Scroll_Type();} -}; Fl_Scroll_Type Fl_Scroll_type; // the "factory" //////////////////////////////////////////////////////////////// -static const char tile_type_name[] = "Fl_Tile"; +const char tile_type_name[] = "Fl_Tile"; -class Fl_Tile_Type : public Fl_Group_Type { -public: - virtual const char *type_name() {return tile_type_name;} - Fl_Widget_Type *_make() {return new Fl_Tile_Type();} -}; Fl_Tile_Type Fl_Tile_type; // the "factory" // -// End of "$Id: Fl_Group_Type.cxx,v 1.4 1999/01/07 19:17:10 mike Exp $". +// End of "$Id: Fl_Group_Type.cxx,v 1.4.2.1 1999/03/29 17:39:24 carl Exp $". // diff --git a/fluid/Fl_Menu_Type.cxx b/fluid/Fl_Menu_Type.cxx index be5363e47..a7b5c6960 100644 --- a/fluid/Fl_Menu_Type.cxx +++ b/fluid/Fl_Menu_Type.cxx @@ -1,5 +1,5 @@ // -// "$Id: Fl_Menu_Type.cxx,v 1.16 1999/03/10 08:00:45 bill Exp $" +// "$Id: Fl_Menu_Type.cxx,v 1.16.2.1 1999/03/29 17:39:25 carl Exp $" // // Menu item code for the Fast Light Tool Kit (FLTK). // @@ -38,44 +38,12 @@ #include <stdio.h> #include <stdlib.h> -static Fl_Menu_Item menu_item_type_menu[] = { +Fl_Menu_Item menu_item_type_menu[] = { {"Normal",0,0,(void*)0}, {"Toggle",0,0,(void*)FL_MENU_BOX}, {"Radio",0,0,(void*)FL_MENU_RADIO}, {0}}; -class Fl_Menu_Item_Type : public Fl_Widget_Type { -public: - Fl_Menu_Item* subtypes() {return menu_item_type_menu;} - const char* type_name() {return "menuitem";} - Fl_Type* make(); - int is_menu_item() const {return 1;} - int is_button() const {return 1;} // this gets shortcut to work - Fl_Widget* widget(int,int,int,int) {return 0;} - Fl_Widget_Type* _make() {return 0;} - void write_declare(); - const char* menu_name(int& i); - int flags(); - void write_static(); - void write_item(); - void write_code1(); - void write_code2(); -}; - -class Fl_Submenu_Type : public Fl_Menu_Item_Type { -public: - Fl_Menu_Item* subtypes() {return 0;} - const char* type_name() {return "submenu";} - int is_parent() const {return 1;} - int is_button() const {return 0;} // disable shortcut - Fl_Type* make(); - // changes to submenu must propagate up so build_menu is called - // on the parent Fl_Menu_Type: - void add_child(Fl_Type*a, Fl_Type*b) {parent->add_child(a,b);} - void move_child(Fl_Type*a, Fl_Type*b) {parent->move_child(a,b);} - void remove_child(Fl_Type*a) {parent->remove_child(a);} -}; - extern int reading_file; extern int force_parent; @@ -323,34 +291,6 @@ void Fl_Menu_Item_Type::write_code2() {} // children. An actual array of Fl_Menu_Items is kept parallel // with the child objects and updated as they change. -class Fl_Menu_Type : public Fl_Widget_Type { - int textstuff(int w, Fl_Font& f, int& s, Fl_Color& c) { - Fl_Menu_ *o = (Fl_Menu_*)(w==4 ? ((Fl_Widget_Type*)this->factory)->o : this->o); - switch (w) { - case 4: - case 0: f = o->textfont(); s = o->textsize(); c = o->textcolor(); break; - case 1: o->textfont(f); break; - case 2: o->textsize(s); break; - case 3: o->textcolor(c); break; - } - return 1; - } -public: - int is_menu_button() const {return 1;} - int is_parent() const {return 1;} - int menusize; - void build_menu(); - Fl_Menu_Type() : Fl_Widget_Type() {menusize = 0;} - ~Fl_Menu_Type() { - if (menusize) delete[] (Fl_Menu_Item*)(((Fl_Menu_*)o)->menu()); - } - void add_child(Fl_Type*, Fl_Type*) {build_menu();} - void move_child(Fl_Type*, Fl_Type*) {build_menu();} - void remove_child(Fl_Type*) {build_menu();} - Fl_Type* click_test(int x, int y); - void write_code2(); -}; - void Fl_Menu_Type::build_menu() { Fl_Menu_* w = (Fl_Menu_*)o; // count how many Fl_Menu_Item structures needed: @@ -423,7 +363,7 @@ void Fl_Menu_Type::write_code2() { //////////////////////////////////////////////////////////////// #include <FL/Fl_Menu_Button.H> -static Fl_Menu_Item button_type_menu[] = { +Fl_Menu_Item button_type_menu[] = { {"normal",0,0,(void*)0}, {"popup1",0,0,(void*)Fl_Menu_Button::POPUP1}, {"popup2",0,0,(void*)Fl_Menu_Button::POPUP2}, @@ -433,44 +373,17 @@ static Fl_Menu_Item button_type_menu[] = { {"popup13",0,0,(void*)Fl_Menu_Button::POPUP13}, {"popup123",0,0,(void*)Fl_Menu_Button::POPUP123}, {0}}; -class Fl_Menu_Button_Type : public Fl_Menu_Type { - Fl_Menu_Item *subtypes() {return button_type_menu;} -public: - virtual const char *type_name() {return "Fl_Menu_Button";} - Fl_Widget *widget(int x,int y,int w,int h) { - return new Fl_Menu_Button(x,y,w,h,"menu");} - Fl_Widget_Type *_make() {return new Fl_Menu_Button_Type();} -}; + Fl_Menu_Button_Type Fl_Menu_Button_type; //////////////////////////////////////////////////////////////// -#include <FL/Fl_Choice.H> +Fl_Menu_Item dummymenu[] = {{"CHOICE"},{0}}; -static Fl_Menu_Item dummymenu[] = {{"CHOICE"},{0}}; - -class Fl_Choice_Type : public Fl_Menu_Type { -public: - virtual const char *type_name() {return "Fl_Choice";} - Fl_Widget *widget(int x,int y,int w,int h) { - Fl_Choice *o = new Fl_Choice(x,y,w,h,"choice:"); - o->menu(dummymenu); - return o; - } - Fl_Widget_Type *_make() {return new Fl_Choice_Type();} -}; Fl_Choice_Type Fl_Choice_type; //////////////////////////////////////////////////////////////// -#include <FL/Fl_Menu_Bar.H> -class Fl_Menu_Bar_Type : public Fl_Menu_Type { -public: - virtual const char *type_name() {return "Fl_Menu_Bar";} - Fl_Widget *widget(int x,int y,int w,int h) { - return new Fl_Menu_Bar(x,y,w,h);} - Fl_Widget_Type *_make() {return new Fl_Menu_Bar_Type();} -}; Fl_Menu_Bar_Type Fl_Menu_Bar_type; //////////////////////////////////////////////////////////////// @@ -529,5 +442,5 @@ void shortcut_in_cb(Shortcut_Button* i, void* v) { } // -// End of "$Id: Fl_Menu_Type.cxx,v 1.16 1999/03/10 08:00:45 bill Exp $". +// End of "$Id: Fl_Menu_Type.cxx,v 1.16.2.1 1999/03/29 17:39:25 carl Exp $". // diff --git a/fluid/Fl_Type.h b/fluid/Fl_Type.h index 927607197..3f054f154 100644 --- a/fluid/Fl_Type.h +++ b/fluid/Fl_Type.h @@ -1,5 +1,5 @@ // -// "$Id: Fl_Type.h,v 1.5 1999/01/07 19:17:10 mike Exp $" +// "$Id: Fl_Type.h,v 1.5.2.1 1999/03/29 17:39:25 carl Exp $" // // Widget type header file for the Fast Light Tool Kit (FLTK). // @@ -33,6 +33,7 @@ #include <FL/Fl_Widget.H> #include <FL/Fl_Menu.H> +#include "Fluid_Image.h" class Fl_Type { @@ -126,6 +127,362 @@ public: const char* class_name() const; }; +class Fl_Function_Type : public Fl_Type { + const char* return_type; + char public_, constructor, havewidgets; +public: + Fl_Type *make(); + void write_declare(); + void write_code1(); + void write_code2(); + void open(); + int ismain() {return name_ == 0;} + virtual const char *type_name() {return "Function";} + virtual const char *title() { + return name() ? name() : "main()"; + } + int is_parent() const {return 1;} + int is_code_block() const {return 1;} + void write_properties(); + void read_property(const char *); +}; + +class Fl_Code_Type : public Fl_Type { +public: + Fl_Type *make(); + void write_declare(); + void write_code1(); + void write_code2(); + void open(); + virtual const char *type_name() {return "code";} + int is_code_block() const {return 0;} +}; + +class Fl_CodeBlock_Type : public Fl_Type { + const char* after; +public: + Fl_Type *make(); + void write_declare(); + void write_code1(); + void write_code2(); + void open(); + virtual const char *type_name() {return "codeblock";} + int is_code_block() const {return 1;} + int is_parent() const {return 1;} + void write_properties(); + void read_property(const char *); +}; + +class Fl_Decl_Type : public Fl_Type { + char public_; +public: + Fl_Type *make(); + void write_declare(); + void write_code1(); + void write_code2(); + void open(); + virtual const char *type_name() {return "decl";} + void write_properties(); + void read_property(const char *); +}; + +class Fl_DeclBlock_Type : public Fl_Type { + const char* after; +public: + Fl_Type *make(); + void write_declare(); + void write_code1(); + void write_code2(); + void open(); + virtual const char *type_name() {return "declblock";} + void write_properties(); + void read_property(const char *); + int is_parent() const {return 1;} + int is_decl_block() const {return 1;} +}; + +class Fl_Class_Type : public Fl_Type { + const char* subclass_of; + char public_; +public: + // state variables for output: + char write_public_state; // true when public: has been printed + Fl_Class_Type* parent_class; // save class if nested +// + Fl_Type *make(); + void write_declare(); + void write_code1(); + void write_code2(); + void open(); + virtual const char *type_name() {return "class";} + int is_parent() const {return 1;} + int is_decl_block() const {return 1;} + int is_class() const {return 1;} + void write_properties(); + void read_property(const char *); +}; + +#define NUM_EXTRA_CODE 4 + +class Fl_Widget_Type : public Fl_Type { + virtual Fl_Widget *widget(int,int,int,int) = 0; + virtual Fl_Widget_Type *_make() = 0; // virtual constructor + virtual void setlabel(const char *); + + const char *extra_code_[NUM_EXTRA_CODE]; + const char *subclass_; + uchar hotspot_; + +protected: + + void write_declare(); + void write_static(); + void write_code1(); + void write_widget_code(); + void write_code2(); + +public: + + const char *xclass; // junk string, used for shortcut + Fl_Widget *o; + int public_; + + Fluid_Image *image; + void setimage(Fluid_Image *); + + Fl_Widget_Type(); + Fl_Type *make(); + void open(); + + const char *extra_code(int n) const {return extra_code_[n];} + void extra_code(int n,const char *); + const char *subclass() const {return subclass_;} + void subclass(const char *); + uchar hotspot() const {return hotspot_;} + void hotspot(uchar v) {hotspot_ = v;} + uchar resizable() const; + void resizable(uchar v); + + virtual int textstuff(int what, Fl_Font &, int &, Fl_Color &); + virtual Fl_Menu_Item *subtypes(); + + virtual int is_widget() const; + + virtual void write_properties(); + virtual void read_property(const char *); + virtual int read_fdesign(const char*, const char*); + + ~Fl_Widget_Type(); + void redraw(); +}; + +#include <FL/Fl_Tabs.H> + +class igroup : public Fl_Group { +public: + void resize(int,int,int,int); + igroup(int x,int y,int w,int h) : Fl_Group(x,y,w,h) {Fl_Group::current(0);} +}; + +class itabs : public Fl_Tabs { +public: + void resize(int,int,int,int); + itabs(int x,int y,int w,int h) : Fl_Tabs(x,y,w,h) {} +}; + +class Fl_Group_Type : public Fl_Widget_Type { +public: + virtual const char *type_name() {return "Fl_Group";} + Fl_Widget *widget(int x,int y,int w,int h) { + igroup *g = new igroup(x,y,w,h); Fl_Group::current(0); return g;} + Fl_Widget_Type *_make() {return new Fl_Group_Type();} + Fl_Type *make(); + void write_code1(); + void write_code2(); + void add_child(Fl_Type*, Fl_Type*); + void move_child(Fl_Type*, Fl_Type*); + void remove_child(Fl_Type*); + int is_parent() const {return 1;} + int is_group() const {return 1;} +}; + +extern const char tabs_type_name[]; + +class Fl_Tabs_Type : public Fl_Group_Type { +public: + virtual const char *type_name() {return tabs_type_name;} + Fl_Widget *widget(int x,int y,int w,int h) { + itabs *g = new itabs(x,y,w,h); Fl_Group::current(0); return g;} + Fl_Widget_Type *_make() {return new Fl_Tabs_Type();} + Fl_Type* click_test(int,int); + void add_child(Fl_Type*, Fl_Type*); + void remove_child(Fl_Type*); +}; + +extern const char scroll_type_name[]; +extern Fl_Menu_Item scroll_type_menu[]; + +class Fl_Scroll_Type : public Fl_Group_Type { + Fl_Menu_Item *subtypes() {return scroll_type_menu;} +public: + virtual const char *type_name() {return scroll_type_name;} + Fl_Widget_Type *_make() {return new Fl_Scroll_Type();} +}; + +extern const char tile_type_name[]; + +class Fl_Tile_Type : public Fl_Group_Type { +public: + virtual const char *type_name() {return tile_type_name;} + Fl_Widget_Type *_make() {return new Fl_Tile_Type();} +}; + +extern Fl_Menu_Item window_type_menu[]; + +class Fl_Window_Type : public Fl_Widget_Type { + Fl_Menu_Item* subtypes() {return window_type_menu;} + + friend class Overlay_Window; + int mx,my; // mouse position during dragging + int x1,y1; // initial position of selection box + int bx,by,br,bt; // bounding box of selection + int dx,dy; + int drag; // which parts of bbox are being moved + int numselected; // number of children selected + enum {LEFT=1,RIGHT=2,BOTTOM=4,TOP=8,DRAG=16,BOX=32}; + void draw_overlay(); + void newdx(); + void newposition(Fl_Widget_Type *,int &x,int &y,int &w,int &h); + int handle(int); + virtual void setlabel(const char *); + void write_code1(); + void write_code2(); + Fl_Widget_Type *_make() {return 0;} // we don't call this + Fl_Widget *widget(int,int,int,int) {return 0;} + int recalc; // set by fix_overlay() + +public: + + uchar modal, non_modal; + + Fl_Type *make(); + virtual const char *type_name() {return "Fl_Window";} + + void open(); + + void fix_overlay(); // update the bounding box, etc + + virtual void write_properties(); + virtual void read_property(const char *); + virtual int read_fdesign(const char*, const char*); + + void add_child(Fl_Type*, Fl_Type*); + void move_child(Fl_Type*, Fl_Type*); + void remove_child(Fl_Type*); + + int is_parent() const {return 1;} + int is_group() const {return 1;} + int is_window() const {return 1;} +}; + +extern Fl_Menu_Item menu_item_type_menu[]; + +class Fl_Menu_Item_Type : public Fl_Widget_Type { +public: + Fl_Menu_Item* subtypes() {return menu_item_type_menu;} + const char* type_name() {return "menuitem";} + Fl_Type* make(); + int is_menu_item() const {return 1;} + int is_button() const {return 1;} // this gets shortcut to work + Fl_Widget* widget(int,int,int,int) {return 0;} + Fl_Widget_Type* _make() {return 0;} + void write_declare(); + const char* menu_name(int& i); + int flags(); + void write_static(); + void write_item(); + void write_code1(); + void write_code2(); +}; + +class Fl_Submenu_Type : public Fl_Menu_Item_Type { +public: + Fl_Menu_Item* subtypes() {return 0;} + const char* type_name() {return "submenu";} + int is_parent() const {return 1;} + int is_button() const {return 0;} // disable shortcut + Fl_Type* make(); + // changes to submenu must propagate up so build_menu is called + // on the parent Fl_Menu_Type: + void add_child(Fl_Type*a, Fl_Type*b) {parent->add_child(a,b);} + void move_child(Fl_Type*a, Fl_Type*b) {parent->move_child(a,b);} + void remove_child(Fl_Type*a) {parent->remove_child(a);} +}; + + +#include <FL/Fl_Menu_.H> +class Fl_Menu_Type : public Fl_Widget_Type { + int textstuff(int w, Fl_Font& f, int& s, Fl_Color& c) { + Fl_Menu_ *o = (Fl_Menu_*)(w==4 ? ((Fl_Widget_Type*)this->factory)->o : this->o); + switch (w) { + case 4: + case 0: f = o->textfont(); s = o->textsize(); c = o->textcolor(); break; + case 1: o->textfont(f); break; + case 2: o->textsize(s); break; + case 3: o->textcolor(c); break; + } + return 1; + } +public: + int is_menu_button() const {return 1;} + int is_parent() const {return 1;} + int menusize; + void build_menu(); + Fl_Menu_Type() : Fl_Widget_Type() {menusize = 0;} + ~Fl_Menu_Type() { + if (menusize) delete[] (Fl_Menu_Item*)(((Fl_Menu_*)o)->menu()); + } + void add_child(Fl_Type*, Fl_Type*) {build_menu();} + void move_child(Fl_Type*, Fl_Type*) {build_menu();} + void remove_child(Fl_Type*) {build_menu();} + Fl_Type* click_test(int x, int y); + void write_code2(); +}; + +extern Fl_Menu_Item button_type_menu[]; + +#include <FL/Fl_Menu_Button.H> +class Fl_Menu_Button_Type : public Fl_Menu_Type { + Fl_Menu_Item *subtypes() {return button_type_menu;} +public: + virtual const char *type_name() {return "Fl_Menu_Button";} + Fl_Widget *widget(int x,int y,int w,int h) { + return new Fl_Menu_Button(x,y,w,h,"menu");} + Fl_Widget_Type *_make() {return new Fl_Menu_Button_Type();} +}; + +extern Fl_Menu_Item dummymenu[]; + +#include <FL/Fl_Choice.H> +class Fl_Choice_Type : public Fl_Menu_Type { +public: + virtual const char *type_name() {return "Fl_Choice";} + Fl_Widget *widget(int x,int y,int w,int h) { + Fl_Choice *o = new Fl_Choice(x,y,w,h,"choice:"); + o->menu(dummymenu); + return o; + } + Fl_Widget_Type *_make() {return new Fl_Choice_Type();} +}; + +#include <FL/Fl_Menu_Bar.H> +class Fl_Menu_Bar_Type : public Fl_Menu_Type { +public: + virtual const char *type_name() {return "Fl_Menu_Bar";} + Fl_Widget *widget(int x,int y,int w,int h) { + return new Fl_Menu_Bar(x,y,w,h);} + Fl_Widget_Type *_make() {return new Fl_Menu_Bar_Type();} +}; // object list operations: Fl_Widget *make_widget_browser(int x,int y,int w,int h); extern int modflag; @@ -166,5 +523,5 @@ int storestring(const char *n, const char * & p, int nostrip=0); extern int include_H_from_C; // -// End of "$Id: Fl_Type.h,v 1.5 1999/01/07 19:17:10 mike Exp $". +// End of "$Id: Fl_Type.h,v 1.5.2.1 1999/03/29 17:39:25 carl Exp $". // diff --git a/fluid/Fl_Widget_Type.h b/fluid/Fl_Widget_Type.h index ec6e48611..add699ee5 100644 --- a/fluid/Fl_Widget_Type.h +++ b/fluid/Fl_Widget_Type.h @@ -1,5 +1,5 @@ // -// "$Id: Fl_Widget_Type.h,v 1.4 1999/01/07 19:17:11 mike Exp $" +// "$Id: Fl_Widget_Type.h,v 1.4.2.1 1999/03/29 17:39:26 carl Exp $" // // Widget type header file for the Fast Light Tool Kit (FLTK). // @@ -32,63 +32,9 @@ struct Fl_Menu_Item; class Fluid_Image; -#define NUM_EXTRA_CODE 4 - -class Fl_Widget_Type : public Fl_Type { - virtual Fl_Widget *widget(int,int,int,int) = 0; - virtual Fl_Widget_Type *_make() = 0; // virtual constructor - virtual void setlabel(const char *); - - const char *extra_code_[NUM_EXTRA_CODE]; - const char *subclass_; - uchar hotspot_; - -protected: - - void write_declare(); - void write_static(); - void write_code1(); - void write_widget_code(); - void write_code2(); - -public: - - const char *xclass; // junk string, used for shortcut - Fl_Widget *o; - int public_; - - Fluid_Image *image; - void setimage(Fluid_Image *); - - Fl_Widget_Type(); - Fl_Type *make(); - void open(); - - const char *extra_code(int n) const {return extra_code_[n];} - void extra_code(int n,const char *); - const char *subclass() const {return subclass_;} - void subclass(const char *); - uchar hotspot() const {return hotspot_;} - void hotspot(uchar v) {hotspot_ = v;} - uchar resizable() const; - void resizable(uchar v); - - virtual int textstuff(int what, Fl_Font &, int &, Fl_Color &); - virtual Fl_Menu_Item *subtypes(); - - virtual int is_widget() const; - - virtual void write_properties(); - virtual void read_property(const char *); - virtual int read_fdesign(const char*, const char*); - - ~Fl_Widget_Type(); - void redraw(); -}; - void* const LOAD = (void *)9831; extern Fl_Widget_Type *current_widget; // one of the selected ones // -// End of "$Id: Fl_Widget_Type.h,v 1.4 1999/01/07 19:17:11 mike Exp $". +// End of "$Id: Fl_Widget_Type.h,v 1.4.2.1 1999/03/29 17:39:26 carl Exp $". // diff --git a/fluid/Fl_Window_Type.cxx b/fluid/Fl_Window_Type.cxx index fc7867ba4..dd3757d7e 100644 --- a/fluid/Fl_Window_Type.cxx +++ b/fluid/Fl_Window_Type.cxx @@ -1,5 +1,5 @@ // -// "$Id: Fl_Window_Type.cxx,v 1.13 1999/02/19 15:03:26 mike Exp $" +// "$Id: Fl_Window_Type.cxx,v 1.13.2.1 1999/03/29 17:39:26 carl Exp $" // // Window type code for the Fast Light Tool Kit (FLTK). // @@ -82,55 +82,10 @@ void include_H_from_C_button_cb(Fl_Light_Button* b, void*) { //////////////////////////////////////////////////////////////// -static Fl_Menu_Item window_type_menu[] = { +Fl_Menu_Item window_type_menu[] = { {"Single",0,0,(void*)FL_WINDOW}, {"Double",0,0,(void*)(FL_WINDOW+1)}, {0}}; -class Fl_Window_Type : public Fl_Widget_Type { - Fl_Menu_Item* subtypes() {return window_type_menu;} - - friend class Overlay_Window; - int mx,my; // mouse position during dragging - int x1,y1; // initial position of selection box - int bx,by,br,bt; // bounding box of selection - int dx,dy; - int drag; // which parts of bbox are being moved - int numselected; // number of children selected - enum {LEFT=1,RIGHT=2,BOTTOM=4,TOP=8,DRAG=16,BOX=32}; - void draw_overlay(); - void newdx(); - void newposition(Fl_Widget_Type *,int &x,int &y,int &w,int &h); - int handle(int); - virtual void setlabel(const char *); - void write_code1(); - void write_code2(); - Fl_Widget_Type *_make() {return 0;} // we don't call this - Fl_Widget *widget(int,int,int,int) {return 0;} - int recalc; // set by fix_overlay() - -public: - - uchar modal, non_modal; - - Fl_Type *make(); - virtual const char *type_name() {return "Fl_Window";} - - void open(); - - void fix_overlay(); // update the bounding box, etc - - virtual void write_properties(); - virtual void read_property(const char *); - virtual int read_fdesign(const char*, const char*); - - void add_child(Fl_Type*, Fl_Type*); - void move_child(Fl_Type*, Fl_Type*); - void remove_child(Fl_Type*); - - int is_parent() const {return 1;} - int is_group() const {return 1;} - int is_window() const {return 1;} -}; static int overlays_invisible; @@ -697,5 +652,5 @@ int Fl_Window_Type::read_fdesign(const char* name, const char* value) { } // -// End of "$Id: Fl_Window_Type.cxx,v 1.13 1999/02/19 15:03:26 mike Exp $". +// End of "$Id: Fl_Window_Type.cxx,v 1.13.2.1 1999/03/29 17:39:26 carl Exp $". // diff --git a/fluid/Fluid_Image.h b/fluid/Fluid_Image.h index ab6bdb3a8..85c217084 100644 --- a/fluid/Fluid_Image.h +++ b/fluid/Fluid_Image.h @@ -1,5 +1,5 @@ // -// "$Id: Fluid_Image.h,v 1.3 1999/01/07 19:17:12 mike Exp $" +// "$Id: Fluid_Image.h,v 1.3.2.1 1999/03/29 17:39:26 carl Exp $" // // Pixmap image header file for the Fast Light Tool Kit (FLTK). // @@ -29,6 +29,9 @@ // Please report all bugs and problems to "fltk-bugs@easysw.com". // +#ifndef FLUID_IMAGE_H +#define FLUID_IMAGE_H + class Fluid_Image { const char *name_; int refcount; @@ -50,6 +53,8 @@ public: // or zero for any errors: Fluid_Image *ui_find_image(const char *); +#endif + // -// End of "$Id: Fluid_Image.h,v 1.3 1999/01/07 19:17:12 mike Exp $". +// End of "$Id: Fluid_Image.h,v 1.3.2.1 1999/03/29 17:39:26 carl Exp $". // |
