don't hard code the menu bar height under WinCE (#10248) [backport of r57393 from trunk]

git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/branches/WX_2_8_BRANCH@57395 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
This commit is contained in:
Vadim Zeitlin
2008-12-17 11:29:20 +00:00
parent 9ea428c072
commit 9dd0e3cfcf
2 changed files with 15 additions and 7 deletions

View File

@@ -135,6 +135,10 @@ wxMSW:
- Correct coordinates of wxDropFilesEvent (Dmitriy Maksimov). - Correct coordinates of wxDropFilesEvent (Dmitriy Maksimov).
- Fix handling of abandoned mutexes in wxMutex (David Heffernan). - Fix handling of abandoned mutexes in wxMutex (David Heffernan).
wxMSW/CE:
- Don't hardcode the menu bar height (Michele Spighi).
wxGTK: wxGTK:
- Fixed printing to use fonts sizes adjustment consistent with wxMSW. - Fixed printing to use fonts sizes adjustment consistent with wxMSW.

View File

@@ -425,19 +425,23 @@ void wxFrame::AttachMenuBar(wxMenuBar *menubar)
SetToolBar(toolBar); SetToolBar(toolBar);
menubar->SetToolBar(toolBar); menubar->SetToolBar(toolBar);
} }
// Now adjust size for menu bar
int menuHeight = 26;
//When the main window is created using CW_USEDEFAULT the height of the // When the main window is created using CW_USEDEFAULT the height of the
// is created is not taken into account). So we resize the window after // menubar is not taken into account, so we resize it afterwards if a
// if a menubar is present // menubar is present
HWND hwndMenuBar = SHFindMenuBar(GetHwnd());
if ( hwndMenuBar )
{ {
RECT mbRect;
::GetWindowRect(hwndMenuBar, &mbRect);
const int menuHeight = mbRect.bottom - mbRect.top;
RECT rc; RECT rc;
::GetWindowRect((HWND) GetHWND(), &rc); ::GetWindowRect(GetHwnd(), &rc);
// adjust for menu / titlebar height // adjust for menu / titlebar height
rc.bottom -= (2*menuHeight-1); rc.bottom -= (2*menuHeight-1);
::MoveWindow((HWND) GetHWND(), rc.left, rc.top, rc.right, rc.bottom, FALSE); ::MoveWindow(Gethwnd(), rc.left, rc.top, rc.right, rc.bottom, FALSE);
} }
#endif #endif