]> git.saurik.com Git - wxWidgets.git/blame - include/wx/msw/dialog.h
Applied patch [ 1286701 ] fix for compiling odbc with MS VC8 on x64
[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
ef359b43 21extern WXDLLEXPORT_DATA(const wxChar*) wxDialogNameStr;
2bda0e17 22
6757b5e3 23class WXDLLEXPORT wxDialogModalData;
2b5f62a0 24
ec5f0c24
JS
25#if wxUSE_TOOLBAR && (defined(__SMARTPHONE__) || defined(__POCKETPC__))
26class WXDLLEXPORT wxToolBar;
a141e018 27extern WXDLLEXPORT_DATA(const wxChar*) wxToolBarNameStr;
ec5f0c24
JS
28#endif
29
2bda0e17 30// Dialog boxes
c50f1fb9 31class WXDLLEXPORT wxDialog : public wxDialogBase
2bda0e17 32{
462e2437 33public:
b0a6bb75 34 wxDialog() { Init(); }
16f6dfd8 35
f46f4c86 36 // full ctor
462e2437
VZ
37 wxDialog(wxWindow *parent, wxWindowID id,
38 const wxString& title,
39 const wxPoint& pos = wxDefaultPosition,
40 const wxSize& size = wxDefaultSize,
41 long style = wxDEFAULT_DIALOG_STYLE,
42 const wxString& name = wxDialogNameStr)
43 {
00233716
VZ
44 Init();
45
46 (void)Create(parent, id, title, pos, size, style, name);
462e2437 47 }
16f6dfd8 48
462e2437
VZ
49 bool Create(wxWindow *parent, wxWindowID id,
50 const wxString& title,
51 const wxPoint& pos = wxDefaultPosition,
52 const wxSize& size = wxDefaultSize,
53 long style = wxDEFAULT_DIALOG_STYLE,
54 const wxString& name = wxDialogNameStr);
16f6dfd8 55
82c9f85c 56 virtual ~wxDialog();
16f6dfd8 57
f46f4c86
VZ
58 // return true if we're showing the dialog modally
59 virtual bool IsModal() const { return m_modalData != NULL; }
16f6dfd8 60
f46f4c86 61 // show the dialog modally and return the value passed to EndModal()
b6c588e1
VZ
62 virtual int ShowModal();
63
64 // may be called to terminate the dialog with the given return code
65 virtual void EndModal(int retCode);
66
a141e018
VZ
67
68 // we treat dialog toolbars specially under Windows CE
ec5f0c24
JS
69#if wxUSE_TOOLBAR && defined(__POCKETPC__)
70 // create main toolbar by calling OnCreateToolBar()
71 virtual wxToolBar* CreateToolBar(long style = -1,
72 wxWindowID winid = wxID_ANY,
73 const wxString& name = wxToolBarNameStr);
74 // return a new toolbar
75 virtual wxToolBar *OnCreateToolBar(long style,
76 wxWindowID winid,
77 const wxString& name );
78
79 // get the main toolbar
80 wxToolBar *GetToolBar() const { return m_dialogToolBar; }
a141e018
VZ
81#endif // wxUSE_TOOLBAR && __POCKETPC__
82
ec5f0c24 83
b6c588e1
VZ
84 // implementation only from now on
85 // -------------------------------
16f6dfd8 86
82c9f85c 87 // override some base class virtuals
d71cc120 88 virtual bool Show(bool show = true);
82c9f85c 89
313901f3
JS
90 virtual void Raise();
91
b6c588e1 92 // event handlers
462e2437 93 void OnCharHook(wxKeyEvent& event);
462e2437 94 void OnCloseWindow(wxCloseEvent& event);
16f6dfd8 95
462e2437
VZ
96 // Standard buttons
97 void OnOK(wxCommandEvent& event);
98 void OnApply(wxCommandEvent& event);
99 void OnCancel(wxCommandEvent& event);
16f6dfd8 100
462e2437
VZ
101 // Responds to colour changes
102 void OnSysColourChanged(wxSysColourChangedEvent& event);
16f6dfd8 103
9ceeecb9
JS
104#ifdef __POCKETPC__
105 // Responds to the OK button in a PocketPC titlebar. This
106 // can be overridden, or you can change the id used for
107 // sending the event with SetAffirmativeId. Returns false
108 // if the event was not processed.
109 virtual bool DoOK();
110#endif
111
b6c588e1 112 // Windows callbacks
c140b7e7 113 WXLRESULT MSWWindowProc(WXUINT message, WXWPARAM wParam, WXLPARAM lParam);
42e69d6b 114
f46f4c86
VZ
115 // obsolete methods
116 // ----------------
117
118 // use the other ctor
119 wxDEPRECATED( wxDialog(wxWindow *parent,
120 const wxString& title, bool modal,
d71cc120 121 int x = wxDefaultCoord, int y = wxDefaultCoord, int width = 500, int height = 500,
f46f4c86
VZ
122 long style = wxDEFAULT_DIALOG_STYLE,
123 const wxString& name = wxDialogNameStr) );
124
125 // just call Show() or ShowModal()
126 wxDEPRECATED( void SetModal(bool flag) );
127
128 // use IsModal()
129 wxDEPRECATED( bool IsModalShowing() const );
130
dc1c4b62 131protected:
a543e3ce
VZ
132 // find the window to use as parent for this dialog if none has been
133 // specified explicitly by the user
134 //
135 // may return NULL
136 wxWindow *FindSuitableParent() const;
137
b0a6bb75
VZ
138 // common part of all ctors
139 void Init();
140
12b58624
VZ
141 // end either modal or modeless dialog
142 void EndDialog(int rc);
143
f55fee08
VZ
144 // emulate click of a button with the given id if it's present in the dialog
145 //
146 // return true if button was "clicked" or false if we don't have it
147 bool EmulateButtonClickIfPresent(int id);
148
149 // handle Escape here
150 virtual bool MSWProcessMessage(WXMSG* pMsg);
151
dfe1eee3 152private:
1a33ac8f
JS
153 wxWindow* m_oldFocus;
154 bool m_endModalCalled; // allow for closing within InitDialog
52a07708 155
ec5f0c24
JS
156#if wxUSE_TOOLBAR && defined(__POCKETPC__)
157 wxToolBar* m_dialogToolBar;
158#endif
159
6757b5e3
VZ
160 // this pointer is non-NULL only while the modal event loop is running
161 wxDialogModalData *m_modalData;
162
b0a6bb75 163 DECLARE_DYNAMIC_CLASS(wxDialog)
462e2437 164 DECLARE_EVENT_TABLE()
22f3361e 165 DECLARE_NO_COPY_CLASS(wxDialog)
2bda0e17
KB
166};
167
168#endif
bbcdf8bc 169 // _WX_DIALOG_H_