summaryrefslogtreecommitdiff
path: root/FL
diff options
context:
space:
mode:
authorAlbrecht Schlosser <albrechts.fltk@online.de>2010-11-11 09:12:05 +0000
committerAlbrecht Schlosser <albrechts.fltk@online.de>2010-11-11 09:12:05 +0000
commit2105f203f18ef44e4710fc07148f1a2e5376cc68 (patch)
treeb817a490852c964657aff73d9699ba1135943203 /FL
parent832c8787ab3769d6120b6b9c87581aae16cb3558 (diff)
Fixed menu and shortcut handling (STR #2243). This partly reverts the
fix for STR #2199 - for details see STR #2243. git-svn-id: file:///fltk/svn/fltk/branches/branch-1.3@7816 ea41ed52-d2ee-0310-a9c1-e6b18d33e121
Diffstat (limited to 'FL')
-rw-r--r--FL/Fl_Menu_.H13
-rw-r--r--FL/Fl_Menu_Item.H2
-rw-r--r--FL/Fl_Widget.H8
3 files changed, 17 insertions, 6 deletions
diff --git a/FL/Fl_Menu_.H b/FL/Fl_Menu_.H
index 7cb4cd18e..4b4e4f30f 100644
--- a/FL/Fl_Menu_.H
+++ b/FL/Fl_Menu_.H
@@ -70,6 +70,17 @@ public:
int find_index(const Fl_Menu_Item *item) const;
int find_index(Fl_Callback *cb) const;
+ /**
+ Returns the menu item with the entered shortcut (key value).
+
+ This searches the complete menu() for a shortcut that matches the
+ entered key value. It must be called for a FL_KEYBOARD or FL_SHORTCUT
+ event.
+
+ If a match is found, the menu's callback will be called.
+
+ \return matched Fl_Menu_Item or NULL.
+ */
const Fl_Menu_Item* test_shortcut() {return picked(menu()->test_shortcut());}
void global();
@@ -118,7 +129,7 @@ public:
int value(int i) {return value(menu_+i);}
/** Returns the title of the last item chosen. */
const char *text() const {return value_ ? value_->text : 0;}
- /** Returns the title of the last item chosen, or of item i. */
+ /** Returns the title of item i. */
const char *text(int i) const {return menu_[i].text;}
/** Gets the current font of menu item labels. */
diff --git a/FL/Fl_Menu_Item.H b/FL/Fl_Menu_Item.H
index 31620e16f..7dde44720 100644
--- a/FL/Fl_Menu_Item.H
+++ b/FL/Fl_Menu_Item.H
@@ -349,7 +349,7 @@ struct FL_EXPORT Fl_Menu_Item {
const Fl_Menu_Item* title = 0,
int menubar=0) const;
const Fl_Menu_Item* test_shortcut() const;
- const Fl_Menu_Item* find_shortcut(int *ip=0) const;
+ const Fl_Menu_Item* find_shortcut(int *ip=0, const bool require_alt = false) const;
/**
Calls the Fl_Menu_Item item's callback, and provides the
diff --git a/FL/Fl_Widget.H b/FL/Fl_Widget.H
index 0b89ad9eb..d20ee6b7e 100644
--- a/FL/Fl_Widget.H
+++ b/FL/Fl_Widget.H
@@ -845,12 +845,12 @@ public:
// Documentation and implementation in Fl_Widget.cxx
void do_callback(Fl_Widget* o,void* arg=0);
- /** Internal use only. */
+ /* Internal use only. */
int test_shortcut();
- /** Internal use only. */
+ /* Internal use only. */
static unsigned int label_shortcut(const char *t);
- /** Internal use only. */
- static int test_shortcut(const char*);
+ /* Internal use only. */
+ static int test_shortcut(const char*, const bool require_alt = false);
/** Checks if w is a child of this widget.
\param[in] w potential child widget