1998-10-20 01:39:29 +04:00
|
|
|
//
|
2002-01-01 18:11:33 +03:00
|
|
|
// "$Id: Fl_Menu_.H,v 1.7.2.4.2.2 2002/01/01 15:11:27 easysw Exp $"
|
1998-10-20 01:39:29 +04:00
|
|
|
//
|
|
|
|
// Menu base class header file for the Fast Light Tool Kit (FLTK).
|
|
|
|
//
|
2002-01-01 18:11:33 +03:00
|
|
|
// Copyright 1998-2002 by Bill Spitzak and others.
|
1998-10-20 01:39:29 +04:00
|
|
|
//
|
|
|
|
// 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.
|
|
|
|
//
|
2000-06-06 01:21:24 +04:00
|
|
|
// Please report all bugs and problems to "fltk-bugs@fltk.org".
|
1998-10-20 01:39:29 +04:00
|
|
|
//
|
1998-10-06 22:21:25 +04:00
|
|
|
|
|
|
|
#ifndef Fl_Menu__H
|
|
|
|
#define Fl_Menu__H
|
|
|
|
|
|
|
|
#ifndef Fl_Widget_H
|
|
|
|
#include "Fl_Widget.H"
|
|
|
|
#endif
|
|
|
|
#include "Fl_Menu_Item.H"
|
|
|
|
|
|
|
|
class Fl_Menu_ : public Fl_Widget {
|
|
|
|
|
|
|
|
Fl_Menu_Item *menu_;
|
|
|
|
const Fl_Menu_Item *value_;
|
|
|
|
|
|
|
|
protected:
|
|
|
|
|
2001-10-29 06:44:33 +03:00
|
|
|
uchar alloc;
|
1998-10-06 22:21:25 +04:00
|
|
|
uchar down_box_;
|
|
|
|
uchar textfont_;
|
|
|
|
uchar textsize_;
|
2001-10-29 06:44:33 +03:00
|
|
|
unsigned textcolor_;
|
1998-10-06 22:21:25 +04:00
|
|
|
|
|
|
|
public:
|
1999-08-09 10:19:33 +04:00
|
|
|
FL_EXPORT const Fl_Menu_Item* picked(const Fl_Menu_Item*);
|
1998-10-06 22:21:25 +04:00
|
|
|
|
1999-02-17 01:00:04 +03:00
|
|
|
FL_EXPORT Fl_Menu_(int,int,int,int,const char * =0);
|
|
|
|
FL_EXPORT ~Fl_Menu_();
|
1998-10-06 22:21:25 +04:00
|
|
|
|
|
|
|
const Fl_Menu_Item* test_shortcut() {return picked(menu()->test_shortcut());}
|
1999-02-17 01:00:04 +03:00
|
|
|
FL_EXPORT void global();
|
1998-10-06 22:21:25 +04:00
|
|
|
|
|
|
|
const Fl_Menu_Item *menu() const {return menu_;}
|
1999-02-17 01:00:04 +03:00
|
|
|
FL_EXPORT void menu(const Fl_Menu_Item *m);
|
|
|
|
FL_EXPORT void copy(const Fl_Menu_Item *m, void* user_data = 0);
|
|
|
|
FL_EXPORT int add(const char*, int shortcut, Fl_Callback*, void* = 0, int = 0);
|
1998-10-06 22:21:25 +04:00
|
|
|
int add(const char* a, const char* b, Fl_Callback* c,
|
|
|
|
void* d = 0, int e = 0) {return add(a,fl_old_shortcut(b),c,d,e);}
|
1999-02-17 01:00:04 +03:00
|
|
|
FL_EXPORT int size() const ;
|
|
|
|
FL_EXPORT void clear();
|
|
|
|
FL_EXPORT int add(const char *);
|
|
|
|
FL_EXPORT void replace(int,const char *);
|
|
|
|
FL_EXPORT void remove(int);
|
1998-10-06 22:21:25 +04:00
|
|
|
void shortcut(int i, int s) {menu_[i].shortcut(s);}
|
|
|
|
void mode(int i,int x) {menu_[i].flags = x;}
|
|
|
|
int mode(int i) const {return menu_[i].flags;}
|
|
|
|
|
|
|
|
const Fl_Menu_Item *mvalue() const {return value_;}
|
|
|
|
int value() const {return value_-menu_;}
|
1999-02-17 01:00:04 +03:00
|
|
|
FL_EXPORT int value(const Fl_Menu_Item*);
|
1998-10-06 22:21:25 +04:00
|
|
|
int value(int i) {return value(menu_+i);}
|
|
|
|
const char *text() const {return value_ ? value_->text : 0;}
|
|
|
|
const char *text(int i) const {return menu_[i].text;}
|
|
|
|
|
|
|
|
Fl_Font textfont() const {return (Fl_Font)textfont_;}
|
|
|
|
void textfont(uchar c) {textfont_=c;}
|
|
|
|
uchar textsize() const {return textsize_;}
|
|
|
|
void textsize(uchar c) {textsize_=c;}
|
|
|
|
Fl_Color textcolor() const {return (Fl_Color)textcolor_;}
|
2001-10-29 06:44:33 +03:00
|
|
|
void textcolor(unsigned c) {textcolor_=c;}
|
1998-10-06 22:21:25 +04:00
|
|
|
|
|
|
|
Fl_Boxtype down_box() const {return (Fl_Boxtype)down_box_;}
|
|
|
|
void down_box(Fl_Boxtype b) {down_box_ = b;}
|
|
|
|
|
|
|
|
// back compatability:
|
|
|
|
Fl_Color down_color() const {return selection_color();}
|
2001-10-29 06:44:33 +03:00
|
|
|
void down_color(unsigned c) {selection_color(c);}
|
1998-10-06 22:21:25 +04:00
|
|
|
};
|
|
|
|
|
|
|
|
#endif
|
1998-10-20 01:39:29 +04:00
|
|
|
|
|
|
|
//
|
2002-01-01 18:11:33 +03:00
|
|
|
// End of "$Id: Fl_Menu_.H,v 1.7.2.4.2.2 2002/01/01 15:11:27 easysw Exp $".
|
1998-10-20 01:39:29 +04:00
|
|
|
//
|