]> git.saurik.com Git - wxWidgets.git/blobdiff - src/msw/frame.cpp
Fixed incorrect return type
[wxWidgets.git] / src / msw / frame.cpp
index 5c9b873da52a46f4df6397563140a650609e17fd..5b108f17f90ff764d45a6995091ef073500f6fd6 100644 (file)
@@ -35,6 +35,7 @@
 #include "wx/statusbr.h"
 #include "wx/toolbar.h"
 #include "wx/menuitem.h"
+#include "wx/log.h"
 
 #ifdef LoadAccelerators
 #undef LoadAccelerators
@@ -74,7 +75,6 @@ wxFrame::wxFrame()
   m_frameMenuBar = NULL;
   m_frameStatusBar = NULL;
 
-  m_windowParent = NULL;
   m_iconized = FALSE;
 }
 
@@ -119,7 +119,12 @@ bool wxFrame::Create(wxWindow *parent,
 
   // we pass NULL as parent to MSWCreate because frames with parents behave
   // very strangely under Win95 shell
-  MSWCreate(m_windowId, NULL, wxFrameClassName, this, title,
+  // Alteration by JACS: keep normal Windows behaviour (float on top of parent)
+  // with this style.
+  if ((m_windowStyle & wxFRAME_FLOAT_ON_PARENT) == 0)
+    parent = NULL;
+
+  MSWCreate(m_windowId, parent, wxFrameClassName, this, title,
             x, y, width, height, style);
 
   wxModelessWindows.Append(this);
@@ -164,7 +169,7 @@ WXHMENU wxFrame::GetWinMenu() const
 }
 
 // Get size *available for subwindows* i.e. excluding menu bar, toolbar etc.
-void wxFrame::GetClientSize(int *x, int *y) const
+void wxFrame::DoGetClientSize(int *x, int *y) const
 {
   RECT rect;
   ::GetClientRect((HWND) GetHWND(), &rect);
@@ -224,7 +229,7 @@ void wxFrame::DoSetClientSize(int width, int height)
   GetEventHandler()->ProcessEvent(event);
 }
 
-void wxFrame::GetSize(int *width, int *height) const
+void wxFrame::DoGetSize(int *width, int *height) const
 {
   RECT rect;
   GetWindowRect((HWND) GetHWND(), &rect);
@@ -232,7 +237,7 @@ void wxFrame::GetSize(int *width, int *height) const
   *height = rect.bottom - rect.top;
 }
 
-void wxFrame::GetPosition(int *x, int *y) const
+void wxFrame::DoGetPosition(int *x, int *y) const
 {
   RECT rect;
   GetWindowRect((HWND) GetHWND(), &rect);
@@ -761,7 +766,7 @@ void wxFrame::MSWOnMenuHighlight(WXWORD nItem, WXWORD nFlags, WXHMENU hSysMenu)
     event.SetEventObject( this );
     GetEventHandler()->ProcessEvent(event);
   }
-  else if (nFlags != MF_SEPARATOR)
+  else if ((nFlags != MF_SEPARATOR) && (nItem != 0) && (nItem != 65535))
   {
     wxMenuEvent event(wxEVT_MENU_HIGHLIGHT, nItem);
     event.SetEventObject( this );
@@ -863,7 +868,7 @@ void wxFrame::OnMenuHighlight(wxMenuEvent& event)
     if ( menuId != -1 )
     {
       wxMenuBar *menuBar = GetMenuBar();
-      if (menuBar)
+      if (menuBar && menuBar->FindItem(menuId))
       {
         // set status text even if the string is empty - this will at
         // least remove the string from the item which was previously
@@ -916,7 +921,16 @@ void wxFrame::ProcessCommand(int id)
   {
     bar->Check(id,!bar->Checked(id)) ;
   }
-  GetEventHandler()->ProcessEvent(commandEvent);
+
+/*
+  // Process events starting with the window with the focus, if any.
+  wxWindow* focusWin = wxFindFocusDescendant(this);
+
+  wxEvtHandler* evtHandler = focusWin ? focusWin->GetEventHandler() : GetEventHandler();
+*/
+
+  wxEvtHandler* evtHandler = GetEventHandler();
+  evtHandler->ProcessEvent(commandEvent);
 }
 
 // Checks if there is a toolbar, and returns the first free client position