1.9
Public Types | Public Member Functions | Protected Member Functions | Protected Attributes | List of all members
Dialog Class Reference

A dialog is a widget that allows user to make a decision. More...

Inheritance diagram for Dialog:
Inheritance graph
[legend]

Public Types

enum class  ButtonId { button1 , button2 }
 Used to identify the button on the dialog. More...
 

Public Member Functions

 Dialog (const Rect &rect={}) noexcept
 Create a dialog with two buttons to handle decision. More...
 
 Dialog (Serializer::Properties &props) noexcept
 
void button (ButtonId button, const std::string &text)
 Set Button details for this dialog. More...
 
void icon (const Image &icon)
 Set a icon in a title area of a dialog. More...
 
void layout () override
 Perform layout on dialog Widget. More...
 
Size min_size_hint () const override
 Get a minimum size hint of the Dialog Widget. More...
 
void resize (const Size &size) override
 Resize the Dialog Widget. More...
 
void title (const Image &icon, const std::string &title)
 Set the title info for this dialog. More...
 
void title (const std::string &title)
 Set a title text for this dialog. More...
 
void widget (const std::shared_ptr< Widget > &widget)
 Set a widget for this dialog. More...
 
- Public Member Functions inherited from PopupType< T >
 PopupType (const Size &size={}, const Point &point={}) noexcept
 
 PopupType (Serializer::Properties &props) noexcept
 
void hide () override
 Hide the Widget. More...
 
void show () override
 Show the Widget. More...
 
virtual void show_centered ()
 Show the window centered. More...
 
virtual void show_modal (bool center=false)
 Show the window in modal mode. More...
 

Public Attributes

Signal on_button1_click
 Event signal. More...
 
Signal on_button2_click
 Signal when button2 is clicked. More...
 

Protected Member Functions

 Dialog (Serializer::Properties &props, bool is_derived) noexcept
 
void initialize (bool init_inherited_properties=true)
 
- Protected Member Functions inherited from PopupType< T >
 PopupType (Serializer::Properties &props, bool is_derived) noexcept
 

Protected Attributes

Button m_button1
 Button for okay or cancel. More...
 
Button m_button2
 Button for okay or cancel. More...
 
VerticalBoxSizer m_content
 Content sizer. More...
 
std::shared_ptr< StaticGridm_grid
 Grid for organizing okay & cancel Buttons. More...
 
VerticalBoxSizer m_layout
 Layout sizer. More...
 
ImageLabel m_title
 Dialog title. More...
 

Detailed Description

A dialog is a widget that allows user to make a decision.

A dialog does not fill the screen and is normally used for modal events that require users to take an action before they can proceed further.

A basic dialog contains three regions:

Title: Title of a dialog. Content: a message text or an widget. Buttons: two buttons to make a decision.

Member Enumeration Documentation

◆ ButtonId

enum ButtonId
strong

Used to identify the button on the dialog.

Enumerator
button1 
button2 

Constructor & Destructor Documentation

◆ Dialog() [1/3]

Dialog ( const Rect rect = {})
explicitnoexcept

Create a dialog with two buttons to handle decision.

Parameters
[in]rectInitial rectangle of the widget.

◆ Dialog() [2/3]

Dialog ( Serializer::Properties props)
inlineexplicitnoexcept
Parameters
[in]propslist of widget argument and its properties.

◆ Dialog() [3/3]

Dialog ( Serializer::Properties props,
bool  is_derived 
)
explicitprotectednoexcept

Member Function Documentation

◆ button()

void button ( ButtonId  button,
const std::string &  text 
)

Set Button details for this dialog.

Parameters
[in]buttonis buttonid
[in]textis a text to display on button.

◆ icon()

void icon ( const Image icon)

Set a icon in a title area of a dialog.

◆ initialize()

void initialize ( bool  init_inherited_properties = true)
protected

◆ layout()

void layout ( )
override

Perform layout on dialog Widget.

◆ min_size_hint()

Size min_size_hint ( ) const
override

Get a minimum size hint of the Dialog Widget.

◆ resize()

void resize ( const Size size)
override

Resize the Dialog Widget.

Changes the width and height of the Widget.

Parameters
[in]sizeThe new size of the Widget.

◆ title() [1/2]

void title ( const Image icon,
const std::string &  title 
)

Set the title info for this dialog.

Parameters
[in]iconset the icon in a title.
[in]titleset the title text.

◆ title() [2/2]

void title ( const std::string &  title)

Set a title text for this dialog.

◆ widget()

void widget ( const std::shared_ptr< Widget > &  widget)

Set a widget for this dialog.

Parameters
[in]widget

Member Data Documentation

◆ m_button1

Button m_button1
protected

Button for okay or cancel.

◆ m_button2

Button m_button2
protected

Button for okay or cancel.

◆ m_content

VerticalBoxSizer m_content
protected

Content sizer.

◆ m_grid

std::shared_ptr<StaticGrid> m_grid
protected

Grid for organizing okay & cancel Buttons.

◆ m_layout

VerticalBoxSizer m_layout
protected

Layout sizer.

◆ m_title

ImageLabel m_title
protected

Dialog title.

◆ on_button1_click

Signal on_button1_click

Event signal.

Signal when button1 is clicked.

◆ on_button2_click

Signal on_button2_click

Signal when button2 is clicked.