]> git.saurik.com Git - wxWidgets.git/blobdiff - src/msw/window.cpp
added line selection
[wxWidgets.git] / src / msw / window.cpp
index f5db90dc550348a211e1c657c8bf0fd51fc08368..f67e46e9be294ce6e9e594b267a1eedecb83671b 100644 (file)
@@ -217,15 +217,13 @@ static inline void wxBringWindowToTop(HWND hwnd)
 
     // activate (set focus to) specified window
     ::SetFocus(hwnd);
+#endif
 
     // raise top level parent to top of z order
-    ::SetWindowPos(hwnd, HWND_TOP, 0, 0, 0, 0, SWP_NOMOVE | SWP_NOSIZE);
-#else // !__WXMICROWIN__
-    if ( !::BringWindowToTop(hwnd) )
+    if (!::SetWindowPos(hwnd, HWND_TOP, 0, 0, 0, 0, SWP_NOMOVE | SWP_NOSIZE))
     {
-        wxLogLastError(_T("BringWindowToTop"));
+        wxLogLastError(_T("SetWindowPos"));
     }
-#endif // __WXMICROWIN__/!__WXMICROWIN__
 }
 
 // ---------------------------------------------------------------------------
@@ -2188,6 +2186,24 @@ long wxWindowMSW::MSWWindowProc(WXUINT message, WXWPARAM wParam, WXLPARAM lParam
             processed = HandleMove(GET_X_LPARAM(lParam), GET_Y_LPARAM(lParam));
             break;
 
+        case WM_MOVING:
+                       {
+                               LPRECT pRect = (LPRECT)lParam;
+                               wxRect rc;
+                               rc.SetLeft(pRect->left);
+                               rc.SetTop(pRect->top);
+                               rc.SetRight(pRect->right);
+                               rc.SetBottom(pRect->bottom);
+                               processed = HandleMoving(rc);
+                               if (processed) {
+                                       pRect->left = rc.GetLeft();
+                                       pRect->top = rc.GetTop();
+                                       pRect->right = rc.GetRight();
+                                       pRect->bottom = rc.GetBottom();
+                               }
+                       }
+            break;
+
         case WM_SIZE:
             switch ( wParam )
             {
@@ -2216,6 +2232,24 @@ long wxWindowMSW::MSWWindowProc(WXUINT message, WXWPARAM wParam, WXLPARAM lParam
             }
             break;
 
+        case WM_SIZING:
+            {
+                LPRECT pRect = (LPRECT)lParam;
+                wxRect rc;
+                rc.SetLeft(pRect->left);
+                rc.SetTop(pRect->top);
+                rc.SetRight(pRect->right);
+                rc.SetBottom(pRect->bottom);
+                processed = HandleSizing(rc);
+                if (processed) {
+                    pRect->left = rc.GetLeft();
+                    pRect->top = rc.GetTop();
+                    pRect->right = rc.GetRight();
+                    pRect->bottom = rc.GetBottom();
+                }
+            }
+            break;
+
 #ifndef __WXMICROWIN__
         case WM_ACTIVATEAPP:
             wxTheApp->SetActive(wParam != 0, FindFocus());
@@ -3397,16 +3431,21 @@ bool wxWindowMSW::MSWOnDrawItem(int id, WXDRAWITEMSTRUCT *itemStruct)
     }
 #endif // wxUSE_MENUS_NATIVE
 
+#endif // USE_OWNER_DRAWN
+
 #if wxUSE_CONTROLS
+
     wxWindow *item = FindItem(id);
+#if wxUSE_OWNER_DRAWN
     if ( item && item->IsKindOf(CLASSINFO(wxControl)) )
-    {
         return ((wxControl *)item)->MSWOnDraw(itemStruct);
-    }
-#endif // wxUSE_CONTROLS
-
+#else
+    if ( item && item->IsKindOf(CLASSINFO(wxButton)) )
+        return ((wxButton *)item)->MSWOnDraw(itemStruct);
 #endif // USE_OWNER_DRAWN
 
+#endif // wxUSE_CONTROLS
+
     return FALSE;
 }
 
@@ -3699,6 +3738,9 @@ extern wxCOLORMAP *wxGetStdColourMap()
 
 bool wxWindowMSW::HandlePaint()
 {
+//    if (GetExtraStyle() & wxWS_EX_THEMED_BACKGROUND)
+//        return FALSE;
+    
 #ifdef __WIN32__
     HRGN hRegion = ::CreateRectRgn(0, 0, 0, 0); // Dummy call to get a handle
     if ( !hRegion )
@@ -3751,6 +3793,29 @@ bool wxWindowMSW::HandleEraseBkgnd(WXHDC hdc)
     if ( ::IsIconic(GetHwnd()) )
         return TRUE;
 
+#if 0
+    if (GetParent() && GetParent()->GetExtraStyle() & wxWS_EX_THEMED_BACKGROUND)
+    {
+        return FALSE;
+    }
+
+    if (GetExtraStyle() & wxWS_EX_THEMED_BACKGROUND)
+    {
+        if (wxUxThemeEngine::Get())
+        {
+            WXHTHEME hTheme = wxUxThemeEngine::Get()->m_pfnOpenThemeData(GetHWND(), L"TAB");
+            if (hTheme)
+            {
+                WXURECT rect;
+                ::GetClientRect((HWND) GetHWND(), (RECT*) & rect);
+                wxUxThemeEngine::Get()->m_pfnDrawThemeBackground(hTheme, hdc, 10 /* TABP_BODY */, 0, &rect, &rect);
+                wxUxThemeEngine::Get()->m_pfnCloseThemeData(hTheme);
+                return TRUE;
+            }
+        }
+    }
+#endif
+    
     wxDCTemp dc(hdc);
 
     dc.SetHDC(hdc);
@@ -3818,6 +3883,17 @@ bool wxWindowMSW::HandleMove(int x, int y)
     return GetEventHandler()->ProcessEvent(event);
 }
 
+bool wxWindowMSW::HandleMoving(wxRect& rect)
+{
+    wxMoveEvent event(rect, m_windowId);
+    event.SetEventObject(this);
+    
+    bool rc = GetEventHandler()->ProcessEvent(event);
+    if (rc)
+        rect = event.GetRect();
+    return rc;
+}
+
 bool wxWindowMSW::HandleSize(int WXUNUSED(w), int WXUNUSED(h),
                              WXUINT WXUNUSED(flag))
 {
@@ -3830,6 +3906,17 @@ bool wxWindowMSW::HandleSize(int WXUNUSED(w), int WXUNUSED(h),
     return GetEventHandler()->ProcessEvent(event);
 }
 
+bool wxWindowMSW::HandleSizing(wxRect& rect)
+{
+    wxSizeEvent event(rect, m_windowId);
+    event.SetEventObject(this);
+    
+    bool rc = GetEventHandler()->ProcessEvent(event);
+    if (rc)
+        rect = event.GetRect();
+    return rc;
+}
+
 bool wxWindowMSW::HandleGetMinMaxInfo(void *mmInfo)
 {
     MINMAXINFO *info = (MINMAXINFO *)mmInfo;