mirror of
https://github.com/juce-framework/JUCE.git
synced 2026-01-16 00:34:19 +00:00
Added a custom text colour for DrawableButton and fixed a bugette in KeyPress.
This commit is contained in:
parent
322cd4dba2
commit
df554b5ad8
6 changed files with 43 additions and 8 deletions
|
|
@ -43932,7 +43932,9 @@ void DrawableButton::paintButton (Graphics& g,
|
|||
{
|
||||
g.setFont ((float) textH);
|
||||
|
||||
g.setColour (Colours::black.withAlpha (isEnabled() ? 1.0f : 0.4f));
|
||||
g.setColour (getLookAndFeel().findColour (DrawableButton::textColourId)
|
||||
.withMultipliedAlpha (isEnabled() ? 1.0f : 0.4f));
|
||||
|
||||
g.drawFittedText (getButtonText(),
|
||||
2, getHeight() - textH - 1,
|
||||
getWidth() - 4, textH,
|
||||
|
|
@ -60696,9 +60698,10 @@ const KeyPress KeyPress::createFromDescription (const String& desc)
|
|||
if (key == 0)
|
||||
{
|
||||
// see if it's a function key..
|
||||
for (int i = 1; i <= 12; ++i)
|
||||
if (desc.containsWholeWordIgnoreCase ("f" + String (i)))
|
||||
key = F1Key + i - 1;
|
||||
if (! desc.containsChar ('#')) // avoid mistaking hex-codes like "#f1"
|
||||
for (int i = 1; i <= 12; ++i)
|
||||
if (desc.containsWholeWordIgnoreCase ("f" + String (i)))
|
||||
key = F1Key + i - 1;
|
||||
|
||||
if (key == 0)
|
||||
{
|
||||
|
|
@ -64955,6 +64958,8 @@ LookAndFeel::LookAndFeel()
|
|||
FileSearchPathListComponent::backgroundColourId, 0xffffffff,
|
||||
|
||||
FileChooserDialogBox::titleTextColourId, 0xff000000,
|
||||
|
||||
DrawableButton::textColourId, 0xff000000,
|
||||
};
|
||||
|
||||
for (int i = 0; i < numElementsInArray (standardColours); i += 2)
|
||||
|
|
|
|||
|
|
@ -43832,6 +43832,18 @@ public:
|
|||
const Drawable* getOverImage() const throw();
|
||||
const Drawable* getDownImage() const throw();
|
||||
|
||||
/** A set of colour IDs to use to change the colour of various aspects of the link.
|
||||
|
||||
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
|
||||
{
|
||||
textColourId = 0x1004010, /**< The colour to use for the URL text. */
|
||||
};
|
||||
|
||||
juce_UseDebuggingNewOperator
|
||||
|
||||
protected:
|
||||
|
|
|
|||
|
|
@ -173,7 +173,9 @@ void DrawableButton::paintButton (Graphics& g,
|
|||
{
|
||||
g.setFont ((float) textH);
|
||||
|
||||
g.setColour (Colours::black.withAlpha (isEnabled() ? 1.0f : 0.4f));
|
||||
g.setColour (getLookAndFeel().findColour (DrawableButton::textColourId)
|
||||
.withMultipliedAlpha (isEnabled() ? 1.0f : 0.4f));
|
||||
|
||||
g.drawFittedText (getButtonText(),
|
||||
2, getHeight() - textH - 1,
|
||||
getWidth() - 4, textH,
|
||||
|
|
|
|||
|
|
@ -153,6 +153,19 @@ public:
|
|||
const Drawable* getOverImage() const throw();
|
||||
const Drawable* getDownImage() const throw();
|
||||
|
||||
//==============================================================================
|
||||
/** A set of colour IDs to use to change the colour of various aspects of the link.
|
||||
|
||||
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
|
||||
{
|
||||
textColourId = 0x1004010, /**< The colour to use for the URL text. */
|
||||
};
|
||||
|
||||
//==============================================================================
|
||||
juce_UseDebuggingNewOperator
|
||||
|
||||
|
|
|
|||
|
|
@ -193,9 +193,10 @@ const KeyPress KeyPress::createFromDescription (const String& desc)
|
|||
if (key == 0)
|
||||
{
|
||||
// see if it's a function key..
|
||||
for (int i = 1; i <= 12; ++i)
|
||||
if (desc.containsWholeWordIgnoreCase ("f" + String (i)))
|
||||
key = F1Key + i - 1;
|
||||
if (! desc.containsChar ('#')) // avoid mistaking hex-codes like "#f1"
|
||||
for (int i = 1; i <= 12; ++i)
|
||||
if (desc.containsWholeWordIgnoreCase ("f" + String (i)))
|
||||
key = F1Key + i - 1;
|
||||
|
||||
if (key == 0)
|
||||
{
|
||||
|
|
|
|||
|
|
@ -221,6 +221,8 @@ LookAndFeel::LookAndFeel()
|
|||
FileSearchPathListComponent::backgroundColourId, 0xffffffff,
|
||||
|
||||
FileChooserDialogBox::titleTextColourId, 0xff000000,
|
||||
|
||||
DrawableButton::textColourId, 0xff000000,
|
||||
};
|
||||
|
||||
for (int i = 0; i < numElementsInArray (standardColours); i += 2)
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue