xtd - Reference Guide  0.2.0
Modern c++17/20 framework to create console, GUI and unit test applications on Windows, macOS, Linux, iOS and android.
Public Attributes | Public Member Functions | Protected Member Functions | List of all members
xtd::forms::common_dialog Class Referenceabstract

#include <common_dialog.h>

Definition

Specifies the base class used for displaying dialog boxes on the screen.

Namespace
xtd::forms
Library
xtd.forms
Remarks
Inherited classes are required to implement run_dialog by invoking show_dialog to create a specific common dialog box. Inherited classes can optionally override hook_proc to implement specific dialog box hook functionality.

Public Attributes

event< common_dialog, dialog_closed_event_handlerdialog_closed
 Occurs when the user close a common dialog box with dialog close button or other dialog buttons. More...
 
event< common_dialog, help_event_handlerhelp_request
 Occurs when the user clicks the Help button on a common dialog box. More...
 

Public Member Functions

 common_dialog ()=default
 Initializes a new instance of the common_dialog class. More...
 
xtd::forms::dialog_result dialog_result () const
 Get async dialog_result result after dialog box is closing. More...
 
virtual void reset ()=0
 When overridden in a derived class, resets the properties of a common dialog box to their default values. More...
 
xtd::forms::dialog_result show_dialog ()
 Runs a common dialog box with a default owner. More...
 
xtd::forms::dialog_result show_dialog (const iwin32_window &owner)
 Runs a common dialog box with the specified owner. More...
 
void show_sheet (const iwin32_window &owner)
 Runs a common dialog box with the specified owner. More...
 
xtd::forms::dialog_result show_sheet_dialog (const iwin32_window &owner)
 Runs a common dialog box with the specified owner. More...
 
std::any tag () const
 Gets an object that contains data about the control. More...
 
common_dialogtag (const std::any &tag)
 Sets an object that contains data about the control. More...
 
- Public Member Functions inherited from xtd::object
 object ()=default
 Create a new instance of the ultimate base class object. More...
 
virtual bool equals (const object &obj) const noexcept
 Determines whether the specified object is equal to the current object. More...
 
virtual size_t get_hash_code () const noexcept
 Serves as a hash function for a particular type. More...
 
template<typename object_t >
std::unique_ptr< object_t > memberwise_clone () const
 Gets the type of the current instance. More...
 
virtual xtd::ustring to_string () const noexcept
 Returns a std::string that represents the current object. More...
 

Protected Member Functions

virtual void on_dialog_closed (const dialog_closed_event_args &e)
 Raises the common_dialog::dialog_close event. More...
 
virtual void on_help_request (help_event_args &e)
 Raises the common_dialog::help_request event. More...
 
virtual bool run_dialog (intptr_t hwnd_owner)=0
 When overridden in a derived class, specifies a common dialog box. More...
 
virtual void run_sheet (intptr_t hwnd_owner)=0
 When overridden in a derived class, specifies a common dialog box. More...
 
- Protected Member Functions inherited from xtd::forms::component
 component ()=default
 Initialises a new instance of the component class. More...
 
virtual bool can_raise_events () const
 Gets a value indicating whether the component can raise an event. More...
 
bool design_mode () const
 Gets a value that indicates whether the component is currently in design mode. More...
 

Additional Inherited Members

- Static Public Member Functions inherited from xtd::object
static bool equals (const object &object_a, const object &object_b) noexcept
 Determines whether the specified object instances are considered equal. More...
 
static bool reference_equals (const object &object_a, const object &object_b) noexcept
 Determines whether the specified object instances are the same instance. More...
 

Constructor & Destructor Documentation

◆ common_dialog()

xtd::forms::common_dialog::common_dialog ( )
default

Initializes a new instance of the common_dialog class.

Member Function Documentation

◆ dialog_result()

xtd::forms::dialog_result xtd::forms::common_dialog::dialog_result ( ) const
inline

Get async dialog_result result after dialog box is closing.

Returns
ok if the user clicks OK in the dialog box; otherwise, cancel.

◆ on_dialog_closed()

virtual void xtd::forms::common_dialog::on_dialog_closed ( const dialog_closed_event_args e)
inlineprotectedvirtual

Raises the common_dialog::dialog_close event.

Parameters
eAn common_dialog_close_event_args that provides the event data.
Remarks
This method is invoked when the common dialog box is closed.

◆ on_help_request()

virtual void xtd::forms::common_dialog::on_help_request ( help_event_args e)
inlineprotectedvirtual

