8 #include "ctextlabel.h" 9 #include "../platform/iplatformtextedit.h" 14 using CTextEditStringToValueProc = bool (*) (UTF8StringPtr txt,
float& result,
void* userData);
35 using StringToValueFunction = std::function<bool(UTF8StringPtr txt, float& result, CTextEdit* textEdit)>;
37 void setStringToValueFunction (
const StringToValueFunction& stringToValueFunc);
38 void setStringToValueFunction (StringToValueFunction&& stringToValueFunc);
46 virtual void setPlaceholderString (
const UTF8String& str);
47 const UTF8String& getPlaceholderString ()
const {
return placeholderString; }
51 void setText (
const UTF8String& txt)
override;
53 void setValue (
float val)
override;
67 bool bWasReturnPressed {
false};
69 PlatformTextEditPtr getPlatformTextEdit ()
const {
return platformControl; }
75 void createPlatformTextEdit ();
76 void updateText (IPlatformTextEdit* pte);
78 CColor platformGetBackColor ()
const override {
return getBackColor (); }
79 CColor platformGetFontColor ()
const override {
return getFontColor (); }
80 CFontRef platformGetFont ()
const override;
81 CHoriTxtAlign platformGetHoriTxtAlign ()
const override {
return getHoriAlign (); }
82 const UTF8String& platformGetText ()
const override {
return text; }
83 const UTF8String& platformGetPlaceholderText ()
const override {
return placeholderString; }
84 CRect platformGetSize ()
const override;
85 CRect platformGetVisibleSize ()
const override;
86 CPoint platformGetTextInset ()
const override {
return getTextInset (); }
87 void platformLooseFocus (
bool returnPressed)
override;
88 bool platformOnKeyDown (
const VstKeyCode& key)
override;
89 void platformTextDidChange ()
override;
90 bool platformIsSecureTextEdit ()
override;
92 PlatformTextEditPtr platformControl;
94 StringToValueFunction stringToValueFunction;
96 bool immediateTextChange {
false};
97 bool secureStyle {
false};
98 mutable SharedPointer<CFontDesc> platformFont;
99 UTF8String placeholderString;
void setSecureStyle(bool state)
enable/disable secure style
Definition: ctextedit.cpp:79
bool getSecureStyle() const
get secure style
Definition: ctextedit.cpp:92
void draw(CDrawContext *pContext) override
called if the view should draw itself
Definition: ctextedit.cpp:165
bool wantsFocus() const override
check if view supports focus
Definition: ctextedit.cpp:333
Rect structure.
Definition: crect.h:17
a text label
Definition: ctextlabel.h:18
Definition: xmlparse.c:181
Definition: vstkeycode.h:12
A drawing context encapsulates the drawing context of the underlying OS.
Definition: cdrawcontext.h:29
CMouseEventResult onMouseDown(CPoint &where, const CButtonState &buttons) override
called when a mouse down event occurs
Definition: ctextedit.cpp:198
CTextEdit(const CRect &size, IControlListener *listener, int32_t tag, UTF8StringPtr txt=nullptr, CBitmap *background=nullptr, const int32_t style=0)
Definition: ctextedit.cpp:31
void setTextRotation(double angle) override
not supported
Definition: ctextedit.h:54
bool getImmediateTextChange() const
get immediate text change behaviour
Definition: ctextedit.h:41
virtual void setImmediateTextChange(bool state)
enable/disable immediate text change behaviour.
Definition: ctextedit.cpp:73
Encapsulates various platform depended kinds of bitmaps.
Definition: cbitmap.h:21
Definition: customcontrols.cpp:8
void looseFocus() override
called if view should loose focus
Definition: ctextedit.cpp:353
void takeFocus() override
called if view should take focus
Definition: ctextedit.cpp:341
int32_t onKeyDown(VstKeyCode &keyCode) override
called if a key down event occurs and this view has focus
Definition: ctextedit.cpp:218
void valueChanged() override
notifies listener and dependent objects
Definition: ctextedit.cpp:150
holds an UTF8 encoded string and a platform representation of it
Definition: cstring.h:56
void setViewSize(const CRect &newSize, bool invalid=true) override
set views size
Definition: ctextedit.cpp:315
virtual void invalid()
mark whole view as invalid
Definition: cview.h:63
void parentSizeChanged() override
notification that one of the views parent has changed its size
Definition: ctextedit.cpp:308
void setText(const UTF8String &txt) override
set text
Definition: ctextedit.cpp:125
Point structure.
Definition: cpoint.h:17
a text edit control
Definition: ctextedit.h:21
Definition: icontrollistener.h:14