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
This commit is contained in:
Julian Smart 2001-07-05 13:35:53 +00:00
parent 24b9f05515
commit 54800df8d8
13 changed files with 77 additions and 36 deletions

View File

@ -205,7 +205,7 @@ public:
// object) - this log object is used by default by all wxLogXXX() // object) - this log object is used by default by all wxLogXXX()
// functions. // functions.
virtual wxLog *CreateLogTarget() virtual wxLog *CreateLogTarget()
#if wxUSE_GUI && wxUSE_LOGGUI #if wxUSE_GUI && wxUSE_LOGGUI && !defined(__WXMICROWIN__)
{ return new wxLogGui; } { return new wxLogGui; }
#else // !GUI #else // !GUI
{ return new wxLogStderr; } { return new wxLogStderr; }

View File

@ -490,7 +490,9 @@ inline const wxMB2WXbuf wxGetTranslation(const wxChar *sz)
#define wxTRANSLATE(str) _T(str) #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 #endif // wxUSE_INTL/!wxUSE_INTL

View File

@ -116,7 +116,8 @@
#define wxUSE_DIRDLG 0 #define wxUSE_DIRDLG 0
#define wxUSE_FONTDLG 0 #define wxUSE_FONTDLG 0
#define wxUSE_FILEDLG 0 #define wxUSE_FILEDLG 0
#define wxUSE_TEXTDLG 0 #define wxUSE_FILEDLG 0
#define wxUSE_COLOURDLG 0
#define wxUSE_CHOICEDLG 0 #define wxUSE_CHOICEDLG 0
#define wxUSE_NUMBERDLG 0 #define wxUSE_NUMBERDLG 0
#define wxUSE_STARTUP_TIPS 0 #define wxUSE_STARTUP_TIPS 0
@ -265,6 +266,7 @@
#define wxUSE_DIRDLG 0 #define wxUSE_DIRDLG 0
#define wxUSE_FONTDLG 0 #define wxUSE_FONTDLG 0
#define wxUSE_FILEDLG 0 #define wxUSE_FILEDLG 0
#define wxUSE_COLOURDLG 0
#define wxUSE_TEXTDLG 0 #define wxUSE_TEXTDLG 0
#define wxUSE_CHOICEDLG 0 #define wxUSE_CHOICEDLG 0
#define wxUSE_NUMBERDLG 0 #define wxUSE_NUMBERDLG 0

View File

@ -86,3 +86,6 @@ cleanwx:
wx: wx:
@pushd $(WXDIR)/src/msw; make -f makefile.mic all; popd @pushd $(WXDIR)/src/msw; make -f makefile.mic all; popd
wxfull:
@pushd $(WXDIR)/src/msw; make -f makefile.mic cleanwx all; popd

View File

@ -67,10 +67,10 @@
#ifndef WX_PRECOMP #ifndef WX_PRECOMP
#include "wx/string.h" #include "wx/string.h"
#include "wx/intl.h"
#include "wx/log.h" #include "wx/log.h"
#endif // WX_PRECOMP #endif // WX_PRECOMP
#include "wx/intl.h"
#include "wx/thread.h" #include "wx/thread.h"
#include "wx/tokenzr.h" #include "wx/tokenzr.h"
#include "wx/module.h" #include "wx/module.h"

View File

@ -1916,7 +1916,5 @@ void wxLocale::InitLanguagesDB()
// --- --- --- generated code ends here --- --- --- // --- --- --- generated code ends here --- --- ---
#endif // wxUSE_INTL #endif // wxUSE_INTL

View File

