GUIFramework
1.1.0
Framework for desktop GUI applications in C++.
Loading...
Searching...
No Matches
BaseEditControl.cpp
Go to the documentation of this file.
1
#include "
BaseEditControl.h
"
2
3
#include "
Styles/Components/EditControlStyles.h
"
4
#include "
Exceptions/GetLastErrorException.h
"
5
6
using namespace
std;
7
8
namespace
gui_framework
9
{
10
void
BaseEditControl::updateLocalization
(wstring_view localizedText)
11
{
12
this->
setPlaceholder
(localizedText);
13
}
14
15
BaseEditControl::BaseEditControl
(
const
std::wstring& editControlName,
const
utility::ComponentSettings
& settings,
BaseComposite
* parent,
bool
isMultiLine) :
16
BaseComponent
17
(
18
standard_classes::editControl,
19
editControlName,
20
settings,
21
styles::EditControlStyles(isMultiLine),
22
parent
23
),
24
ITextOperations(handle)
25
{
26
ITextOperations::setText(L
""
);
27
}
28
29
bool
BaseEditControl::setPlaceholder
(std::wstring_view placeholder)
30
{
31
bool
result = SendMessageW(
handle
, EM_SETCUEBANNER,
false
,
reinterpret_cast<
LPARAM
>
(
placeholder
.data()));
32
33
if
(result)
34
{
35
this->placeholder =
placeholder
;
36
}
37
38
return
result;
39
}
40
41
const
wstring&
BaseEditControl::getPlaceholder
()
const
42
{
43
return
placeholder
;
44
}
45
46
json::JSONBuilder
BaseEditControl::getStructure
()
const
47
{
48
using
json::utility::jsonObject;
49
50
json::JSONBuilder builder =
BaseComponent::getStructure
();
51
uint32_t codepage = ISerializable::getCodepage();
52
53
get<jsonObject>(builder[
utility::to_string
(
windowName
, codepage)]).data.push_back({
"placeholder"
s,
utility::to_string
(
placeholder
, codepage) });
54
55
return
builder;
56
}
57
58
void
BaseEditControl::setText
(string_view localizationKey)
59
{
60
this->
setLocalizationKey
(localizationKey);
61
62
ITextOperations::setText(localizationKey);
63
}
64
}
BaseEditControl.h
EditControlStyles.h
GetLastErrorException.h
gui_framework::BaseComponent
Base class for all windows, controls, etc.
Definition
BaseComponent.h:17
gui_framework::BaseComponent::getStructure
virtual json::JSONBuilder getStructure() const override
Definition
BaseComponent.cpp:401
gui_framework::BaseComponent::windowName
const std::wstring windowName
Definition
BaseComponent.h:32
gui_framework::BaseComponent::handle
HWND handle
Definition
BaseComponent.h:33
gui_framework::BaseComposite
Base class for all windows that has children windows.
Definition
BaseComposite.h:23
gui_framework::BaseEditControl::placeholder
std::wstring placeholder
Definition
BaseEditControl.h:20
gui_framework::BaseEditControl::setPlaceholder
virtual bool setPlaceholder(std::wstring_view placeholder) final
Set placeholder to single line edit control.
Definition
BaseEditControl.cpp:29
gui_framework::BaseEditControl::BaseEditControl
BaseEditControl(const std::wstring &editControlName, const utility::ComponentSettings &settings, BaseComposite *parent, bool isMultiLine=false)
Definition
BaseEditControl.cpp:15
gui_framework::BaseEditControl::getStructure
virtual json::JSONBuilder getStructure() const override
Definition
BaseEditControl.cpp:46
gui_framework::BaseEditControl::updateLocalization
virtual void updateLocalization(std::wstring_view localizedText) override
Definition
BaseEditControl.cpp:10
gui_framework::BaseEditControl::getPlaceholder
virtual const std::wstring & getPlaceholder() const final
Definition
BaseEditControl.cpp:41
gui_framework::BaseEditControl::setText
virtual void setText(std::string_view localizationKey) final override
Definition
BaseEditControl.cpp:58
gui_framework::interfaces::ISingleTextLocalized::setLocalizationKey
virtual void setLocalizationKey(std::string_view localizationKey) final
gui_framework::utility::to_string
string to_string(wstring_view stringToConvert, uint32_t codepage)
Definition
Utility.cpp:41
gui_framework
Definition
BaseComponent.cpp:21
gui_framework::utility::ComponentSettings
All settings for windows.
Definition
ComponentSettings.h:11
GUIFramework
src
BaseComponents
StandardComponents
BaseEditControl.cpp
Generated by
1.12.0