]>
Commit | Line | Data |
---|---|---|
2bda0e17 KB |
1 | ///////////////////////////////////////////////////////////////////////////// |
2 | // Name: 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 and Markus Holzem | |
16f6dfd8 | 9 | // Licence: wxWindows license |
2bda0e17 KB |
10 | ///////////////////////////////////////////////////////////////////////////// |
11 | ||
bbcdf8bc JS |
12 | #ifndef _WX_DIALOG_H_ |
13 | #define _WX_DIALOG_H_ | |
2bda0e17 KB |
14 | |
15 | #ifdef __GNUG__ | |
462e2437 | 16 | #pragma interface "dialog.h" |
2bda0e17 KB |
17 | #endif |
18 | ||
19 | #include "wx/panel.h" | |
20 | ||
32c1cda2 | 21 | WXDLLEXPORT_DATA(extern const wxChar*) wxDialogNameStr; |
2bda0e17 KB |
22 | |
23 | // Dialog boxes | |
462e2437 | 24 | class WXDLLEXPORT wxDialog : public wxPanel |
2bda0e17 | 25 | { |
462e2437 | 26 | DECLARE_DYNAMIC_CLASS(wxDialog) |
2bda0e17 | 27 | |
462e2437 VZ |
28 | public: |
29 | wxDialog(); | |
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 | { | |
38 | long modalStyle = modal ? wxDIALOG_MODAL : wxDIALOG_MODELESS ; | |
39 | Create(parent, -1, title, wxPoint(x, y), wxSize(width, height), | |
40 | style | modalStyle, name); | |
41 | } | |
16f6dfd8 | 42 | |
462e2437 VZ |
43 | // Constructor with no modal flag - the new convention. |
44 | wxDialog(wxWindow *parent, wxWindowID id, | |
45 | const wxString& title, | |
46 | const wxPoint& pos = wxDefaultPosition, | |
47 | const wxSize& size = wxDefaultSize, | |
48 | long style = wxDEFAULT_DIALOG_STYLE, | |
49 | const wxString& name = wxDialogNameStr) | |
50 | { | |
51 | Create(parent, id, title, pos, size, style, name); | |
52 | } | |
16f6dfd8 | 53 | |
462e2437 VZ |
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); | |
16f6dfd8 | 60 | |
462e2437 | 61 | ~wxDialog(); |
16f6dfd8 | 62 | |
cc2b7472 VZ |
63 | void SetReturnCode(int returnCode) { m_returnCode = returnCode; } |
64 | int GetReturnCode() const { return m_returnCode; } | |
65 | ||
462e2437 | 66 | virtual bool Destroy(); |
16f6dfd8 | 67 | |
721b32e0 | 68 | virtual void DoSetClientSize(int width, int height); |
16f6dfd8 | 69 | |
462e2437 | 70 | virtual void GetPosition(int *x, int *y) const; |
16f6dfd8 | 71 | |
462e2437 VZ |
72 | bool Show(bool show); |
73 | bool IsShown() const; | |
74 | void Iconize(bool iconize); | |
16f6dfd8 | 75 | |
2bda0e17 | 76 | #if WXWIN_COMPATIBILITY |
462e2437 | 77 | bool Iconized() const { return IsIconized(); }; |
2bda0e17 | 78 | #endif |
16f6dfd8 | 79 | |
462e2437 VZ |
80 | virtual bool IsIconized() const; |
81 | void Fit(); | |
16f6dfd8 | 82 | |
462e2437 VZ |
83 | void SetTitle(const wxString& title); |
84 | wxString GetTitle() const ; | |
16f6dfd8 | 85 | |
462e2437 VZ |
86 | void OnSize(wxSizeEvent& event); |
87 | bool OnClose(); | |
88 | void OnCharHook(wxKeyEvent& event); | |
89 | void OnPaint(wxPaintEvent& event); | |
90 | void OnCloseWindow(wxCloseEvent& event); | |
16f6dfd8 | 91 | |
462e2437 | 92 | void SetModal(bool flag); |
16f6dfd8 | 93 | |
462e2437 VZ |
94 | virtual void Centre(int direction = wxBOTH); |
95 | virtual bool IsModal() const | |
96 | { return ((GetWindowStyleFlag() & wxDIALOG_MODAL) == wxDIALOG_MODAL); } | |
16f6dfd8 | 97 | |
462e2437 VZ |
98 | // For now, same as Show(TRUE) but returns return code |
99 | virtual int ShowModal(); | |
100 | virtual void EndModal(int retCode); | |
16f6dfd8 | 101 | |
462e2437 VZ |
102 | // Standard buttons |
103 | void OnOK(wxCommandEvent& event); | |
104 | void OnApply(wxCommandEvent& event); | |
105 | void OnCancel(wxCommandEvent& event); | |
16f6dfd8 | 106 | |
462e2437 VZ |
107 | // Responds to colour changes |
108 | void OnSysColourChanged(wxSysColourChangedEvent& event); | |
16f6dfd8 | 109 | |
a23fd0e1 VZ |
110 | // implementation |
111 | // -------------- | |
112 | ||
42e69d6b VZ |
113 | long MSWWindowProc(WXUINT message, WXWPARAM wParam, WXLPARAM lParam); |
114 | ||
462e2437 VZ |
115 | virtual WXHBRUSH OnCtlColor(WXHDC pDC, WXHWND pWnd, WXUINT nCtlColor, |
116 | WXUINT message, WXWPARAM wParam, WXLPARAM lParam); | |
16f6dfd8 | 117 | |
462e2437 | 118 | bool IsModalShowing() const { return m_modalShowing; } |
2bda0e17 | 119 | |
16f6dfd8 VZ |
120 | // tooltip management |
121 | #if wxUSE_TOOLTIPS | |
122 | WXHWND GetToolTipCtrl() const { return m_hwndToolTip; } | |
123 | void SetToolTipCtrl(WXHWND hwndTT) { m_hwndToolTip = hwndTT; } | |
124 | #endif // tooltips | |
125 | ||
dc1c4b62 | 126 | protected: |
462e2437 VZ |
127 | bool m_modalShowing; |
128 | WXHWND m_hwndOldFocus; // the window which had focus before we were shown | |
16f6dfd8 | 129 | |
a23fd0e1 | 130 | private: |
16f6dfd8 VZ |
131 | #if wxUSE_TOOLTIPS |
132 | WXHWND m_hwndToolTip; | |
133 | #endif // tooltips | |
134 | ||
cc2b7472 VZ |
135 | int m_returnCode; |
136 | ||
462e2437 | 137 | DECLARE_EVENT_TABLE() |
2bda0e17 KB |
138 | }; |
139 | ||
140 | #endif | |
bbcdf8bc | 141 | // _WX_DIALOG_H_ |