Esempio n. 1
0
    //==============================================================================
    void paintListBoxItem (int rowNumber, Graphics &g,
                           int width, int height, bool rowIsSelected) override
    {
        const auto textColour = getLookAndFeel().findColour (ListBox::textColourId);

        if (rowIsSelected)
            g.fillAll (textColour.interpolatedWith (getLookAndFeel().findColour (ListBox::backgroundColourId), 0.5));


        g.setColour (textColour);
        g.setFont (height * 0.7f);

        if (isInput)
        {
            if (rowNumber < parent.getNumMidiInputs())
                g.drawText (parent.getMidiDevice (rowNumber, true)->name,
                            5, 0, width, height,
                            Justification::centredLeft, true);
        }
        else
        {
            if (rowNumber < parent.getNumMidiOutputs())
                g.drawText (parent.getMidiDevice (rowNumber, false)->name,
                            5, 0, width, height,
                            Justification::centredLeft, true);
        }
    }
Esempio n. 2
0
	void paintRowBackground(Graphics& g, int /*rowNumber*/, int /*width*/, int /*height*/, bool rowIsSelected) override
	{
		const auto defaultColour = owner.findColour(ListBox::backgroundColourId);
		const auto c = rowIsSelected ? defaultColour.interpolatedWith(owner.findColour(ListBox::textColourId), 0.5f)
			: defaultColour;

		g.fillAll(c);
	}
Esempio n. 3
0
	void paintCell(Graphics& g, int row, int columnId, int width, int height, bool /*rowIsSelected*/) override
	{
		String text;
		bool isBlacklisted = row >= list.getNumTypes();

		if (isBlacklisted)
		{
			if (columnId == nameCol)
				text = list.getBlacklistedFiles()[row - list.getNumTypes()];
			else if (columnId == descCol)
				text = TRANS("Deactivated after failing to initialise correctly");
		}
		else if (const PluginDescription* const desc = list.getType(row))
		{
			switch (columnId)
			{
			case nameCol:         text = desc->name; break;
			case typeCol:         text = desc->pluginFormatName; break;
			case categoryCol:     text = desc->category.isNotEmpty() ? desc->category : "-"; break;
			case manufacturerCol: text = desc->manufacturerName; break;
			case descCol:         text = getPluginDescription(*desc); break;

			default: jassertfalse; break;
			}
		}

		if (text.isNotEmpty())
		{
			const auto defaultTextColour = owner.findColour(ListBox::textColourId);
			g.setColour(isBlacklisted ? Colours::red
				: columnId == nameCol ? defaultTextColour
				: defaultTextColour.interpolatedWith(Colours::transparentBlack, 0.3f));
			g.setFont(Font(height * 0.7f, Font::bold));
			g.drawFittedText(text, 4, 0, width - 6, height, Justification::centredLeft, 1, 0.9f);
		}
	}