SavvyUI C++ UI Library
Loading...
Searching...
No Matches
TextField.h
Go to the documentation of this file.
1#pragma once
2
3#include "Component.h"
4
8class TextField : public Component
9{
10 BOOL _isPassword;
11 BOOL _readOnly;
12 int _maxLength;
13 wstring _text;
14
15protected:
25 BOOL getCreateWindowOptions(wstring& title, UINT& widownStyles, wstring& wndClassName, BOOL& isCustomWndProc);
26
31
32public:
37
41 virtual ~TextField();
42
43 void setReadOnly(BOOL readOnly);
44
45 void setMaxLength(int maxLen);
46
52 void setPassword(BOOL isPassword = TRUE);
53
59 void setText(const wstring& text);
60
66 wstring getText();
67
71 wstring getSelectedText();
72 void replaceSelectedText(const wstring& newText);
73
74 void selectText(int startPos, int endPos);
75
76 BOOL canUndo();
77 BOOL undo();
78
79 void setCaretPos(int newPos);
80
87
95 void onDataChanged(WinHandle hTarget, const wstring& newValue, const ProcParams& procParams);
96
103};
HWND WinHandle
Definition Common.h:16
Component()
Constructs a new Component instance.
Definition EventListeners.h:15
Definition Component.h:9
void setMaxLength(int maxLen)
wstring getSelectedText()
Gets the selected text content.
void replaceSelectedText(const wstring &newText)
TextField()
Constructs a new TextField.
void setCaretPos(int newPos)
void setPassword(BOOL isPassword=TRUE)
Sets whether this text field masks input as a password.
wstring getText()
Gets the current text content.
void addDataChangedListener(DataChangeListener *l)
Adds a listener for data changed events.
BOOL undo()
void onDataChanged(WinHandle hTarget, const wstring &newValue, const ProcParams &procParams)
Handles data changed events.
void windowCreated()
Called when the window is created.
BOOL canUndo()
void selectText(int startPos, int endPos)
void setText(const wstring &text)
Sets the text content of the field.
int getPreferredHeight()
Gets the preferred height of the text field control.
virtual ~TextField()
Destructor.
void setReadOnly(BOOL readOnly)
BOOL getCreateWindowOptions(wstring &title, UINT &widownStyles, wstring &wndClassName, BOOL &isCustomWndProc)
Retrieves window creation options.