コード例 #1
0
void InterfaceComponent::paintListBoxItem (const int rowNumber,
                                           juce::Graphics& g,
                                           const int width, const int height,
                                           const bool isRowSelected)
{
    if (isRowSelected)
    {
        g.fillAll (juce::Colours::white.darker());
        g.setColour (juce::Colours::white.darker().contrasting());
    }
    else
    {
        g.setColour (fileListBox.findColour (juce::ListBox::textColourId));
    }

    g.setFont (height * 0.7f);

    g.drawText (files[rowNumber],
                5, 0, width, height,
                juce::Justification::centredLeft, false);

    const float h = (float) height;
    const float w = (float) width;
    const float offset = 5.0f;
    const float thickness = 0.25f;

    g.setColour (juce::Colours::lightgrey);

    g.drawLine (offset, h - thickness,
                w - (offset * 2.0f), h - thickness,
                thickness);
}
コード例 #2
0
void StringListBoxModel::paintListBoxItem(const int rowNumber,
        juce::Graphics &g,
        const int width,
        const int height,
        const bool /*rowIsSelected*/)
{
    if (rowNumber < getNumRows())
    {
        g.setColour(juce::Colours::black);
        juce::Font font(height * 0.7f);
        font.setHorizontalScale(0.9f);
        g.setFont(font);
        g.drawText(juce::String(items[rowNumber].c_str()), 4, 0, width - 6, height, juce::Justification::centredLeft);
    }
}