mirror of
https://github.com/juce-framework/JUCE.git
synced 2026-01-24 01:54:22 +00:00
This commit is contained in:
parent
ebddf597b4
commit
b64bdda679
5 changed files with 49 additions and 12 deletions
|
|
@ -51,12 +51,6 @@ ComboBox::ComboBox (const String& name)
|
|||
label (0)
|
||||
{
|
||||
noChoicesMessage = TRANS("(no choices)");
|
||||
|
||||
addAndMakeVisible (label = new Label (String::empty, String::empty));
|
||||
label->addListener (this);
|
||||
label->addMouseListener (this, false);
|
||||
|
||||
setEditableText (false);
|
||||
setRepaintsOnMouseActivity (true);
|
||||
|
||||
lookAndFeelChanged();
|
||||
|
|
@ -453,13 +447,33 @@ void ComboBox::lookAndFeelChanged()
|
|||
{
|
||||
repaint();
|
||||
|
||||
label->setColour (Label::backgroundColourId, Colours::transparentBlack);
|
||||
label->setColour (Label::textColourId, findColour (ComboBox::textColourId));
|
||||
Label* const newLabel = getLookAndFeel().createComboBoxTextBox (*this);
|
||||
|
||||
label->setColour (TextEditor::textColourId, findColour (ComboBox::textColourId));
|
||||
label->setColour (TextEditor::backgroundColourId, Colours::transparentBlack);
|
||||
label->setColour (TextEditor::highlightColourId, findColour (TextEditor::highlightColourId));
|
||||
label->setColour (TextEditor::outlineColourId, Colours::transparentBlack);
|
||||
if (label != 0)
|
||||
{
|
||||
newLabel->setEditable (label->isEditable());
|
||||
newLabel->setJustificationType (label->getJustificationType());
|
||||
newLabel->setTooltip (label->getTooltip());
|
||||
newLabel->setText (label->getText(), false);
|
||||
}
|
||||
|
||||
delete label;
|
||||
label = newLabel;
|
||||
|
||||
addAndMakeVisible (newLabel);
|
||||
|
||||
newLabel->addListener (this);
|
||||
newLabel->addMouseListener (this, false);
|
||||
|
||||
newLabel->setColour (Label::backgroundColourId, Colours::transparentBlack);
|
||||
newLabel->setColour (Label::textColourId, findColour (ComboBox::textColourId));
|
||||
|
||||
newLabel->setColour (TextEditor::textColourId, findColour (ComboBox::textColourId));
|
||||
newLabel->setColour (TextEditor::backgroundColourId, Colours::transparentBlack);
|
||||
newLabel->setColour (TextEditor::highlightColourId, findColour (TextEditor::highlightColourId));
|
||||
newLabel->setColour (TextEditor::outlineColourId, Colours::transparentBlack);
|
||||
|
||||
resized();
|
||||
}
|
||||
|
||||
void ComboBox::colourChanged()
|
||||
|
|
|
|||
|
|
@ -875,6 +875,11 @@ void Component::setBounds (int x, int y, int w, int h)
|
|||
const bool wasResized = (getWidth() != w || getHeight() != h);
|
||||
const bool wasMoved = (getX() != x || getY() != y);
|
||||
|
||||
#ifdef JUCE_DEBUG
|
||||
// It's a very bad idea to try to resize a component during its paint() method!
|
||||
jassert (! (flags.isInsidePaintCall && wasResized));
|
||||
#endif
|
||||
|
||||
if (wasMoved || wasResized)
|
||||
{
|
||||
if (flags.visibleFlag)
|
||||
|
|
@ -1680,6 +1685,10 @@ void Component::paintEntireComponent (Graphics& originalContext)
|
|||
{
|
||||
jassert (! originalContext.isClipEmpty());
|
||||
|
||||
#ifdef JUCE_DEBUG
|
||||
flags.isInsidePaintCall = true;
|
||||
#endif
|
||||
|
||||
Graphics* g = &originalContext;
|
||||
Image* effectImage = 0;
|
||||
|
||||
|
|
@ -1775,6 +1784,10 @@ void Component::paintEntireComponent (Graphics& originalContext)
|
|||
effect_->applyEffect (*effectImage, originalContext);
|
||||
delete effectImage;
|
||||
}
|
||||
|
||||
#ifdef JUCE_DEBUG
|
||||
flags.isInsidePaintCall = false;
|
||||
#endif
|
||||
}
|
||||
|
||||
//==============================================================================
|
||||
|
|
|
|||
|
|
@ -2038,6 +2038,9 @@ private:
|
|||
bool currentlyModalFlag : 1;
|
||||
bool isDisabledFlag : 1;
|
||||
bool childCompFocusedFlag : 1;
|
||||
#ifdef JUCE_DEBUG
|
||||
bool isInsidePaintCall : 1;
|
||||
#endif
|
||||
};
|
||||
|
||||
union
|
||||
|
|
|
|||
|
|
@ -1121,6 +1121,11 @@ const Font LookAndFeel::getComboBoxFont (ComboBox& box)
|
|||
return f;
|
||||
}
|
||||
|
||||
Label* LookAndFeel::createComboBoxTextBox (ComboBox& box)
|
||||
{
|
||||
return new Label (String::empty, String::empty);
|
||||
}
|
||||
|
||||
//==============================================================================
|
||||
void LookAndFeel::drawLinearSlider (Graphics& g,
|
||||
int x, int y,
|
||||
|
|
|
|||
|
|
@ -326,6 +326,8 @@ public:
|
|||
|
||||
virtual const Font getComboBoxFont (ComboBox& box);
|
||||
|
||||
virtual Label* createComboBoxTextBox (ComboBox& box);
|
||||
|
||||
//==============================================================================
|
||||
virtual void drawLinearSlider (Graphics& g,
|
||||
int x, int y,
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue