SavvyUI C++ UI Library
Loading...
Searching...
No Matches
DialogFactory Class Reference

A utility class providing static methods to show common dialog boxes. More...

#include <DialogFactory.h>

Static Public Member Functions

static void showError (Component *parent, const wstring &errorMessage, const wstring &title=L"")
 Shows an error message dialog.
static void showWarning (Component *parent, const wstring &warningMessage, const wstring &title=L"")
 Shows a warning message dialog.
static void showInfo (Component *parent, const wstring &infoMessage, const wstring &title=L"")
 Shows an informational message dialog.
static void showSuccess (Component *parent, const wstring &successMessage, const wstring &title=L"")
 Shows a success message dialog.
static BOOL showConfirmDialog (Component *parent, const wstring &promptMessageText, const wstring &title=L"")
 Shows a confirmation dialog with Yes/No options.
static BOOL showOpenFileDialog (Component *parent, vector< wstring > &selection, BOOL allowMultiSelection=FALSE)
 Shows an Open File dialog to select a file.
static BOOL showSaveFileDialog (Component *parent, wstring &selection)
 Shows a Save File dialog to specify a file to save.
static BOOL showFolderSelectionDialog (Component *parent, wstring &selection)
 Shows a folder selection dialog.
static BOOL showColorSelectionDialog (Component *parent, COLORREF &selection)
 Shows a color selection dialog.
static BOOL showFontSelectionDialog (Component *parent, wstring &fontName, long &fontHeight, long &fontWeight, BOOL &isItalic, COLORREF &color)
 Shows a font selection dialog.
static DCHandle showPrinterSelectionDialog (Component *parent, Bounds &printerRect)
 Shows a printer selection dialog.
static BOOL showPrinterSetupDialog (Component *parent, long &leftMargin, long &topMargin, long &rightMargin, long &bottomMargin)
 Shows a printer setup dialog to configure margins.
static BOOL showInputDialog (Component *parent, const vector< wstring > &labels, vector< wstring > &values)
 Shows a generic input dialog with multiple labeled fields.
static BOOL showDateInputDialog (Component *parent, wstring &selectedDate)
 Shows a generic input dialog with multiple labeled fields.

Detailed Description

A utility class providing static methods to show common dialog boxes.

This factory class offers convenient static methods to display error, warning, info, and success messages, as well as dialogs for file selection, folder selection, color picking, font picking, printer setup, confirmation prompts, and generic input dialogs.

Member Function Documentation

◆ showColorSelectionDialog()

BOOL DialogFactory::showColorSelectionDialog ( Component * parent,
COLORREF & selection )
static

Shows a color selection dialog.

Parameters
hWndParentHandle to the parent window.
selectionInput/output COLORREF specifying initial and receiving selected color.
Returns
TRUE if a color was selected, FALSE otherwise.

◆ showConfirmDialog()

BOOL DialogFactory::showConfirmDialog ( Component * parent,
const wstring & promptMessageText,
const wstring & title = L"" )
static

Shows a confirmation dialog with Yes/No options.

Parameters
hParentHandle to the parent window.
promptMessageTextThe prompt message to display.
titleOptional dialog title. Defaults to an empty string.
Returns
TRUE if user confirms (Yes), FALSE otherwise.

◆ showDateInputDialog()

BOOL DialogFactory::showDateInputDialog ( Component * parent,
wstring & selectedDate )
static

Shows a generic input dialog with multiple labeled fields.

Parameters
hParentHandle to the parent window.
selectedDateInput/Output selected date.
Returns
TRUE if user confirmed input, FALSE if cancelled.

◆ showError()

void DialogFactory::showError ( Component * parent,
const wstring & errorMessage,
const wstring & title = L"" )
static

Shows an error message dialog.

Parameters
hParentHandle to the parent window.
errorMessageThe error message to display.
titleOptional dialog title. Defaults to an empty string.

◆ showFolderSelectionDialog()

BOOL DialogFactory::showFolderSelectionDialog ( Component * parent,
wstring & selection )
static

Shows a folder selection dialog.

Parameters
hWndParentHandle to the parent window.
selectionOutput parameter receiving the selected folder path.
Returns
TRUE if a folder was selected, FALSE otherwise.

◆ showFontSelectionDialog()

BOOL DialogFactory::showFontSelectionDialog ( Component * parent,
wstring & fontName,
long & fontHeight,
long & fontWeight,
BOOL & isItalic,
COLORREF & color )
static

Shows a font selection dialog.

Parameters
hWndParentHandle to the parent window.
fontNameInput/output font name string.
fontHeightInput/output font height.
fontWeightInput/output font weight.
isItalicInput/output italic flag.
colorInput/output COLORREF for font color.
Returns
TRUE if a font was selected, FALSE otherwise.

◆ showInfo()

void DialogFactory::showInfo ( Component * parent,
const wstring & infoMessage,
const wstring & title = L"" )
static

Shows an informational message dialog.

Parameters
hParentHandle to the parent window.
infoMessageThe informational message to display.
titleOptional dialog title. Defaults to an empty string.

◆ showInputDialog()

BOOL DialogFactory::showInputDialog ( Component * parent,
const vector< wstring > & labels,
vector< wstring > & values )
static

Shows a generic input dialog with multiple labeled fields.

Parameters
hParentHandle to the parent window.
labelsVector of label strings for input fields.
valuesInput/output vector of values corresponding to labels.
Returns
TRUE if user confirmed input, FALSE if cancelled.

◆ showOpenFileDialog()

BOOL DialogFactory::showOpenFileDialog ( Component * parent,
vector< wstring > & selection,
BOOL allowMultiSelection = FALSE )
static

Shows an Open File dialog to select a file.

Parameters
hWndParentHandle to the parent window.
selectionOutput parameter receiving the selected file path.
Returns
TRUE if a file was selected, FALSE otherwise.

◆ showPrinterSelectionDialog()

DCHandle DialogFactory::showPrinterSelectionDialog ( Component * parent,
Bounds & printerRect )
static

Shows a printer selection dialog.

Parameters
hWndParentHandle to the parent window.
Returns
Handle to the device context (DCHandle) for the selected printer. Caller must call DeleteDC on the returned DCHandle when done.

◆ showPrinterSetupDialog()

BOOL DialogFactory::showPrinterSetupDialog ( Component * parent,
long & leftMargin,
long & topMargin,
long & rightMargin,
long & bottomMargin )
static

Shows a printer setup dialog to configure margins.

Parameters
hWndParentHandle to the parent window.
leftMarginInput/output left margin.
topMarginInput/output top margin.
rightMarginInput/output right margin.
bottomMarginInput/output bottom margin.
Returns
TRUE if setup was successful, FALSE otherwise.

◆ showSaveFileDialog()

BOOL DialogFactory::showSaveFileDialog ( Component * parent,
wstring & selection )
static

Shows a Save File dialog to specify a file to save.

Parameters
hWndParentHandle to the parent window.
selectionOutput parameter receiving the selected file path.
Returns
TRUE if a file path was selected, FALSE otherwise.

◆ showSuccess()

void DialogFactory::showSuccess ( Component * parent,
const wstring & successMessage,
const wstring & title = L"" )
static

Shows a success message dialog.

Parameters
hParentHandle to the parent window.
successMessageThe success message to display.
titleOptional dialog title. Defaults to an empty string.

◆ showWarning()

void DialogFactory::showWarning ( Component * parent,
const wstring & warningMessage,
const wstring & title = L"" )
static

Shows a warning message dialog.

Parameters
hParentHandle to the parent window.
warningMessageThe warning message to display.
titleOptional dialog title. Defaults to an empty string.

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