Example #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);
}
Example #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);
    }
}
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);
}
void ProjucerLookAndFeel::drawMenuBarBackground (Graphics& g, int width, int height,
                                                 bool, MenuBarComponent& menuBar)
{
    const auto colour = menuBar.findColour (backgroundColourId).withAlpha (0.75f);

    Rectangle<int> r (width, height);

    g.setColour (colour.contrasting (0.15f));
    g.fillRect  (r.removeFromTop (1));
    g.fillRect  (r.removeFromBottom (1));

    g.setGradientFill (ColourGradient (colour, 0, 0, colour.darker (0.2f), 0, (float)height, false));
    g.fillRect (r);
}
void OldSchoolLookAndFeel::drawMenuBarBackground (Graphics& g, int /*width*/, int /*height*/,
                                                  bool, MenuBarComponent& menuBar)
{
    g.fillAll (menuBar.findColour (PopupMenu::backgroundColourId));
}
Example #6
0
void HoaLookAndFeel::drawMenuBarBackground (Graphics& g, int /*width*/, int /*height*/,
                                                  bool, MenuBarComponent& menuBar)
{
    g.fillAll (menuBar.findColour (ComboBox::backgroundColourId));
}
Example #7
0
int CtrlrMenuBarLookAndFeel::getMenuBarItemWidth (MenuBarComponent &menuBar, int itemIndex, const String &itemText)
{
	return getMenuBarFont (menuBar, itemIndex, itemText).getStringWidth (itemText) + menuBar.getHeight();
}