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