Move the sources to trunk
[opencv] / otherlibs / _fltk / include / FL / Fl_Menu_.H
1 //
2 // "$Id: Fl_Menu_.H,v 1.2 2002/12/01 15:38:37 neurosurg Exp $"
3 //
4 // Menu base class header file for the Fast Light Tool Kit (FLTK).
5 //
6 // Copyright 1998-2002 by Bill Spitzak and others.
7 //
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.
12 //
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.
17 //
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
21 // USA.
22 //
23 // Please report all bugs and problems to "fltk-bugs@fltk.org".
24 //
25
26 #ifndef Fl_Menu__H
27 #define Fl_Menu__H
28
29 #ifndef Fl_Widget_H
30 #include "Fl_Widget.H"
31 #endif
32 #include "Fl_Menu_Item.H"
33
34 class FL_EXPORT Fl_Menu_ : public Fl_Widget {
35
36   Fl_Menu_Item *menu_;
37   const Fl_Menu_Item *value_;
38
39 protected:
40
41   uchar alloc;
42   uchar down_box_;
43   uchar textfont_;
44   uchar textsize_;
45   unsigned textcolor_;
46
47 public:
48   const Fl_Menu_Item* picked(const Fl_Menu_Item*);
49
50   Fl_Menu_(int,int,int,int,const char * =0);
51   ~Fl_Menu_();
52
53   const Fl_Menu_Item* test_shortcut() {return picked(menu()->test_shortcut());}
54   void global();
55
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);}
62   int  size() const ;
63   void clear();
64   int  add(const char *);
65   void replace(int,const char *);
66   void remove(int);
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;}
70
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;}
77
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;}
84
85   Fl_Boxtype down_box() const {return (Fl_Boxtype)down_box_;}
86   void down_box(Fl_Boxtype b) {down_box_ = b;}
87
88   // back compatability:
89   Fl_Color down_color() const {return selection_color();}
90   void down_color(unsigned c) {selection_color(c);}
91 };
92
93 #endif
94
95 //
96 // End of "$Id: Fl_Menu_.H,v 1.2 2002/12/01 15:38:37 neurosurg Exp $".
97 //