7#pragma push_macro("min")
8#pragma push_macro("max")
24 standard_classes::listBox,
33 parent ? parent->getHandle() : nullptr,
44 LRESULT result = SendMessageW(
handle, LB_ADDSTRING, NULL,
reinterpret_cast<LPARAM
>(value.data()));
50 else if (result == LB_ERRSPACE)
64 return this->
addValue(localization::WTextLocalization::get()[localizationKey]);
69 LRESULT result = SendMessageW(
handle, LB_DELETESTRING, index, NULL);
76 IMultipleTextLocalized::removeLocalizationKey(index);
85 LRESULT result = SendMessageW(
handle, LB_INSERTSTRING, index,
reinterpret_cast<LPARAM
>(value.data()));
91 else if (result == LB_ERRSPACE)
105 return this->
insertValue(localization::WTextLocalization::get()[localizationKey], index);
110 LRESULT result = SendMessageW(
handle, LB_SETITEMDATA, index,
reinterpret_cast<LPARAM
>(newValue.data()));
112 if (result == LB_ERR)
114 throw exceptions::SelectListException(__FUNCTION__, result, __FILE__, __FUNCTION__, __LINE__);
126 return this->
changeValue(localization::WTextLocalization::get()[localizationKey], index);
131 LRESULT findedIndex = SendMessageW(
handle, LB_FINDSTRING, 0,
reinterpret_cast<LPARAM
>(subStringToFind.data()));
133 if (findedIndex == LB_ERR)
143 LRESULT findedIndex = SendMessageW(
handle, LB_FINDSTRINGEXACT, 0,
reinterpret_cast<LPARAM
>(stringToFind.data()));
145 if (findedIndex == LB_ERR)
156 LRESULT
size = SendMessageW(
handle, LB_GETTEXTLEN, index, NULL);
163 result.resize(++
size);
165 LRESULT errorCode = SendMessageW(
handle, LB_GETTEXT, index,
reinterpret_cast<LPARAM
>(result.data()));
167 if (errorCode == LB_ERR)
179 return SendMessageW(
handle, LB_GETCURSEL, NULL, NULL);
184 LRESULT result = SendMessageW(
handle, LB_SETCURSEL, index, NULL);
186 if (result == LB_ERR)
196 LRESULT result = SendMessageW(
handle, LB_GETCOUNT, NULL, NULL);
198 if (result == LB_ERR)
208 SendMessageW(
handle, LB_RESETCONTENT, NULL, NULL);
213 LRESULT result = SendMessageW(
handle, LB_SETITEMHEIGHT, NULL, height);
215 if (result == LB_ERR)
225 LRESULT result = SendMessageW(
handle, LB_SETCOLUMNWIDTH, width, NULL);
227 if (result == LB_ERR)
239 LRESULT result = SendMessageW(
handle, LB_GETITEMHEIGHT, NULL, NULL);
241 if (result == LB_ERR)
258 LRESULT currentSize = this->
size();
259 HDC deviceContext = GetDC(
handle);
262 if (currentSize == CB_ERR || !currentSize)
264 double widthCoefficient =
static_cast<double>(width) /
parentWidth;
269 static_cast<int>(
desiredX * widthCoefficient),
276 ShowWindow(
handle, SW_SHOW);
281 for (
size_t i = 0; i < static_cast<size_t>(currentSize); i++)
286 if (GetTextExtentPoint32W(deviceContext, value.data(),
static_cast<int>(value.size()), &valueSizes))
298 heightSum += valueSizes.cy;
302 uint16_t newHeight = 0;
316 newHeight =
static_cast<uint16_t
>(heightSum +
requiredSize.cy * 2);
329 ShowWindow(
handle, SW_SHOW);
335 using json::utility::jsonObject;
337 uint32_t codepage = ISerializable::getCodepage();
340 vector<jsonObject> values;
341 LRESULT currentSize = this->
size();
343 current.data.push_back({
"columnWidth"s,
static_cast<uint64_t
>(
columnsWidth) });
347 for (
size_t i = 0; i < static_cast<size_t>(currentSize); i++)
352 current.data.push_back({
"listBoxValues"s, move(values) });
359#pragma pop_macro("min")
360#pragma pop_macro("max")
Base class for all windows, controls, etc.
virtual json::JSONBuilder getStructure() const override
uint16_t getActualHeight() const
const std::wstring windowName
uint16_t getActualWidth() const
Base class for all windows that has children windows.
std::wstring getValue(size_t index) const
LRESULT setItemsHeight(uint8_t height)
LRESULT addValue(std::wstring_view value)
LRESULT getItemsHeight() const
virtual LRESULT insertValue(std::wstring_view value, LRESULT index)
virtual json::JSONBuilder getStructure() const override
LRESULT findSubstring(std::wstring_view subStringToFind)
uint8_t getColumnsWidth() const
LRESULT findString(std::wstring_view stringToFind)
virtual LRESULT setCurrentSelection(LRESULT index) const
LRESULT removeValue(size_t index)
LRESULT getCurrentSelectionIndex() const
BaseListBox(std::wstring_view listBoxName, const utility::ComponentSettings &settings, const styles::ListBoxStyles &styles, BaseComposite *parent)
virtual LRESULT changeValue(std::wstring_view newValue, LRESULT index)
virtual void updateLocalization(size_t index, std::wstring_view localizedText) override
virtual void resize(uint16_t width, uint16_t height) override
LRESULT setColumnsWidth(uint8_t width)
Exception for all list classes exceptions.
void addLocalizationKey(std::string_view localizationKey)
Base class for list box styles.
constexpr std::string_view notEnoughSpace
constexpr uint16_t listBoxAdditionalWidth
void removeStyle(HWND handle, LONG_PTR styleToRemove)
Remove WinAPI style.
void appendStyle(HWND handle, LONG_PTR newStyle)
Append WinAPI style.
string to_string(wstring_view stringToConvert, uint32_t codepage)
All settings for windows.