]>
Commit | Line | Data |
---|---|---|
7c78e7c7 RR |
1 | ///////////////////////////////////////////////////////////////////////////// |
2 | // Name: dialog.h | |
01b2eeec KB |
3 | // Purpose: wxDialog class |
4 | // Author: AUTHOR | |
5 | // Modified by: | |
6 | // Created: ??/??/98 | |
7 | // RCS-ID: $Id$ | |
8 | // Copyright: (c) AUTHOR | |
7c78e7c7 RR |
9 | // Licence: wxWindows licence |
10 | ///////////////////////////////////////////////////////////////////////////// | |
11 | ||
01b2eeec KB |
12 | #ifndef _WX_DIALOG_H_ |
13 | #define _WX_DIALOG_H_ | |
7c78e7c7 RR |
14 | |
15 | #ifdef __GNUG__ | |
01b2eeec | 16 | #pragma interface "dialog.h" |
7c78e7c7 RR |
17 | #endif |
18 | ||
01b2eeec | 19 | #include "wx/panel.h" |
7c78e7c7 | 20 | |
01b2eeec | 21 | WXDLLEXPORT_DATA(extern const char*) wxDialogNameStr; |
7c78e7c7 | 22 | |
01b2eeec KB |
23 | // Dialog boxes |
24 | class WXDLLEXPORT wxDialog: public wxPanel | |
25 | { | |
26 | DECLARE_DYNAMIC_CLASS(wxDialog) | |
27 | public: | |
7c78e7c7 | 28 | |
01b2eeec | 29 | wxDialog(); |
7c78e7c7 | 30 | |
01b2eeec KB |
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 | } | |
7c78e7c7 | 41 | |
01b2eeec KB |
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 | } | |
7c78e7c7 | 52 | |
01b2eeec KB |
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); | |
7c78e7c7 | 59 | |
01b2eeec | 60 | ~wxDialog(); |
7c78e7c7 | 61 | |
01b2eeec KB |
62 | virtual bool Destroy(); |
63 | void SetClientSize(int width, int height); | |
64 | void GetPosition(int *x, int *y) const; | |
65 | bool Show(bool show); | |
66 | void Iconize(bool iconize); | |
67 | ||
68 | virtual bool IsIconized() const; | |
69 | void Fit(); | |
70 | ||
71 | void SetTitle(const wxString& title); | |
72 | wxString GetTitle() const ; | |
7c78e7c7 | 73 | |
01b2eeec KB |
74 | bool OnClose(); |
75 | void OnCharHook(wxKeyEvent& event); | |
76 | void OnCloseWindow(wxCloseEvent& event); | |
77 | ||
78 | void SetModal(bool flag); | |
79 | ||
80 | virtual void Centre(int direction = wxBOTH); | |
81 | virtual bool IsModal() const { return ((GetWindowStyleFlag() & wxDIALOG_MODAL) == wxDIALOG_MODAL); } | |
82 | ||
83 | virtual int ShowModal(); | |
84 | virtual void EndModal(int retCode); | |
85 | ||
86 | // Standard buttons | |
87 | void OnOK(wxCommandEvent& event); | |
88 | void OnApply(wxCommandEvent& event); | |
89 | void OnCancel(wxCommandEvent& event); | |
90 | ||
91 | // Responds to colour changes | |
92 | void OnSysColourChanged(wxSysColourChangedEvent& event); | |
93 | ||
94 | DECLARE_EVENT_TABLE() | |
7c78e7c7 RR |
95 | }; |
96 | ||
01b2eeec KB |
97 | #endif |
98 | // _WX_DIALOG_H_ |