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