* Copyright 2001, 2004 Michael Stefaniuc
* Copyright 2001 Charles Loep for CodeWeavers
* Copyright 2002 Dimitrie O. Paun
+ * Copyright 2009 Owen Rudge for CodeWeavers
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* This function CANNOT be used to reduce the number of images.
*/
static void
-IMAGELIST_InternalExpandBitmaps (HIMAGELIST himl, INT nImageCount, INT cy)
+IMAGELIST_InternalExpandBitmaps (HIMAGELIST himl, INT nImageCount, INT cx, INT cy)
{
HDC hdcBitmap;
HBITMAP hbmNewBitmap, hbmNull;
&& (himl->cy >= cy))
return;
+ if (cx == 0) cx = himl->cx;
nNewCount = himl->cCurImage + nImageCount + himl->cGrow;
- imagelist_get_bitmap_size(himl, nNewCount, himl->cx, &sz);
+ imagelist_get_bitmap_size(himl, nNewCount, cx, &sz);
TRACE("Create expanded bitmaps : himl=%p x=%d y=%d count=%d\n", himl, sz.cx, cy, nNewCount);
hdcBitmap = CreateCompatibleDC (0);
- hbmNewBitmap = ImageList_CreateImage(hdcBitmap, himl, nNewCount, himl->cx);
+ hbmNewBitmap = ImageList_CreateImage(hdcBitmap, himl, nNewCount, cx);
if (hbmNewBitmap == 0)
ERR("creating new image bitmap (x=%d y=%d)!\n", sz.cx, cy);
nImageCount = bmp.bmWidth / himl->cx;
- IMAGELIST_InternalExpandBitmaps (himl, nImageCount, bmp.bmHeight);
+ IMAGELIST_InternalExpandBitmaps (himl, nImageCount, bmp.bmWidth, bmp.bmHeight);
hdcBitmap = CreateCompatibleDC(0);
else
nImageCount = 0;
- IMAGELIST_InternalExpandBitmaps (himl, nImageCount, bmp.bmHeight);
+ IMAGELIST_InternalExpandBitmaps (himl, nImageCount, bmp.bmWidth, bmp.bmHeight);
nIndex = himl->cCurImage;
himl->cCurImage += nImageCount;
if (nIndex == -1) {
if (himl->cCurImage + 1 > himl->cMaxImage)
- IMAGELIST_InternalExpandBitmaps (himl, 1, 0);
+ IMAGELIST_InternalExpandBitmaps (himl, 1, 0, 0);
nIndex = himl->cCurImage;
himl->cCurImage++;
{
return SetDIBColorTable(himl->hdcImage, uStartIndex, cEntries, prgb);
}
+
+/*************************************************************************
+ * ImageList_CoCreateInstance [COMCTL32.@]
+ *
+ * Creates a new imagelist instance and returns an interface pointer to it.
+ *
+ * PARAMS
+ * rclsid [I] A reference to the CLSID (CLSID_ImageList).
+ * punkOuter [I] Pointer to IUnknown interface for aggregation, if desired
+ * riid [I] Identifier of the requested interface.
+ * ppv [O] Returns the address of the pointer requested, or NULL.
+ *
+ * RETURNS
+ * Success: S_OK.
+ * Failure: Error value.
+ */
+HRESULT WINAPI
+ImageList_CoCreateInstance (REFCLSID rclsid, const IUnknown *punkOuter, REFIID riid, void **ppv)
+{
+ FIXME("STUB: %s %p %s %p\n", debugstr_guid(rclsid), punkOuter, debugstr_guid(riid), ppv);
+ return E_NOINTERFACE;
+}
+
+/*************************************************************************
+ * HIMAGELIST_QueryInterface [COMCTL32.@]
+ *
+ * Returns a pointer to an IImageList or IImageList2 object for the given
+ * HIMAGELIST.
+ *
+ * PARAMS
+ * himl [I] Image list handle.
+ * riid [I] Identifier of the requested interface.
+ * ppv [O] Returns the address of the pointer requested, or NULL.
+ *
+ * RETURNS
+ * Success: S_OK.
+ * Failure: Error value.
+ */
+HRESULT WINAPI
+HIMAGELIST_QueryInterface (HIMAGELIST himl, REFIID riid, void **ppv)
+{
+ FIXME("STUB: %p %s %p\n", himl, debugstr_guid(riid), ppv);
+ return E_NOINTERFACE;
+}
*/
hwndButton = GetDlgItem(hwndParent, IDCANCEL);
- x = rcSheet.right - ((padding.x + buttonWidth) * (num_buttons - 1));
+ x += padding.x + buttonWidth;
SetWindowPos(hwndButton, 0, x, y, 0, 0,
SWP_NOSIZE | SWP_NOZORDER | SWP_NOACTIVATE);
*/
hwndButton = GetDlgItem(hwndParent, IDC_APPLY_BUTTON);
- if (psInfo->hasApply)
- {
- if (psInfo->hasHelp)
- x = rcSheet.right - ((padding.x + buttonWidth) * 2);
- else
- x = rcSheet.right - (padding.x + buttonWidth);
-
- SetWindowPos(hwndButton, 0, x, y, 0, 0,
- SWP_NOSIZE | SWP_NOZORDER | SWP_NOACTIVATE);
-
- EnableWindow(hwndButton, FALSE);
- }
+ if(psInfo->hasApply)
+ x += padding.x + buttonWidth;
else
ShowWindow(hwndButton, SW_HIDE);
+ SetWindowPos(hwndButton, 0, x, y, 0, 0,
+ SWP_NOSIZE | SWP_NOZORDER | SWP_NOACTIVATE);
+ EnableWindow(hwndButton, FALSE);
+
/*
* Position Help button.
*/
hwndButton = GetDlgItem(hwndParent, IDHELP);
- if (psInfo->hasHelp)
- {
- x = rcSheet.right - (padding.x + buttonWidth);
+ x += padding.x + buttonWidth;
+ SetWindowPos(hwndButton, 0, x, y, 0, 0,
+ SWP_NOSIZE | SWP_NOZORDER | SWP_NOACTIVATE);
- SetWindowPos(hwndButton, 0, x, y, 0, 0,
- SWP_NOSIZE | SWP_NOZORDER | SWP_NOACTIVATE);
- }
- else
+ if(!psInfo->hasHelp)
ShowWindow(hwndButton, SW_HIDE);
return TRUE;
{
HWND hwndTabCtrl;
HWND hwndLineHeader;
+ HWND control;
LPCPROPSHEETPAGEW ppshpage;
TRACE("active_page %d, index %d\n", psInfo->active_page, index);
{
PROPSHEET_SetTitleW(hwndDlg, psInfo->ppshheader.dwFlags,
psInfo->proppage[index].pszText);
+
+ control = GetNextDlgTabItem(psInfo->proppage[index].hwndPage, NULL, FALSE);
+ if(control != NULL)
+ SetFocus(control);
}
if (psInfo->active_page != -1)
if (idx >= 0 && idx < psInfo->nPages)
{
if (PROPSHEET_CanSetCurSel(hwndDlg))
+ {
+ SetFocus(GetDlgItem(hwndDlg, IDC_BACK_BUTTON));
+ SendMessageW(hwndDlg, DM_SETDEFID, IDC_BACK_BUTTON, 0);
PROPSHEET_SetCurSel(hwndDlg, idx, -1, 0);
+ }
}
return TRUE;
}
if (idx < psInfo->nPages )
{
if (PROPSHEET_CanSetCurSel(hwndDlg) != FALSE)
+ {
+ SetFocus(GetDlgItem(hwndDlg, IDC_NEXT_BUTTON));
+ SendMessageW(hwndDlg, DM_SETDEFID, IDC_NEXT_BUTTON, 0);
PROPSHEET_SetCurSel(hwndDlg, idx, 1, 0);
+ }
}
return TRUE;
/* set up the Next and Back buttons by default */
PROPSHEET_SetWizButtons(hwnd, PSWIZB_BACK|PSWIZB_NEXT);
+ SetFocus(GetDlgItem(hwnd, IDC_NEXT_BUTTON));
/* Set up fonts */
SystemParametersInfoW (SPI_GETICONTITLELOGFONT, 0, &logFont, 0);
* from which to switch to the next page */
SendMessageW(hwndTabCtrl, TCM_SETCURSEL, psInfo->active_page, 0);
- PROPSHEET_UnChanged(hwnd, (HWND)wParam);
+ PROPSHEET_UnChanged(hwnd, NULL);
+
+ /* wizards set their focus during init */
+ if (psInfo->ppshheader.dwFlags & INTRNL_ANY_WIZARD)
+ return FALSE;
return TRUE;
}
typedef struct
{
HWND hwndSelf;
+ DWORD dwStyle;
LONG lRangeMin;
LONG lRangeMax;
LONG lLineSize;
static BOOL
notify_with_scroll (const TRACKBAR_INFO *infoPtr, UINT code)
{
- BOOL bVert = GetWindowLongW (infoPtr->hwndSelf, GWL_STYLE) & TBS_VERT;
+ BOOL bVert = infoPtr->dwStyle & TBS_VERT;
TRACE("%x\n", code);
int tic;
unsigned nrTics, i;
- if (infoPtr->uTicFreq && infoPtr->lRangeMax >= infoPtr->lRangeMin)
- nrTics=(infoPtr->lRangeMax - infoPtr->lRangeMin)/infoPtr->uTicFreq;
+ if (infoPtr->uTicFreq && infoPtr->lRangeMax >= infoPtr->lRangeMin) {
+ nrTics=(infoPtr->lRangeMax - infoPtr->lRangeMin)/infoPtr->uTicFreq;
+ /* don't add extra tic if there's no remainder */
+ if ((infoPtr->lRangeMax - infoPtr->lRangeMin) % infoPtr->uTicFreq == 0)
+ nrTics--;
+ }
else {
Free (infoPtr->tics);
infoPtr->tics = NULL;
(in range of trackbar) */
static inline LONG
-TRACKBAR_ConvertPlaceToPosition (const TRACKBAR_INFO *infoPtr, int place, int vertical)
+TRACKBAR_ConvertPlaceToPosition (const TRACKBAR_INFO *infoPtr, int place)
{
double range, width, pos, offsetthumb;
range = infoPtr->lRangeMax - infoPtr->lRangeMin;
- if (vertical) {
+ if (infoPtr->dwStyle & TBS_VERT) {
offsetthumb = (infoPtr->rcThumb.bottom - infoPtr->rcThumb.top)/2;
width = infoPtr->rcChannel.bottom - infoPtr->rcChannel.top - (offsetthumb * 2) - 1;
pos = (range*(place - infoPtr->rcChannel.top - offsetthumb)) / width;
static LONG
TRACKBAR_GetAutoPageDirection (const TRACKBAR_INFO *infoPtr, POINT clickPoint)
{
- DWORD dwStyle = GetWindowLongW (infoPtr->hwndSelf, GWL_STYLE);
RECT pageRect;
- if (dwStyle & TBS_VERT) {
+ if (infoPtr->dwStyle & TBS_VERT) {
pageRect.top = infoPtr->rcChannel.top;
pageRect.bottom = infoPtr->rcChannel.bottom;
pageRect.left = infoPtr->rcThumb.left;
if (PtInRect(&pageRect, clickPoint))
{
- int clickPlace = (dwStyle & TBS_VERT) ? clickPoint.y : clickPoint.x;
+ int clickPlace = (infoPtr->dwStyle & TBS_VERT) ? clickPoint.y : clickPoint.x;
+
+ LONG clickPos = TRACKBAR_ConvertPlaceToPosition(infoPtr, clickPlace);
- LONG clickPos = TRACKBAR_ConvertPlaceToPosition(infoPtr, clickPlace,
- dwStyle & TBS_VERT);
return clickPos - infoPtr->lPos;
}
static void
TRACKBAR_CalcChannel (TRACKBAR_INFO *infoPtr)
{
- DWORD dwStyle = GetWindowLongW (infoPtr->hwndSelf, GWL_STYLE);
INT cyChannel, offsetthumb, offsetedge;
RECT lpRect, *channel = & infoPtr->rcChannel;
offsetthumb = infoPtr->uThumbLen / 4;
offsetedge = offsetthumb + 3;
- cyChannel = (dwStyle & TBS_ENABLESELRANGE) ? offsetthumb*3 : 4;
- if (dwStyle & TBS_VERT) {
+ cyChannel = (infoPtr->dwStyle & TBS_ENABLESELRANGE) ? offsetthumb*3 : 4;
+ if (infoPtr->dwStyle & TBS_VERT) {
channel->top = lpRect.top + offsetedge;
channel->bottom = lpRect.bottom - offsetedge;
- if (dwStyle & TBS_ENABLESELRANGE)
+ if (infoPtr->dwStyle & TBS_ENABLESELRANGE)
channel->left = lpRect.left + ((infoPtr->uThumbLen - cyChannel + 2) / 2);
else
channel->left = lpRect.left + (infoPtr->uThumbLen / 2) - 1;
- if (dwStyle & TBS_BOTH) {
- if (dwStyle & TBS_NOTICKS)
+ if (infoPtr->dwStyle & TBS_BOTH) {
+ if (infoPtr->dwStyle & TBS_NOTICKS)
channel->left += 1;
else
channel->left += 9;
}
- else if (dwStyle & TBS_TOP) {
- if (dwStyle & TBS_NOTICKS)
+ else if (infoPtr->dwStyle & TBS_TOP) {
+ if (infoPtr->dwStyle & TBS_NOTICKS)
channel->left += 2;
else
channel->left += 10;
} else {
channel->left = lpRect.left + offsetedge;
channel->right = lpRect.right - offsetedge;
- if (dwStyle & TBS_ENABLESELRANGE)
+ if (infoPtr->dwStyle & TBS_ENABLESELRANGE)
channel->top = lpRect.top + ((infoPtr->uThumbLen - cyChannel + 2) / 2);
else
channel->top = lpRect.top + (infoPtr->uThumbLen / 2) - 1;
- if (dwStyle & TBS_BOTH) {
- if (dwStyle & TBS_NOTICKS)
+ if (infoPtr->dwStyle & TBS_BOTH) {
+ if (infoPtr->dwStyle & TBS_NOTICKS)
channel->top += 1;
else
channel->top += 9;
}
- else if (dwStyle & TBS_TOP) {
- if (dwStyle & TBS_NOTICKS)
+ else if (infoPtr->dwStyle & TBS_TOP) {
+ if (infoPtr->dwStyle & TBS_NOTICKS)
channel->top += 2;
else
channel->top += 10;
TRACKBAR_CalcThumb (const TRACKBAR_INFO *infoPtr, LONG lPos, RECT *thumb)
{
int range, width, height, thumbwidth;
- DWORD dwStyle = GetWindowLongW (infoPtr->hwndSelf, GWL_STYLE);
RECT lpRect;
range = infoPtr->lRangeMax - infoPtr->lRangeMin;
if (!range) range = 1;
GetClientRect(infoPtr->hwndSelf, &lpRect);
- if (dwStyle & TBS_VERT)
+ if (infoPtr->dwStyle & TBS_VERT)
{
height = infoPtr->rcChannel.bottom - infoPtr->rcChannel.top - thumbwidth;
- if ((dwStyle & (TBS_BOTH | TBS_LEFT)) && !(dwStyle & TBS_NOTICKS))
+ if ((infoPtr->dwStyle & (TBS_BOTH | TBS_LEFT)) && !(infoPtr->dwStyle & TBS_NOTICKS))
thumb->left = 10;
else
thumb->left = 2;
thumb->left = infoPtr->rcChannel.left +
(width*(lPos - infoPtr->lRangeMin))/range;
thumb->right = thumb->left + thumbwidth;
- if ((dwStyle & (TBS_BOTH | TBS_TOP)) && !(dwStyle & TBS_NOTICKS))
+ if ((infoPtr->dwStyle & (TBS_BOTH | TBS_TOP)) && !(infoPtr->dwStyle & TBS_NOTICKS))
thumb->top = 10;
else
thumb->top = 2;
if (range <= 0) {
SetRectEmpty (selection);
} else {
- if (GetWindowLongW (infoPtr->hwndSelf, GWL_STYLE) & TBS_VERT) {
+ if (infoPtr->dwStyle & TBS_VERT) {
offsetthumb = (infoPtr->rcThumb.bottom - infoPtr->rcThumb.top)/2;
height = infoPtr->rcChannel.bottom - infoPtr->rcChannel.top - offsetthumb*2;
selection->top = infoPtr->rcChannel.top + offsetthumb +
/* Trackbar drawing code. I like my spaghetti done milanese. */
static void
-TRACKBAR_DrawChannel (const TRACKBAR_INFO *infoPtr, HDC hdc, DWORD dwStyle)
+TRACKBAR_DrawChannel (const TRACKBAR_INFO *infoPtr, HDC hdc)
{
RECT rcChannel = infoPtr->rcChannel;
HTHEME theme = GetWindowTheme (infoPtr->hwndSelf);
if (theme)
{
DrawThemeBackground (theme, hdc,
- (GetWindowLongW (infoPtr->hwndSelf, GWL_STYLE) & TBS_VERT) ?
+ (infoPtr->dwStyle & TBS_VERT) ?
TKP_TRACKVERT : TKP_TRACK, TKS_NORMAL, &rcChannel, 0);
}
else
{
DrawEdge (hdc, &rcChannel, EDGE_SUNKEN, BF_RECT | BF_ADJUST);
- if (dwStyle & TBS_ENABLESELRANGE) { /* fill the channel */
+ if (infoPtr->dwStyle & TBS_ENABLESELRANGE) { /* fill the channel */
FillRect (hdc, &rcChannel, GetStockObject(WHITE_BRUSH));
if (TRACKBAR_HasSelection(infoPtr))
FillRect (hdc, &infoPtr->rcSelection, GetSysColorBrush(COLOR_HIGHLIGHT));
}
static void
-TRACKBAR_DrawTics (const TRACKBAR_INFO *infoPtr, HDC hdc, DWORD dwStyle)
+TRACKBAR_DrawTics (const TRACKBAR_INFO *infoPtr, HDC hdc)
{
unsigned int i;
- int ticFlags = dwStyle & 0x0f;
+ int ticFlags = infoPtr->dwStyle & 0x0f;
LOGPEN ticPen = { PS_SOLID, {1, 0}, GetSysColor (COLOR_3DDKSHADOW) };
HPEN hOldPen, hTicPen;
HTHEME theme = GetWindowTheme (infoPtr->hwndSelf);
if (theme)
{
- int part = (dwStyle & TBS_VERT) ? TKP_TICSVERT : TKP_TICS;
+ int part = (infoPtr->dwStyle & TBS_VERT) ? TKP_TICSVERT : TKP_TICS;
GetThemeColor (theme, part, TSS_NORMAL, TMT_COLOR, &ticPen.lopnColor);
}
/* create the pen to draw the tics with */
TRACKBAR_DrawTic (infoPtr, hdc, infoPtr->lRangeMin, ticFlags | TIC_EDGE);
TRACKBAR_DrawTic (infoPtr, hdc, infoPtr->lRangeMax, ticFlags | TIC_EDGE);
- if ((dwStyle & TBS_ENABLESELRANGE) && TRACKBAR_HasSelection(infoPtr)) {
+ if ((infoPtr->dwStyle & TBS_ENABLESELRANGE) && TRACKBAR_HasSelection(infoPtr)) {
TRACKBAR_DrawTic (infoPtr, hdc, infoPtr->lSelMin,
ticFlags | TIC_SELECTIONMARKMIN);
TRACKBAR_DrawTic (infoPtr, hdc, infoPtr->lSelMax,
}
static void
-TRACKBAR_DrawThumb (const TRACKBAR_INFO *infoPtr, HDC hdc, DWORD dwStyle)
+TRACKBAR_DrawThumb (const TRACKBAR_INFO *infoPtr, HDC hdc)
{
HBRUSH oldbr;
HPEN oldpen;
{
int partId;
int stateId;
- if (dwStyle & TBS_BOTH)
- partId = (dwStyle & TBS_VERT) ? TKP_THUMBVERT : TKP_THUMB;
- else if (dwStyle & TBS_LEFT)
- partId = (dwStyle & TBS_VERT) ? TKP_THUMBLEFT : TKP_THUMBTOP;
+ if (infoPtr->dwStyle & TBS_BOTH)
+ partId = (infoPtr->dwStyle & TBS_VERT) ? TKP_THUMBVERT : TKP_THUMB;
+ else if (infoPtr->dwStyle & TBS_LEFT)
+ partId = (infoPtr->dwStyle & TBS_VERT) ? TKP_THUMBLEFT : TKP_THUMBTOP;
else
- partId = (dwStyle & TBS_VERT) ? TKP_THUMBRIGHT : TKP_THUMBBOTTOM;
+ partId = (infoPtr->dwStyle & TBS_VERT) ? TKP_THUMBRIGHT : TKP_THUMBBOTTOM;
- if (dwStyle & WS_DISABLED)
+ if (infoPtr->dwStyle & WS_DISABLED)
stateId = TUS_DISABLED;
else if (infoPtr->flags & TB_DRAG_MODE)
stateId = TUS_PRESSED;
oldbr = SelectObject (hdc, GetSysColorBrush(fillClr));
SetPolyFillMode (hdc, WINDING);
- if (dwStyle & TBS_BOTH)
+ if (infoPtr->dwStyle & TBS_BOTH)
{
points[0].x=thumb.right;
points[0].y=thumb.top;
}
else
{
- if (dwStyle & TBS_VERT)
+ if (infoPtr->dwStyle & TBS_VERT)
{
PointDepth = (thumb.bottom - thumb.top) / 2;
- if (dwStyle & TBS_LEFT)
+ if (infoPtr->dwStyle & TBS_LEFT)
{
points[0].x=thumb.right;
points[0].y=thumb.top;
else
{
PointDepth = (thumb.right - thumb.left) / 2;
- if (dwStyle & TBS_TOP)
+ if (infoPtr->dwStyle & TBS_TOP)
{
points[0].x=(thumb.right - thumb.left) / 2 + thumb.left + 1;
points[0].y=thumb.top;
static void
TRACKBAR_UpdateToolTip (const TRACKBAR_INFO *infoPtr)
{
- DWORD dwStyle = GetWindowLongW (infoPtr->hwndSelf, GWL_STYLE);
WCHAR buf[80];
static const WCHAR fmt[] = { '%', 'l', 'd', 0 };
TTTOOLINFOW ti;
GetClientRect (infoPtr->hwndSelf, &rcClient);
size = SendMessageW (infoPtr->hwndToolTip, TTM_GETBUBBLESIZE, 0, (LPARAM)&ti);
- if (dwStyle & TBS_VERT) {
+ if (infoPtr->dwStyle & TBS_VERT) {
if (infoPtr->fLocation == TBTS_LEFT)
pt.x = 0 - LOWORD(size) - TOOLTIP_OFFSET;
else
static void
TRACKBAR_Refresh (TRACKBAR_INFO *infoPtr, HDC hdcDst)
{
- DWORD dwStyle = GetWindowLongW (infoPtr->hwndSelf, GWL_STYLE);
RECT rcClient;
HDC hdc;
HBITMAP hOldBmp = 0, hOffScreenBmp = 0;
icdrf = notify_customdraw(infoPtr, &nmcd, CDDS_ITEMPREPAINT);
} else icdrf = CDRF_DODEFAULT;
if ( !(icdrf & CDRF_SKIPDEFAULT) ) {
- TRACKBAR_DrawChannel (infoPtr, hdc, dwStyle);
+ TRACKBAR_DrawChannel (infoPtr, hdc);
if (icdrf & CDRF_NOTIFYPOSTPAINT)
notify_customdraw(infoPtr, &nmcd, CDDS_ITEMPOSTPAINT);
}
/* draw tics */
- if (!(dwStyle & TBS_NOTICKS)) {
+ if (!(infoPtr->dwStyle & TBS_NOTICKS)) {
if (gcdrf & CDRF_NOTIFYITEMDRAW) {
nmcd.dwItemSpec = TBCD_TICS;
nmcd.uItemState = CDIS_DEFAULT;
icdrf = notify_customdraw(infoPtr, &nmcd, CDDS_ITEMPREPAINT);
} else icdrf = CDRF_DODEFAULT;
if ( !(icdrf & CDRF_SKIPDEFAULT) ) {
- TRACKBAR_DrawTics (infoPtr, hdc, dwStyle);
+ TRACKBAR_DrawTics (infoPtr, hdc);
if (icdrf & CDRF_NOTIFYPOSTPAINT)
notify_customdraw(infoPtr, &nmcd, CDDS_ITEMPOSTPAINT);
}
}
/* draw thumb */
- if (!(dwStyle & TBS_NOTHUMB)) {
+ if (!(infoPtr->dwStyle & TBS_NOTHUMB)) {
if (gcdrf & CDRF_NOTIFYITEMDRAW) {
nmcd.dwItemSpec = TBCD_THUMB;
nmcd.uItemState = infoPtr->flags & TB_DRAG_MODE ? CDIS_HOT : CDIS_DEFAULT;
icdrf = notify_customdraw(infoPtr, &nmcd, CDDS_ITEMPREPAINT);
} else icdrf = CDRF_DODEFAULT;
if ( !(icdrf & CDRF_SKIPDEFAULT) ) {
- TRACKBAR_DrawThumb(infoPtr, hdc, dwStyle);
+ TRACKBAR_DrawThumb(infoPtr, hdc);
if (icdrf & CDRF_NOTIFYPOSTPAINT)
notify_customdraw(infoPtr, &nmcd, CDDS_ITEMPOSTPAINT);
}
static void
TRACKBAR_AlignBuddies (const TRACKBAR_INFO *infoPtr)
{
- DWORD dwStyle = GetWindowLongW (infoPtr->hwndSelf, GWL_STYLE);
HWND hwndParent = GetParent (infoPtr->hwndSelf);
RECT rcSelf, rcBuddy;
INT x, y;
GetWindowRect (infoPtr->hwndBuddyLA, &rcBuddy);
MapWindowPoints (HWND_DESKTOP, hwndParent, (LPPOINT)&rcBuddy, 2);
- if (dwStyle & TBS_VERT) {
+ if (infoPtr->dwStyle & TBS_VERT) {
x = (infoPtr->rcChannel.right + infoPtr->rcChannel.left) / 2 -
(rcBuddy.right - rcBuddy.left) / 2 + rcSelf.left;
y = rcSelf.top - (rcBuddy.bottom - rcBuddy.top);
GetWindowRect (infoPtr->hwndBuddyRB, &rcBuddy);
MapWindowPoints (HWND_DESKTOP, hwndParent, (LPPOINT)&rcBuddy, 2);
- if (dwStyle & TBS_VERT) {
+ if (infoPtr->dwStyle & TBS_VERT) {
x = (infoPtr->rcChannel.right + infoPtr->rcChannel.left) / 2 -
(rcBuddy.right - rcBuddy.left) / 2 + rcSelf.left;
y = rcSelf.bottom;
static inline LONG
TRACKBAR_GetNumTics (const TRACKBAR_INFO *infoPtr)
{
- if (GetWindowLongW (infoPtr->hwndSelf, GWL_STYLE) & TBS_NOTICKS)
- return 0;
+ if (infoPtr->dwStyle & TBS_NOTICKS) return 0;
- if(infoPtr->uNumTics == 0)
- return 2;
- else
- return infoPtr->uNumTics + 1;
+ return infoPtr->uNumTics + 2;
}
static inline LRESULT
TRACKBAR_SetSel (TRACKBAR_INFO *infoPtr, BOOL fRedraw, LONG lSel)
{
- if (!(GetWindowLongW (infoPtr->hwndSelf, GWL_STYLE) & TBS_ENABLESELRANGE)){
+ if (!(infoPtr->dwStyle & TBS_ENABLESELRANGE)){
infoPtr->lSelMin = 0;
infoPtr->lSelMax = 0;
return 0;
static inline LRESULT
TRACKBAR_SetSelEnd (TRACKBAR_INFO *infoPtr, BOOL fRedraw, LONG lEnd)
{
- if (!(GetWindowLongW (infoPtr->hwndSelf, GWL_STYLE) & TBS_ENABLESELRANGE)){
+ if (!(infoPtr->dwStyle & TBS_ENABLESELRANGE)){
infoPtr->lSelMax = 0;
return 0;
}
static inline LRESULT
TRACKBAR_SetSelStart (TRACKBAR_INFO *infoPtr, BOOL fRedraw, LONG lStart)
{
- if (!(GetWindowLongW (infoPtr->hwndSelf, GWL_STYLE) & TBS_ENABLESELRANGE)){
+ if (!(infoPtr->dwStyle & TBS_ENABLESELRANGE)){
infoPtr->lSelMin = 0;
return 0;
}
static inline LRESULT
TRACKBAR_SetThumbLength (TRACKBAR_INFO *infoPtr, UINT iLength)
{
- if (GetWindowLongW (infoPtr->hwndSelf, GWL_STYLE) & TBS_FIXEDLENGTH) {
+ if (infoPtr->dwStyle & TBS_FIXEDLENGTH) {
infoPtr->uThumbLen = iLength;
infoPtr->flags |= TB_THUMBSIZECHANGED;
InvalidateRect (infoPtr->hwndSelf, &infoPtr->rcThumb, FALSE);
static inline LRESULT
TRACKBAR_SetTic (TRACKBAR_INFO *infoPtr, LONG lPos)
{
- if (GetWindowLongW (infoPtr->hwndSelf, GWL_STYLE) & TBS_AUTOTICKS)
+ if (infoPtr->dwStyle & TBS_AUTOTICKS)
return FALSE;
if ((lPos < infoPtr->lRangeMin) || (lPos> infoPtr->lRangeMax))
static inline LRESULT
TRACKBAR_SetTicFreq (TRACKBAR_INFO *infoPtr, WORD wFreq)
{
- if (GetWindowLongW (infoPtr->hwndSelf, GWL_STYLE) & TBS_AUTOTICKS) {
+ if (infoPtr->dwStyle & TBS_AUTOTICKS) {
infoPtr->uTicFreq = wFreq;
TRACKBAR_RecalculateTics (infoPtr);
TRACKBAR_InvalidateAll(infoPtr);
static LRESULT
TRACKBAR_InitializeThumb (TRACKBAR_INFO *infoPtr)
{
- DWORD dwStyle = GetWindowLongW (infoPtr->hwndSelf, GWL_STYLE);
RECT rect;
int clientWidth, clientMetric;
/* initial thumb length */
- clientMetric = (dwStyle & TBS_ENABLESELRANGE) ? 23 : 21;
+ clientMetric = (infoPtr->dwStyle & TBS_ENABLESELRANGE) ? 23 : 21;
GetClientRect(infoPtr->hwndSelf,&rect);
- if (dwStyle & TBS_VERT) {
+ if (infoPtr->dwStyle & TBS_VERT) {
clientWidth = rect.right - rect.left;
} else {
clientWidth = rect.bottom - rect.top;
TRACKBAR_Create (HWND hwnd, const CREATESTRUCTW *lpcs)
{
TRACKBAR_INFO *infoPtr;
- DWORD dwStyle;
infoPtr = Alloc (sizeof(TRACKBAR_INFO));
if (!infoPtr) return -1;
/* set default values */
infoPtr->hwndSelf = hwnd;
+ infoPtr->dwStyle = lpcs->style;
infoPtr->lRangeMin = 0;
infoPtr->lRangeMax = 100;
infoPtr->lLineSize = 1;
TRACKBAR_InitializeThumb (infoPtr);
- dwStyle = GetWindowLongW (hwnd, GWL_STYLE);
-
/* Create tooltip control */
- if (dwStyle & TBS_TOOLTIPS) {
+ if (infoPtr->dwStyle & TBS_TOOLTIPS) {
infoPtr->hwndToolTip =
CreateWindowExW (0, TOOLTIPS_CLASSW, NULL, WS_POPUP,
return 0;
}
+static LRESULT
+TRACKBAR_StyleChanged (TRACKBAR_INFO *infoPtr, WPARAM wStyleType,
+ const STYLESTRUCT *lpss)
+{
+ if (wStyleType != GWL_STYLE) return 0;
+
+ infoPtr->dwStyle = lpss->styleNew;
+
+ return 0;
+}
static LRESULT
TRACKBAR_Timer (TRACKBAR_INFO *infoPtr)
static LRESULT
TRACKBAR_MouseMove (TRACKBAR_INFO *infoPtr, INT x, INT y)
{
- DWORD dwStyle = GetWindowLongW (infoPtr->hwndSelf, GWL_STYLE);
- INT clickPlace = (dwStyle & TBS_VERT) ? y : x;
+ INT clickPlace = (infoPtr->dwStyle & TBS_VERT) ? y : x;
LONG dragPos, oldPos = infoPtr->lPos;
TRACE("(x=%d. y=%d)\n", x, y);
return TRUE;
}
- dragPos = TRACKBAR_ConvertPlaceToPosition (infoPtr, clickPlace,
- dwStyle & TBS_VERT);
+ dragPos = TRACKBAR_ConvertPlaceToPosition (infoPtr, clickPlace);
+
if (dragPos == oldPos) return TRUE;
infoPtr->lPos = dragPos;
static BOOL
TRACKBAR_KeyDown (TRACKBAR_INFO *infoPtr, INT nVirtKey)
{
- DWORD style = GetWindowLongW (infoPtr->hwndSelf, GWL_STYLE);
- BOOL downIsLeft = style & TBS_DOWNISLEFT;
- BOOL vert = style & TBS_VERT;
+ BOOL downIsLeft = infoPtr->dwStyle & TBS_DOWNISLEFT;
+ BOOL vert = infoPtr->dwStyle & TBS_VERT;
LONG pos = infoPtr->lPos;
TRACE("%x\n", nVirtKey);
case WM_SIZE:
return TRACKBAR_Size (infoPtr);
+ case WM_STYLECHANGED:
+ return TRACKBAR_StyleChanged (infoPtr, wParam, (LPSTYLESTRUCT)lParam);
+
case WM_THEMECHANGED:
return theme_changed (infoPtr);