Author: gadamopoulos
Date: Tue Feb 21 21:03:04 2017
New Revision: 73871

URL: http://svn.reactos.org/svn/reactos?rev=73871&view=rev
Log:
[COMCTL32]: Copy button.c from user32, make the needed changes to make it 
compile and register it. This is the beginning of the v6 button. Remove the 
subclassing of the builtin button.

Added:
    trunk/reactos/dll/win32/comctl32/button.c
      - copied, changed from r73835, 
trunk/reactos/win32ss/user/user32/controls/button.c
Modified:
    trunk/reactos/dll/win32/comctl32/CMakeLists.txt
    trunk/reactos/dll/win32/comctl32/comctl32.h
    trunk/reactos/dll/win32/comctl32/commctrl.c
    trunk/reactos/dll/win32/comctl32/theming.c

Modified: trunk/reactos/dll/win32/comctl32/CMakeLists.txt
URL: 
http://svn.reactos.org/svn/reactos/trunk/reactos/dll/win32/comctl32/CMakeLists.txt?rev=73871&r1=73870&r2=73871&view=diff
==============================================================================
--- trunk/reactos/dll/win32/comctl32/CMakeLists.txt     [iso-8859-1] (original)
+++ trunk/reactos/dll/win32/comctl32/CMakeLists.txt     [iso-8859-1] Tue Feb 21 
21:03:04 2017
@@ -12,6 +12,7 @@
 
 list(APPEND SOURCE
     animate.c
+    button.c
     comboex.c
     comctl32undoc.c
     commctrl.c

Copied: trunk/reactos/dll/win32/comctl32/button.c (from r73835, 
trunk/reactos/win32ss/user/user32/controls/button.c)
URL: 
http://svn.reactos.org/svn/reactos/trunk/reactos/dll/win32/comctl32/button.c?p2=trunk/reactos/dll/win32/comctl32/button.c&p1=trunk/reactos/win32ss/user/user32/controls/button.c&r1=73835&r2=73871&rev=73871&view=diff
==============================================================================
--- trunk/reactos/win32ss/user/user32/controls/button.c [iso-8859-1] (original)
+++ trunk/reactos/dll/win32/comctl32/button.c   [iso-8859-1] Tue Feb 21 
21:03:04 2017
@@ -62,7 +62,7 @@
  *  - Button_SetImageList
  *  - Button_SetTextMargin
  */
-#include <user32.h>
+#include "comctl32.h"
 
 #include <wine/debug.h>
 WINE_DEFAULT_DEBUG_CHANNEL(button);
@@ -135,6 +135,7 @@
     OB_Paint     /* BS_OWNERDRAW */
 };
 
+#ifdef _USER32_
 /*********************************************************************
  * button class descriptor
  */
@@ -153,6 +154,7 @@
     IDC_ARROW,           /* cursor */
     0                    /* brush */
 };
+#endif
 
 
 static inline LONG get_button_state( HWND hwnd )
@@ -178,6 +180,33 @@
 }
 
 #endif /* __REACTOS__ */
