summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMatthias Melcher <fltk@matthiasm.com>2005-07-23 22:56:27 +0000
committerMatthias Melcher <fltk@matthiasm.com>2005-07-23 22:56:27 +0000
commit9688b0b1c3f34bf44399ee120ab5c3f0c826d7df (patch)
treeca31e52a8543ab6e29a6d50cfcb0441f8ffe794d
parente9f7f4ce4999d6a48bb89aae3b9f9b01668f99d3 (diff)
Fluid was casting Fl_Input_Choice to Fl_Menu_ at two occasions which is wrong since Input_Choice is derived from Fl_Group. Fixed.
git-svn-id: file:///fltk/svn/fltk/branches/branch-1.1@4451 ea41ed52-d2ee-0310-a9c1-e6b18d33e121
-rw-r--r--CHANGES1
-rw-r--r--fluid/Fl_Menu_Type.cxx18
-rw-r--r--fluid/Fl_Type.h5
3 files changed, 22 insertions, 2 deletions
diff --git a/CHANGES b/CHANGES
index 1fa076b06..f7fc707e6 100644
--- a/CHANGES
+++ b/CHANGES
@@ -2,6 +2,7 @@ CHANGES IN FLTK 1.1.7
- Documentation fixes (STR #648, STR #692, STR #730, STR
#744, STR #745, STR #942)
+ - Fixed integration of Fl_Input_Choice into Fluid (STR #879)
- New windows touching the right screen border would be
positioned all the way to the left (STR #898)
- Made pie drawing size for WIN32 and OS X the same as X11 (STR #905)
diff --git a/fluid/Fl_Menu_Type.cxx b/fluid/Fl_Menu_Type.cxx
index 7cb6f7724..72b5005eb 100644
--- a/fluid/Fl_Menu_Type.cxx
+++ b/fluid/Fl_Menu_Type.cxx
@@ -492,6 +492,24 @@ void Fl_Input_Choice_Type::copy_properties() {
d->textsize(s->textsize());
}
+Fl_Type* Fl_Input_Choice_Type::click_test(int, int) {
+ if (selected) return 0; // let user move the widget
+ Fl_Menu_* w = ((Fl_Input_Choice*)o)->menubutton();
+ if (!menusize) return 0;
+ const Fl_Menu_Item* save = w->mvalue();
+ w->value((Fl_Menu_Item*)0);
+ Fl::pushed(w);
+ w->handle(FL_PUSH);
+ const Fl_Menu_Item* m = w->mvalue();
+ if (m) {
+ // restore the settings of toggles & radio items:
+ if (m->flags & (FL_MENU_RADIO | FL_MENU_TOGGLE)) build_menu();
+ return (Fl_Type*)(m->user_data());
+ }
+ w->value(save);
+ return this;
+}
+
////////////////////////////////////////////////////////////////
Fl_Menu_Bar_Type Fl_Menu_Bar_type;
diff --git a/fluid/Fl_Type.h b/fluid/Fl_Type.h
index fd77dafab..4c7d18af5 100644
--- a/fluid/Fl_Type.h
+++ b/fluid/Fl_Type.h
@@ -643,10 +643,10 @@ public:
#include <FL/Fl_Input_Choice.H>
class Fl_Input_Choice_Type : public Fl_Menu_Type {
int textstuff(int w, Fl_Font& f, int& s, Fl_Color& c) {
- Fl_Menu_ *myo = (Fl_Menu_*)(w==4 ? ((Fl_Widget_Type*)this->factory)->o : this->o);
+ Fl_Input_Choice *myo = (Fl_Input_Choice*)(w==4 ? ((Fl_Widget_Type*)this->factory)->o : this->o);
switch (w) {
case 4:
- case 0: f = myo->textfont(); s = myo->textsize(); c = myo->textcolor(); break;
+ 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;
@@ -665,6 +665,7 @@ public:
if (w < (15 + h)) w = 15 + h;
}
virtual const char *type_name() {return "Fl_Input_Choice";}
+ virtual Fl_Type* click_test(int,int);
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:");
myo->menu(dummymenu);