summaryrefslogtreecommitdiff
path: root/fluid/Fl_Type.h
diff options
context:
space:
mode:
authorCarl E. Thompson <devel-fltk@carlthompson.net>1999-03-29 17:39:46 +0000
committerCarl E. Thompson <devel-fltk@carlthompson.net>1999-03-29 17:39:46 +0000
commit81c7d9b2156da7495668132a96e63e994be0d19d (patch)
tree7e1c3dc9dbc0fd7cde40759301bb7bf99483a10c /fluid/Fl_Type.h
parent617a7ee619493a1b07df49058509922bae48f559 (diff)
Changes needed to get FLTK to compile on Borland C++ 5 under Windows. I
compiled this on BC++ 5.0 upgraded to 5.0B via the two monster patches. I didn't turn on optimization because my version of BC++ doesn't seem to do much in the way of optimization (FLUID was only 1k smaller when optimized for size). VC++ generates smaller code. The examples that use OpenGL don't work because Borland's linker can't find "wglShareLists". I'm sure this is a simple problem, but I don't know how to fix it. Borland's C++ compiler won't allow you to call main() from C++, so I had to add a c function in "fl_call_main.c" to call it so that you don't have to do that WinMain crap. However, when I added this file to the Visual C++ project it converted the whole thing from 5.0 format to 6.0 format. The files look the nearly identical so I don't think this should be a problem for 5.0 users, but if it is then you can revert them back to the previous version and just add this one source file. Borland really doesn't suck that bad. It doesn't look as polished as VC++ and it refused to supress some warnings for no reason, but I forgot how much I liked the feel of Borlands compilers... Much more intuitive then MS VC++. git-svn-id: file:///fltk/svn/fltk/branches/branch-1.0@475 ea41ed52-d2ee-0310-a9c1-e6b18d33e121
Diffstat (limited to 'fluid/Fl_Type.h')
-rw-r--r--fluid/Fl_Type.h361
1 files changed, 359 insertions, 2 deletions
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 $".
//