]>
Commit | Line | Data |
---|---|---|
9b6dbb09 JS |
1 | ///////////////////////////////////////////////////////////////////////////// |
2 | // Name: dialog.h | |
3 | // Purpose: wxDialog class | |
4 | // Author: Julian Smart | |
5 | // Modified by: | |
6 | // Created: 17/09/98 | |
7 | // RCS-ID: $Id$ | |
8 | // Copyright: (c) Julian Smart | |
9 | // Licence: wxWindows licence | |
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 char*) wxDialogNameStr; | |
22 | ||
23 | // Dialog boxes | |
24 | class WXDLLEXPORT wxDialog: public wxPanel | |
25 | { | |
26 | DECLARE_DYNAMIC_CLASS(wxDialog) | |
27 | public: | |
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, 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), style|modalStyle, name); | |
40 | } | |
41 | ||
42 | // Constructor with no modal flag - the new convention. | |
43 | inline wxDialog(wxWindow *parent, wxWindowID id, | |
44 | const wxString& title, | |
45 | const wxPoint& pos = wxDefaultPosition, | |
46 | const wxSize& size = wxDefaultSize, | |
47 | long style = wxDEFAULT_DIALOG_STYLE, | |
48 | const wxString& name = wxDialogNameStr) | |
49 | { | |
50 | Create(parent, id, title, pos, size, style, name); | |
51 | } | |
52 | ||
53 | bool Create(wxWindow *parent, wxWindowID id, | |
54 | const wxString& title, // bool modal = FALSE, // TODO make this a window style? | |
55 | const wxPoint& pos = wxDefaultPosition, | |
56 | const wxSize& size = wxDefaultSize, | |
57 | long style = wxDEFAULT_DIALOG_STYLE, | |
58 | const wxString& name = wxDialogNameStr); | |
59 | ||
60 | ~wxDialog(); | |
61 | ||
62 | virtual bool Destroy(); | |
63 | void SetClientSize(int width, int height); | |
4fabb575 JS |
64 | void SetClientSize(const wxSize& size) { wxWindow::SetClientSize(size); } |
65 | ||
dfc54541 | 66 | void SetSize(int x, int y, int width, int height, int sizeFlags = wxSIZE_AUTO); |
4fabb575 JS |
67 | virtual void SetSize(const wxRect& rect, int sizeFlags = wxSIZE_AUTO) |
68 | { wxWindow::SetSize(rect, sizeFlags); } | |
69 | virtual void SetSize(const wxSize& size) { wxWindow::SetSize(size); } | |
c330a2cf | 70 | virtual void SetSize(int width, int height) { SetSize(-1, -1, width, height, wxSIZE_USE_EXISTING); } |
4fabb575 | 71 | |
9b6dbb09 JS |
72 | bool Show(bool show); |
73 | void Iconize(bool iconize); | |
dfc54541 JS |
74 | void Raise(); |
75 | void Lower(); | |
9b6dbb09 JS |
76 | |
77 | virtual bool IsIconized() const; | |
78 | void Fit(); | |
79 | ||
80 | void SetTitle(const wxString& title); | |
81 | wxString GetTitle() const ; | |
82 | ||
e3065973 | 83 | // bool OnClose(); |
9b6dbb09 JS |
84 | void OnCharHook(wxKeyEvent& event); |
85 | void OnCloseWindow(wxCloseEvent& event); | |
86 | ||
87 | void SetModal(bool flag); | |
88 | ||
89 | virtual void Centre(int direction = wxBOTH); | |
90 | virtual bool IsModal() const { return ((GetWindowStyleFlag() & wxDIALOG_MODAL) == wxDIALOG_MODAL); } | |
91 | ||
92 | virtual int ShowModal(); | |
93 | virtual void EndModal(int retCode); | |
94 | ||
95 | // Standard buttons | |
96 | void OnOK(wxCommandEvent& event); | |
97 | void OnApply(wxCommandEvent& event); | |
98 | void OnCancel(wxCommandEvent& event); | |
99 | ||
100 | // Responds to colour changes | |
101 | void OnSysColourChanged(wxSysColourChangedEvent& event); | |
102 | ||
0d57be45 | 103 | // Implementation |
4b5f3fe6 | 104 | virtual void ChangeFont(bool keepOriginalSize = TRUE); |
0d57be45 JS |
105 | virtual void ChangeBackgroundColour(); |
106 | virtual void ChangeForegroundColour(); | |
dfc54541 JS |
107 | inline WXWidget GetTopWidget() const { return m_mainWidget; } |
108 | inline WXWidget GetClientWidget() const { return m_mainWidget; } | |
109 | ||
110 | ||
111 | public: | |
112 | //// Motif-specific | |
113 | bool m_modalShowing; | |
114 | wxString m_dialogTitle; | |
115 | ||
9b6dbb09 JS |
116 | DECLARE_EVENT_TABLE() |
117 | }; | |
118 | ||
119 | #endif | |
120 | // _WX_DIALOG_H_ |