diff options
| author | ManoloFLTK <41016272+ManoloFLTK@users.noreply.github.com> | 2020-01-26 19:14:45 +0100 |
|---|---|---|
| committer | ManoloFLTK <41016272+ManoloFLTK@users.noreply.github.com> | 2020-01-26 19:15:30 +0100 |
| commit | 3384fe93dfb08be200bfde1e488177bb650376a6 (patch) | |
| tree | b55c71f5cba86391a57ca90d7b5fa6086d6b1f81 /FL/Fl_Widget.H | |
| parent | d2cb11369c8e6e846e16b88b327b871a498dac51 (diff) | |
Add Fl_Widget::shortcut_label(int) to control effect of '&' in some widget labels
Diffstat (limited to 'FL/Fl_Widget.H')
| -rw-r--r-- | FL/Fl_Widget.H | 22 |
1 files changed, 22 insertions, 0 deletions
diff --git a/FL/Fl_Widget.H b/FL/Fl_Widget.H index 89ca2e80f..375830f65 100644 --- a/FL/Fl_Widget.H +++ b/FL/Fl_Widget.H @@ -1042,6 +1042,28 @@ public: \deprecated Use selection_color(unsigned) instead. */ void color2(unsigned a) {color2_ = a;} + + /** Sets whether the widget's label use '&' to indicate shortcuts. + By default, all objects of classes Fl_Menu_ (and derivatives), Fl_Button (and derivatives), + Fl_Text_Display, Fl_Value_Input, and Fl_Input_ (and derivatives) + use character '&' in their label, unless '&' is repeated, + to indicate shortcuts: '&' does not appear in the drawn label, + the next character after '&' in the label is drawn underlined, and typing this character + triggers the corresponding menu window, button, or other widget. If the label contains 2 consecutive '&', + only one is drawn and the next character is not underlined and not used as a shortcut. + If \p value is set to 0, all these labels don't process character '&' as indicating a shortcut: + '&' is drawn in the label, the next character is not underlined and does not define a shortcut. + */ + void shortcut_label(int value) { + if (value) + set_flag(SHORTCUT_LABEL); + else + clear_flag(SHORTCUT_LABEL); + } + + /** Returns whether the widget's label use '&' to indicate shortcuts. + \see void shortcut_label(int value) */ + int shortcut_label() const { return flags_ & SHORTCUT_LABEL; } }; /** |
