]> git.saurik.com Git - wxWidgets.git/blobdiff - src/msw/window.cpp
inform the IM context about focus changes
[wxWidgets.git] / src / msw / window.cpp
index 6a4ffb7334591f6b0d09d742325fb9dff794b269..51552987e4ad223da7c3d9c81c029f3f612eef8e 100644 (file)
@@ -1737,6 +1737,12 @@ bool wxWindowMSW::DoPopupMenu(wxMenu *menu, int x, int y)
     menu->SetInvokingWindow(this);
     menu->UpdateUI();
 
+    if ( x == -1 && y == -1 )
+    {
+        wxPoint mouse = ScreenToClient(wxGetMousePosition());
+        x = mouse.x; y = mouse.y;
+    }
+
     HWND hWnd = GetHwnd();
     HMENU hMenu = GetHmenuOf(menu);
     POINT point;
@@ -3689,7 +3695,13 @@ wxWindowMSW::MSWOnDrawItem(int WXUNUSED_UNLESS_ODRAWN(id),
 #else // !wxUSE_OWNER_DRAWN
     // we may still have owner-drawn buttons internally because we have to make
     // them owner-drawn to support colour change
-    wxControl *item = wxDynamicCast(FindItem(id), wxButton);
+    wxControl *item = 
+#                     if wxUSE_BUTTON
+                         wxDynamicCast(FindItem(id), wxButton)
+#                     else
+                         NULL
+#                     endif
+                    ;
 #endif // USE_OWNER_DRAWN
 
     if ( item )
@@ -3916,18 +3928,6 @@ void wxWindowMSW::OnSysColourChanged(wxSysColourChangedEvent& WXUNUSED(event))
 
         node = node->GetNext();
     }
-
-    // update the colours we use if they were not set explicitly by the user:
-    // this must be done or OnCtlColor() would continue to use the old colours
-    if ( !m_hasFgCol || !m_hasBgCol )
-    {
-        wxVisualAttributes attrs = GetDefaultAttributes();
-        if ( !m_hasFgCol )
-            m_foregroundColour = attrs.colFg;
-
-        if ( !m_hasBgCol )
-            m_backgroundColour = attrs.colBg;
-    }
 }
 
 extern wxCOLORMAP *wxGetStdColourMap()
@@ -4093,10 +4093,11 @@ void wxWindowMSW::OnEraseBackground(wxEraseEvent& event)
 {
     RECT rect;
     ::GetClientRect(GetHwnd(), &rect);
-
-    COLORREF ref = PALETTERGB(m_backgroundColour.Red(),
-                              m_backgroundColour.Green(),
-                              m_backgroundColour.Blue());
+    
+    wxColour backgroundColour( GetBackgroundColour());
+    COLORREF ref = PALETTERGB(backgroundColour.Red(),
+                              backgroundColour.Green(),
+                              backgroundColour.Blue());
     HBRUSH hBrush = ::CreateSolidBrush(ref);
     if ( !hBrush )
         wxLogLastError(wxT("CreateSolidBrush"));
@@ -4703,6 +4704,9 @@ int wxWindowMSW::HandleMenuChar(int chAccel, WXLPARAM lParam)
             wxLogLastError(_T("GetMenuItemInfo"));
         }
     }
+#else
+    wxUnusedVar(chAccel);
+    wxUnusedVar(lParam);
 #endif
     return wxNOT_FOUND;
 }
@@ -4791,6 +4795,10 @@ bool wxWindowMSW::HandleJoystickEvent(WXUINT msg, int x, int y, WXUINT flags)
 
     return GetEventHandler()->ProcessEvent(event);
 #else
+    wxUnusedVar(msg);
+    wxUnusedVar(x);
+    wxUnusedVar(y);
+    wxUnusedVar(flags);
     return false;
 #endif
 }
@@ -4879,22 +4887,21 @@ bool wxWindowMSW::MSWOnScroll(int orientation, WXWORD wParam,
 // global functions
 // ===========================================================================
 
-void wxGetCharSize(WXHWND wnd, int *x, int *y, const wxFont *the_font)
+void wxGetCharSize(WXHWND wnd, int *x, int *y, const wxFontthe_font)
 {
     TEXTMETRIC tm;
     HDC dc = ::GetDC((HWND) wnd);
     HFONT fnt =0;
     HFONT was = 0;
-    if ( the_font )
-    {
-        //    the_font->UseResource();
-        //    the_font->RealizeResource();
-        fnt = (HFONT)((wxFont *)the_font)->GetResourceHandle(); // const_cast
-        if ( fnt )
-            was = (HFONT) SelectObject(dc,fnt);
-    }
+        
+    //    the_font.UseResource();
+    //    the_font.RealizeResource();
+    fnt = (HFONT)the_font.GetResourceHandle(); // const_cast
+    if ( fnt )
+        was = (HFONT) SelectObject(dc,fnt);
+    
     GetTextMetrics(dc, &tm);
-    if ( the_font && fnt && was )
+    if ( fnt && was )
     {
         SelectObject(dc,was);
     }
@@ -4905,8 +4912,7 @@ void wxGetCharSize(WXHWND wnd, int *x, int *y, const wxFont *the_font)
     if ( y )
         *y = tm.tmHeight + tm.tmExternalLeading;
 
-    //  if ( the_font )
-    //    the_font->ReleaseResource();
+    //   the_font.ReleaseResource();
 }
 
 // Returns 0 if was a normal ASCII value, not a special key. This indicates that