1998-10-21 20:29:01 +04:00
|
|
|
//
|
2005-02-06 19:28:36 +03:00
|
|
|
// "$Id$"
|
1998-10-21 20:29:01 +04:00
|
|
|
//
|
|
|
|
// Widget factory code for the Fast Light Tool Kit (FLTK).
|
|
|
|
//
|
|
|
|
// Type classes for most of the fltk widgets. Most of the work
|
|
|
|
// is done by code in Fl_Widget_Type.C. Also a factory instance
|
|
|
|
// of each of these type classes.
|
|
|
|
//
|
|
|
|
// This file also contains the "new" menu, which has a pointer
|
|
|
|
// to a factory instance for every class (both the ones defined
|
|
|
|
// here and ones in other files)
|
|
|
|
//
|
2005-02-25 00:55:12 +03:00
|
|
|
// Copyright 1998-2005 by Bill Spitzak and others.
|
1998-10-21 20:29:01 +04:00
|
|
|
//
|
|
|
|
// This library is free software; you can redistribute it and/or
|
|
|
|
// modify it under the terms of the GNU Library General Public
|
|
|
|
// License as published by the Free Software Foundation; either
|
|
|
|
// version 2 of the License, or (at your option) any later version.
|
|
|
|
//
|
|
|
|
// This library is distributed in the hope that it will be useful,
|
|
|
|
// but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
|
|
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
|
|
|
// Library General Public License for more details.
|
|
|
|
//
|
|
|
|
// You should have received a copy of the GNU Library General Public
|
|
|
|
// License along with this library; if not, write to the Free Software
|
|
|
|
// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
|
|
|
|
// USA.
|
|
|
|
//
|
2005-04-16 04:13:17 +04:00
|
|
|
// Please report all bugs and problems on the following page:
|
|
|
|
//
|
|
|
|
// http://www.fltk.org/str.php
|
1998-10-21 20:29:01 +04:00
|
|
|
//
|
1998-10-06 22:21:25 +04:00
|
|
|
|
|
|
|
#include <FL/Fl.H>
|
|
|
|
#include <FL/Fl_Group.H>
|
|
|
|
#include <FL/Fl_Menu_Item.H>
|
2002-10-31 00:08:39 +03:00
|
|
|
#include <FL/Fl_Pixmap.H>
|
1998-10-06 22:21:25 +04:00
|
|
|
#include <stdio.h>
|
2002-05-16 16:47:44 +04:00
|
|
|
#include "../src/flstring.h"
|
2005-03-20 07:00:48 +03:00
|
|
|
#include "undo.h"
|
1998-10-06 22:21:25 +04:00
|
|
|
|
1998-12-06 18:09:22 +03:00
|
|
|
#include "Fl_Widget_Type.h"
|
1998-10-06 22:21:25 +04:00
|
|
|
|
2002-10-31 00:08:39 +03:00
|
|
|
extern Fl_Pixmap *pixmap[];
|
|
|
|
|
2000-11-20 18:44:19 +03:00
|
|
|
#if !HAVE_STRCASECMP
|
|
|
|
//
|
|
|
|
// 'strcasecmp()' - Do a case-insensitive compare...
|
|
|
|
//
|
|
|
|
|
|
|
|
static int
|
|
|
|
strcasecmp(const char *s, const char *t) {
|
|
|
|
while (*s != '\0' && *t != '\0') {
|
|
|
|
if (tolower(*s) < tolower(*t))
|
|
|
|
return (-1);
|
|
|
|
else if (tolower(*s) > tolower(*t))
|
|
|
|
return (1);
|
|
|
|
|
|
|
|
s ++;
|
|
|
|
t ++;
|
|
|
|
}
|
|
|
|
|
|
|
|
if (*s == '\0' && *t == '\0')
|
|
|
|
return (0);
|
|
|
|
else if (*s != '\0')
|
|
|
|
return (1);
|
|
|
|
else
|
|
|
|
return (-1);
|
|
|
|
}
|
|
|
|
#endif // !HAVE_STRCASECMP
|
|
|
|
|
1998-10-06 22:21:25 +04:00
|
|
|
////////////////////////////////////////////////////////////////
|
|
|
|
|
|
|
|
#include <FL/Fl_Box.H>
|
|
|
|
class Fl_Box_Type : public Fl_Widget_Type {
|
|
|
|
public:
|
|
|
|
virtual const char *type_name() {return "Fl_Box";}
|
|
|
|
Fl_Widget *widget(int x,int y,int w, int h) {
|
|
|
|
return new Fl_Box(x,y,w,h,"label");}
|
|
|
|
Fl_Widget_Type *_make() {return new Fl_Box_Type();}
|
2002-10-31 00:08:39 +03:00
|
|
|
int pixmapID() { return 5; }
|
1998-10-06 22:21:25 +04:00
|
|
|
};
|
|
|
|
static Fl_Box_Type Fl_Box_type;
|
|
|
|
|
|
|
|
////////////////////////////////////////////////////////////////
|
|
|
|
|
|
|
|
#include <FL/Fl_Button.H>
|
1999-03-31 03:11:26 +04:00
|
|
|
static Fl_Menu_Item buttontype_menu[] = {
|
1998-10-06 22:21:25 +04:00
|
|
|
{"Normal",0,0,(void*)0},
|
|
|
|
{"Toggle",0,0,(void*)FL_TOGGLE_BUTTON},
|
|
|
|
{"Radio",0,0,(void*)FL_RADIO_BUTTON},
|
|
|
|
{0}};
|
|
|
|
class Fl_Button_Type : public Fl_Widget_Type {
|
1999-03-31 03:11:26 +04:00
|
|
|
Fl_Menu_Item *subtypes() {return buttontype_menu;}
|
1998-10-06 22:21:25 +04:00
|
|
|
public:
|
2005-03-19 07:09:32 +03:00
|
|
|
virtual void ideal_size(int &w, int &h) {
|
|
|
|
Fl_Widget_Type::ideal_size(w, h);
|
|
|
|
w += 2 * (o->labelsize() - 4);
|
|
|
|
h = (h / 5) * 5;
|
|
|
|
}
|
1998-10-06 22:21:25 +04:00
|
|
|
virtual const char *type_name() {return "Fl_Button";}
|
|
|
|
Fl_Widget *widget(int x,int y,int w,int h) {
|
|
|
|
return new Fl_Button(x,y,w,h,"button");}
|
|
|
|
Fl_Widget_Type *_make() {return new Fl_Button_Type();}
|
|
|
|
int is_button() const {return 1;}
|
2002-10-31 00:08:39 +03:00
|
|
|
int pixmapID() { return 2; }
|
1998-10-06 22:21:25 +04:00
|
|
|
};
|
|
|
|
static Fl_Button_Type Fl_Button_type;
|
|
|
|
|
|
|
|
////////////////////////////////////////////////////////////////
|
|
|
|
|
|
|
|
#include <FL/Fl_Return_Button.H>
|
|
|
|
class Fl_Return_Button_Type : public Fl_Button_Type {
|
|
|
|
public:
|
2005-03-08 02:55:49 +03:00
|
|
|
virtual void ideal_size(int &w, int &h) {
|
2005-03-19 07:09:32 +03:00
|
|
|
Fl_Button_Type::ideal_size(w, h);
|
2005-03-08 02:55:49 +03:00
|
|
|
int W = o->h();
|
|
|
|
if (o->w()/3 < W) W = o->w()/3;
|
|
|
|
w += W + 8 - o->labelsize();
|
|
|
|
}
|
1998-10-06 22:21:25 +04:00
|
|
|
virtual const char *type_name() {return "Fl_Return_Button";}
|
|
|
|
Fl_Widget *widget(int x,int y,int w,int h) {
|
2005-03-19 07:09:32 +03:00
|
|
|
return new Fl_Return_Button(x,y,w,h,"button");}
|
1998-10-06 22:21:25 +04:00
|
|
|
Fl_Widget_Type *_make() {return new Fl_Return_Button_Type();}
|
2002-10-31 00:08:39 +03:00
|
|
|
int pixmapID() { return 23; }
|
1998-10-06 22:21:25 +04:00
|
|
|
};
|
|
|
|
static Fl_Return_Button_Type Fl_Return_Button_type;
|
|
|
|
|
|
|
|
////////////////////////////////////////////////////////////////
|
|
|
|
|
|
|
|
#include <FL/Fl_Repeat_Button.H>
|
|
|
|
class Fl_Repeat_Button_Type : public Fl_Widget_Type {
|
|
|
|
public:
|
|
|
|
virtual const char *type_name() {return "Fl_Repeat_Button";}
|
|
|
|
Fl_Widget *widget(int x,int y,int w,int h) {
|
2005-03-19 07:09:32 +03:00
|
|
|
return new Fl_Repeat_Button(x,y,w,h,"button");}
|
1998-10-06 22:21:25 +04:00
|
|
|
Fl_Widget_Type *_make() {return new Fl_Repeat_Button_Type();}
|
2002-10-31 00:08:39 +03:00
|
|
|
int pixmapID() { return 25; }
|
1998-10-06 22:21:25 +04:00
|
|
|
};
|
|
|
|
static Fl_Repeat_Button_Type Fl_Repeat_Button_type;
|
|
|
|
|
|
|
|
////////////////////////////////////////////////////////////////
|
|
|
|
|
|
|
|
#include <FL/Fl_Light_Button.H>
|
|
|
|
class Fl_Light_Button_Type : public Fl_Button_Type {
|
|
|
|
public:
|
2005-03-08 02:55:49 +03:00
|
|
|
virtual void ideal_size(int &w, int &h) {
|
2005-03-19 07:09:32 +03:00
|
|
|
Fl_Button_Type::ideal_size(w, h);
|
|
|
|
w += 4;
|
2005-03-08 02:55:49 +03:00
|
|
|
}
|
1998-10-06 22:21:25 +04:00
|
|
|
virtual const char *type_name() {return "Fl_Light_Button";}
|
|
|
|
Fl_Widget *widget(int x,int y,int w,int h) {
|
|
|
|
return new Fl_Light_Button(x,y,w,h,"button");}
|
|
|
|
Fl_Widget_Type *_make() {return new Fl_Light_Button_Type();}
|
2002-10-31 00:08:39 +03:00
|
|
|
int pixmapID() { return 24; }
|
1998-10-06 22:21:25 +04:00
|
|
|
};
|
|
|
|
static Fl_Light_Button_Type Fl_Light_Button_type;
|
|
|
|
|
|
|
|
////////////////////////////////////////////////////////////////
|
|
|
|
|
|
|
|
#include <FL/Fl_Check_Button.H>
|
|
|
|
class Fl_Check_Button_Type : public Fl_Button_Type {
|
|
|
|
public:
|
2005-03-08 02:55:49 +03:00
|
|
|
virtual void ideal_size(int &w, int &h) {
|
2005-03-19 07:09:32 +03:00
|
|
|
Fl_Button_Type::ideal_size(w, h);
|
|
|
|
w += 4;
|
2005-03-08 02:55:49 +03:00
|
|
|
}
|
1998-10-06 22:21:25 +04:00
|
|
|
virtual const char *type_name() {return "Fl_Check_Button";}
|
|
|
|
Fl_Widget *widget(int x,int y,int w,int h) {
|
|
|
|
return new Fl_Check_Button(x,y,w,h,"button");}
|
|
|
|
Fl_Widget_Type *_make() {return new Fl_Check_Button_Type();}
|
2002-10-31 00:08:39 +03:00
|
|
|
int pixmapID() { return 3; }
|
1998-10-06 22:21:25 +04:00
|
|
|
};
|
|
|
|
static Fl_Check_Button_Type Fl_Check_Button_type;
|
|
|
|
|
|
|
|
////////////////////////////////////////////////////////////////
|
|
|
|
|
|
|
|
#include <FL/Fl_Round_Button.H>
|
|
|
|
class Fl_Round_Button_Type : public Fl_Button_Type {
|
|
|
|
public:
|
2005-03-08 02:55:49 +03:00
|
|
|
virtual void ideal_size(int &w, int &h) {
|
2005-03-19 07:09:32 +03:00
|
|
|
Fl_Button_Type::ideal_size(w, h);
|
|
|
|
w += 4;
|
2005-03-08 02:55:49 +03:00
|
|
|
}
|
1998-10-06 22:21:25 +04:00
|
|
|
virtual const char *type_name() {return "Fl_Round_Button";}
|
|
|
|
Fl_Widget *widget(int x,int y,int w,int h) {
|
|
|
|
return new Fl_Round_Button(x,y,w,h,"button");}
|
|
|
|
Fl_Widget_Type *_make() {return new Fl_Round_Button_Type();}
|
2002-10-31 00:08:39 +03:00
|
|
|
int pixmapID() { return 4; }
|
1998-10-06 22:21:25 +04:00
|
|
|
};
|
|
|
|
static Fl_Round_Button_Type Fl_Round_Button_type;
|
|
|
|
|
|
|
|
////////////////////////////////////////////////////////////////
|
|
|
|
|
1999-11-20 12:17:21 +03:00
|
|
|
extern int compile_only;
|
|
|
|
|
1998-10-06 22:21:25 +04:00
|
|
|
#include <FL/Fl_Browser.H>
|
2001-08-11 20:09:26 +04:00
|
|
|
#include <FL/Fl_Check_Browser.H>
|
2001-09-29 18:38:59 +04:00
|
|
|
#include <FL/Fl_File_Browser.H>
|
2001-08-11 20:09:26 +04:00
|
|
|
|
1998-10-06 22:21:25 +04:00
|
|
|
static Fl_Menu_Item browser_type_menu[] = {
|
|
|
|
{"No Select",0,0,(void*)FL_NORMAL_BROWSER},
|
|
|
|
{"Select",0,0,(void*)FL_SELECT_BROWSER},
|
|
|
|
{"Hold",0,0,(void*)FL_HOLD_BROWSER},
|
|
|
|
{"Multi",0,0,(void*)FL_MULTI_BROWSER},
|
|
|
|
{0}};
|
|
|
|
class Fl_Browser_Type : public Fl_Widget_Type {
|
|
|
|
Fl_Menu_Item *subtypes() {return browser_type_menu;}
|
1999-04-03 19:51:39 +04:00
|
|
|
int textstuff(int w, Fl_Font& f, int& s, Fl_Color& c);
|
1998-10-06 22:21:25 +04:00
|
|
|
public:
|
2005-03-08 02:55:49 +03:00
|
|
|
virtual void ideal_size(int &w, int &h) {
|
|
|
|
Fl_Browser *myo = (Fl_Browser *)o;
|
|
|
|
fl_font(myo->textfont(), myo->textsize());
|
|
|
|
h -= Fl::box_dh(o->box());
|
|
|
|
w -= Fl::box_dw(o->box());
|
|
|
|
int ww = (int)fl_width('m');
|
|
|
|
w = ((w + ww - 1) / ww) * ww + Fl::box_dw(o->box());
|
|
|
|
h = ((h + fl_height() - 1) / fl_height()) * fl_height() +
|
|
|
|
Fl::box_dh(o->box());
|
2005-03-21 00:27:20 +03:00
|
|
|
if (h < 30) h = 30;
|
|
|
|
if (w < 50) w = 50;
|
2005-03-08 02:55:49 +03:00
|
|
|
}
|
1998-10-06 22:21:25 +04:00
|
|
|
virtual const char *type_name() {return "Fl_Browser";}
|
|
|
|
Fl_Widget *widget(int x,int y,int w,int h) {
|
|
|
|
Fl_Browser* b = new Fl_Browser(x,y,w,h);
|
1999-11-20 12:17:21 +03:00
|
|
|
// Fl_Browser::add calls fl_height(), which requires the X display open.
|
|
|
|
// Avoid this when compiling so it works w/o a display:
|
|
|
|
if (!compile_only) {
|
|
|
|
char buffer[20];
|
|
|
|
for (int i = 1; i <= 20; i++) {
|
|
|
|
sprintf(buffer,"Browser Line %d",i);
|
|
|
|
b->add(buffer);
|
|
|
|
}
|
1998-10-06 22:21:25 +04:00
|
|
|
}
|
|
|
|
return b;
|
|
|
|
}
|
|
|
|
Fl_Widget_Type *_make() {return new Fl_Browser_Type();}
|
2002-10-31 00:08:39 +03:00
|
|
|
int pixmapID() { return 31; }
|
1998-10-06 22:21:25 +04:00
|
|
|
};
|
|
|
|
static Fl_Browser_Type Fl_Browser_type;
|
|
|
|
|
1999-04-03 19:51:39 +04:00
|
|
|
int Fl_Browser_Type::textstuff(int w, Fl_Font& f, int& s, Fl_Color& c) {
|
2001-04-13 23:07:40 +04:00
|
|
|
Fl_Browser *myo = (Fl_Browser*)(w==4 ? ((Fl_Widget_Type*)factory)->o : o);
|
1999-04-03 19:51:39 +04:00
|
|
|
switch (w) {
|
|
|
|
case 4:
|
2001-04-13 23:07:40 +04:00
|
|
|
case 0: f = myo->textfont(); s = myo->textsize(); c = myo->textcolor(); break;
|
|
|
|
case 1: myo->textfont(f); break;
|
|
|
|
case 2: myo->textsize(s); break;
|
|
|
|
case 3: myo->textcolor(c); break;
|
1999-04-03 19:51:39 +04:00
|
|
|
}
|
|
|
|
return 1;
|
|
|
|
}
|
|
|
|
|
2001-08-11 20:09:26 +04:00
|
|
|
class Fl_Check_Browser_Type : public Fl_Widget_Type {
|
|
|
|
Fl_Menu_Item *subtypes() {return browser_type_menu;}
|
|
|
|
int textstuff(int w, Fl_Font& f, int& s, Fl_Color& c);
|
|
|
|
public:
|
2005-03-08 02:55:49 +03:00
|
|
|
virtual void ideal_size(int &w, int &h) {
|
|
|
|
Fl_Check_Browser *myo = (Fl_Check_Browser *)o;
|
|
|
|
fl_font(myo->textfont(), myo->textsize());
|
|
|
|
h -= Fl::box_dh(o->box());
|
|
|
|
w -= Fl::box_dw(o->box()) - fl_height();
|
|
|
|
int ww = (int)fl_width('m');
|
|
|
|
w = ((w + ww - 1) / ww) * ww + Fl::box_dw(o->box());
|
|
|
|
h = ((h + fl_height() - 1) / fl_height()) * fl_height() +
|
|
|
|
Fl::box_dh(o->box());
|
2005-03-21 00:27:20 +03:00
|
|
|
if (h < 30) h = 30;
|
|
|
|
if (w < 50) w = 50;
|
2005-03-08 02:55:49 +03:00
|
|
|
}
|
2001-08-11 20:09:26 +04:00
|
|
|
virtual const char *type_name() {return "Fl_Check_Browser";}
|
|
|
|
Fl_Widget *widget(int x,int y,int w,int h) {
|
|
|
|
Fl_Check_Browser* b = new Fl_Check_Browser(x,y,w,h);
|
|
|
|
// Fl_Check_Browser::add calls fl_height(), which requires the X display open.
|
|
|
|
// Avoid this when compiling so it works w/o a display:
|
|
|
|
if (!compile_only) {
|
|
|
|
char buffer[20];
|
|
|
|
for (int i = 1; i <= 20; i++) {
|
|
|
|
sprintf(buffer,"Browser Line %d",i);
|
|
|
|
b->add(buffer);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
return b;
|
|
|
|
}
|
|
|
|
Fl_Widget_Type *_make() {return new Fl_Check_Browser_Type();}
|
2002-10-31 00:08:39 +03:00
|
|
|
int pixmapID() { return 32; }
|
2001-08-11 20:09:26 +04:00
|
|
|
};
|
|
|
|
static Fl_Check_Browser_Type Fl_Check_Browser_type;
|
|
|
|
|
|
|
|
int Fl_Check_Browser_Type::textstuff(int w, Fl_Font& f, int& s, Fl_Color& c) {
|
|
|
|
Fl_Check_Browser *myo = (Fl_Check_Browser*)(w==4 ? ((Fl_Widget_Type*)factory)->o : o);
|
|
|
|
switch (w) {
|
|
|
|
case 4:
|
|
|
|
case 0: f = myo->textfont(); s = myo->textsize(); c = myo->textcolor(); break;
|
|
|
|
case 1: myo->textfont(f); break;
|
|
|
|
case 2: myo->textsize(s); break;
|
|
|
|
case 3: myo->textcolor(c); break;
|
|
|
|
}
|
|
|
|
return 1;
|
|
|
|
}
|
|
|
|
|
2001-09-29 18:38:59 +04:00
|
|
|
class Fl_File_Browser_Type : public Fl_Widget_Type {
|
2001-08-11 20:09:26 +04:00
|
|
|
Fl_Menu_Item *subtypes() {return browser_type_menu;}
|
|
|
|
int textstuff(int w, Fl_Font& f, int& s, Fl_Color& c);
|
|
|
|
public:
|
2005-03-08 02:55:49 +03:00
|
|
|
virtual void ideal_size(int &w, int &h) {
|
|
|
|
Fl_File_Browser *myo = (Fl_File_Browser *)o;
|
|
|
|
fl_font(myo->textfont(), myo->textsize());
|
|
|
|
h -= Fl::box_dh(o->box());
|
|
|
|
w -= Fl::box_dw(o->box()) + fl_height();
|
|
|
|
int ww = (int)fl_width('m');
|
|
|
|
w = ((w + ww - 1) / ww) * ww + Fl::box_dw(o->box());
|
|
|
|
h = ((h + fl_height() - 1) / fl_height()) * fl_height() +
|
|
|
|
Fl::box_dh(o->box());
|
2005-03-21 00:27:20 +03:00
|
|
|
if (h < 30) h = 30;
|
|
|
|
if (w < 50) w = 50;
|
2005-03-08 02:55:49 +03:00
|
|
|
}
|
2001-09-29 18:38:59 +04:00
|
|
|
virtual const char *type_name() {return "Fl_File_Browser";}
|
2001-08-11 20:09:26 +04:00
|
|
|
Fl_Widget *widget(int x,int y,int w,int h) {
|
2001-09-29 18:38:59 +04:00
|
|
|
Fl_File_Browser* b = new Fl_File_Browser(x,y,w,h);
|
|
|
|
// Fl_File_Browser::add calls fl_height(), which requires the X display open.
|
2001-08-11 20:09:26 +04:00
|
|
|
// Avoid this when compiling so it works w/o a display:
|
|
|
|
if (!compile_only) {
|
2001-09-29 18:38:59 +04:00
|
|
|
b->load(".");
|
2001-08-11 20:09:26 +04:00
|
|
|
}
|
|
|
|
return b;
|
|
|
|
}
|
2001-09-29 18:38:59 +04:00
|
|
|
Fl_Widget_Type *_make() {return new Fl_File_Browser_Type();}
|
2002-10-31 00:08:39 +03:00
|
|
|
int pixmapID() { return 33; }
|
2001-08-11 20:09:26 +04:00
|
|
|
};
|
2001-09-29 18:38:59 +04:00
|
|
|
static Fl_File_Browser_Type Fl_File_Browser_type;
|
2001-08-11 20:09:26 +04:00
|
|
|
|
2001-09-29 18:38:59 +04:00
|
|
|
int Fl_File_Browser_Type::textstuff(int w, Fl_Font& f, int& s, Fl_Color& c) {
|
|
|
|
Fl_File_Browser *myo = (Fl_File_Browser*)(w==4 ? ((Fl_Widget_Type*)factory)->o : o);
|
2001-08-11 20:09:26 +04:00
|
|
|
switch (w) {
|
|
|
|
case 4:
|
|
|
|
case 0: f = myo->textfont(); s = myo->textsize(); c = myo->textcolor(); break;
|
|
|
|
case 1: myo->textfont(f); break;
|
|
|
|
case 2: myo->textsize(s); break;
|
|
|
|
case 3: myo->textcolor(c); break;
|
|
|
|
}
|
|
|
|
return 1;
|
|
|
|
}
|
|
|
|
|
1998-10-06 22:21:25 +04:00
|
|
|
////////////////////////////////////////////////////////////////
|
|
|
|
|
|
|
|
#include <FL/Fl_Counter.H>
|
|
|
|
static Fl_Menu_Item counter_type_menu[] = {
|
|
|
|
{"Normal",0,0,(void*)FL_NORMAL_COUNTER},
|
|
|
|
{"Simple",0,0,(void*)FL_SIMPLE_COUNTER},
|
|
|
|
{0}};
|
|
|
|
class Fl_Counter_Type : public Fl_Widget_Type {
|
|
|
|
Fl_Menu_Item *subtypes() {return counter_type_menu;}
|
1999-04-03 19:51:39 +04:00
|
|
|
int textstuff(int w, Fl_Font& f, int& s, Fl_Color& c);
|
1998-10-06 22:21:25 +04:00
|
|
|
int is_valuator() const {return 1;}
|
2002-10-31 00:08:39 +03:00
|
|
|
int pixmapID() { return 41; }
|
1998-10-06 22:21:25 +04:00
|
|
|
public:
|
|
|
|
virtual const char *type_name() {return "Fl_Counter";}
|
|
|
|
Fl_Widget *widget(int x,int y,int w,int h) {
|
|
|
|
return new Fl_Counter(x,y,w,h,"counter:");}
|
|
|
|
Fl_Widget_Type *_make() {return new Fl_Counter_Type();}
|
|
|
|
};
|
|
|
|
static Fl_Counter_Type Fl_Counter_type;
|
|
|
|
|
1999-04-03 19:51:39 +04:00
|
|
|
int Fl_Counter_Type::textstuff(int w, Fl_Font& f, int& s, Fl_Color& c) {
|
2001-04-13 23:07:40 +04:00
|
|
|
Fl_Counter *myo = (Fl_Counter*)(w==4 ? ((Fl_Widget_Type*)factory)->o : o);
|
1999-04-03 19:51:39 +04:00
|
|
|
switch (w) {
|
|
|
|
case 4:
|
2001-04-13 23:07:40 +04:00
|
|
|
case 0: f = myo->textfont(); s = myo->textsize(); c = myo->textcolor(); break;
|
|
|
|
case 1: myo->textfont(f); break;
|
|
|
|
case 2: myo->textsize(s); break;
|
|
|
|
case 3: myo->textcolor(c); break;
|
1999-04-03 19:51:39 +04:00
|
|
|
}
|
|
|
|
return 1;
|
|
|
|
}
|
|
|
|
|
1998-10-06 22:21:25 +04:00
|
|
|
////////////////////////////////////////////////////////////////
|
|
|
|
|
2005-03-21 02:38:14 +03:00
|
|
|
#include <FL/Fl_Spinner.H>
|
|
|
|
class Fl_Spinner_Type : public Fl_Widget_Type {
|
|
|
|
Fl_Menu_Item *subtypes() {return 0;}
|
|
|
|
int textstuff(int w, Fl_Font& f, int& s, Fl_Color& c);
|
|
|
|
int pixmapID() { return 47; }
|
|
|
|
public:
|
|
|
|
virtual void ideal_size(int &w, int &h) {
|
|
|
|
Fl_Spinner *myo = (Fl_Spinner *)o;
|
|
|
|
fl_font(myo->textfont(), myo->textsize());
|
|
|
|
h = fl_height() + myo->textsize() - 6;
|
|
|
|
if (h < 15) h = 15;
|
|
|
|
w -= Fl::box_dw(o->box());
|
|
|
|
int ww = (int)fl_width('m');
|
|
|
|
w = ((w + ww - 1) / ww) * ww + Fl::box_dw(o->box()) + h / 2;
|
|
|
|
if (w < 40) w = 40 ;
|
|
|
|
}
|
|
|
|
virtual const char *type_name() {return "Fl_Spinner";}
|
|
|
|
Fl_Widget *widget(int x,int y,int w,int h) {
|
|
|
|
return new Fl_Spinner(x,y,w,h,"spinner:");}
|
|
|
|
Fl_Widget_Type *_make() {return new Fl_Spinner_Type();}
|
|
|
|
};
|
|
|
|
static Fl_Spinner_Type Fl_Spinner_type;
|
|
|
|
|
|
|
|
int Fl_Spinner_Type::textstuff(int w, Fl_Font& f, int& s, Fl_Color& c) {
|
|
|
|
Fl_Spinner *myo = (Fl_Spinner*)(w==4 ? ((Fl_Widget_Type*)factory)->o : o);
|
|
|
|
switch (w) {
|
|
|
|
case 4:
|
|
|
|
case 0: f = (Fl_Font)myo->textfont(); s = myo->textsize(); c = myo->textcolor(); break;
|
|
|
|
case 1: myo->textfont(f); break;
|
|
|
|
case 2: myo->textsize(s); break;
|
|
|
|
case 3: myo->textcolor(c); break;
|
|
|
|
}
|
|
|
|
return 1;
|
|
|
|
}
|
|
|
|
|
|
|
|
////////////////////////////////////////////////////////////////
|
|
|
|
|
1998-10-06 22:21:25 +04:00
|
|
|
#include <FL/Fl_Input.H>
|
|
|
|
static Fl_Menu_Item input_type_menu[] = {
|
|
|
|
{"Normal",0,0,(void*)FL_NORMAL_INPUT},
|
|
|
|
{"Multiline",0,0,(void*)FL_MULTILINE_INPUT},
|
|
|
|
{"Secret",0,0,(void*)FL_SECRET_INPUT},
|
|
|
|
{"Int",0,0,(void*)FL_INT_INPUT},
|
|
|
|
{"Float",0,0,(void*)FL_FLOAT_INPUT},
|
|
|
|
{0}};
|
|
|
|
class Fl_Input_Type : public Fl_Widget_Type {
|
|
|
|
Fl_Menu_Item *subtypes() {return input_type_menu;}
|
1999-04-03 19:51:39 +04:00
|
|
|
int textstuff(int w, Fl_Font& f, int& s, Fl_Color& c);
|
1998-10-06 22:21:25 +04:00
|
|
|
public:
|
2005-03-08 02:55:49 +03:00
|
|
|
virtual void ideal_size(int &w, int &h) {
|
|
|
|
Fl_Input *myo = (Fl_Input *)o;
|
|
|
|
fl_font(myo->textfont(), myo->textsize());
|
|
|
|
h = fl_height() + myo->textsize() - 6;
|
|
|
|
w -= Fl::box_dw(o->box());
|
|
|
|
int ww = (int)fl_width('m');
|
|
|
|
w = ((w + ww - 1) / ww) * ww + Fl::box_dw(o->box());
|
2005-03-21 00:27:20 +03:00
|
|
|
if (h < 15) h = 15;
|
|
|
|
if (w < 15) w = 15;
|
2005-03-08 02:55:49 +03:00
|
|
|
}
|
1998-10-06 22:21:25 +04:00
|
|
|
virtual const char *type_name() {return "Fl_Input";}
|
|
|
|
Fl_Widget *widget(int x,int y,int w,int h) {
|
2001-04-13 23:07:40 +04:00
|
|
|
Fl_Input *myo = new Fl_Input(x,y,w,h,"input:");
|
|
|
|
myo->value("Text Input");
|
|
|
|
return myo;
|
1998-10-06 22:21:25 +04:00
|
|
|
}
|
|
|
|
Fl_Widget_Type *_make() {return new Fl_Input_Type();}
|
2002-10-31 00:08:39 +03:00
|
|
|
int pixmapID() { return 14; }
|
2005-07-20 15:11:51 +04:00
|
|
|
virtual void copy_properties() {
|
|
|
|
Fl_Widget_Type::copy_properties();
|
|
|
|
Fl_Input_ *d = (Fl_Input_*)live_widget, *s = (Fl_Input_*)o;
|
|
|
|
d->textfont(s->textfont());
|
|
|
|
d->textsize(s->textsize());
|
|
|
|
d->textcolor(s->textcolor());
|
|
|
|
}
|
1998-10-06 22:21:25 +04:00
|
|
|
};
|
|
|
|
static Fl_Input_Type Fl_Input_type;
|
|
|
|
|
1999-04-03 19:51:39 +04:00
|
|
|
int Fl_Input_Type::textstuff(int w, Fl_Font& f, int& s, Fl_Color& c) {
|
2001-04-13 23:07:40 +04:00
|
|
|
Fl_Input_ *myo = (Fl_Input_*)(w==4 ? ((Fl_Widget_Type*)factory)->o : o);
|
1999-04-03 19:51:39 +04:00
|
|
|
switch (w) {
|
|
|
|
case 4:
|
2001-04-13 23:07:40 +04:00
|
|
|
case 0: f = myo->textfont(); s = myo->textsize(); c = myo->textcolor(); break;
|
|
|
|
case 1: myo->textfont(f); break;
|
|
|
|
case 2: myo->textsize(s); break;
|
|
|
|
case 3: myo->textcolor(c); break;
|
1999-04-03 19:51:39 +04:00
|
|
|
}
|
|
|
|
return 1;
|
|
|
|
}
|
|
|
|
|
1998-10-06 22:21:25 +04:00
|
|
|
////////////////////////////////////////////////////////////////
|
|
|
|
|
2002-05-01 12:51:59 +04:00
|
|
|
#include <FL/Fl_File_Input.H>
|
|
|
|
class Fl_File_Input_Type : public Fl_Widget_Type {
|
|
|
|
Fl_Menu_Item *subtypes() {return 0;}
|
|
|
|
int textstuff(int w, Fl_Font& f, int& s, Fl_Color& c);
|
|
|
|
public:
|
2005-03-08 02:55:49 +03:00
|
|
|
virtual void ideal_size(int &w, int &h) {
|
|
|
|
Fl_File_Input *myo = (Fl_File_Input *)o;
|
|
|
|
fl_font(myo->textfont(), myo->textsize());
|
|
|
|
h = fl_height() + myo->textsize() + 4;
|
|
|
|
w -= Fl::box_dw(o->box());
|
|
|
|
int ww = (int)fl_width('m');
|
|
|
|
w = ((w + ww - 1) / ww) * ww + Fl::box_dw(o->box());
|
2005-03-21 00:27:20 +03:00
|
|
|
if (h < 20) h = 20;
|
|
|
|
if (w < 50) w = 50;
|
2005-03-08 02:55:49 +03:00
|
|
|
}
|
2002-05-01 12:51:59 +04:00
|
|
|
virtual const char *type_name() {return "Fl_File_Input";}
|
|
|
|
Fl_Widget *widget(int x,int y,int w,int h) {
|
|
|
|
Fl_File_Input *myo = new Fl_File_Input(x,y,w,h,"file:");
|
|
|
|
myo->value("/now/is/the/time/for/a/filename.ext");
|
|
|
|
return myo;
|
|
|
|
}
|
|
|
|
Fl_Widget_Type *_make() {return new Fl_File_Input_Type();}
|
2002-10-31 00:08:39 +03:00
|
|
|
int pixmapID() { return 30; }
|
2002-05-01 12:51:59 +04:00
|
|
|
};
|
|
|
|
static Fl_File_Input_Type Fl_File_Input_type;
|
|
|
|
|
|
|
|
int Fl_File_Input_Type::textstuff(int w, Fl_Font& f, int& s, Fl_Color& c) {
|
|
|
|
Fl_File_Input *myo = (Fl_File_Input*)(w==4 ? ((Fl_Widget_Type*)factory)->o : o);
|
|
|
|
switch (w) {
|
|
|
|
case 4:
|
|
|
|
case 0: f = myo->textfont(); s = myo->textsize(); c = myo->textcolor(); break;
|
|
|
|
case 1: myo->textfont(f); break;
|
|
|
|
case 2: myo->textsize(s); break;
|
|
|
|
case 3: myo->textcolor(c); break;
|
|
|
|
}
|
|
|
|
return 1;
|
|
|
|
}
|
|
|
|
|
|
|
|
////////////////////////////////////////////////////////////////
|
|
|
|
|
2001-08-11 20:09:26 +04:00
|
|
|
#include <FL/Fl_Text_Display.H>
|
|
|
|
class Fl_Text_Display_Type : public Fl_Widget_Type {
|
|
|
|
int textstuff(int w, Fl_Font& f, int& s, Fl_Color& c);
|
|
|
|
public:
|
2005-03-08 02:55:49 +03:00
|
|
|
virtual void ideal_size(int &w, int &h) {
|
|
|
|
Fl_Text_Display *myo = (Fl_Text_Display *)o;
|
|
|
|
fl_font(myo->textfont(), myo->textsize());
|
|
|
|
h -= Fl::box_dh(o->box());
|
|
|
|
w -= Fl::box_dw(o->box());
|
|
|
|
int ww = (int)fl_width('m');
|
|
|
|
w = ((w + ww - 1) / ww) * ww + Fl::box_dw(o->box());
|
|
|
|
h = ((h + fl_height() - 1) / fl_height()) * fl_height() +
|
|
|
|
Fl::box_dh(o->box());
|
2005-03-21 00:27:20 +03:00
|
|
|
if (h < 30) h = 30;
|
|
|
|
if (w < 50) w = 50;
|
2005-03-08 02:55:49 +03:00
|
|
|
}
|
2001-08-11 20:09:26 +04:00
|
|
|
virtual const char *type_name() {return "Fl_Text_Display";}
|
|
|
|
Fl_Widget *widget(int x,int y,int w,int h) {
|
|
|
|
Fl_Text_Display *myo = new Fl_Text_Display(x,y,w,h);
|
|
|
|
return myo;
|
|
|
|
}
|
|
|
|
Fl_Widget_Type *_make() {return new Fl_Text_Display_Type();}
|
2002-10-31 00:08:39 +03:00
|
|
|
int pixmapID() { return 28; }
|
2001-08-11 20:09:26 +04:00
|
|
|
};
|
|
|
|
static Fl_Text_Display_Type Fl_Text_Display_type;
|
|
|
|
|
|
|
|
int Fl_Text_Display_Type::textstuff(int w, Fl_Font& f, int& s, Fl_Color& c) {
|
|
|
|
Fl_Text_Display *myo = (Fl_Text_Display*)(w==4 ? ((Fl_Widget_Type*)factory)->o : o);
|
|
|
|
switch (w) {
|
|
|
|
case 4:
|
|
|
|
case 0: f = myo->textfont(); s = myo->textsize(); c = myo->textcolor(); break;
|
|
|
|
case 1: myo->textfont(f); break;
|
|
|
|
case 2: myo->textsize(s); break;
|
|
|
|
case 3: myo->textcolor(c); break;
|
|
|
|
}
|
|
|
|
return 1;
|
|
|
|
}
|
|
|
|
|
|
|
|
////////////////////////////////////////////////////////////////
|
|
|
|
|
|
|
|
#include <FL/Fl_Text_Editor.H>
|
|
|
|
class Fl_Text_Editor_Type : public Fl_Widget_Type {
|
|
|
|
int textstuff(int w, Fl_Font& f, int& s, Fl_Color& c);
|
|
|
|
public:
|
2005-03-08 02:55:49 +03:00
|
|
|
virtual void ideal_size(int &w, int &h) {
|
|
|
|
Fl_Text_Editor *myo = (Fl_Text_Editor *)o;
|
|
|
|
fl_font(myo->textfont(), myo->textsize());
|
|
|
|
h -= Fl::box_dh(o->box());
|
|
|
|
w -= Fl::box_dw(o->box());
|
|
|
|
int ww = (int)fl_width('m');
|
|
|
|
w = ((w + ww - 1) / ww) * ww + Fl::box_dw(o->box());
|
|
|
|
h = ((h + fl_height() - 1) / fl_height()) * fl_height() +
|
|
|
|
Fl::box_dh(o->box());
|
2005-03-21 00:27:20 +03:00
|
|
|
if (h < 30) h = 30;
|
|
|
|
if (w < 50) w = 50;
|
2005-03-08 02:55:49 +03:00
|
|
|
}
|
2001-08-11 20:09:26 +04:00
|
|
|
virtual const char *type_name() {return "Fl_Text_Editor";}
|
|
|
|
Fl_Widget *widget(int x,int y,int w,int h) {
|
|
|
|
Fl_Text_Editor *myo = new Fl_Text_Editor(x,y,w,h);
|
|
|
|
return myo;
|
|
|
|
}
|
|
|
|
Fl_Widget_Type *_make() {return new Fl_Text_Editor_Type();}
|
2002-10-31 00:08:39 +03:00
|
|
|
int pixmapID() { return 29; }
|
2001-08-11 20:09:26 +04:00
|
|
|
};
|
|
|
|
static Fl_Text_Editor_Type Fl_Text_Editor_type;
|
|
|
|
|
|
|
|
int Fl_Text_Editor_Type::textstuff(int w, Fl_Font& f, int& s, Fl_Color& c) {
|
|
|
|
Fl_Text_Editor *myo = (Fl_Text_Editor*)(w==4 ? ((Fl_Widget_Type*)factory)->o : o);
|
|
|
|
switch (w) {
|
|
|
|
case 4:
|
|
|
|
case 0: f = myo->textfont(); s = myo->textsize(); c = myo->textcolor(); break;
|
|
|
|
case 1: myo->textfont(f); break;
|
|
|
|
case 2: myo->textsize(s); break;
|
|
|
|
case 3: myo->textcolor(c); break;
|
|
|
|
}
|
|
|
|
return 1;
|
|
|
|
}
|
|
|
|
|
|
|
|
////////////////////////////////////////////////////////////////
|
|
|
|
|
1998-10-06 22:21:25 +04:00
|
|
|
#include <FL/Fl_Clock.H>
|
|
|
|
class Fl_Clock_Type : public Fl_Widget_Type {
|
|
|
|
public:
|
|
|
|
virtual const char *type_name() {return "Fl_Clock";}
|
|
|
|
Fl_Widget *widget(int x,int y,int w,int h) {
|
|
|
|
return new Fl_Clock(x,y,w,h);}
|
|
|
|
Fl_Widget_Type *_make() {return new Fl_Clock_Type();}
|
2002-10-31 00:08:39 +03:00
|
|
|
int pixmapID() { return 34; }
|
1998-10-06 22:21:25 +04:00
|
|
|
};
|
|
|
|
static Fl_Clock_Type Fl_Clock_type;
|
|
|
|
|
|
|
|
////////////////////////////////////////////////////////////////
|
|
|
|
|
2001-09-29 18:38:59 +04:00
|
|
|
#include <FL/Fl_Help_View.H>
|
|
|
|
class Fl_Help_View_Type : public Fl_Widget_Type {
|
2001-08-11 20:09:26 +04:00
|
|
|
public:
|
2005-03-08 02:55:49 +03:00
|
|
|
virtual void ideal_size(int &w, int &h) {
|
|
|
|
Fl_Help_View *myo = (Fl_Help_View *)o;
|
|
|
|
fl_font(myo->textfont(), myo->textsize());
|
|
|
|
h -= Fl::box_dh(o->box());
|
|
|
|
w -= Fl::box_dw(o->box());
|
|
|
|
int ww = (int)fl_width('m');
|
|
|
|
w = ((w + ww - 1) / ww) * ww + Fl::box_dw(o->box());
|
|
|
|
h = ((h + fl_height() - 1) / fl_height()) * fl_height() +
|
|
|
|
Fl::box_dh(o->box());
|
2005-03-21 00:27:20 +03:00
|
|
|
if (h < 30) h = 30;
|
|
|
|
if (w < 50) w = 50;
|
2005-03-08 02:55:49 +03:00
|
|
|
}
|
2001-09-29 18:38:59 +04:00
|
|
|
virtual const char *type_name() {return "Fl_Help_View";}
|
2001-08-11 20:09:26 +04:00
|
|
|
Fl_Widget *widget(int x,int y,int w,int h) {
|
2001-09-29 18:38:59 +04:00
|
|
|
Fl_Help_View *myo = new Fl_Help_View(x,y,w,h);
|
|
|
|
myo->value("<HTML><BODY><H1>Fl_Help_View Widget</H1>"
|
|
|
|
"<P>This is a Fl_Help_View widget.</P></BODY></HTML>");
|
2001-08-11 20:09:26 +04:00
|
|
|
return myo;}
|
2001-09-29 18:38:59 +04:00
|
|
|
Fl_Widget_Type *_make() {return new Fl_Help_View_Type();}
|
2002-10-31 00:08:39 +03:00
|
|
|
int pixmapID() { return 35; }
|
2001-08-11 20:09:26 +04:00
|
|
|
};
|
2001-09-29 18:38:59 +04:00
|
|
|
static Fl_Help_View_Type Fl_Help_View_type;
|
2001-08-11 20:09:26 +04:00
|
|
|
|
|
|
|
////////////////////////////////////////////////////////////////
|
|
|
|
|
|
|
|
#include <FL/Fl_Progress.H>
|
|
|
|
class Fl_Progress_Type : public Fl_Widget_Type {
|
|
|
|
public:
|
|
|
|
virtual const char *type_name() {return "Fl_Progress";}
|
|
|
|
Fl_Widget *widget(int x,int y,int w,int h) {
|
2005-03-19 07:09:32 +03:00
|
|
|
Fl_Progress *myo = new Fl_Progress(x,y,w,h,"label");
|
2001-08-11 20:09:26 +04:00
|
|
|
myo->value(50);
|
|
|
|
return myo;}
|
|
|
|
Fl_Widget_Type *_make() {return new Fl_Progress_Type();}
|
2002-10-31 00:08:39 +03:00
|
|
|
int pixmapID() { return 36; }
|
2001-08-11 20:09:26 +04:00
|
|
|
};
|
|
|
|
static Fl_Progress_Type Fl_Progress_type;
|
|
|
|
|
|
|
|
////////////////////////////////////////////////////////////////
|
|
|
|
|
1998-10-06 22:21:25 +04:00
|
|
|
#include <FL/Fl_Adjuster.H>
|
|
|
|
class Fl_Adjuster_Type : public Fl_Widget_Type {
|
|
|
|
int is_valuator() const {return 1;}
|
|
|
|
public:
|
|
|
|
virtual const char *type_name() {return "Fl_Adjuster";}
|
|
|
|
Fl_Widget *widget(int x,int y,int w,int h) {
|
|
|
|
return new Fl_Adjuster(x,y,w,h);}
|
|
|
|
Fl_Widget_Type *_make() {return new Fl_Adjuster_Type();}
|
2002-10-31 00:08:39 +03:00
|
|
|
int pixmapID() { return 40; }
|
1998-10-06 22:21:25 +04:00
|
|
|
};
|
|
|
|
static Fl_Adjuster_Type Fl_Adjuster_type;
|
|
|
|
|
|
|
|
////////////////////////////////////////////////////////////////
|
|
|
|
|
|
|
|
#include <FL/Fl_Dial.H>
|
|
|
|
static Fl_Menu_Item dial_type_menu[] = {
|
|
|
|
{"Dot",0,0,(void*)0},
|
|
|
|
{"Line",0,0,(void*)FL_LINE_DIAL},
|
|
|
|
{"Fill",0,0,(void*)FL_FILL_DIAL},
|
|
|
|
{0}};
|
|
|
|
class Fl_Dial_Type : public Fl_Widget_Type {
|
|
|
|
Fl_Menu_Item *subtypes() {return dial_type_menu;}
|
|
|
|
int is_valuator() const {return 1;}
|
|
|
|
public:
|
|
|
|
virtual const char *type_name() {return "Fl_Dial";}
|
|
|
|
Fl_Widget *widget(int x,int y,int w,int h) {
|
|
|
|
return new Fl_Dial(x,y,w,h);}
|
|
|
|
Fl_Widget_Type *_make() {return new Fl_Dial_Type();}
|
2002-10-31 00:08:39 +03:00
|
|
|
int pixmapID() { return 42; }
|
1998-10-06 22:21:25 +04:00
|
|
|
};
|
|
|
|
static Fl_Dial_Type Fl_Dial_type;
|
|
|
|
|
|
|
|
////////////////////////////////////////////////////////////////
|
|
|
|
|
|
|
|
#include <FL/Fl_Roller.H>
|
|
|
|
static Fl_Menu_Item roller_type_menu[] = {
|
|
|
|
{"Vertical",0,0,(void*)0},
|
|
|
|
{"Horizontal",0,0,(void*)FL_HORIZONTAL},
|
|
|
|
{0}};
|
|
|
|
class Fl_Roller_Type : public Fl_Widget_Type {
|
|
|
|
Fl_Menu_Item *subtypes() {return roller_type_menu;}
|
|
|
|
int is_valuator() const {return 1;}
|
|
|
|
public:
|
|
|
|
virtual const char *type_name() {return "Fl_Roller";}
|
|
|
|
Fl_Widget *widget(int x,int y,int w,int h) {
|
|
|
|
return new Fl_Roller(x,y,w,h);}
|
|
|
|
Fl_Widget_Type *_make() {return new Fl_Roller_Type();}
|
2002-10-31 00:08:39 +03:00
|
|
|
int pixmapID() { return 43; }
|
1998-10-06 22:21:25 +04:00
|
|
|
};
|
|
|
|
static Fl_Roller_Type Fl_Roller_type;
|
|
|
|
|
|
|
|
////////////////////////////////////////////////////////////////
|
|
|
|
|
|
|
|
#include <FL/Fl_Scrollbar.H>
|
|
|
|
static Fl_Menu_Item slider_type_menu[] = {
|
|
|
|
{"Vertical",0,0,(void*)FL_VERT_SLIDER},
|
|
|
|
{"Horizontal",0,0,(void*)FL_HOR_SLIDER},
|
|
|
|
{"Vert Fill",0,0,(void*)FL_VERT_FILL_SLIDER},
|
|
|
|
{"Horz Fill",0,0,(void*)FL_HOR_FILL_SLIDER},
|
|
|
|
{"Vert Knob",0,0,(void*)FL_VERT_NICE_SLIDER},
|
|
|
|
{"Horz Knob",0,0,(void*)FL_HOR_NICE_SLIDER},
|
|
|
|
{0}};
|
|
|
|
class Fl_Slider_Type : public Fl_Widget_Type {
|
|
|
|
Fl_Menu_Item *subtypes() {return slider_type_menu;}
|
|
|
|
int is_valuator() const {return 2;}
|
|
|
|
public:
|
|
|
|
virtual const char *type_name() {return "Fl_Slider";}
|
|
|
|
Fl_Widget *widget(int x,int y,int w,int h) {
|
2005-03-19 07:09:32 +03:00
|
|
|
return new Fl_Slider(x,y,w,h,"slider:");}
|
1998-10-06 22:21:25 +04:00
|
|
|
Fl_Widget_Type *_make() {return new Fl_Slider_Type();}
|
2002-10-31 00:08:39 +03:00
|
|
|
int pixmapID() { return 37; }
|
1998-10-06 22:21:25 +04:00
|
|
|
};
|
|
|
|
static Fl_Slider_Type Fl_Slider_type;
|
|
|
|
|
|
|
|
static Fl_Menu_Item scrollbar_type_menu[] = {
|
|
|
|
{"Vertical",0,0,(void*)FL_VERT_SLIDER},
|
|
|
|
{"Horizontal",0,0,(void*)FL_HOR_SLIDER},
|
|
|
|
{0}};
|
|
|
|
class Fl_Scrollbar_Type : public Fl_Slider_Type {
|
|
|
|
Fl_Menu_Item *subtypes() {return scrollbar_type_menu;}
|
|
|
|
public:
|
|
|
|
virtual const char *type_name() {return "Fl_Scrollbar";}
|
|
|
|
Fl_Widget *widget(int x,int y,int w,int h) {
|
|
|
|
return new Fl_Scrollbar(x,y,w,h);}
|
|
|
|
Fl_Widget_Type *_make() {return new Fl_Scrollbar_Type();}
|
2002-10-31 00:08:39 +03:00
|
|
|
int pixmapID() { return 38; }
|
1998-10-06 22:21:25 +04:00
|
|
|
};
|
|
|
|
static Fl_Scrollbar_Type Fl_Scrollbar_type;
|
|
|
|
|
|
|
|
////////////////////////////////////////////////////////////////
|
|
|
|
|
|
|
|
#include <FL/Fl_Output.H>
|
|
|
|
static Fl_Menu_Item output_type_menu[] = {
|
2002-04-11 15:52:43 +04:00
|
|
|
{"Normal",0,0,(void*)FL_NORMAL_OUTPUT},
|
|
|
|
{"Multiline",0,0,(void*)FL_MULTILINE_OUTPUT},
|
1998-10-06 22:21:25 +04:00
|
|
|
{0}};
|
|
|
|
class Fl_Output_Type : public Fl_Input_Type {
|
|
|
|
Fl_Menu_Item *subtypes() {return output_type_menu;}
|
|
|
|
public:
|
2005-03-08 02:55:49 +03:00
|
|
|
virtual void ideal_size(int &w, int &h) {
|
|
|
|
Fl_Output *myo = (Fl_Output *)o;
|
|
|
|
fl_font(myo->textfont(), myo->textsize());
|
|
|
|
h = fl_height() + myo->textsize() - 6;
|
|
|
|
w -= Fl::box_dw(o->box());
|
|
|
|
int ww = (int)fl_width('m');
|
|
|
|
w = ((w + ww - 1) / ww) * ww + Fl::box_dw(o->box());
|
2005-03-21 00:27:20 +03:00
|
|
|
if (h < 15) h = 15;
|
|
|
|
if (w < 15) w = 15;
|
2005-03-08 02:55:49 +03:00
|
|
|
}
|
1998-10-06 22:21:25 +04:00
|
|
|
virtual const char *type_name() {return "Fl_Output";}
|
|
|
|
Fl_Widget *widget(int x,int y,int w,int h) {
|
2001-04-13 23:07:40 +04:00
|
|
|
Fl_Output *myo = new Fl_Output(x,y,w,h,"output:");
|
|
|
|
myo->value("Text Output");
|
|
|
|
return myo;
|
1998-10-06 22:21:25 +04:00
|
|
|
}
|
|
|
|
Fl_Widget_Type *_make() {return new Fl_Output_Type();}
|
2002-10-31 00:08:39 +03:00
|
|
|
int pixmapID() { return 27; }
|
1998-10-06 22:21:25 +04:00
|
|
|
};
|
|
|
|
static Fl_Output_Type Fl_Output_type;
|
|
|
|
|
|
|
|
////////////////////////////////////////////////////////////////
|
|
|
|
|
|
|
|
#include <FL/Fl_Value_Input.H>
|
|
|
|
class Fl_Value_Input_Type : public Fl_Widget_Type {
|
|
|
|
public:
|
2005-03-08 02:55:49 +03:00
|
|
|
virtual void ideal_size(int &w, int &h) {
|
|
|
|
Fl_Value_Input *myo = (Fl_Value_Input *)o;
|
|
|
|
fl_font(myo->textfont(), myo->textsize());
|
|
|
|
h = fl_height() + myo->textsize() - 6;
|
|
|
|
w -= Fl::box_dw(o->box());
|
|
|
|
int ww = (int)fl_width('m');
|
|
|
|
w = ((w + ww - 1) / ww) * ww + Fl::box_dw(o->box());
|
2005-03-21 00:27:20 +03:00
|
|
|
if (h < 15) h = 15;
|
|
|
|
if (w < 15) w = 15;
|
2005-03-08 02:55:49 +03:00
|
|
|
}
|
1998-10-06 22:21:25 +04:00
|
|
|
virtual const char *type_name() {return "Fl_Value_Input";}
|
1999-04-03 19:51:39 +04:00
|
|
|
int textstuff(int w, Fl_Font& f, int& s, Fl_Color& c);
|
1998-10-06 22:21:25 +04:00
|
|
|
int is_valuator() const {return 1;}
|
|
|
|
Fl_Widget *widget(int x,int y,int w,int h) {
|
2001-04-13 23:07:40 +04:00
|
|
|
Fl_Value_Input *myo = new Fl_Value_Input(x,y,w,h,"value:");
|
|
|
|
return myo;
|
1998-10-06 22:21:25 +04:00
|
|
|
}
|
|
|
|
Fl_Widget_Type *_make() {return new Fl_Value_Input_Type();}
|
2002-10-31 00:08:39 +03:00
|
|
|
int pixmapID() { return 44; }
|
1998-10-06 22:21:25 +04:00
|
|
|
};
|
|
|
|
static Fl_Value_Input_Type Fl_Value_Input_type;
|
|
|
|
|
1999-04-03 19:51:39 +04:00
|
|
|
int Fl_Value_Input_Type::textstuff(int w, Fl_Font& f, int& s, Fl_Color& c) {
|
2001-04-13 23:07:40 +04:00
|
|
|
Fl_Value_Input *myo = (Fl_Value_Input*)(w==4 ? ((Fl_Widget_Type*)factory)->o : o);
|
1999-04-03 19:51:39 +04:00
|
|
|
switch (w) {
|
1998-10-06 22:21:25 +04:00
|
|
|
case 4:
|
2001-04-13 23:07:40 +04:00
|
|
|
case 0: f = myo->textfont(); s = myo->textsize(); c = myo->textcolor(); break;
|
|
|
|
case 1: myo->textfont(f); break;
|
|
|
|
case 2: myo->textsize(s); break;
|
|
|
|
case 3: myo->textcolor(c); break;
|
1998-10-06 22:21:25 +04:00
|
|
|
}
|
1999-04-03 19:51:39 +04:00
|
|
|
return 1;
|
|
|
|
}
|
|
|
|
|
|
|
|
////////////////////////////////////////////////////////////////
|
|
|
|
|
|
|
|
#include <FL/Fl_Value_Output.H>
|
|
|
|
class Fl_Value_Output_Type : public Fl_Widget_Type {
|
|
|
|
public:
|
2005-03-08 02:55:49 +03:00
|
|
|
virtual void ideal_size(int &w, int &h) {
|
|
|
|
Fl_Value_Output *myo = (Fl_Value_Output *)o;
|
|
|
|
fl_font(myo->textfont(), myo->textsize());
|
|
|
|
h = fl_height() + myo->textsize() - 6;
|
|
|
|
w = o->w() - Fl::box_dw(o->box());
|
|
|
|
int ww = (int)fl_width('m');
|
|
|
|
w = ((w + ww - 1) / ww) * ww + Fl::box_dw(o->box());
|
2005-03-21 00:27:20 +03:00
|
|
|
if (h < 15) h = 15;
|
|
|
|
if (w < 15) w = 15;
|
2005-03-08 02:55:49 +03:00
|
|
|
}
|
1999-04-03 19:51:39 +04:00
|
|
|
virtual const char *type_name() {return "Fl_Value_Output";}
|
|
|
|
int textstuff(int w, Fl_Font& f, int& s, Fl_Color& c);
|
1998-10-06 22:21:25 +04:00
|
|
|
int is_valuator() const {return 1;}
|
|
|
|
Fl_Widget *widget(int x,int y,int w,int h) {
|
2001-04-13 23:07:40 +04:00
|
|
|
Fl_Value_Output *myo = new Fl_Value_Output(x,y,w,h,"value:");
|
|
|
|
return myo;
|
1998-10-06 22:21:25 +04:00
|
|
|
}
|
|
|
|
Fl_Widget_Type *_make() {return new Fl_Value_Output_Type();}
|
2002-10-31 00:08:39 +03:00
|
|
|
int pixmapID() { return 45; }
|
1998-10-06 22:21:25 +04:00
|
|
|
};
|
|
|
|
static Fl_Value_Output_Type Fl_Value_Output_type;
|
|
|
|
|
1999-04-03 19:51:39 +04:00
|
|
|
int Fl_Value_Output_Type::textstuff(int w, Fl_Font& f, int& s, Fl_Color& c) {
|
2001-04-13 23:07:40 +04:00
|
|
|
Fl_Value_Output *myo = (Fl_Value_Output*)(w==4 ? ((Fl_Widget_Type*)factory)->o : o);
|
1999-04-03 19:51:39 +04:00
|
|
|
switch (w) {
|
1998-10-06 22:21:25 +04:00
|
|
|
case 4:
|
2001-04-13 23:07:40 +04:00
|
|
|
case 0: f = myo->textfont(); s = myo->textsize(); c = myo->textcolor(); break;
|
|
|
|
case 1: myo->textfont(f); break;
|
|
|
|
case 2: myo->textsize(s); break;
|
|
|
|
case 3: myo->textcolor(c); break;
|
1998-10-06 22:21:25 +04:00
|
|
|
}
|
1999-04-03 19:51:39 +04:00
|
|
|
return 1;
|
|
|
|
}
|
|
|
|
|
|
|
|
////////////////////////////////////////////////////////////////
|
|
|
|
|
|
|
|
#include <FL/Fl_Value_Slider.H>
|
|
|
|
class Fl_Value_Slider_Type : public Fl_Slider_Type {
|
|
|
|
int textstuff(int w, Fl_Font& f, int& s, Fl_Color& c);
|
1998-10-06 22:21:25 +04:00
|
|
|
public:
|
|
|
|
virtual const char *type_name() {return "Fl_Value_Slider";}
|
|
|
|
Fl_Widget *widget(int x,int y,int w,int h) {
|
2005-03-19 07:09:32 +03:00
|
|
|
return new Fl_Value_Slider(x,y,w,h,"slider:");}
|
1998-10-06 22:21:25 +04:00
|
|
|
Fl_Widget_Type *_make() {return new Fl_Value_Slider_Type();}
|
2002-10-31 00:08:39 +03:00
|
|
|
int pixmapID() { return 39; }
|
1998-10-06 22:21:25 +04:00
|
|
|
};
|
|
|
|
static Fl_Value_Slider_Type Fl_Value_Slider_type;
|
|
|
|
|
1999-04-03 19:51:39 +04:00
|
|
|
int Fl_Value_Slider_Type::textstuff(int w, Fl_Font& f, int& s, Fl_Color& c) {
|
2001-04-13 23:07:40 +04:00
|
|
|
Fl_Value_Slider *myo = (Fl_Value_Slider*)(w==4 ? ((Fl_Widget_Type*)factory)->o : o);
|
1999-04-03 19:51:39 +04:00
|
|
|
switch (w) {
|
|
|
|
case 4:
|
2001-04-13 23:07:40 +04:00
|
|
|
case 0: f = myo->textfont(); s = myo->textsize(); c = myo->textcolor(); break;
|
|
|
|
case 1: myo->textfont(f); break;
|
|
|
|
case 2: myo->textsize(s); break;
|
|
|
|
case 3: myo->textcolor(c); break;
|
1999-04-03 19:51:39 +04:00
|
|
|
}
|
|
|
|
return 1;
|
|
|
|
}
|
|
|
|
|
1998-10-06 22:21:25 +04:00
|
|
|
////////////////////////////////////////////////////////////////
|
|
|
|
|
|
|
|
extern class Fl_Function_Type Fl_Function_type;
|
|
|
|
extern class Fl_Code_Type Fl_Code_type;
|
|
|
|
extern class Fl_CodeBlock_Type Fl_CodeBlock_type;
|
|
|
|
extern class Fl_Decl_Type Fl_Decl_type;
|
|
|
|
extern class Fl_DeclBlock_Type Fl_DeclBlock_type;
|
2005-03-10 00:26:53 +03:00
|
|
|
extern class Fl_Comment_Type Fl_Comment_type;
|
1998-10-06 22:21:25 +04:00
|
|
|
extern class Fl_Class_Type Fl_Class_type;
|
|
|
|
extern class Fl_Window_Type Fl_Window_type;
|
2005-03-28 08:23:32 +04:00
|
|
|
extern class Fl_Widget_Class_Type Fl_Widget_Class_type;
|
1998-10-06 22:21:25 +04:00
|
|
|
extern class Fl_Group_Type Fl_Group_type;
|
1999-08-05 13:01:25 +04:00
|
|
|
extern class Fl_Pack_Type Fl_Pack_type;
|
1998-10-06 22:21:25 +04:00
|
|
|
extern class Fl_Tabs_Type Fl_Tabs_type;
|
|
|
|
extern class Fl_Scroll_Type Fl_Scroll_type;
|
|
|
|
extern class Fl_Tile_Type Fl_Tile_type;
|
2005-02-25 00:14:22 +03:00
|
|
|
extern class Fl_Input_Choice_Type Fl_Input_Choice_type;
|
1998-10-06 22:21:25 +04:00
|
|
|
extern class Fl_Choice_Type Fl_Choice_type;
|
|
|
|
extern class Fl_Menu_Bar_Type Fl_Menu_Bar_type;
|
|
|
|
extern class Fl_Menu_Button_Type Fl_Menu_Button_type;
|
|
|
|
extern class Fl_Menu_Item_Type Fl_Menu_Item_type;
|
|
|
|
extern class Fl_Submenu_Type Fl_Submenu_type;
|
2001-08-11 20:09:26 +04:00
|
|
|
extern class Fl_Wizard_Type Fl_Wizard_type;
|
1998-10-06 22:21:25 +04:00
|
|
|
|
|
|
|
extern void select(Fl_Type *,int);
|
|
|
|
extern void select_only(Fl_Type *);
|
|
|
|
|
2005-03-19 07:09:32 +03:00
|
|
|
#include <FL/Fl_Window.H>
|
|
|
|
|
1998-10-06 22:21:25 +04:00
|
|
|
static void cb(Fl_Widget *, void *v) {
|
2005-03-20 07:00:48 +03:00
|
|
|
undo_checkpoint();
|
|
|
|
undo_suspend();
|
1998-10-06 22:21:25 +04:00
|
|
|
Fl_Type *t = ((Fl_Type*)v)->make();
|
2005-03-19 07:09:32 +03:00
|
|
|
if (t) {
|
|
|
|
if (t->is_widget() && !t->is_window()) {
|
|
|
|
Fl_Widget_Type *wt = (Fl_Widget_Type *)t;
|
|
|
|
|
|
|
|
// Set font sizes...
|
|
|
|
wt->o->labelsize(Fl_Widget_Type::default_size);
|
|
|
|
|
|
|
|
Fl_Font f;
|
|
|
|
int s = Fl_Widget_Type::default_size;
|
|
|
|
Fl_Color c;
|
|
|
|
|
|
|
|
wt->textstuff(2, f, s, c);
|
|
|
|
|
|
|
|
// Resize and/or reposition new widget...
|
2005-05-19 19:57:32 +04:00
|
|
|
int w = 0, h = 0;
|
2005-03-19 07:09:32 +03:00
|
|
|
wt->ideal_size(w, h);
|
|
|
|
|
|
|
|
if (!strcmp(wt->type_name(), "Fl_Menu_Bar")) {
|
|
|
|
// Move and resize the menubar across the top of the window...
|
|
|
|
wt->o->resize(0, 0, w, h);
|
|
|
|
} else {
|
|
|
|
// Just resize to the ideal size...
|
|
|
|
wt->o->size(w, h);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
select_only(t);
|
2005-03-19 11:38:21 +03:00
|
|
|
set_modflag(1);
|
2005-03-19 07:09:32 +03:00
|
|
|
t->open();
|
2005-03-20 07:00:48 +03:00
|
|
|
} else {
|
|
|
|
undo_current --;
|
|
|
|
undo_last --;
|
2005-03-19 07:09:32 +03:00
|
|
|
}
|
2005-03-20 07:00:48 +03:00
|
|
|
undo_resume();
|
1998-10-06 22:21:25 +04:00
|
|
|
}
|
|
|
|
|
|
|
|
Fl_Menu_Item New_Menu[] = {
|
2005-03-19 07:09:32 +03:00
|
|
|
{"Code",0,0,0,FL_SUBMENU},
|
2005-03-20 17:35:18 +03:00
|
|
|
{"Function/Method",0,cb,(void*)&Fl_Function_type},
|
|
|
|
{"Code",0,cb,(void*)&Fl_Code_type},
|
|
|
|
{"Code Block",0,cb,(void*)&Fl_CodeBlock_type},
|
|
|
|
{"Declaration",0,cb,(void*)&Fl_Decl_type},
|
|
|
|
{"Declaration Block",0,cb,(void*)&Fl_DeclBlock_type},
|
|
|
|
{"Class",0,cb,(void*)&Fl_Class_type},
|
2005-03-28 08:23:32 +04:00
|
|
|
{"Widget Class",0,cb,(void*)&Fl_Widget_Class_type},
|
2005-03-20 17:35:18 +03:00
|
|
|
{"Comment",0,cb,(void*)&Fl_Comment_type},
|
1998-10-06 22:21:25 +04:00
|
|
|
{0},
|
2005-03-19 07:09:32 +03:00
|
|
|
{"Group",0,0,0,FL_SUBMENU},
|
1998-10-06 22:21:25 +04:00
|
|
|
{0,0,cb,(void*)&Fl_Window_type},
|
|
|
|
{0,0,cb,(void*)&Fl_Group_type},
|
1999-08-05 13:01:25 +04:00
|
|
|
{0,0,cb,(void*)&Fl_Pack_type},
|
1998-10-06 22:21:25 +04:00
|
|
|
{0,0,cb,(void*)&Fl_Tabs_type},
|
|
|
|
{0,0,cb,(void*)&Fl_Scroll_type},
|
|
|
|
{0,0,cb,(void*)&Fl_Tile_type},
|
2001-08-11 20:09:26 +04:00
|
|
|
{0,0,cb,(void*)&Fl_Wizard_type},
|
1998-10-06 22:21:25 +04:00
|
|
|
{0},
|
2005-03-19 07:09:32 +03:00
|
|
|
{"Buttons",0,0,0,FL_SUBMENU},
|
1998-10-06 22:21:25 +04:00
|
|
|
{0,0,cb,(void*)&Fl_Button_type},
|
|
|
|
{0,0,cb,(void*)&Fl_Return_Button_type},
|
|
|
|
{0,0,cb,(void*)&Fl_Light_Button_type},
|
|
|
|
{0,0,cb,(void*)&Fl_Check_Button_type},
|
|
|
|
{0,0,cb,(void*)&Fl_Repeat_Button_type},
|
2001-10-29 06:44:33 +03:00
|
|
|
{0,0,cb,(void*)&Fl_Round_Button_type},
|
1998-10-06 22:21:25 +04:00
|
|
|
{0},
|
2005-03-19 07:09:32 +03:00
|
|
|
{"Valuators",0,0,0,FL_SUBMENU},
|
1998-10-06 22:21:25 +04:00
|
|
|
{0,0,cb,(void*)&Fl_Slider_type},
|
|
|
|
{0,0,cb,(void*)&Fl_Scrollbar_type},
|
|
|
|
{0,0,cb,(void*)&Fl_Value_Slider_type},
|
|
|
|
{0,0,cb,(void*)&Fl_Adjuster_type},
|
|
|
|
{0,0,cb,(void*)&Fl_Counter_type},
|
2005-03-21 02:38:14 +03:00
|
|
|
{0,0,cb,(void*)&Fl_Spinner_type},
|
1998-10-06 22:21:25 +04:00
|
|
|
{0,0,cb,(void*)&Fl_Dial_type},
|
|
|
|
{0,0,cb,(void*)&Fl_Roller_type},
|
|
|
|
{0,0,cb,(void*)&Fl_Value_Input_type},
|
|
|
|
{0,0,cb,(void*)&Fl_Value_Output_type},
|
|
|
|
{0},
|
2005-03-19 07:09:32 +03:00
|
|
|
{"Text",0,0,0,FL_SUBMENU},
|
2002-05-01 12:51:59 +04:00
|
|
|
{0,0,cb,(void*)&Fl_File_Input_type},
|
1998-10-06 22:21:25 +04:00
|
|
|
{0,0,cb,(void*)&Fl_Input_type},
|
|
|
|
{0,0,cb,(void*)&Fl_Output_type},
|
2001-08-11 20:09:26 +04:00
|
|
|
{0,0,cb,(void*)&Fl_Text_Display_type},
|
|
|
|
{0,0,cb,(void*)&Fl_Text_Editor_type},
|
1998-10-06 22:21:25 +04:00
|
|
|
{0},
|
2005-03-19 07:09:32 +03:00
|
|
|
{"Menus",0,0,0,FL_SUBMENU},
|
1998-10-06 22:21:25 +04:00
|
|
|
{0,0,cb,(void*)&Fl_Menu_Bar_type},
|
|
|
|
{0,0,cb,(void*)&Fl_Menu_Button_type},
|
|
|
|
{0,0,cb,(void*)&Fl_Choice_type},
|
2005-02-25 00:14:22 +03:00
|
|
|
{0,0,cb,(void*)&Fl_Input_Choice_type},
|
1998-10-06 22:21:25 +04:00
|
|
|
{0,0,cb, (void*)&Fl_Submenu_type},
|
|
|
|
{0,0,cb, (void*)&Fl_Menu_Item_type},
|
|
|
|
{0},
|
2005-03-19 07:09:32 +03:00
|
|
|
{"Browsers",0,0,0,FL_SUBMENU},
|
1998-10-06 22:21:25 +04:00
|
|
|
{0,0,cb,(void*)&Fl_Browser_type},
|
2001-08-11 20:09:26 +04:00
|
|
|
{0,0,cb,(void*)&Fl_Check_Browser_type},
|
2001-09-29 18:38:59 +04:00
|
|
|
{0,0,cb,(void*)&Fl_File_Browser_type},
|
2001-08-11 20:09:26 +04:00
|
|
|
{0},
|
2005-03-19 07:09:32 +03:00
|
|
|
{"Other",0,0,0,FL_SUBMENU},
|
1998-10-06 22:21:25 +04:00
|
|
|
{0,0,cb,(void*)&Fl_Box_type},
|
|
|
|
{0,0,cb,(void*)&Fl_Clock_type},
|
2001-09-29 18:38:59 +04:00
|
|
|
{0,0,cb,(void*)&Fl_Help_View_type},
|
2001-08-11 20:09:26 +04:00
|
|
|
{0,0,cb,(void*)&Fl_Progress_type},
|
1998-10-06 22:21:25 +04:00
|
|
|
{0},
|
|
|
|
{0}};
|
|
|
|
|
2002-10-31 00:08:39 +03:00
|
|
|
#include <FL/Fl_Multi_Label.H>
|
|
|
|
|
|
|
|
// modify a menuitem to display an icon in front of the label
|
|
|
|
static void make_iconlabel( Fl_Menu_Item *mi, Fl_Image *ic, const char *txt )
|
|
|
|
{
|
|
|
|
if (ic) {
|
2005-03-19 07:09:32 +03:00
|
|
|
char *t1 = new char[strlen(txt)+6];
|
2002-10-31 00:08:39 +03:00
|
|
|
strcpy( t1, " " );
|
2002-10-31 01:30:30 +03:00
|
|
|
strcat(t1, txt);
|
2005-03-19 07:09:32 +03:00
|
|
|
strcat(t1, "...");
|
2002-10-31 00:08:39 +03:00
|
|
|
mi->image( ic );
|
|
|
|
Fl_Multi_Label *ml = new Fl_Multi_Label;
|
|
|
|
ml->labela = (char*)ic;
|
|
|
|
ml->labelb = t1;
|
|
|
|
ml->typea = _FL_IMAGE_LABEL;
|
|
|
|
ml->typeb = FL_NORMAL_LABEL;
|
|
|
|
ml->label( mi );
|
|
|
|
}
|
2002-10-31 01:30:30 +03:00
|
|
|
else if (txt!=mi->text)
|
2002-10-31 00:08:39 +03:00
|
|
|
mi->label(txt);
|
|
|
|
}
|
|
|
|
|
1998-10-06 22:21:25 +04:00
|
|
|
void fill_in_New_Menu() {
|
|
|
|
for (unsigned i = 0; i < sizeof(New_Menu)/sizeof(*New_Menu); i++) {
|
|
|
|
Fl_Menu_Item *m = New_Menu+i;
|
2002-10-31 00:08:39 +03:00
|
|
|
if (m->user_data()) {
|
2002-10-31 01:30:30 +03:00
|
|
|
Fl_Type *t = (Fl_Type*)m->user_data();
|
2002-10-31 00:08:39 +03:00
|
|
|
if (m->text) {
|
2002-10-31 01:30:30 +03:00
|
|
|
make_iconlabel( m, pixmap[t->pixmapID()], m->label() );
|
2002-10-31 00:08:39 +03:00
|
|
|
}
|
|
|
|
else {
|
|
|
|
const char *n = t->type_name();
|
|
|
|
if (!strncmp(n,"Fl_",3)) n += 3;
|
|
|
|
make_iconlabel( m, pixmap[t->pixmapID()], n );
|
|
|
|
}
|
1998-10-06 22:21:25 +04:00
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
// use keyword to pick the type, this is used to parse files:
|
|
|
|
int reading_file;
|
|
|
|
Fl_Type *Fl_Type_make(const char *tn) {
|
|
|
|
reading_file = 1; // makes labels be null
|
|
|
|
Fl_Type *r = 0;
|
|
|
|
for (unsigned i = 0; i < sizeof(New_Menu)/sizeof(*New_Menu); i++) {
|
|
|
|
Fl_Menu_Item *m = New_Menu+i;
|
|
|
|
if (!m->user_data()) continue;
|
|
|
|
Fl_Type *t = (Fl_Type*)(m->user_data());
|
|
|
|
if (!strcasecmp(tn,t->type_name())) {r = t->make(); break;}
|
|
|
|
}
|
|
|
|
reading_file = 0;
|
|
|
|
return r;
|
|
|
|
}
|
|
|
|
|
|
|
|
////////////////////////////////////////////////////////////////
|
|
|
|
|
|
|
|
// Since I have included all the .H files, do this table here:
|
|
|
|
// This table is only used to read fdesign files:
|
|
|
|
|
|
|
|
struct symbol {const char *name; int value;};
|
|
|
|
|
|
|
|
static symbol table[] = {
|
|
|
|
{"BLACK", FL_BLACK},
|
|
|
|
{"RED", FL_RED},
|
|
|
|
{"GREEN", FL_GREEN},
|
|
|
|
{"YELLOW", FL_YELLOW},
|
|
|
|
{"BLUE", FL_BLUE},
|
|
|
|
{"MAGENTA", FL_MAGENTA},
|
|
|
|
{"CYAN", FL_CYAN},
|
|
|
|
{"WHITE", FL_WHITE},
|
|
|
|
|
|
|
|
{"LCOL", FL_BLACK},
|
|
|
|
{"COL1", FL_GRAY},
|
|
|
|
{"MCOL", FL_LIGHT1},
|
|
|
|
{"LEFT_BCOL", FL_LIGHT3},
|
|
|
|
{"TOP_BCOL", FL_LIGHT2},
|
|
|
|
{"BOTTOM_BCOL", FL_DARK2},
|
|
|
|
{"RIGHT_BCOL", FL_DARK3},
|
|
|
|
{"INACTIVE", FL_INACTIVE_COLOR},
|
|
|
|
{"INACTIVE_COL", FL_INACTIVE_COLOR},
|
|
|
|
{"FREE_COL1", FL_FREE_COLOR},
|
|
|
|
{"FREE_COL2", FL_FREE_COLOR+1},
|
|
|
|
{"FREE_COL3", FL_FREE_COLOR+2},
|
|
|
|
{"FREE_COL4", FL_FREE_COLOR+3},
|
|
|
|
{"FREE_COL5", FL_FREE_COLOR+4},
|
|
|
|
{"FREE_COL6", FL_FREE_COLOR+5},
|
|
|
|
{"FREE_COL7", FL_FREE_COLOR+6},
|
|
|
|
{"FREE_COL8", FL_FREE_COLOR+7},
|
|
|
|
{"FREE_COL9", FL_FREE_COLOR+8},
|
|
|
|
{"FREE_COL10", FL_FREE_COLOR+9},
|
|
|
|
{"FREE_COL11", FL_FREE_COLOR+10},
|
|
|
|
{"FREE_COL12", FL_FREE_COLOR+11},
|
|
|
|
{"FREE_COL13", FL_FREE_COLOR+12},
|
|
|
|
{"FREE_COL14", FL_FREE_COLOR+13},
|
|
|
|
{"FREE_COL15", FL_FREE_COLOR+14},
|
|
|
|
{"FREE_COL16", FL_FREE_COLOR+15},
|
|
|
|
{"TOMATO", 131},
|
|
|
|
{"INDIANRED", 164},
|
|
|
|
{"SLATEBLUE", 195},
|
|
|
|
{"DARKGOLD", 84},
|
|
|
|
{"PALEGREEN", 157},
|
|
|
|
{"ORCHID", 203},
|
|
|
|
{"DARKCYAN", 189},
|
|
|
|
{"DARKTOMATO", 113},
|
|
|
|
{"WHEAT", 174},
|
|
|
|
{"ALIGN_CENTER", FL_ALIGN_CENTER},
|
|
|
|
{"ALIGN_TOP", FL_ALIGN_TOP},
|
|
|
|
{"ALIGN_BOTTOM", FL_ALIGN_BOTTOM},
|
|
|
|
{"ALIGN_LEFT", FL_ALIGN_LEFT},
|
|
|
|
{"ALIGN_RIGHT", FL_ALIGN_RIGHT},
|
|
|
|
{"ALIGN_INSIDE", FL_ALIGN_INSIDE},
|
|
|
|
{"ALIGN_TOP_LEFT", FL_ALIGN_TOP | FL_ALIGN_LEFT},
|
|
|
|
{"ALIGN_TOP_RIGHT", FL_ALIGN_TOP | FL_ALIGN_RIGHT},
|
|
|
|
{"ALIGN_BOTTOM_LEFT", FL_ALIGN_BOTTOM | FL_ALIGN_LEFT},
|
|
|
|
{"ALIGN_BOTTOM_RIGHT", FL_ALIGN_BOTTOM | FL_ALIGN_RIGHT},
|
|
|
|
{"ALIGN_CENTER|FL_ALIGN_INSIDE", FL_ALIGN_CENTER|FL_ALIGN_INSIDE},
|
|
|
|
{"ALIGN_TOP|FL_ALIGN_INSIDE", FL_ALIGN_TOP|FL_ALIGN_INSIDE},
|
|
|
|
{"ALIGN_BOTTOM|FL_ALIGN_INSIDE", FL_ALIGN_BOTTOM|FL_ALIGN_INSIDE},
|
|
|
|
{"ALIGN_LEFT|FL_ALIGN_INSIDE", FL_ALIGN_LEFT|FL_ALIGN_INSIDE},
|
|
|
|
{"ALIGN_RIGHT|FL_ALIGN_INSIDE", FL_ALIGN_RIGHT|FL_ALIGN_INSIDE},
|
|
|
|
{"ALIGN_INSIDE|FL_ALIGN_INSIDE", FL_ALIGN_INSIDE|FL_ALIGN_INSIDE},
|
|
|
|
{"ALIGN_TOP_LEFT|FL_ALIGN_INSIDE", FL_ALIGN_TOP|FL_ALIGN_LEFT|FL_ALIGN_INSIDE},
|
|
|
|
{"ALIGN_TOP_RIGHT|FL_ALIGN_INSIDE", FL_ALIGN_TOP|FL_ALIGN_RIGHT|FL_ALIGN_INSIDE},
|
|
|
|
{"ALIGN_BOTTOM_LEFT|FL_ALIGN_INSIDE", FL_ALIGN_BOTTOM|FL_ALIGN_LEFT|FL_ALIGN_INSIDE},
|
|
|
|
{"ALIGN_BOTTOM_RIGHT|FL_ALIGN_INSIDE",FL_ALIGN_BOTTOM|FL_ALIGN_RIGHT|FL_ALIGN_INSIDE},
|
|
|
|
|
|
|
|
{"ALIGN_LEFT_TOP", FL_ALIGN_TOP | FL_ALIGN_LEFT},
|
|
|
|
{"ALIGN_RIGHT_TOP", FL_ALIGN_TOP | FL_ALIGN_RIGHT},
|
|
|
|
{"ALIGN_LEFT_BOTTOM", FL_ALIGN_BOTTOM | FL_ALIGN_LEFT},
|
|
|
|
{"ALIGN_RIGHT_BOTTOM", FL_ALIGN_BOTTOM | FL_ALIGN_RIGHT},
|
|
|
|
{"INVALID_STYLE", 255},
|
|
|
|
{"NORMAL_STYLE", FL_HELVETICA},
|
|
|
|
{"BOLD_STYLE", FL_HELVETICA|FL_BOLD},
|
|
|
|
{"ITALIC_STYLE", FL_HELVETICA|FL_ITALIC},
|
|
|
|
{"BOLDITALIC_STYLE", FL_HELVETICA|FL_BOLD|FL_ITALIC},
|
|
|
|
{"FIXED_STYLE", FL_COURIER},
|
|
|
|
{"FIXEDBOLD_STYLE", FL_COURIER|FL_BOLD},
|
|
|
|
{"FIXEDITALIC_STYLE", FL_COURIER|FL_ITALIC},
|
|
|
|
{"FIXEDBOLDITALIC_STYLE", FL_COURIER|FL_BOLD|FL_ITALIC},
|
|
|
|
{"TIMES_STYLE", FL_TIMES},
|
|
|
|
{"TIMESBOLD_STYLE", FL_TIMES|FL_BOLD},
|
|
|
|
{"TIMESITALIC_STYLE", FL_TIMES|FL_ITALIC},
|
|
|
|
{"TIMESBOLDITALIC_STYLE", FL_TIMES|FL_BOLD|FL_ITALIC},
|
|
|
|
{"SHADOW_STYLE", (_FL_SHADOW_LABEL<<8)},
|
|
|
|
{"ENGRAVED_STYLE", (_FL_ENGRAVED_LABEL<<8)},
|
|
|
|
{"EMBOSSED_STYLE", (_FL_EMBOSSED_LABEL<<0)},
|
|
|
|
{"TINY_SIZE", 8},
|
|
|
|
{"SMALL_SIZE", 11},
|
|
|
|
{"NORMAL_SIZE", FL_NORMAL_SIZE},
|
|
|
|
{"MEDIUM_SIZE", 18},
|
|
|
|
{"LARGE_SIZE", 24},
|
|
|
|
{"HUGE_SIZE", 32},
|
|
|
|
{"DEFAULT_SIZE", FL_NORMAL_SIZE},
|
|
|
|
{"TINY_FONT", 8},
|
|
|
|
{"SMALL_FONT", 11},
|
|
|
|
{"NORMAL_FONT", FL_NORMAL_SIZE},
|
|
|
|
{"MEDIUM_FONT", 18},
|
|
|
|
{"LARGE_FONT", 24},
|
|
|
|
{"HUGE_FONT", 32},
|
|
|
|
{"NORMAL_FONT1", 11},
|
|
|
|
{"NORMAL_FONT2", FL_NORMAL_SIZE},
|
|
|
|
{"DEFAULT_FONT", 11},
|
|
|
|
{"RETURN_END_CHANGED", 0},
|
|
|
|
{"RETURN_CHANGED", 1},
|
|
|
|
{"RETURN_END", 2},
|
|
|
|
{"RETURN_ALWAYS", 3},
|
|
|
|
{"PUSH_BUTTON", FL_TOGGLE_BUTTON},
|
|
|
|
{"RADIO_BUTTON", FL_RADIO_BUTTON},
|
|
|
|
{"HIDDEN_BUTTON", FL_HIDDEN_BUTTON},
|
|
|
|
{"SELECT_BROWSER", FL_SELECT_BROWSER},
|
|
|
|
{"HOLD_BROWSER", FL_HOLD_BROWSER},
|
|
|
|
{"MULTI_BROWSER", FL_MULTI_BROWSER},
|
|
|
|
{"SIMPLE_COUNTER", FL_SIMPLE_COUNTER},
|
|
|
|
{"LINE_DIAL", FL_LINE_DIAL},
|
|
|
|
{"FILL_DIAL", FL_FILL_DIAL},
|
|
|
|
{"VERT_SLIDER", FL_VERT_SLIDER},
|
|
|
|
{"HOR_SLIDER", FL_HOR_SLIDER},
|
|
|
|
{"VERT_FILL_SLIDER", FL_VERT_FILL_SLIDER},
|
|
|
|
{"HOR_FILL_SLIDER", FL_HOR_FILL_SLIDER},
|
|
|
|
{"VERT_NICE_SLIDER", FL_VERT_NICE_SLIDER},
|
|
|
|
{"HOR_NICE_SLIDER", FL_HOR_NICE_SLIDER},
|
|
|
|
};
|
|
|
|
|
|
|
|
#include <stdlib.h>
|
|
|
|
|
|
|
|
int lookup_symbol(const char *name, int &v, int numberok) {
|
|
|
|
if (name[0]=='F' && name[1]=='L' && name[2]=='_') name += 3;
|
|
|
|
for (int i=0; i < int(sizeof(table)/sizeof(*table)); i++)
|
|
|
|
if (!strcasecmp(name,table[i].name)) {v = table[i].value; return 1;}
|
|
|
|
if (numberok && ((v = atoi(name)) || !strcmp(name,"0"))) return 1;
|
|
|
|
return 0;
|
|
|
|
}
|
1998-10-21 20:29:01 +04:00
|
|
|
|
|
|
|
//
|
2005-02-06 19:28:36 +03:00
|
|
|
// End of "$Id$".
|
1998-10-21 20:29:01 +04:00
|
|
|
//
|