summaryrefslogtreecommitdiff
path: root/src/Fl_Menu_.cxx
diff options
context:
space:
mode:
authorMatthias Melcher <github@matthiasm.com>2023-03-18 17:33:27 +0100
committerGitHub <noreply@github.com>2023-03-18 17:33:27 +0100
commit5c482f9d9b357e098f955351f425bc985254ff28 (patch)
treec410588ac915886aea4bef3478a12d682bb5ad9f /src/Fl_Menu_.cxx
parenta9fb6a979fbcf31c2405d61ea720879bd5507d02 (diff)
Fix and update alignment #346 (#701)
* interactive layout alignment rewritten * interface for new alignment rules * new alignment dialog box * user defined layout rules added * layout rules can be stored in projects, settings, and external files * Valgrind verification
Diffstat (limited to 'src/Fl_Menu_.cxx')
-rw-r--r--src/Fl_Menu_.cxx10
1 files changed, 6 insertions, 4 deletions
diff --git a/src/Fl_Menu_.cxx b/src/Fl_Menu_.cxx
index 60712a9ef..28a476e02 100644
--- a/src/Fl_Menu_.cxx
+++ b/src/Fl_Menu_.cxx
@@ -359,10 +359,11 @@ void Fl_Menu_::setonly(Fl_Menu_Item* item) {
}
/** Turns the radio item "on" for the menu item and turns "off" adjacent radio items set.
- \deprecated This method is dangerous if radio items are first in the menu.
- Use Fl_Menu_::setonly(Fl_Menu_Item*) instead.
+ \note This method is dangerous if radio items are first in the menu.
+ Make sure that \p first is set ciorrectly or use Fl_Menu_::setonly(Fl_Menu_Item*) instead.
+ \param[in] first start of menu array or NULL (default) if the radio group is not the first item
*/
-void Fl_Menu_Item::setonly() {
+void Fl_Menu_Item::setonly(Fl_Menu_Item const* first) {
flags |= FL_MENU_RADIO | FL_MENU_VALUE;
Fl_Menu_Item* j;
for (j = this; ; ) { // go down
@@ -371,9 +372,10 @@ void Fl_Menu_Item::setonly() {
if (!j->text || !j->radio()) break; // stop after group
j->clear();
}
- for (j = this-1; ; j--) { // go up
+ if (this != first) for (j = this-1; ; j--) { // go up
if (!j->text || (j->flags&FL_MENU_DIVIDER) || !j->radio()) break;
j->clear();
+ if (j == first) break;
}
}