]>
git.saurik.com Git - wxWidgets.git/blob - include/wx/msw/dialog.h
1 /////////////////////////////////////////////////////////////////////////////
3 // Purpose: wxDialog class
4 // Author: Julian Smart
8 // Copyright: (c) Julian Smart and Markus Holzem
9 // Licence: wxWindows license
10 /////////////////////////////////////////////////////////////////////////////
16 #pragma interface "dialog.h"
21 WXDLLEXPORT_DATA(extern const char*) wxDialogNameStr
;
24 class WXDLLEXPORT wxDialog
: public wxPanel
26 DECLARE_DYNAMIC_CLASS(wxDialog
)
33 // Constructor with a modal flag, but no window id - the old convention
34 inline wxDialog(wxWindow
*parent
,
35 const wxString
& title
, bool modal
,
36 int x
= -1, int y
= -1, int width
= 500, int height
= 500,
37 long style
= wxDEFAULT_DIALOG_STYLE
,
38 const wxString
& name
= wxDialogNameStr
)
40 long modalStyle
= modal
? wxDIALOG_MODAL
: wxDIALOG_MODELESS
;
41 Create(parent
, -1, title
, wxPoint(x
, y
), wxSize(width
, height
), style
|modalStyle
, name
);
44 // Constructor with no modal flag - the new convention.
45 inline wxDialog(wxWindow
*parent
, wxWindowID id
,
46 const wxString
& title
,
47 const wxPoint
& pos
= wxDefaultPosition
,
48 const wxSize
& size
= wxDefaultSize
,
49 long style
= wxDEFAULT_DIALOG_STYLE
,
50 const wxString
& name
= wxDialogNameStr
)
52 Create(parent
, id
, title
, pos
, size
, style
, name
);
55 bool Create(wxWindow
*parent
, wxWindowID id
,
56 const wxString
& title
, // bool modal = FALSE, // TODO make this a window style?
57 const wxPoint
& pos
= wxDefaultPosition
,
58 const wxSize
& size
= wxDefaultSize
,
59 long style
= wxDEFAULT_DIALOG_STYLE
,
60 const wxString
& name
= wxDialogNameStr
);
64 virtual bool Destroy();
66 virtual void SetClientSize(int width
, int height
);
68 virtual void GetPosition(int *x
, int *y
) const;
71 bool IsShown() const ;
72 void Iconize(bool iconize
);
74 #if WXWIN_COMPATIBILITY
75 inline bool Iconized() const { return IsIconized(); };
78 virtual bool IsIconized() const;
81 void SetTitle(const wxString
& title
);
82 wxString
GetTitle() const ;
84 void OnSize(wxSizeEvent
& event
);
86 void OnCharHook(wxKeyEvent
& event
);
87 void OnPaint(wxPaintEvent
& event
);
88 void OnCloseWindow(wxCloseEvent
& event
);
90 void SetModal(bool flag
);
92 virtual void Centre(int direction
= wxBOTH
);
93 virtual bool IsModal() const { return ((GetWindowStyleFlag() & wxDIALOG_MODAL
) == wxDIALOG_MODAL
); }
95 // For now, same as Show(TRUE) but returns return code
96 virtual int ShowModal();
97 virtual void EndModal(int retCode
);
100 void OnOK(wxCommandEvent
& event
);
101 void OnApply(wxCommandEvent
& event
);
102 void OnCancel(wxCommandEvent
& event
);
104 // Responds to colour changes
105 void OnSysColourChanged(wxSysColourChangedEvent
& event
);
108 virtual long MSWWindowProc(WXUINT nMsg
, WXWPARAM wParam
, WXLPARAM lParam
);
109 virtual long MSWDefWindowProc(WXUINT nMsg
, WXWPARAM wParam
, WXLPARAM lParam
);
110 virtual bool MSWProcessMessage(WXMSG
* pMsg
);
111 // virtual bool MSWOnEraseBkgnd(WXHDC pDC);
112 virtual bool MSWOnClose();
113 inline bool IsModalShowing() const { return m_modalShowing
; }
114 virtual WXHBRUSH
OnCtlColor(WXHDC pDC
, WXHWND pWnd
, WXUINT nCtlColor
,
115 WXUINT message
, WXWPARAM wParam
, WXLPARAM lParam
);
118 WXHWND m_hwndOldFocus
; // the window which had focus before we were shown
120 DECLARE_EVENT_TABLE()