示例#1
0
void CtrlrMenuBarLookAndFeel::drawMenuBarItem (Graphics &g, int width, int height, int itemIndex, const String &itemText, bool isMouseOverItem, bool isMenuOpen, bool isMouseOverBar, MenuBarComponent &menuBar)
{
	if (itemText.isEmpty())
		return;

	Colour textColour	= getColour (Ids::ctrlrMenuBarTextColour);
	Font textFont		= getMenuBarFont (menuBar, itemIndex, itemText);

	if (!menuBar.isEnabled())
	{
		textColour = textColour.withMultipliedAlpha (0.5f);
	}
	else if (isMouseOverItem && !isMenuOpen)
	{
		textColour = getColour (Ids::ctrlrMenuBarHighlightedTextColour);
		drawSelectionRectangle (g, width, height, getColour (Ids::ctrlrMenuBarHighlightColour).darker(0.3f));
	}
	else if (isMouseOverItem && isMenuOpen)
	{
		textColour = getColour (Ids::ctrlrMenuBarHighlightedTextColour);
		drawSelectionRectangle (g, width, height, getColour (Ids::ctrlrMenuBarHighlightColour));
	}
	else if (isMenuOpen)
	{
		textColour = getColour (Ids::ctrlrMenuBarHighlightedTextColour);
		drawSelectionRectangle (g, width, height, getColour (Ids::ctrlrMenuBarHighlightColour));
	}

	g.setColour (textColour);
	g.setFont (textFont);
	g.drawFittedText (itemText, 0, 0, width, height, Justification::centred, 1);
}
示例#2
0
void NonShinyLookAndFeel::drawMenuBarBackground (Graphics& g, int width, int height,
                                         bool, MenuBarComponent& menuBar)
{
    const Colour baseColour (createBaseColour (menuBar.findColour (PopupMenu::backgroundColourId), false, false, false));

    if (menuBar.isEnabled())
    {
        drawShinyButtonShape (g,
                              -4.0f, 0.0f,
                              width + 8.0f, (float) height,
                              0.0f,
                              baseColour,
                              0.4f,
                              true, true, true, true);
    }
    else
    {
        g.fillAll (baseColour);
    }
}
示例#3
0
void ProjucerLookAndFeel::drawMenuBarItem (Graphics& g, int width, int height,
                                           int itemIndex, const String& itemText,
                                           bool isMouseOverItem, bool isMenuOpen,
                                           bool /*isMouseOverBar*/, MenuBarComponent& menuBar)
{
    if (! menuBar.isEnabled())
    {
        g.setColour (menuBar.findColour (defaultTextColourId)
                            .withMultipliedAlpha (0.5f));
    }
    else if (isMenuOpen || isMouseOverItem)
    {
        g.fillAll   (menuBar.findColour (defaultHighlightColourId).withAlpha (0.75f));
        g.setColour (menuBar.findColour (defaultHighlightedTextColourId));
    }
    else
    {
        g.setColour (menuBar.findColour (defaultTextColourId));
    }

    g.setFont (getMenuBarFont (menuBar, itemIndex, itemText));
    g.drawFittedText (itemText, 0, 0, width, height, Justification::centred, 1);
}