| 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_DROP_DOWN_BUTTON_H_INCLUDED |
| 8 | #define APP_UI_DROP_DOWN_BUTTON_H_INCLUDED |
| 9 | #pragma once |
| 10 | |
| 11 | #include "obs/signal.h" |
| 12 | #include "ui/box.h" |
| 13 | |
| 14 | namespace ui { |
| 15 | class Button; |
| 16 | class Event; |
| 17 | } |
| 18 | |
| 19 | namespace app { |
| 20 | |
| 21 | class DropDownButton : public ui::HBox { |
| 22 | public: |
| 23 | DropDownButton(const char* text); |
| 24 | |
| 25 | ui::Button* mainButton() { return m_button; } |
| 26 | ui::Button* dropDown() { return m_dropDown; } |
| 27 | |
| 28 | obs::signal<void()> Click; |
| 29 | obs::signal<void()> DropDownClick; |
| 30 | |
| 31 | protected: |
| 32 | void onButtonClick(ui::Event& ev); |
| 33 | void onDropDownButtonClick(ui::Event& ev); |
| 34 | |
| 35 | private: |
| 36 | ui::Button* m_button; |
| 37 | ui::Button* m_dropDown; |
| 38 | }; |
| 39 | |
| 40 | } // namespace app |
| 41 | |
| 42 | #endif |
| 43 | |