Example #1
0
	void SetColor(rgb_color col)
	{
		if (!CompareColors (fColor, col)) {
			fColor = col;
			BMenu* parent = Menu();
			if (parent) parent->Invalidate(Frame());
		}
	}
Example #2
0
	void ResetColors(rgb_color col, rgb_color initial)
	{
		if (!CompareColors(fColor, col) || !CompareColors (fInitialColor, initial)) {
			fColor = col;
			fInitialColor = initial;
			BMenu* parent = Menu();
			if (parent) parent->Invalidate(Frame());
		}
	}
Example #3
0
void
IconMenuItem::SetMarked(bool mark)
{
    _inherited::SetMarked(mark);

    if (!mark)
        return;

    // we are marking the item

    BMenu* menu = Menu();
    if (menu == NULL)
        return;

    // we have a parent menu

    BMenu* _menu = menu;
    while ((_menu = _menu->Supermenu()) != NULL)
        menu = _menu;

    // went up the hierarchy to found the topmost menu

    if (menu == NULL || menu->Parent() == NULL)
        return;

    // our topmost menu has a parent

    if (dynamic_cast<BMenuField*>(menu->Parent()) == NULL)
        return;

    // our topmost menu's parent is a BMenuField

    BMenuItem* topLevelItem = menu->ItemAt((int32)0);

    if (topLevelItem == NULL)
        return;

    // our topmost menu has a menu item

    IconMenuItem* topLevelIconMenuItem
        = dynamic_cast<IconMenuItem*>(topLevelItem);
    if (topLevelIconMenuItem == NULL)
        return;

    // our topmost menu's item is an IconMenuItem

    // update the icon
    topLevelIconMenuItem->SetIcon(fDeviceIcon);
    menu->Invalidate();
}
Example #4
0
void
BMenuItem::SetEnabled(bool state)
{
	if (fEnabled == state)
		return;

	fEnabled = state;

	if (fSubmenu != NULL)
		fSubmenu->SetEnabled(state);

	BMenu *menu = Menu();
	if (menu != NULL && menu->LockLooper()) {
		menu->Invalidate(fBounds);
		menu->UnlockLooper();
	}
}