Skip to content

Commit 219df43

Browse files
committed
Improved handling
1 parent be6aeca commit 219df43

File tree

12 files changed

+52
-17
lines changed

12 files changed

+52
-17
lines changed

examples/graphics/source/examples/Artboard.h

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,6 @@ class ArtboardDemo : public yup::Component
3030
ArtboardDemo()
3131
{
3232
setWantsKeyboardFocus (true);
33-
setOpaque (false);
3433
}
3534

3635
bool loadArtboard()
@@ -101,6 +100,12 @@ class ArtboardDemo : public yup::Component
101100
}
102101
}
103102

103+
void paint (Graphics& g) override
104+
{
105+
g.setFillColor (findColor (yup::DocumentWindow::Style::backgroundColorId).value_or (yup::Colors::dimgray));
106+
g.fillAll();
107+
}
108+
104109
private:
105110
yup::OwnedArray<yup::Artboard> artboards;
106111
int totalRows = 1;

examples/graphics/source/examples/Audio.h

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -161,8 +161,6 @@ class AudioExample
161161
AudioExample (const yup::Font& font)
162162
: Component ("AudioExample")
163163
{
164-
setOpaque (false);
165-
166164
// Initialize the audio device
167165
deviceManager.initialiseWithDefaultDevices (0, 2);
168166

@@ -239,6 +237,12 @@ class AudioExample
239237
oscilloscope.setBounds (bottomBounds);
240238
}
241239

240+
void paint (yup::Graphics& g) override
241+
{
242+
g.setFillColor (findColor (yup::DocumentWindow::Style::backgroundColorId).value_or (yup::Colors::dimgray));
243+
g.fillAll();
244+
}
245+
242246
void mouseDown (const yup::MouseEvent& event) override
243247
{
244248
takeKeyboardFocus();

examples/graphics/source/examples/FileChooser.h

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -82,6 +82,12 @@ class FileChooserDemo : public yup::Component
8282
openMultipleFiles.setBounds (buttons1.removeFromLeft (buttonWidth));
8383
}
8484

85+
void paint (yup::Graphics& g) override
86+
{
87+
g.setFillColor (findColor (yup::DocumentWindow::Style::backgroundColorId).value_or (yup::Colors::dimgray));
88+
g.fillAll();
89+
}
90+
8591
private:
8692
yup::TextButton openFile;
8793
yup::TextButton openMultipleFiles;

examples/graphics/source/examples/LayoutFonts.h

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,6 @@ class LayoutFontsExample : public yup::Component
3030
: Component ("LayoutFontsExample")
3131
, font (font)
3232
{
33-
setOpaque (false);
3433
}
3534

3635
void resized() override
@@ -51,6 +50,9 @@ class LayoutFontsExample : public yup::Component
5150

