summaryrefslogtreecommitdiff
path: root/fluid/Fl_Type.h
diff options
context:
space:
mode:
authorMichael R Sweet <michael.r.sweet@gmail.com>2005-03-19 04:09:32 +0000
committerMichael R Sweet <michael.r.sweet@gmail.com>2005-03-19 04:09:32 +0000
commit59004878f3c36ec693737b631f5769f511fd74cb (patch)
treeb50238e6908abf76db0570e3cef65a2d973b1f33 /fluid/Fl_Type.h
parenta218f44b5db233bbbd588b5766ec6f3e5e6cb822 (diff)
Many FLUID updates...
fluid/align_widget.cxx: - Add widget_size_cb() to set default size and size of labels and text for selected widgets. fluid/factory.cxx: - More normalization of menus - "..." when opening a window, Capitalized Words. - cb(): Assign default label/text size and resize to ideal size. - Make sure that all buttons, input, and valuator widgets have default label strings. - Fl_*_Button::ideal_size(): fix ideal width calcs to match widget. fluid/Fl_Menu_Type.cxx: - Fl_Menu_Item_Type::make(): set default label size. fluid/Fl_Type.h: - Add Fl_Widget_Type::default_size global. - Fl_Menu_Item_Type::type_name(): return "Menu_Item". - Fl_Submenu_Type::type_name(): return "Submenu". - Update ideal_size() methods to use a default height that is evenly divisible by 5. - Fl_Choice_Type::ideal_size() and Fl_Menubutton_Type::ideal_size(): fix ideal width calcs to match widget. - Fl_Menu_Bar::ideal_size(): add, returning the window width. fluid/fluid.cxx: - Add "Layout/Widget Size" submenu. - "File/Write code..." becomes "File/Write Code..." and "File/Write strings..." becomes "File/Write Strings..." fluid/fluid.plist: - Bump version number and copyright info. fluid/Fl_Widget_Type.cxx: - Fl_Widget_Type::ideal_size(): add box dw/dh and enforce a minimum size of 15x15. - labelsize_cb(): use Fl_Widget_Type::default_size instead of FL_NORMAL_SIZE. - textsize_cb(): use Fl_Widget_Type::default_size instead of FL_NORMAL_SIZE. fluid/Fl_Window_Type.cxx: - Fl_Window_Type::newdx(): require at least 2 pixels of movement. - Fl_Window_Type::draw_overlay(): adjust bounding box for outside labels above and below. - Fl_Window_Type::handle(): reset dx/dy on FL_PUSH. fluid/function_panel.cxx: fluid/function_panel.fl: fluid/function_panel.h: - Update some of the windows for the "small" size. git-svn-id: file:///fltk/svn/fltk/branches/branch-1.1@4129 ea41ed52-d2ee-0310-a9c1-e6b18d33e121
Diffstat (limited to 'fluid/Fl_Type.h')
-rw-r--r--fluid/Fl_Type.h24
1 files changed, 18 insertions, 6 deletions
diff --git a/fluid/Fl_Type.h b/fluid/Fl_Type.h
index 6e2f63e4e..a3abe95b1 100644
--- a/fluid/Fl_Type.h
+++ b/fluid/Fl_Type.h
@@ -282,6 +282,7 @@ protected:
void write_color(const char*, Fl_Color);
public:
+ static int default_size;
const char *xclass; // junk string, used for shortcut
Fl_Widget *o;
@@ -488,7 +489,7 @@ 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";}
+ const char* type_name() {return "Menu_Item";}
Fl_Type* make();
int is_menu_item() const {return 1;}
int is_button() const {return 1;} // this gets shortcut to work
@@ -506,7 +507,7 @@ public:
class Fl_Submenu_Type : public Fl_Menu_Item_Type {
public:
Fl_Menu_Item* subtypes() {return 0;}
- const char* type_name() {return "submenu";}
+ const char* type_name() {return "Submenu";}
int is_parent() const {return 1;}
int is_button() const {return 0;} // disable shortcut
Fl_Type* make();
@@ -556,7 +557,8 @@ class Fl_Menu_Button_Type : public Fl_Menu_Type {
public:
virtual void ideal_size(int &w, int &h) {
Fl_Widget_Type::ideal_size(w, h);
- w += 20;
+ w += 2 * ((o->labelsize() - 3) & ~1) + o->labelsize() - 4;
+ h = (h / 5) * 5;
}
virtual const char *type_name() {return "Fl_Menu_Button";}
Fl_Widget *widget(int X,int Y,int W,int H) {
@@ -572,7 +574,12 @@ class Fl_Choice_Type : public Fl_Menu_Type {
public:
virtual void ideal_size(int &w, int &h) {
Fl_Widget_Type::ideal_size(w, h);
- w += 20;
+ int w1 = o->h() - Fl::box_dh(o->box());
+ if (w1 > 20) w1 = 20;
+ w1 = (w1 - 4) / 3;
+ if (w1 < 1) w1 = 1;
+ w += 2 * w1 + o->labelsize() - 4;
+ h = (h / 5) * 5;
}
virtual const char *type_name() {return "Fl_Choice";}
Fl_Widget *widget(int X,int Y,int W,int H) {
@@ -618,12 +625,17 @@ public:
int pixmapID() { return 15; }
};
+#include <FL/Fl_Window.H>
#include <FL/Fl_Menu_Bar.H>
class Fl_Menu_Bar_Type : public Fl_Menu_Type {
public:
+ virtual void ideal_size(int &w, int &h) {
+ w = o->window()->w();
+ h = ((o->labelsize() + Fl::box_dh(o->box()) + 4) / 5) * 5;
+ if (h < 15) h = 15;
+ }
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 *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();}
int pixmapID() { return 17; }
};