Browse Source

Added a custom text colour for DrawableButton and fixed a bugette in KeyPress.

tags/2021-05-28
Julian Storer 15 years ago
parent
commit
df554b5ad8
6 changed files with 43 additions and 8 deletions
  1. +9
    -4
      juce_amalgamated.cpp
  2. +12
    -0
      juce_amalgamated.h
  3. +3
    -1
      src/gui/components/buttons/juce_DrawableButton.cpp
  4. +13
    -0
      src/gui/components/buttons/juce_DrawableButton.h
  5. +4
    -3
      src/gui/components/keyboard/juce_KeyPress.cpp
  6. +2
    -0
      src/gui/components/lookandfeel/juce_LookAndFeel.cpp

+ 9
- 4
juce_amalgamated.cpp View File

@@ -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)


+ 12
- 0
juce_amalgamated.h View File

@@ -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:


+ 3
- 1
src/gui/components/buttons/juce_DrawableButton.cpp View File

@@ -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,


+ 13
- 0
src/gui/components/buttons/juce_DrawableButton.h View File

@@ -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


+ 4
- 3
src/gui/components/keyboard/juce_KeyPress.cpp View File

@@ -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)
{


+ 2
- 0
src/gui/components/lookandfeel/juce_LookAndFeel.cpp View File

@@ -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…
Cancel
Save