1 /////////////////////////////////////////////////////////////////////////////
3 // Purpose: wxDialog class
4 // Author: Julian Smart
8 // Copyright: (c) Julian Smart
9 // Licence: wxWindows licence
10 /////////////////////////////////////////////////////////////////////////////
16 #pragma interface "dialog.h"
19 WXDLLEXPORT_DATA(extern const char*) wxDialogNameStr
;
22 class WXDLLEXPORT wxDialog
: public wxDialogBase
24 DECLARE_DYNAMIC_CLASS(wxDialog
)
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
)
36 long modalStyle
= modal
? wxDIALOG_MODAL
: wxDIALOG_MODELESS
;
37 Create(parent
, -1, title
, wxPoint(x
, y
), wxSize(width
, height
), style
|modalStyle
, name
);
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
)
48 Create(parent
, id
, title
, pos
, size
, style
, name
);
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
);
60 virtual bool Destroy();
63 void Iconize(bool iconize
);
67 virtual bool IsIconized() const;
69 virtual bool IsTopLevel() const { return TRUE
; }
71 void SetTitle(const wxString
& title
);
72 wxString
GetTitle() const ;
74 void SetModal(bool flag
);
76 virtual bool IsModal() const
77 { return ((GetWindowStyleFlag() & wxDIALOG_MODAL
) == wxDIALOG_MODAL
); }
79 virtual int ShowModal();
80 virtual void EndModal(int retCode
);
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
; }
90 void OnOK(wxCommandEvent
& event
);
91 void OnApply(wxCommandEvent
& event
);
92 void OnCancel(wxCommandEvent
& event
);
94 void OnPaint(wxPaintEvent
&event
);
96 // Responds to colour changes
97 void OnSysColourChanged(wxSysColourChangedEvent
& event
);
100 void OnCharHook(wxKeyEvent
& event
);
101 void OnCloseWindow(wxCloseEvent
& event
);
103 // Responds to size changes
104 void OnSize(wxSizeEvent
& event
);
109 wxString m_dialogTitle
;
112 virtual void DoSetSize(int x
, int y
,
113 int width
, int height
,
114 int sizeFlags
= wxSIZE_AUTO
);
116 virtual void DoSetClientSize(int width
, int height
);
119 DECLARE_EVENT_TABLE()