5251
void paint (yup::Graphics& g) override
5352
{
53+
g.setFillColor (findColor (yup::DocumentWindow::Style::backgroundColorId).value_or (yup::Colors::dimgray));
54+
g.fillAll();
55+
5456
const int numTexts = yup::numElementsInArray (text);
5557
for (int i = 0; i < numTexts; ++i)
5658
{

examples/graphics/source/examples/Paths.h

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -29,11 +29,13 @@ class PathsExample : public yup::Component
2929
PathsExample()
3030
: Component ("PathsExample")
3131
{
32-
setOpaque (false);
3332
}
3433

3534
void paint (yup::Graphics& g) override
3635
{
36+
g.setFillColor (findColor (yup::DocumentWindow::Style::backgroundColorId).value_or (yup::Colors::dimgray));
37+
g.fillAll();
38+
3739
// Draw title
3840
/*
3941
g.setColour (yup::Color (50, 50, 80));

examples/graphics/source/examples/PopupMenu.h

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -32,8 +32,6 @@ class PopupMenuDemo : public yup::Component
3232
, statusLabel ("statusLabel")
3333
, currentPlacementIndex (0)
3434
{
35-
setOpaque (false);
36-
3735
addAndMakeVisible (statusLabel);
3836
statusLabel.setTitle ("Click the button to test placements. Right-click for submenus and scrollable menus.");
3937

@@ -68,6 +66,9 @@ class PopupMenuDemo : public yup::Component
6866
{
6967
auto area = getLocalBounds().reduced (5);
7068

69+
g.setFillColor (findColor (yup::DocumentWindow::Style::backgroundColorId).value_or (yup::Colors::dimgray));
70+
g.fillAll();
71+
7172
auto styledText = yup::StyledText();
7273
{
7374
auto modifier = styledText.startUpdate();

examples/graphics/source/examples/TextEditor.h

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -27,8 +27,6 @@ class TextEditorDemo : public yup::Component
2727
TextEditorDemo()
2828
: Component ("TextEditorDemo")
2929
{
30-
setOpaque (false);
31-
3230
// Create the editors
3331
singleLineEditor = std::make_unique<yup::TextEditor> ("singleLineEditor");
3432
multiLineEditor = std::make_unique<yup::TextEditor> ("multiLineEditor");
@@ -106,6 +104,9 @@ class TextEditorDemo : public yup::Component
106104

107105
void paint (yup::Graphics& g) override
108106
{
107+
g.setFillColor (findColor (yup::DocumentWindow::Style::backgroundColorId).value_or (yup::Colors::dimgray));
108+
g.fillAll();
109+
109110
// Header separator
110111
g.setStrokeColor (yup::Colors::darkgray);
111112
g.setStrokeWidth (2.0f);

examples/graphics/source/examples/VariableFonts.h

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -30,8 +30,6 @@ class VariableFontsExample : public yup::Component
3030
: Component ("VariableFontsExample")
3131
, font (font)
3232
{
33-
setOpaque (false);
34-
3533
text =
3634
"Lorem ipsum dolor sit amet, consectetur adipiscing elit. Sed non aliquam risus, eu molestie sem. "
3735
"Proin fringilla porttitor metus at pharetra. Nunc quis lacus gravida justo pellentesque dignissim a "
@@ -127,6 +125,9 @@ class VariableFontsExample : public yup::Component
127125

128126
void paint (yup::Graphics& g) override
129127
{
128+
g.setFillColor (findColor (yup::DocumentWindow::Style::backgroundColorId).value_or (yup::Colors::dimgray));
129+
g.fillAll();
130+
130131
g.setTransform (yup::AffineTransform::rotation (
131132
yup::degreesToRadians (-rotation), getLocalBounds().getCenterX(), 100.0f));
132133

examples/graphics/source/examples/Widgets.h

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -28,8 +28,6 @@ class WidgetsDemo : public Component
2828
public:
2929
WidgetsDemo()
3030
{
31-
setOpaque (false);
32-
3331
auto theme = ApplicationTheme::getGlobalTheme();
3432
exampleFont = theme->getDefaultFont();
3533

@@ -171,6 +169,12 @@ class WidgetsDemo : public Component
171169
slider->setBounds (Rectangle<float> (static_cast<float> (margin), static_cast<float> (y), static_cast<float> (inputWidth / 2), static_cast<float> (inputWidth / 2)));
172170
}
173171

172+
void paint (Graphics& g) override
173+
{
174+
g.setFillColor (findColor (yup::DocumentWindow::Style::backgroundColorId).value_or (yup::Colors::dimgray));
175+
g.fillAll();
176+
}
177+
174178
// Custom ComboBox to handle selection changes
175179
class CustomComboBox : public ComboBox
176180
{

modules/yup_gui/buttons/yup_ToggleButton.cpp

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,7 @@ namespace yup
2323
{
2424

2525
//==============================================================================
26+
2627
const Identifier ToggleButton::Style::backgroundColorId = "toggleButtonBackground";
2728
const Identifier ToggleButton::Style::backgroundToggledColorId = "toggleButtonBackgroundToggled";
2829
const Identifier ToggleButton::Style::textColorId = "toggleButtonText";

0 commit comments

Comments
 (0)