SavvyUI C++ UI Library
Loading...
Searching...
No Matches
Dialog.h
Go to the documentation of this file.
1#pragma once
2
3#include "Common.h"
4#include "GridPanel.h"
5
6#define DIALOG_OK 1
7#define DIALOG_CANCEL 0
8
9// IMPORTANT: The dialog instance must be declared in local scope if the dialog will be displayed again and again. do
10// NOT declare the dialog instance as instance variable of a parent class
11/*
12 MyDialog dlg; // CORRECT
13 dlg.setVisible(thisHwnd);
14
15 class ParentClass {
16 MyDialog dlg; // INCORRECT
17 ...
18 }
19*/
20
28class Dialog: public Component
29{
30 WinHandle _hWndParent;
31 WinHandle _hWndDlg;
32 GridPanel _contentPane;
33 WinHandle _hPanel;
34 wstring _title;
35 long _width, _height;
36
37 long _exitCode;
38
39
40protected:
41
50 BOOL getCreateWindowOptions(wstring& title, UINT& widownStyles, wstring& wndClassName, BOOL& isCustomWndProc);
51
56
57public:
62
66 virtual ~Dialog();
67
73 void setTitle(const wstring& title);
74
80 wstring getTitle();
81
88 void setSize(long width, long height);
89
96 void getSize(long& width, long& height);
97
104 BOOL setVisible(Component *parent);
105
111 void close(long exitCode);
112
118 void setExitCode(long exitCode);
119
126
133
140
147 void setDialogNativeHandle(const wstring& source, WinHandle hDlg);
148
153
154public: // Overridables
155
161 virtual BOOL windowOpening();
162
168 virtual BOOL windowOpened();
169
175 virtual BOOL okToClose();
176
180 virtual void windowClosed();
181};
182
HWND WinHandle
Definition Common.h:16
Component()
Constructs a new Component instance.
BOOL getCreateWindowOptions(wstring &title, UINT &widownStyles, wstring &wndClassName, BOOL &isCustomWndProc)
Retrieves window creation options such as title, styles, and class name.
BOOL setVisible(Component *parent)
Shows the dialog and attaches it to a parent window.
Dialog()
Constructs a new Dialog instance.
virtual BOOL okToClose()
Called to determine if the dialog can close.
void getSize(long &width, long &height)
Retrieves the current size of the dialog window.
GridPanel * getContentPane()
Gets a pointer to the content pane GridPanel.
long getExitCode()
Gets the current exit code of the dialog.
void setTitle(const wstring &title)
Sets the dialog's window title.
wstring getTitle()
Gets the current dialog title.
void onWindowMoved()
Called when the dialog window has been moved.
void setSize(long width, long height)
Sets the size of the dialog window.
virtual void windowClosed()
Called after the dialog has closed.
void setDialogNativeHandle(const wstring &source, WinHandle hDlg)
Sets the native handle of the dialog window.
virtual BOOL windowOpened()
Called after the dialog window has opened.
void setExitCode(long exitCode)
Sets the dialog's exit code without closing.
WinHandle getContentPaneNativeHandle()
Gets the native window handle of the content pane.
virtual BOOL windowOpening()
Called before the dialog window opens.
void windowCreated()
Called after the native window has been created.
void close(long exitCode)
Closes the dialog with a specific exit code.
virtual ~Dialog()
Destructor.
A panel that arranges child components in a grid layout.
Definition GridPanel.h:39