From 2df3459457eb7c83fea191fa6105fca0c8ca7e8d Mon Sep 17 00:00:00 2001 From: Michael R Sweet Date: Thu, 24 Feb 2005 21:14:22 +0000 Subject: [PATCH] Added Greg Ercolano's simple Fl_Input_Choice widget which is a combination of the Fl_Input and Fl_Menu_Button widgets (STR #650) FL/Fl_Input_Choice.H: documentation/Fl_Input_Choice.html: - Added. documentation/fltk.book: - Added Fl_Input_Choice.html + --no-embedfonts option. documentation/index.html: - Update version number and revision. documentation/input_choice.jpg: - Added. documentation/preface.html: - Update version number and revision. documentation/widgets.html: - Add Fl_Input_Choice to lists. fluid/Fl_Menu_Type.cxx: - Add Fl_Input_Choice_Type class and instance. fluid/Fl_Type.h: - Add Fl_Input_Choice_Type class and instance. fluid/factory.cxx: - Add Fl_Input_Choice menu item. test/Makefile: - Add input_choice example. test/input_choice.cxx: - Added. test/demo.menu: - Add input_choice example. git-svn-id: file:///fltk/svn/fltk/branches/branch-1.1@4050 ea41ed52-d2ee-0310-a9c1-e6b18d33e121 --- CHANGES | 3 + FL/Fl_Input_Choice.H | 128 +++++++++++++++++++++++++++++ documentation/Fl_Input_Choice.html | 100 ++++++++++++++++++++++ documentation/fltk.book | 3 +- documentation/index.html | 6 +- documentation/input_choice.jpg | Bin 0 -> 5320 bytes documentation/preface.html | 4 +- documentation/widgets.html | 2 + fluid/Fl_Menu_Type.cxx | 2 + fluid/Fl_Type.h | 18 +++- fluid/factory.cxx | 2 + test/Makefile | 8 +- test/demo.menu | 1 + test/input_choice.cxx | 57 +++++++++++++ 14 files changed, 324 insertions(+), 10 deletions(-) create mode 100644 FL/Fl_Input_Choice.H create mode 100644 documentation/Fl_Input_Choice.html create mode 100644 documentation/input_choice.jpg create mode 100644 test/input_choice.cxx diff --git a/CHANGES b/CHANGES index 3c0780446..b932c5361 100644 --- a/CHANGES +++ b/CHANGES @@ -1,6 +1,9 @@ CHANGES IN FLTK 1.1.7 - Documentation fixes (STR #648, STR #692) + - Added Greg Ercolano's simple Fl_Input_Choice widget + which is a combination of the Fl_Input and + Fl_Menu_Button widgets (STR #650) - Fl_Multiline_Input now scrolls the full height of the widget instead of 5 lines when the user presses PageUp or PageDown (STR #727) diff --git a/FL/Fl_Input_Choice.H b/FL/Fl_Input_Choice.H new file mode 100644 index 000000000..2b7d1424e --- /dev/null +++ b/FL/Fl_Input_Choice.H @@ -0,0 +1,128 @@ +// +// "$Id$" +// +// An input/chooser widget. +// ______________ ____ +// | || __ | +// | input area || \/ | +// |______________||____| +// +// Copyright 1998-2005 by Bill Spitzak and others. +// Copyright 2004 by Greg Ercolano. +// +// 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. +// +// Please report all bugs and problems to "fltk-bugs@fltk.org". +// + +#ifndef Fl_Input_Choice_H +#define Fl_Input_Choice_H + +#include +#include +#include +#include + +class Fl_Input_Choice : public Fl_Group { + // Private class to handle slightly 'special' behavior of menu button + class InputMenuButton : public Fl_Menu_Button { + void draw() { + draw_box(FL_UP_BOX, color()); + fl_color(active_r() ? labelcolor() : fl_inactive(labelcolor())); + int xc = x()+w()/2, yc=y()+h()/2; + fl_polygon(xc-5,yc-3,xc+5,yc-3,xc,yc+3); + if (Fl::focus() == this) draw_focus(); + } + public: + InputMenuButton(int x,int y,int w,int h,const char*l=0) : + Fl_Menu_Button(x,y,w,h,l) { box(FL_UP_BOX); } + }; + + Fl_Input *inp_; + InputMenuButton *menu_; + + static void menu_cb(Fl_Widget*, void *data) { + Fl_Input_Choice *o=(Fl_Input_Choice *)data; + o->inp_->value(o->menu_->text()); + o->do_callback(); + } + + static void inp_cb(Fl_Widget*, void *data) { + Fl_Input_Choice *o=(Fl_Input_Choice *)data; + o->do_callback(); + } + + // Custom resize behavior -- input stretches, menu button doesn't + inline int inp_x() { return(x() + Fl::box_dx(box())); } + inline int inp_y() { return(y() + Fl::box_dy(box())); } + inline int inp_w() { return(w() - Fl::box_dw(box()) - 20); } + inline int inp_h() { return(h() - Fl::box_dh(box())); } + + inline int menu_x() { return(x() + w() - 20 - Fl::box_dx(box())); } + inline int menu_y() { return(y() + Fl::box_dy(box()) + (Fl::scheme()?1:0)); } + inline int menu_w() { return(20); } + inline int menu_h() { return(h() - Fl::box_dh(box()) - (Fl::scheme()?1:0)); } + +public: + Fl_Input_Choice (int x,int y,int w,int h,const char*l=0) : Fl_Group(x,y,w,h,l) { + Fl_Group::box(FL_DOWN_BOX); + align(FL_ALIGN_LEFT); // default like Fl_Input + inp_ = new Fl_Input(inp_x(), inp_y(), + inp_w(), inp_h()); + inp_->callback(inp_cb, (void*)this); + inp_->box(FL_FLAT_BOX); // cosmetic + menu_ = new InputMenuButton(menu_x(), menu_y(), + menu_w(), menu_h()); + menu_->callback(menu_cb, (void*)this); + menu_->box(FL_FLAT_BOX); // cosmetic + end(); + } + void add(const char *s) { + menu_->add(s); + } + void clear() { + menu_->clear(); + } + const Fl_Menu_Item *menu() { + return (menu_->menu()); + } + void menu(const Fl_Menu_Item *m) { + menu_->menu(m); + } + void resize(int X, int Y, int W, int H) { + Fl_Group::resize(X,Y,W,H); + inp_->resize(inp_x(), inp_y(), inp_w(), inp_h()); + menu_->resize(menu_x(), menu_y(), menu_w(), menu_h()); + } + const char* value() const { + return(inp_->value()); + } + void value(const char *val) { + inp_->value(val); + } + void value(int val) { + menu_->value(val); + inp_->value(menu_->text(val)); + } + Fl_Menu_Button *menubutton() { return menu_; } + Fl_Input *input() { return inp_; } +}; + +#endif // !Fl_Input_Choice_H + +// +// End of "$Id$". +// diff --git a/documentation/Fl_Input_Choice.html b/documentation/Fl_Input_Choice.html new file mode 100644 index 000000000..b941e3447 --- /dev/null +++ b/documentation/Fl_Input_Choice.html @@ -0,0 +1,100 @@ + + + + + +

class Fl_Input_Choice

+ +
+ +

Class Hierarchy

+ + + +

Include Files

+ +
    +#include <FL/Fl_Input_Choice.H>
    +
+ +

+
+Plastic and normal Fl::scheme()s. +

+ +

Description

+

A combination of the input widget and a menu button. +The user can either type into the input area, or use the +menu button chooser on the right, which loads the input area +with predefined text. Normally it is drawn with an inset box +and a white background. +

+The application can directly access both the input and menu +widgets directly, using the menubutton() +and input() accessor methods. + +

Methods

+
+
+
+
+ +

Fl_Input_Choice::Fl_Input_Choice(int x, int y, int w, +int h, const char *label = 0)

+ +

Creates a new Fl_Input_Choice widget using the given position, size, +and label string. + +

virtual Fl_Input_Choice::~Fl_Input_Choice()

+ +

Destroys the widget and any value associated with it. + +

void Fl_Input_Choice::add(const char *s)

+ +

Adds an item to the menu.

+ +

void Fl_Input_Choice::clear()

+ +

Removes all items from the menu.

+ +

Fl_Input *Fl_Input_Choice::input()

+ +

Returns a reference to the internal Fl_Input widget.

+ +

void Fl_Input_Choice::menu(const Fl_Menu_Item *m)
+const Fl_Menu_Item *menu()

+ +

Gets or sets the Fl_Menu_Item array used for the menu.

+ +

Fl_Menu_Button *Fl_Input_Choice::menubutton()

+ +

Returns a reference to the internal Fl_Menu_Button widget. + +

void Fl_Input_Choice::value(const char *s)
+void Fl_Input_Choice::value(int v)
+const char *Fl_Input_Choice::value() const

+ +

Sets or returns the input widget's current contents. The +second form sets the contents using the index into the menu +which you can set as an integer. Setting the value effectively +'chooses' this menu item, and sets it as the new input text, +deleting the previous text.

+ + + diff --git a/documentation/fltk.book b/documentation/fltk.book index 50915a6b9..2dd70f748 100644 --- a/documentation/fltk.book +++ b/documentation/fltk.book @@ -1,5 +1,5 @@ #HTMLDOC 1.8.20 --t pdf13 -f fltk.pdf --book --toclevels 2 --no-numbered --toctitle "Table of Contents" --title --titleimage FL.gif --linkstyle underline --size Universal --left 1.00in --right 0.50in --top 0.50in --bottom 0.50in --header .t. --footer h.1 --tocheader .t. --tocfooter ..i --duplex --portrait --color --no-pscommands --no-xrxcomments --compression=9 --jpeg=50 --fontsize 11.0 --fontspacing 1.2 --headingfont Helvetica --bodyfont Times --headfootsize 11.0 --headfootfont Helvetica --charset 8859-1 --links --no-truetype --pagemode outline --pagelayout single --firstpage c1 --pageeffect none --pageduration 10 --effectduration 1.0 --no-encryption --permissions all --owner-password "" --user-password "" --browserwidth 680 +-t pdf13 -f fltk.pdf --book --toclevels 2 --no-numbered --toctitle "Table of Contents" --title --titleimage FL.gif --linkstyle underline --size Universal --left 1.00in --right 0.50in --top 0.50in --bottom 0.50in --header .t. --footer h.1 --tocheader .t. --tocfooter ..i --duplex --portrait --color --no-pscommands --no-xrxcomments --compression=9 --jpeg=50 --no-embedfonts --fontsize 11.0 --fontspacing 1.2 --headingfont Helvetica --bodyfont Times --headfootsize 11.0 --headfootfont Helvetica --charset 8859-1 --links --no-truetype --pagemode outline --pagelayout single --firstpage c1 --pageeffect none --pageduration 10 --effectduration 1.0 --no-encryption --permissions all --owner-password "" --user-password "" --browserwidth 680 preface.html intro.html basics.html @@ -44,6 +44,7 @@ Fl_Hold_Browser.html Fl_Image.html Fl_Input.html Fl_Input_.html +Fl_Input_Choice.html Fl_Int_Input.html Fl_JPEG_Image.html Fl_Light_Button.html diff --git a/documentation/index.html b/documentation/index.html index 2853526ba..489623036 100644 --- a/documentation/index.html +++ b/documentation/index.html @@ -1,7 +1,7 @@ - FLTK 1.1.6 Programming Manual + FLTK 1.1.7 Programming Manual @@ -10,8 +10,8 @@ FL -

FLTK 1.1.6 Programming Manual

-

Revision 6 by Michael Sweet, Craig P. Earls, and Bill Spitzak
+

FLTK 1.1.7 Programming Manual

+

Revision 7 by Michael Sweet, Craig P. Earls, and Bill Spitzak
Copyright 1998-2004 by Bill Spitzak and others.

diff --git a/documentation/input_choice.jpg b/documentation/input_choice.jpg new file mode 100644 index 0000000000000000000000000000000000000000..7f7b93f8556052de0aff9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1.1.6, a C++ Graphical User Interface +version 1.1.7, a C++ Graphical User Interface ("GUI") toolkit for UNIX, Microsoft Windows and MacOS. Each of the chapters in this manual is designed as a tutorial for using FLTK, while the appendices provide a convenient reference diff --git a/documentation/widgets.html b/documentation/widgets.html index d0c1967e4..d101330c6 100644 --- a/documentation/widgets.html +++ b/documentation/widgets.html @@ -45,6 +45,7 @@ description of the fl_ functions, see Fl_Image
Fl_Input_
Fl_Input
+Fl_Input_Choice
Fl_Int_Input
Fl_JPEG_Image
Fl_Light_Button
@@ -161,6 +162,7 @@ description of the fl_ functions, see

  • Fl_File_Chooser
  • Fl_Help_Dialog
  • Fl_Help_View +
  • Fl_Input_Choice
  • Fl_Pack
  • Fl_Scroll
  • Fl_Tabs diff --git a/fluid/Fl_Menu_Type.cxx b/fluid/Fl_Menu_Type.cxx index 08d109916..954aa5051 100644 --- a/fluid/Fl_Menu_Type.cxx +++ b/fluid/Fl_Menu_Type.cxx @@ -419,6 +419,8 @@ Fl_Menu_Item dummymenu[] = {{"CHOICE"},{0}}; Fl_Choice_Type Fl_Choice_type; +Fl_Input_Choice_Type Fl_Input_Choice_type; + //////////////////////////////////////////////////////////////// Fl_Menu_Bar_Type Fl_Menu_Bar_type; diff --git a/fluid/Fl_Type.h b/fluid/Fl_Type.h index 1a732ad2e..cc0c246cb 100644 --- a/fluid/Fl_Type.h +++ b/fluid/Fl_Type.h @@ -1,5 +1,5 @@ // -// "$Id: Fl_Type.h,v 1.5.2.11.2.13 2004/04/11 04:38:55 easysw Exp $" +// "$Id$" // // Widget type header file for the Fast Light Tool Kit (FLTK). // @@ -549,6 +549,20 @@ public: int pixmapID() { return 15; } }; +#include +class Fl_Input_Choice_Type : public Fl_Menu_Type { +public: + 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:"); + myo->menu(dummymenu); + myo->value("input"); + return myo; + } + Fl_Widget_Type *_make() {return new Fl_Input_Choice_Type();} + int pixmapID() { return 15; } +}; + #include class Fl_Menu_Bar_Type : public Fl_Menu_Type { public: @@ -599,5 +613,5 @@ int storestring(const char *n, const char * & p, int nostrip=0); extern int include_H_from_C; // -// End of "$Id: Fl_Type.h,v 1.5.2.11.2.13 2004/04/11 04:38:55 easysw Exp $". +// End of "$Id$". // diff --git a/fluid/factory.cxx b/fluid/factory.cxx index 995c93182..efba7d6de 100644 --- a/fluid/factory.cxx +++ b/fluid/factory.cxx @@ -690,6 +690,7 @@ extern class Fl_Pack_Type Fl_Pack_type; extern class Fl_Tabs_Type Fl_Tabs_type; extern class Fl_Scroll_Type Fl_Scroll_type; extern class Fl_Tile_Type Fl_Tile_type; +extern class Fl_Input_Choice_Type Fl_Input_Choice_type; 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; @@ -753,6 +754,7 @@ Fl_Menu_Item New_Menu[] = { {0,0,cb,(void*)&Fl_Menu_Bar_type}, {0,0,cb,(void*)&Fl_Menu_Button_type}, {0,0,cb,(void*)&Fl_Choice_type}, + {0,0,cb,(void*)&Fl_Input_Choice_type}, {0,0,cb, (void*)&Fl_Submenu_type}, {0,0,cb, (void*)&Fl_Menu_Item_type}, {0}, diff --git a/test/Makefile b/test/Makefile index 3c7d74bb4..ead8a4753 100644 --- a/test/Makefile +++ b/test/Makefile @@ -1,5 +1,5 @@ # -# "$Id: Makefile,v 1.19.2.7.2.42 2004/08/26 22:24:24 matthiaswm Exp $" +# "$Id$" # # Test/example program makefile for the Fast Light Tool Kit (FLTK). # @@ -61,6 +61,7 @@ CPPFILES =\ image.cxx \ inactive.cxx \ input.cxx \ + input_choice.cxx \ keyboard.cxx \ label.cxx \ line_style.cxx \ @@ -118,6 +119,7 @@ ALL = \ image$(EXEEXT) \ inactive$(EXEEXT) \ input$(EXEEXT) \ + input_choice$(EXEEXT) \ keyboard$(EXEEXT) \ label$(EXEEXT) \ line_style$(EXEEXT) \ @@ -259,6 +261,8 @@ inactive.cxx: inactive.fl input$(EXEEXT): input.o +input_choice$(EXEEXT): input_choice.o + keyboard$(EXEEXT): keyboard_ui.o keyboard.o echo Linking $@... $(CXX) -I.. $(CXXFLAGS) -o $@ keyboard.o keyboard_ui.o $(LINKFLTK) $(LDLIBS) @@ -376,5 +380,5 @@ shape$(EXEEXT): shape.o # -# End of "$Id: Makefile,v 1.19.2.7.2.42 2004/08/26 22:24:24 matthiaswm Exp $". +# End of "$Id$". # diff --git a/test/demo.menu b/test/demo.menu index 75417d01f..a8678a08b 100644 --- a/test/demo.menu +++ b/test/demo.menu @@ -65,6 +65,7 @@ @o:File Chooser:file_chooser @o:Fonts:fonts @o:HelpDialog:help + @o:Input Choice:input_choice @o:Preferences:preferences @o:Threading:threads @o:XForms Emulation:forms diff --git a/test/input_choice.cxx b/test/input_choice.cxx new file mode 100644 index 000000000..45a50916b --- /dev/null +++ b/test/input_choice.cxx @@ -0,0 +1,57 @@ +// Test program for Fl_Input_Choice +// +// Copyright 1998-2004 by Bill Spitzak and others. +// +// 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. +// + +#include +#include +#include +#include + +void buttcb(Fl_Widget*,void*data) { + Fl_Input_Choice *in=(Fl_Input_Choice *)data; + static int flag = 1; + flag ^= 1; + if ( flag ) in->activate(); + else in->deactivate(); +} + +void input_choice_cb(Fl_Widget*,void*data) { + Fl_Input_Choice *in=(Fl_Input_Choice *)data; + fprintf(stderr, "Value='%s'\n", (const char*)in->value()); +} + +int main(int argc, char **argv) { + Fl::scheme("plastic"); // optional + Fl_Window win(300, 200); + + Fl_Input_Choice in(40,40,100,28,"Test"); + in.callback(input_choice_cb, (void*)&in); + in.add("one"); + in.add("two"); + in.add("three"); + in.value(1); + + Fl_Button onoff(40,150,200,28,"Activate/Deactivate"); + onoff.callback(buttcb, (void*)&in); + + win.end(); + win.resizable(win); + win.show(argc, argv); + return Fl::run(); +}