summaryrefslogtreecommitdiff
path: root/fluid/Fl_Type.h
diff options
context:
space:
mode:
authorMichael R Sweet <michael.r.sweet@gmail.com>2005-03-07 23:55:49 +0000
committerMichael R Sweet <michael.r.sweet@gmail.com>2005-03-07 23:55:49 +0000
commitcdcb8a50e26d958a811342ff5cd77ed501f290ce (patch)
tree1e637e7cd0fe8c654d6fd5e87cacee6dfa7ade0a /fluid/Fl_Type.h
parent120dbf2c46b838de792472af39a6e76da19f544d (diff)
More guide stuff - most of the widgets that need it should have their
own custom ideal_size() function, and we now snap when showing the alignment guides. git-svn-id: file:///fltk/svn/fltk/branches/branch-1.1@4086 ea41ed52-d2ee-0310-a9c1-e6b18d33e121
Diffstat (limited to 'fluid/Fl_Type.h')
-rw-r--r--fluid/Fl_Type.h16
1 files changed, 16 insertions, 0 deletions
diff --git a/fluid/Fl_Type.h b/fluid/Fl_Type.h
index f5fd26924..77c7ee340 100644
--- a/fluid/Fl_Type.h
+++ b/fluid/Fl_Type.h
@@ -530,6 +530,10 @@ extern Fl_Menu_Item button_type_menu[];
class Fl_Menu_Button_Type : public Fl_Menu_Type {
Fl_Menu_Item *subtypes() {return button_type_menu;}
public:
+ virtual void ideal_size(int &w, int &h) {
+ Fl_Widget_Type::ideal_size(w, h);
+ w += 20;
+ }
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");}
@@ -542,6 +546,10 @@ extern Fl_Menu_Item dummymenu[];
#include <FL/Fl_Choice.H>
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;
+ }
virtual const char *type_name() {return "Fl_Choice";}
Fl_Widget *widget(int X,int Y,int W,int H) {
Fl_Choice *myo = new Fl_Choice(X,Y,W,H,"choice:");
@@ -566,6 +574,14 @@ class Fl_Input_Choice_Type : public Fl_Menu_Type {
return 1;
}
public:
+ virtual void ideal_size(int &w, int &h) {
+ Fl_Input_Choice *myo = (Fl_Input_Choice *)o;
+ fl_font(myo->textfont(), myo->textsize());
+ h = fl_height() + myo->textsize() - 6;
+ w = o->w() - 20 - Fl::box_dw(o->box());
+ int ww = (int)fl_width('m');
+ w = ((w + ww - 1) / ww) * ww + 20 + Fl::box_dw(o->box());
+ }
virtual const char *type_name() {return "Fl_Input_Choice";}
Fl_Widget *widget(int X,int Y,int W,int H) {
Fl_Input_Choice *myo = new Fl_Input_Choice(X,Y,W,H,"input choice:");