Commit 5d10abde authored by Nikolay Sivov's avatar Nikolay Sivov Committed by Alexandre Julliard

comctl32: Introduce Button control.

parent b21eb673
...@@ -6,6 +6,7 @@ DELAYIMPORTS = winmm uxtheme ...@@ -6,6 +6,7 @@ DELAYIMPORTS = winmm uxtheme
C_SRCS = \ C_SRCS = \
animate.c \ animate.c \
button.c \
comboex.c \ comboex.c \
comctl32undoc.c \ comctl32undoc.c \
commctrl.c \ commctrl.c \
......
...@@ -175,6 +175,7 @@ BOOL WINAPI MirrorIcon(HICON *phicon1, HICON *phicon2); ...@@ -175,6 +175,7 @@ BOOL WINAPI MirrorIcon(HICON *phicon1, HICON *phicon2);
extern void ANIMATE_Register(void) DECLSPEC_HIDDEN; extern void ANIMATE_Register(void) DECLSPEC_HIDDEN;
extern void ANIMATE_Unregister(void) DECLSPEC_HIDDEN; extern void ANIMATE_Unregister(void) DECLSPEC_HIDDEN;
extern void BUTTON_Register(void) DECLSPEC_HIDDEN;
extern void COMBOEX_Register(void) DECLSPEC_HIDDEN; extern void COMBOEX_Register(void) DECLSPEC_HIDDEN;
extern void COMBOEX_Unregister(void) DECLSPEC_HIDDEN; extern void COMBOEX_Unregister(void) DECLSPEC_HIDDEN;
extern void DATETIME_Register(void) DECLSPEC_HIDDEN; extern void DATETIME_Register(void) DECLSPEC_HIDDEN;
......
...@@ -98,6 +98,7 @@ static void unregister_versioned_classes(void) ...@@ -98,6 +98,7 @@ static void unregister_versioned_classes(void)
#define VERSION "6.0.2600.2982!" #define VERSION "6.0.2600.2982!"
static const char *classes[] = static const char *classes[] =
{ {
VERSION WC_BUTTONA,
VERSION WC_EDITA, VERSION WC_EDITA,
}; };
int i; int i;
...@@ -167,6 +168,7 @@ BOOL WINAPI DllMain(HINSTANCE hinstDLL, DWORD fdwReason, LPVOID lpvReserved) ...@@ -167,6 +168,7 @@ BOOL WINAPI DllMain(HINSTANCE hinstDLL, DWORD fdwReason, LPVOID lpvReserved)
TREEVIEW_Register (); TREEVIEW_Register ();
UPDOWN_Register (); UPDOWN_Register ();
BUTTON_Register ();
EDIT_Register (); EDIT_Register ();
/* subclass user32 controls */ /* subclass user32 controls */
......
...@@ -576,7 +576,8 @@ static void test_button_messages(void) ...@@ -576,7 +576,8 @@ static void test_button_messages(void)
SendMessageA(hwnd, BM_SETSTYLE, button[i].style | BS_BOTTOM, TRUE); SendMessageA(hwnd, BM_SETSTYLE, button[i].style | BS_BOTTOM, TRUE);
SendMessageA(hwnd, WM_APP, 0, 0); /* place a separator mark here */ SendMessageA(hwnd, WM_APP, 0, 0); /* place a separator mark here */
while (PeekMessageA(&msg, 0, 0, 0, PM_REMOVE)) DispatchMessageA(&msg); while (PeekMessageA(&msg, 0, 0, 0, PM_REMOVE)) DispatchMessageA(&msg);
ok_sequence(sequences, COMBINED_SEQ_INDEX, button[i].setstyle, "BM_SETSTYLE on a button", TRUE); todo = button[i].style == BS_USERBUTTON || button[i].style == BS_OWNERDRAW;
ok_sequence(sequences, COMBINED_SEQ_INDEX, button[i].setstyle, "BM_SETSTYLE on a button", todo);
style = GetWindowLongA(hwnd, GWL_STYLE); style = GetWindowLongA(hwnd, GWL_STYLE);
style &= ~(WS_VISIBLE | WS_CHILD | BS_NOTIFY); style &= ~(WS_VISIBLE | WS_CHILD | BS_NOTIFY);
...@@ -623,17 +624,14 @@ static void test_button_messages(void) ...@@ -623,17 +624,14 @@ static void test_button_messages(void)
button[i].style == BS_AUTORADIOBUTTON) button[i].style == BS_AUTORADIOBUTTON)
{ {
seq = setcheck_radio_seq; seq = setcheck_radio_seq;
todo = TRUE;
} }
else else
{
seq = setcheck_ignored_seq; seq = setcheck_ignored_seq;
todo = FALSE;
}
SendMessageA(hwnd, BM_SETCHECK, BST_UNCHECKED, 0); SendMessageA(hwnd, BM_SETCHECK, BST_UNCHECKED, 0);
SendMessageA(hwnd, WM_APP, 0, 0); /* place a separator mark here */ SendMessageA(hwnd, WM_APP, 0, 0); /* place a separator mark here */
while (PeekMessageA(&msg, 0, 0, 0, PM_REMOVE)) DispatchMessageA(&msg); while (PeekMessageA(&msg, 0, 0, 0, PM_REMOVE)) DispatchMessageA(&msg);
ok_sequence(sequences, COMBINED_SEQ_INDEX, seq, "BM_SETCHECK on a button", todo); ok_sequence(sequences, COMBINED_SEQ_INDEX, seq, "BM_SETCHECK on a button", FALSE);
state = SendMessageA(hwnd, BM_GETCHECK, 0, 0); state = SendMessageA(hwnd, BM_GETCHECK, 0, 0);
ok(state == BST_UNCHECKED, "expected BST_UNCHECKED, got %04x\n", state); ok(state == BST_UNCHECKED, "expected BST_UNCHECKED, got %04x\n", state);
...@@ -715,7 +713,6 @@ static void test_button_class(void) ...@@ -715,7 +713,6 @@ static void test_button_class(void)
ret = GetClassInfoExA(NULL, WC_BUTTONA, &exA); ret = GetClassInfoExA(NULL, WC_BUTTONA, &exA);
ok(ret, "got %d\n", ret); ok(ret, "got %d\n", ret);
todo_wine
ok(IS_WNDPROC_HANDLE(exA.lpfnWndProc), "got %p\n", exA.lpfnWndProc); ok(IS_WNDPROC_HANDLE(exA.lpfnWndProc), "got %p\n", exA.lpfnWndProc);
ret = GetClassInfoExW(NULL, WC_BUTTONW, &exW); ret = GetClassInfoExW(NULL, WC_BUTTONW, &exW);
...@@ -727,9 +724,7 @@ todo_wine ...@@ -727,9 +724,7 @@ todo_wine
ok(lstrcmpW(nameW, WC_BUTTONW), "got %s\n", wine_dbgstr_w(nameW)); ok(lstrcmpW(nameW, WC_BUTTONW), "got %s\n", wine_dbgstr_w(nameW));
ret = GetClassInfoExW(NULL, nameW, &ex2W); ret = GetClassInfoExW(NULL, nameW, &ex2W);
todo_wine
ok(ret, "got %d\n", ret); ok(ret, "got %d\n", ret);
if (ret) /* TODO: remove once Wine is fixed */
ok(ex2W.lpfnWndProc == exW.lpfnWndProc, "got %p, %p\n", exW.lpfnWndProc, ex2W.lpfnWndProc); ok(ex2W.lpfnWndProc == exW.lpfnWndProc, "got %p, %p\n", exW.lpfnWndProc, ex2W.lpfnWndProc);
/* Check reported class name */ /* Check reported class name */
...@@ -745,10 +740,8 @@ if (ret) /* TODO: remove once Wine is fixed */ ...@@ -745,10 +740,8 @@ if (ret) /* TODO: remove once Wine is fixed */
/* explicitly create with versioned class name */ /* explicitly create with versioned class name */
hwnd = CreateWindowExW(0, nameW, testW, BS_CHECKBOX, 0, 0, 50, 14, NULL, 0, 0, NULL); hwnd = CreateWindowExW(0, nameW, testW, BS_CHECKBOX, 0, 0, 50, 14, NULL, 0, 0, NULL);
todo_wine
ok(hwnd != NULL, "failed to create a window %s\n", wine_dbgstr_w(nameW)); ok(hwnd != NULL, "failed to create a window %s\n", wine_dbgstr_w(nameW));
if (hwnd)
{
len = GetClassNameA(hwnd, buffA, sizeof(buffA)); len = GetClassNameA(hwnd, buffA, sizeof(buffA));
ok(len == strlen(buffA), "got %d\n", len); ok(len == strlen(buffA), "got %d\n", len);
ok(!strcmp(buffA, "Button"), "got %s\n", buffA); ok(!strcmp(buffA, "Button"), "got %s\n", buffA);
...@@ -759,7 +752,6 @@ if (hwnd) ...@@ -759,7 +752,6 @@ if (hwnd)
DestroyWindow(hwnd); DestroyWindow(hwnd);
} }
}
static void register_parent_class(void) static void register_parent_class(void)
{ {
......
...@@ -345,7 +345,8 @@ static void check_class( const char *name, int must_exist, UINT style, UINT igno ...@@ -345,7 +345,8 @@ static void check_class( const char *name, int must_exist, UINT style, UINT igno
if (GetClassInfoA( 0, name, &wc )) if (GetClassInfoA( 0, name, &wc ))
{ {
todo_wine_if(strcmp(name, "Edit")) todo_wine_if(strcmp(name, "Button") &&
strcmp(name, "Edit"))
ok( !(~wc.style & style & ~ignore), "System class %s is missing bits %x (%08x/%08x)\n", ok( !(~wc.style & style & ~ignore), "System class %s is missing bits %x (%08x/%08x)\n",
name, ~wc.style & style, wc.style, style ); name, ~wc.style & style, wc.style, style );
ok( !(wc.style & ~style), "System class %s has extra bits %x (%08x/%08x)\n", ok( !(wc.style & ~style), "System class %s has extra bits %x (%08x/%08x)\n",
......
...@@ -166,7 +166,6 @@ static BOOL is_builtin_class( const WCHAR *name ) ...@@ -166,7 +166,6 @@ static BOOL is_builtin_class( const WCHAR *name )
{ {
static const WCHAR classesW[][20] = static const WCHAR classesW[][20] =
{ {
{'B','u','t','t','o','n',0},
{'C','o','m','b','o','B','o','x',0}, {'C','o','m','b','o','B','o','x',0},
{'C','o','m','b','o','L','B','o','x',0}, {'C','o','m','b','o','L','B','o','x',0},
{'I','M','E',0}, {'I','M','E',0},
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment