1 /////////////////////////////////////////////////////////////////////////////
2 // Name: src/msw/frame.cpp
4 // Author: Julian Smart
8 // Copyright: (c) Julian Smart
9 // Licence: wxWindows licence
10 /////////////////////////////////////////////////////////////////////////////
12 // ============================================================================
14 // ============================================================================
16 // ----------------------------------------------------------------------------
18 // ----------------------------------------------------------------------------
20 // For compilers that support precompilation, includes "wx.h".
21 #include "wx/wxprec.h"
30 #include "wx/msw/wrapcctl.h" // include <commctrl.h> "properly"
34 #include "wx/dialog.h"
35 #include "wx/settings.h"
36 #include "wx/dcclient.h"
40 #include "wx/toolbar.h"
41 #include "wx/statusbr.h"
42 #include "wx/menuitem.h"
45 #include "wx/msw/private.h"
47 #if defined(__POCKETPC__) || defined(__SMARTPHONE__)
50 #include "wx/msw/winundef.h"
53 #include "wx/generic/statusbr.h"
55 #ifdef __WXUNIVERSAL__
56 #include "wx/univ/theme.h"
57 #include "wx/univ/colschem.h"
58 #endif // __WXUNIVERSAL__
60 // ----------------------------------------------------------------------------
62 // ----------------------------------------------------------------------------
64 #if wxUSE_MENUS_NATIVE
65 extern wxMenu
*wxCurrentPopupMenu
;
66 #endif // wxUSE_MENUS_NATIVE
68 // ----------------------------------------------------------------------------
70 // ----------------------------------------------------------------------------
72 BEGIN_EVENT_TABLE(wxFrame
, wxFrameBase
)
73 EVT_SYS_COLOUR_CHANGED(wxFrame::OnSysColourChanged
)
76 // ============================================================================
78 // ============================================================================
80 // ----------------------------------------------------------------------------
81 // static class members
82 // ----------------------------------------------------------------------------
85 #if wxUSE_NATIVE_STATUSBAR
86 bool wxFrame::m_useNativeStatusBar
= true;
88 bool wxFrame::m_useNativeStatusBar
= false;
90 #endif // wxUSE_NATIVE_STATUSBAR
92 // ----------------------------------------------------------------------------
93 // creation/destruction
94 // ----------------------------------------------------------------------------
100 #endif // wxUSE_MENUS
106 m_wasMinimized
= false;
109 bool wxFrame::Create(wxWindow
*parent
,
111 const wxString
& title
,
115 const wxString
& name
)
117 if ( !wxTopLevelWindow::Create(parent
, id
, title
, pos
, size
, style
, name
) )
120 SetOwnBackgroundColour(wxSystemSettings::GetColour(wxSYS_COLOUR_APPWORKSPACE
));
122 #if defined(__SMARTPHONE__)
123 SetLeftMenu(wxID_EXIT
, _("Done"));
126 #if wxUSE_ACCEL && defined(__POCKETPC__)
127 // The guidelines state that Ctrl+Q should quit the app.
128 // Let's define an accelerator table to send wxID_EXIT.
129 wxAcceleratorEntry entries
[1];
130 entries
[0].Set(wxACCEL_CTRL
, 'Q', wxID_EXIT
);
131 wxAcceleratorTable
accel(1, entries
);
132 SetAcceleratorTable(accel
);
133 #endif // wxUSE_ACCEL && __POCKETPC__
145 // ----------------------------------------------------------------------------
146 // wxFrame client size calculations
147 // ----------------------------------------------------------------------------
149 void wxFrame::DoSetClientSize(int width
, int height
)
151 // leave enough space for the status bar if we have (and show) it
153 wxStatusBar
*statbar
= GetStatusBar();
154 if ( statbar
&& statbar
->IsShown() )
156 height
+= statbar
->GetSize().y
;
158 #endif // wxUSE_STATUSBAR
160 // call GetClientAreaOrigin() to take the toolbar into account
161 wxPoint pt
= GetClientAreaOrigin();
166 wxToolBar
* const toolbar
= GetToolBar();
169 if ( toolbar
->HasFlag(wxTB_RIGHT
| wxTB_BOTTOM
) )
171 const wxSize sizeTB
= toolbar
->GetSize();
172 if ( toolbar
->HasFlag(wxTB_RIGHT
) )
177 //else: toolbar already taken into account by GetClientAreaOrigin()
179 #endif // wxUSE_TOOLBAR
181 wxTopLevelWindow::DoSetClientSize(width
, height
);
184 // Get size *available for subwindows* i.e. excluding menu bar, toolbar etc.
185 void wxFrame::DoGetClientSize(int *x
, int *y
) const
187 wxTopLevelWindow::DoGetClientSize(x
, y
);
189 // account for the possible toolbar
190 wxPoint pt
= GetClientAreaOrigin();
198 wxToolBar
* const toolbar
= GetToolBar();
201 if ( toolbar
->HasFlag(wxTB_RIGHT
| wxTB_BOTTOM
) )
203 const wxSize sizeTB
= toolbar
->GetSize();
204 if ( toolbar
->HasFlag(wxTB_RIGHT
) )
215 //else: toolbar already taken into account by GetClientAreaOrigin()
217 #endif // wxUSE_TOOLBAR
220 // adjust client area height to take the status bar into account
223 wxStatusBar
*statbar
= GetStatusBar();
224 if ( statbar
&& statbar
->IsShown() )
226 *y
-= statbar
->GetSize().y
;
229 #endif // wxUSE_STATUSBAR
232 // ----------------------------------------------------------------------------
233 // wxFrame: various geometry-related functions
234 // ----------------------------------------------------------------------------
236 void wxFrame::Raise()
238 ::SetForegroundWindow(GetHwnd());
241 // generate an artificial resize event
242 void wxFrame::SendSizeEvent(int flags
)
246 RECT r
= wxGetWindowRect(GetHwnd());
248 if ( flags
& wxSEND_EVENT_POST
)
250 ::PostMessage(GetHwnd(), WM_SIZE
,
251 IsMaximized() ? SIZE_MAXIMIZED
: SIZE_RESTORED
,
252 MAKELPARAM(r
.right
- r
.left
, r
.bottom
- r
.top
));
256 ::SendMessage(GetHwnd(), WM_SIZE
,
257 IsMaximized() ? SIZE_MAXIMIZED
: SIZE_RESTORED
,
258 MAKELPARAM(r
.right
- r
.left
, r
.bottom
- r
.top
));
264 wxStatusBar
*wxFrame::OnCreateStatusBar(int number
,
267 const wxString
& name
)
269 wxStatusBar
*statusBar
wxDUMMY_INITIALIZE(NULL
);
271 #if wxUSE_NATIVE_STATUSBAR
272 if ( !UsesNativeStatusBar() )
274 statusBar
= (wxStatusBar
*)new wxStatusBarGeneric(this, id
, style
);
279 statusBar
= new wxStatusBar(this, id
, style
, name
);
282 statusBar
->SetFieldsCount(number
);
287 void wxFrame::PositionStatusBar()
289 if ( !m_frameStatusBar
|| !m_frameStatusBar
->IsShown() )
293 GetClientSize(&w
, &h
);
296 m_frameStatusBar
->GetSize(&sw
, &sh
);
300 wxToolBar
* const toolbar
= GetToolBar();
301 if ( toolbar
&& !toolbar
->HasFlag(wxTB_TOP
) )
303 const wxSize sizeTB
= toolbar
->GetSize();
305 if ( toolbar
->HasFlag(wxTB_LEFT
| wxTB_RIGHT
) )
307 if ( toolbar
->HasFlag(wxTB_LEFT
) )
314 // we need to position the status bar below the toolbar
318 //else: no adjustments necessary for the toolbar on top
319 #endif // wxUSE_TOOLBAR
321 // Since we wish the status bar to be directly under the client area,
322 // we use the adjusted sizes without using wxSIZE_NO_ADJUSTMENTS.
323 m_frameStatusBar
->SetSize(x
, h
, w
, sh
);
326 #endif // wxUSE_STATUSBAR
328 #if wxUSE_MENUS_NATIVE
330 void wxFrame::AttachMenuBar(wxMenuBar
*menubar
)
332 #if defined(__SMARTPHONE__) && defined(__WXWINCE__)
334 wxMenu
*autoMenu
= NULL
;
336 if( menubar
->GetMenuCount() == 1 )
338 autoMenu
= wxTopLevelWindowMSW::ButtonMenu::DuplicateMenu(menubar
->GetMenu(0));
339 SetRightMenu(wxID_ANY
, menubar
->GetMenuLabel(0), autoMenu
);
343 autoMenu
= new wxMenu
;
345 for( size_t n
= 0; n
< menubar
->GetMenuCount(); n
++ )
347 wxMenu
*item
= menubar
->GetMenu(n
);
348 wxString label
= menubar
->GetMenuLabel(n
);
349 wxMenu
*new_item
= wxTopLevelWindowMSW::ButtonMenu::DuplicateMenu(item
);
350 autoMenu
->Append(wxID_ANY
, label
, new_item
);
353 SetRightMenu(wxID_ANY
, _("Menu"), autoMenu
);
356 #elif defined(WINCE_WITHOUT_COMMANDBAR)
359 wxToolMenuBar
* toolBar
= new wxToolMenuBar(this, wxID_ANY
,
360 wxDefaultPosition
, wxDefaultSize
,
361 wxBORDER_NONE
| wxTB_HORIZONTAL
,
362 wxToolBarNameStr
, menubar
);
364 menubar
->SetToolBar(toolBar
);
367 // When the main window is created using CW_USEDEFAULT the height of the
368 // menubar is not taken into account, so we resize it afterwards if a
369 // menubar is present
370 HWND hwndMenuBar
= SHFindMenuBar(GetHwnd());
374 ::GetWindowRect(hwndMenuBar
, &mbRect
);
375 const int menuHeight
= mbRect
.bottom
- mbRect
.top
;
378 ::GetWindowRect(GetHwnd(), &rc
);
379 // adjust for menu / titlebar height
380 rc
.bottom
-= (2*menuHeight
-1);
382 ::MoveWindow(Gethwnd(), rc
.left
, rc
.top
, rc
.right
, rc
.bottom
, FALSE
);
386 wxFrameBase::AttachMenuBar(menubar
);
390 // actually remove the menu from the frame
391 m_hMenu
= (WXHMENU
)0;
392 InternalSetMenuBar();
394 else // set new non NULL menu bar
396 #if !defined(__WXWINCE__) || defined(WINCE_WITH_COMMANDBAR)
397 // Can set a menubar several times.
398 if ( menubar
->GetHMenu() )
400 m_hMenu
= menubar
->GetHMenu();
404 m_hMenu
= menubar
->Create();
408 wxFAIL_MSG( wxT("failed to create menu bar") );
413 InternalSetMenuBar();
417 void wxFrame::InternalSetMenuBar()
419 #if defined(__WXMICROWIN__) || defined(__WXWINCE__)
422 if ( !::SetMenu(GetHwnd(), (HMENU
)m_hMenu
) )
424 wxLogLastError(wxT("SetMenu"));
429 #endif // wxUSE_MENUS_NATIVE
431 // Responds to colour changes, and passes event on to children.
432 void wxFrame::OnSysColourChanged(wxSysColourChangedEvent
& event
)
434 SetOwnBackgroundColour(wxSystemSettings::GetColour(wxSYS_COLOUR_APPWORKSPACE
));
438 if ( m_frameStatusBar
)
440 wxSysColourChangedEvent event2
;
441 event2
.SetEventObject( m_frameStatusBar
);
442 m_frameStatusBar
->HandleWindowEvent(event2
);
444 #endif // wxUSE_STATUSBAR
446 // Propagate the event to the non-top-level children
447 wxWindow::OnSysColourChanged(event
);
450 // Pass true to show full screen, false to restore.
451 bool wxFrame::ShowFullScreen(bool show
, long style
)
453 // TODO-CE: add support for CE
454 #if !defined(__WXMICROWIN__) && !defined(__WXWINCE__)
455 if ( IsFullScreen() == show
)
460 // zap the toolbar, menubar, and statusbar if needed
462 // TODO: hide commandbar for WINCE_WITH_COMMANDBAR
464 wxToolBar
*theToolBar
= GetToolBar();
466 if ((style
& wxFULLSCREEN_NOTOOLBAR
) && theToolBar
)
468 if ( theToolBar
->IsShown() )
470 theToolBar
->SetSize(wxDefaultCoord
,0);
471 theToolBar
->Show(false);
473 else // prevent it from being restored later
475 style
&= ~wxFULLSCREEN_NOTOOLBAR
;
478 #endif // wxUSE_TOOLBAR
480 if (style
& wxFULLSCREEN_NOMENUBAR
)
481 SetMenu((HWND
)GetHWND(), (HMENU
) NULL
);
484 wxStatusBar
*theStatusBar
= GetStatusBar();
486 // Save the number of fields in the statusbar
487 if ((style
& wxFULLSCREEN_NOSTATUSBAR
) && theStatusBar
)
489 if ( theStatusBar
->IsShown() )
490 theStatusBar
->Show(false);
492 style
&= ~wxFULLSCREEN_NOSTATUSBAR
;
494 #endif // wxUSE_STATUSBAR
496 else // restore to normal
498 // restore the toolbar, menubar, and statusbar if we had hid them
500 wxToolBar
*theToolBar
= GetToolBar();
502 if ((m_fsStyle
& wxFULLSCREEN_NOTOOLBAR
) && theToolBar
)
504 theToolBar
->Show(true);
506 #endif // wxUSE_TOOLBAR
509 if (m_fsStyle
& wxFULLSCREEN_NOMENUBAR
)
511 const WXHMENU hmenu
= MSWGetActiveMenu();
513 ::SetMenu(GetHwnd(), (HMENU
)hmenu
);
515 #endif // wxUSE_MENUS
518 wxStatusBar
*theStatusBar
= GetStatusBar();
520 if ((m_fsStyle
& wxFULLSCREEN_NOSTATUSBAR
) && theStatusBar
)
522 theStatusBar
->Show(true);
525 #endif // wxUSE_STATUSBAR
527 #endif // !defined(__WXMICROWIN__) && !defined(__WXWINCE__)
529 return wxFrameBase::ShowFullScreen(show
, style
);
532 // ----------------------------------------------------------------------------
533 // tool/status bar stuff
534 // ----------------------------------------------------------------------------
538 wxToolBar
* wxFrame::CreateToolBar(long style
, wxWindowID id
, const wxString
& name
)
540 #if defined(WINCE_WITHOUT_COMMANDBAR)
541 // We may already have a toolbar from calling SetMenuBar.
545 if ( wxFrameBase::CreateToolBar(style
, id
, name
) )
550 return m_frameToolBar
;
553 void wxFrame::PositionToolBar()
555 // TODO: we want to do something different in WinCE, because the toolbar
556 // should be associated with the commandbar, instead of being
557 // independent window.
558 #if !defined(WINCE_WITHOUT_COMMANDBAR)
559 wxToolBar
*toolbar
= GetToolBar();
560 if ( toolbar
&& toolbar
->IsShown() )
562 // don't call our (or even wxTopLevelWindow) version because we want
563 // the real (full) client area size, not excluding the tool/status bar
565 wxWindow::DoGetClientSize(&width
, &height
);
568 wxStatusBar
*statbar
= GetStatusBar();
569 if ( statbar
&& statbar
->IsShown() )
571 height
-= statbar
->GetClientSize().y
;
573 #endif // wxUSE_STATUSBAR
576 toolbar
->GetPosition( &tx
, &ty
);
577 toolbar
->GetSize( &tw
, &th
);
580 if ( toolbar
->HasFlag(wxTB_BOTTOM
) )
585 else if ( toolbar
->HasFlag(wxTB_RIGHT
) )
596 #if defined(WINCE_WITH_COMMANDBAR)
597 // We're using a commandbar - so we have to allow for it.
598 if (GetMenuBar() && GetMenuBar()->GetCommandBar())
601 ::GetWindowRect((HWND
) GetMenuBar()->GetCommandBar(), &rect
);
602 y
= rect
.bottom
- rect
.top
;
604 #endif // WINCE_WITH_COMMANDBAR
606 if ( toolbar
->HasFlag(wxTB_BOTTOM
) )
608 if ( ty
< 0 && ( -ty
== th
) )
610 if ( tx
< 0 && (-tx
== tw
) )
613 else if ( toolbar
->HasFlag(wxTB_RIGHT
) )
615 if( ty
< 0 && ( -ty
== th
) )
617 if( tx
< 0 && ( -tx
== tw
) )
622 if (ty
< 0 && (-ty
== th
))
624 if (tx
< 0 && (-tx
== tw
))
631 if ( toolbar
->IsVertical() )
642 // use the 'real' MSW position here, don't offset relatively to the
643 // client area origin
644 toolbar
->SetSize(x
, y
, desiredW
, desiredH
, wxSIZE_NO_ADJUSTMENTS
);
647 #endif // !WINCE_WITH_COMMANDBAR
650 #endif // wxUSE_TOOLBAR
652 // ----------------------------------------------------------------------------
653 // frame state (iconized/maximized/...)
654 // ----------------------------------------------------------------------------
656 // propagate our state change to all child frames: this allows us to emulate X
657 // Windows behaviour where child frames float independently of the parent one
658 // on the desktop, but are iconized/restored with it
659 void wxFrame::IconizeChildFrames(bool bIconize
)
661 m_iconized
= bIconize
;
663 for ( wxWindowList::compatibility_iterator node
= GetChildren().GetFirst();
665 node
= node
->GetNext() )
667 wxWindow
*win
= node
->GetData();
669 // iconizing the frames with this style under Win95 shell puts them at
670 // the bottom of the screen (as the MDI children) instead of making
671 // them appear in the taskbar because they are, by virtue of this
672 // style, not managed by the taskbar - instead leave Windows take care
674 if ( win
->GetWindowStyle() & wxFRAME_TOOL_WINDOW
)
677 // the child MDI frames are a special case and should not be touched by
678 // the parent frame - instead, they are managed by the user
679 wxFrame
*frame
= wxDynamicCast(win
, wxFrame
);
681 #if wxUSE_MDI_ARCHITECTURE
682 && !frame
->IsMDIChild()
683 #endif // wxUSE_MDI_ARCHITECTURE
686 // we don't want to restore the child frames which had been
687 // iconized even before we were iconized, so save the child frame
688 // status when iconizing the parent frame and check it when
692 frame
->m_wasMinimized
= frame
->IsIconized();
695 // note that we shouldn't touch the hidden frames neither because
696 // iconizing/restoring them would show them as a side effect
697 if ( !frame
->m_wasMinimized
&& frame
->IsShown() )
698 frame
->Iconize(bIconize
);
703 WXHICON
wxFrame::GetDefaultIcon() const
705 // we don't have any standard icons (any more)
709 // ===========================================================================
710 // message processing
711 // ===========================================================================
713 // ---------------------------------------------------------------------------
715 // ---------------------------------------------------------------------------
717 bool wxFrame::MSWDoTranslateMessage(wxFrame
*frame
, WXMSG
*pMsg
)
719 if ( wxWindow::MSWTranslateMessage(pMsg
) )
722 #if wxUSE_MENUS && wxUSE_ACCEL && !defined(__WXUNIVERSAL__)
723 // try the menu bar accelerators
724 wxMenuBar
*menuBar
= GetMenuBar();
725 if ( menuBar
&& menuBar
->GetAcceleratorTable()->Translate(frame
, pMsg
) )
727 #endif // wxUSE_MENUS && wxUSE_ACCEL
732 // ---------------------------------------------------------------------------
733 // our private (non virtual) message handlers
734 // ---------------------------------------------------------------------------
736 bool wxFrame::HandleSize(int WXUNUSED(x
), int WXUNUSED(y
), WXUINT id
)
738 #if !defined(__WXMICROWIN__) && !defined(__WXWINCE__)
743 // only do it it if we were iconized before, otherwise resizing the
744 // parent frame has a curious side effect of bringing it under it's
749 // restore all child frames too
750 IconizeChildFrames(false);
752 (void)SendIconizeEvent(false);
756 // iconize all child frames too
757 IconizeChildFrames(true);
762 #endif // !__WXWINCE__
768 #endif // wxUSE_STATUSBAR
772 #endif // wxUSE_TOOLBAR
774 #if defined(WINCE_WITH_COMMANDBAR)
775 // Position the menu command bar
776 if (GetMenuBar() && GetMenuBar()->GetCommandBar())
779 ::GetWindowRect((HWND
) GetMenuBar()->GetCommandBar(), &rect
);
780 wxSize clientSz
= GetClientSize();
782 if ( !::MoveWindow((HWND
) GetMenuBar()->GetCommandBar(), 0, 0, clientSz
.x
, rect
.bottom
- rect
.top
, true ) )
784 wxLogLastError(wxT("MoveWindow"));
788 #endif // WINCE_WITH_COMMANDBAR
791 // call the base class version to generate the appropriate events
795 bool wxFrame::HandleCommand(WXWORD id
, WXWORD cmd
, WXHWND control
)
799 #if defined(WINCE_WITHOUT_COMMANDBAR)
800 if (GetToolBar() && GetToolBar()->FindById(id
))
801 return GetToolBar()->MSWCommand(cmd
, id
);
804 // we only need to handle the menu and accelerator commands from the items
805 // of our menu bar, base wxWindow class already handles the rest
806 if ( !control
&& (cmd
== 0 /* menu */ || cmd
== 1 /* accel */) )
808 #if wxUSE_MENUS_NATIVE
809 if ( !wxCurrentPopupMenu
)
810 #endif // wxUSE_MENUS_NATIVE
812 wxMenuItem
* const mitem
= FindItemInMenuBar((signed short)id
);
814 return ProcessCommand(mitem
);
817 #endif // wxUSE_MENUS
819 return wxFrameBase::HandleCommand(id
, cmd
, control
);;
825 wxFrame::HandleMenuSelect(WXWORD nItem
, WXWORD flags
, WXHMENU
WXUNUSED(hMenu
))
827 // sign extend to int from unsigned short we get from Windows
828 int item
= (signed short)nItem
;
830 // WM_MENUSELECT is generated for both normal items and menus, including
831 // the top level menus of the menu bar, which can't be represented using
832 // any valid identifier in wxMenuEvent so use an otherwise unused value for
834 if ( flags
& (MF_POPUP
| MF_SEPARATOR
) )
837 wxMenuEvent
event(wxEVT_MENU_HIGHLIGHT
, item
);
838 event
.SetEventObject(this);
840 if ( HandleWindowEvent(event
) )
843 // by default, i.e. if the event wasn't handled above, clear the status bar
844 // text when an item which can't have any associated help string in wx API
846 if ( item
== wxID_NONE
)
847 DoGiveHelp(wxEmptyString
, true);
852 bool wxFrame::HandleMenuLoop(const wxEventType
& evtType
, WXWORD isPopup
)
854 // we don't have the menu id here, so we use the id to specify if the event
855 // was from a popup menu or a normal one
856 wxMenuEvent
event(evtType
, isPopup
? -1 : 0);
857 event
.SetEventObject(this);
859 return HandleWindowEvent(event
);
862 bool wxFrame::HandleInitMenuPopup(WXHMENU hMenu
)
867 int nCount
= GetMenuBar()->GetMenuCount();
868 for (int n
= 0; n
< nCount
; n
++)
870 if (GetMenuBar()->GetMenu(n
)->GetHMenu() == hMenu
)
872 menu
= GetMenuBar()->GetMenu(n
);
878 wxMenuEvent
event(wxEVT_MENU_OPEN
, 0, menu
);
879 event
.SetEventObject(this);
881 return HandleWindowEvent(event
);
884 #endif // wxUSE_MENUS
886 // ---------------------------------------------------------------------------
887 // the window proc for wxFrame
888 // ---------------------------------------------------------------------------
890 WXLRESULT
wxFrame::MSWWindowProc(WXUINT message
, WXWPARAM wParam
, WXLPARAM lParam
)
893 bool processed
= false;
898 // if we can't close, tell the system that we processed the
899 // message - otherwise it would close us
900 processed
= !Close();
904 processed
= HandleSize(LOWORD(lParam
), HIWORD(lParam
), wParam
);
911 UnpackCommand((WXWPARAM
)wParam
, (WXLPARAM
)lParam
,
914 HandleCommand(id
, cmd
, (WXHWND
)hwnd
);
916 // don't pass WM_COMMAND to the base class whether we processed
917 // it or not because we did generate an event for it (our
918 // HandleCommand() calls the base class version) and we must
919 // not do it again or the handlers which skip the event would
925 #if !defined(__WXMICROWIN__) && !defined(__WXWINCE__)
927 case WM_INITMENUPOPUP
:
928 processed
= HandleInitMenuPopup((WXHMENU
) wParam
);
935 UnpackMenuSelect(wParam
, lParam
, &item
, &flags
, &hmenu
);
937 processed
= HandleMenuSelect(item
, flags
, hmenu
);
941 case WM_EXITMENULOOP
:
942 processed
= HandleMenuLoop(wxEVT_MENU_CLOSE
, (WXWORD
)wParam
);
944 #endif // wxUSE_MENUS
946 case WM_QUERYDRAGICON
:
948 const wxIcon
& icon
= GetIcon();
949 HICON hIcon
= icon
.Ok() ? GetHiconOf(icon
)
950 : (HICON
)GetDefaultIcon();
951 rc
= (WXLRESULT
)hIcon
;
955 #endif // !__WXMICROWIN__
959 rc
= wxFrameBase::MSWWindowProc(message
, wParam
, lParam
);
964 // ----------------------------------------------------------------------------
965 // wxFrame size management: we exclude the areas taken by menu/status/toolbars
966 // from the client area, so the client area is what's really available for the
968 // ----------------------------------------------------------------------------
970 // get the origin of the client area in the client coordinates
971 wxPoint
wxFrame::GetClientAreaOrigin() const
973 wxPoint pt
= wxTopLevelWindow::GetClientAreaOrigin();
975 #if wxUSE_TOOLBAR && !defined(__WXUNIVERSAL__) && \
976 (!defined(__WXWINCE__) || (_WIN32_WCE >= 400 && !defined(__POCKETPC__) && !defined(__SMARTPHONE__)))
977 wxToolBar
* const toolbar
= GetToolBar();
978 if ( toolbar
&& toolbar
->IsShown() )
980 const wxSize sizeTB
= toolbar
->GetSize();
982 if ( toolbar
->HasFlag(wxTB_TOP
) )
986 else if ( toolbar
->HasFlag(wxTB_LEFT
) )
991 #endif // wxUSE_TOOLBAR
993 #if defined(WINCE_WITH_COMMANDBAR)
994 if (GetMenuBar() && GetMenuBar()->GetCommandBar())
997 ::GetWindowRect((HWND
) GetMenuBar()->GetCommandBar(), &rect
);
998 pt
.y
+= (rect
.bottom
- rect
.top
);