fluid outputs symbolic names for align() and when() to the C++ code

file.  Suggested by Luis Ibanez.


git-svn-id: file:///fltk/svn/fltk/branches/branch-1.0@531 ea41ed52-d2ee-0310-a9c1-e6b18d33e121
This commit is contained in:
Bill Spitzak 1999-04-10 09:14:34 +00:00
parent fa29bbdc0f
commit 6776041873
1 changed files with 38 additions and 5 deletions

View File

@ -1,5 +1,5 @@
//
// "$Id: Fl_Widget_Type.cxx,v 1.15 1999/02/19 16:21:50 mike Exp $"
// "$Id: Fl_Widget_Type.cxx,v 1.15.2.1 1999/04/10 09:14:34 bill Exp $"
//
// Widget type code for the Fast Light Tool Kit (FLTK).
//
@ -430,6 +430,15 @@ Fl_Menu_Item whenmenu[] = {
//{"Release or Enter",0,0,(void*)(FL_WHEN_ENTER_KEY|FL_WHEN_RELEASE)},
{0}};
static Fl_Menu_Item whensymbolmenu[] = {
{"FL_WHEN_NEVER",0,0,(void*)(FL_WHEN_NEVER)},
{"FL_WHEN_CHANGED",0,0,(void*)(FL_WHEN_CHANGED)},
{"FL_WHEN_RELEASE",0,0,(void*)(FL_WHEN_RELEASE)},
{"FL_WHEN_RELEASE_ALWAYS",0,0,(void*)(FL_WHEN_RELEASE_ALWAYS)},
{"FL_WHEN_ENTER_KEY",0,0,(void*)(FL_WHEN_ENTER_KEY)},
{"FL_WHEN_ENTER_KEY_ALWAYS",0,0,(void*)(FL_WHEN_ENTER_KEY_ALWAYS)},
{0}};
void when_cb(Fl_Choice* i, void *v) {
if (v == LOAD) {
if (current_widget->is_menu_item()) {i->hide(); return;} else i->show();
@ -719,6 +728,25 @@ static Fl_Button* relative(Fl_Widget* o, int i) {
return (Fl_Button*)(g->child(g->find(*o)+i));
}
static Fl_Menu_Item alignmenu[] = {
{"FL_ALIGN_CENTER",0,0,(void*)(FL_ALIGN_CENTER)},
{"FL_ALIGN_TOP",0,0,(void*)(FL_ALIGN_TOP)},
{"FL_ALIGN_BOTTOM",0,0,(void*)(FL_ALIGN_BOTTOM)},
{"FL_ALIGN_LEFT",0,0,(void*)(FL_ALIGN_LEFT)},
{"FL_ALIGN_RIGHT",0,0,(void*)(FL_ALIGN_RIGHT)},
{"FL_ALIGN_INSIDE",0,0,(void*)(FL_ALIGN_INSIDE)},
{"FL_ALIGN_CLIP",0,0,(void*)(FL_ALIGN_CLIP)},
{"FL_ALIGN_WRAP",0,0,(void*)(FL_ALIGN_WRAP)},
{"FL_ALIGN_TOP_LEFT",0,0,(void*)(FL_ALIGN_TOP_LEFT)},
{"FL_ALIGN_TOP_RIGHT",0,0,(void*)(FL_ALIGN_TOP_RIGHT)},
{"FL_ALIGN_BOTTOM_LEFT",0,0,(void*)(FL_ALIGN_BOTTOM_LEFT)},
{"FL_ALIGN_BOTTOM_RIGHT",0,0,(void*)(FL_ALIGN_BOTTOM_RIGHT)},
{"FL_ALIGN_LEFT_TOP",0,0,(void*)(FL_ALIGN_LEFT_TOP)},
{"FL_ALIGN_RIGHT_TOP",0,0,(void*)(FL_ALIGN_RIGHT_TOP)},
{"FL_ALIGN_LEFT_BOTTOM",0,0,(void*)(FL_ALIGN_LEFT_BOTTOM)},
{"FL_ALIGN_RIGHT_BOTTOM",0,0,(void*)(FL_ALIGN_RIGHT_BOTTOM)},
{0}};
void align_cb(Fl_Button* i, void *v) {
int b = int(long(i->user_data()));
if (v == LOAD) {
@ -1380,10 +1408,15 @@ void Fl_Widget_Type::write_widget_code() {
} else if (ud) {
write_c("%so->user_data((void*)(%s));\n", indent(), ud);
}
if (o->align() != tplate->align())
write_c("%so->align(%d);\n", indent(), o->align());
if (o->align() != tplate->align()) {
int i = o->align();
write_c("%so->align(%s", indent(),
item_name(alignmenu, i & ~FL_ALIGN_INSIDE));
if (i & FL_ALIGN_INSIDE) write_c("|FL_ALIGN_INSIDE");
write_c(");\n");
}
if (o->when() != tplate->when())
write_c("%so->when(%d);\n", indent(), o->when());
write_c("%so->when(%d);\n", indent(),item_name(whensymbolmenu, o->when()));
if (!o->visible() && o->parent())
write_c("%so->hide();\n", indent());
if (!o->active())
@ -1705,5 +1738,5 @@ int Fl_Widget_Type::read_fdesign(const char* name, const char* value) {
}
//
// End of "$Id: Fl_Widget_Type.cxx,v 1.15 1999/02/19 16:21:50 mike Exp $".
// End of "$Id: Fl_Widget_Type.cxx,v 1.15.2.1 1999/04/10 09:14:34 bill Exp $".
//