]>
Commit | Line | Data |
---|---|---|
1 | /////////////////////////////////////////////////////////////////////////////// | |
2 | // Name: x11/toplevel.cpp | |
3 | // Purpose: implements wxTopLevelWindow for X11 | |
4 | // Author: Julian Smart | |
5 | // Modified by: | |
6 | // Created: 24.09.01 | |
7 | // RCS-ID: $Id$ | |
8 | // Copyright: (c) 2002 Julian Smart | |
9 | // License: wxWindows licence | |
10 | /////////////////////////////////////////////////////////////////////////////// | |
11 | ||
12 | // ============================================================================ | |
13 | // declarations | |
14 | // ============================================================================ | |
15 | ||
16 | // ---------------------------------------------------------------------------- | |
17 | // headers | |
18 | // ---------------------------------------------------------------------------- | |
19 | ||
20 | #ifdef __GNUG__ | |
21 | #pragma implementation "toplevel.h" | |
22 | #endif | |
23 | ||
24 | // For compilers that support precompilation, includes "wx.h". | |
25 | #include "wx/wxprec.h" | |
26 | ||
27 | #ifdef __BORLANDC__ | |
28 | #pragma hdrstop | |
29 | #endif | |
30 | ||
31 | #ifndef WX_PRECOMP | |
32 | #include "wx/app.h" | |
33 | #include "wx/toplevel.h" | |
34 | #include "wx/string.h" | |
35 | #include "wx/log.h" | |
36 | #include "wx/intl.h" | |
37 | #include "wx/frame.h" | |
38 | #endif //WX_PRECOMP | |
39 | ||
40 | #include "wx/x11/private.h" | |
41 | ||
42 | // ---------------------------------------------------------------------------- | |
43 | // globals | |
44 | // ---------------------------------------------------------------------------- | |
45 | ||
46 | // list of all frames and modeless dialogs | |
47 | // wxWindowList wxModelessWindows; | |
48 | ||
49 | // ---------------------------------------------------------------------------- | |
50 | // wxTopLevelWindowX11 creation | |
51 | // ---------------------------------------------------------------------------- | |
52 | ||
53 | void wxTopLevelWindowX11::Init() | |
54 | { | |
55 | m_iconized = | |
56 | m_maximizeOnShow = FALSE; | |
57 | ||
58 | // unlike (almost?) all other windows, frames are created hidden | |
59 | m_isShown = FALSE; | |
60 | ||
61 | // Data to save/restore when calling ShowFullScreen | |
62 | m_fsStyle = 0; | |
63 | m_fsIsMaximized = FALSE; | |
64 | m_fsIsShowing = FALSE; | |
65 | } | |
66 | ||
67 | bool wxTopLevelWindowX11::CreateDialog(const wxString& title, | |
68 | const wxPoint& pos, | |
69 | const wxSize& size) | |
70 | { | |
71 | // TODO | |
72 | return FALSE; | |
73 | } | |
74 | ||
75 | bool wxTopLevelWindowX11::CreateFrame(const wxString& title, | |
76 | const wxPoint& pos, | |
77 | const wxSize& size) | |
78 | { | |
79 | // TODO | |
80 | return FALSE; | |
81 | } | |
82 | ||
83 | bool wxTopLevelWindowX11::Create(wxWindow *parent, | |
84 | wxWindowID id, | |
85 | const wxString& title, | |
86 | const wxPoint& pos, | |
87 | const wxSize& size, | |
88 | long style, | |
89 | const wxString& name) | |
90 | { | |
91 | // init our fields | |
92 | Init(); | |
93 | ||
94 | m_windowStyle = style; | |
95 | ||
96 | SetName(name); | |
97 | ||
98 | m_windowId = id == -1 ? NewControlId() : id; | |
99 | ||
100 | wxTopLevelWindows.Append(this); | |
101 | ||
102 | if ( parent ) | |
103 | parent->AddChild(this); | |
104 | ||
105 | if ( GetExtraStyle() & wxTOPLEVEL_EX_DIALOG ) | |
106 | { | |
107 | return CreateDialog(title, pos, size); | |
108 | } | |
109 | else // !dialog | |
110 | { | |
111 | return CreateFrame(title, pos, size); | |
112 | } | |
113 | } | |
114 | ||
115 | wxTopLevelWindowX11::~wxTopLevelWindowX11() | |
116 | { | |
117 | wxTopLevelWindows.DeleteObject(this); | |
118 | ||
119 | if ( wxModelessWindows.Find(this) ) | |
120 | wxModelessWindows.DeleteObject(this); | |
121 | ||
122 | // If this is the last top-level window, exit. | |
123 | if ( wxTheApp && (wxTopLevelWindows.Number() == 0) ) | |
124 | { | |
125 | wxTheApp->SetTopWindow(NULL); | |
126 | ||
127 | if (wxTheApp->GetExitOnFrameDelete()) | |
128 | { | |
129 | // Signal to the app that we're going to close | |
130 | wxTheApp->ExitMainLoop(); | |
131 | } | |
132 | } | |
133 | } | |
134 | ||
135 | // ---------------------------------------------------------------------------- | |
136 | // wxTopLevelWindowX11 showing | |
137 | // ---------------------------------------------------------------------------- | |
138 | ||
139 | bool wxTopLevelWindowX11::Show(bool show) | |
140 | { | |
141 | if ( !wxWindowBase::Show(show) ) | |
142 | return FALSE; | |
143 | ||
144 | // TODO | |
145 | ||
146 | return TRUE; | |
147 | } | |
148 | ||
149 | // ---------------------------------------------------------------------------- | |
150 | // wxTopLevelWindowX11 maximize/minimize | |
151 | // ---------------------------------------------------------------------------- | |
152 | ||
153 | void wxTopLevelWindowX11::Maximize(bool maximize) | |
154 | { | |
155 | // TODO | |
156 | } | |
157 | ||
158 | bool wxTopLevelWindowX11::IsMaximized() const | |
159 | { | |
160 | // TODO | |
161 | return TRUE; | |
162 | } | |
163 | ||
164 | void wxTopLevelWindowX11::Iconize(bool iconize) | |
165 | { | |
166 | // TODO | |
167 | } | |
168 | ||
169 | bool wxTopLevelWindowX11::IsIconized() const | |
170 | { | |
171 | // TODO | |
172 | return m_iconized; | |
173 | } | |
174 | ||
175 | void wxTopLevelWindowX11::Restore() | |
176 | { | |
177 | // TODO | |
178 | } | |
179 | ||
180 | // ---------------------------------------------------------------------------- | |
181 | // wxTopLevelWindowX11 fullscreen | |
182 | // ---------------------------------------------------------------------------- | |
183 | ||
184 | bool wxTopLevelWindowX11::ShowFullScreen(bool show, long style) | |
185 | { | |
186 | if (show) | |
187 | { | |
188 | if (IsFullScreen()) | |
189 | return FALSE; | |
190 | ||
191 | m_fsIsShowing = TRUE; | |
192 | m_fsStyle = style; | |
193 | ||
194 | // TODO | |
195 | ||
196 | return TRUE; | |
197 | } | |
198 | else | |
199 | { | |
200 | if (!IsFullScreen()) | |
201 | return FALSE; | |
202 | ||
203 | m_fsIsShowing = FALSE; | |
204 | ||
205 | // TODO | |
206 | return TRUE; | |
207 | } | |
208 | } | |
209 | ||
210 | // ---------------------------------------------------------------------------- | |
211 | // wxTopLevelWindowX11 misc | |
212 | // ---------------------------------------------------------------------------- | |
213 | ||
214 | void wxTopLevelWindowX11::SetIcon(const wxIcon& icon) | |
215 | { | |
216 | // this sets m_icon | |
217 | wxTopLevelWindowBase::SetIcon(icon); | |
218 | ||
219 | // TODO | |
220 | } |