summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorBill Spitzak <spitzak@gmail.com>1999-08-05 09:01:25 +0000
committerBill Spitzak <spitzak@gmail.com>1999-08-05 09:01:25 +0000
commit467e73ed0b946bf882479c941bf666716482de7e (patch)
tree5d6aa98810572aabe6fc693b512a8d1451548352
parent16a999efd0f14f0a99fb01c4e8484ace744fd416 (diff)
Added Chrisophe Kalt's patch to add "extern "C"" to functions
if desired. Added Chrisophe Kalt's patch to let you create Fl_Pack. git-svn-id: file:///fltk/svn/fltk/branches/branch-1.0@638 ea41ed52-d2ee-0310-a9c1-e6b18d33e121
-rw-r--r--fluid/Fl_Function_Type.cxx17
-rw-r--r--fluid/Fl_Group_Type.cxx15
-rw-r--r--fluid/Fl_Type.h17
-rw-r--r--fluid/factory.cxx6
-rw-r--r--fluid/function_panel.cxx5
-rw-r--r--fluid/function_panel.fl18
-rw-r--r--fluid/function_panel.h2
7 files changed, 63 insertions, 17 deletions
diff --git a/fluid/Fl_Function_Type.cxx b/fluid/Fl_Function_Type.cxx
index f2689d840..dbc4f5db5 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.2.7 1999/08/05 08:01:35 bill Exp $"
+// "$Id: Fl_Function_Type.cxx,v 1.15.2.8 1999/08/05 09:01:24 bill Exp $"
//
// C function type code for the Fast Light Tool Kit (FLTK).
//
@@ -112,12 +112,14 @@ Fl_Type *Fl_Function_Type::make() {
o->add(p);
o->factory = this;
o->public_ = 1;
+ o->cdecl_ = 0;
return o;
}
void Fl_Function_Type::write_properties() {
Fl_Type::write_properties();
if (!public_) write_string("private");
+ if (cdecl_) write_string("C");
if (return_type) {
write_string("return_type");
write_word(return_type);
@@ -127,6 +129,8 @@ void Fl_Function_Type::write_properties() {
void Fl_Function_Type::read_property(const char *c) {
if (!strcmp(c,"private")) {
public_ = 0;
+ } else if (!strcmp(c,"C")) {
+ cdecl_ = 1;
} else if (!strcmp(c,"return_type")) {
storestring(read_word(),return_type);
} else {
@@ -142,6 +146,7 @@ void Fl_Function_Type::open() {
f_return_type_input->static_value(return_type);
f_name_input->static_value(name());
f_public_button->value(public_);
+ f_c_button->value(cdecl_);
function_panel->show();
const char* message = 0;
for (;;) { // repeat as long as there are errors
@@ -165,6 +170,7 @@ void Fl_Function_Type::open() {
name(f_name_input->value());
storestring(c, return_type);
public_ = f_public_button->value();
+ cdecl_ = f_c_button->value();
break;
}
BREAK2:
@@ -242,7 +248,12 @@ void Fl_Function_Type::write_code1() {
write_h("%s;\n", s);
write_c("%s::%s {\n", k, name());
} else {
- if (public_) write_h("%s %s;\n", t, name());
+ if (public_) {
+ if (cdecl_)
+ write_h("extern \"C\" { %s %s; }\n", t, name());
+ else
+ write_h("%s %s;\n", t, name());
+ }
else write_c("static ");
write_c("%s %s {\n", t, name());
}
@@ -650,5 +661,5 @@ void Fl_Class_Type::write_code2() {
}
//
-// End of "$Id: Fl_Function_Type.cxx,v 1.15.2.7 1999/08/05 08:01:35 bill Exp $".
+// End of "$Id: Fl_Function_Type.cxx,v 1.15.2.8 1999/08/05 09:01:24 bill Exp $".
//
diff --git a/fluid/Fl_Group_Type.cxx b/fluid/Fl_Group_Type.cxx
index f6b7ff78a..47ee52e36 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.2.2 1999/04/18 14:10:55 gustavo Exp $"
+// "$Id: Fl_Group_Type.cxx,v 1.4.2.3 1999/08/05 09:01:24 bill Exp $"
//
// Fl_Group object code for the Fast Light Tool Kit (FLTK).
//
@@ -129,6 +129,17 @@ void Fl_Group_Type::write_code2() {
////////////////////////////////////////////////////////////////
+const char pack_type_name[] = "Fl_Pack";
+
+Fl_Menu_Item pack_type_menu[] = {
+ {"HORIZONTAL", 0, 0, (void*)Fl_Pack::HORIZONTAL},
+ {"VERTICAL", 0, 0, (void*)Fl_Pack::VERTICAL},
+ {0}};
+
+Fl_Pack_Type Fl_Pack_type; // the "factory"
+
+////////////////////////////////////////////////////////////////
+
const char tabs_type_name[] = "Fl_Tabs";
// Override group's resize behavior to do nothing to children:
@@ -220,5 +231,5 @@ const char tile_type_name[] = "Fl_Tile";
Fl_Tile_Type Fl_Tile_type; // the "factory"
//
-// End of "$Id: Fl_Group_Type.cxx,v 1.4.2.2 1999/04/18 14:10:55 gustavo Exp $".
+// End of "$Id: Fl_Group_Type.cxx,v 1.4.2.3 1999/08/05 09:01:24 bill Exp $".
//
diff --git a/fluid/Fl_Type.h b/fluid/Fl_Type.h
index 167540c49..70b6b1043 100644
--- a/fluid/Fl_Type.h
+++ b/fluid/Fl_Type.h
@@ -1,5 +1,5 @@
//
-// "$Id: Fl_Type.h,v 1.5.2.3 1999/08/05 08:01:36 bill Exp $"
+// "$Id: Fl_Type.h,v 1.5.2.4 1999/08/05 09:01:25 bill Exp $"
//
// Widget type header file for the Fast Light Tool Kit (FLTK).
//
@@ -128,7 +128,7 @@ public:
class Fl_Function_Type : public Fl_Type {
const char* return_type;
- char public_, constructor, havewidgets;
+ char public_, cdecl_, constructor, havewidgets;
public:
Fl_Type *make();
void write_code1();
@@ -271,6 +271,7 @@ public:
};
#include <FL/Fl_Tabs.H>
+#include <FL/Fl_Pack.H>
class igroup : public Fl_Group {
public:
@@ -300,6 +301,16 @@ public:
int is_group() const {return 1;}
};
+extern const char pack_type_name[];
+extern Fl_Menu_Item pack_type_menu[];
+
+class Fl_Pack_Type : public Fl_Group_Type {
+ Fl_Menu_Item *subtypes() {return pack_type_menu;}
+public:
+ virtual const char *type_name() {return pack_type_name;}
+ Fl_Widget_Type *_make() {return new Fl_Pack_Type();}
+};
+
extern const char tabs_type_name[];
class Fl_Tabs_Type : public Fl_Group_Type {
@@ -516,5 +527,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.2.3 1999/08/05 08:01:36 bill Exp $".
+// End of "$Id: Fl_Type.h,v 1.5.2.4 1999/08/05 09:01:25 bill Exp $".
//
diff --git a/fluid/factory.cxx b/fluid/factory.cxx
index 3655e3534..eb5cc67b5 100644
--- a/fluid/factory.cxx
+++ b/fluid/factory.cxx
@@ -1,5 +1,5 @@
//
-// "$Id: factory.cxx,v 1.4.2.2 1999/04/03 15:51:39 carl Exp $"
+// "$Id: factory.cxx,v 1.4.2.3 1999/08/05 09:01:25 bill Exp $"
//
// Widget factory code for the Fast Light Tool Kit (FLTK).
//
@@ -449,6 +449,7 @@ extern class Fl_DeclBlock_Type Fl_DeclBlock_type;
extern class Fl_Class_Type Fl_Class_type;
extern class Fl_Window_Type Fl_Window_type;
extern class Fl_Group_Type Fl_Group_type;
+extern class Fl_Pack_Type Fl_Pack_type;
extern class Fl_Tabs_Type Fl_Tabs_type;
extern class Fl_Scroll_Type Fl_Scroll_type;
extern class Fl_Tile_Type Fl_Tile_type;
@@ -478,6 +479,7 @@ Fl_Menu_Item New_Menu[] = {
{"group",0,0,0,FL_SUBMENU},
{0,0,cb,(void*)&Fl_Window_type},
{0,0,cb,(void*)&Fl_Group_type},
+ {0,0,cb,(void*)&Fl_Pack_type},
{0,0,cb,(void*)&Fl_Tabs_type},
{0,0,cb,(void*)&Fl_Scroll_type},
{0,0,cb,(void*)&Fl_Tile_type},
@@ -685,5 +687,5 @@ int lookup_symbol(const char *name, int &v, int numberok) {
}
//
-// End of "$Id: factory.cxx,v 1.4.2.2 1999/04/03 15:51:39 carl Exp $".
+// End of "$Id: factory.cxx,v 1.4.2.3 1999/08/05 09:01:25 bill Exp $".
//
diff --git a/fluid/function_panel.cxx b/fluid/function_panel.cxx
index 77a50fcdb..12a5c1e32 100644
--- a/fluid/function_panel.cxx
+++ b/fluid/function_panel.cxx
@@ -6,6 +6,8 @@ Fl_Window *function_panel=(Fl_Window *)0;
Fl_Light_Button *f_public_button=(Fl_Light_Button *)0;
+Fl_Light_Button *f_c_button=(Fl_Light_Button *)0;
+
Fl_Input *f_name_input=(Fl_Input *)0;
Fl_Input *f_return_type_input=(Fl_Input *)0;
@@ -22,6 +24,9 @@ Fl_Window* make_function_panel() {
o->labelsize(10);
o->when(FL_WHEN_NEVER);
}
+ { Fl_Light_Button* o = f_c_button = new Fl_Light_Button(90, 15, 90, 25, "C declaration");
+ o->labelsize(10);
+ }
{ Fl_Input* o = f_name_input = new Fl_Input(10, 60, 270, 25, "Name(args): (blank for main())");
o->labelsize(12);
o->align(FL_ALIGN_TOP_LEFT);
diff --git a/fluid/function_panel.fl b/fluid/function_panel.fl
index 637c0bdd4..ac73dbc5c 100644
--- a/fluid/function_panel.fl
+++ b/fluid/function_panel.fl
@@ -9,18 +9,22 @@ Function {make_function_panel()} {open
} {
Fl_Window function_panel {
label {function/method} open
- xywh {281 608 287 173} resizable modal visible
+ xywh {975 642 287 173} resizable modal visible
} {
Fl_Light_Button f_public_button {
label public
xywh {10 15 65 25} labelsize 10 when 0
}
+ Fl_Light_Button f_c_button {
+ label {C declaration} selected
+ xywh {90 15 90 25} labelsize 10
+ }
Fl_Input f_name_input {
label {Name(args): (blank for main())}
xywh {10 60 270 25} labelsize 12 align 5 when 0 resizable
}
Fl_Input f_return_type_input {
- label {Return Type: (blank to return outermost widget)} selected
+ label {Return Type: (blank to return outermost widget)}
xywh {10 105 270 25} labelsize 12 align 5 when 0
}
Fl_Return_Button f_panel_ok {
@@ -38,7 +42,7 @@ Function {make_code_panel()} {open
} {
Fl_Window code_panel {
label code open
- xywh {256 219 291 178} resizable modal visible
+ xywh {260 242 291 178} hide resizable modal
} {
Fl_Input code_input {
xywh {6 5 280 135} type Multiline labelsize 12 align 0 when 0 resizable
@@ -58,7 +62,7 @@ Function {make_codeblock_panel()} {open
} {
Fl_Window codeblock_panel {
label codeblock open
- xywh {285 439 293 134} resizable modal visible
+ xywh {289 462 293 134} hide resizable modal
} {
Fl_Input code_before_input {
xywh {10 5 275 25} labelsize 12 align 5 when 0 resizable
@@ -85,7 +89,7 @@ Function {make_declblock_panel()} {open
} {
Fl_Window declblock_panel {
label {declaration block} open
- xywh {296 118 293 134} resizable modal visible
+ xywh {517 141 293 134} hide resizable modal
} {
Fl_Input decl_before_input {
xywh {15 10 275 25} labelsize 12 align 5 when 0 resizable
@@ -112,7 +116,7 @@ Function {make_decl_panel()} {open
} {
Fl_Window decl_panel {
label declaration open
- xywh {278 800 290 176} resizable visible
+ xywh {282 823 290 176} hide resizable
} {
Fl_Light_Button decl_public_button {
label public
@@ -140,7 +144,7 @@ Function {make_class_panel()} {open
} {
Fl_Window class_panel {
label class open
- xywh {513 790 287 173} resizable modal visible
+ xywh {517 813 287 173} hide resizable modal
} {
Fl_Light_Button c_public_button {
label public
diff --git a/fluid/function_panel.h b/fluid/function_panel.h
index ce0962583..89f4fffdd 100644
--- a/fluid/function_panel.h
+++ b/fluid/function_panel.h
@@ -7,6 +7,7 @@
extern Fl_Window *function_panel;
#include <FL/Fl_Light_Button.H>
extern Fl_Light_Button *f_public_button;
+extern Fl_Light_Button *f_c_button;
#include <FL/Fl_Input.H>
extern Fl_Input *f_name_input;
extern Fl_Input *f_return_type_input;
@@ -17,6 +18,7 @@ extern Fl_Button *f_panel_cancel;
Fl_Window* make_function_panel();
extern Fl_Window *function_panel;
extern Fl_Light_Button *f_public_button;
+extern Fl_Light_Button *f_c_button;
extern Fl_Input *f_name_input;
extern Fl_Input *f_return_type_input;
extern Fl_Return_Button *f_panel_ok;