]>
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 | |
dfe1eee3 | 9 | // Licence: wxWindows licence |
9b6dbb09 JS |
10 | ///////////////////////////////////////////////////////////////////////////// |
11 | ||
12 | #ifndef _WX_DIALOG_H_ | |
13 | #define _WX_DIALOG_H_ | |
14 | ||
15 | #ifdef __GNUG__ | |
83df96d6 | 16 | #pragma interface "dialog.h" |
9b6dbb09 JS |
17 | #endif |
18 | ||
9b6dbb09 JS |
19 | WXDLLEXPORT_DATA(extern const char*) wxDialogNameStr; |
20 | ||
21 | // Dialog boxes | |
dfe1eee3 | 22 | class WXDLLEXPORT wxDialog : public wxDialogBase |
9b6dbb09 | 23 | { |
83df96d6 JS |
24 | DECLARE_DYNAMIC_CLASS(wxDialog) |
25 | ||
9b6dbb09 | 26 | public: |
bfc6fde4 | 27 | wxDialog(); |
83df96d6 | 28 | |
bfc6fde4 VZ |
29 | // Constructor with a modal flag, but no window id - the old convention |
30 | wxDialog(wxWindow *parent, | |
83df96d6 JS |
31 | const wxString& title, bool modal, |
32 | int x = -1, int y= -1, int width = 500, int height = 500, | |
33 | long style = wxDEFAULT_DIALOG_STYLE, | |
34 | const wxString& name = wxDialogNameStr) | |
bfc6fde4 VZ |
35 | { |
36 | long modalStyle = modal ? wxDIALOG_MODAL : wxDIALOG_MODELESS ; | |
37 | Create(parent, -1, title, wxPoint(x, y), wxSize(width, height), style|modalStyle, name); | |
38 | } | |
83df96d6 | 39 | |
bfc6fde4 VZ |
40 | // Constructor with no modal flag - the new convention. |
41 | wxDialog(wxWindow *parent, wxWindowID id, | |
83df96d6 JS |
42 | const wxString& title, |
43 | const wxPoint& pos = wxDefaultPosition, | |
44 | const wxSize& size = wxDefaultSize, | |
45 | long style = wxDEFAULT_DIALOG_STYLE, | |
46 | const wxString& name = wxDialogNameStr) | |
bfc6fde4 VZ |
47 | { |
48 | Create(parent, id, title, pos, size, style, name); | |
49 | } | |
83df96d6 | 50 | |
bfc6fde4 | 51 | bool Create(wxWindow *parent, wxWindowID id, |
83df96d6 JS |
52 | const wxString& title, // bool modal = FALSE, // TODO make this a window style? |
53 | const wxPoint& pos = wxDefaultPosition, | |
54 | const wxSize& size = wxDefaultSize, | |
55 | long style = wxDEFAULT_DIALOG_STYLE, | |
56 | const wxString& name = wxDialogNameStr); | |
57 | ||
bfc6fde4 | 58 | ~wxDialog(); |
83df96d6 | 59 | |
bfc6fde4 | 60 | virtual bool Destroy(); |
83df96d6 | 61 | |
bfc6fde4 VZ |
62 | bool Show(bool show); |
63 | void Iconize(bool iconize); | |
64 | void Raise(); | |
65 | void Lower(); | |
83df96d6 | 66 | |
bfc6fde4 | 67 | virtual bool IsIconized() const; |
83df96d6 | 68 | |
8487f887 RR |
69 | virtual bool IsTopLevel() const { return TRUE; } |
70 | ||
bfc6fde4 VZ |
71 | void SetTitle(const wxString& title); |
72 | wxString GetTitle() const ; | |
83df96d6 | 73 | |
bfc6fde4 | 74 | void SetModal(bool flag); |
83df96d6 | 75 | |
dfe1eee3 | 76 | virtual bool IsModal() const |
83df96d6 JS |
77 | { return ((GetWindowStyleFlag() & wxDIALOG_MODAL) == wxDIALOG_MODAL); } |
78 | ||
bfc6fde4 VZ |
79 | virtual int ShowModal(); |
80 | virtual void EndModal(int retCode); | |
83df96d6 | 81 | |
dfe1eee3 VZ |
82 | // Implementation |
83 | virtual void ChangeFont(bool keepOriginalSize = TRUE); | |
84 | virtual void ChangeBackgroundColour(); | |
85 | virtual void ChangeForegroundColour(); | |
86 | inline WXWidget GetTopWidget() const { return m_mainWidget; } | |
87 | inline WXWidget GetClientWidget() const { return m_mainWidget; } | |
83df96d6 | 88 | |
bfc6fde4 VZ |
89 | // Standard buttons |
90 | void OnOK(wxCommandEvent& event); | |
91 | void OnApply(wxCommandEvent& event); | |
92 | void OnCancel(wxCommandEvent& event); | |
83df96d6 | 93 | |
d75638f8 | 94 | void OnPaint(wxPaintEvent &event); |
83df96d6 | 95 | |
bfc6fde4 VZ |
96 | // Responds to colour changes |
97 | void OnSysColourChanged(wxSysColourChangedEvent& event); | |
83df96d6 | 98 | |
dfe1eee3 VZ |
99 | // bool OnClose(); |
100 | void OnCharHook(wxKeyEvent& event); | |
101 | void OnCloseWindow(wxCloseEvent& event); | |
83df96d6 | 102 | |
8e877c19 RR |
103 | // Responds to size changes |
104 | void OnSize(wxSizeEvent& event); | |
105 | ||
bfc6fde4 VZ |
106 | public: |
107 | //// Motif-specific | |
108 | bool m_modalShowing; | |
109 | wxString m_dialogTitle; | |
83df96d6 | 110 | |
bfc6fde4 VZ |
111 | protected: |
112 | virtual void DoSetSize(int x, int y, | |
83df96d6 JS |
113 | int width, int height, |
114 | int sizeFlags = wxSIZE_AUTO); | |
115 | ||
bfc6fde4 | 116 | virtual void DoSetClientSize(int width, int height); |
83df96d6 | 117 | |
bfc6fde4 VZ |
118 | private: |
119 | DECLARE_EVENT_TABLE() | |
9b6dbb09 JS |
120 | }; |
121 | ||
122 | #endif | |
83df96d6 | 123 | // _WX_DIALOG_H_ |