extern COMCTL32_SysColor comctl32_color DECLSPEC_HIDDEN;
+#ifdef __REACTOS__
+
typedef struct _BUTTON_DATA {
LONG state;
HFONT font;
return (PBUTTON_DATA)GetWindowLongPtrW( hwnd, 0 );
}
+#endif /* __REACTOS__ */
+
/* Internal function */
HWND COMCTL32_CreateToolTip (HWND) DECLSPEC_HIDDEN;
VOID COMCTL32_RefreshSysColors(void) DECLSPEC_HIDDEN;
BOOL Str_SetPtrAtoW (LPWSTR *lppDest, LPCSTR lpSrc) DECLSPEC_HIDDEN;
BOOL Str_SetPtrWtoA (LPSTR *lppDest, LPCWSTR lpSrc) DECLSPEC_HIDDEN;
+#ifndef __REACTOS__
+#define COMCTL32_VERSION_MINOR 81
+#endif
+
/* Our internal stack structure of the window procedures to subclass */
typedef struct _SUBCLASSPROCS {
SUBCLASSPROC subproc;
extern void TREEVIEW_Unregister(void) DECLSPEC_HIDDEN;
extern void UPDOWN_Register(void) DECLSPEC_HIDDEN;
extern void UPDOWN_Unregister(void) DECLSPEC_HIDDEN;
+#ifdef __REACTOS__
extern void BUTTON_Register();
extern void BUTTON_Unregister();
-#ifdef __REACTOS__
extern void TOOLBARv6_Register(void) DECLSPEC_HIDDEN;
extern void TOOLBARv6_Unregister(void) DECLSPEC_HIDDEN;
-#endif
+#endif /* __REACTOS__ */
int MONTHCAL_MonthLength(int month, int year) DECLSPEC_HIDDEN;
int MONTHCAL_CalculateDayOfWeek(SYSTEMTIME *date, BOOL inplace) DECLSPEC_HIDDEN;
LONG MONTHCAL_CompareSystemTime(const SYSTEMTIME *first, const SYSTEMTIME *second) DECLSPEC_HIDDEN;
-
+#ifdef __REACTOS__
extern void THEMING_Initialize(HANDLE hActCtx5, HANDLE hActCtx6) DECLSPEC_HIDDEN;
+#else
+extern void THEMING_Initialize(void) DECLSPEC_HIDDEN;
+#endif
extern void THEMING_Uninitialize(void) DECLSPEC_HIDDEN;
extern LRESULT THEMING_CallOriginalClass(HWND, UINT, WPARAM, LPARAM) DECLSPEC_HIDDEN;
extern void THEMING_SetSubclassData(HWND, ULONG_PTR) DECLSPEC_HIDDEN;
return TRUE;
}
-#endif
+#endif /* __REACTOS__ */
/***********************************************************************
* DllMain [Internal]
HRESULT WINAPI DllInstall(BOOL bInstall, LPCWSTR cmdline)
{
TRACE("(%u, %s): stub\n", bInstall, debugstr_w(cmdline));
-
return S_OK;
}
mask_info->bmiHeader = info->bmiHeader;
mask_info->bmiHeader.biBitCount = 1;
mask_info->bmiHeader.biSizeImage = mask_width * height;
- if (!(mask_bits = HeapAlloc( GetProcessHeap(), HEAP_ZERO_MEMORY, info->bmiHeader.biSizeImage )))
+ if (!(mask_bits = HeapAlloc( GetProcessHeap(), HEAP_ZERO_MEMORY, mask_info->bmiHeader.biSizeImage )))
goto done;
if (!GetDIBits( hdc, hbmMask, 0, height, mask_bits, mask_info, DIB_RGB_COLORS )) goto done;
}
nImageCount = dib.dsBm.bmWidth / cx;
- himl = ImageList_Create (cx, dib.dsBm.bmHeight, ILC_MASK | color, nImageCount, cGrow);
+ if (clrMask != CLR_NONE) color |= ILC_MASK;
+ himl = ImageList_Create (cx, dib.dsBm.bmHeight, color, nImageCount, cGrow);
if (!himl) {
DeleteObject (handle);
return NULL;
return ret;
}
- /* if dipsinfo holder changed notification code then convert */
+ /* if dispinfo holder changed notification code then convert */
if (!isW && (pdi->hdr.code == LVN_GETDISPINFOW) && (pdi->item.mask & LVIF_TEXT))
{
length = WideCharToMultiByte(CP_ACP, 0, pdi->item.pszText, -1, NULL, 0, NULL, NULL);
COLORREF backcolor, textcolor;
/* apparently, for selected items, we have to override the returned values */
- if (!SubItem || (infoPtr->dwLvExStyle & LVS_EX_FULLROWSELECT))
+ if (!SubItem)
{
if (lpnmlvcd->nmcd.uItemState & CDIS_SELECTED)
{
* None.
*/
static void LISTVIEW_MarqueeHighlight(LISTVIEW_INFO *infoPtr, const POINT *coords_orig,
- const POINT *coords_offs, const POINT *offset,
INT scroll)
{
BOOL controlDown = FALSE;
LVITEMW item;
ITERATOR old_elems, new_elems;
RECT rect;
+ POINT coords_offs, offset;
- if (coords_offs->x > infoPtr->marqueeOrigin.x)
+ /* Ensure coordinates are within client bounds */
+ coords_offs.x = max(min(coords_orig->x, infoPtr->rcList.right), 0);
+ coords_offs.y = max(min(coords_orig->y, infoPtr->rcList.bottom), 0);
+
+ /* Get offset */
+ LISTVIEW_GetOrigin(infoPtr, &offset);
+
+ /* Offset coordinates by the appropriate amount */
+ coords_offs.x -= offset.x;
+ coords_offs.y -= offset.y;
+
+ if (coords_offs.x > infoPtr->marqueeOrigin.x)
{
rect.left = infoPtr->marqueeOrigin.x;
- rect.right = coords_offs->x;
+ rect.right = coords_offs.x;
}
else
{
- rect.left = coords_offs->x;
+ rect.left = coords_offs.x;
rect.right = infoPtr->marqueeOrigin.x;
}
- if (coords_offs->y > infoPtr->marqueeOrigin.y)
+ if (coords_offs.y > infoPtr->marqueeOrigin.y)
{
rect.top = infoPtr->marqueeOrigin.y;
- rect.bottom = coords_offs->y;
+ rect.bottom = coords_offs.y;
}
else
{
- rect.top = coords_offs->y;
+ rect.top = coords_offs.y;
rect.bottom = infoPtr->marqueeOrigin.y;
}
infoPtr->marqueeRect = rect;
infoPtr->marqueeDrawRect = rect;
- OffsetRect(&infoPtr->marqueeDrawRect, offset->x, offset->y);
+ OffsetRect(&infoPtr->marqueeDrawRect, offset.x, offset.y);
iterator_frameditems_absolute(&new_elems, infoPtr, &infoPtr->marqueeRect);
iterator_remove_common_items(&old_elems, &new_elems);
{
LISTVIEW_INFO *infoPtr;
SCROLLINFO scrollInfo;
- POINT coords_orig;
- POINT coords_offs;
- POINT offset;
+ POINT coords;
INT scroll = 0;
infoPtr = (LISTVIEW_INFO *) idEvent;
return;
/* Get the current cursor position and convert to client coordinates */
- GetCursorPos(&coords_orig);
- ScreenToClient(hWnd, &coords_orig);
-
- /* Ensure coordinates are within client bounds */
- coords_offs.x = max(min(coords_orig.x, infoPtr->rcList.right), 0);
- coords_offs.y = max(min(coords_orig.y, infoPtr->rcList.bottom), 0);
-
- /* Get offset */
- LISTVIEW_GetOrigin(infoPtr, &offset);
-
- /* Offset coordinates by the appropriate amount */
- coords_offs.x -= offset.x;
- coords_offs.y -= offset.y;
+ GetCursorPos(&coords);
+ ScreenToClient(hWnd, &coords);
scrollInfo.cbSize = sizeof(SCROLLINFO);
scrollInfo.fMask = SIF_ALL;
scroll |= SCROLL_RIGHT;
}
- if (((coords_orig.x <= 0) && (scroll & SCROLL_LEFT)) ||
- ((coords_orig.y <= 0) && (scroll & SCROLL_UP)) ||
- ((coords_orig.x >= infoPtr->rcList.right) && (scroll & SCROLL_RIGHT)) ||
- ((coords_orig.y >= infoPtr->rcList.bottom) && (scroll & SCROLL_DOWN)))
+ if (((coords.x <= 0) && (scroll & SCROLL_LEFT)) ||
+ ((coords.y <= 0) && (scroll & SCROLL_UP)) ||
+ ((coords.x >= infoPtr->rcList.right) && (scroll & SCROLL_RIGHT)) ||
+ ((coords.y >= infoPtr->rcList.bottom) && (scroll & SCROLL_DOWN)))
{
- LISTVIEW_MarqueeHighlight(infoPtr, &coords_orig, &coords_offs, &offset, scroll);
+ LISTVIEW_MarqueeHighlight(infoPtr, &coords, scroll);
}
}
RECT rect;
POINT pt;
+ pt.x = x;
+ pt.y = y;
+
if (!(fwKeys & MK_LBUTTON))
infoPtr->bLButtonDown = FALSE;
if (infoPtr->bMarqueeSelect)
{
- POINT coords_orig;
- POINT coords_offs;
- POINT offset;
-
- coords_orig.x = x;
- coords_orig.y = y;
-
- /* Get offset */
- LISTVIEW_GetOrigin(infoPtr, &offset);
-
- /* Ensure coordinates are within client bounds */
- coords_offs.x = max(min(x, infoPtr->rcList.right), 0);
- coords_offs.y = max(min(y, infoPtr->rcList.bottom), 0);
-
- /* Offset coordinates by the appropriate amount */
- coords_offs.x -= offset.x;
- coords_offs.y -= offset.y;
-
/* Enable the timer if we're going outside our bounds, in case the user doesn't
move the mouse again */
KillTimer(infoPtr->hwndSelf, (UINT_PTR) infoPtr);
}
- LISTVIEW_MarqueeHighlight(infoPtr, &coords_orig, &coords_offs, &offset, 0);
+ LISTVIEW_MarqueeHighlight(infoPtr, &pt, 0);
return 0;
}
- pt.x = x;
- pt.y = y;
-
ht.pt = pt;
LISTVIEW_HitTest(infoPtr, &ht, TRUE, TRUE);
while (iterator_next(subitems))
{
DWORD subitemstage = CDRF_DODEFAULT;
- NMLVCUSTOMDRAW temp_nmlvcd;
/* We need to query for each subitem, item's data (subitem == 0) is already here at this point */
if (subitems->nItem)
if (cdsubitemmode & CDRF_NOTIFYSUBITEMDRAW)
subitemstage = notify_customdraw(infoPtr, CDDS_SUBITEM | CDDS_ITEMPREPAINT, &nmlvcd);
+ else
+ {
+ nmlvcd.clrTextBk = infoPtr->clrTextBk;
+ nmlvcd.clrText = infoPtr->clrText;
+ }
- /*
- * A selection should neither affect the colors in the post paint notification nor
- * affect the colors of the next drawn subitem. Copy the structure to prevent this.
- */
- temp_nmlvcd = nmlvcd;
- prepaint_setup(infoPtr, hdc, &temp_nmlvcd, subitems->nItem);
+ if (subitems->nItem == 0 || (cdmode & CDRF_NOTIFYITEMDRAW))
+ prepaint_setup(infoPtr, hdc, &nmlvcd, FALSE);
+ else if (!(infoPtr->dwLvExStyle & LVS_EX_FULLROWSELECT))
+ prepaint_setup(infoPtr, hdc, &nmlvcd, TRUE);
if (!(subitemstage & CDRF_SKIPDEFAULT))
- LISTVIEW_DrawItemPart(infoPtr, &lvItem, &temp_nmlvcd, &pos);
+ LISTVIEW_DrawItemPart(infoPtr, &lvItem, &nmlvcd, &pos);
if (subitemstage & CDRF_NOTIFYPOSTPAINT)
subitemstage = notify_customdraw(infoPtr, CDDS_SUBITEM | CDDS_ITEMPOSTPAINT, &nmlvcd);
if (infoPtr->nFocusedItem >= nItems)
{
LISTVIEW_SetItemFocus(infoPtr, -1);
+ infoPtr->nFocusedItem = -1;
SetRectEmpty(&infoPtr->rcFocus);
}
}
* Success: TRUE
* Failure: FALSE
*/
-static LRESULT LISTVIEW_NCCreate(HWND hwnd, const CREATESTRUCTW *lpcs)
+static LRESULT LISTVIEW_NCCreate(HWND hwnd, WPARAM wParam, const CREATESTRUCTW *lpcs)
{
LISTVIEW_INFO *infoPtr;
LOGFONTW logFont;
if (!(infoPtr->hdpaPosX = DPA_Create(10))) goto fail;
if (!(infoPtr->hdpaPosY = DPA_Create(10))) goto fail;
if (!(infoPtr->hdpaColumns = DPA_Create(10))) goto fail;
- return TRUE;
+
+ return DefWindowProcW(hwnd, WM_NCCREATE, wParam, (LPARAM)lpcs);
fail:
DestroyWindow(infoPtr->hwndHeader);
return LISTVIEW_Command(infoPtr, wParam, lParam);
case WM_NCCREATE:
- return LISTVIEW_NCCreate(hwnd, (LPCREATESTRUCTW)lParam);
+ return LISTVIEW_NCCreate(hwnd, wParam, (LPCREATESTRUCTW)lParam);
case WM_CREATE:
return LISTVIEW_Create(hwnd, (LPCREATESTRUCTW)lParam);
oldcolor = SetTextColor (hdc, new);
}
+#ifdef __REACTOS__
if (!theme)
{
DrawTextW (hdc, lpBand->lpText, -1, &lpBand->rcCapText, DT_CENTER | DT_VCENTER | DT_SINGLELINE);
{
DrawThemeText(theme, hdc, 0, 0, lpBand->lpText, -1, DT_CENTER | DT_VCENTER | DT_SINGLELINE, 0, &lpBand->rcCapText);
}
+#else
+ DrawTextW (hdc, lpBand->lpText, -1, &lpBand->rcCapText,
+ DT_CENTER | DT_VCENTER | DT_SINGLELINE);
+#endif
if (oldBkMode != TRANSPARENT)
SetBkMode (hdc, oldBkMode);
oldrow = -1;
for(i=0; i<infoPtr->uNumBands; i++) {
RECT rcBand;
-
lpBand = REBAR_GetBand(infoPtr, i);
if (HIDDENBAND(lpBand)) continue;
translate_rect(infoPtr, &rcBand, &lpBand->rcBand);
SendMessageW (infoPtr->Notify, WM_DRAWITEM, dis.CtlID, (LPARAM)&dis);
} else {
r.left += x;
+#ifdef __REACTOS__
if (!theme)
DrawStatusTextW (hdc, &r, part->text, SBT_NOBORDERS);
else
DrawThemeText(theme, hdc, SP_PANE, 0, part->text, -1, DT_VCENTER|DT_SINGLELINE|DT_NOPREFIX, 0, &r);
+#else
+ DrawStatusTextW (hdc, &r, part->text, SBT_NOBORDERS);
+#endif
}
}
* SYSLINK_GetIdealSize
* Calculates the ideal size of a link control at a given maximum width.
*/
-static VOID SYSLINK_GetIdealSize (const SYSLINK_INFO *infoPtr, int cxMaxWidth, LPSIZE lpSize)
+static LONG SYSLINK_GetIdealSize (const SYSLINK_INFO *infoPtr, int cxMaxWidth, SIZE *lpSize)
{
RECT rc;
HDC hdc;
lpSize->cx = rc.right;
lpSize->cy = rc.bottom;
}
+
+ return rc.bottom;
}
/***********************************************************************
case LM_GETIDEALHEIGHT:
if (lParam)
- {
- /* LM_GETIDEALSIZE */
- SYSLINK_GetIdealSize(infoPtr, (int)wParam, (LPSIZE)lParam);
- }
- return SYSLINK_GetIdealHeight(infoPtr);
+ return SYSLINK_GetIdealSize(infoPtr, (int)wParam, (SIZE *)lParam);
+ else
+ return SYSLINK_GetIdealHeight(infoPtr);
case WM_SETFOCUS:
return SYSLINK_SetFocus(infoPtr);
unsigned int template_size;
};
+struct taskdialog_button_desc
+{
+ int id;
+ const WCHAR *text;
+ unsigned int width;
+ unsigned int line;
+ HINSTANCE hinst;
+};
+
struct taskdialog_template_desc
{
const TASKDIALOGCONFIG *taskconfig;
LONG x_baseunit;
LONG y_baseunit;
HFONT font;
+ struct taskdialog_button_desc *default_button;
};
-struct taskdialog_button_desc
+struct taskdialog_info
{
- int id;
- const WCHAR *text;
- unsigned int width;
- unsigned int line;
- HINSTANCE hinst;
+ HWND hwnd;
+ PFTASKDIALOGCALLBACK callback;
+ LONG_PTR callback_data;
};
static void pixels_to_dialogunits(const struct taskdialog_template_desc *desc, LONG *width, LONG *height)
}
static unsigned int taskdialog_add_control(struct taskdialog_template_desc *desc, WORD id, const WCHAR *class,
- HINSTANCE hInstance, const WCHAR *text, short x, short y, short cx, short cy)
+ HINSTANCE hInstance, const WCHAR *text, DWORD style, short x, short y, short cx, short cy)
{
struct taskdialog_control *control = Alloc(sizeof(*control));
unsigned int size, class_size, text_size;
control->template = template = Alloc(size);
control->template_size = size;
- template->style = WS_VISIBLE;
+ template->style = WS_VISIBLE | style;
template->dwExtendedStyle = 0;
template->x = x;
template->y = y;
taskdialog_get_text_extent(desc, str, TRUE, &sz);
desc->dialog_height += DIALOG_SPACING;
- size = taskdialog_add_control(desc, id, WC_STATICW, desc->taskconfig->hInstance, str, DIALOG_SPACING,
+ size = taskdialog_add_control(desc, id, WC_STATICW, desc->taskconfig->hInstance, str, 0, DIALOG_SPACING,
desc->dialog_height, sz.cx, sz.cy);
desc->dialog_height += sz.cy + DIALOG_SPACING;
return size;
button->width = max(DIALOG_BUTTON_WIDTH, sz.cx + DIALOG_SPACING * 2);
button->line = 0;
button->hinst = custom_button ? desc->taskconfig->hInstance : COMCTL32_hModule;
+
+ if (id == desc->taskconfig->nDefaultButton)
+ desc->default_button = button;
}
static void taskdialog_init_common_buttons(struct taskdialog_template_desc *desc, struct taskdialog_button_desc *buttons,
if (count == 0)
taskdialog_init_button(&buttons[count++], desc, IDOK, MAKEINTRESOURCEW(IDS_BUTTON_OK), FALSE);
+ if (!desc->default_button)
+ desc->default_button = &buttons[0];
+
/* For easy handling just allocate as many lines as buttons, the worst case. */
line_widths = Alloc(count * sizeof(*line_widths));
location_x = alignment;
for (i = 0; i < count; i++)
{
+ DWORD style = &buttons[i] == desc->default_button ? BS_DEFPUSHBUTTON : BS_PUSHBUTTON;
+
if (i > 0 && buttons[i].line != buttons[i - 1].line) /* New line */
{
location_x = alignment;
desc->dialog_height += DIALOG_BUTTON_HEIGHT + DIALOG_SPACING;
}
- size += taskdialog_add_control(desc, buttons[i].id, WC_BUTTONW, buttons[i].hinst, buttons[i].text, location_x,
- desc->dialog_height, buttons[i].width, DIALOG_BUTTON_HEIGHT);
+ size += taskdialog_add_control(desc, buttons[i].id, WC_BUTTONW, buttons[i].hinst, buttons[i].text, style,
+ location_x, desc->dialog_height, buttons[i].width, DIALOG_BUTTON_HEIGHT);
location_x += buttons[i].width + DIALOG_SPACING;
}
return info.rcWork.right - info.rcWork.left;
}
+static WCHAR *taskdialog_get_exe_name(const TASKDIALOGCONFIG *taskconfig, WCHAR *name, DWORD length)
+{
+ DWORD len = GetModuleFileNameW(NULL, name, length);
+ if (len && len < length)
+ {
+ WCHAR *p;
+ if ((p = strrchrW(name, '/'))) name = p + 1;
+ if ((p = strrchrW(name, '\\'))) name = p + 1;
+ return name;
+ }
+ else
+ return NULL;
+}
+
static DLGTEMPLATE *create_taskdialog_template(const TASKDIALOGCONFIG *taskconfig)
{
struct taskdialog_control *control, *control2;
const WCHAR *titleW = NULL;
DLGTEMPLATE *template;
NONCLIENTMETRICSW ncm;
+ WCHAR pathW[MAX_PATH];
RECT ref_rect;
char *ptr;
HDC hdc;
/* Window title */
if (!taskconfig->pszWindowTitle)
- FIXME("use executable name for window title\n");
+ titleW = taskdialog_get_exe_name(taskconfig, pathW, sizeof(pathW)/sizeof(pathW[0]));
else if (IS_INTRESOURCE(taskconfig->pszWindowTitle))
- FIXME("load window title from resources\n");
+ {
+ if (!LoadStringW(taskconfig->hInstance, LOWORD(taskconfig->pszWindowTitle), (WCHAR *)&titleW, 0))
+ titleW = taskdialog_get_exe_name(taskconfig, pathW, sizeof(pathW)/sizeof(pathW[0]));
+ }
else
titleW = taskconfig->pszWindowTitle;
if (!titleW)
desc.dialog_height = 0;
desc.dialog_width = max(taskconfig->cxWidth, DIALOG_MIN_WIDTH);
desc.dialog_width = min(desc.dialog_width, screen_width);
+ desc.default_button = NULL;
size += taskdialog_add_main_instruction(&desc);
size += taskdialog_add_content(&desc);
return template;
}
+static HRESULT taskdialog_notify(struct taskdialog_info *dialog_info, UINT notification, WPARAM wparam, LPARAM lparam)
+{
+ return dialog_info->callback ? dialog_info->callback(dialog_info->hwnd, notification, wparam, lparam,
+ dialog_info->callback_data) : S_OK;
+}
+
+static void taskdialog_on_button_click(struct taskdialog_info *dialog_info, WORD command_id)
+{
+ if (taskdialog_notify(dialog_info, TDN_BUTTON_CLICKED, command_id, 0) == S_OK)
+ EndDialog(dialog_info->hwnd, command_id);
+}
+
static INT_PTR CALLBACK taskdialog_proc(HWND hwnd, UINT msg, WPARAM wParam, LPARAM lParam)
{
+ static const WCHAR taskdialog_info_propnameW[] = {'T','a','s','k','D','i','a','l','o','g','I','n','f','o',0};
+ struct taskdialog_info *dialog_info;
+
TRACE("hwnd=%p msg=0x%04x wparam=%lx lparam=%lx\n", hwnd, msg, wParam, lParam);
+ if (msg != WM_INITDIALOG)
+ dialog_info = GetPropW(hwnd, taskdialog_info_propnameW);
+
switch (msg)
{
+ case TDM_CLICK_BUTTON:
+ taskdialog_on_button_click(dialog_info, LOWORD(wParam));
+ break;
+ case WM_INITDIALOG:
+ dialog_info = (struct taskdialog_info *)lParam;
+ dialog_info->hwnd = hwnd;
+ SetPropW(hwnd, taskdialog_info_propnameW, dialog_info);
+
+ taskdialog_notify(dialog_info, TDN_DIALOG_CONSTRUCTED, 0, 0);
+ break;
+ case WM_SHOWWINDOW:
+ taskdialog_notify(dialog_info, TDN_CREATED, 0, 0);
+ break;
case WM_COMMAND:
if (HIWORD(wParam) == BN_CLICKED)
{
- WORD command_id = LOWORD(wParam);
- EndDialog(hwnd, command_id);
+ taskdialog_on_button_click(dialog_info, LOWORD(wParam));
return TRUE;
}
break;
+ case WM_DESTROY:
+ taskdialog_notify(dialog_info, TDN_DESTROYED, 0, 0);
+ RemovePropW(hwnd, taskdialog_info_propnameW);
+ break;
}
return FALSE;
}
HRESULT WINAPI TaskDialogIndirect(const TASKDIALOGCONFIG *taskconfig, int *button,
int *radio_button, BOOL *verification_flag_checked)
{
+ struct taskdialog_info dialog_info;
DLGTEMPLATE *template;
INT ret;
TRACE("%p, %p, %p, %p\n", taskconfig, button, radio_button, verification_flag_checked);
+ if (!taskconfig || taskconfig->cbSize != sizeof(TASKDIALOGCONFIG))
+ return E_INVALIDARG;
+
+ dialog_info.callback = taskconfig->pfCallback;
+ dialog_info.callback_data = taskconfig->lpCallbackData;
+
template = create_taskdialog_template(taskconfig);
- ret = DialogBoxIndirectParamW(taskconfig->hInstance, template, taskconfig->hwndParent, taskdialog_proc, 0);
+ ret = (short)DialogBoxIndirectParamW(taskconfig->hInstance, template, taskconfig->hwndParent,
+ taskdialog_proc, (LPARAM)&dialog_info);
Free(template);
if (button) *button = ret;
}
}
else {
- ERR("recursive text callback!\n");
+ ERR("recursive text callback\n");
buffer[0] = '\0';
}
}
}
else {
- ERR("recursive text callback!\n");
+ ERR("recursive text callback\n");
buffer[0] = '\0';
}
NMHDR hdr;
int ptfx = 0;
DWORD style = GetWindowLongW(infoPtr->hwndSelf, GWL_STYLE);
- INT nTool;
+ INT nTool, current;
if (track_activate)
{
if (infoPtr->nTrackTool == -1)
{
- TRACE("invalid tracking tool (-1)!\n");
+ TRACE("invalid tracking tool %d\n", infoPtr->nTrackTool);
return;
}
nTool = infoPtr->nTrackTool;
{
if (infoPtr->nTool == -1)
{
- TRACE("invalid tool (-1)!\n");
- return;
+ TRACE("invalid tool %d\n", infoPtr->nTool);
+ return;
}
nTool = infoPtr->nTool;
}
- TRACE("Show tooltip pre %d! (%p)\n", nTool, infoPtr->hwndSelf);
+ TRACE("Show tooltip pre %d, %p\n", nTool, infoPtr->hwndSelf);
+
+ current = infoPtr->nCurrentTool;
+ if (!track_activate)
+ infoPtr->nCurrentTool = infoPtr->nTool;
TOOLTIPS_GetTipText (infoPtr, nTool, infoPtr->szTipText);
if (infoPtr->szTipText[0] == '\0')
+ {
+ infoPtr->nCurrentTool = current;
return;
+ }
toolPtr = &infoPtr->tools[nTool];
- if (!track_activate)
- infoPtr->nCurrentTool = infoPtr->nTool;
-
- TRACE("Show tooltip %d!\n", nTool);
+ TRACE("Show tooltip %d\n", nTool);
hdr.hwndFrom = infoPtr->hwndSelf;
hdr.idFrom = toolPtr->uId;
if (!track_activate)
{
SetTimer (infoPtr->hwndSelf, ID_TIMERPOP, infoPtr->nAutoPopTime, 0);
- TRACE("timer 2 started!\n");
+ TRACE("timer 2 started\n");
SetTimer (infoPtr->hwndSelf, ID_TIMERLEAVE, infoPtr->nReshowTime, 0);
- TRACE("timer 3 started!\n");
+ TRACE("timer 3 started\n");
}
}
TTTOOL_INFO *toolPtr;
NMHDR hdr;
- TRACE("Hide tooltip %d! (%p)\n", infoPtr->nCurrentTool, infoPtr->hwndSelf);
+ TRACE("Hide tooltip %d, %p.\n", infoPtr->nCurrentTool, infoPtr->hwndSelf);
if (infoPtr->nCurrentTool == -1)
return;
}
static inline void
-TOOLTIPS_CopyInfoT (const TTTOOL_INFO *toolPtr, TTTOOLINFOW *ti, BOOL isW)
+TOOLTIPS_CopyInfoT (const TOOLTIPS_INFO *infoPtr, INT index, TTTOOLINFOW *ti, BOOL isW)
{
+ const TTTOOL_INFO *toolPtr = &infoPtr->tools[index];
+
+ ti->uFlags = toolPtr->uFlags;
+ ti->hwnd = toolPtr->hwnd;
+ ti->uId = toolPtr->uId;
+ ti->rect = toolPtr->rect;
+ ti->hinst = toolPtr->hinst;
+
if (ti->lpszText) {
if (toolPtr->lpszText == NULL ||
IS_INTRESOURCE(toolPtr->lpszText) ||
WideCharToMultiByte(CP_ACP, 0, toolPtr->lpszText, -1,
(LPSTR)ti->lpszText, MAX_TEXT_SIZE_A, NULL, NULL);
}
+
+ if (ti->cbSize >= TTTOOLINFOW_V2_SIZE)
+ ti->lParam = toolPtr->lParam;
+
+ /* lpReserved is intentionally not set. */
}
static BOOL
{
infoPtr->bActive = activate;
- if (infoPtr->bActive)
- TRACE("activate!\n");
+ TRACE("activate %d\n", activate);
if (!(infoPtr->bActive) && (infoPtr->nCurrentTool != -1))
TOOLTIPS_Hide (infoPtr);
if (!ti) return FALSE;
- TRACE("add tool (%p) %p %ld%s!\n",
- infoPtr->hwndSelf, ti->hwnd, ti->uId,
- (ti->uFlags & TTF_IDISHWND) ? " TTF_IDISHWND" : "");
+ TRACE("add tool (%p) %p %ld%s\n", infoPtr->hwndSelf, ti->hwnd, ti->uId,
+ (ti->uFlags & TTF_IDISHWND) ? " TTF_IDISHWND" : "");
if (ti->cbSize >= TTTOOLINFOW_V2_SIZE && !ti->lpszText && isW)
return FALSE;
}
else if (ti->lpszText) {
if (TOOLTIPS_IsCallbackString(ti->lpszText, isW)) {
- TRACE("add CALLBACK!\n");
+ TRACE("add CALLBACK\n");
toolPtr->lpszText = LPSTR_TEXTCALLBACKW;
}
else if (isW) {
- __TRY
- {
- INT len = lstrlenW (ti->lpszText);
- TRACE("add text %s!\n", debugstr_w(ti->lpszText));
- toolPtr->lpszText = Alloc ((len + 1)*sizeof(WCHAR));
- strcpyW (toolPtr->lpszText, ti->lpszText);
- }
- __EXCEPT_PAGE_FAULT
- {
- WARN("Invalid lpszText.\n");
- return FALSE;
- }
- __ENDTRY
+ INT len = lstrlenW (ti->lpszText);
+ TRACE("add text %s\n", debugstr_w(ti->lpszText));
+ toolPtr->lpszText = Alloc ((len + 1)*sizeof(WCHAR));
+ strcpyW (toolPtr->lpszText, ti->lpszText);
}
else {
INT len = MultiByteToWideChar(CP_ACP, 0, (LPSTR)ti->lpszText, -1, NULL, 0);
- TRACE("add text \"%s\"!\n", (LPSTR)ti->lpszText);
+ TRACE("add text \"%s\"\n", debugstr_a((char *)ti->lpszText));
toolPtr->lpszText = Alloc (len * sizeof(WCHAR));
MultiByteToWideChar(CP_ACP, 0, (LPSTR)ti->lpszText, -1, toolPtr->lpszText, len);
}
SetWindowSubclass(toolPtr->hwnd, TOOLTIPS_SubclassProc, 1,
(DWORD_PTR)infoPtr->hwndSelf);
}
- TRACE("subclassing installed!\n");
+ TRACE("subclassing installed\n");
}
nResult = SendMessageW (toolPtr->hwnd, WM_NOTIFYFORMAT,
toolPtr->bNotifyUnicode = TRUE;
TRACE(" -- WM_NOTIFYFORMAT returns: NFR_UNICODE\n");
} else {
- TRACE (" -- WM_NOTIFYFORMAT returns: error!\n");
+ TRACE (" -- WM_NOTIFYFORMAT returns: %d\n", nResult);
}
return TRUE;
}
+static void TOOLTIPS_ResetSubclass (const TTTOOL_INFO *toolPtr)
+{
+ /* Reset subclassing data. */
+ if (toolPtr->uInternalFlags & TTF_SUBCLASS)
+ SetWindowSubclass(toolPtr->uInternalFlags & TTF_IDISHWND ? (HWND)toolPtr->uId : toolPtr->hwnd,
+ TOOLTIPS_SubclassProc, 1, 0);
+}
static LRESULT
TOOLTIPS_DelToolT (TOOLTIPS_INFO *infoPtr, const TTTOOLINFOW *ti, BOOL isW)
Free (toolPtr->lpszText);
}
- /* remove subclassing */
- if (toolPtr->uInternalFlags & TTF_SUBCLASS) {
- if (toolPtr->uInternalFlags & TTF_IDISHWND) {
- RemoveWindowSubclass((HWND)toolPtr->uId, TOOLTIPS_SubclassProc, 1);
- }
- else {
- RemoveWindowSubclass(toolPtr->hwnd, TOOLTIPS_SubclassProc, 1);
- }
- }
+ TOOLTIPS_ResetSubclass (toolPtr);
/* delete tool from tool list */
if (infoPtr->uNumTools == 1) {
TOOLTIPS_EnumToolsT (const TOOLTIPS_INFO *infoPtr, UINT uIndex, TTTOOLINFOW *ti,
BOOL isW)
{
- TTTOOL_INFO *toolPtr;
-
- if (!ti) return FALSE;
- if (ti->cbSize < TTTOOLINFOW_V1_SIZE)
+ if (!ti || ti->cbSize < TTTOOLINFOW_V1_SIZE)
return FALSE;
if (uIndex >= infoPtr->uNumTools)
return FALSE;
TRACE("index=%u\n", uIndex);
- toolPtr = &infoPtr->tools[uIndex];
-
- /* copy tool data */
- ti->uFlags = toolPtr->uFlags;
- ti->hwnd = toolPtr->hwnd;
- ti->uId = toolPtr->uId;
- ti->rect = toolPtr->rect;
- ti->hinst = toolPtr->hinst;
- TOOLTIPS_CopyInfoT (toolPtr, ti, isW);
-
- if (ti->cbSize >= TTTOOLINFOA_V2_SIZE)
- ti->lParam = toolPtr->lParam;
+ TOOLTIPS_CopyInfoT (infoPtr, uIndex, ti, isW);
return TRUE;
}
static LRESULT
TOOLTIPS_GetCurrentToolT (const TOOLTIPS_INFO *infoPtr, TTTOOLINFOW *ti, BOOL isW)
{
- TTTOOL_INFO *toolPtr;
-
if (ti) {
if (ti->cbSize < TTTOOLINFOW_V1_SIZE)
return FALSE;
- if (infoPtr->nCurrentTool > -1) {
- toolPtr = &infoPtr->tools[infoPtr->nCurrentTool];
-
- /* copy tool data */
- ti->uFlags = toolPtr->uFlags;
- ti->rect = toolPtr->rect;
- ti->hinst = toolPtr->hinst;
- TOOLTIPS_CopyInfoT (toolPtr, ti, isW);
-
- if (ti->cbSize >= TTTOOLINFOW_V2_SIZE)
- ti->lParam = toolPtr->lParam;
-
- return TRUE;
- }
- else
- return FALSE;
+ if (infoPtr->nCurrentTool != -1)
+ TOOLTIPS_CopyInfoT (infoPtr, infoPtr->nCurrentTool, ti, isW);
}
- else
- return (infoPtr->nCurrentTool != -1);
+
+ return infoPtr->nCurrentTool != -1;
}
static LRESULT
TOOLTIPS_GetToolInfoT (const TOOLTIPS_INFO *infoPtr, TTTOOLINFOW *ti, BOOL isW)
{
- TTTOOL_INFO *toolPtr;
INT nTool;
+ HWND hwnd;
if (!ti) return FALSE;
if (ti->cbSize < TTTOOLINFOW_V1_SIZE)
TRACE("tool %d\n", nTool);
- toolPtr = &infoPtr->tools[nTool];
-
- /* copy tool data */
- ti->uFlags = toolPtr->uFlags;
- ti->rect = toolPtr->rect;
- ti->hinst = toolPtr->hinst;
- TOOLTIPS_CopyInfoT (toolPtr, ti, isW);
-
- if (ti->cbSize >= TTTOOLINFOW_V2_SIZE)
- ti->lParam = toolPtr->lParam;
+ hwnd = ti->hwnd;
+ TOOLTIPS_CopyInfoT (infoPtr, nTool, ti, isW);
+ ti->hwnd = hwnd;
return TRUE;
}
TOOLTIPS_HitTestT (const TOOLTIPS_INFO *infoPtr, LPTTHITTESTINFOW lptthit,
BOOL isW)
{
- TTTOOL_INFO *toolPtr;
INT nTool;
if (lptthit == 0)
if (nTool == -1)
return FALSE;
- TRACE("tool %d!\n", nTool);
+ TRACE("tool %d\n", nTool);
/* copy tool data */
- if (lptthit->ti.cbSize >= TTTOOLINFOW_V1_SIZE) {
- toolPtr = &infoPtr->tools[nTool];
-
- lptthit->ti.uFlags = toolPtr->uFlags;
- lptthit->ti.hwnd = toolPtr->hwnd;
- lptthit->ti.uId = toolPtr->uId;
- lptthit->ti.rect = toolPtr->rect;
- lptthit->ti.hinst = toolPtr->hinst;
- TOOLTIPS_CopyInfoT (toolPtr, &lptthit->ti, isW);
- if (lptthit->ti.cbSize >= TTTOOLINFOW_V2_SIZE)
- lptthit->ti.lParam = toolPtr->lParam;
- }
+ if (lptthit->ti.cbSize >= TTTOOLINFOW_V1_SIZE)
+ TOOLTIPS_CopyInfoT (infoPtr, nTool, &lptthit->ti, isW);
return TRUE;
}
INT nOldTool;
if (!lpMsg) {
- ERR("lpMsg == NULL!\n");
+ ERR("lpMsg == NULL\n");
return 0;
}
} else if (nOldTool == -1) { /* Moved from outside */
if(infoPtr->bActive) {
SetTimer(infoPtr->hwndSelf, ID_TIMERSHOW, infoPtr->nInitialTime, 0);
- TRACE("timer 1 started!\n");
+ TRACE("timer 1 started\n");
}
} else { /* Moved from one to another */
TOOLTIPS_Hide (infoPtr);
KillTimer(infoPtr->hwndSelf, ID_TIMERLEAVE);
if(infoPtr->bActive) {
SetTimer (infoPtr->hwndSelf, ID_TIMERSHOW, infoPtr->nReshowTime, 0);
- TRACE("timer 1 started!\n");
+ TRACE("timer 1 started\n");
}
}
} else if(infoPtr->nCurrentTool != -1) { /* restart autopop */
} else if(infoPtr->nTool != -1 && infoPtr->bActive) {
/* previous show attempt didn't result in tooltip so try again */
SetTimer(infoPtr->hwndSelf, ID_TIMERSHOW, infoPtr->nInitialTime, 0);
- TRACE("timer 1 started!\n");
+ TRACE("timer 1 started\n");
}
break;
}
toolPtr->hinst = ti->hinst;
if (IS_INTRESOURCE(ti->lpszText)) {
- TRACE("set string id %x!\n", LOWORD(ti->lpszText));
+ TRACE("set string id %x\n", LOWORD(ti->lpszText));
toolPtr->lpszText = ti->lpszText;
}
else {
/* activate */
infoPtr->nTrackTool = TOOLTIPS_GetToolFromInfoT (infoPtr, (const TTTOOLINFOW*)ti);
if (infoPtr->nTrackTool != -1) {
- TRACE("activated!\n");
+ TRACE("activated\n");
infoPtr->bTrackActive = TRUE;
TOOLTIPS_TrackShow (infoPtr);
}
infoPtr->bTrackActive = FALSE;
infoPtr->nTrackTool = -1;
- TRACE("deactivated!\n");
+ TRACE("deactivated\n");
}
return 0;
}
}
- /* remove subclassing */
- if (toolPtr->uInternalFlags & TTF_SUBCLASS) {
- if (toolPtr->uInternalFlags & TTF_IDISHWND) {
- RemoveWindowSubclass((HWND)toolPtr->uId, TOOLTIPS_SubclassProc, 1);
- }
- else {
- RemoveWindowSubclass(toolPtr->hwnd, TOOLTIPS_SubclassProc, 1);
- }
+ TOOLTIPS_ResetSubclass (toolPtr);
}
- }
+
Free (infoPtr->tools);
}
if ((nTool > -1) && (nTool < infoPtr->uNumTools)) {
if (infoPtr->tools[nTool].uFlags & TTF_TRANSPARENT) {
- TRACE("-- in transparent mode!\n");
+ TRACE("-- in transparent mode\n");
return HTTRANSPARENT;
}
}
lf.lfWeight = FW_BOLD;
infoPtr->hTitleFont = CreateFontIndirectW(&lf);
- if (redraw && infoPtr->nCurrentTool != -1) {
- FIXME("full redraw needed!\n");
- }
+ if (redraw && infoPtr->nCurrentTool != -1)
+ FIXME("full redraw needed\n");
return 0;
}
{
INT nOldTool;
- TRACE("timer %d (%p) expired!\n", iTimer, infoPtr->hwndSelf);
+ TRACE("timer %d (%p) expired\n", iTimer, infoPtr->hwndSelf);
switch (iTimer) {
case ID_TIMERSHOW:
static LRESULT CALLBACK
-TOOLTIPS_SubclassProc (HWND hwnd, UINT uMsg, WPARAM wParam, LPARAM lParam, UINT_PTR uID, DWORD_PTR dwRef)
+TOOLTIPS_SubclassProc (HWND hwnd, UINT message, WPARAM wParam, LPARAM lParam, UINT_PTR uID, DWORD_PTR dwRef)
{
TOOLTIPS_INFO *infoPtr = TOOLTIPS_GetInfoPtr ((HWND)dwRef);
MSG msg;
- switch(uMsg) {
+ switch (message)
+ {
case WM_MOUSEMOVE:
case WM_LBUTTONDOWN:
case WM_LBUTTONUP:
case WM_MBUTTONUP:
case WM_RBUTTONDOWN:
case WM_RBUTTONUP:
- msg.hwnd = hwnd;
- msg.message = uMsg;
- msg.wParam = wParam;
- msg.lParam = lParam;
- TOOLTIPS_RelayEvent(infoPtr, &msg);
- break;
-
+ if (infoPtr)
+ {
+ msg.hwnd = hwnd;
+ msg.message = message;
+ msg.wParam = wParam;
+ msg.lParam = lParam;
+ TOOLTIPS_RelayEvent(infoPtr, &msg);
+ }
+ break;
+ case WM_NCDESTROY:
+ RemoveWindowSubclass(hwnd, TOOLTIPS_SubclassProc, 1);
+ break;
default:
break;
}
- return DefSubclassProc(hwnd, uMsg, wParam, lParam);
+
+ return DefSubclassProc(hwnd, message, wParam, lParam);
}
RECT budRect; /* new coord for the buddy */
int x, width; /* new x position and width for the up-down */
WCHAR buddyClass[40];
- HWND ret;
+ HWND old_buddy;
TRACE("(hwnd=%p, bud=%p)\n", infoPtr->Self, bud);
- ret = infoPtr->Buddy;
+ old_buddy = infoPtr->Buddy;
/* there is already a buddy assigned */
if (infoPtr->Buddy) RemoveWindowSubclass(infoPtr->Buddy, UPDOWN_Buddy_SubclassProc,
x = budRect.right+DEFAULT_XSEP;
} else {
/* nothing to do */
- return ret;
+ return old_buddy;
}
/* first adjust the buddy to accommodate the up/down */
budRect.top - DEFAULT_ADDTOP, width,
budRect.bottom - budRect.top + DEFAULT_ADDTOP + DEFAULT_ADDBOT,
SWP_NOACTIVATE|SWP_FRAMECHANGED|SWP_NOZORDER);
- } else {
+ } else if (!(infoPtr->dwStyle & UDS_HORZ) && old_buddy != NULL) {
RECT rect;
GetWindowRect(infoPtr->Self, &rect);
MapWindowPoints(HWND_DESKTOP, GetParent(infoPtr->Self), (POINT *)&rect, 2);
SetWindowPos(infoPtr->Self, 0, rect.left, rect.top, DEFAULT_WIDTH, rect.bottom - rect.top,
SWP_NOACTIVATE|SWP_FRAMECHANGED|SWP_NOZORDER);
}
- return ret;
+
+ return old_buddy;
}
/***********************************************************************
reactos/dll/win32/cabinet # Synced to WineStaging-2.9
reactos/dll/win32/clusapi # Synced to WineStaging-2.9
reactos/dll/win32/comcat # Synced to WineStaging-2.9
-reactos/dll/win32/comctl32 # Synced to WineStaging-2.16
+reactos/dll/win32/comctl32 # Synced to Wine-3.0
reactos/dll/win32/comdlg32 # Synced to WineStaging-2.16
reactos/dll/win32/compstui # Synced to WineStaging-2.9
reactos/dll/win32/credui # Synced to WineStaging-2.9