GUIFramework 1.1.0
Framework for desktop GUI applications in C++.
Loading...
Searching...
No Matches
BaseComboBox.h
Go to the documentation of this file.
1#pragma once
2
4
8
9namespace gui_framework
10{
13 public BaseComponent,
15 {
16 protected:
18 std::function<void(BaseComboBox&)> onSelectionChange;
19 std::string functionName;
20 std::string moduleName;
21
22 protected:
23 virtual LRESULT windowMessagesHandle(HWND handle, UINT message, WPARAM wparam, LPARAM lparam, bool& isUsed) final override;
24
25 public:
31 static void loadOnSelectionChangeFromModule(std::function<void(BaseComboBox&)>& onSelectionChange, const std::string& functionName, const std::string& moduleName);
32
33 public:
34 enum class itemHeightEnum
35 {
36 forAllItems,
37 selectionFieldItem
38 };
39
40 public:
41 BaseComboBox(const std::wstring& comboBoxName, const utility::ComponentSettings& settings, const styles::ComboBoxStyles& styles, BaseComposite* parent);
42
47 LRESULT addValue(const std::wstring& value);
48
55 LRESULT addValues(const std::vector<std::wstring>& values);
56
61 LRESULT removeValue(size_t index);
62
68 virtual LRESULT insertValue(const std::wstring& value, LRESULT index);
69
75 virtual LRESULT changeValue(const std::wstring& newValue, LRESULT index);
76
81 LRESULT findSubstring(const std::wstring& substringToFind);
82
87 LRESULT findString(const std::wstring& stringToFind);
88
93 std::wstring getValue(size_t index) const;
94
98 LRESULT getCurrentSelectionIndex() const;
99
104 LRESULT setCurrentSelection(LRESULT index) const;
105
109 LRESULT size() const;
110
112 void clear();
113
116 void setSortingMode(bool isSorting);
117
123 LRESULT setItemHeight(itemHeightEnum value, uint16_t height);
124
129 LRESULT setDroppedWidth(uint16_t width);
130
133 void setOnSelectionChange(const std::function<void(BaseComboBox&)>& onSelectionChange);
134
140 void setOnSelectionChange(const std::string& functionName, const std::string& moduleName);
141
146 LRESULT getItemHeight(itemHeightEnum value) const;
147
151 LRESULT getDroppedWidth() const;
152
157 virtual void resize(uint16_t width, uint16_t height) override;
158
164 virtual void setBackgroundColor(uint8_t red, uint8_t green, uint8_t blue) final override;
165
171 virtual void setTextColor(uint8_t red, uint8_t green, uint8_t blue) final override;
172
175 virtual size_t getHash() const override = 0;
176
177 virtual json::JSONBuilder getStructure() const override;
178
179 virtual ~BaseComboBox() = default;
180 };
181
184}
#define GUI_FRAMEWORK_API
Base class for all combo boxes.
std::function< void(BaseComboBox &)> onSelectionChange
void setOnSelectionChange(const std::function< void(BaseComboBox &)> &onSelectionChange)
Set callback function with on selection change event.
virtual ~BaseComboBox()=default
virtual size_t getHash() const override=0
Used as key in creators.
void setOnSelectionChange(const std::string &functionName, const std::string &moduleName)
Set serializable callback function with on selection change event.
Base class for all windows, controls, etc.
Base class for all windows that has children windows.
Provides resize, setBlockResize, getBlockResize methods.
Base class for combo box styles.
void(*)(BaseComboBox &) comboBoxCallbackSignature
Used in notification events in combo box.