*
* 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 <user32.h>
/* 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
__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 )
break;
case WM_CAPTURECHANGED:
+ TRACE("WM_CAPTURECHANGED %p\n", hWnd);
state = get_button_state( hWnd );
if (state & BUTTON_BTNPRESSED)
{
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)
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 );
SetBkMode(hDC, oldBkMode);
}
-
/**********************************************************************
* Check Box & Radio Button Functions
*/
DrawFocusRect( hDC, &rc );
}
+
/**********************************************************************
* Ownerdrawn Button Functions
*/