Fl_Menu_.H
//
// "$Id: Fl_Menu_.H 9202 2011-12-08 17:10:11Z greg.ercolano $"
//
// Menu base class header file for the Fast Light Tool Kit (FLTK).
//
// Copyright 1998-2010 by Bill Spitzak and others.
//
// This library is free software. Distribution and use rights are outlined in
// the file "COPYING" which should have been included with this file. If this
// file is missing or damaged, see the license at:
//
// http://www.fltk.org/COPYING.php
//
// Please report all bugs and problems on the following page:
//
// http://www.fltk.org/str.php
//
/* \file
Fl_Menu_ widget . */
#ifndef Fl_Menu__H
#define Fl_Menu__H
#ifndef Fl_Widget_H
#include "Fl_Widget.H"
#endif
#include "Fl_Menu_Item.H"
class FL_EXPORT Fl_Menu_ : public Fl_Widget {
Fl_Menu_Item *menu_;
const Fl_Menu_Item *value_;
protected:
uchar alloc; // flag indicates if menu_ is a dynamic copy (=1) or not (=0)
uchar down_box_;
Fl_Font textfont_;
Fl_Fontsize textsize_;
Fl_Color textcolor_;
public:
Fl_Menu_(int,int,int,int,const char * =0);
~Fl_Menu_();
int item_pathname(char *name, int namelen, const Fl_Menu_Item *finditem=0) const;
const Fl_Menu_Item* picked(const Fl_Menu_Item*);
const Fl_Menu_Item* find_item(const char *name);
const Fl_Menu_Item* find_item(Fl_Callback*);
int find_index(const char *name) const;
int find_index(const Fl_Menu_Item *item) const;
int find_index(Fl_Callback *cb) const;
const Fl_Menu_Item* test_shortcut() {return picked(menu()->test_shortcut());}
void global();
const Fl_Menu_Item *menu() const {return menu_;}
void menu(const Fl_Menu_Item *m);
void copy(const Fl_Menu_Item *m, void* user_data = 0);
int insert(int index, const char*, int shortcut, Fl_Callback*, void* = 0, int = 0);
int add(const char*, int shortcut, Fl_Callback*, void* = 0, int = 0);
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);
}
int insert(int index, const char* a, const char* b, Fl_Callback* c, void* d = 0, int e = 0) {
return insert(index,a,fl_old_shortcut(b),c,d,e);
}
int add(const char *);
int size() const ;
void size(int W, int H) { Fl_Widget::size(W, H); }
void clear();
int clear_submenu(int index);
void replace(int,const char *);
void remove(int);
void shortcut(int i, int s) {menu_[i].shortcut(s);}
void mode(int i,int fl) {menu_[i].flags = fl;}
int mode(int i) const {return menu_[i].flags;}
const Fl_Menu_Item *mvalue() const {return value_;}
int value() const {return value_ ? (int)(value_-menu_) : -1;}
int value(const Fl_Menu_Item*);
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 textfont_;}
void textfont(Fl_Font c) {textfont_=c;}
Fl_Fontsize textsize() const {return textsize_;}
void textsize(Fl_Fontsize c) {textsize_=c;}
Fl_Color textcolor() const {return textcolor_;}
void textcolor(Fl_Color c) {textcolor_=c;}
Fl_Boxtype down_box() const {return (Fl_Boxtype)down_box_;}
void down_box(Fl_Boxtype b) {down_box_ = b;}
Fl_Color down_color() const {return selection_color();}
void down_color(unsigned c) {selection_color(c);}
};
#endif
//
// End of "$Id: Fl_Menu_.H 9202 2011-12-08 17:10:11Z greg.ercolano $".
//
- © 1998-2012 by Bill Spitzak and others.