1
0
Fork 0
mirror of https://github.com/juce-framework/JUCE.git synced 2026-01-25 02:04:23 +00:00

Added callback Label::Listener::editorShown

This commit is contained in:
jules 2014-05-23 22:08:19 +01:00
parent 1fb5d99dfd
commit 4bd38dc619
2 changed files with 18 additions and 9 deletions

View file

@ -189,7 +189,12 @@ void Label::componentVisibilityChanged (Component& component)
//==============================================================================
void Label::textWasEdited() {}
void Label::textWasChanged() {}
void Label::editorShown (TextEditor*) {}
void Label::editorShown (TextEditor* textEditor)
{
Component::BailOutChecker checker (this);
listeners.callChecked (checker, &LabelListener::editorShown, this, *textEditor);
}
void Label::editorAboutToBeHidden (TextEditor*)
{
@ -444,3 +449,5 @@ void Label::textEditorFocusLost (TextEditor& ed)
{
textEditorTextChanged (ed);
}
void Label::Listener::editorShown (Label*, TextEditor&) {}

View file

@ -74,7 +74,7 @@ public:
You can call Value::referTo() on this object to make the label read and control
a Value object that you supply.
*/
Value& getTextValue() { return textValue; }
Value& getTextValue() noexcept { return textValue; }
//==============================================================================
/** Changes the font to use to draw the text.
@ -109,13 +109,12 @@ public:
//==============================================================================
/** Sets the style of justification to be used for positioning the text.
(The default is Justification::centredLeft)
*/
void setJustificationType (Justification justification);
/** Returns the type of justification, as set in setJustificationType(). */
Justification getJustificationType() const noexcept { return justification; }
Justification getJustificationType() const noexcept { return justification; }
/** Changes the border that is left between the edge of the component and the text.
By default there's a small gap left at the sides of the component to allow for
@ -124,7 +123,7 @@ public:
void setBorderSize (BorderSize<int> newBorderSize);
/** Returns the size of the border to be left around the text. */
BorderSize<int> getBorderSize() const noexcept { return border; }
BorderSize<int> getBorderSize() const noexcept { return border; }
/** Makes this label "stick to" another component.
@ -149,16 +148,17 @@ public:
Returns false if the label is above the other component. This is only relevent if
attachToComponent() has been called.
*/
bool isAttachedOnLeft() const noexcept { return leftOfOwnerComp; }
bool isAttachedOnLeft() const noexcept { return leftOfOwnerComp; }
/** Specifies the minimum amount that the font can be squashed horizantally before it starts
/** Specifies the minimum amount that the font can be squashed horizontally before it starts
using ellipsis.
@see Graphics::drawFittedText
*/
void setMinimumHorizontalScale (float newScale);
float getMinimumHorizontalScale() const noexcept { return minimumHorizontalScale; }
/** Specifies the amount that the font can be squashed horizontally. */
float getMinimumHorizontalScale() const noexcept { return minimumHorizontalScale; }
//==============================================================================
/**
@ -179,6 +179,9 @@ public:
/** Called when a Label's text has changed. */
virtual void labelTextChanged (Label* labelThatHasChanged) = 0;
/** Called when a Label goes into editing mode and displays a TextEditor. */
virtual void editorShown (Label*, TextEditor& textEditorShown);
};
/** Registers a listener that will be called when the label's text changes. */
@ -225,7 +228,6 @@ public:
bool isEditable() const noexcept { return editSingleClick || editDoubleClick; }
/** Makes the editor appear as if the label had been clicked by the user.
@see textWasEdited, setEditable
*/
void showEditor();