| 1 | // Aseprite |
| 2 | // Copyright (C) 2001-2016 David Capello |
| 3 | // |
| 4 | // This program is distributed under the terms of |
| 5 | // the End-User License Agreement for Aseprite. |
| 6 | |
| 7 | #ifndef APP_UI_HEX_COLOR_ENTRY_H_INCLUDED |
| 8 | #define APP_UI_HEX_COLOR_ENTRY_H_INCLUDED |
| 9 | #pragma once |
| 10 | |
| 11 | #include "app/color.h" |
| 12 | #include "obs/signal.h" |
| 13 | #include "ui/box.h" |
| 14 | #include "ui/entry.h" |
| 15 | #include "ui/label.h" |
| 16 | |
| 17 | namespace app { |
| 18 | |
| 19 | // Little widget to show a color in hexadecimal format (as HTML). |
| 20 | class HexColorEntry : public ui::Box { |
| 21 | public: |
| 22 | HexColorEntry(); |
| 23 | |
| 24 | void setColor(const app::Color& color); |
| 25 | |
| 26 | // Signals |
| 27 | obs::signal<void(const app::Color&)> ColorChange; |
| 28 | |
| 29 | protected: |
| 30 | void onEntryChange(); |
| 31 | |
| 32 | private: |
| 33 | class CustomEntry : public ui::Entry { |
| 34 | public: |
| 35 | CustomEntry(); |
| 36 | private: |
| 37 | bool onProcessMessage(ui::Message* msg) override; |
| 38 | }; |
| 39 | |
| 40 | ui::Label m_label; |
| 41 | CustomEntry m_entry; |
| 42 | }; |
| 43 | |
| 44 | } // namespace app |
| 45 | |
| 46 | #endif |
| 47 | |