]>
Commit | Line | Data |
---|---|---|
1 | ///////////////////////////////////////////////////////////////////////////// | |
2 | // Name: src/msw/frame.cpp | |
3 | // Purpose: wxFrame | |
4 | // Author: Julian Smart | |
5 | // Modified by: | |
6 | // Created: 01/02/97 | |
7 | // RCS-ID: $Id$ | |
8 | // Copyright: (c) Julian Smart | |
9 | // Licence: wxWindows licence | |
10 | ///////////////////////////////////////////////////////////////////////////// | |
11 | ||
12 | // ============================================================================ | |
13 | // declarations | |
14 | // ============================================================================ | |
15 | ||
16 | // ---------------------------------------------------------------------------- | |
17 | // headers | |
18 | // ---------------------------------------------------------------------------- | |
19 | ||
20 | // For compilers that support precompilation, includes "wx.h". | |
21 | #include "wx/wxprec.h" | |
22 | ||
23 | #ifdef __BORLANDC__ | |
24 | #pragma hdrstop | |
25 | #endif | |
26 | ||
27 | #include "wx/frame.h" | |
28 | ||
29 | #ifndef WX_PRECOMP | |
30 | #include "wx/msw/wrapcctl.h" // include <commctrl.h> "properly" | |
31 | #include "wx/app.h" | |
32 | #include "wx/menu.h" | |
33 | #include "wx/utils.h" | |
34 | #include "wx/dialog.h" | |
35 | #include "wx/settings.h" | |
36 | #include "wx/dcclient.h" | |
37 | #include "wx/mdi.h" | |
38 | #include "wx/panel.h" | |
39 | #include "wx/log.h" | |
40 | #include "wx/toolbar.h" | |
41 | #include "wx/statusbr.h" | |
42 | #include "wx/menuitem.h" | |
43 | #endif // WX_PRECOMP | |
44 | ||
45 | #include "wx/msw/private.h" | |
46 | ||
47 | #if defined(__POCKETPC__) || defined(__SMARTPHONE__) | |
48 | #include <ole2.h> | |
49 | #include <aygshell.h> | |
50 | #include "wx/msw/winundef.h" | |
51 | #endif | |
52 | ||
53 | #include "wx/generic/statusbr.h" | |
54 | ||
55 | #ifdef __WXUNIVERSAL__ | |
56 | #include "wx/univ/theme.h" | |
57 | #include "wx/univ/colschem.h" | |
58 | #endif // __WXUNIVERSAL__ | |
59 | ||
60 | // ---------------------------------------------------------------------------- | |
61 | // globals | |
62 | // ---------------------------------------------------------------------------- | |
63 | ||
64 | #if wxUSE_MENUS_NATIVE | |
65 | extern wxMenu *wxCurrentPopupMenu; | |
66 | #endif // wxUSE_MENUS_NATIVE | |
67 | ||
68 | // ---------------------------------------------------------------------------- | |
69 | // event tables | |
70 | // ---------------------------------------------------------------------------- | |
71 | ||
72 | BEGIN_EVENT_TABLE(wxFrame, wxFrameBase) | |
73 | EVT_SYS_COLOUR_CHANGED(wxFrame::OnSysColourChanged) | |
74 | END_EVENT_TABLE() | |
75 | ||
76 | #if wxUSE_EXTENDED_RTTI | |
77 | WX_DEFINE_FLAGS( wxFrameStyle ) | |
78 | ||
79 | wxBEGIN_FLAGS( wxFrameStyle ) | |
80 | // new style border flags, we put them first to | |
81 | // use them for streaming out | |
82 | wxFLAGS_MEMBER(wxBORDER_SIMPLE) | |
83 | wxFLAGS_MEMBER(wxBORDER_SUNKEN) | |
84 | wxFLAGS_MEMBER(wxBORDER_DOUBLE) | |
85 | wxFLAGS_MEMBER(wxBORDER_RAISED) | |
86 | wxFLAGS_MEMBER(wxBORDER_STATIC) | |
87 | wxFLAGS_MEMBER(wxBORDER_NONE) | |
88 | ||
89 | // old style border flags | |
90 | wxFLAGS_MEMBER(wxSIMPLE_BORDER) | |
91 | wxFLAGS_MEMBER(wxSUNKEN_BORDER) | |
92 | wxFLAGS_MEMBER(wxDOUBLE_BORDER) | |
93 | wxFLAGS_MEMBER(wxRAISED_BORDER) | |
94 | wxFLAGS_MEMBER(wxSTATIC_BORDER) | |
95 | wxFLAGS_MEMBER(wxBORDER) | |
96 | ||
97 | // standard window styles | |
98 | wxFLAGS_MEMBER(wxTAB_TRAVERSAL) | |
99 | wxFLAGS_MEMBER(wxCLIP_CHILDREN) | |
100 | wxFLAGS_MEMBER(wxTRANSPARENT_WINDOW) | |
101 | wxFLAGS_MEMBER(wxWANTS_CHARS) | |
102 | wxFLAGS_MEMBER(wxFULL_REPAINT_ON_RESIZE) | |
103 | wxFLAGS_MEMBER(wxALWAYS_SHOW_SB ) | |
104 | wxFLAGS_MEMBER(wxVSCROLL) | |
105 | wxFLAGS_MEMBER(wxHSCROLL) | |
106 | ||
107 | // frame styles | |
108 | wxFLAGS_MEMBER(wxSTAY_ON_TOP) | |
109 | wxFLAGS_MEMBER(wxCAPTION) | |
110 | #if WXWIN_COMPATIBILITY_2_6 | |
111 | wxFLAGS_MEMBER(wxTHICK_FRAME) | |
112 | #endif // WXWIN_COMPATIBILITY_2_6 | |
113 | wxFLAGS_MEMBER(wxSYSTEM_MENU) | |
114 | wxFLAGS_MEMBER(wxRESIZE_BORDER) | |
115 | #if WXWIN_COMPATIBILITY_2_6 | |
116 | wxFLAGS_MEMBER(wxRESIZE_BOX) | |
117 | #endif // WXWIN_COMPATIBILITY_2_6 | |
118 | wxFLAGS_MEMBER(wxCLOSE_BOX) | |
119 | wxFLAGS_MEMBER(wxMAXIMIZE_BOX) | |
120 | wxFLAGS_MEMBER(wxMINIMIZE_BOX) | |
121 | ||
122 | wxFLAGS_MEMBER(wxFRAME_TOOL_WINDOW) | |
123 | wxFLAGS_MEMBER(wxFRAME_FLOAT_ON_PARENT) | |
124 | ||
125 | wxFLAGS_MEMBER(wxFRAME_SHAPED) | |
126 | ||
127 | wxEND_FLAGS( wxFrameStyle ) | |
128 | ||
129 | IMPLEMENT_DYNAMIC_CLASS_XTI(wxFrame, wxTopLevelWindow,"wx/frame.h") | |
130 | ||
131 | wxBEGIN_PROPERTIES_TABLE(wxFrame) | |
132 | wxEVENT_PROPERTY( Menu , wxEVT_COMMAND_MENU_SELECTED , wxCommandEvent) | |
133 | ||
134 | wxPROPERTY( Title,wxString, SetTitle, GetTitle, wxString() , 0 /*flags*/ , wxT("Helpstring") , wxT("group")) | |
135 | wxPROPERTY_FLAGS( WindowStyle , wxFrameStyle , long , SetWindowStyleFlag , GetWindowStyleFlag , EMPTY_MACROVALUE , 0 /*flags*/ , wxT("Helpstring") , wxT("group")) // style | |
136 | wxPROPERTY( MenuBar , wxMenuBar * , SetMenuBar , GetMenuBar , EMPTY_MACROVALUE , 0 /*flags*/ , wxT("Helpstring") , wxT("group")) | |
137 | wxEND_PROPERTIES_TABLE() | |
138 | ||
139 | wxBEGIN_HANDLERS_TABLE(wxFrame) | |
140 | wxEND_HANDLERS_TABLE() | |
141 | ||
142 | wxCONSTRUCTOR_6( wxFrame , wxWindow* , Parent , wxWindowID , Id , wxString , Title , wxPoint , Position , wxSize , Size , long , WindowStyle) | |
143 | ||
144 | #else | |
145 | IMPLEMENT_DYNAMIC_CLASS(wxFrame, wxTopLevelWindow) | |
146 | #endif | |
147 | ||
148 | // ============================================================================ | |
149 | // implementation | |
150 | // ============================================================================ | |
151 | ||
152 | // ---------------------------------------------------------------------------- | |
153 | // static class members | |
154 | // ---------------------------------------------------------------------------- | |
155 | ||
156 | #if wxUSE_STATUSBAR | |
157 | #if wxUSE_NATIVE_STATUSBAR | |
158 | bool wxFrame::m_useNativeStatusBar = true; | |
159 | #else | |
160 | bool wxFrame::m_useNativeStatusBar = false; | |
161 | #endif | |
162 | #endif // wxUSE_NATIVE_STATUSBAR | |
163 | ||
164 | // ---------------------------------------------------------------------------- | |
165 | // creation/destruction | |
166 | // ---------------------------------------------------------------------------- | |
167 | ||
168 | void wxFrame::Init() | |
169 | { | |
170 | #if wxUSE_MENUS | |
171 | m_hMenu = NULL; | |
172 | #endif // wxUSE_MENUS | |
173 | ||
174 | #if wxUSE_TOOLTIPS | |
175 | m_hwndToolTip = 0; | |
176 | #endif | |
177 | ||
178 | m_wasMinimized = false; | |
179 | } | |
180 | ||
181 | bool wxFrame::Create(wxWindow *parent, | |
182 | wxWindowID id, | |
183 | const wxString& title, | |
184 | const wxPoint& pos, | |
185 | const wxSize& size, | |
186 | long style, | |
187 | const wxString& name) | |
188 | { | |
189 | if ( !wxTopLevelWindow::Create(parent, id, title, pos, size, style, name) ) | |
190 | return false; | |
191 | ||
192 | SetOwnBackgroundColour(wxSystemSettings::GetColour(wxSYS_COLOUR_APPWORKSPACE)); | |
193 | ||
194 | #if defined(__SMARTPHONE__) | |
195 | SetLeftMenu(wxID_EXIT, _("Done")); | |
196 | #endif | |
197 | ||
198 | #if wxUSE_ACCEL && defined(__POCKETPC__) | |
199 | // The guidelines state that Ctrl+Q should quit the app. | |
200 | // Let's define an accelerator table to send wxID_EXIT. | |
201 | wxAcceleratorEntry entries[1]; | |
202 | entries[0].Set(wxACCEL_CTRL, 'Q', wxID_EXIT); | |
203 | wxAcceleratorTable accel(1, entries); | |
204 | SetAcceleratorTable(accel); | |
205 | #endif // wxUSE_ACCEL && __POCKETPC__ | |
206 | ||
207 | return true; | |
208 | } | |
209 | ||
210 | wxFrame::~wxFrame() | |
211 | { | |
212 | m_isBeingDeleted = true; | |
213 | DeleteAllBars(); | |
214 | } | |
215 | ||
216 | // ---------------------------------------------------------------------------- | |
217 | // wxFrame client size calculations | |
218 | // ---------------------------------------------------------------------------- | |
219 | ||
220 | void wxFrame::DoSetClientSize(int width, int height) | |
221 | { | |
222 | // leave enough space for the status bar if we have (and show) it | |
223 | #if wxUSE_STATUSBAR | |
224 | wxStatusBar *statbar = GetStatusBar(); | |
225 | if ( statbar && statbar->IsShown() ) | |
226 | { | |
227 | height += statbar->GetSize().y; | |
228 | } | |
229 | #endif // wxUSE_STATUSBAR | |
230 | ||
231 | // call GetClientAreaOrigin() to take the toolbar into account | |
232 | wxPoint pt = GetClientAreaOrigin(); | |
233 | width += pt.x; | |
234 | height += pt.y; | |
235 | ||
236 | #if wxUSE_TOOLBAR | |
237 | wxToolBar * const toolbar = GetToolBar(); | |
238 | if ( toolbar ) | |
239 | { | |
240 | if ( toolbar->HasFlag(wxTB_RIGHT | wxTB_BOTTOM) ) | |
241 | { | |
242 | const wxSize sizeTB = toolbar->GetSize(); | |
243 | if ( toolbar->HasFlag(wxTB_RIGHT) ) | |
244 | width -= sizeTB.x; | |
245 | else // wxTB_BOTTOM | |
246 | height -= sizeTB.y; | |
247 | } | |
248 | //else: toolbar already taken into account by GetClientAreaOrigin() | |
249 | } | |
250 | #endif // wxUSE_TOOLBAR | |
251 | ||
252 | wxTopLevelWindow::DoSetClientSize(width, height); | |
253 | } | |
254 | ||
255 | // Get size *available for subwindows* i.e. excluding menu bar, toolbar etc. | |
256 | void wxFrame::DoGetClientSize(int *x, int *y) const | |
257 | { | |
258 | wxTopLevelWindow::DoGetClientSize(x, y); | |
259 | ||
260 | // account for the possible toolbar | |
261 | wxPoint pt = GetClientAreaOrigin(); | |
262 | if ( x ) | |
263 | *x -= pt.x; | |
264 | ||
265 | if ( y ) | |
266 | *y -= pt.y; | |
267 | ||
268 | #if wxUSE_TOOLBAR | |
269 | wxToolBar * const toolbar = GetToolBar(); | |
270 | if ( toolbar ) | |
271 | { | |
272 | if ( toolbar->HasFlag(wxTB_RIGHT | wxTB_BOTTOM) ) | |
273 | { | |
274 | const wxSize sizeTB = toolbar->GetSize(); | |
275 | if ( toolbar->HasFlag(wxTB_RIGHT) ) | |
276 | { | |
277 | if ( x ) | |
278 | *x -= sizeTB.x; | |
279 | } | |
280 | else // wxTB_BOTTOM | |
281 | { | |
282 | if ( y ) | |
283 | *y -= sizeTB.y; | |
284 | } | |
285 | } | |
286 | //else: toolbar already taken into account by GetClientAreaOrigin() | |
287 | } | |
288 | #endif // wxUSE_TOOLBAR | |
289 | ||
290 | #if wxUSE_STATUSBAR | |
291 | // adjust client area height to take the status bar into account | |
292 | if ( y ) | |
293 | { | |
294 | wxStatusBar *statbar = GetStatusBar(); | |
295 | if ( statbar && statbar->IsShown() ) | |
296 | { | |
297 | *y -= statbar->GetClientSize().y; | |
298 | } | |
299 | } | |
300 | #endif // wxUSE_STATUSBAR | |
301 | } | |
302 | ||
303 | // ---------------------------------------------------------------------------- | |
304 | // wxFrame: various geometry-related functions | |
305 | // ---------------------------------------------------------------------------- | |
306 | ||
307 | void wxFrame::Raise() | |
308 | { | |
309 | ::SetForegroundWindow(GetHwnd()); | |
310 | } | |
311 | ||
312 | // generate an artificial resize event | |
313 | void wxFrame::SendSizeEvent() | |
314 | { | |
315 | if ( !m_iconized ) | |
316 | { | |
317 | RECT r = wxGetWindowRect(GetHwnd()); | |
318 | ||
319 | (void)::PostMessage(GetHwnd(), WM_SIZE, | |
320 | IsMaximized() ? SIZE_MAXIMIZED : SIZE_RESTORED, | |
321 | MAKELPARAM(r.right - r.left, r.bottom - r.top)); | |
322 | } | |
323 | } | |
324 | ||
325 | #if wxUSE_STATUSBAR | |
326 | wxStatusBar *wxFrame::OnCreateStatusBar(int number, | |
327 | long style, | |
328 | wxWindowID id, | |
329 | const wxString& name) | |
330 | { | |
331 | wxStatusBar *statusBar wxDUMMY_INITIALIZE(NULL); | |
332 | ||
333 | #if wxUSE_NATIVE_STATUSBAR | |
334 | if ( !UsesNativeStatusBar() ) | |
335 | { | |
336 | statusBar = (wxStatusBar *)new wxStatusBarGeneric(this, id, style); | |
337 | } | |
338 | else | |
339 | #endif | |
340 | { | |
341 | statusBar = new wxStatusBar(this, id, style, name); | |
342 | } | |
343 | ||
344 | statusBar->SetFieldsCount(number); | |
345 | ||
346 | return statusBar; | |
347 | } | |
348 | ||
349 | void wxFrame::PositionStatusBar() | |
350 | { | |
351 | if ( !m_frameStatusBar || !m_frameStatusBar->IsShown() ) | |
352 | return; | |
353 | ||
354 | int w, h; | |
355 | GetClientSize(&w, &h); | |
356 | ||
357 | int sw, sh; | |
358 | m_frameStatusBar->GetSize(&sw, &sh); | |
359 | ||
360 | int x = 0; | |
361 | #if wxUSE_TOOLBAR | |
362 | wxToolBar * const toolbar = GetToolBar(); | |
363 | if ( toolbar && !toolbar->HasFlag(wxTB_TOP) ) | |
364 | { | |
365 | const wxSize sizeTB = toolbar->GetSize(); | |
366 | ||
367 | if ( toolbar->HasFlag(wxTB_LEFT | wxTB_RIGHT) ) | |
368 | { | |
369 | if ( toolbar->HasFlag(wxTB_LEFT) ) | |
370 | x -= sizeTB.x; | |
371 | ||
372 | w += sizeTB.x; | |
373 | } | |
374 | else // wxTB_BOTTOM | |
375 | { | |
376 | // we need to position the status bar below the toolbar | |
377 | h += sizeTB.y; | |
378 | } | |
379 | } | |
380 | //else: no adjustments necessary for the toolbar on top | |
381 | #endif // wxUSE_TOOLBAR | |
382 | ||
383 | // Since we wish the status bar to be directly under the client area, | |
384 | // we use the adjusted sizes without using wxSIZE_NO_ADJUSTMENTS. | |
385 | m_frameStatusBar->SetSize(x, h, w, sh); | |
386 | } | |
387 | ||
388 | #endif // wxUSE_STATUSBAR | |
389 | ||
390 | #if wxUSE_MENUS_NATIVE | |
391 | ||
392 | void wxFrame::AttachMenuBar(wxMenuBar *menubar) | |
393 | { | |
394 | #if defined(__SMARTPHONE__) && defined(__WXWINCE__) | |
395 | ||
396 | wxMenu *autoMenu = NULL; | |
397 | ||
398 | if( menubar->GetMenuCount() == 1 ) | |
399 | { | |
400 | autoMenu = wxTopLevelWindowMSW::ButtonMenu::DuplicateMenu(menubar->GetMenu(0)); | |
401 | SetRightMenu(wxID_ANY, menubar->GetMenuLabel(0), autoMenu); | |
402 | } | |
403 | else | |
404 | { | |
405 | autoMenu = new wxMenu; | |
406 | ||
407 | for( size_t n = 0; n < menubar->GetMenuCount(); n++ ) | |
408 | { | |
409 | wxMenu *item = menubar->GetMenu(n); | |
410 | wxString label = menubar->GetMenuLabel(n); | |
411 | wxMenu *new_item = wxTopLevelWindowMSW::ButtonMenu::DuplicateMenu(item); | |
412 | autoMenu->Append(wxID_ANY, label, new_item); | |
413 | } | |
414 | ||
415 | SetRightMenu(wxID_ANY, _("Menu"), autoMenu); | |
416 | } | |
417 | ||
418 | #elif defined(WINCE_WITHOUT_COMMANDBAR) | |
419 | if (!GetToolBar()) | |
420 | { | |
421 | wxToolMenuBar* toolBar = new wxToolMenuBar(this, wxID_ANY, | |
422 | wxDefaultPosition, wxDefaultSize, | |
423 | wxBORDER_NONE | wxTB_HORIZONTAL, | |
424 | wxToolBarNameStr, menubar); | |
425 | SetToolBar(toolBar); | |
426 | menubar->SetToolBar(toolBar); | |
427 | } | |
428 | // Now adjust size for menu bar | |
429 | int menuHeight = 26; | |
430 | ||
431 | //When the main window is created using CW_USEDEFAULT the height of the | |
432 | // is created is not taken into account). So we resize the window after | |
433 | // if a menubar is present | |
434 | { | |
435 | RECT rc; | |
436 | ::GetWindowRect((HWND) GetHWND(), &rc); | |
437 | // adjust for menu / titlebar height | |
438 | rc.bottom -= (2*menuHeight-1); | |
439 | ||
440 | ::MoveWindow((HWND) GetHWND(), rc.left, rc.top, rc.right, rc.bottom, FALSE); | |
441 | } | |
442 | #endif | |
443 | ||
444 | wxFrameBase::AttachMenuBar(menubar); | |
445 | ||
446 | if ( !menubar ) | |
447 | { | |
448 | // actually remove the menu from the frame | |
449 | m_hMenu = (WXHMENU)0; | |
450 | InternalSetMenuBar(); | |
451 | } | |
452 | else // set new non NULL menu bar | |
453 | { | |
454 | #if !defined(__WXWINCE__) || defined(WINCE_WITH_COMMANDBAR) | |
455 | // Can set a menubar several times. | |
456 | if ( menubar->GetHMenu() ) | |
457 | { | |
458 | m_hMenu = menubar->GetHMenu(); | |
459 | } | |
460 | else // no HMENU yet | |
461 | { | |
462 | m_hMenu = menubar->Create(); | |
463 | ||
464 | if ( !m_hMenu ) | |
465 | { | |
466 | wxFAIL_MSG( _T("failed to create menu bar") ); | |
467 | return; | |
468 | } | |
469 | } | |
470 | #endif | |
471 | InternalSetMenuBar(); | |
472 | } | |
473 | } | |
474 | ||
475 | void wxFrame::InternalSetMenuBar() | |
476 | { | |
477 | #if defined(__WXMICROWIN__) || defined(__WXWINCE__) | |
478 | // Nothing | |
479 | #else | |
480 | if ( !::SetMenu(GetHwnd(), (HMENU)m_hMenu) ) | |
481 | { | |
482 | wxLogLastError(wxT("SetMenu")); | |
483 | } | |
484 | #endif | |
485 | } | |
486 | ||
487 | #endif // wxUSE_MENUS_NATIVE | |
488 | ||
489 | // Responds to colour changes, and passes event on to children. | |
490 | void wxFrame::OnSysColourChanged(wxSysColourChangedEvent& event) | |
491 | { | |
492 | SetOwnBackgroundColour(wxSystemSettings::GetColour(wxSYS_COLOUR_APPWORKSPACE)); | |
493 | Refresh(); | |
494 | ||
495 | #if wxUSE_STATUSBAR | |
496 | if ( m_frameStatusBar ) | |
497 | { | |
498 | wxSysColourChangedEvent event2; | |
499 | event2.SetEventObject( m_frameStatusBar ); | |
500 | m_frameStatusBar->HandleWindowEvent(event2); | |
501 | } | |
502 | #endif // wxUSE_STATUSBAR | |
503 | ||
504 | // Propagate the event to the non-top-level children | |
505 | wxWindow::OnSysColourChanged(event); | |
506 | } | |
507 | ||
508 | // Pass true to show full screen, false to restore. | |
509 | bool wxFrame::ShowFullScreen(bool show, long style) | |
510 | { | |
511 | // TODO-CE: add support for CE | |
512 | #if !defined(__WXMICROWIN__) && !defined(__WXWINCE__) | |
513 | if ( IsFullScreen() == show ) | |
514 | return false; | |
515 | ||
516 | if (show) | |
517 | { | |
518 | // zap the toolbar, menubar, and statusbar if needed | |
519 | // | |
520 | // TODO: hide commandbar for WINCE_WITH_COMMANDBAR | |
521 | #if wxUSE_TOOLBAR | |
522 | wxToolBar *theToolBar = GetToolBar(); | |
523 | ||
524 | if ((style & wxFULLSCREEN_NOTOOLBAR) && theToolBar) | |
525 | { | |
526 | if ( theToolBar->IsShown() ) | |
527 | { | |
528 | theToolBar->SetSize(wxDefaultCoord,0); | |
529 | theToolBar->Show(false); | |
530 | } | |
531 | else // prevent it from being restored later | |
532 | { | |
533 | style &= ~wxFULLSCREEN_NOTOOLBAR; | |
534 | } | |
535 | } | |
536 | #endif // wxUSE_TOOLBAR | |
537 | ||
538 | if (style & wxFULLSCREEN_NOMENUBAR) | |
539 | SetMenu((HWND)GetHWND(), (HMENU) NULL); | |
540 | ||
541 | #if wxUSE_STATUSBAR | |
542 | wxStatusBar *theStatusBar = GetStatusBar(); | |
543 | ||
544 | // Save the number of fields in the statusbar | |
545 | if ((style & wxFULLSCREEN_NOSTATUSBAR) && theStatusBar) | |
546 | { | |
547 | if ( theStatusBar->IsShown() ) | |
548 | theStatusBar->Show(false); | |
549 | else | |
550 | style &= ~wxFULLSCREEN_NOSTATUSBAR; | |
551 | } | |
552 | #endif // wxUSE_STATUSBAR | |
553 | } | |
554 | else // restore to normal | |
555 | { | |
556 | // restore the toolbar, menubar, and statusbar if we had hid them | |
557 | #if wxUSE_TOOLBAR | |
558 | wxToolBar *theToolBar = GetToolBar(); | |
559 | ||
560 | if ((m_fsStyle & wxFULLSCREEN_NOTOOLBAR) && theToolBar) | |
561 | { | |
562 | theToolBar->Show(true); | |
563 | } | |
564 | #endif // wxUSE_TOOLBAR | |
565 | ||
566 | #if wxUSE_MENUS | |
567 | if (m_fsStyle & wxFULLSCREEN_NOMENUBAR) | |
568 | { | |
569 | WXHMENU menu = m_hMenu; | |
570 | ||
571 | #if wxUSE_MDI_ARCHITECTURE | |
572 | wxMDIParentFrame *frame = wxDynamicCast(this, wxMDIParentFrame); | |
573 | if (frame) | |
574 | { | |
575 | wxMDIChildFrame *child = frame->GetActiveChild(); | |
576 | if (child) | |
577 | { | |
578 | menu = child->GetWinMenu(); | |
579 | } | |
580 | } | |
581 | #endif // wxUSE_MDI_ARCHITECTURE | |
582 | ||
583 | if (menu) | |
584 | { | |
585 | ::SetMenu(GetHwnd(), (HMENU)menu); | |
586 | } | |
587 | } | |
588 | #endif // wxUSE_MENUS | |
589 | ||
590 | #if wxUSE_STATUSBAR | |
591 | wxStatusBar *theStatusBar = GetStatusBar(); | |
592 | ||
593 | if ((m_fsStyle & wxFULLSCREEN_NOSTATUSBAR) && theStatusBar) | |
594 | { | |
595 | theStatusBar->Show(true); | |
596 | PositionStatusBar(); | |
597 | } | |
598 | #endif // wxUSE_STATUSBAR | |
599 | } | |
600 | #endif // !defined(__WXMICROWIN__) && !defined(__WXWINCE__) | |
601 | ||
602 | return wxFrameBase::ShowFullScreen(show, style); | |
603 | } | |
604 | ||
605 | // ---------------------------------------------------------------------------- | |
606 | // tool/status bar stuff | |
607 | // ---------------------------------------------------------------------------- | |
608 | ||
609 | #if wxUSE_TOOLBAR | |
610 | ||
611 | wxToolBar* wxFrame::CreateToolBar(long style, wxWindowID id, const wxString& name) | |
612 | { | |
613 | #if defined(WINCE_WITHOUT_COMMANDBAR) | |
614 | // We may already have a toolbar from calling SetMenuBar. | |
615 | if (GetToolBar()) | |
616 | return GetToolBar(); | |
617 | #endif | |
618 | if ( wxFrameBase::CreateToolBar(style, id, name) ) | |
619 | { | |
620 | PositionToolBar(); | |
621 | } | |
622 | ||
623 | return m_frameToolBar; | |
624 | } | |
625 | ||
626 | void wxFrame::PositionToolBar() | |
627 | { | |
628 | // TODO: we want to do something different in WinCE, because the toolbar | |
629 | // should be associated with the commandbar, instead of being | |
630 | // independent window. | |
631 | #if !defined(WINCE_WITHOUT_COMMANDBAR) | |
632 | wxToolBar *toolbar = GetToolBar(); | |
633 | if ( toolbar && toolbar->IsShown() ) | |
634 | { | |
635 | // don't call our (or even wxTopLevelWindow) version because we want | |
636 | // the real (full) client area size, not excluding the tool/status bar | |
637 | int width, height; | |
638 | wxWindow::DoGetClientSize(&width, &height); | |
639 | ||
640 | #if wxUSE_STATUSBAR | |
641 | wxStatusBar *statbar = GetStatusBar(); | |
642 | if ( statbar && statbar->IsShown() ) | |
643 | { | |
644 | height -= statbar->GetClientSize().y; | |
645 | } | |
646 | #endif // wxUSE_STATUSBAR | |
647 | ||
648 | int tx, ty, tw, th; | |
649 | toolbar->GetPosition( &tx, &ty ); | |
650 | toolbar->GetSize( &tw, &th ); | |
651 | ||
652 | int x = 0, y = 0; | |
653 | if ( toolbar->HasFlag(wxTB_BOTTOM) ) | |
654 | { | |
655 | x = 0; | |
656 | y = height - th; | |
657 | } | |
658 | else if ( toolbar->HasFlag(wxTB_RIGHT) ) | |
659 | { | |
660 | x = width - tw; | |
661 | y = 0; | |
662 | } | |
663 | else // left or top | |
664 | { | |
665 | x = 0; | |
666 | y = 0; | |
667 | } | |
668 | ||
669 | #if defined(WINCE_WITH_COMMANDBAR) | |
670 | // We're using a commandbar - so we have to allow for it. | |
671 | if (GetMenuBar() && GetMenuBar()->GetCommandBar()) | |
672 | { | |
673 | RECT rect; | |
674 | ::GetWindowRect((HWND) GetMenuBar()->GetCommandBar(), &rect); | |
675 | y = rect.bottom - rect.top; | |
676 | } | |
677 | #endif // WINCE_WITH_COMMANDBAR | |
678 | ||
679 | if ( toolbar->HasFlag(wxTB_BOTTOM) ) | |
680 | { | |
681 | if ( ty < 0 && ( -ty == th ) ) | |
682 | ty = height - th; | |
683 | if ( tx < 0 && (-tx == tw ) ) | |
684 | tx = 0; | |
685 | } | |
686 | else if ( toolbar->HasFlag(wxTB_RIGHT) ) | |
687 | { | |
688 | if( ty < 0 && ( -ty == th ) ) | |
689 | ty = 0; | |
690 | if( tx < 0 && ( -tx == tw ) ) | |
691 | tx = width - tw; | |
692 | } | |
693 | else // left or top | |
694 | { | |
695 | if (ty < 0 && (-ty == th)) | |
696 | ty = 0; | |
697 | if (tx < 0 && (-tx == tw)) | |
698 | tx = 0; | |
699 | } | |
700 | ||
701 | int desiredW = tw; | |
702 | int desiredH = th; | |
703 | ||
704 | if ( toolbar->IsVertical() ) | |
705 | { | |
706 | desiredH = height; | |
707 | } | |
708 | else | |
709 | { | |
710 | desiredW = width; | |
711 | } | |
712 | ||
713 | // use the 'real' MSW position here, don't offset relativly to the | |
714 | // client area origin | |
715 | ||
716 | // Optimise such that we don't have to always resize the toolbar | |
717 | // when the frame changes, otherwise we'll get a lot of flicker. | |
718 | bool heightChanging wxDUMMY_INITIALIZE(true); | |
719 | bool widthChanging wxDUMMY_INITIALIZE(true); | |
720 | ||
721 | if ( toolbar->IsVertical() ) | |
722 | { | |
723 | // It's OK if the current height is greater than what can be shown. | |
724 | heightChanging = (desiredH > th) ; | |
725 | widthChanging = (desiredW != tw) ; | |
726 | ||
727 | // The next time around, we may not have to set the size | |
728 | if (heightChanging) | |
729 | desiredH = desiredH + 200; | |
730 | } | |
731 | else | |
732 | { | |
733 | // It's OK if the current width is greater than what can be shown. | |
734 | widthChanging = (desiredW > tw) ; | |
735 | heightChanging = (desiredH != th) ; | |
736 | ||
737 | // The next time around, we may not have to set the size | |
738 | if (widthChanging) | |
739 | desiredW = desiredW + 200; | |
740 | } | |
741 | ||
742 | if (tx != 0 || ty != 0 || widthChanging || heightChanging) | |
743 | toolbar->SetSize(x, y, desiredW, desiredH, wxSIZE_NO_ADJUSTMENTS); | |
744 | ||
745 | } | |
746 | #endif // !WINCE_WITH_COMMANDBAR | |
747 | } | |
748 | ||
749 | #endif // wxUSE_TOOLBAR | |
750 | ||
751 | // ---------------------------------------------------------------------------- | |
752 | // frame state (iconized/maximized/...) | |
753 | // ---------------------------------------------------------------------------- | |
754 | ||
755 | // propagate our state change to all child frames: this allows us to emulate X | |
756 | // Windows behaviour where child frames float independently of the parent one | |
757 | // on the desktop, but are iconized/restored with it | |
758 | void wxFrame::IconizeChildFrames(bool bIconize) | |
759 | { | |
760 | m_iconized = bIconize; | |
761 | ||
762 | for ( wxWindowList::compatibility_iterator node = GetChildren().GetFirst(); | |
763 | node; | |
764 | node = node->GetNext() ) | |
765 | { | |
766 | wxWindow *win = node->GetData(); | |
767 | ||
768 | // iconizing the frames with this style under Win95 shell puts them at | |
769 | // the bottom of the screen (as the MDI children) instead of making | |
770 | // them appear in the taskbar because they are, by virtue of this | |
771 | // style, not managed by the taskbar - instead leave Windows take care | |
772 | // of them | |
773 | if ( win->GetWindowStyle() & wxFRAME_TOOL_WINDOW ) | |
774 | continue; | |
775 | ||
776 | // the child MDI frames are a special case and should not be touched by | |
777 | // the parent frame - instead, they are managed by the user | |
778 | wxFrame *frame = wxDynamicCast(win, wxFrame); | |
779 | if ( frame | |
780 | #if wxUSE_MDI_ARCHITECTURE | |
781 | && !frame->IsMDIChild() | |
782 | #endif // wxUSE_MDI_ARCHITECTURE | |
783 | ) | |
784 | { | |
785 | // we don't want to restore the child frames which had been | |
786 | // iconized even before we were iconized, so save the child frame | |
787 | // status when iconizing the parent frame and check it when | |
788 | // restoring it | |
789 | if ( bIconize ) | |
790 | { | |
791 | frame->m_wasMinimized = frame->IsIconized(); | |
792 | } | |
793 | ||
794 | // note that we shouldn't touch the hidden frames neither because | |
795 | // iconizing/restoring them would show them as a side effect | |
796 | if ( !frame->m_wasMinimized && frame->IsShown() ) | |
797 | frame->Iconize(bIconize); | |
798 | } | |
799 | } | |
800 | } | |
801 | ||
802 | WXHICON wxFrame::GetDefaultIcon() const | |
803 | { | |
804 | // we don't have any standard icons (any more) | |
805 | return (WXHICON)0; | |
806 | } | |
807 | ||
808 | // =========================================================================== | |
809 | // message processing | |
810 | // =========================================================================== | |
811 | ||
812 | // --------------------------------------------------------------------------- | |
813 | // preprocessing | |
814 | // --------------------------------------------------------------------------- | |
815 | ||
816 | bool wxFrame::MSWDoTranslateMessage(wxFrame *frame, WXMSG *pMsg) | |
817 | { | |
818 | if ( wxWindow::MSWTranslateMessage(pMsg) ) | |
819 | return true; | |
820 | ||
821 | #if wxUSE_MENUS && wxUSE_ACCEL && !defined(__WXUNIVERSAL__) | |
822 | // try the menu bar accels | |
823 | wxMenuBar *menuBar = GetMenuBar(); | |
824 | if ( menuBar ) | |
825 | { | |
826 | const wxAcceleratorTable& acceleratorTable = menuBar->GetAccelTable(); | |
827 | return acceleratorTable.Translate(frame, pMsg); | |
828 | } | |
829 | #endif // wxUSE_MENUS && wxUSE_ACCEL | |
830 | ||
831 | return false; | |
832 | } | |
833 | ||
834 | // --------------------------------------------------------------------------- | |
835 | // our private (non virtual) message handlers | |
836 | // --------------------------------------------------------------------------- | |
837 | ||
838 | bool wxFrame::HandlePaint() | |
839 | { | |
840 | RECT rect; | |
841 | if ( ::GetUpdateRect(GetHwnd(), &rect, FALSE) ) | |
842 | { | |
843 | #if !defined(__WXMICROWIN__) && !defined(__WXWINCE__) | |
844 | if ( m_iconized ) | |
845 | { | |
846 | const wxIcon& icon = GetIcon(); | |
847 | HICON hIcon = icon.Ok() ? GetHiconOf(icon) | |
848 | : (HICON)GetDefaultIcon(); | |
849 | ||
850 | // Hold a pointer to the dc so long as the OnPaint() message | |
851 | // is being processed | |
852 | PAINTSTRUCT ps; | |
853 | HDC hdc = ::BeginPaint(GetHwnd(), &ps); | |
854 | ||
855 | // Erase background before painting or we get white background | |
856 | MSWDefWindowProc(WM_ICONERASEBKGND, (WORD)(LONG)ps.hdc, 0L); | |
857 | ||
858 | if ( hIcon ) | |
859 | { | |
860 | RECT rect; | |
861 | ::GetClientRect(GetHwnd(), &rect); | |
862 | ||
863 | // FIXME: why hardcoded? | |
864 | static const int icon_width = 32; | |
865 | static const int icon_height = 32; | |
866 | ||
867 | int icon_x = (int)((rect.right - icon_width)/2); | |
868 | int icon_y = (int)((rect.bottom - icon_height)/2); | |
869 | ||
870 | ::DrawIcon(hdc, icon_x, icon_y, hIcon); | |
871 | } | |
872 | ||
873 | ::EndPaint(GetHwnd(), &ps); | |
874 | ||
875 | return true; | |
876 | } | |
877 | else | |
878 | #endif | |
879 | { | |
880 | return wxWindow::HandlePaint(); | |
881 | } | |
882 | } | |
883 | else | |
884 | { | |
885 | // nothing to paint - processed | |
886 | return true; | |
887 | } | |
888 | } | |
889 | ||
890 | bool wxFrame::HandleSize(int WXUNUSED(x), int WXUNUSED(y), WXUINT id) | |
891 | { | |
892 | #if !defined(__WXMICROWIN__) && !defined(__WXWINCE__) | |
893 | switch ( id ) | |
894 | { | |
895 | case SIZE_RESTORED: | |
896 | case SIZE_MAXIMIZED: | |
897 | // only do it it if we were iconized before, otherwise resizing the | |
898 | // parent frame has a curious side effect of bringing it under it's | |
899 | // children | |
900 | if ( !m_iconized ) | |
901 | break; | |
902 | ||
903 | // restore all child frames too | |
904 | IconizeChildFrames(false); | |
905 | ||
906 | (void)SendIconizeEvent(false); | |
907 | break; | |
908 | ||
909 | case SIZE_MINIMIZED: | |
910 | // iconize all child frames too | |
911 | IconizeChildFrames(true); | |
912 | break; | |
913 | } | |
914 | #else | |
915 | wxUnusedVar(id); | |
916 | #endif // !__WXWINCE__ | |
917 | ||
918 | if ( !m_iconized ) | |
919 | { | |
920 | #if wxUSE_STATUSBAR | |
921 | PositionStatusBar(); | |
922 | #endif // wxUSE_STATUSBAR | |
923 | ||
924 | #if wxUSE_TOOLBAR | |
925 | PositionToolBar(); | |
926 | #endif // wxUSE_TOOLBAR | |
927 | ||
928 | #if defined(WINCE_WITH_COMMANDBAR) | |
929 | // Position the menu command bar | |
930 | if (GetMenuBar() && GetMenuBar()->GetCommandBar()) | |
931 | { | |
932 | RECT rect; | |
933 | ::GetWindowRect((HWND) GetMenuBar()->GetCommandBar(), &rect); | |
934 | wxSize clientSz = GetClientSize(); | |
935 | ||
936 | if ( !::MoveWindow((HWND) GetMenuBar()->GetCommandBar(), 0, 0, clientSz.x, rect.bottom - rect.top, true ) ) | |
937 | { | |
938 | wxLogLastError(wxT("MoveWindow")); | |
939 | } | |
940 | ||
941 | } | |
942 | #endif // WINCE_WITH_COMMANDBAR | |
943 | } | |
944 | ||
945 | // call the base class version to generate the appropriate events | |
946 | return false; | |
947 | } | |
948 | ||
949 | bool wxFrame::HandleCommand(WXWORD id_, WXWORD cmd, WXHWND control) | |
950 | { | |
951 | // sign extend to int from short before comparing with the other int ids | |
952 | int id = (signed short)id_; | |
953 | ||
954 | if ( control ) | |
955 | { | |
956 | // In case it's e.g. a toolbar. | |
957 | wxWindow *win = wxFindWinFromHandle(control); | |
958 | if ( win ) | |
959 | return win->MSWCommand(cmd, id); | |
960 | } | |
961 | ||
962 | // handle here commands from menus and accelerators | |
963 | if ( cmd == 0 || cmd == 1 ) | |
964 | { | |
965 | #if wxUSE_MENUS_NATIVE | |
966 | if ( wxCurrentPopupMenu ) | |
967 | { | |
968 | wxMenu *popupMenu = wxCurrentPopupMenu; | |
969 | wxCurrentPopupMenu = NULL; | |
970 | ||
971 | return popupMenu->MSWCommand(cmd, id); | |
972 | } | |
973 | #endif // wxUSE_MENUS_NATIVE | |
974 | ||
975 | #if defined(__SMARTPHONE__) && defined(__WXWINCE__) | |
976 | // handle here commands from Smartphone menu bar | |
977 | if ( wxTopLevelWindow::HandleCommand(id, cmd, control ) ) | |
978 | { | |
979 | return true; | |
980 | } | |
981 | #endif // __SMARTPHONE__ && __WXWINCE__ | |
982 | ||
983 | if ( ProcessCommand(id) ) | |
984 | { | |
985 | return true; | |
986 | } | |
987 | } | |
988 | ||
989 | return false; | |
990 | } | |
991 | ||
992 | #if wxUSE_MENUS | |
993 | ||
994 | bool wxFrame::HandleMenuSelect(WXWORD nItem, WXWORD flags, WXHMENU hMenu) | |
995 | { | |
996 | int item; | |
997 | if ( flags == 0xFFFF && hMenu == 0 ) | |
998 | { | |
999 | // menu was removed from screen | |
1000 | item = -1; | |
1001 | } | |
1002 | #ifndef __WXMICROWIN__ | |
1003 | else if ( !(flags & MF_POPUP) && !(flags & MF_SEPARATOR) ) | |
1004 | { | |
1005 | item = nItem; | |
1006 | } | |
1007 | #endif | |
1008 | else | |
1009 | { | |
1010 | // don't give hints for separators (doesn't make sense) nor for the | |
1011 | // items opening popup menus (they don't have them anyhow) but do clear | |
1012 | // the status line - otherwise, we would be left with the help message | |
1013 | // for the previous item which doesn't apply any more | |
1014 | DoGiveHelp(wxEmptyString, true); | |
1015 | ||
1016 | return false; | |
1017 | } | |
1018 | ||
1019 | wxMenuEvent event(wxEVT_MENU_HIGHLIGHT, item); | |
1020 | event.SetEventObject(this); | |
1021 | ||
1022 | return HandleWindowEvent(event); | |
1023 | } | |
1024 | ||
1025 | bool wxFrame::HandleMenuLoop(const wxEventType& evtType, WXWORD isPopup) | |
1026 | { | |
1027 | // we don't have the menu id here, so we use the id to specify if the event | |
1028 | // was from a popup menu or a normal one | |
1029 | wxMenuEvent event(evtType, isPopup ? -1 : 0); | |
1030 | event.SetEventObject(this); | |
1031 | ||
1032 | return HandleWindowEvent(event); | |
1033 | } | |
1034 | ||
1035 | bool wxFrame::HandleInitMenuPopup(WXHMENU hMenu) | |
1036 | { | |
1037 | wxMenu* menu = NULL; | |
1038 | if (GetMenuBar()) | |
1039 | { | |
1040 | int nCount = GetMenuBar()->GetMenuCount(); | |
1041 | for (int n = 0; n < nCount; n++) | |
1042 | { | |
1043 | if (GetMenuBar()->GetMenu(n)->GetHMenu() == hMenu) | |
1044 | { | |
1045 | menu = GetMenuBar()->GetMenu(n); | |
1046 | break; | |
1047 | } | |
1048 | } | |
1049 | } | |
1050 | ||
1051 | wxMenuEvent event(wxEVT_MENU_OPEN, 0, menu); | |
1052 | event.SetEventObject(this); | |
1053 | ||
1054 | return HandleWindowEvent(event); | |
1055 | } | |
1056 | ||
1057 | #endif // wxUSE_MENUS | |
1058 | ||
1059 | // --------------------------------------------------------------------------- | |
1060 | // the window proc for wxFrame | |
1061 | // --------------------------------------------------------------------------- | |
1062 | ||
1063 | WXLRESULT wxFrame::MSWWindowProc(WXUINT message, WXWPARAM wParam, WXLPARAM lParam) | |
1064 | { | |
1065 | WXLRESULT rc = 0; | |
1066 | bool processed = false; | |
1067 | ||
1068 | switch ( message ) | |
1069 | { | |
1070 | case WM_CLOSE: | |
1071 | // if we can't close, tell the system that we processed the | |
1072 | // message - otherwise it would close us | |
1073 | processed = !Close(); | |
1074 | break; | |
1075 | ||
1076 | case WM_SIZE: | |
1077 | processed = HandleSize(LOWORD(lParam), HIWORD(lParam), wParam); | |
1078 | break; | |
1079 | ||
1080 | case WM_COMMAND: | |
1081 | { | |
1082 | WORD id, cmd; | |
1083 | WXHWND hwnd; | |
1084 | UnpackCommand((WXWPARAM)wParam, (WXLPARAM)lParam, | |
1085 | &id, &hwnd, &cmd); | |
1086 | ||
1087 | processed = HandleCommand(id, cmd, (WXHWND)hwnd); | |
1088 | } | |
1089 | break; | |
1090 | ||
1091 | case WM_PAINT: | |
1092 | processed = HandlePaint(); | |
1093 | break; | |
1094 | ||
1095 | #if !defined(__WXMICROWIN__) && !defined(__WXWINCE__) | |
1096 | #if wxUSE_MENUS | |
1097 | case WM_INITMENUPOPUP: | |
1098 | processed = HandleInitMenuPopup((WXHMENU) wParam); | |
1099 | break; | |
1100 | ||
1101 | case WM_MENUSELECT: | |
1102 | { | |
1103 | WXWORD item, flags; | |
1104 | WXHMENU hmenu; | |
1105 | UnpackMenuSelect(wParam, lParam, &item, &flags, &hmenu); | |
1106 | ||
1107 | processed = HandleMenuSelect(item, flags, hmenu); | |
1108 | } | |
1109 | break; | |
1110 | ||
1111 | case WM_EXITMENULOOP: | |
1112 | processed = HandleMenuLoop(wxEVT_MENU_CLOSE, (WXWORD)wParam); | |
1113 | break; | |
1114 | #endif // wxUSE_MENUS | |
1115 | ||
1116 | case WM_QUERYDRAGICON: | |
1117 | { | |
1118 | const wxIcon& icon = GetIcon(); | |
1119 | HICON hIcon = icon.Ok() ? GetHiconOf(icon) | |
1120 | : (HICON)GetDefaultIcon(); | |
1121 | rc = (long)hIcon; | |
1122 | processed = rc != 0; | |
1123 | } | |
1124 | break; | |
1125 | #endif // !__WXMICROWIN__ | |
1126 | } | |
1127 | ||
1128 | if ( !processed ) | |
1129 | rc = wxFrameBase::MSWWindowProc(message, wParam, lParam); | |
1130 | ||
1131 | return rc; | |
1132 | } | |
1133 | ||
1134 | // ---------------------------------------------------------------------------- | |
1135 | // wxFrame size management: we exclude the areas taken by menu/status/toolbars | |
1136 | // from the client area, so the client area is what's really available for the | |
1137 | // frame contents | |
1138 | // ---------------------------------------------------------------------------- | |
1139 | ||
1140 | // get the origin of the client area in the client coordinates | |
1141 | wxPoint wxFrame::GetClientAreaOrigin() const | |
1142 | { | |
1143 | wxPoint pt = wxTopLevelWindow::GetClientAreaOrigin(); | |
1144 | ||
1145 | #if wxUSE_TOOLBAR && !defined(__WXUNIVERSAL__) && \ | |
1146 | (!defined(__WXWINCE__) || (_WIN32_WCE >= 400 && !defined(__POCKETPC__) && !defined(__SMARTPHONE__))) | |
1147 | wxToolBar * const toolbar = GetToolBar(); | |
1148 | if ( toolbar && toolbar->IsShown() ) | |
1149 | { | |
1150 | const wxSize sizeTB = toolbar->GetSize(); | |
1151 | ||
1152 | if ( toolbar->HasFlag(wxTB_TOP) ) | |
1153 | { | |
1154 | pt.y += sizeTB.y; | |
1155 | } | |
1156 | else if ( toolbar->HasFlag(wxTB_LEFT) ) | |
1157 | { | |
1158 | pt.x += sizeTB.x; | |
1159 | } | |
1160 | } | |
1161 | #endif // wxUSE_TOOLBAR | |
1162 | ||
1163 | #if defined(WINCE_WITH_COMMANDBAR) | |
1164 | if (GetMenuBar() && GetMenuBar()->GetCommandBar()) | |
1165 | { | |
1166 | RECT rect; | |
1167 | ::GetWindowRect((HWND) GetMenuBar()->GetCommandBar(), &rect); | |
1168 | pt.y += (rect.bottom - rect.top); | |
1169 | } | |
1170 | #endif | |
1171 | ||
1172 | return pt; | |
1173 | } |