diff --git a/extras/Introjucer/Source/Application/jucer_JuceUpdater.cpp b/extras/Introjucer/Source/Application/jucer_JuceUpdater.cpp index e406f591dd..ef958aeb92 100644 --- a/extras/Introjucer/Source/Application/jucer_JuceUpdater.cpp +++ b/extras/Introjucer/Source/Application/jucer_JuceUpdater.cpp @@ -273,7 +273,6 @@ Component* JuceUpdater::refreshComponentForRow (int rowNumber, bool isRowSelecte : updater (updater_) { addChildComponent (&toggle); - toggle.setBounds ("2, 2, parent.height - 2, parent.height - 2"); toggle.setWantsKeyboardFocus (false); setInterceptsMouseClicks (false, true); } @@ -328,6 +327,11 @@ Component* JuceUpdater::refreshComponentForRow (int rowNumber, bool isRowSelecte Justification::centredLeft, true); } + void resized() + { + toggle.setBounds (getLocalBounds().reduced (2)); + } + private: JuceUpdater& updater; ToggleButton toggle; diff --git a/extras/Introjucer/Source/Project/jucer_ModulesPanel.h b/extras/Introjucer/Source/Project/jucer_ModulesPanel.h index 16d97fd0d7..aa548b318c 100644 --- a/extras/Introjucer/Source/Project/jucer_ModulesPanel.h +++ b/extras/Introjucer/Source/Project/jucer_ModulesPanel.h @@ -349,7 +349,6 @@ public: addAndMakeVisible (&fixButton); fixButton.setColour (TextButton::buttonColourId, Colours::red); fixButton.setColour (TextButton::textColourOffId, Colours::white); - fixButton.setBounds ("right - 160, parent.height - 26, parent.width - 8, top + 22"); fixButton.addListener (this); } @@ -381,6 +380,11 @@ public: mp->refresh(); } + void resized() + { + fixButton.setBounds (getWidth() - 168, getHeight() - 26, 160, 22); + } + private: Project& project; ModuleList& moduleList; diff --git a/extras/JuceDemo/Source/MainDemoWindow.cpp b/extras/JuceDemo/Source/MainDemoWindow.cpp index 3742ea2388..4ccae3c604 100644 --- a/extras/JuceDemo/Source/MainDemoWindow.cpp +++ b/extras/JuceDemo/Source/MainDemoWindow.cpp @@ -54,13 +54,18 @@ public: g.fillAll (Colours::white); } + void resized() + { + if (currentDemo != nullptr) + currentDemo->setBounds (getLocalBounds()); + } + //============================================================================== void showDemo (Component* demoComp) { currentDemo = demoComp; addAndMakeVisible (currentDemo); - - currentDemo->setBounds ("0, 0, parent.width, parent.height"); + resized(); } //============================================================================== diff --git a/modules/juce_gui_basics/lookandfeel/juce_LookAndFeel.cpp b/modules/juce_gui_basics/lookandfeel/juce_LookAndFeel.cpp index c958dc9a65..02b9272a0c 100644 --- a/modules/juce_gui_basics/lookandfeel/juce_LookAndFeel.cpp +++ b/modules/juce_gui_basics/lookandfeel/juce_LookAndFeel.cpp @@ -140,9 +140,6 @@ LookAndFeel::LookAndFeel() TextButton::textColourOnId, 0xff000000, TextButton::textColourOffId, 0xff000000, - ComboBox::buttonColourId, 0xffbbbbff, - ComboBox::outlineColourId, standardOutlineColour, - ToggleButton::textColourId, 0xff000000, TextEditor::backgroundColourId, 0xffffffff, @@ -172,10 +169,16 @@ LookAndFeel::LookAndFeel() PopupMenu::highlightedTextColourId, 0xffffffff, PopupMenu::highlightedBackgroundColourId, 0x991111aa, + ComboBox::buttonColourId, 0xffbbbbff, + ComboBox::outlineColourId, standardOutlineColour, ComboBox::textColourId, 0xff000000, ComboBox::backgroundColourId, 0xffffffff, ComboBox::arrowColourId, 0x99000000, + TextPropertyComponent::backgroundColourId, 0xffffffff, + TextPropertyComponent::textColourId, 0xff000000, + TextPropertyComponent::outlineColourId, standardOutlineColour, + ListBox::backgroundColourId, 0xffffffff, ListBox::outlineColourId, standardOutlineColour, ListBox::textColourId, 0xff000000, diff --git a/modules/juce_gui_basics/properties/juce_TextPropertyComponent.cpp b/modules/juce_gui_basics/properties/juce_TextPropertyComponent.cpp index 4a8d4d10fe..5b67d0940c 100644 --- a/modules/juce_gui_basics/properties/juce_TextPropertyComponent.cpp +++ b/modules/juce_gui_basics/properties/juce_TextPropertyComponent.cpp @@ -35,8 +35,9 @@ public: { 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() diff --git a/modules/juce_gui_basics/properties/juce_TextPropertyComponent.h b/modules/juce_gui_basics/properties/juce_TextPropertyComponent.h index 39686849aa..34a9567e43 100644 --- a/modules/juce_gui_basics/properties/juce_TextPropertyComponent.h +++ b/modules/juce_gui_basics/properties/juce_TextPropertyComponent.h @@ -78,6 +78,20 @@ public: /** Returns the text that should be shown in the text editor. */ 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 */