Skip to content

Commit e1a8672

Browse files
committed
Added option to WindowMenu for checked (ticked) items
1 parent cfe1b82 commit e1a8672

File tree

1 file changed

+29
-9
lines changed

1 file changed

+29
-9
lines changed

miniwindow.cpp

Lines changed: 29 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -3675,16 +3675,36 @@ CPoint menupoint (Left, Top);
36753675
if (vPopup.size () > 1)
36763676
vPopup.pop_back (); // drop last item
36773677
}
3678-
else if (strItem.Left (1) == "^")
3679-
vPopup.back ()->AppendMenu (MF_STRING | MF_GRAYED, 0, strItem.Mid (1));
3680-
else
3681-
{
3682-
strMXP_menu_item [j] = strItem;
3683-
vPopup.back ()->AppendMenu (MF_STRING | MF_ENABLED, MXP_FIRST_MENU + j, strItem);
3684-
j++;
3685-
if (j >= MXP_MENU_COUNT)
3686-
break;
3678+
else
3679+
{
3680+
// flags - will always be a string
3681+
UINT iFlags = MF_STRING;
3682+
3683+
while (strItem.Left (1) == "+" ||
3684+
strItem.Left (1) == "^")
3685+
{
3686+
// leading + means tick it
3687+
if (strItem.Left (1) == "+")
3688+
iFlags |= MF_CHECKED;
3689+
// and a carat means disabled
3690+
else if (strItem.Left (1) == "^")
3691+
iFlags |= MF_GRAYED;
3692+
3693+
strItem = strItem.Mid (1); // get rid of first character
3694+
} // end of while
3695+
3696+
if (iFlags & MF_GRAYED)
3697+
vPopup.back ()->AppendMenu (iFlags, 0, strItem);
3698+
else
3699+
{
3700+
strMXP_menu_item [j] = strItem;
3701+
vPopup.back ()->AppendMenu (iFlags, MXP_FIRST_MENU + j, strItem);
3702+
j++;
3703+
if (j >= MXP_MENU_COUNT)
3704+
break;
3705+
}
36873706
}
3707+
36883708
}
36893709

36903710
// without this line the auto-enable always set "no items" to active

0 commit comments

Comments
 (0)