]> git.saurik.com Git - wxWidgets.git/blob - include/wx/os2/dialog.h
wxMenu implementations
[wxWidgets.git] / include / wx / os2 / dialog.h
1 /////////////////////////////////////////////////////////////////////////////
2 // Name: dialog.h
3 // Purpose: wxDialog class
4 // Author: David Webster
5 // Modified by:
6 // Created: 10/14/99
7 // RCS-ID: $Id$
8 // Copyright: (c) David Webster
9 // Licence: wxWindows licence
10 /////////////////////////////////////////////////////////////////////////////
11
12 #ifndef _WX_DIALOG_H_
13 #define _WX_DIALOG_H_
14
15 #include "wx/panel.h"
16
17 WXDLLEXPORT_DATA(extern const char*) wxDialogNameStr;
18
19 // Dialog boxes
20 class WXDLLEXPORT wxDialog: public wxDialogBase
21 {
22 DECLARE_DYNAMIC_CLASS(wxDialog)
23 public:
24
25 wxDialog();
26
27 // Constructor with a modal flag, but no window id - the old convention
28 inline wxDialog( wxWindow* parent
29 ,const wxString& title
30 ,bool modal
31 ,int x = -1
32 ,int y = -1
33 ,int width = 500
34 ,int height = 500
35 ,long style = wxDEFAULT_DIALOG_STYLE
36 ,const wxString& name = wxDialogNameStr
37 )
38 {
39 long modalStyle = modal ? wxDIALOG_MODAL : wxDIALOG_MODELESS ;
40 Create(parent, -1, title, wxPoint(x, y), wxSize(width, height), style|modalStyle, name);
41 }
42
43 // Constructor with no modal flag - the new convention.
44 inline wxDialog( wxWindow* parent
45 ,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
51 )
52 {
53 Create(parent, id, title, pos, size, style, name);
54 }
55
56 bool Create( wxWindow* parent
57 ,wxWindowID id
58 ,const wxString& title
59 , // bool modal = FALSE, // TODO make this a window style?
60 const wxPoint& pos = wxDefaultPosition
61 ,const wxSize& size = wxDefaultSize
62 ,long style = wxDEFAULT_DIALOG_STYLE
63 ,const wxString& name = wxDialogNameStr
64 );
65
66 ~wxDialog();
67
68 virtual bool Destroy();
69
70 virtual void DoSetClientSize(int width, int height);
71
72 virtual void GetPosition(int *x, int *y) const;
73
74 bool Show(bool show);
75 bool IsShown() const;
76 void Iconize(bool iconize);
77
78 #if WXWIN_COMPATIBILITY
79 bool Iconized() const { return IsIconized(); };
80 #endif
81
82 virtual bool IsIconized() const;
83 void Fit();
84
85 void SetTitle(const wxString& title);
86 wxString GetTitle() const ;
87
88 void OnSize(wxSizeEvent& event);
89 bool OnClose();
90 void OnCharHook(wxKeyEvent& event);
91 void OnPaint(wxPaintEvent& event);
92 void OnCloseWindow(wxCloseEvent& event);
93
94 void SetModal(bool flag);
95
96 virtual void Centre(int direction = wxBOTH);
97 virtual bool IsModal() const;
98
99 // For now, same as Show(TRUE) but returns return code
100 virtual int ShowModal();
101 virtual void EndModal(int retCode);
102
103 // Standard buttons
104 void OnOK(wxCommandEvent& event);
105 void OnApply(wxCommandEvent& event);
106 void OnCancel(wxCommandEvent& event);
107
108 // Responds to colour changes
109 void OnSysColourChanged(wxSysColourChangedEvent& event);
110
111 // implementation
112 // --------------
113 virtual MRESULT OS2WindowProc(HWND hwnd, WXUINT message, WXWPARAM wParam, WXLPARAM lParam);
114
115 virtual WXHBRUSH OnCtlColor(WXHDC pDC, WXHWND pWnd, WXUINT nCtlColor,
116 WXUINT message, WXWPARAM wParam, WXLPARAM lParam);
117
118 bool IsModalShowing() const { return m_modalShowing; }
119
120 // tooltip management
121 #if wxUSE_TOOLTIPS
122 WXHWND GetToolTipCtrl() const { return m_hwndToolTip; }
123 void SetToolTipCtrl(WXHWND hwndTT) { m_hwndToolTip = hwndTT; }
124 #endif // tooltips
125
126 protected:
127 bool m_modalShowing;
128 WXHWND m_hwndOldFocus; // the window which had focus before we were shown
129
130 private:
131 #if wxUSE_TOOLTIPS
132 WXHWND m_hwndToolTip;
133 #endif // tooltips
134
135 private:
136
137 DECLARE_EVENT_TABLE()
138 };
139
140 #endif
141 // _WX_DIALOG_H_