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