1.10
dialog.h
1/*
2 * Copyright (C) 2018 Microchip Technology Inc. All rights reserved.
3 *
4 * SPDX-License-Identifier: Apache-2.0
5 */
6#ifndef EGT_DIALOG_H
7#define EGT_DIALOG_H
8
9#include <egt/button.h>
10#include <egt/detail/meta.h>
11#include <egt/grid.h>
12#include <egt/label.h>
13#include <egt/popup.h>
14#include <egt/signal.h>
15#include <egt/sizer.h>
16#include <memory>
17#include <string>
18
19namespace egt
20{
21inline namespace v1
22{
23
37class EGT_API Dialog : public Popup
38{
39public:
40
44 enum class ButtonId
45 {
46 button1,
47 button2,
48 };
49
65 explicit Dialog(const Rect& rect = {}) noexcept;
66
70 explicit Dialog(Serializer::Properties& props) noexcept
71 : Dialog(props, false)
72 {
73 }
74
75protected:
76
77 explicit Dialog(Serializer::Properties& props, bool is_derived) noexcept;
78
79public:
80
87 void title(const Image& icon, const std::string& title);
88
92 void title(const std::string& title);
93
97 void icon(const Image& icon);
98
105 void button(ButtonId button, const std::string& text);
106
112 void widget(const std::shared_ptr<Widget>& widget);
113
117 Size min_size_hint() const override;
118
122 void layout() override;
123
131 void resize(const Size& size) override;
132
133protected:
134
137
140
143
145 std::shared_ptr<StaticGrid> m_grid;
146
149
152
153 void initialize(bool init_inherited_properties = true);
154};
155
156}
157
158}
159
160#endif
Basic button control.
Definition button.h:65
A dialog is a widget that allows user to make a decision.
Definition dialog.h:38
VerticalBoxSizer m_layout
Layout sizer.
Definition dialog.h:136
void button(ButtonId button, const std::string &text)
Set Button details for this dialog.
Signal on_button1_click
Event signal.
Definition dialog.h:55
Size min_size_hint() const override
Get a minimum size hint of the Dialog Widget.
std::shared_ptr< StaticGrid > m_grid
Grid for organizing okay & cancel Buttons.
Definition dialog.h:145
void icon(const Image &icon)
Set a icon in a title area of a dialog.
void title(const std::string &title)
Set a title text for this dialog.
void widget(const std::shared_ptr< Widget > &widget)
Set a widget for this dialog.
Dialog(Serializer::Properties &props) noexcept
Definition dialog.h:70
void layout() override
Perform layout on dialog Widget.
Button m_button1
Button for okay or cancel.
Definition dialog.h:148
void resize(const Size &size) override
Resize the Dialog Widget.
VerticalBoxSizer m_content
Content sizer.
Definition dialog.h:139
Dialog(const Rect &rect={}) noexcept
Create a dialog with two buttons to handle decision.
void title(const Image &icon, const std::string &title)
Set the title info for this dialog.
ButtonId
Used to identify the button on the dialog.
Definition dialog.h:45
Dialog(Serializer::Properties &props, bool is_derived) noexcept
Button m_button2
Button for okay or cancel.
Definition dialog.h:151
Signal on_button2_click
Signal when button2 is clicked.
Definition dialog.h:57
void initialize(bool init_inherited_properties=true)
ImageLabel m_title
Dialog title.
Definition dialog.h:142
Raster image resource used for drawing or displaying.
Definition image.h:39
Popup window.
Definition popup.h:30
std::list< std::tuple< std::string, std::string, Serializer::Attributes > > Properties
Definition serialize.h:47
Signal class used for defining a signal and dispatching events.
Definition signal.h:30
VerticalBoxSizer helper variation of BoxSizer.
Definition sizer.h:239
EGT framework namespace.
Definition animation.h:24