mirror of
https://github.com/juce-framework/JUCE.git
synced 2026-01-10 23:44:24 +00:00
Fixed some issues in the JUCE Demo project where colours weren't being updated when changing the LookAndFeel with the keyboard shortcuts
This commit is contained in:
parent
3e7a111922
commit
63cf3e2057
15 changed files with 125 additions and 36 deletions
|
|
@ -308,9 +308,6 @@ public:
|
|||
resultsBox.setCaretVisible (false);
|
||||
resultsBox.setPopupMenuEnabled (true);
|
||||
|
||||
resultsBox.setColour (TextEditor::backgroundColourId,
|
||||
getUIColourIfAvailable (LookAndFeel_V4::ColourScheme::UIColour::widgetBackground,
|
||||
Colour (0x32ffffff)));
|
||||
resultsBox.setColour (TextEditor::outlineColourId, Colour (0x1c000000));
|
||||
resultsBox.setColour (TextEditor::shadowColourId, Colour (0x16000000));
|
||||
|
||||
|
|
@ -368,6 +365,13 @@ private:
|
|||
startTest();
|
||||
}
|
||||
|
||||
void lookAndFeelChanged() override
|
||||
{
|
||||
resultsBox.setColour (TextEditor::backgroundColourId,
|
||||
getUIColourIfAvailable (LookAndFeel_V4::ColourScheme::UIColour::widgetBackground,
|
||||
Colour (0x32ffffff)));
|
||||
}
|
||||
|
||||
JUCE_DECLARE_NON_COPYABLE_WITH_LEAK_DETECTOR (AudioLatencyDemo)
|
||||
};
|
||||
|
||||
|
|
|
|||
|
|
@ -113,6 +113,11 @@ private:
|
|||
dumpDeviceInfo();
|
||||
}
|
||||
|
||||
void lookAndFeelChanged() override
|
||||
{
|
||||
diagnosticsBox.applyFontToAllText (diagnosticsBox.getFont());
|
||||
}
|
||||
|
||||
static String getListOfActiveBits (const BitArray& b)
|
||||
{
|
||||
StringArray bits;
|
||||
|
|
|
|||
|
|
@ -299,6 +299,11 @@ private:
|
|||
}
|
||||
}
|
||||
|
||||
void lookAndFeelChanged() override
|
||||
{
|
||||
instructions.applyFontToAllText (instructions.getFont());
|
||||
}
|
||||
|
||||
static StringArray getTestsList()
|
||||
{
|
||||
const char* tests[] =
|
||||
|
|
|
|||
|
|
@ -205,6 +205,11 @@ private:
|
|||
testResultsBox.moveCaretToEnd();
|
||||
}
|
||||
|
||||
void lookAndFeelChanged() override
|
||||
{
|
||||
testResultsBox.applyFontToAllText (testResultsBox.getFont());
|
||||
}
|
||||
|
||||
JUCE_DECLARE_NON_COPYABLE_WITH_LEAK_DETECTOR (ChildProcessDemo)
|
||||
};
|
||||
|
||||
|
|
|
|||
|
|
@ -36,16 +36,6 @@ public:
|
|||
addAndMakeVisible (rsaGroup);
|
||||
rsaGroup.setText ("RSA Encryption");
|
||||
|
||||
rsaGroup.setColour (GroupComponent::outlineColourId,
|
||||
getUIColourIfAvailable (LookAndFeel_V4::ColourScheme::UIColour::outline,
|
||||
Colours::grey));
|
||||
rsaGroup.setColour (GroupComponent::textColourId,
|
||||
getUIColourIfAvailable (LookAndFeel_V4::ColourScheme::UIColour::defaultText,
|
||||
Colours::white));
|
||||
rsaResultBox.setColour (TextEditor::backgroundColourId,
|
||||
getUIColourIfAvailable (LookAndFeel_V4::ColourScheme::UIColour::widgetBackground,
|
||||
Colours::white.withAlpha (0.5f)));
|
||||
|
||||
bitSizeLabel.setText ("Num Bits to Use:", dontSendNotification);
|
||||
bitSizeLabel.attachToComponent (&bitSize, true);
|
||||
|
||||
|
|
@ -120,6 +110,22 @@ private:
|
|||
createRSAKey();
|
||||
}
|
||||
|
||||
void lookAndFeelChanged() override
|
||||
{
|
||||
rsaGroup.setColour (GroupComponent::outlineColourId,
|
||||
getUIColourIfAvailable (LookAndFeel_V4::ColourScheme::UIColour::outline,
|
||||
Colours::grey));
|
||||
rsaGroup.setColour (GroupComponent::textColourId,
|
||||
getUIColourIfAvailable (LookAndFeel_V4::ColourScheme::UIColour::defaultText,
|
||||
Colours::white));
|
||||
rsaResultBox.setColour (TextEditor::backgroundColourId,
|
||||
getUIColourIfAvailable (LookAndFeel_V4::ColourScheme::UIColour::widgetBackground,
|
||||
Colours::white.withAlpha (0.5f)));
|
||||
|
||||
bitSize.applyFontToAllText (bitSize.getFont());
|
||||
rsaResultBox.applyFontToAllText (rsaResultBox.getFont());
|
||||
}
|
||||
|
||||
JUCE_DECLARE_NON_COPYABLE_WITH_LEAK_DETECTOR (RSAComponent)
|
||||
};
|
||||
|
||||
|
|
@ -133,16 +139,6 @@ public:
|
|||
addAndMakeVisible (hashGroup);
|
||||
hashGroup.setText ("Hashes");
|
||||
|
||||
hashGroup.setColour (GroupComponent::outlineColourId,
|
||||
getUIColourIfAvailable (LookAndFeel_V4::ColourScheme::UIColour::outline,
|
||||
Colours::grey));
|
||||
hashGroup.setColour (GroupComponent::textColourId,
|
||||
getUIColourIfAvailable (LookAndFeel_V4::ColourScheme::UIColour::defaultText,
|
||||
Colours::white));
|
||||
hashEntryBox.setColour (TextEditor::backgroundColourId,
|
||||
getUIColourIfAvailable (LookAndFeel_V4::ColourScheme::UIColour::widgetBackground,
|
||||
Colours::white.withAlpha (0.5f)));
|
||||
|
||||
addAndMakeVisible (hashEntryBox);
|
||||
hashEntryBox.setMultiLine (true);
|
||||
|
||||
|
|
@ -214,6 +210,21 @@ private:
|
|||
void textEditorEscapeKeyPressed (TextEditor&) override { updateHashes(); }
|
||||
void textEditorFocusLost (TextEditor&) override { updateHashes(); }
|
||||
|
||||
void lookAndFeelChanged() override
|
||||
{
|
||||
hashGroup.setColour (GroupComponent::outlineColourId,
|
||||
getUIColourIfAvailable (LookAndFeel_V4::ColourScheme::UIColour::outline,
|
||||
Colours::grey));
|
||||
hashGroup.setColour (GroupComponent::textColourId,
|
||||
getUIColourIfAvailable (LookAndFeel_V4::ColourScheme::UIColour::defaultText,
|
||||
Colours::white));
|
||||
hashEntryBox.setColour (TextEditor::backgroundColourId,
|
||||
getUIColourIfAvailable (LookAndFeel_V4::ColourScheme::UIColour::widgetBackground,
|
||||
Colours::white.withAlpha (0.5f)));
|
||||
|
||||
hashEntryBox.applyFontToAllText (hashEntryBox.getFont());
|
||||
}
|
||||
|
||||
JUCE_DECLARE_NON_COPYABLE_WITH_LEAK_DETECTOR (HashesComponent)
|
||||
};
|
||||
|
||||
|
|
|
|||
|
|
@ -124,6 +124,14 @@ struct DemoFlexPanel : public juce::Component,
|
|||
r.reduced (4), Justification::bottomRight, 2);
|
||||
}
|
||||
|
||||
void lookAndFeelChanged() override
|
||||
{
|
||||
flexOrderEditor.applyFontToAllText (flexOrderEditor.getFont());
|
||||
flexGrowEditor.applyFontToAllText (flexGrowEditor.getFont());
|
||||
flexShrinkEditor.applyFontToAllText (flexShrinkEditor.getFont());
|
||||
flexBasisEditor.applyFontToAllText (flexBasisEditor.getFont());
|
||||
}
|
||||
|
||||
FlexItem& flexItem;
|
||||
|
||||
TextEditor flexOrderEditor, flexGrowEditor, flexShrinkEditor, flexBasisEditor;
|
||||
|
|
|
|||
|
|
@ -152,6 +152,11 @@ private:
|
|||
outputDisplay.setBounds (r.withTrimmedTop (8));
|
||||
}
|
||||
|
||||
void lookAndFeelChanged() override
|
||||
{
|
||||
outputDisplay.applyFontToAllText (outputDisplay.getFont());
|
||||
}
|
||||
|
||||
JUCE_DECLARE_NON_COPYABLE_WITH_LEAK_DETECTOR (JavaScriptDemo)
|
||||
};
|
||||
|
||||
|
|
|
|||
|
|
@ -36,10 +36,6 @@ public:
|
|||
{
|
||||
setOpaque (true);
|
||||
addAndMakeVisible (keyMappingEditor);
|
||||
|
||||
LookAndFeel* lf = &LookAndFeel::getDefaultLookAndFeel();
|
||||
keyMappingEditor.setColours (lf->findColour (KeyMappingEditorComponent::backgroundColourId),
|
||||
lf->findColour (KeyMappingEditorComponent::textColourId));
|
||||
}
|
||||
|
||||
void paint (Graphics& g) override
|
||||
|
|
@ -56,6 +52,13 @@ public:
|
|||
private:
|
||||
KeyMappingEditorComponent keyMappingEditor;
|
||||
|
||||
void lookAndFeelChanged() override
|
||||
{
|
||||
auto* lf = &LookAndFeel::getDefaultLookAndFeel();
|
||||
keyMappingEditor.setColours (lf->findColour (KeyMappingEditorComponent::backgroundColourId),
|
||||
lf->findColour (KeyMappingEditorComponent::textColourId));
|
||||
}
|
||||
|
||||
JUCE_DECLARE_NON_COPYABLE_WITH_LEAK_DETECTOR (KeyMappingsDemo)
|
||||
};
|
||||
|
||||
|
|
|
|||
|
|
@ -114,6 +114,11 @@ private:
|
|||
changed();
|
||||
}
|
||||
|
||||
void lookAndFeelChanged() override
|
||||
{
|
||||
editor.applyFontToAllText (editor.getFont());
|
||||
}
|
||||
|
||||
void textEditorReturnKeyPressed (TextEditor&) override {}
|
||||
void textEditorEscapeKeyPressed (TextEditor&) override {}
|
||||
void textEditorFocusLost (TextEditor&) override {}
|
||||
|
|
|
|||
|
|
@ -118,6 +118,11 @@ private:
|
|||
fetchButton.triggerClick();
|
||||
}
|
||||
|
||||
void lookAndFeelChanged() override
|
||||
{
|
||||
urlBox.applyFontToAllText (urlBox.getFont());
|
||||
}
|
||||
|
||||
JUCE_DECLARE_NON_COPYABLE_WITH_LEAK_DETECTOR (NetworkingDemo)
|
||||
};
|
||||
|
||||
|
|
|
|||
|
|
@ -368,18 +368,11 @@ struct OpenGLDemoClasses
|
|||
addAndMakeVisible (showBackgroundToggle);
|
||||
showBackgroundToggle.addListener (this);
|
||||
|
||||
Colour editorBackground = dynamic_cast<LookAndFeel_V4*> (&LookAndFeel::getDefaultLookAndFeel())
|
||||
? getLookAndFeel().findColour (ResizableWindow::backgroundColourId)
|
||||
: Colours::white;
|
||||
|
||||
addAndMakeVisible (tabbedComp);
|
||||
tabbedComp.setTabBarDepth (25);
|
||||
tabbedComp.setColour (TabbedButtonBar::tabTextColourId, Colours::grey);
|
||||
tabbedComp.addTab ("Vertex", editorBackground, &vertexEditorComp, false);
|
||||
tabbedComp.addTab ("Fragment", editorBackground, &fragmentEditorComp, false);
|
||||
|
||||
vertexEditorComp.setColour (CodeEditorComponent::backgroundColourId, editorBackground);
|
||||
fragmentEditorComp.setColour (CodeEditorComponent::backgroundColourId, editorBackground);
|
||||
tabbedComp.addTab ("Vertex", Colours::transparentBlack, &vertexEditorComp, false);
|
||||
tabbedComp.addTab ("Fragment", Colours::transparentBlack, &fragmentEditorComp, false);
|
||||
|
||||
vertexDocument.addListener (this);
|
||||
fragmentDocument.addListener (this);
|
||||
|
|
@ -409,6 +402,8 @@ struct OpenGLDemoClasses
|
|||
addAndMakeVisible (textureLabel);
|
||||
textureLabel.setText ("Texture:", dontSendNotification);
|
||||
textureLabel.attachToComponent (&textureBox, true);
|
||||
|
||||
lookAndFeelChanged();
|
||||
}
|
||||
|
||||
void initialise()
|
||||
|
|
@ -562,6 +557,18 @@ struct OpenGLDemoClasses
|
|||
selectTexture (textureBox.getSelectedId());
|
||||
}
|
||||
|
||||
void lookAndFeelChanged() override
|
||||
{
|
||||
auto editorBackground = getUIColourIfAvailable (LookAndFeel_V4::ColourScheme::UIColour::windowBackground,
|
||||
Colours::white);
|
||||
|
||||
for (int i = tabbedComp.getNumTabs(); i >= 0; --i)
|
||||
tabbedComp.setTabBackgroundColour (i, editorBackground);
|
||||
|
||||
vertexEditorComp.setColour (CodeEditorComponent::backgroundColourId, editorBackground);
|
||||
fragmentEditorComp.setColour (CodeEditorComponent::backgroundColourId, editorBackground);
|
||||
}
|
||||
|
||||
OpenGLDemo& demo;
|
||||
|
||||
Label speedLabel, zoomLabel;
|
||||
|
|
|
|||
|
|
@ -202,6 +202,11 @@ public:
|
|||
private:
|
||||
TextEditor resultsBox;
|
||||
|
||||
void lookAndFeelChanged() override
|
||||
{
|
||||
resultsBox.applyFontToAllText (resultsBox.getFont());
|
||||
}
|
||||
|
||||
JUCE_DECLARE_NON_COPYABLE_WITH_LEAK_DETECTOR (SystemInfoDemo)
|
||||
};
|
||||
|
||||
|
|
|
|||
|
|
@ -186,6 +186,11 @@ struct UnitTestClasses
|
|||
TextButton startTestButton;
|
||||
TextEditor testResultsBox;
|
||||
|
||||
void lookAndFeelChanged() override
|
||||
{
|
||||
testResultsBox.applyFontToAllText (testResultsBox.getFont());
|
||||
}
|
||||
|
||||
JUCE_DECLARE_NON_COPYABLE_WITH_LEAK_DETECTOR (UnitTestsDemo)
|
||||
};
|
||||
};
|
||||
|
|
|
|||
|
|
@ -140,6 +140,11 @@ private:
|
|||
webView->goToURL (addressTextBox.getText());
|
||||
}
|
||||
|
||||
void lookAndFeelChanged() override
|
||||
{
|
||||
addressTextBox.applyFontToAllText (addressTextBox.getFont());
|
||||
}
|
||||
|
||||
JUCE_DECLARE_NON_COPYABLE_WITH_LEAK_DETECTOR (WebBrowserDemo)
|
||||
};
|
||||
|
||||
|
|
|
|||
|
|
@ -447,6 +447,12 @@ struct MiscPage : public Component
|
|||
comboBox.setSelectedId (1);
|
||||
}
|
||||
|
||||
void lookAndFeelChanged() override
|
||||
{
|
||||
textEditor1.applyFontToAllText (textEditor1.getFont());
|
||||
textEditor2.applyFontToAllText (textEditor2.getFont());
|
||||
}
|
||||
|
||||
TextEditor textEditor1, textEditor2;
|
||||
ComboBox comboBox;
|
||||
};
|
||||
|
|
@ -1572,6 +1578,11 @@ private:
|
|||
setTabBackgroundColour (i, getLookAndFeel().findColour (ResizableWindow::backgroundColourId));
|
||||
}
|
||||
}
|
||||
|
||||
void lookAndFeelChanged() override
|
||||
{
|
||||
updateTabColours();
|
||||
}
|
||||
};
|
||||
|
||||
//==============================================================================
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue