summaryrefslogtreecommitdiff
path: root/fluid/Fl_Menu_Type.h
diff options
context:
space:
mode:
Diffstat (limited to 'fluid/Fl_Menu_Type.h')
-rw-r--r--fluid/Fl_Menu_Type.h44
1 files changed, 9 insertions, 35 deletions
diff --git a/fluid/Fl_Menu_Type.h b/fluid/Fl_Menu_Type.h
index a18e4edef..3824270a6 100644
--- a/fluid/Fl_Menu_Type.h
+++ b/fluid/Fl_Menu_Type.h
@@ -1,5 +1,5 @@
//
-// Widget type header file for the Fast Light Tool Kit (FLTK).
+// Menu type header file for the Fast Light Tool Kit (FLTK).
//
// Type for creating all subclasses of Fl_Widget
// This should have the widget pointer in it, but it is still in the
@@ -23,6 +23,8 @@
#include "Fl_Button_Type.h"
+#include "Fd_Snap_Action.h"
+
#include <FL/Fl_Choice.H>
#include <FL/Fl_Menu_.H>
#include <FL/Fl_Menu_Button.H>
@@ -125,6 +127,11 @@ class Fl_Menu_Manager_Type : public Fl_Widget_Type
{
typedef Fl_Widget_Type super;
public:
+ void ideal_size(int &w, int &h) FL_OVERRIDE {
+ h = layout->textsize_not_null() + 8;
+ w = layout->textsize_not_null() * 6 + 8;
+ Fd_Snap_Action::better_size(w, h);
+ }
int is_parent() const FL_OVERRIDE {return 1;}
int menusize;
virtual void build_menu() = 0;
@@ -160,16 +167,6 @@ class Fl_Input_Choice_Type : public Fl_Menu_Manager_Type
return 1;
}
public:
- void ideal_size(int &w, int &h) FL_OVERRIDE {
- 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());
- if (h < 15) h = 15;
- if (w < (15 + h)) w = 15 + h;
- }
~Fl_Input_Choice_Type() {
if (menusize) delete[] (Fl_Menu_Item*)(((Fl_Input_Choice*)o)->menu());
}
@@ -221,20 +218,13 @@ public:
extern Fl_Menu_Item button_type_menu[];
/**
- \brief Makae Menu Button widgets.
+ \brief Make Menu Button widgets.
*/
class Fl_Menu_Button_Type : public Fl_Menu_Base_Type
{
typedef Fl_Menu_Base_Type super;
Fl_Menu_Item *subtypes() FL_OVERRIDE {return button_type_menu;}
public:
- void ideal_size(int &w, int &h) FL_OVERRIDE {
- Fl_Widget_Type::ideal_size(w, h);
- w += 2 * ((o->labelsize() - 3) & ~1) + o->labelsize() - 4;
- h = (h / 5) * 5;
- if (h < 15) h = 15;
- if (w < (15 + h)) w = 15 + h;
- }
const char *type_name() FL_OVERRIDE {return "Fl_Menu_Button";}
const char *alt_type_name() FL_OVERRIDE {return "fltk::MenuButton";}
Fl_Widget *widget(int X,int Y,int W,int H) FL_OVERRIDE {
@@ -252,17 +242,6 @@ class Fl_Choice_Type : public Fl_Menu_Base_Type
{
typedef Fl_Menu_Base_Type super;
public:
- void ideal_size(int &w, int &h) FL_OVERRIDE {
- Fl_Widget_Type::ideal_size(w, h);
- 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;
- if (h < 15) h = 15;
- if (w < (15 + h)) w = 15 + h;
- }
const char *type_name() FL_OVERRIDE {return "Fl_Choice";}
const char *alt_type_name() FL_OVERRIDE {return "fltk::Choice";}
Fl_Widget *widget(int X,int Y,int W,int H) FL_OVERRIDE {
@@ -283,11 +262,6 @@ class Fl_Menu_Bar_Type : public Fl_Menu_Base_Type
{
typedef Fl_Menu_Base_Type super;
public:
- void ideal_size(int &w, int &h) FL_OVERRIDE {
- w = o->window()->w();
- h = ((o->labelsize() + Fl::box_dh(o->box()) + 4) / 5) * 5;
- if (h < 15) h = 15;
- }
const char *type_name() FL_OVERRIDE {return "Fl_Menu_Bar";}
const char *alt_type_name() FL_OVERRIDE {return "fltk::MenuBar";}
Fl_Widget *widget(int X,int Y,int W,int H) FL_OVERRIDE {return new Fl_Menu_Bar(X,Y,W,H);}