-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
toggle button using look and fell from viator dsp style sheet
- Loading branch information
1 parent
3a85864
commit 7f4444d
Showing
10 changed files
with
132 additions
and
14 deletions.
There are no files selected for viewing
Binary file not shown.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,52 @@ | ||
/* | ||
============================================================================== | ||
ToggleButtonLAF.cpp | ||
Created: 8 Feb 2023 11:21:46am | ||
Author: Utente | ||
============================================================================== | ||
*/ | ||
|
||
#include "ToggleButtonLAF.h" | ||
|
||
void PowerToggleLAF::drawToggleButton | ||
( | ||
juce::Graphics& g, | ||
juce::ToggleButton& toggleButton, | ||
bool shouldDrawButtonAsHighlighted, | ||
bool shouldDrawButtonAsDown | ||
) | ||
{ | ||
Path button; | ||
|
||
auto bounds = toggleButton.getLocalBounds(); | ||
|
||
auto size = jmin(bounds.getWidth(), bounds.getHeight()) - 6; | ||
auto r = bounds.withSizeKeepingCentre(size, size).toFloat(); | ||
|
||
float ang = 30.f; | ||
|
||
size -= 9; | ||
|
||
|
||
button.addCentredArc(r.getCentreX(), | ||
r.getCentreY(), | ||
size * 0.25, | ||
size * 0.25, | ||
0.f, | ||
degreesToRadians(ang), | ||
degreesToRadians(360.f - ang), | ||
true); | ||
|
||
button.startNewSubPath(r.getCentreX(), r.getY() + r.getHeight() * 0.21); | ||
button.lineTo(r.getCentre()); | ||
|
||
PathStrokeType pst(2.5f, PathStrokeType::JointStyle::curved); | ||
|
||
auto color = | ||
toggleButton.getToggleState() ? toggleButton.findColour(juce::ToggleButton::tickDisabledColourId) : toggleButton.findColour(juce::ToggleButton::tickColourId); | ||
|
||
g.setColour(color); | ||
g.strokePath(button, pst); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,27 @@ | ||
/* | ||
============================================================================== | ||
ToggleButtonLAF.h | ||
Created: 8 Feb 2023 11:21:46am | ||
Author: Utente | ||
============================================================================== | ||
*/ | ||
|
||
#pragma once | ||
#include <JuceHeader.h> | ||
|
||
class PowerToggleLAF : public LookAndFeel_V4 | ||
{ | ||
|
||
public: | ||
|
||
|
||
void drawToggleButton | ||
( | ||
juce::Graphics& g, | ||
juce::ToggleButton& toggleButton, | ||
bool shouldDrawButtonAsHighlighted, | ||
bool shouldDrawButtonAsDown | ||
) override; | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters