Browse Source

Added a isTextEditorMultiLine() method to TextPropertyComponent

tags/2021-05-28
ed 7 years ago
parent
commit
b4b6feaf97
2 changed files with 12 additions and 5 deletions
  1. +5
    -4
      modules/juce_gui_basics/properties/juce_TextPropertyComponent.cpp
  2. +7
    -1
      modules/juce_gui_basics/properties/juce_TextPropertyComponent.h

+ 5
- 4
modules/juce_gui_basics/properties/juce_TextPropertyComponent.cpp View File

@@ -151,11 +151,12 @@ private:
//==============================================================================
TextPropertyComponent::TextPropertyComponent (const String& name,
int maxNumChars,
bool isMultiLine,
bool multiLine,
bool isEditable)
: PropertyComponent (name)
: PropertyComponent (name),
isMultiLine (multiLine)
{
createEditor (maxNumChars, isMultiLine, isEditable);
createEditor (maxNumChars, isEditable);
}
TextPropertyComponent::TextPropertyComponent (const Value& valueToControl,
@@ -198,7 +199,7 @@ Value& TextPropertyComponent::getValue() const
return textEditor->getTextValue();
}
void TextPropertyComponent::createEditor (int maxNumChars, bool isMultiLine, bool isEditable)
void TextPropertyComponent::createEditor (int maxNumChars, bool isEditable)
{
textEditor.reset (new LabelComp (*this, maxNumChars, isMultiLine, isEditable));
addAndMakeVisible (textEditor.get());


+ 7
- 1
modules/juce_gui_basics/properties/juce_TextPropertyComponent.h View File

@@ -106,6 +106,10 @@ public:
/** Returns the text that should be shown in the text editor as a Value object. */
Value& getValue() const;
//==============================================================================
/** Returns true if the text editor allows carriage returns. */
bool isTextEditorMultiLine() const noexcept { return isMultiLine; }
//==============================================================================
/** A set of colour IDs to use to change the colour of various aspects of the component.
@@ -164,6 +168,8 @@ public:
virtual void textWasEdited();
private:
bool isMultiLine;
class RemapperValueSourceWithDefault;
class LabelComp;
@@ -173,7 +179,7 @@ private:
ListenerList<Listener> listenerList;
void callListeners();
void createEditor (int maxNumChars, bool isMultiLine, bool isEditable);
void createEditor (int maxNumChars, bool isEditable);
JUCE_DECLARE_NON_COPYABLE_WITH_LEAK_DETECTOR (TextPropertyComponent)
};


Loading…
Cancel
Save