FLTK 1.4.4
Toggle main menu visibility
Loading...
Searching...
No Matches
Fl_Menu_.H
1
//
2
// Menu base class header file for the Fast Light Tool Kit (FLTK).
3
//
4
// Copyright 1998-2024 by Bill Spitzak and others.
5
//
6
// This library is free software. Distribution and use rights are outlined in
7
// the file "COPYING" which should have been included with this file. If this
8
// file is missing or damaged, see the license at:
9
//
10
// https://www.fltk.org/COPYING.php
11
//
12
// Please see the following page on how to report bugs and issues:
13
//
14
// https://www.fltk.org/bugs.php
15
//
16
17
/* \file
18
Fl_Menu_ widget . */
19
20
#ifndef Fl_Menu__H
21
#define Fl_Menu__H
22
23
#ifndef Fl_Widget_H
24
#include "
Fl_Widget.H
"
25
#endif
26
#include "
Fl_Menu_Item.H
"
27
53
class
FL_EXPORT
Fl_Menu_
:
public
Fl_Widget {
54
55
Fl_Menu_Item
*menu_;
56
const
Fl_Menu_Item
*value_;
57
const
Fl_Menu_Item
*prev_value_;
58
59
protected
:
60
61
uchar
alloc;
// flag indicates if menu_ is a dynamic copy (=1) or not (=0)
62
uchar
down_box_;
63
Fl_Boxtype
menu_box_;
64
Fl_Font
textfont_;
65
Fl_Fontsize
textsize_;
66
Fl_Color
textcolor_;
67
68
int
item_pathname_(
char
*name,
int
namelen,
const
Fl_Menu_Item
*finditem,
69
const
Fl_Menu_Item
*
menu
=0)
const
;
70
public
:
71
Fl_Menu_
(
int
,
int
,
int
,
int
,
const
char
* =0);
72
~Fl_Menu_
();
73
74
int
item_pathname
(
char
*name,
int
namelen,
const
Fl_Menu_Item
*finditem=0)
const
;
75
const
Fl_Menu_Item
*
picked
(
const
Fl_Menu_Item
*);
76
const
Fl_Menu_Item
*
find_item
(
const
char
*name);
77
const
Fl_Menu_Item
*
find_item
(
Fl_Callback
*);
78
const
Fl_Menu_Item
*
find_item_with_user_data
(
void
*);
79
const
Fl_Menu_Item
*
find_item_with_argument
(
long
);
80
int
find_index
(
const
char
*name)
const
;
81
int
find_index
(
const
Fl_Menu_Item
*item)
const
;
82
int
find_index
(
Fl_Callback
*cb)
const
;
83
95
const
Fl_Menu_Item
*
test_shortcut
() {
return
picked
(
menu
()->
test_shortcut
());}
96
void
global();
97
133
const
Fl_Menu_Item
*
menu
()
const
{
return
menu_;}
134
const
Fl_Menu_Item
*menu_end();
// in src/Fl_Menu_add.cxx
135
void
menu(
const
Fl_Menu_Item
*m);
136
void
copy(
const
Fl_Menu_Item
*m,
void
* user_data = 0);
137
int
insert(
int
index,
const
char
*,
int
shortcut,
Fl_Callback
*,
void
* = 0,
int
= 0);
138
int
add(
const
char
*,
int
shortcut,
Fl_Callback
*,
void
* = 0,
int
= 0);
// see src/Fl_Menu_add.cxx
140
int
add
(
const
char
* a,
const
char
* b,
Fl_Callback
* c,
void
* d = 0,
int
e = 0) {
141
return
add
(a,fl_old_shortcut(b),c,d,e);
142
}
143
144
int
insert
(
int
index,
const
char
* a,
const
char
* b,
Fl_Callback
* c,
void
* d = 0,
int
e = 0) {
145
return
insert
(index,a,fl_old_shortcut(b),c,d,e);
146
}
147
int
add(
const
char
*);
148
int
size
()
const
;
149
void
size
(
int
W,
int
H) {
Fl_Widget::size
(W, H); }
150
void
clear();
151
int
clear_submenu(
int
index);
152
void
replace(
int
,
const
char
*);
153
void
remove(
int
);
155
void
shortcut
(
int
i,
int
s) {menu_[i].shortcut(s);}
157
void
mode
(
int
i,
int
fl) {menu_[i].flags = fl;}
159
int
mode
(
int
i)
const
{
return
menu_[i].flags;}
160
162
const
Fl_Menu_Item
*
mvalue
()
const
{
return
value_;}
163
167
const
Fl_Menu_Item
*
prev_mvalue
()
const
{
return
prev_value_;}
168
// Return the index into the menu() of the last item chosen by the user or -1.
169
int
value()
const
;
170
// Set the internal value_ of the menu to the given Fl_Menu_Item.
171
int
value(
const
Fl_Menu_Item
*);
205
int
value
(
int
i) {
206
if
(!menu_ || i < 0 || i >=
size
())
207
return
0;
208
return
value
(menu_ + i);
209
}
210
212
const
char
*
text
()
const
{
return
value_ ? value_->text : 0;}
214
const
char
*
text
(
int
i)
const
{
return
menu_[i].text;}
215
217
Fl_Font
textfont
()
const
{
return
textfont_;}
219
void
textfont
(
Fl_Font
c) {textfont_=c;}
221
Fl_Fontsize
textsize
()
const
{
return
textsize_;}
223
void
textsize
(
Fl_Fontsize
c) {textsize_=c;}
225
Fl_Color
textcolor
()
const
{
return
textcolor_;}
227
void
textcolor
(
Fl_Color
c) {textcolor_=c;}
228
233
Fl_Boxtype
down_box
()
const
{
return
(
Fl_Boxtype
)down_box_;}
235
void
down_box
(
Fl_Boxtype
b) {down_box_ = b;}
236
240
Fl_Boxtype
menu_box
()
const
{
return
menu_box_; }
245
void
menu_box
(
Fl_Boxtype
b) { menu_box_ = b; }
246
248
Fl_Color
down_color
()
const
{
return
selection_color
();}
250
void
down_color
(
unsigned
c) {
selection_color
(c);}
251
void
setonly(
Fl_Menu_Item
* item);
252
};
253
254
#endif
Fl_Font
int Fl_Font
A font number is an index into the internal font table.
Definition
Enumerations.H:1063
Fl_Color
unsigned int Fl_Color
An FLTK color value; see also Colors.
Definition
Enumerations.H:1120
Fl_Fontsize
int Fl_Fontsize
Size of a font in pixels.
Definition
Enumerations.H:1092
Fl_Boxtype
Fl_Boxtype
FLTK standard box types.
Definition
Enumerations.H:644
Fl_Menu_Item.H
Fl_Widget.H
Fl_Widget and 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:33
Fl_Menu_::picked
const Fl_Menu_Item * picked(const Fl_Menu_Item *)
When user picks a menu item, call this.
Definition
Fl_Menu_.cxx:385
Fl_Menu_::down_color
Fl_Color down_color() const
For back compatibility, same as selection_color().
Definition
Fl_Menu_.H:248
Fl_Menu_::mode
void mode(int i, int fl)
Set the flags of item i.
Definition
Fl_Menu_.H:157
Fl_Menu_::down_color
void down_color(unsigned c)
For back compatibility, same as selection_color().
Definition
Fl_Menu_.H:250
Fl_Menu_::prev_mvalue
const Fl_Menu_Item * prev_mvalue() const
Return a pointer to the menu item that was picked before the current one was picked.
Definition
Fl_Menu_.H:167
Fl_Menu_::menu_box
void menu_box(Fl_Boxtype b)
Set the box type for the menu popup windows.
Definition
Fl_Menu_.H:245
Fl_Menu_::find_item_with_argument
const Fl_Menu_Item * find_item_with_argument(long)
Find the menu item for the given user argument v.
Definition
Fl_Menu_.cxx:293
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:384
Fl_Menu_::textfont
Fl_Font textfont() const
Gets the current font of menu item labels.
Definition
Fl_Menu_.H:217
Fl_Menu_::textsize
void textsize(Fl_Fontsize c)
Sets the font size of menu item labels.
Definition
Fl_Menu_.H:223
Fl_Menu_::value
int value() const
Return the index into the menu() of the last item chosen by the user.
Definition
Fl_Menu_.cxx:365
Fl_Menu_::down_box
void down_box(Fl_Boxtype b)
Sets the box type used to surround the currently-selected items in the menus.
Definition
Fl_Menu_.H:235
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:144
Fl_Menu_::value
int value(int i)
Set the value of the menu to index i.
Definition
Fl_Menu_.H:205
Fl_Menu_::text
const char * text(int i) const
Returns the title of item i.
Definition
Fl_Menu_.H:214
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:149
Fl_Menu_::textsize
Fl_Fontsize textsize() const
Gets the font size of menu item labels.
Definition
Fl_Menu_.H:221
Fl_Menu_::menu
const Fl_Menu_Item * menu() const
Returns a pointer to the array of Fl_Menu_Items.
Definition
Fl_Menu_.H:133
Fl_Menu_::textcolor
void textcolor(Fl_Color c)
Sets the current color of menu item labels.
Definition
Fl_Menu_.H:227
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:140
Fl_Menu_::shortcut
void shortcut(int i, int s)
Change the shortcut of item i to s.
Definition
Fl_Menu_.H:155
Fl_Menu_::mvalue
const Fl_Menu_Item * mvalue() const
Return a pointer to the last menu item that was picked.
Definition
Fl_Menu_.H:162
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:218
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:486
Fl_Menu_::menu_box
Fl_Boxtype menu_box() const
Get the box type for the menu popup windows.
Definition
Fl_Menu_.H:240
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:63
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:348
Fl_Menu_::text
const char * text() const
Returns the title of the last item chosen.
Definition
Fl_Menu_.H:212
Fl_Menu_::mode
int mode(int i) const
Get the flags of item i.
Definition
Fl_Menu_.H:159
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:233
Fl_Menu_::test_shortcut
const Fl_Menu_Item * test_shortcut()
Returns the menu item with the entered shortcut (key value).
Definition
Fl_Menu_.H:95
Fl_Menu_::textfont
void textfont(Fl_Font c)
Sets the current font of menu item labels.
Definition
Fl_Menu_.H:219
Fl_Menu_::find_item_with_user_data
const Fl_Menu_Item * find_item_with_user_data(void *)
Find the menu item for the given user data v.
Definition
Fl_Menu_.cxx:276
Fl_Menu_::textcolor
Fl_Color textcolor() const
Get the current color of menu item labels.
Definition
Fl_Menu_.H:225
Fl_Widget::selection_color
Fl_Color selection_color() const
Gets the selection color.
Definition
Fl_Widget.H:473
Fl_Widget::size
void size(int W, int H)
Changes the size of the widget.
Definition
Fl_Widget.H:418
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:124
FL
Fl_Menu_.H
Generated by
1.17.0