Skip to content

Commit

Permalink
Add multiline type for TypedNamedValue
Browse files Browse the repository at this point in the history
  • Loading branch information
christofmuc committed Oct 16, 2023
1 parent 9990684 commit 11a33e4
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 3 deletions.
9 changes: 7 additions & 2 deletions TypedNamedValue.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -32,8 +32,8 @@ TypedNamedValue::TypedNamedValue(juce::String const &name, juce::String const &s
enabled_ = true;
}

TypedNamedValue::TypedNamedValue(juce::String const &name, juce::String const &sectionName, juce::String const &defaultValue, int maxLength) :
name_(name), sectionName_(sectionName), valueType_(ValueType::String)
TypedNamedValue::TypedNamedValue(juce::String const &name, juce::String const &sectionName, juce::String const &defaultValue, int maxLength, bool isMultiLine /* = false */) :
name_(name), sectionName_(sectionName), valueType_(ValueType::String), multiLine_(isMultiLine)
{
value_ = juce::Value(defaultValue);
minValue_ = 0;
Expand Down Expand Up @@ -106,6 +106,11 @@ int TypedNamedValue::maxValue() const
return maxValue_;
}

bool TypedNamedValue::multiLine() const
{
return multiLine_;
}

bool TypedNamedValue::enabled() const
{
return enabled_;
Expand Down
4 changes: 3 additions & 1 deletion TypedNamedValue.h
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@ class TypedNamedValue {
//! Construct a Bool type
TypedNamedValue(juce::String const &name, juce::String const &sectionName, bool defaultValue);
//! Construct a juce::String type (edit field)
TypedNamedValue(juce::String const &name, juce::String const &sectionName, juce::String const &defaultValue, int maxLength);
TypedNamedValue(juce::String const &name, juce::String const &sectionName, juce::String const &defaultValue, int maxLength, bool isMultiLine = false);
//! Construct an Integer type
TypedNamedValue(juce::String const &name, juce::String const &sectionName, int defaultValue, int minValue, int maxValue);
//! Construct a lookup value type
Expand All @@ -63,6 +63,7 @@ class TypedNamedValue {
ValueType valueType() const;
int minValue() const;
int maxValue() const;
bool multiLine() const;
bool enabled() const;
std::map<int, std::string> lookup() const;

Expand All @@ -79,6 +80,7 @@ class TypedNamedValue {
ValueType valueType_;
int minValue_;
int maxValue_;
bool multiLine_ { false };
std::map<int, std::string> lookup_;
bool enabled_;
};
Expand Down

0 comments on commit 11a33e4

Please sign in to comment.