]> git.saurik.com Git - wxWidgets.git/blame - include/wx/msw/dialog.h
Source cleaning: whitespaces, tabs, TRUE/true, FALSE/false, -1/wxID_ANY/wxDefaultCoor...
[wxWidgets.git] / include / wx / msw / dialog.h
CommitLineData
2bda0e17 1/////////////////////////////////////////////////////////////////////////////
82c9f85c 2// Name: wx/msw/dialog.h
2bda0e17
KB
3// Purpose: wxDialog class
4// Author: Julian Smart
5// Modified by:
6// Created: 01/02/97
7// RCS-ID: $Id$
371a5b4e 8// Copyright: (c) Julian Smart
65571936 9// Licence: wxWindows licence
2bda0e17
KB
10/////////////////////////////////////////////////////////////////////////////
11
bbcdf8bc
JS
12#ifndef _WX_DIALOG_H_
13#define _WX_DIALOG_H_
2bda0e17 14
12028905 15#if defined(__GNUG__) && !defined(NO_GCC_PRAGMA)
462e2437 16 #pragma interface "dialog.h"
2bda0e17
KB
17#endif
18
19#include "wx/panel.h"
20
32c1cda2 21WXDLLEXPORT_DATA(extern const wxChar*) wxDialogNameStr;
2bda0e17 22
6757b5e3 23class WXDLLEXPORT wxDialogModalData;
2b5f62a0 24
2bda0e17 25// Dialog boxes
c50f1fb9 26class WXDLLEXPORT wxDialog : public wxDialogBase
2bda0e17 27{
462e2437 28public:
b0a6bb75 29 wxDialog() { Init(); }
16f6dfd8 30
f46f4c86 31 // full ctor
462e2437
VZ
32 wxDialog(wxWindow *parent, wxWindowID id,
33 const wxString& title,
34 const wxPoint& pos = wxDefaultPosition,
35 const wxSize& size = wxDefaultSize,
36 long style = wxDEFAULT_DIALOG_STYLE,
37 const wxString& name = wxDialogNameStr)
38 {
00233716
VZ
39 Init();
40
41 (void)Create(parent, id, title, pos, size, style, name);
462e2437 42 }
16f6dfd8 43
462e2437
VZ
44 bool Create(wxWindow *parent, wxWindowID id,
45 const wxString& title,
46 const wxPoint& pos = wxDefaultPosition,
47 const wxSize& size = wxDefaultSize,
48 long style = wxDEFAULT_DIALOG_STYLE,
49 const wxString& name = wxDialogNameStr);
16f6dfd8 50
82c9f85c 51 virtual ~wxDialog();
16f6dfd8 52
f46f4c86
VZ
53 // return true if we're showing the dialog modally
54 virtual bool IsModal() const { return m_modalData != NULL; }
16f6dfd8 55
f46f4c86 56 // show the dialog modally and return the value passed to EndModal()
b6c588e1
VZ
57 virtual int ShowModal();
58
59 // may be called to terminate the dialog with the given return code
60 virtual void EndModal(int retCode);
61
b6c588e1
VZ
62 // implementation only from now on
63 // -------------------------------
16f6dfd8 64
82c9f85c 65 // override some base class virtuals
d71cc120 66 virtual bool Show(bool show = true);
82c9f85c 67
313901f3
JS
68 virtual void Raise();
69
b6c588e1 70 // event handlers
462e2437 71 void OnCharHook(wxKeyEvent& event);
462e2437 72 void OnCloseWindow(wxCloseEvent& event);
16f6dfd8 73
462e2437
VZ
74 // Standard buttons
75 void OnOK(wxCommandEvent& event);
76 void OnApply(wxCommandEvent& event);
77 void OnCancel(wxCommandEvent& event);
16f6dfd8 78
462e2437
VZ
79 // Responds to colour changes
80 void OnSysColourChanged(wxSysColourChangedEvent& event);
16f6dfd8 81
b6c588e1 82 // Windows callbacks
c140b7e7 83 WXLRESULT MSWWindowProc(WXUINT message, WXWPARAM wParam, WXLPARAM lParam);
42e69d6b 84
b6c588e1 85#if wxUSE_CTL3D
462e2437
VZ
86 virtual WXHBRUSH OnCtlColor(WXHDC pDC, WXHWND pWnd, WXUINT nCtlColor,
87 WXUINT message, WXWPARAM wParam, WXLPARAM lParam);
b6c588e1 88#endif // wxUSE_CTL3D
16f6dfd8 89
f46f4c86
VZ
90 // obsolete methods
91 // ----------------
92
93 // use the other ctor
94 wxDEPRECATED( wxDialog(wxWindow *parent,
95 const wxString& title, bool modal,
d71cc120 96 int x = wxDefaultCoord, int y = wxDefaultCoord, int width = 500, int height = 500,
f46f4c86
VZ
97 long style = wxDEFAULT_DIALOG_STYLE,
98 const wxString& name = wxDialogNameStr) );
99
100 // just call Show() or ShowModal()
101 wxDEPRECATED( void SetModal(bool flag) );
102
103 // use IsModal()
104 wxDEPRECATED( bool IsModalShowing() const );
105
dc1c4b62 106protected:
a543e3ce
VZ
107 // find the window to use as parent for this dialog if none has been
108 // specified explicitly by the user
109 //
110 // may return NULL
111 wxWindow *FindSuitableParent() const;
112
b0a6bb75
VZ
113 // common part of all ctors
114 void Init();
115
12b58624
VZ
116 // end either modal or modeless dialog
117 void EndDialog(int rc);
118
dfe1eee3 119private:
1a33ac8f
JS
120 wxWindow* m_oldFocus;
121 bool m_endModalCalled; // allow for closing within InitDialog
52a07708 122
6757b5e3
VZ
123 // this pointer is non-NULL only while the modal event loop is running
124 wxDialogModalData *m_modalData;
125
b0a6bb75
VZ
126
127 DECLARE_DYNAMIC_CLASS(wxDialog)
462e2437 128 DECLARE_EVENT_TABLE()
22f3361e 129 DECLARE_NO_COPY_CLASS(wxDialog)
2bda0e17
KB
130};
131
132#endif
bbcdf8bc 133 // _WX_DIALOG_H_