]>
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__ | |
dfe1eee3 | 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 | { |
bfc6fde4 VZ |
24 | DECLARE_DYNAMIC_CLASS(wxDialog) |
25 | ||
9b6dbb09 | 26 | public: |
bfc6fde4 VZ |
27 | wxDialog(); |
28 | ||
29 | // Constructor with a modal flag, but no window id - the old convention | |
30 | wxDialog(wxWindow *parent, | |
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) | |
35 | { | |
36 | long modalStyle = modal ? wxDIALOG_MODAL : wxDIALOG_MODELESS ; | |
37 | Create(parent, -1, title, wxPoint(x, y), wxSize(width, height), style|modalStyle, name); | |
38 | } | |
39 | ||
40 | // Constructor with no modal flag - the new convention. | |
41 | wxDialog(wxWindow *parent, wxWindowID id, | |
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) | |
47 | { | |
48 | Create(parent, id, title, pos, size, style, name); | |
49 | } | |
50 | ||
51 | bool Create(wxWindow *parent, wxWindowID id, | |
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 | ||
58 | ~wxDialog(); | |
59 | ||
60 | virtual bool Destroy(); | |
61 | ||
62 | bool Show(bool show); | |
63 | void Iconize(bool iconize); | |
64 | void Raise(); | |
65 | void Lower(); | |
66 | ||
67 | virtual bool IsIconized() const; | |
bfc6fde4 VZ |
68 | |
69 | void SetTitle(const wxString& title); | |
70 | wxString GetTitle() const ; | |
71 | ||
bfc6fde4 VZ |
72 | void SetModal(bool flag); |
73 | ||
dfe1eee3 VZ |
74 | virtual bool IsModal() const |
75 | { return ((GetWindowStyleFlag() & wxDIALOG_MODAL) == wxDIALOG_MODAL); } | |
bfc6fde4 VZ |
76 | |
77 | virtual int ShowModal(); | |
78 | virtual void EndModal(int retCode); | |
79 | ||
dfe1eee3 VZ |
80 | // Implementation |
81 | virtual void ChangeFont(bool keepOriginalSize = TRUE); | |
82 | virtual void ChangeBackgroundColour(); | |
83 | virtual void ChangeForegroundColour(); | |
84 | inline WXWidget GetTopWidget() const { return m_mainWidget; } | |
85 | inline WXWidget GetClientWidget() const { return m_mainWidget; } | |
da175b2c | 86 | |
bfc6fde4 VZ |
87 | // Standard buttons |
88 | void OnOK(wxCommandEvent& event); | |
89 | void OnApply(wxCommandEvent& event); | |
90 | void OnCancel(wxCommandEvent& event); | |
dfe1eee3 | 91 | |
d75638f8 | 92 | void OnPaint(wxPaintEvent &event); |
bfc6fde4 VZ |
93 | |
94 | // Responds to colour changes | |
95 | void OnSysColourChanged(wxSysColourChangedEvent& event); | |
96 | ||
dfe1eee3 VZ |
97 | // bool OnClose(); |
98 | void OnCharHook(wxKeyEvent& event); | |
99 | void OnCloseWindow(wxCloseEvent& event); | |
9b6dbb09 | 100 | |
8e877c19 RR |
101 | // Responds to size changes |
102 | void OnSize(wxSizeEvent& event); | |
103 | ||
bfc6fde4 VZ |
104 | public: |
105 | //// Motif-specific | |
106 | bool m_modalShowing; | |
107 | wxString m_dialogTitle; | |
dfc54541 | 108 | |
bfc6fde4 VZ |
109 | protected: |
110 | virtual void DoSetSize(int x, int y, | |
111 | int width, int height, | |
112 | int sizeFlags = wxSIZE_AUTO); | |
dfc54541 | 113 | |
bfc6fde4 | 114 | virtual void DoSetClientSize(int width, int height); |
dfc54541 | 115 | |
bfc6fde4 VZ |
116 | private: |
117 | DECLARE_EVENT_TABLE() | |
9b6dbb09 JS |
118 | }; |
119 | ||
120 | #endif | |
121 | // _WX_DIALOG_H_ |