- Sync user32/buttons.c with Wine

- Update wine-syncs doc

svn path=/trunk/; revision=22459
This commit is contained in:
Aleksey Bragin 2006-06-21 14:16:50 +00:00
parent 4c5a1e73e8
commit e291e62bf9
2 changed files with 55 additions and 7 deletions

View file

@ -16,16 +16,61 @@
* *
* You should have received a copy of the GNU Lesser General Public * You should have received a copy of the GNU Lesser General Public
* License along with this library; if not, write to the Free Software * License along with this library; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA
*
* NOTES
*
* This code was audited for completeness against the documented features
* of Comctl32.dll version 6.0 on Oct. 3, 2004, by Dimitrie O. Paun.
*
* Unless otherwise noted, we believe this code to be complete, as per
* the specification mentioned above.
* If you discover missing features, or bugs, please note them below.
*
* TODO
* Styles
* - BS_NOTIFY: is it complete?
* - BS_RIGHTBUTTON: same as BS_LEFTTEXT
* - BS_TYPEMASK
*
* Messages
* - WM_CHAR: Checks a (manual or automatic) check box on '+' or '=', clears it on '-' key.
* - WM_SETFOCUS: For (manual or automatic) radio buttons, send the parent window BN_CLICKED
* - WM_NCCREATE: Turns any BS_OWNERDRAW button into a BS_PUSHBUTTON button.
* - WM_SYSKEYUP
* - BCM_GETIDEALSIZE
* - BCM_GETIMAGELIST
* - BCM_GETTEXTMARGIN
* - BCM_SETIMAGELIST
* - BCM_SETTEXTMARGIN
*
* Notifications
* - BCN_HOTITEMCHANGE
* - BN_DISABLE
* - BN_PUSHED/BN_HILITE
* + BN_KILLFOCUS: is it OK?
* - BN_PAINT
* + BN_SETFOCUS: is it OK?
* - BN_UNPUSHED/BN_UNHILITE
* - NM_CUSTOMDRAW
*
* Structures/Macros/Definitions
* - BUTTON_IMAGELIST
* - NMBCHOTITEM
* - Button_GetIdealSize
* - Button_GetImageList
* - Button_GetTextMargin
* - Button_SetImageList
* - Button_SetTextMargin
*/ */
#define NDEBUG // turn off TRACEs
#include <user32.h> #include <user32.h>
/* GetWindowLong offsets for window extra information */ /* GetWindowLong offsets for window extra information */
#define STATE_GWL_OFFSET 0 #define STATE_GWL_OFFSET 0
#define HFONT_GWL_OFFSET (sizeof(LONG)) #define HFONT_GWL_OFFSET (sizeof(LONG))
#define HIMAGE_GWL_OFFSET (HFONT_GWL_OFFSET*sizeof(LONG)) #define HIMAGE_GWL_OFFSET (HFONT_GWL_OFFSET+sizeof(HFONT))
#define NB_EXTRA_BYTES (HIMAGE_GWL_OFFSET*sizeof(LONG)) #define NB_EXTRA_BYTES (HIMAGE_GWL_OFFSET+sizeof(HANDLE))
/* Button state values */ /* Button state values */
#define BUTTON_UNCHECKED 0x00 #define BUTTON_UNCHECKED 0x00
@ -139,7 +184,7 @@ __inline static HFONT get_button_font( HWND hwnd )
__inline static void set_button_font( HWND hwnd, HFONT font ) __inline static void set_button_font( HWND hwnd, HFONT font )
{ {
SetWindowLongPtrW( hwnd, HFONT_GWL_OFFSET, (LONG)font ); SetWindowLongPtrW( hwnd, HFONT_GWL_OFFSET, (LONG_PTR)font );
} }
__inline static UINT get_button_type( LONG window_style ) __inline static UINT get_button_type( LONG window_style )
@ -308,6 +353,7 @@ static LRESULT WINAPI ButtonWndProc_common(HWND hWnd, UINT uMsg,
break; break;
case WM_CAPTURECHANGED: case WM_CAPTURECHANGED:
TRACE("WM_CAPTURECHANGED %p\n", hWnd);
state = get_button_state( hWnd ); state = get_button_state( hWnd );
if (state & BUTTON_BTNPRESSED) if (state & BUTTON_BTNPRESSED)
{ {
@ -367,6 +413,7 @@ static LRESULT WINAPI ButtonWndProc_common(HWND hWnd, UINT uMsg,
return (LRESULT)get_button_font( hWnd ); return (LRESULT)get_button_font( hWnd );
case WM_SETFOCUS: case WM_SETFOCUS:
TRACE("WM_SETFOCUS %p\n",hWnd);
set_button_state( hWnd, get_button_state(hWnd) | BUTTON_HASFOCUS ); set_button_state( hWnd, get_button_state(hWnd) | BUTTON_HASFOCUS );
paint_button( hWnd, btn_type, ODA_FOCUS ); paint_button( hWnd, btn_type, ODA_FOCUS );
if (style & BS_NOTIFY) if (style & BS_NOTIFY)
@ -374,6 +421,7 @@ static LRESULT WINAPI ButtonWndProc_common(HWND hWnd, UINT uMsg,
break; break;
case WM_KILLFOCUS: case WM_KILLFOCUS:
TRACE("WM_KILLFOCUS %p\n",hWnd);
state = get_button_state( hWnd ); state = get_button_state( hWnd );
set_button_state( hWnd, state & ~BUTTON_HASFOCUS ); set_button_state( hWnd, state & ~BUTTON_HASFOCUS );
paint_button( hWnd, btn_type, ODA_FOCUS ); paint_button( hWnd, btn_type, ODA_FOCUS );
@ -819,7 +867,6 @@ static void PB_Paint( HWND hwnd, HDC hDC, UINT action )
SetBkMode(hDC, oldBkMode); SetBkMode(hDC, oldBkMode);
} }
/********************************************************************** /**********************************************************************
* Check Box & Radio Button Functions * Check Box & Radio Button Functions
*/ */
@ -1053,6 +1100,7 @@ static void UB_Paint( HWND hwnd, HDC hDC, UINT action )
DrawFocusRect( hDC, &rc ); DrawFocusRect( hDC, &rc );
} }
/********************************************************************** /**********************************************************************
* Ownerdrawn Button Functions * Ownerdrawn Button Functions
*/ */

View file

@ -114,7 +114,7 @@ msvcrt -
reactos/dll/win32/msvcrt/wine/*.c # Out of sync reactos/dll/win32/msvcrt/wine/*.c # Out of sync
User32 - User32 -
reactos/dll/win32/user32/controls/button.c # Out of sync reactos/dll/win32/user32/controls/button.c # Synced at 20060621
reactos/dll/win32/user32/controls/edit.c # Out of sync reactos/dll/win32/user32/controls/edit.c # Out of sync
reactos/dll/win32/user32/controls/static.c # Out of sync reactos/dll/win32/user32/controls/static.c # Out of sync
reactos/dll/win32/user32/misc/wsprintf.c # Out of sync reactos/dll/win32/user32/misc/wsprintf.c # Out of sync