]> git.saurik.com Git - wxWidgets.git/blob - include/wx/msw/dialog.h
Add a test of precisely sized status bar fields.
[wxWidgets.git] / include / wx / msw / dialog.h
1 /////////////////////////////////////////////////////////////////////////////
2 // Name: wx/msw/dialog.h
3 // Purpose: wxDialog class
4 // Author: Julian Smart
5 // Modified by:
6 // Created: 01/02/97
7 // RCS-ID: $Id$
8 // Copyright: (c) Julian Smart
9 // Licence: wxWindows licence
10 /////////////////////////////////////////////////////////////////////////////
11
12 #ifndef _WX_DIALOG_H_
13 #define _WX_DIALOG_H_
14
15 #include "wx/panel.h"
16
17 // this option is always enabled (there doesn't seem to be any good reason to
18 // disable it) for desktop Windows versions but Windows CE dialogs are usually
19 // not resizeable and never show resize gripper anyhow so don't use it there
20 #ifdef __WXWINCE__
21 #define wxUSE_DIALOG_SIZEGRIP 0
22 #else
23 #define wxUSE_DIALOG_SIZEGRIP 1
24 #endif
25
26 extern WXDLLIMPEXP_DATA_CORE(const char) wxDialogNameStr[];
27
28 class WXDLLIMPEXP_FWD_CORE wxDialogModalData;
29
30 #if wxUSE_TOOLBAR && (defined(__SMARTPHONE__) || defined(__POCKETPC__))
31 class WXDLLIMPEXP_FWD_CORE wxToolBar;
32 extern WXDLLIMPEXP_DATA_CORE(const char) wxToolBarNameStr[];
33 #endif
34
35 // Dialog boxes
36 class WXDLLIMPEXP_CORE wxDialog : public wxDialogBase
37 {
38 public:
39 wxDialog() { Init(); }
40
41 // full ctor
42 wxDialog(wxWindow *parent, wxWindowID id,
43 const wxString& title,
44 const wxPoint& pos = wxDefaultPosition,
45 const wxSize& size = wxDefaultSize,
46 long style = wxDEFAULT_DIALOG_STYLE,
47 const wxString& name = wxDialogNameStr)
48 {
49 Init();
50
51 (void)Create(parent, id, title, pos, size, style, name);
52 }
53
54 bool Create(wxWindow *parent, wxWindowID id,
55 const wxString& title,
56 const wxPoint& pos = wxDefaultPosition,
57 const wxSize& size = wxDefaultSize,
58 long style = wxDEFAULT_DIALOG_STYLE,
59 const wxString& name = wxDialogNameStr);
60
61 virtual ~wxDialog();
62
63 // return true if we're showing the dialog modally
64 virtual bool IsModal() const { return m_modalData != NULL; }
65
66 // show the dialog modally and return the value passed to EndModal()
67 virtual int ShowModal();
68
69 // may be called to terminate the dialog with the given return code
70 virtual void EndModal(int retCode);
71
72
73 // we treat dialog toolbars specially under Windows CE
74 #if wxUSE_TOOLBAR && defined(__POCKETPC__)
75 // create main toolbar by calling OnCreateToolBar()
76 virtual wxToolBar* CreateToolBar(long style = -1,
77 wxWindowID winid = wxID_ANY,
78 const wxString& name = wxToolBarNameStr);
79 // return a new toolbar
80 virtual wxToolBar *OnCreateToolBar(long style,
81 wxWindowID winid,
82 const wxString& name );
83
84 // get the main toolbar
85 wxToolBar *GetToolBar() const { return m_dialogToolBar; }
86 #endif // wxUSE_TOOLBAR && __POCKETPC__
87
88
89 // implementation only from now on
90 // -------------------------------
91
92 // override some base class virtuals
93 virtual bool Show(bool show = true);
94
95 virtual void Raise();
96
97 virtual void SetWindowStyleFlag(long style);
98
99 #ifdef __POCKETPC__
100 // Responds to the OK button in a PocketPC titlebar. This
101 // can be overridden, or you can change the id used for
102 // sending the event with SetAffirmativeId. Returns false
103 // if the event was not processed.
104 virtual bool DoOK();
105 #endif
106
107 // Windows callbacks
108 WXLRESULT MSWWindowProc(WXUINT message, WXWPARAM wParam, WXLPARAM lParam);
109
110 protected:
111 // common part of all ctors
112 void Init();
113
114 private:
115 #if wxUSE_DIALOG_SIZEGRIP
116 // these functions deal with the gripper window shown in the corner of
117 // resizeable dialogs
118 void CreateGripper();
119 void DestroyGripper();
120 void ShowGripper(bool show);
121 void ResizeGripper();
122
123 // this function is used to adjust Z-order of new children relative to the
124 // gripper if we have one
125 void OnWindowCreate(wxWindowCreateEvent& event);
126
127 // gripper window for a resizable dialog, NULL if we're not resizable
128 WXHWND m_hGripper;
129 #endif // wxUSE_DIALOG_SIZEGRIP
130
131 #if wxUSE_TOOLBAR && defined(__POCKETPC__)
132 wxToolBar* m_dialogToolBar;
133 #endif
134
135 // this pointer is non-NULL only while the modal event loop is running
136 wxDialogModalData *m_modalData;
137
138 DECLARE_DYNAMIC_CLASS(wxDialog)
139 wxDECLARE_NO_COPY_CLASS(wxDialog);
140 };
141
142 #endif
143 // _WX_DIALOG_H_