]>
Commit | Line | Data |
---|---|---|
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 | |
9 | // Licence: wxWindows license | |
10 | ///////////////////////////////////////////////////////////////////////////// | |
11 | ||
12 | #ifndef _WX_DIALOG_H_ | |
13 | #define _WX_DIALOG_H_ | |
14 | ||
15 | #ifdef __GNUG__ | |
16 | #pragma interface "dialog.h" | |
17 | #endif | |
18 | ||
19 | #include "wx/panel.h" | |
20 | ||
21 | WXDLLEXPORT_DATA(extern const wxChar*) wxDialogNameStr; | |
22 | ||
23 | // Dialog boxes | |
24 | class WXDLLEXPORT wxDialog : public wxDialogBase | |
25 | { | |
26 | DECLARE_DYNAMIC_CLASS(wxDialog) | |
27 | ||
28 | public: | |
29 | wxDialog(); | |
30 | ||
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 | } | |
42 | ||
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 | } | |
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 | ~wxDialog(); | |
62 | ||
63 | virtual bool Destroy(); | |
64 | ||
65 | virtual void DoSetClientSize(int width, int height); | |
66 | ||
67 | virtual void GetPosition(int *x, int *y) const; | |
68 | ||
69 | bool Show(bool show); | |
70 | bool IsShown() const; | |
71 | void Iconize(bool iconize); | |
72 | ||
73 | #if WXWIN_COMPATIBILITY | |
74 | bool Iconized() const { return IsIconized(); }; | |
75 | #endif | |
76 | ||
77 | virtual bool IsIconized() const; | |
78 | void Fit(); | |
79 | ||
80 | virtual bool IsTopLevel() const { return TRUE; } | |
81 | ||
82 | void SetTitle(const wxString& title); | |
83 | wxString GetTitle() const ; | |
84 | ||
85 | void OnSize(wxSizeEvent& event); | |
86 | bool OnClose(); | |
87 | void OnCharHook(wxKeyEvent& event); | |
88 | void OnPaint(wxPaintEvent& event); | |
89 | void OnCloseWindow(wxCloseEvent& event); | |
90 | ||
91 | void SetModal(bool flag); | |
92 | ||
93 | virtual void Centre(int direction = wxBOTH); | |
94 | virtual bool IsModal() const; | |
95 | ||
96 | // For now, same as Show(TRUE) but returns return code | |
97 | virtual int ShowModal(); | |
98 | virtual void EndModal(int retCode); | |
99 | ||
100 | // Standard buttons | |
101 | void OnOK(wxCommandEvent& event); | |
102 | void OnApply(wxCommandEvent& event); | |
103 | void OnCancel(wxCommandEvent& event); | |
104 | ||
105 | // Responds to colour changes | |
106 | void OnSysColourChanged(wxSysColourChangedEvent& event); | |
107 | ||
108 | // implementation | |
109 | // -------------- | |
110 | ||
111 | long MSWWindowProc(WXUINT message, WXWPARAM wParam, WXLPARAM lParam); | |
112 | ||
113 | virtual WXHBRUSH OnCtlColor(WXHDC pDC, WXHWND pWnd, WXUINT nCtlColor, | |
114 | WXUINT message, WXWPARAM wParam, WXLPARAM lParam); | |
115 | ||
116 | bool IsModalShowing() const { return m_modalShowing; } | |
117 | ||
118 | // tooltip management | |
119 | #if wxUSE_TOOLTIPS | |
120 | WXHWND GetToolTipCtrl() const { return m_hwndToolTip; } | |
121 | void SetToolTipCtrl(WXHWND hwndTT) { m_hwndToolTip = hwndTT; } | |
122 | #endif // tooltips | |
123 | ||
124 | protected: | |
125 | bool m_modalShowing; | |
126 | WXHWND m_hwndOldFocus; // the window which had focus before we were shown | |
127 | ||
128 | private: | |
129 | #if wxUSE_TOOLTIPS | |
130 | WXHWND m_hwndToolTip; | |
131 | #endif // tooltips | |
132 | ||
133 | private: | |
134 | DECLARE_EVENT_TABLE() | |
135 | }; | |
136 | ||
137 | #endif | |
138 | // _WX_DIALOG_H_ |