diff --git a/reactos/dll/win32/user32/controls/button.c b/reactos/dll/win32/user32/controls/button.c index ea872deffcf..40c1d5b95e5 100644 --- a/reactos/dll/win32/user32/controls/button.c +++ b/reactos/dll/win32/user32/controls/button.c @@ -16,16 +16,61 @@ * * You should have received a copy of the GNU Lesser General Public * 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 /* GetWindowLong offsets for window extra information */ #define STATE_GWL_OFFSET 0 #define HFONT_GWL_OFFSET (sizeof(LONG)) -#define HIMAGE_GWL_OFFSET (HFONT_GWL_OFFSET*sizeof(LONG)) -#define NB_EXTRA_BYTES (HIMAGE_GWL_OFFSET*sizeof(LONG)) +#define HIMAGE_GWL_OFFSET (HFONT_GWL_OFFSET+sizeof(HFONT)) +#define NB_EXTRA_BYTES (HIMAGE_GWL_OFFSET+sizeof(HANDLE)) /* Button state values */ #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 ) { - SetWindowLongPtrW( hwnd, HFONT_GWL_OFFSET, (LONG)font ); + SetWindowLongPtrW( hwnd, HFONT_GWL_OFFSET, (LONG_PTR)font ); } __inline static UINT get_button_type( LONG window_style ) @@ -308,6 +353,7 @@ static LRESULT WINAPI ButtonWndProc_common(HWND hWnd, UINT uMsg, break; case WM_CAPTURECHANGED: + TRACE("WM_CAPTURECHANGED %p\n", hWnd); state = get_button_state( hWnd ); if (state & BUTTON_BTNPRESSED) { @@ -367,6 +413,7 @@ static LRESULT WINAPI ButtonWndProc_common(HWND hWnd, UINT uMsg, return (LRESULT)get_button_font( hWnd ); case WM_SETFOCUS: + TRACE("WM_SETFOCUS %p\n",hWnd); set_button_state( hWnd, get_button_state(hWnd) | BUTTON_HASFOCUS ); paint_button( hWnd, btn_type, ODA_FOCUS ); if (style & BS_NOTIFY) @@ -374,6 +421,7 @@ static LRESULT WINAPI ButtonWndProc_common(HWND hWnd, UINT uMsg, break; case WM_KILLFOCUS: + TRACE("WM_KILLFOCUS %p\n",hWnd); state = get_button_state( hWnd ); set_button_state( hWnd, state & ~BUTTON_HASFOCUS ); paint_button( hWnd, btn_type, ODA_FOCUS ); @@ -819,7 +867,6 @@ static void PB_Paint( HWND hwnd, HDC hDC, UINT action ) SetBkMode(hDC, oldBkMode); } - /********************************************************************** * Check Box & Radio Button Functions */ @@ -1053,6 +1100,7 @@ static void UB_Paint( HWND hwnd, HDC hDC, UINT action ) DrawFocusRect( hDC, &rc ); } + /********************************************************************** * Ownerdrawn Button Functions */ diff --git a/reactos/media/doc/README.WINE b/reactos/media/doc/README.WINE index 137707b1114..4159e0e7dca 100644 --- a/reactos/media/doc/README.WINE +++ b/reactos/media/doc/README.WINE @@ -114,7 +114,7 @@ msvcrt - reactos/dll/win32/msvcrt/wine/*.c # Out of sync 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/static.c # Out of sync reactos/dll/win32/user32/misc/wsprintf.c # Out of sync