@ -337,7 +337,11 @@ void wxPopupWindowHandler::OnLeftDown(wxMouseEvent& event)
void wxPopupFocusHandler::OnKillFocus(wxFocusEvent& event) void wxPopupFocusHandler::OnKillFocus(wxFocusEvent& event)
{ {
// when we lose focus we always disappear // 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 #endif // wxUSE_POPUPWIN

View File

@ -170,12 +170,30 @@ bool wxDialog::Create(wxWindow *parent,
dlg = wxT("wxCaptionDialog"); dlg = wxT("wxCaptionDialog");
else else
dlg = wxT("wxNoCaptionDialog"); 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, MSWCreate(m_windowId, parent, NULL, this, NULL,
x, y, width, height, x, y, width, height,
0, // style is not used if we have dlg template 0, // style is not used if we have dlg template
dlg, dlg,
extendedStyle); extendedStyle);
#endif
HWND hwnd = (HWND)GetHWND(); HWND hwnd = (HWND)GetHWND();
if ( !hwnd ) if ( !hwnd )
@ -185,8 +203,10 @@ bool wxDialog::Create(wxWindow *parent,
return FALSE; return FALSE;
} }
#ifndef __WXMICROWIN__
SubclassWin(GetHWND()); SubclassWin(GetHWND());
#endif
SetWindowText(hwnd, title); SetWindowText(hwnd, title);
return TRUE; return TRUE;

View File

@ -1233,8 +1233,12 @@ int wxDisplayDepth()
void wxDisplaySize(int *width, int *height) void wxDisplaySize(int *width, int *height)
{ {
#ifdef __WXMICROWIN__ #ifdef __WXMICROWIN__
// MICROWIN_TODO RECT rect;
*width = 0; * height = 0; HWND hWnd = GetDesktopWindow();
::GetWindowRect(hWnd, & rect);
*width = rect.right - rect.left;
*height = rect.bottom - rect.top;
#else #else
ScreenHDC dc; ScreenHDC dc;

View File

@ -496,7 +496,19 @@ bool wxWindowMSW::Show(bool show)
if ( 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); BringWindowToTop(hWnd);
#endif
} }
return TRUE; return TRUE;
@ -508,8 +520,20 @@ void wxWindowMSW::Raise()
#ifdef __WIN16__ #ifdef __WIN16__
::BringWindowToTop(GetHwnd()); ::BringWindowToTop(GetHwnd());
#else // Win32 #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()); ::SetForegroundWindow(GetHwnd());
#endif #endif
#endif
} }
// Lower the window to the bottom of the Z order // Lower the window to the bottom of the Z order
@ -921,6 +945,9 @@ void wxWindowMSW::SubclassWin(WXHWND hWnd)
wxAssociateWinWithHandle(hwnd, this); wxAssociateWinWithHandle(hwnd, this);
m_oldWndProc = (WXFARPROC) GetWindowLong(hwnd, GWL_WNDPROC); m_oldWndProc = (WXFARPROC) GetWindowLong(hwnd, GWL_WNDPROC);
wxASSERT( (WXFARPROC) m_oldWndProc != (WXFARPROC) wxWndProc );
SetWindowLong(hwnd, GWL_WNDPROC, (LONG) wxWndProc); SetWindowLong(hwnd, GWL_WNDPROC, (LONG) wxWndProc);
} }
@ -2656,9 +2683,9 @@ bool wxWindowMSW::MSWCreate(int id,
wxWndHook = this; wxWndHook = this;
#ifndef __WXMICROWIN__
if ( dialog_template ) if ( dialog_template )
{ {
#ifndef __WXMICROWIN__
// for the dialogs without wxDIALOG_NO_PARENT style, use the top level // for the dialogs without wxDIALOG_NO_PARENT style, use the top level
// app window as parent - this avoids creating modal dialogs without // app window as parent - this avoids creating modal dialogs without
// parent // parent
@ -2730,11 +2757,11 @@ bool wxWindowMSW::MSWCreate(int id,
{ {
wxLogLastError(wxT("MoveWindow")); wxLogLastError(wxT("MoveWindow"));
} }
#endif
// __WXMICROWIN__
} }
else // creating a normal window, not a dialog else // creating a normal window, not a dialog
#endif
// __WXMICROWIN__
{ {
int controlId = 0; int controlId = 0;
if ( style & WS_CHILD ) if ( style & WS_CHILD )

View File

@ -75,21 +75,13 @@ void wxFrame::OnSize(wxSizeEvent& event)
{ {
#if wxUSE_MENUS #if wxUSE_MENUS
PositionMenuBar(); PositionMenuBar();
<<<<<<< framuniv.cpp #endif // wxUSE_MENUS
#endif
=======
#endif // wxUSE_WAVE
>>>>>>> 1.4
event.Skip(); event.Skip();
} }
<<<<<<< framuniv.cpp
#if wxUSE_MENUS
=======
#if wxUSE_MENUS #if wxUSE_MENUS
>>>>>>> 1.4
void wxFrame::PositionMenuBar() void wxFrame::PositionMenuBar()
{ {
if ( m_frameMenuBar ) if ( m_frameMenuBar )
@ -100,14 +92,8 @@ void wxFrame::PositionMenuBar()
GetClientSize().x, -1); GetClientSize().x, -1);
} }
} }
<<<<<<< framuniv.cpp
#endif // wxUSE_MENUS #endif // wxUSE_MENUS
=======
#endif // wxUSE_MENUS
>>>>>>> 1.4
wxPoint wxFrame::GetClientAreaOrigin() const wxPoint wxFrame::GetClientAreaOrigin() const
{ {
wxPoint pt = wxFrameNative::GetClientAreaOrigin(); wxPoint pt = wxFrameNative::GetClientAreaOrigin();

View File

@ -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 // 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) // 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 // open the new menu if the old one we closed had been opened
PopupCurrentMenu(FALSE /* don't select first item - as Windows does */); PopupCurrentMenu(FALSE /* don't select first item - as Windows does */);

View File

@ -2410,7 +2410,6 @@ void wxWin32Renderer::DrawSliderTicks(wxDC& dc,
DrawLine(dc, x2, y1, x2, y2, orient == wxVERTICAL); DrawLine(dc, x2, y1, x2, y2, orient == wxVERTICAL);
} }
#if wxUSE_MENUS
// ---------------------------------------------------------------------------- // ----------------------------------------------------------------------------
// menu and menubar // menu and menubar
// ---------------------------------------------------------------------------- // ----------------------------------------------------------------------------
@ -2445,7 +2444,7 @@ private:
GetMenuGeometry(wxWindow *, const wxMenu&) const; GetMenuGeometry(wxWindow *, const wxMenu&) const;
}; };
#endif // wxUSE_WAVE #endif // wxUSE_MENUS
// FIXME: all constants are hardcoded but shouldn't be // FIXME: all constants are hardcoded but shouldn't be
static const wxCoord MENU_LEFT_MARGIN = 9; static const wxCoord MENU_LEFT_MARGIN = 9;
@ -2680,9 +2679,6 @@ wxMenuGeometryInfo *wxWin32Renderer::GetMenuGeometry(wxWindow *win,
return gi; return gi;
} }
<<<<<<< win32.cpp
#endif
=======
#else // !wxUSE_MENUS #else // !wxUSE_MENUS
@ -2725,7 +2721,6 @@ wxWin32Renderer::GetMenuGeometry(wxWindow *WXUNUSED(win),
#endif // wxUSE_MENUS/!wxUSE_MENUS #endif // wxUSE_MENUS/!wxUSE_MENUS
>>>>>>> 1.5
// ---------------------------------------------------------------------------- // ----------------------------------------------------------------------------
// combobox // combobox
// ---------------------------------------------------------------------------- // ----------------------------------------------------------------------------