]>
Commit | Line | Data |
---|---|---|
0e320a79 DW |
1 | ///////////////////////////////////////////////////////////////////////////// |
2 | // Name: dialog.h | |
3 | // Purpose: wxDialog class | |
54da4255 | 4 | // Author: AUTHOR |
0e320a79 | 5 | // Modified by: |
54da4255 | 6 | // Created: ??/??/98 |
0e320a79 | 7 | // RCS-ID: $Id$ |
54da4255 DW |
8 | // Copyright: (c) AUTHOR |
9 | // Licence: wxWindows licence | |
0e320a79 DW |
10 | ///////////////////////////////////////////////////////////////////////////// |
11 | ||
12 | #ifndef _WX_DIALOG_H_ | |
13 | #define _WX_DIALOG_H_ | |
14 | ||
15 | #ifdef __GNUG__ | |
54da4255 | 16 | #pragma interface "dialog.h" |
0e320a79 DW |
17 | #endif |
18 | ||
19 | #include "wx/panel.h" | |
20 | ||
54da4255 | 21 | WXDLLEXPORT_DATA(extern const char*) wxDialogNameStr; |
0e320a79 DW |
22 | |
23 | // Dialog boxes | |
54da4255 | 24 | class WXDLLEXPORT wxDialog: public wxDialogBase |
0e320a79 | 25 | { |
54da4255 | 26 | DECLARE_DYNAMIC_CLASS(wxDialog) |
0e320a79 | 27 | public: |
54da4255 DW |
28 | |
29 | wxDialog(); | |
30 | ||
31 | // Constructor with a modal flag, but no window id - the old convention | |
32 | inline wxDialog( wxWindow* parent | |
33 | ,const wxString& title | |
34 | ,bool modal | |
35 | ,int x = -1 | |
36 | ,int y = -1 | |
37 | ,int width = 500 | |
38 | ,int height = 500 | |
39 | ,long style = wxDEFAULT_DIALOG_STYLE | |
40 | ,const wxString& name = wxDialogNameStr | |
41 | ) | |
0e320a79 DW |
42 | { |
43 | long modalStyle = modal ? wxDIALOG_MODAL : wxDIALOG_MODELESS ; | |
54da4255 | 44 | Create(parent, -1, title, wxPoint(x, y), wxSize(width, height), style|modalStyle, name); |
0e320a79 DW |
45 | } |
46 | ||
47 | // Constructor with no modal flag - the new convention. | |
54da4255 DW |
48 | inline wxDialog( wxWindow* parent |
49 | ,wxWindowID id | |
50 | ,const wxString& title | |
51 | ,const wxPoint& pos = wxDefaultPosition | |
52 | ,const wxSize& size = wxDefaultSize | |
53 | ,long style = wxDEFAULT_DIALOG_STYLE | |
54 | ,const wxString& name = wxDialogNameStr | |
55 | ) | |
0e320a79 DW |
56 | { |
57 | Create(parent, id, title, pos, size, style, name); | |
58 | } | |
59 | ||
54da4255 DW |
60 | bool Create( wxWindow* parent |
61 | ,wxWindowID id | |
62 | ,const wxString& title | |
63 | , // bool modal = FALSE, // TODO make this a window style? | |
64 | const wxPoint& pos = wxDefaultPosition | |
65 | ,const wxSize& size = wxDefaultSize | |
66 | ,long style = wxDEFAULT_DIALOG_STYLE | |
67 | ,const wxString& name = wxDialogNameStr | |
68 | ); | |
0e320a79 DW |
69 | |
70 | ~wxDialog(); | |
71 | ||
54da4255 DW |
72 | // --------------------------------------------------------------------------- |
73 | // Virtuals | |
74 | // --------------------------------------------------------------------------- | |
0e320a79 | 75 | |
54da4255 | 76 | virtual bool Destroy(); |
27476f73 DW |
77 | virtual void DoSetClientSize(int width, int height); |
78 | virtual void GetPosition(int *x, int *y) const; | |
0e320a79 | 79 | |
27476f73 DW |
80 | bool Show(bool show); |
81 | bool IsShown() const; | |
82 | void Iconize(bool iconize); | |
1408104d | 83 | |
27476f73 DW |
84 | virtual bool IsIconized() const; |
85 | void Fit(); | |
0e320a79 | 86 | |
54da4255 DW |
87 | void SetTitle(const wxString& title); |
88 | wxString GetTitle() const ; | |
0e320a79 | 89 | |
27476f73 DW |
90 | void OnSize(wxSizeEvent& event); |
91 | bool OnClose(); | |
92 | void OnCharHook(wxKeyEvent& event); | |
93 | void OnPaint(wxPaintEvent& event); | |
94 | void OnCloseWindow(wxCloseEvent& event); | |
0e320a79 | 95 | |
27476f73 DW |
96 | void SetModal(bool flag); |
97 | ||
98 | virtual void Centre(int direction = wxBOTH); | |
99 | virtual bool IsModal() const; | |
100 | ||
101 | // For now, same as Show(TRUE) but returns return code | |
102 | virtual int ShowModal(); | |
103 | virtual void EndModal(int retCode); | |
0e320a79 | 104 | |
54da4255 DW |
105 | // Standard buttons |
106 | void OnOK(wxCommandEvent& event); | |
107 | void OnApply(wxCommandEvent& event); | |
108 | void OnCancel(wxCommandEvent& event); | |
0e320a79 | 109 | |
54da4255 DW |
110 | // Responds to colour changes |
111 | void OnSysColourChanged(wxSysColourChangedEvent& event); | |
0e320a79 | 112 | |
27476f73 DW |
113 | // implementation |
114 | // -------------- | |
115 | virtual MRESULT OS2WindowProc(HWND hwnd, WXUINT message, WXWPARAM wParam, WXLPARAM lParam); | |
116 | ||
117 | virtual WXHBRUSH OnCtlColor(WXHDC pDC, WXHWND pWnd, WXUINT nCtlColor, | |
118 | WXUINT message, WXWPARAM wParam, WXLPARAM lParam); | |
119 | ||
120 | bool IsModalShowing() const { return m_modalShowing; } | |
121 | ||
122 | // tooltip management | |
123 | #if wxUSE_TOOLTIPS | |
124 | WXHWND GetToolTipCtrl() const { return m_hwndToolTip; } | |
125 | void SetToolTipCtrl(WXHWND hwndTT) { m_hwndToolTip = hwndTT; } | |
126 | #endif // tooltips | |
127 | ||
128 | protected: | |
129 | bool m_modalShowing; | |
130 | WXHWND m_hwndOldFocus; // the window which had focus before we were shown | |
131 | ||
132 | private: | |
133 | #if wxUSE_TOOLTIPS | |
134 | WXHWND m_hwndToolTip; | |
135 | #endif // tooltips | |
136 | ||
137 | private: | |
138 | ||
54da4255 | 139 | DECLARE_EVENT_TABLE() |
0e320a79 DW |
140 | }; |
141 | ||
142 | #endif | |
143 | // _WX_DIALOG_H_ |