| 1 | // Aseprite UI Library |
| 2 | // Copyright (C) 2019 Igara Studio S.A. |
| 3 | // Copyright (C) 2001-2018 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_ALERT_H_INCLUDED |
| 9 | #define UI_ALERT_H_INCLUDED |
| 10 | #pragma once |
| 11 | |
| 12 | #include "ui/window.h" |
| 13 | |
| 14 | #include <memory> |
| 15 | #include <string> |
| 16 | #include <vector> |
| 17 | |
| 18 | namespace ui { |
| 19 | |
| 20 | class Box; |
| 21 | class CheckBox; |
| 22 | class Slider; |
| 23 | |
| 24 | class Alert; |
| 25 | typedef std::shared_ptr<Alert> AlertPtr; |
| 26 | |
| 27 | class Alert : public Window { |
| 28 | public: |
| 29 | Alert(); |
| 30 | |
| 31 | void setTitle(const std::string& title); |
| 32 | void addLabel(const std::string& text, const int align); |
| 33 | void addSeparator(); |
| 34 | void addButton(const std::string& text); |
| 35 | |
| 36 | void addProgress(); |
| 37 | void setProgress(double progress); |
| 38 | |
| 39 | CheckBox* addCheckBox(const std::string& text); |
| 40 | |
| 41 | int show(); |
| 42 | |
| 43 | static AlertPtr create(const std::string& msg); |
| 44 | static int show(const std::string& msg); |
| 45 | |
| 46 | private: |
| 47 | void processString(std::string& buf); |
| 48 | |
| 49 | Slider* m_progress; |
| 50 | Box* m_labelsPlaceholder; |
| 51 | Box* m_buttonsPlaceholder; |
| 52 | Box* m_progressPlaceholder; |
| 53 | std::vector<Widget*> m_buttons; |
| 54 | }; |
| 55 | |
| 56 | } // namespace ui |
| 57 | |
| 58 | #endif |
| 59 | |