Raises the common_dialog::help_request event.

Parameters
eAn help_event_args that provides the event data.
Remarks
This method is invoked when the Help button is clicked. Inheriting classes can override this method to handle the event.

◆ reset()

virtual void xtd::forms::common_dialog::reset ( )
pure virtual

When overridden in a derived class, resets the properties of a common dialog box to their default values.

Notes to Inheritors
Inheriting classes can override this method to reset their properties.

Implemented in xtd::forms::file_dialog, xtd::forms::font_dialog, xtd::forms::input_dialog, xtd::forms::color_dialog, and xtd::forms::folder_browser_dialog.

◆ run_dialog()

virtual bool xtd::forms::common_dialog::run_dialog ( intptr_t  hwnd_owner)
protectedpure virtual

When overridden in a derived class, specifies a common dialog box.

Parameters
hwnd_ownerA value that represents the window handle of the owner window for the common dialog box.
Returns
true if the dialog box was successfully run; otherwise, false.

Implemented in xtd::forms::file_dialog, xtd::forms::font_dialog, xtd::forms::input_dialog, xtd::forms::color_dialog, and xtd::forms::folder_browser_dialog.

◆ run_sheet()

virtual void xtd::forms::common_dialog::run_sheet ( intptr_t  hwnd_owner)
protectedpure virtual

When overridden in a derived class, specifies a common dialog box.

Parameters
hwnd_ownerA value that represents the window handle of the owner window for the common dialog box.
Returns
true if the dialog box was successfully run; otherwise, false.
Remarks
The result will done in async. Check result_dialog property after dialog box closed to obtain the result.

Implemented in xtd::forms::file_dialog, xtd::forms::font_dialog, xtd::forms::color_dialog, xtd::forms::input_dialog, and xtd::forms::folder_browser_dialog.

◆ show_dialog() [1/2]

xtd::forms::dialog_result xtd::forms::common_dialog::show_dialog ( )
inline

Runs a common dialog box with a default owner.

Returns
ok if the user clicks OK in the dialog box; otherwise, cancel.
Remarks
This method implements run_dialog.
Examples:
color_dialog.cpp, font_dialog.cpp, image_list.cpp, and input_dialog_multiline.cpp.

◆ show_dialog() [2/2]

xtd::forms::dialog_result xtd::forms::common_dialog::show_dialog ( const iwin32_window owner)
inline

Runs a common dialog box with the specified owner.

Parameters
ownerAny object that implements iwn32_window that represents the top-level window that will own the modal dialog box.
Returns
ok the user clicks OK in the dialog box; otherwise, cancel.
Remarks
This version of the show_dialog method allows you to specify a specific form or control that will own the dialog box that is shown. If you use the version of this method that has no parameters, the dialog box being shown would be owned automatically by the currently active window of your application.

◆ show_sheet()

void xtd::forms::common_dialog::show_sheet ( const iwin32_window owner)
inline

Runs a common dialog box with the specified owner.

Parameters
ownerAny object that implements iwn32_window that represents the top-level window that will own the modal dialog box.
Remarks
This version of the show_dialog method allows you to specify a specific form or control that will own the dialog box that is shown. If you use the version of this method that has no parameters, the dialog box being shown would be owned automatically by the currently active window of your application.

◆ show_sheet_dialog()

xtd::forms::dialog_result xtd::forms::common_dialog::show_sheet_dialog ( const iwin32_window owner)
inline

Runs a common dialog box with the specified owner.

Parameters
ownerAny object that implements iwn32_window that represents the top-level window that will own the modal dialog box.
Remarks
This version of the show_dialog method allows you to specify a specific form or control that will own the dialog box that is shown. If you use the version of this method that has no parameters, the dialog box being shown would be owned automatically by the currently active window of your application.
Examples:
folder_browser_dialog.cpp, input_dialog.cpp, input_dialog_password.cpp, open_file_dialog.cpp, and save_file_dialog.cpp.

◆ tag() [1/2]

std::any xtd::forms::common_dialog::tag ( ) const
inline

Gets an object that contains data about the control.

Returns
The object that contains data about the common_dialog.
Remarks
Use this property to store arbitrary information about the control.

◆ tag() [2/2]

common_dialog& xtd::forms::common_dialog::tag ( const std::any tag)
inline

Sets an object that contains data about the control.

Parameters
tagThe object that contains data about the common_dialog.
Remarks
Use this property to store arbitrary information about the control.

The documentation for this class was generated from the following file: