Browse Source

Added some colour IDs for TextPropertyComponent

tags/2021-05-28
jules 13 years ago
parent
commit
c93d7a31d5
6 changed files with 40 additions and 9 deletions
  1. +5
    -1
      extras/Introjucer/Source/Application/jucer_JuceUpdater.cpp
  2. +5
    -1
      extras/Introjucer/Source/Project/jucer_ModulesPanel.h
  3. +7
    -2
      extras/JuceDemo/Source/MainDemoWindow.cpp
  4. +6
    -3
      modules/juce_gui_basics/lookandfeel/juce_LookAndFeel.cpp
  5. +3
    -2
      modules/juce_gui_basics/properties/juce_TextPropertyComponent.cpp
  6. +14
    -0
      modules/juce_gui_basics/properties/juce_TextPropertyComponent.h

+ 5
- 1
extras/Introjucer/Source/Application/jucer_JuceUpdater.cpp View File

@@ -273,7 +273,6 @@ Component* JuceUpdater::refreshComponentForRow (int rowNumber, bool isRowSelecte
: updater (updater_) : updater (updater_)
{ {
addChildComponent (&toggle); addChildComponent (&toggle);
toggle.setBounds ("2, 2, parent.height - 2, parent.height - 2");
toggle.setWantsKeyboardFocus (false); toggle.setWantsKeyboardFocus (false);
setInterceptsMouseClicks (false, true); setInterceptsMouseClicks (false, true);
} }
@@ -328,6 +327,11 @@ Component* JuceUpdater::refreshComponentForRow (int rowNumber, bool isRowSelecte
Justification::centredLeft, true); Justification::centredLeft, true);
} }
void resized()
{
toggle.setBounds (getLocalBounds().reduced (2));
}
private: private:
JuceUpdater& updater; JuceUpdater& updater;
ToggleButton toggle; ToggleButton toggle;


+ 5
- 1
extras/Introjucer/Source/Project/jucer_ModulesPanel.h View File

@@ -349,7 +349,6 @@ public:
addAndMakeVisible (&fixButton); addAndMakeVisible (&fixButton);
fixButton.setColour (TextButton::buttonColourId, Colours::red); fixButton.setColour (TextButton::buttonColourId, Colours::red);
fixButton.setColour (TextButton::textColourOffId, Colours::white); fixButton.setColour (TextButton::textColourOffId, Colours::white);
fixButton.setBounds ("right - 160, parent.height - 26, parent.width - 8, top + 22");
fixButton.addListener (this); fixButton.addListener (this);
} }
@@ -381,6 +380,11 @@ public:
mp->refresh(); mp->refresh();
} }
void resized()
{
fixButton.setBounds (getWidth() - 168, getHeight() - 26, 160, 22);
}
private: private:
Project& project; Project& project;
ModuleList& moduleList; ModuleList& moduleList;


+ 7
- 2
extras/JuceDemo/Source/MainDemoWindow.cpp View File

@@ -54,13 +54,18 @@ public:
g.fillAll (Colours::white); g.fillAll (Colours::white);
} }
void resized()
{
if (currentDemo != nullptr)
currentDemo->setBounds (getLocalBounds());
}
//============================================================================== //==============================================================================
void showDemo (Component* demoComp) void showDemo (Component* demoComp)
{ {
currentDemo = demoComp; currentDemo = demoComp;
addAndMakeVisible (currentDemo); addAndMakeVisible (currentDemo);
currentDemo->setBounds ("0, 0, parent.width, parent.height");
resized();
} }
//============================================================================== //==============================================================================


+ 6
- 3
modules/juce_gui_basics/lookandfeel/juce_LookAndFeel.cpp View File

@@ -140,9 +140,6 @@ LookAndFeel::LookAndFeel()
TextButton::textColourOnId, 0xff000000, TextButton::textColourOnId, 0xff000000,
TextButton::textColourOffId, 0xff000000, TextButton::textColourOffId, 0xff000000,
ComboBox::buttonColourId, 0xffbbbbff,
ComboBox::outlineColourId, standardOutlineColour,
ToggleButton::textColourId, 0xff000000, ToggleButton::textColourId, 0xff000000,
TextEditor::backgroundColourId, 0xffffffff, TextEditor::backgroundColourId, 0xffffffff,
@@ -172,10 +169,16 @@ LookAndFeel::LookAndFeel()
PopupMenu::highlightedTextColourId, 0xffffffff, PopupMenu::highlightedTextColourId, 0xffffffff,
PopupMenu::highlightedBackgroundColourId, 0x991111aa, PopupMenu::highlightedBackgroundColourId, 0x991111aa,
ComboBox::buttonColourId, 0xffbbbbff,
ComboBox::outlineColourId, standardOutlineColour,
ComboBox::textColourId, 0xff000000, ComboBox::textColourId, 0xff000000,
ComboBox::backgroundColourId, 0xffffffff, ComboBox::backgroundColourId, 0xffffffff,
ComboBox::arrowColourId, 0x99000000, ComboBox::arrowColourId, 0x99000000,
TextPropertyComponent::backgroundColourId, 0xffffffff,
TextPropertyComponent::textColourId, 0xff000000,
TextPropertyComponent::outlineColourId, standardOutlineColour,
ListBox::backgroundColourId, 0xffffffff, ListBox::backgroundColourId, 0xffffffff,
ListBox::outlineColourId, standardOutlineColour, ListBox::outlineColourId, standardOutlineColour,
ListBox::textColourId, 0xff000000, ListBox::textColourId, 0xff000000,


+ 3
- 2
modules/juce_gui_basics/properties/juce_TextPropertyComponent.cpp View File

@@ -35,8 +35,9 @@ public:
{ {
setEditable (true, true, false); setEditable (true, true, false);
setColour (backgroundColourId, findColour (Label::backgroundColourId));
setColour (outlineColourId, findColour (Label::outlineColourId));
setColour (backgroundColourId, owner.findColour (TextPropertyComponent::backgroundColourId));
setColour (outlineColourId, owner.findColour (TextPropertyComponent::outlineColourId));
setColour (textColourId, owner.findColour (TextPropertyComponent::textColourId));
} }
TextEditor* createEditorComponent() TextEditor* createEditorComponent()


+ 14
- 0
modules/juce_gui_basics/properties/juce_TextPropertyComponent.h View File

@@ -78,6 +78,20 @@ public:
/** Returns the text that should be shown in the text editor. */ /** Returns the text that should be shown in the text editor. */
virtual String getText() const; virtual String getText() const;
//==============================================================================
/** A set of colour IDs to use to change the colour of various aspects of the component.
These constants can be used either via the Component::setColour(), or LookAndFeel::setColour()
methods.
@see Component::setColour, Component::findColour, LookAndFeel::setColour, LookAndFeel::findColour
*/
enum ColourIds
{
backgroundColourId = 0x100e401, /**< The colour to fill the background of the text area. */
textColourId = 0x100e402, /**< The colour to use for the editable text. */
outlineColourId = 0x100e403, /**< The colour to use to draw an outline around the text area. */
};
//============================================================================== //==============================================================================
/** @internal */ /** @internal */


Loading…
Cancel
Save