[prev in list] [next in list] [prev in thread] [next in thread] 

List:       wine-devel
Subject:    Re: [1/2] comctl32: support for drawing themed push buttons. [try 3]
From:       Alexandre Julliard <julliard () winehq ! org>
Date:       2008-07-30 13:19:05
Message-ID: 87wsj3h5me.fsf () wine ! dyndns ! org
[Download RAW message or body]

"Reece Dunn" <msclrhd@googlemail.com> writes:

> -typedef void (*pfThemedPaint)(HTHEME theme, HWND hwnd, HDC hdc);
> +/* These are indices into a states array to determine the theme state for a given theme part. */
> +#define STATE_NORMAL 0
> +#define STATE_DISABLED 1
> +#define STATE_HOT 2
> +#define STATE_PRESSED 3
> +#define STATE_DEFAULTED 4

An enum would be nicer.

> +static void PB_draw(HTHEME theme, HWND hwnd, HDC hDC, int drawState, UINT dtFlags)
> +{
> +    static const int states[] = { PBS_NORMAL, PBS_DISABLED, PBS_HOT, PBS_PRESSED, PBS_DEFAULTED };
> +
> +    RECT bgRect, textRect;
> +    HFONT font = (HFONT)SendMessageW(hwnd, WM_GETFONT, 0, 0);
> +    HFONT hPrevFont = font ? SelectObject(hDC, font) : NULL;
> +    int state = states[ drawState ];
> +    WCHAR text[MAX_PATH];
> +    int len = MAX_PATH;

MAX_PATH is not appropriate for a button text, this has nothing to do
with a path. You should define your own constant, though dynamic
allocation would of course be preferable.

-- 
Alexandre Julliard
julliard@winehq.org


[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic