1
0
Fork 0
mirror of https://github.com/juce-framework/JUCE.git synced 2026-01-30 02:50:05 +00:00

Added a colour ID TreeView::selectedItemBackgroundColourId, and changed the TreeView to fill selected items with this. (The colour is set to transparent by default so this won't affect existing code).

Updated the LookAndFeel::drawTreeviewPlusMinusBox and TreeViewItem::paintOpenCloseButton methods to provide more flexibility.
This commit is contained in:
jules 2013-10-27 12:49:17 +00:00
parent 020f138d20
commit 56ec1d1400
10 changed files with 71 additions and 57 deletions

View file

@ -271,10 +271,10 @@ public:
: owner (kec), commandID (command)
{}
String getUniqueName() const { return String ((int) commandID) + "_id"; }
bool mightContainSubItems() { return false; }
int getItemHeight() const { return 20; }
Component* createItemComponent() { return new ItemComponent (owner, commandID); }
String getUniqueName() const override { return String ((int) commandID) + "_id"; }
bool mightContainSubItems() override { return false; }
int getItemHeight() const override { return 20; }
Component* createItemComponent() override { return new ItemComponent (owner, commandID); }
private:
KeyMappingEditorComponent& owner;
@ -292,19 +292,24 @@ public:
: owner (kec), categoryName (name)
{}
String getUniqueName() const { return categoryName + "_cat"; }
bool mightContainSubItems() { return true; }
int getItemHeight() const { return 28; }
String getUniqueName() const override { return categoryName + "_cat"; }
bool mightContainSubItems() override { return true; }
int getItemHeight() const override { return 24; }
void paintItem (Graphics& g, int width, int height) override
{
g.setFont (Font (height * 0.6f, Font::bold));
g.setFont (Font (height * 0.7f, Font::bold));
g.setColour (owner.findColour (KeyMappingEditorComponent::textColourId));
g.drawText (TRANS (categoryName), 2, 0, width - 2, height,
Justification::centredLeft, true);
}
void paintOpenCloseButton (Graphics& g, const Rectangle<float>& area, Colour backgroundColour, bool isMouseOver) override
{
TreeViewItem::paintOpenCloseButton (g, area.reduced (4), backgroundColour, isMouseOver);
}
void itemOpennessChanged (bool isNowOpen) override
{
if (isNowOpen)