+
+#ifndef _USER32_
+#define NtUserAlterWindowStyle SetWindowLongPtrW
+
+HRGN set_control_clipping( HDC hdc, const RECT *rect )
+{
+    RECT rc = *rect;
+    HRGN hrgn = CreateRectRgn( 0, 0, 0, 0 );
+
+    if (GetClipRgn( hdc, hrgn ) != 1)
+    {
+        DeleteObject( hrgn );
+        hrgn = 0;
+    }
+    DPtoLP( hdc, (POINT *)&rc, 2 );
+    if (GetLayout( hdc ) & LAYOUT_RTL)  /* compensate for the shifting done by 
IntersectClipRect */
+    {
+        rc.left++;
+        rc.right++;
+    }
+    IntersectClipRect( hdc, rc.left, rc.top, rc.right, rc.bottom );
+    return hrgn;
+}
+
+BOOL BUTTON_Paint(HTHEME theme, HWND hwnd, HDC hParamDC, UINT action);
+
+#endif
 
 static inline HFONT get_button_font( HWND hwnd )
 {
@@ -249,7 +278,7 @@
     UINT btn_type = get_button_type( style );
     LONG state;
     HANDLE oldHbitmap;
-#ifdef __REACTOS__
+#if defined(__REACTOS__) && defined(_USER32_)
     PWND pWnd;
 
     pWnd = ValidateHwnd(hWnd);
@@ -315,7 +344,7 @@
 #endif
         return 0;
 
-#ifdef __REACTOS__
+#if defined(__REACTOS__) && defined(_USER32_)
     case WM_NCDESTROY:
         NtUserSetWindowFNID(hWnd, FNID_DESTROY);
     case WM_DESTROY:
@@ -330,7 +359,7 @@
             HBRUSH hBrush;
             HWND parent = GetParent(hWnd);
             if (!parent) parent = hWnd;
-#ifdef __REACTOS__
+#if defined(__REACTOS__) && defined(_USER32_)
             hBrush = GetControlColor( parent, hWnd, hdc, WM_CTLCOLORBTN);
 #else
             hBrush = (HBRUSH)SendMessageW(parent, WM_CTLCOLORBTN, (WPARAM)hdc, 
(LPARAM)hWnd);
@@ -484,7 +513,7 @@
                             WM_CTLCOLORBTN : WM_CTLCOLORSTATIC;
 
             if (!parent) parent = hWnd;
-#ifdef __REACTOS__
+#if defined(__REACTOS__) && defined(_USER32_)
             hbrush = GetControlColor(parent, hWnd, hdc, message);
 #else
             hbrush = (HBRUSH)SendMessageW(parent, message,
@@ -945,7 +974,7 @@
     if ((hFont = get_button_font( hwnd ))) SelectObject( hDC, hFont );
     parent = GetParent(hwnd);
     if (!parent) parent = hwnd;
-#ifdef __REACTOS__
+#if defined(__REACTOS__) && defined(_USER32_)
     GetControlColor( parent, hwnd, hDC, WM_CTLCOLORBTN);
 #else
     SendMessageW( parent, WM_CTLCOLORBTN, (WPARAM)hDC, (LPARAM)hwnd );
@@ -1061,7 +1090,7 @@
 
     parent = GetParent(hwnd);
     if (!parent) parent = hwnd;
-#ifdef __REACTOS__
+#if defined(__REACTOS__) && defined(_USER32_)
     hBrush = GetControlColor(parent, hwnd, hDC, WM_CTLCOLORSTATIC);
 #else
     hBrush = (HBRUSH)SendMessageW(parent, WM_CTLCOLORSTATIC,
@@ -1215,7 +1244,7 @@
     /* GroupBox acts like static control, so it sends CTLCOLORSTATIC */
     parent = GetParent(hwnd);
     if (!parent) parent = hwnd;
-#ifdef __REACTOS__
+#if defined(__REACTOS__) && defined(_USER32_)
     hbr = GetControlColor(parent, hwnd, hDC, WM_CTLCOLORSTATIC);
 #else
     hbr = (HBRUSH)SendMessageW(parent, WM_CTLCOLORSTATIC, (WPARAM)hDC, 
(LPARAM)hwnd);
@@ -1271,7 +1300,7 @@
 
     parent = GetParent(hwnd);
     if (!parent) parent = hwnd;
-#ifdef __REACTOS__
+#if defined(__REACTOS__) && defined(_USER32_)
     hBrush = GetControlColor( parent, hwnd, hDC, WM_CTLCOLORBTN);
 #else
     hBrush = (HBRUSH)SendMessageW(parent, WM_CTLCOLORBTN, (WPARAM)hDC, 
(LPARAM)hwnd);
@@ -1336,7 +1365,7 @@
     if ((hFont = get_button_font( hwnd ))) hPrevFont = SelectObject( hDC, 
hFont );
     parent = GetParent(hwnd);
     if (!parent) parent = hwnd;
-#ifdef __REACTOS__
+#if defined(__REACTOS__) && defined(_USER32_)
     GetControlColor( parent, hwnd, hDC, WM_CTLCOLORBTN);
 #else
     SendMessageW( parent, WM_CTLCOLORBTN, (WPARAM)hDC, (LPARAM)hwnd );
@@ -1349,3 +1378,26 @@
     SelectClipRgn( hDC, hrgn );
     if (hrgn) DeleteObject( hrgn );
 }
+
+#ifndef _USER32_
+void BUTTON_Register()
+{
+    WNDCLASSW wndClass;
+
+    ZeroMemory(&wndClass, sizeof(WNDCLASSW));
+    wndClass.style         = CS_GLOBALCLASS | CS_DBLCLKS | CS_VREDRAW | 
CS_HREDRAW | CS_PARENTDC;
+    wndClass.lpfnWndProc   = ButtonWndProcW;
+    wndClass.cbClsExtra    = 0;
+    wndClass.cbWndExtra    = NB_EXTRA_BYTES;
+    wndClass.hCursor       = LoadCursorW(0, (LPCWSTR)IDC_ARROW);
+    wndClass.hbrBackground = (HBRUSH)(COLOR_BTNFACE + 1);
+    wndClass.lpszClassName = WC_BUTTONW;
+
+    RegisterClassW(&wndClass);
+}
+
+void BUTTON_Unregister()
+{
+    UnregisterClassW(WC_BUTTONW, NULL);
+}
+#endif

Modified: trunk/reactos/dll/win32/comctl32/comctl32.h
URL: 
http://svn.reactos.org/svn/reactos/trunk/reactos/dll/win32/comctl32/comctl32.h?rev=73871&r1=73870&r2=73871&view=diff
==============================================================================
--- trunk/reactos/dll/win32/comctl32/comctl32.h [iso-8859-1] (original)
+++ trunk/reactos/dll/win32/comctl32/comctl32.h [iso-8859-1] Tue Feb 21 
21:03:04 2017
@@ -159,7 +159,8 @@
 extern void TREEVIEW_Unregister(void) DECLSPEC_HIDDEN;
 extern void UPDOWN_Register(void) DECLSPEC_HIDDEN;
 extern void UPDOWN_Unregister(void) DECLSPEC_HIDDEN;
-
+extern void BUTTON_Register();
+extern void BUTTON_Unregister();
 
 int MONTHCAL_MonthLength(int month, int year) DECLSPEC_HIDDEN;
 int MONTHCAL_CalculateDayOfWeek(SYSTEMTIME *date, BOOL inplace) 
DECLSPEC_HIDDEN;

Modified: trunk/reactos/dll/win32/comctl32/commctrl.c
URL: 
http://svn.reactos.org/svn/reactos/trunk/reactos/dll/win32/comctl32/commctrl.c?rev=73871&r1=73870&r2=73871&view=diff
==============================================================================
--- trunk/reactos/dll/win32/comctl32/commctrl.c [iso-8859-1] (original)
+++ trunk/reactos/dll/win32/comctl32/commctrl.c [iso-8859-1] Tue Feb 21 
21:03:04 2017
@@ -274,6 +274,7 @@
     {
         activated = ActivateActCtx(hActCtx6, &ulCookie);
         RegisterControls();      /* Register the classes pretending to be v6 */
+        BUTTON_Register();
         if (activated) DeactivateActCtx(0, ulCookie);
 
         /* Initialize the themed controls only when the v6 manifest is present 
*/
@@ -298,6 +299,7 @@
         activated = ActivateActCtx(hActCtx6, &ulCookie);
         THEMING_Uninitialize();
         UnregisterControls();
+        BUTTON_Unregister();
         if (activated) DeactivateActCtx(0, ulCookie);
     }
 }

Modified: trunk/reactos/dll/win32/comctl32/theming.c
URL: 
http://svn.reactos.org/svn/reactos/trunk/reactos/dll/win32/comctl32/theming.c?rev=73871&r1=73870&r2=73871&view=diff
==============================================================================
--- trunk/reactos/dll/win32/comctl32/theming.c  [iso-8859-1] (original)
+++ trunk/reactos/dll/win32/comctl32/theming.c  [iso-8859-1] Tue Feb 21 
21:03:04 2017
@@ -26,8 +26,6 @@
 typedef LRESULT (CALLBACK* THEMING_SUBCLASSPROC)(HWND, UINT, WPARAM, LPARAM,
     ULONG_PTR);
 
-extern LRESULT CALLBACK THEMING_ButtonSubclassProc (HWND, UINT, WPARAM, LPARAM,
-                                                    ULONG_PTR) DECLSPEC_HIDDEN;
 extern LRESULT CALLBACK THEMING_ComboSubclassProc (HWND, UINT, WPARAM, LPARAM,
                                                    ULONG_PTR) DECLSPEC_HIDDEN;
 extern LRESULT CALLBACK THEMING_EditSubclassProc (HWND, UINT, WPARAM, LPARAM,
@@ -46,7 +44,6 @@
     THEMING_SUBCLASSPROC subclassProc;
 } subclasses[] = {
     /* Note: list must be sorted by class name */
-    {WC_BUTTONW,           THEMING_ButtonSubclassProc},
     {WC_COMBOBOXW,         THEMING_ComboSubclassProc},
     {comboLboxClass,       THEMING_ListBoxSubclassProc},
     {WC_EDITW,             THEMING_EditSubclassProc},
@@ -86,15 +83,13 @@
 MAKE_SUBCLASS_PROC(2)
 MAKE_SUBCLASS_PROC(3)
 MAKE_SUBCLASS_PROC(4)
-MAKE_SUBCLASS_PROC(5)
 
 static const WNDPROC subclassProcs[NUM_SUBCLASSES] = {
     subclass_proc0,
     subclass_proc1,
     subclass_proc2,
     subclass_proc3,
-    subclass_proc4,
-    subclass_proc5
+    subclass_proc4
 };
 
 /***********************************************************************


Reply via email to