FLTK 1.3.11
Toggle main menu visibility
Loading...
Searching...
No Matches
Fl_Menu_.H
1
//
2
// "$Id$"
3
//
4
// Menu base class header file for the Fast Light Tool Kit (FLTK).
5
//
6
// Copyright 1998-2016 by Bill Spitzak and others.
7
//
8
// This library is free software. Distribution and use rights are outlined in
9
// the file "COPYING" which should have been included with this file. If this
10
// file is missing or damaged, see the license at:
11
//
12
// http://www.fltk.org/COPYING.php
13
//
14
// Please report all bugs and problems on the following page:
15
//
16
// http://www.fltk.org/str.php
17
//
18
19
/* \file
20
Fl_Menu_ widget . */
21
22
#ifndef Fl_Menu__H
23
#define Fl_Menu__H
24
25
#ifndef Fl_Widget_H
26
#include "
Fl_Widget.H
"
27
#endif
28
#include "
Fl_Menu_Item.H
"
29
51
class
FL_EXPORT
Fl_Menu_
:
public
Fl_Widget {
52
53
Fl_Menu_Item
*menu_;
54
const
Fl_Menu_Item
*value_;
55
56
protected
:
57
58
uchar
alloc;
// flag indicates if menu_ is a dynamic copy (=1) or not (=0)
59
uchar
down_box_;
60
Fl_Font
textfont_;
61
Fl_Fontsize
textsize_;
62
Fl_Color
textcolor_;
63
64
int
item_pathname_(
char
*name,
int
namelen,
const
Fl_Menu_Item
*finditem,
65
const
Fl_Menu_Item
*
menu
=0)
const
;
66
public
:
67
Fl_Menu_
(
int
,
int
,
int
,
int
,
const
char
* =0);
68
~Fl_Menu_
();
69
70
int
item_pathname
(
char
*name,
int
namelen,
const
Fl_Menu_Item
*finditem=0)
const
;
71
const
Fl_Menu_Item
*
picked
(
const
Fl_Menu_Item
*);
72
const
Fl_Menu_Item
*
find_item
(
const
char
*name);
73
const
Fl_Menu_Item
*
find_item
(
Fl_Callback
*);
74
int
find_index
(
const
char
*name)
const
;
75
int
find_index
(
const
Fl_Menu_Item
*item)
const
;
76
int
find_index
(
Fl_Callback
*cb)
const
;
77
89
const
Fl_Menu_Item
*
test_shortcut
() {
return
picked
(
menu
()->
test_shortcut
());}
90
void
global();
91
110
const
Fl_Menu_Item
*
menu
()
const
{
return
menu_;}
111
void
menu(
const
Fl_Menu_Item
*m);
112
void
copy(
const
Fl_Menu_Item
*m,
void
* user_data = 0);
113
int
insert(
int
index,
const
char
*,
int
shortcut,
Fl_Callback
*,
void
* = 0,
int
= 0);
114
int
add(
const
char
*,
int
shortcut,
Fl_Callback
*,
void
* = 0,
int
= 0);
// see src/Fl_Menu_add.cxx
116
int
add
(
const
char
* a,
const
char
* b,
Fl_Callback
* c,
void
* d = 0,
int
e = 0) {
117
return
add
(a,fl_old_shortcut(b),c,d,e);
118
}
119
120
int
insert
(
int
index,
const
char
* a,
const
char
* b,
Fl_Callback
* c,
void
* d = 0,
int
e = 0) {
121
return
insert
(index,a,fl_old_shortcut(b),c,d,e);
122
}
123
int
add(
const
char
*);
124
int
size
()
const
;
125
void
size
(
int
W,
int
H) {
Fl_Widget::size
(W, H); }
126
void
clear();
127
int
clear_submenu(
int
index);
128
void
replace(
int
,
const
char
*);
129
void
remove(
int
);
131
void
shortcut
(
int
i,
int
s) {menu_[i].shortcut(s);}
133
void
mode
(
int
i,
int
fl) {menu_[i].flags = fl;}
135
int
mode
(
int
i)
const
{
return
menu_[i].flags;}
136
138
const
Fl_Menu_Item
*
mvalue
()
const
{
return
value_;}
140
int
value
()
const
{
return
value_ ? (int)(value_-menu_) : -1;}
141
int
value(
const
Fl_Menu_Item
*);
148
int
value
(
int
i) {
return
value
(menu_+i);}
150
const
char
*
text
()
const
{
return
value_ ? value_->text : 0;}
152
const
char
*
text
(
int
i)
const
{
return
menu_[i].text;}
153
155
Fl_Font
textfont
()
const
{
return
textfont_;}
157
void
textfont
(
Fl_Font
c) {textfont_=c;}
159
Fl_Fontsize
textsize
()
const
{
return
textsize_;}
161
void
textsize
(
Fl_Fontsize
c) {textsize_=c;}
163
Fl_Color
textcolor
()
const
{
return
textcolor_;}
165
void
textcolor
(
Fl_Color
c) {textcolor_=c;}
166
173
Fl_Boxtype
down_box
()
const
{
return
(
Fl_Boxtype
)down_box_;}
175
void
down_box
(
Fl_Boxtype
b) {down_box_ = b;}
176
178
Fl_Color
down_color
()
const
{
return
selection_color
();}
180
void
down_color
(
unsigned
c) {
selection_color
(c);}
181
void
setonly(
Fl_Menu_Item
* item);
182
};
183
184
#endif
185
186
//
187
// End of "$Id$".
188
//
Fl_Font
int Fl_Font
A font number is an index into the internal font table.
Definition
Enumerations.H:884
Fl_Color
unsigned int Fl_Color
An FLTK color value; see also Colors.
Definition
Enumerations.H:941
Fl_Fontsize
int Fl_Fontsize
Size of a font in pixels.
Definition
Enumerations.H:913
Fl_Boxtype
Fl_Boxtype
Definition
Enumerations.H:610
Fl_Menu_Item.H
Fl_Widget.H
Fl_Widget, Fl_Label classes .
Fl_Callback
void Fl_Callback(Fl_Widget *, void *)
Default callback type definition for all fltk widgets (by far the most used).
Definition
Fl_Widget.H:49
Fl_Menu_::picked
const Fl_Menu_Item * picked(const Fl_Menu_Item *)
When user picks a menu item, call this.
Definition
Fl_Menu_.cxx:288
Fl_Menu_::down_color
Fl_Color down_color() const
For back compatibility, same as selection_color().
Definition
Fl_Menu_.H:178
Fl_Menu_::mode
void mode(int i, int fl)
Sets the flags of item i.
Definition
Fl_Menu_.H:133
Fl_Menu_::down_color
void down_color(unsigned c)
For back compatibility, same as selection_color().
Definition
Fl_Menu_.H:180
Fl_Menu_::insert
int insert(int index, const char *, int shortcut, Fl_Callback *, void *=0, int=0)
Inserts a new menu item at the specified index position.
Definition
Fl_Menu_add.cxx:368
Fl_Menu_::textfont
Fl_Font textfont() const
Gets the current font of menu item labels.
Definition
Fl_Menu_.H:155
Fl_Menu_::textsize
void textsize(Fl_Fontsize c)
Sets the font size of menu item labels.
Definition
Fl_Menu_.H:161
Fl_Menu_::value
int value() const
Returns the index into menu() of the last item chosen by the user.
Definition
Fl_Menu_.H:140
Fl_Menu_::down_box
void down_box(Fl_Boxtype b)
See Fl_Boxtype Fl_Menu_::down_box() const.
Definition
Fl_Menu_.H:175
Fl_Menu_::insert
int insert(int index, const char *a, const char *b, Fl_Callback *c, void *d=0, int e=0)
See int Fl_Menu_::insert(const char* label, int shortcut, Fl_Callback*, void *user_data=0,...
Definition
Fl_Menu_.H:120
Fl_Menu_::value
int value(int i)
The value is the index into menu() of the last item chosen by the user.
Definition
Fl_Menu_.H:148
Fl_Menu_::text
const char * text(int i) const
Returns the title of item i.
Definition
Fl_Menu_.H:152
Fl_Menu_::find_item
const Fl_Menu_Item * find_item(const char *name)
Find the menu item for a given menu pathname, such as "Edit/Copy".
Definition
Fl_Menu_.cxx:151
Fl_Menu_::textsize
Fl_Fontsize textsize() const
Gets the font size of menu item labels.
Definition
Fl_Menu_.H:159
Fl_Menu_::menu
const Fl_Menu_Item * menu() const
Returns a pointer to the array of Fl_Menu_Items.
Definition
Fl_Menu_.H:110
Fl_Menu_::textcolor
void textcolor(Fl_Color c)
Sets the current color of menu item labels.
Definition
Fl_Menu_.H:165
Fl_Menu_::add
int add(const char *a, const char *b, Fl_Callback *c, void *d=0, int e=0)
See int Fl_Menu_::add(const char* label, int shortcut, Fl_Callback*, void *user_data=0,...
Definition
Fl_Menu_.H:116
Fl_Menu_::shortcut
void shortcut(int i, int s)
Changes the shortcut of item i to s.
Definition
Fl_Menu_.H:131
Fl_Menu_::mvalue
const Fl_Menu_Item * mvalue() const
Returns a pointer to the last menu item that was picked.
Definition
Fl_Menu_.H:138
Fl_Menu_::find_index
int find_index(const char *name) const
Find the menu item index for a given menu pathname, such as "Edit/Copy".
Definition
Fl_Menu_.cxx:220
Fl_Menu_::Fl_Menu_
Fl_Menu_(int, int, int, int, const char *=0)
Creates a new Fl_Menu_ widget using the given position, size, and label string.
Definition
Fl_Menu_.cxx:386
Fl_Menu_::item_pathname
int item_pathname(char *name, int namelen, const Fl_Menu_Item *finditem=0) const
Get the menu 'pathname' for the specified menuitem.
Definition
Fl_Menu_.cxx:65
Fl_Menu_::add
int add(const char *, int shortcut, Fl_Callback *, void *=0, int=0)
Adds a new menu item.
Definition
Fl_Menu_add.cxx:332
Fl_Menu_::text
const char * text() const
Returns the title of the last item chosen.
Definition
Fl_Menu_.H:150
Fl_Menu_::mode
int mode(int i) const
Gets the flags of item i.
Definition
Fl_Menu_.H:135
Fl_Menu_::down_box
Fl_Boxtype down_box() const
This box type is used to surround the currently-selected items in the menus.
Definition
Fl_Menu_.H:173
Fl_Menu_::test_shortcut
const Fl_Menu_Item * test_shortcut()
Returns the menu item with the entered shortcut (key value).
Definition
Fl_Menu_.H:89
Fl_Menu_::textfont
void textfont(Fl_Font c)
Sets the current font of menu item labels.
Definition
Fl_Menu_.H:157
Fl_Menu_::textcolor
Fl_Color textcolor() const
Get the current color of menu item labels.
Definition
Fl_Menu_.H:163
Fl_Widget::selection_color
Fl_Color selection_color() const
Gets the selection color.
Definition
Fl_Widget.H:396
Fl_Widget::size
void size(int W, int H)
Changes the size of the widget.
Definition
Fl_Widget.H:341
uchar
unsigned char uchar
unsigned char
Definition
fl_types.h:30
Fl_Menu_Item
The Fl_Menu_Item structure defines a single menu item that is used by the Fl_Menu_ class.
Definition
Fl_Menu_Item.H:112
FL
Fl_Menu_.H
Generated by
1.17.0