|
W32DLib
|
The base Dialog class. More...
#include <w32dlib/dialog.h>
Public Member Functions | |
| Dialog () | |
| Constructor. | |
| virtual | ~Dialog () |
| Destructor. | |
| virtual int | ResourceID ()=0 |
| Returns the Resource ID for the dialog. | |
| virtual void | CreateControls ()=0 |
| Create the controls attached to the dialog. | |
| virtual void | OnInit () |
| Called when the dialog is displaying. | |
| virtual void | OnClose () |
| Called when the dialog is closing. | |
| void | Enable (bool enable) |
| Enables or disables all Controls in the dialog. | |
| INT_PTR | ShowModal (HINSTANCE instance, HWND parent) |
| Displays a modal dialog. | |
| void | Close (INT_PTR result) |
| Closes the dialog. | |
| void | AddControl (Control *control) |
| Adds a control to the dialog. | |
| void | SetMenuProc (Window *owner, W32DLibCallback callback) |
| Sets a callback for handling menu commands. | |
| void | SetData () |
| Request data exchange with all controls. | |
| void | GetData () |
| Request data exchange with all controls. | |
Public Member Functions inherited from W32DLib::Window | |
| Window () | |
| Constructor. | |
| virtual | ~Window () |
| Destructor. | |
| bool | HasMutex () |
| Whether the Window() constructor could create a mutex. | |
| HWND | GetHWND () |
| Returns the HWND for the window. | |
| HMENU | GetHMENU () |
| Returns the HMENU associated with this window. | |
| bool | SetHMENU (HMENU menu) |
| Sets the HMENU associated with this window. | |
| bool | Move (int x, int y, int width, int height, bool repaint=true) |
| Sets a Window's position and size. | |
| bool | MoveBase (Window *w, int x, int y, int width, int height, bool repaint=true) |
| Sets a Window's position and size using Dialog base units. | |
| LRESULT | SendMsg (UINT msg, WPARAM wp, LPARAM lp) |
| Send a message to the window. | |
| void | SetText (const TCHAR *text) |
| Sets the window text. | |
| void | SetText (const W32String &text) |
| Sets the window text. | |
| W32String | GetText () |
| Gets the window text. | |
| void | Enable (bool enable) |
| Enables or disables the window. | |
Protected Member Functions | |
| virtual BOOL | InstanceProc (HWND wnd, UINT msg, WPARAM wp, LPARAM lp) |
| Handles windows messages. | |
Additional Inherited Members | |
Static Protected Member Functions inherited from W32DLib::Window | |
| static BOOL CALLBACK | WindowProc (HWND wnd, UINT msg, WPARAM wp, LPARAM lp) |
| The base WindProc. | |
Protected Attributes inherited from W32DLib::Window | |
| HWND | m_wnd |
| The window handle for this window. | |
The base Dialog class.
| W32DLib::Dialog::Dialog | ( | ) |
Constructor.
Do not add controls in a derived Dialog. Use CreateControls instead.
|
virtual |
Destructor.
| void W32DLib::Dialog::AddControl | ( | Control * | control | ) |
Adds a control to the dialog.
Note that the pointer to the control is stored, so the control must exist as long as the dialog is in use.
| control | The control the add. |
| void W32DLib::Dialog::Close | ( | INT_PTR | result | ) |
Closes the dialog.
Closes the dialog. Silently ignored if the dialog is not open.
| result | The result to return. |
|
pure virtual |
Create the controls attached to the dialog.
All derived classes must implement this. This should create the controls for the dialog.
| void W32DLib::Dialog::Enable | ( | bool | enable | ) |
Enables or disables all Controls in the dialog.
Overrides Window::Enable.
| void W32DLib::Dialog::GetData | ( | ) |
|
protectedvirtual |
Handles windows messages.
| wnd | The window handle |
| msg | The message |
| wp | Additional parameters. Depends on the value of msg. |
| lp | Additional parameters. Depends on the value of msg. |
Reimplemented from W32DLib::Window.
|
virtual |
Called when the dialog is closing.
Override this call to pick up this event.
|
virtual |
Called when the dialog is displaying.
Override this call to initialise dialog controls.
|
pure virtual |
Returns the Resource ID for the dialog.
All derived classes must implement this. This should return the ID of the dialog in the resource file.
| void W32DLib::Dialog::SetData | ( | ) |
| void W32DLib::Dialog::SetMenuProc | ( | Window * | owner, |
| W32DLibCallback | callback | ||
| ) |
Sets a callback for handling menu commands.
This call simply passes on all WM_COMMAND messages that were not for any registered control's resource ID.
Due to this, the callback should take care to ensure it only actions recognised menu commands.
| INT_PTR W32DLib::Dialog::ShowModal | ( | HINSTANCE | instance, |
| HWND | parent | ||
| ) |
Displays a modal dialog.
Call this to display the dialog.
| instance | The HINSTANCE. Call Common::GetInstance() to get an instance (from a DLL, for example) if all else fails. |
| parent | The parent window of the dialog (NULL for none). |