2 // "$Id: Fl_Menu_.H,v 1.2 2002/12/01 15:38:37 neurosurg Exp $"
4 // Menu base class header file for the Fast Light Tool Kit (FLTK).
6 // Copyright 1998-2002 by Bill Spitzak and others.
8 // This library is free software; you can redistribute it and/or
9 // modify it under the terms of the GNU Library General Public
10 // License as published by the Free Software Foundation; either
11 // version 2 of the License, or (at your option) any later version.
13 // This library is distributed in the hope that it will be useful,
14 // but WITHOUT ANY WARRANTY; without even the implied warranty of
15 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
16 // Library General Public License for more details.
18 // You should have received a copy of the GNU Library General Public
19 // License along with this library; if not, write to the Free Software
20 // Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
23 // Please report all bugs and problems to "fltk-bugs@fltk.org".
30 #include "Fl_Widget.H"
32 #include "Fl_Menu_Item.H"
34 class FL_EXPORT Fl_Menu_ : public Fl_Widget {
37 const Fl_Menu_Item *value_;
48 const Fl_Menu_Item* picked(const Fl_Menu_Item*);
50 Fl_Menu_(int,int,int,int,const char * =0);
53 const Fl_Menu_Item* test_shortcut() {return picked(menu()->test_shortcut());}
56 const Fl_Menu_Item *menu() const {return menu_;}
57 void menu(const Fl_Menu_Item *m);
58 void copy(const Fl_Menu_Item *m, void* user_data = 0);
59 int add(const char*, int shortcut, Fl_Callback*, void* = 0, int = 0);
60 int add(const char* a, const char* b, Fl_Callback* c,
61 void* d = 0, int e = 0) {return add(a,fl_old_shortcut(b),c,d,e);}
64 int add(const char *);
65 void replace(int,const char *);
67 void shortcut(int i, int s) {menu_[i].shortcut(s);}
68 void mode(int i,int fl) {menu_[i].flags = fl;}
69 int mode(int i) const {return menu_[i].flags;}
71 const Fl_Menu_Item *mvalue() const {return value_;}
72 int value() const {return (int)(value_-menu_);}
73 int value(const Fl_Menu_Item*);
74 int value(int i) {return value(menu_+i);}
75 const char *text() const {return value_ ? value_->text : 0;}
76 const char *text(int i) const {return menu_[i].text;}
78 Fl_Font textfont() const {return (Fl_Font)textfont_;}
79 void textfont(uchar c) {textfont_=c;}
80 uchar textsize() const {return textsize_;}
81 void textsize(uchar c) {textsize_=c;}
82 Fl_Color textcolor() const {return (Fl_Color)textcolor_;}
83 void textcolor(unsigned c) {textcolor_=c;}
85 Fl_Boxtype down_box() const {return (Fl_Boxtype)down_box_;}
86 void down_box(Fl_Boxtype b) {down_box_ = b;}
88 // back compatability:
89 Fl_Color down_color() const {return selection_color();}
90 void down_color(unsigned c) {selection_color(c);}
96 // End of "$Id: Fl_Menu_.H,v 1.2 2002/12/01 15:38:37 neurosurg Exp $".