| 1 | // Aseprite UI Library |
| 2 | // Copyright (C) 2022 Igara Studio S.A. |
| 3 | // Copyright (C) 2001-2017 David Capello |
| 4 | // |
| 5 | // This file is released under the terms of the MIT license. |
| 6 | // Read LICENSE.txt for more information. |
| 7 | |
| 8 | #ifndef UI_LISTITEM_H_INCLUDED |
| 9 | #define UI_LISTITEM_H_INCLUDED |
| 10 | #pragma once |
| 11 | |
| 12 | #include "ui/widget.h" |
| 13 | |
| 14 | namespace ui { |
| 15 | |
| 16 | class ListItem : public Widget { |
| 17 | public: |
| 18 | ListItem(const std::string& text = std::string()); |
| 19 | |
| 20 | const std::string& getValue() const { return m_value; } |
| 21 | |
| 22 | void setValue(const std::string& value) { |
| 23 | m_value = value; |
| 24 | } |
| 25 | |
| 26 | protected: |
| 27 | bool onProcessMessage(Message* msg) override; |
| 28 | void onResize(ResizeEvent& ev) override; |
| 29 | void onSizeHint(SizeHintEvent& ev) override; |
| 30 | void onInitTheme(InitThemeEvent& ev) override; |
| 31 | void onSetText() override; |
| 32 | |
| 33 | private: |
| 34 | std::string m_value; |
| 35 | int m_textLength = -1; |
| 36 | }; |
| 37 | |
| 38 | } // namespace ui |
| 39 | |
| 40 | #endif |
| 41 | |