]> git.saurik.com Git - wxWidgets.git/blame - include/wx/msw/dialog.h
implment wxBitmapButton::DoGetBestSize
[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
JS
8// Copyright: (c) Julian Smart
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
462e2437
VZ
31 // Constructor with a modal flag, but no window id - the old convention
32 wxDialog(wxWindow *parent,
33 const wxString& title, bool modal,
34 int x = -1, int y= -1, int width = 500, int height = 500,
35 long style = wxDEFAULT_DIALOG_STYLE,
36 const wxString& name = wxDialogNameStr)
37 {
00233716
VZ
38 Init();
39
462e2437
VZ
40 long modalStyle = modal ? wxDIALOG_MODAL : wxDIALOG_MODELESS ;
41 Create(parent, -1, title, wxPoint(x, y), wxSize(width, height),
42 style | modalStyle, name);
43 }
16f6dfd8 44
462e2437
VZ
45 // Constructor with no modal flag - the new convention.
46 wxDialog(wxWindow *parent, wxWindowID id,
47 const wxString& title,
48 const wxPoint& pos = wxDefaultPosition,
49 const wxSize& size = wxDefaultSize,
50 long style = wxDEFAULT_DIALOG_STYLE,
51 const wxString& name = wxDialogNameStr)
52 {
00233716
VZ
53 Init();
54
55 (void)Create(parent, id, title, pos, size, style, name);
462e2437 56 }
16f6dfd8 57
462e2437
VZ
58 bool Create(wxWindow *parent, wxWindowID id,
59 const wxString& title,
60 const wxPoint& pos = wxDefaultPosition,
61 const wxSize& size = wxDefaultSize,
62 long style = wxDEFAULT_DIALOG_STYLE,
63 const wxString& name = wxDialogNameStr);
16f6dfd8 64
82c9f85c 65 virtual ~wxDialog();
16f6dfd8 66
b6c588e1
VZ
67 void SetModal(bool flag);
68 virtual bool IsModal() const;
16f6dfd8 69
b6c588e1
VZ
70 // For now, same as Show(TRUE) but returns return code
71 virtual int ShowModal();
72
73 // may be called to terminate the dialog with the given return code
74 virtual void EndModal(int retCode);
75
76 // returns TRUE if we're in a modal loop
77 bool IsModalShowing() const;
16f6dfd8 78
b6c588e1
VZ
79 // implementation only from now on
80 // -------------------------------
16f6dfd8 81
82c9f85c 82 // override some base class virtuals
356c7bfa 83 virtual bool Show(bool show = TRUE);
82c9f85c 84
313901f3
JS
85 virtual void Raise();
86
b6c588e1 87 // event handlers
462e2437 88 void OnCharHook(wxKeyEvent& event);
462e2437 89 void OnCloseWindow(wxCloseEvent& event);
16f6dfd8 90
462e2437
VZ
91 // Standard buttons
92 void OnOK(wxCommandEvent& event);
93 void OnApply(wxCommandEvent& event);
94 void OnCancel(wxCommandEvent& event);
16f6dfd8 95
462e2437
VZ
96 // Responds to colour changes
97 void OnSysColourChanged(wxSysColourChangedEvent& event);
16f6dfd8 98
b6c588e1 99 // Windows callbacks
c140b7e7 100 WXLRESULT MSWWindowProc(WXUINT message, WXWPARAM wParam, WXLPARAM lParam);
42e69d6b 101
b6c588e1 102#if wxUSE_CTL3D
462e2437
VZ
103 virtual WXHBRUSH OnCtlColor(WXHDC pDC, WXHWND pWnd, WXUINT nCtlColor,
104 WXUINT message, WXWPARAM wParam, WXLPARAM lParam);
b6c588e1 105#endif // wxUSE_CTL3D
16f6dfd8 106
dc1c4b62 107protected:
a543e3ce
VZ
108 // find the window to use as parent for this dialog if none has been
109 // specified explicitly by the user
110 //
111 // may return NULL
112 wxWindow *FindSuitableParent() const;
113
b6c588e1
VZ
114 // show modal dialog and enter modal loop
115 void DoShowModal();
16f6dfd8 116
b0a6bb75
VZ
117 // common part of all ctors
118 void Init();
119
dfe1eee3 120private:
1a33ac8f
JS
121 wxWindow* m_oldFocus;
122 bool m_endModalCalled; // allow for closing within InitDialog
52a07708 123
6757b5e3
VZ
124 // this pointer is non-NULL only while the modal event loop is running
125 wxDialogModalData *m_modalData;
126
b0a6bb75
VZ
127
128 DECLARE_DYNAMIC_CLASS(wxDialog)
462e2437 129 DECLARE_EVENT_TABLE()
22f3361e 130 DECLARE_NO_COPY_CLASS(wxDialog)
2bda0e17
KB
131};
132
133#endif
bbcdf8bc 134 // _WX_DIALOG_H_