From 54800df8d8f5e425c4f11538cd05341c51243543 Mon Sep 17 00:00:00 2001 From: Julian Smart Date: Thu, 5 Jul 2001 13:35:53 +0000 Subject: [PATCH] Misc fixes, now menus are almost working on MicroWindows git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@10844 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775 --- include/wx/app.h | 2 +- include/wx/intl.h | 4 +++- include/wx/univ/setup.h | 4 +++- samples/minimal/makefile.mic | 3 +++ src/common/datetime.cpp | 2 +- src/common/intl.cpp | 2 -- src/common/popupcmn.cpp | 6 +++++- src/msw/dialog.cpp | 24 ++++++++++++++++++++++-- src/msw/utils.cpp | 8 ++++++-- src/msw/window.cpp | 33 ++++++++++++++++++++++++++++++--- src/univ/framuniv.cpp | 16 +--------------- src/univ/menu.cpp | 2 +- src/univ/themes/win32.cpp | 7 +------ 13 files changed, 77 insertions(+), 36 deletions(-) diff --git a/include/wx/app.h b/include/wx/app.h index 8f0b44bbed..cdd0e46cf5 100644 --- a/include/wx/app.h +++ b/include/wx/app.h @@ -205,7 +205,7 @@ public: // object) - this log object is used by default by all wxLogXXX() // functions. virtual wxLog *CreateLogTarget() - #if wxUSE_GUI && wxUSE_LOGGUI + #if wxUSE_GUI && wxUSE_LOGGUI && !defined(__WXMICROWIN__) { return new wxLogGui; } #else // !GUI { return new wxLogStderr; } diff --git a/include/wx/intl.h b/include/wx/intl.h index a8e8233277..8521815234 100644 --- a/include/wx/intl.h +++ b/include/wx/intl.h @@ -490,7 +490,9 @@ inline const wxMB2WXbuf wxGetTranslation(const wxChar *sz) #define wxTRANSLATE(str) _T(str) -inline const wxChar *wxGetTranslation(const wxChar *sz) { return sz; } +// Note: use of 'inline' here can cause this symbol not to be found when compiled with gcc +//const wxChar *wxGetTranslation(const wxChar *sz); +#define wxGetTranslation(sz) sz #endif // wxUSE_INTL/!wxUSE_INTL diff --git a/include/wx/univ/setup.h b/include/wx/univ/setup.h index 24f7b684c7..462c01354e 100644 --- a/include/wx/univ/setup.h +++ b/include/wx/univ/setup.h @@ -116,7 +116,8 @@ #define wxUSE_DIRDLG 0 #define wxUSE_FONTDLG 0 #define wxUSE_FILEDLG 0 -#define wxUSE_TEXTDLG 0 +#define wxUSE_FILEDLG 0 +#define wxUSE_COLOURDLG 0 #define wxUSE_CHOICEDLG 0 #define wxUSE_NUMBERDLG 0 #define wxUSE_STARTUP_TIPS 0 @@ -265,6 +266,7 @@ #define wxUSE_DIRDLG 0 #define wxUSE_FONTDLG 0 #define wxUSE_FILEDLG 0 +#define wxUSE_COLOURDLG 0 #define wxUSE_TEXTDLG 0 #define wxUSE_CHOICEDLG 0 #define wxUSE_NUMBERDLG 0 diff --git a/samples/minimal/makefile.mic b/samples/minimal/makefile.mic index b366facc34..f560e6912d 100644 --- a/samples/minimal/makefile.mic +++ b/samples/minimal/makefile.mic @@ -86,3 +86,6 @@ cleanwx: wx: @pushd $(WXDIR)/src/msw; make -f makefile.mic all; popd + +wxfull: + @pushd $(WXDIR)/src/msw; make -f makefile.mic cleanwx all; popd diff --git a/src/common/datetime.cpp b/src/common/datetime.cpp index ab397e793c..672a97e7a9 100644 --- a/src/common/datetime.cpp +++ b/src/common/datetime.cpp @@ -67,10 +67,10 @@ #ifndef WX_PRECOMP #include "wx/string.h" - #include "wx/intl.h" #include "wx/log.h" #endif // WX_PRECOMP +#include "wx/intl.h" #include "wx/thread.h" #include "wx/tokenzr.h" #include "wx/module.h" diff --git a/src/common/intl.cpp b/src/common/intl.cpp index 66a219459b..711788c1e4 100644 --- a/src/common/intl.cpp +++ b/src/common/intl.cpp @@ -1916,7 +1916,5 @@ void wxLocale::InitLanguagesDB() // --- --- --- generated code ends here --- --- --- - - #endif // wxUSE_INTL diff --git a/src/common/popupcmn.cpp b/src/common/popupcmn.cpp index 8f7215b235..604714fe7f 100644 --- a/src/common/popupcmn.cpp +++ b/src/common/popupcmn.cpp @@ -337,7 +337,11 @@ void wxPopupWindowHandler::OnLeftDown(wxMouseEvent& event) void wxPopupFocusHandler::OnKillFocus(wxFocusEvent& event) { // when we lose focus we always disappear - m_popup->DismissAndNotify(); + + // But if m_popup was about to get the focus, + // don't disappear. + if (event.GetWindow() != m_popup) + m_popup->DismissAndNotify(); } #endif // wxUSE_POPUPWIN diff --git a/src/msw/dialog.cpp b/src/msw/dialog.cpp index 4de4676889..001b485490 100644 --- a/src/msw/dialog.cpp +++ b/src/msw/dialog.cpp @@ -170,12 +170,30 @@ bool wxDialog::Create(wxWindow *parent, dlg = wxT("wxCaptionDialog"); else dlg = wxT("wxNoCaptionDialog"); + +#ifdef __WXMICROWIN__ + extern const wxChar *wxFrameClassName; + + int msflags = WS_OVERLAPPED; + if (style & wxCAPTION) + msflags |= WS_CAPTION; + if (style & wxCLIP_CHILDREN) + msflags |= WS_CLIPCHILDREN; + if ((style & wxTHICK_FRAME) == 0) + msflags |= WS_BORDER; + MSWCreate(m_windowId, parent, wxFrameClassName, this, NULL, + x, y, width, height, + msflags, + NULL, + extendedStyle); + +#else MSWCreate(m_windowId, parent, NULL, this, NULL, x, y, width, height, 0, // style is not used if we have dlg template dlg, extendedStyle); - +#endif HWND hwnd = (HWND)GetHWND(); if ( !hwnd ) @@ -185,8 +203,10 @@ bool wxDialog::Create(wxWindow *parent, return FALSE; } +#ifndef __WXMICROWIN__ SubclassWin(GetHWND()); - +#endif + SetWindowText(hwnd, title); return TRUE; diff --git a/src/msw/utils.cpp b/src/msw/utils.cpp index b117cb09c1..f9db6a472b 100644 --- a/src/msw/utils.cpp +++ b/src/msw/utils.cpp @@ -1233,8 +1233,12 @@ int wxDisplayDepth() void wxDisplaySize(int *width, int *height) { #ifdef __WXMICROWIN__ - // MICROWIN_TODO - *width = 0; * height = 0; + RECT rect; + HWND hWnd = GetDesktopWindow(); + ::GetWindowRect(hWnd, & rect); + + *width = rect.right - rect.left; + *height = rect.bottom - rect.top; #else ScreenHDC dc; diff --git a/src/msw/window.cpp b/src/msw/window.cpp index 7c9db9eac1..64ad5feeaa 100644 --- a/src/msw/window.cpp +++ b/src/msw/window.cpp @@ -496,7 +496,19 @@ bool wxWindowMSW::Show(bool show) if ( show ) { +#ifdef __WXMICROWIN__ + // It seems that MicroWindows brings the _parent_ of the + // window to the top, which can be the wrong one. + + /* activate (set focus to) specified window*/ + ::SetFocus(hWnd); + + /* raise top level parent to top of z order*/ + ::SetWindowPos(hWnd, HWND_TOP, 0, 0, 0, 0, + SWP_NOMOVE|SWP_NOSIZE); +#else BringWindowToTop(hWnd); +#endif } return TRUE; @@ -508,8 +520,20 @@ void wxWindowMSW::Raise() #ifdef __WIN16__ ::BringWindowToTop(GetHwnd()); #else // Win32 +#ifdef __WXMICROWIN__ + // It seems that MicroWindows brings the _parent_ of the + // window to the top, which can be the wrong one. + + /* activate (set focus to) specified window*/ + ::SetFocus(GetHwnd()); + + /* raise top level parent to top of z order*/ + ::SetWindowPos(GetHwnd(), HWND_TOP, 0, 0, 0, 0, + SWP_NOMOVE|SWP_NOSIZE); +#else ::SetForegroundWindow(GetHwnd()); #endif +#endif } // Lower the window to the bottom of the Z order @@ -921,6 +945,9 @@ void wxWindowMSW::SubclassWin(WXHWND hWnd) wxAssociateWinWithHandle(hwnd, this); m_oldWndProc = (WXFARPROC) GetWindowLong(hwnd, GWL_WNDPROC); + + wxASSERT( (WXFARPROC) m_oldWndProc != (WXFARPROC) wxWndProc ); + SetWindowLong(hwnd, GWL_WNDPROC, (LONG) wxWndProc); } @@ -2656,9 +2683,9 @@ bool wxWindowMSW::MSWCreate(int id, wxWndHook = this; +#ifndef __WXMICROWIN__ if ( dialog_template ) { -#ifndef __WXMICROWIN__ // for the dialogs without wxDIALOG_NO_PARENT style, use the top level // app window as parent - this avoids creating modal dialogs without // parent @@ -2730,11 +2757,11 @@ bool wxWindowMSW::MSWCreate(int id, { wxLogLastError(wxT("MoveWindow")); } -#endif - // __WXMICROWIN__ } else // creating a normal window, not a dialog +#endif + // __WXMICROWIN__ { int controlId = 0; if ( style & WS_CHILD ) diff --git a/src/univ/framuniv.cpp b/src/univ/framuniv.cpp index 546f714ef4..92a7ae405e 100644 --- a/src/univ/framuniv.cpp +++ b/src/univ/framuniv.cpp @@ -75,21 +75,13 @@ void wxFrame::OnSize(wxSizeEvent& event) { #if wxUSE_MENUS PositionMenuBar(); -<<<<<<< framuniv.cpp -#endif -======= -#endif // wxUSE_WAVE +#endif // wxUSE_MENUS ->>>>>>> 1.4 event.Skip(); } -<<<<<<< framuniv.cpp -#if wxUSE_MENUS -======= #if wxUSE_MENUS ->>>>>>> 1.4 void wxFrame::PositionMenuBar() { if ( m_frameMenuBar ) @@ -100,14 +92,8 @@ void wxFrame::PositionMenuBar() GetClientSize().x, -1); } } -<<<<<<< framuniv.cpp -#endif // wxUSE_MENUS - -======= - #endif // wxUSE_MENUS ->>>>>>> 1.4 wxPoint wxFrame::GetClientAreaOrigin() const { wxPoint pt = wxFrameNative::GetClientAreaOrigin(); diff --git a/src/univ/menu.cpp b/src/univ/menu.cpp index ed3bd429ff..001380d7f2 100644 --- a/src/univ/menu.cpp +++ b/src/univ/menu.cpp @@ -1963,7 +1963,7 @@ bool wxMenuBar::ProcessMouseEvent(const wxPoint& pt) // show the menu if we know that we should, even if we hadn't been showing // it before (this may happen if the previous menu was disabled) - if ( m_shouldShowMenu ) + if ( m_shouldShowMenu && !m_menuShown) { // open the new menu if the old one we closed had been opened PopupCurrentMenu(FALSE /* don't select first item - as Windows does */); diff --git a/src/univ/themes/win32.cpp b/src/univ/themes/win32.cpp index 68178a25e3..596bc217a3 100644 --- a/src/univ/themes/win32.cpp +++ b/src/univ/themes/win32.cpp @@ -2410,7 +2410,6 @@ void wxWin32Renderer::DrawSliderTicks(wxDC& dc, DrawLine(dc, x2, y1, x2, y2, orient == wxVERTICAL); } -#if wxUSE_MENUS // ---------------------------------------------------------------------------- // menu and menubar // ---------------------------------------------------------------------------- @@ -2445,7 +2444,7 @@ private: GetMenuGeometry(wxWindow *, const wxMenu&) const; }; -#endif // wxUSE_WAVE +#endif // wxUSE_MENUS // FIXME: all constants are hardcoded but shouldn't be static const wxCoord MENU_LEFT_MARGIN = 9; @@ -2680,9 +2679,6 @@ wxMenuGeometryInfo *wxWin32Renderer::GetMenuGeometry(wxWindow *win, return gi; } -<<<<<<< win32.cpp -#endif -======= #else // !wxUSE_MENUS @@ -2725,7 +2721,6 @@ wxWin32Renderer::GetMenuGeometry(wxWindow *WXUNUSED(win), #endif // wxUSE_MENUS/!wxUSE_MENUS ->>>>>>> 1.5 // ---------------------------------------------------------------------------- // combobox // ---------------------------------------------------------------------------- -- 2.45.2