mirror of
https://github.com/reactos/reactos.git
synced 2024-12-27 04:53:31 +08:00
[COMCTL32] Sync with Wine Staging 2.16. CORE-13762
d505c2d comctl32/monthcal: Make sure set focus date is valid before using it (Valgrind). a56f49c comctl32/monthcal: Make sure set today date is valid before using it (Valgrind). 9231452 comctl32/monthcal: Initialize day field before setting final hit test result (Valgrind). 1d45250 comctl32/listview: Invalidate the focus rectangle when the control gets or loses focus. d6fdbae comctl32: New high resolution cursors generated from SVG. 11c557b comctl32: Don't FIXME on handled cases. 5b06498 comctl32/taskdialog: Added support for custom buttons. 9e3ebed comctl32/taskdialog: Added TaskDialog() export. d93ae6f comctl32/toolbar: Support undocumented IDs for standard bitmap lists. ece34a1 comctl32/toolbar: Don't add NULL imagelist entries. e558858 comctl32: Change some overly exciting tracing messages. svn path=/trunk/; revision=75862
This commit is contained in:
parent
fd6f688414
commit
a82b6638df
@ -695,7 +695,7 @@ static BOOL ANIMATE_OpenW(ANIMATE_INFO *infoPtr, HINSTANCE hInstance, LPWSTR lps
|
||||
|
||||
if (!lpszName)
|
||||
{
|
||||
TRACE("Closing avi!\n");
|
||||
TRACE("Closing avi.\n");
|
||||
/* installer of thebat! v1.62 requires FALSE here */
|
||||
return (infoPtr->hMMio != 0);
|
||||
}
|
||||
@ -709,10 +709,10 @@ static BOOL ANIMATE_OpenW(ANIMATE_INFO *infoPtr, HINSTANCE hInstance, LPWSTR lps
|
||||
{
|
||||
if (!ANIMATE_LoadResW(infoPtr, hInstance, lpszName))
|
||||
{
|
||||
TRACE("No AVI resource found!\n");
|
||||
TRACE("No AVI resource found.\n");
|
||||
if (!ANIMATE_LoadFileW(infoPtr, lpszName))
|
||||
{
|
||||
WARN("No AVI file found!\n");
|
||||
WARN("No AVI file found.\n");
|
||||
return FALSE;
|
||||
}
|
||||
}
|
||||
@ -721,7 +721,7 @@ static BOOL ANIMATE_OpenW(ANIMATE_INFO *infoPtr, HINSTANCE hInstance, LPWSTR lps
|
||||
{
|
||||
if (!ANIMATE_LoadResW(infoPtr, hInstance, lpszName))
|
||||
{
|
||||
WARN("No AVI resource found!\n");
|
||||
WARN("No AVI resource found.\n");
|
||||
return FALSE;
|
||||
}
|
||||
}
|
||||
|
File diff suppressed because it is too large
Load Diff
@ -275,13 +275,13 @@ BOOL WINAPI DPA_Merge (HDPA hdpa1, HDPA hdpa2, DWORD dwFlags,
|
||||
return FALSE;
|
||||
|
||||
if (!(dwFlags & DPAM_SORTED)) {
|
||||
TRACE("sorting dpa's!\n");
|
||||
TRACE("sorting dpa's.\n");
|
||||
if (hdpa1->nItemCount > 0)
|
||||
DPA_Sort (hdpa1, pfnCompare, lParam);
|
||||
TRACE ("dpa 1 sorted!\n");
|
||||
TRACE ("dpa 1 sorted.\n");
|
||||
if (hdpa2->nItemCount > 0)
|
||||
DPA_Sort (hdpa2, pfnCompare, lParam);
|
||||
TRACE ("dpa 2 sorted!\n");
|
||||
TRACE ("dpa 2 sorted.\n");
|
||||
}
|
||||
|
||||
if (hdpa2->nItemCount < 1)
|
||||
|
@ -1698,7 +1698,7 @@ HEADER_LButtonDown (HEADER_INFO *infoPtr, INT x, INT y)
|
||||
HEADER_RefreshItem (infoPtr, nItem);
|
||||
ReleaseDC (infoPtr->hwndSelf, hdc);
|
||||
|
||||
TRACE("Pressed item %d!\n", nItem);
|
||||
TRACE("Pressed item %d.\n", nItem);
|
||||
}
|
||||
else if ((flags == HHT_ONDIVIDER) || (flags == HHT_ONDIVOPEN)) {
|
||||
INT iCurrWidth = infoPtr->items[nItem].cxy;
|
||||
@ -1717,7 +1717,7 @@ HEADER_LButtonDown (HEADER_INFO *infoPtr, INT x, INT y)
|
||||
ReleaseDC (infoPtr->hwndSelf, hdc);
|
||||
}
|
||||
|
||||
TRACE("Begin tracking item %d!\n", nItem);
|
||||
TRACE("Begin tracking item %d.\n", nItem);
|
||||
}
|
||||
}
|
||||
|
||||
@ -1783,14 +1783,14 @@ HEADER_LButtonUp (HEADER_INFO *infoPtr, INT x, INT y)
|
||||
HEADER_SendNotifyWithHDItemT(infoPtr, HDN_ITEMCLICKW, infoPtr->iMoveItem, NULL);
|
||||
}
|
||||
|
||||
TRACE("Released item %d!\n", infoPtr->iMoveItem);
|
||||
TRACE("Released item %d.\n", infoPtr->iMoveItem);
|
||||
infoPtr->bPressed = FALSE;
|
||||
}
|
||||
else if (infoPtr->bTracking) {
|
||||
INT iNewWidth = pt.x - infoPtr->items[infoPtr->iMoveItem].rect.left + infoPtr->xTrackOffset;
|
||||
if (iNewWidth < 0)
|
||||
iNewWidth = 0;
|
||||
TRACE("End tracking item %d!\n", infoPtr->iMoveItem);
|
||||
TRACE("End tracking item %d.\n", infoPtr->iMoveItem);
|
||||
infoPtr->bTracking = FALSE;
|
||||
|
||||
HEADER_SendNotifyWithIntFieldT(infoPtr, HDN_ENDTRACKW, infoPtr->iMoveItem, HDI_WIDTH, iNewWidth);
|
||||
@ -1920,7 +1920,7 @@ HEADER_MouseMove (HEADER_INFO *infoPtr, LPARAM lParam)
|
||||
ReleaseDC (infoPtr->hwndSelf, hdc);
|
||||
}
|
||||
|
||||
TRACE("Moving pressed item %d!\n", infoPtr->iMoveItem);
|
||||
TRACE("Moving pressed item %d.\n", infoPtr->iMoveItem);
|
||||
}
|
||||
else if (infoPtr->bTracking) {
|
||||
if (infoPtr->dwStyle & HDS_FULLDRAG) {
|
||||
@ -1960,7 +1960,7 @@ HEADER_MouseMove (HEADER_INFO *infoPtr, LPARAM lParam)
|
||||
HEADER_SendNotifyWithIntFieldT(infoPtr, HDN_TRACKW, infoPtr->iMoveItem, HDI_WIDTH, iTrackWidth);
|
||||
}
|
||||
|
||||
TRACE("Tracking item %d!\n", infoPtr->iMoveItem);
|
||||
TRACE("Tracking item %d.\n", infoPtr->iMoveItem);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -10776,11 +10776,12 @@ static inline LRESULT LISTVIEW_WMPaint(LISTVIEW_INFO *infoPtr, HDC hdc)
|
||||
*/
|
||||
static LRESULT LISTVIEW_PrintClient(LISTVIEW_INFO *infoPtr, HDC hdc, DWORD options)
|
||||
{
|
||||
FIXME("Partial Stub: (hdc=%p options=0x%08x)\n", hdc, options);
|
||||
|
||||
if ((options & PRF_CHECKVISIBLE) && !IsWindowVisible(infoPtr->hwndSelf))
|
||||
return 0;
|
||||
|
||||
if (options & ~(PRF_ERASEBKGND|PRF_CLIENT))
|
||||
FIXME("(hdc=%p options=0x%08x) partial stub\n", hdc, options);
|
||||
|
||||
if (options & PRF_ERASEBKGND)
|
||||
LISTVIEW_EraseBkgnd(infoPtr, hdc);
|
||||
|
||||
|
@ -244,10 +244,12 @@ static inline BOOL MONTHCAL_IsDateEqual(const SYSTEMTIME *first, const SYSTEMTIM
|
||||
/* make sure that date fields are valid */
|
||||
static BOOL MONTHCAL_ValidateDate(const SYSTEMTIME *time)
|
||||
{
|
||||
if(time->wMonth < 1 || time->wMonth > 12 ) return FALSE;
|
||||
if(time->wDay > MONTHCAL_MonthLength(time->wMonth, time->wYear)) return FALSE;
|
||||
if (time->wMonth < 1 || time->wMonth > 12 )
|
||||
return FALSE;
|
||||
if (time->wDay == 0 || time->wDay > MONTHCAL_MonthLength(time->wMonth, time->wYear))
|
||||
return FALSE;
|
||||
|
||||
return TRUE;
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
/* Copies timestamp part only.
|
||||
@ -626,11 +628,16 @@ static inline void MONTHCAL_GetDayRectI(const MONTHCAL_INFO *infoPtr, RECT *r,
|
||||
*
|
||||
* NOTE: when calendar index is unknown pass -1
|
||||
*/
|
||||
static inline void MONTHCAL_GetDayRect(const MONTHCAL_INFO *infoPtr, const SYSTEMTIME *date,
|
||||
RECT *r, INT calIdx)
|
||||
static BOOL MONTHCAL_GetDayRect(const MONTHCAL_INFO *infoPtr, const SYSTEMTIME *date, RECT *r, INT calIdx)
|
||||
{
|
||||
INT col, row;
|
||||
|
||||
if (!MONTHCAL_ValidateDate(date))
|
||||
{
|
||||
SetRectEmpty(r);
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
if (calIdx == -1)
|
||||
{
|
||||
INT cmp = MONTHCAL_CompareMonths(date, &infoPtr->calendars[0].month);
|
||||
@ -653,6 +660,8 @@ static inline void MONTHCAL_GetDayRect(const MONTHCAL_INFO *infoPtr, const SYSTE
|
||||
|
||||
MONTHCAL_GetDayPos(infoPtr, date, &col, &row, calIdx);
|
||||
MONTHCAL_GetDayRectI(infoPtr, r, col, row, calIdx);
|
||||
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
static LRESULT
|
||||
@ -724,20 +733,19 @@ static BOOL MONTHCAL_SetDayFocus(MONTHCAL_INFO *infoPtr, const SYSTEMTIME *st)
|
||||
if(MONTHCAL_IsDateEqual(&infoPtr->focusedSel, st)) return FALSE;
|
||||
|
||||
/* invalidate old focused day */
|
||||
MONTHCAL_GetDayRect(infoPtr, &infoPtr->focusedSel, &r, -1);
|
||||
InvalidateRect(infoPtr->hwndSelf, &r, FALSE);
|
||||
if (MONTHCAL_GetDayRect(infoPtr, &infoPtr->focusedSel, &r, -1))
|
||||
InvalidateRect(infoPtr->hwndSelf, &r, FALSE);
|
||||
|
||||
infoPtr->focusedSel = *st;
|
||||
}
|
||||
|
||||
MONTHCAL_GetDayRect(infoPtr, &infoPtr->focusedSel, &r, -1);
|
||||
/* On set invalidates new day, on reset clears previous focused day. */
|
||||
if (MONTHCAL_GetDayRect(infoPtr, &infoPtr->focusedSel, &r, -1))
|
||||
InvalidateRect(infoPtr->hwndSelf, &r, FALSE);
|
||||
|
||||
if(!st && MONTHCAL_ValidateDate(&infoPtr->focusedSel))
|
||||
infoPtr->focusedSel = st_null;
|
||||
|
||||
/* on set invalidates new day, on reset clears previous focused day */
|
||||
InvalidateRect(infoPtr->hwndSelf, &r, FALSE);
|
||||
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
@ -1725,21 +1733,22 @@ MONTHCAL_GetToday(const MONTHCAL_INFO *infoPtr, SYSTEMTIME *today)
|
||||
static BOOL
|
||||
MONTHCAL_UpdateToday(MONTHCAL_INFO *infoPtr, const SYSTEMTIME *today)
|
||||
{
|
||||
RECT new_r, old_r;
|
||||
RECT rect;
|
||||
|
||||
if(MONTHCAL_IsDateEqual(today, &infoPtr->todaysDate)) return FALSE;
|
||||
if (MONTHCAL_IsDateEqual(today, &infoPtr->todaysDate))
|
||||
return FALSE;
|
||||
|
||||
MONTHCAL_GetDayRect(infoPtr, &infoPtr->todaysDate, &old_r, -1);
|
||||
MONTHCAL_GetDayRect(infoPtr, today, &new_r, -1);
|
||||
/* Invalidate old and new today day rectangle, and today label. */
|
||||
if (MONTHCAL_GetDayRect(infoPtr, &infoPtr->todaysDate, &rect, -1))
|
||||
InvalidateRect(infoPtr->hwndSelf, &rect, FALSE);
|
||||
|
||||
infoPtr->todaysDate = *today;
|
||||
if (MONTHCAL_GetDayRect(infoPtr, today, &rect, -1))
|
||||
InvalidateRect(infoPtr->hwndSelf, &rect, FALSE);
|
||||
|
||||
/* only two days need redrawing */
|
||||
InvalidateRect(infoPtr->hwndSelf, &old_r, FALSE);
|
||||
InvalidateRect(infoPtr->hwndSelf, &new_r, FALSE);
|
||||
/* and today label */
|
||||
InvalidateRect(infoPtr->hwndSelf, &infoPtr->todayrect, FALSE);
|
||||
return TRUE;
|
||||
infoPtr->todaysDate = *today;
|
||||
|
||||
InvalidateRect(infoPtr->hwndSelf, &infoPtr->todayrect, FALSE);
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
/* MCM_SETTODAT handler */
|
||||
@ -1894,6 +1903,7 @@ MONTHCAL_HitTest(const MONTHCAL_INFO *infoPtr, MCHITTESTINFO *lpht)
|
||||
else if(PtInRect(&infoPtr->calendars[calIdx].days, lpht->pt))
|
||||
{
|
||||
htinfo.iOffset = calIdx;
|
||||
htinfo.st.wDay = ht_month->wDay;
|
||||
htinfo.st.wYear = ht_month->wYear;
|
||||
htinfo.st.wMonth = ht_month->wMonth;
|
||||
/* previous month only valid for first calendar */
|
||||
|
@ -28,7 +28,7 @@ WINE_DEFAULT_DEBUG_CHANNEL(taskdialog);
|
||||
#define ALIGN_LENGTH(_Len, _Align) _Len = ALIGNED_LENGTH(_Len, _Align)
|
||||
#define ALIGN_POINTER(_Ptr, _Align) _Ptr = ALIGNED_POINTER(_Ptr, _Align)
|
||||
|
||||
static const UINT DIALOG_MIN_WIDTH = 180;
|
||||
static const UINT DIALOG_MIN_WIDTH = 240;
|
||||
static const UINT DIALOG_SPACING = 5;
|
||||
static const UINT DIALOG_BUTTON_WIDTH = 50;
|
||||
static const UINT DIALOG_BUTTON_HEIGHT = 14;
|
||||
@ -55,6 +55,15 @@ struct taskdialog_template_desc
|
||||
HFONT font;
|
||||
};
|
||||
|
||||
struct taskdialog_button_desc
|
||||
{
|
||||
int id;
|
||||
const WCHAR *text;
|
||||
unsigned int width;
|
||||
unsigned int line;
|
||||
HINSTANCE hinst;
|
||||
};
|
||||
|
||||
static void pixels_to_dialogunits(const struct taskdialog_template_desc *desc, LONG *width, LONG *height)
|
||||
{
|
||||
if (width)
|
||||
@ -77,6 +86,47 @@ static void template_write_data(char **ptr, const void *src, unsigned int size)
|
||||
*ptr += size;
|
||||
}
|
||||
|
||||
/* used to calculate size for the controls */
|
||||
static void taskdialog_get_text_extent(const struct taskdialog_template_desc *desc, const WCHAR *text,
|
||||
BOOL user_resource, SIZE *sz)
|
||||
{
|
||||
RECT rect = { 0, 0, desc->dialog_width - DIALOG_SPACING * 2, 0}; /* padding left and right of the control */
|
||||
const WCHAR *textW = NULL;
|
||||
static const WCHAR nulW;
|
||||
unsigned int length;
|
||||
HFONT oldfont;
|
||||
HDC hdc;
|
||||
|
||||
if (IS_INTRESOURCE(text))
|
||||
{
|
||||
if (!(length = LoadStringW(user_resource ? desc->taskconfig->hInstance : COMCTL32_hModule,
|
||||
(UINT_PTR)text, (WCHAR *)&textW, 0)))
|
||||
{
|
||||
WARN("Failed to load text\n");
|
||||
textW = &nulW;
|
||||
length = 0;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
textW = text;
|
||||
length = strlenW(textW);
|
||||
}
|
||||
|
||||
hdc = GetDC(0);
|
||||
oldfont = SelectObject(hdc, desc->font);
|
||||
|
||||
dialogunits_to_pixels(desc, &rect.right, NULL);
|
||||
DrawTextW(hdc, textW, length, &rect, DT_LEFT | DT_EXPANDTABS | DT_CALCRECT | DT_WORDBREAK);
|
||||
pixels_to_dialogunits(desc, &rect.right, &rect.bottom);
|
||||
|
||||
SelectObject(hdc, oldfont);
|
||||
ReleaseDC(0, hdc);
|
||||
|
||||
sz->cx = rect.right - rect.left;
|
||||
sz->cy = rect.bottom - rect.top;
|
||||
}
|
||||
|
||||
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)
|
||||
{
|
||||
@ -124,43 +174,18 @@ static unsigned int taskdialog_add_control(struct taskdialog_template_desc *desc
|
||||
|
||||
static unsigned int taskdialog_add_static_label(struct taskdialog_template_desc *desc, WORD id, const WCHAR *str)
|
||||
{
|
||||
RECT rect = { 0, 0, desc->dialog_width - DIALOG_SPACING * 2, 0}; /* padding left and right of the control */
|
||||
const WCHAR *textW = NULL;
|
||||
unsigned int size, length;
|
||||
HFONT oldfont;
|
||||
HDC hdc;
|
||||
unsigned int size;
|
||||
SIZE sz;
|
||||
|
||||
if (!str)
|
||||
return 0;
|
||||
|
||||
if (IS_INTRESOURCE(str))
|
||||
{
|
||||
if (!(length = LoadStringW(desc->taskconfig->hInstance, (UINT_PTR)str, (WCHAR *)&textW, 0)))
|
||||
{
|
||||
WARN("Failed to load static text %s, id %#x\n", debugstr_w(str), id);
|
||||
return 0;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
textW = str;
|
||||
length = strlenW(textW);
|
||||
}
|
||||
|
||||
hdc = GetDC(0);
|
||||
oldfont = SelectObject(hdc, desc->font);
|
||||
|
||||
dialogunits_to_pixels(desc, &rect.right, NULL);
|
||||
DrawTextW(hdc, textW, length, &rect, DT_LEFT | DT_EXPANDTABS | DT_CALCRECT | DT_WORDBREAK);
|
||||
pixels_to_dialogunits(desc, &rect.right, &rect.bottom);
|
||||
|
||||
SelectObject(hdc, oldfont);
|
||||
ReleaseDC(0, hdc);
|
||||
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,
|
||||
desc->dialog_height, rect.right, rect.bottom);
|
||||
desc->dialog_height += rect.bottom;
|
||||
desc->dialog_height, sz.cx, sz.cy);
|
||||
desc->dialog_height += sz.cy + DIALOG_SPACING;
|
||||
return size;
|
||||
}
|
||||
|
||||
@ -174,37 +199,146 @@ static unsigned int taskdialog_add_content(struct taskdialog_template_desc *desc
|
||||
return taskdialog_add_static_label(desc, ID_CONTENT, desc->taskconfig->pszContent);
|
||||
}
|
||||
|
||||
static unsigned int taskdialog_add_common_buttons(struct taskdialog_template_desc *desc)
|
||||
static void taskdialog_init_button(struct taskdialog_button_desc *button, struct taskdialog_template_desc *desc,
|
||||
int id, const WCHAR *text, BOOL custom_button)
|
||||
{
|
||||
SIZE sz;
|
||||
|
||||
taskdialog_get_text_extent(desc, text, custom_button, &sz);
|
||||
|
||||
button->id = id;
|
||||
button->text = text;
|
||||
button->width = max(DIALOG_BUTTON_WIDTH, sz.cx + DIALOG_SPACING * 2);
|
||||
button->line = 0;
|
||||
button->hinst = custom_button ? desc->taskconfig->hInstance : COMCTL32_hModule;
|
||||
}
|
||||
|
||||
static void taskdialog_init_common_buttons(struct taskdialog_template_desc *desc, struct taskdialog_button_desc *buttons,
|
||||
unsigned int *button_count)
|
||||
{
|
||||
short button_x = desc->dialog_width - DIALOG_BUTTON_WIDTH - DIALOG_SPACING;
|
||||
DWORD flags = desc->taskconfig->dwCommonButtons;
|
||||
unsigned int size = 0;
|
||||
|
||||
#define TASKDIALOG_ADD_COMMON_BUTTON(id) \
|
||||
#define TASKDIALOG_INIT_COMMON_BUTTON(id) \
|
||||
do { \
|
||||
size += taskdialog_add_control(desc, ID##id, WC_BUTTONW, COMCTL32_hModule, MAKEINTRESOURCEW(IDS_BUTTON_##id), \
|
||||
button_x, desc->dialog_height + DIALOG_SPACING, DIALOG_BUTTON_WIDTH, DIALOG_BUTTON_HEIGHT); \
|
||||
button_x -= DIALOG_BUTTON_WIDTH + DIALOG_SPACING; \
|
||||
taskdialog_init_button(&buttons[(*button_count)++], desc, ID##id, MAKEINTRESOURCEW(IDS_BUTTON_##id), FALSE); \
|
||||
} while(0)
|
||||
if (flags & TDCBF_CLOSE_BUTTON)
|
||||
TASKDIALOG_ADD_COMMON_BUTTON(CLOSE);
|
||||
if (flags & TDCBF_CANCEL_BUTTON)
|
||||
TASKDIALOG_ADD_COMMON_BUTTON(CANCEL);
|
||||
if (flags & TDCBF_RETRY_BUTTON)
|
||||
TASKDIALOG_ADD_COMMON_BUTTON(RETRY);
|
||||
if (flags & TDCBF_NO_BUTTON)
|
||||
TASKDIALOG_ADD_COMMON_BUTTON(NO);
|
||||
if (flags & TDCBF_YES_BUTTON)
|
||||
TASKDIALOG_ADD_COMMON_BUTTON(YES);
|
||||
if (flags & TDCBF_OK_BUTTON)
|
||||
TASKDIALOG_ADD_COMMON_BUTTON(OK);
|
||||
/* Always add OK button */
|
||||
if (list_empty(&desc->controls))
|
||||
TASKDIALOG_ADD_COMMON_BUTTON(OK);
|
||||
#undef TASKDIALOG_ADD_COMMON_BUTTON
|
||||
|
||||
/* make room for common buttons row */
|
||||
desc->dialog_height += DIALOG_BUTTON_HEIGHT + 2 * DIALOG_SPACING;
|
||||
if (flags & TDCBF_OK_BUTTON)
|
||||
TASKDIALOG_INIT_COMMON_BUTTON(OK);
|
||||
if (flags & TDCBF_YES_BUTTON)
|
||||
TASKDIALOG_INIT_COMMON_BUTTON(YES);
|
||||
if (flags & TDCBF_NO_BUTTON)
|
||||
TASKDIALOG_INIT_COMMON_BUTTON(NO);
|
||||
if (flags & TDCBF_RETRY_BUTTON)
|
||||
TASKDIALOG_INIT_COMMON_BUTTON(RETRY);
|
||||
if (flags & TDCBF_CANCEL_BUTTON)
|
||||
TASKDIALOG_INIT_COMMON_BUTTON(CANCEL);
|
||||
if (flags & TDCBF_CLOSE_BUTTON)
|
||||
TASKDIALOG_INIT_COMMON_BUTTON(CLOSE);
|
||||
|
||||
#undef TASKDIALOG_INIT_COMMON_BUTTON
|
||||
}
|
||||
|
||||
static unsigned int taskdialog_add_buttons(struct taskdialog_template_desc *desc)
|
||||
{
|
||||
unsigned int count = 0, buttons_size, i, line_count, size = 0;
|
||||
unsigned int location_x, *line_widths, alignment = ~0u;
|
||||
const TASKDIALOGCONFIG *taskconfig = desc->taskconfig;
|
||||
struct taskdialog_button_desc *buttons;
|
||||
|
||||
/* Allocate enough memory for the custom and the default buttons. Maximum 6 default buttons possible. */
|
||||
buttons_size = 6;
|
||||
if (taskconfig->cButtons && taskconfig->pButtons)
|
||||
buttons_size += taskconfig->cButtons;
|
||||
|
||||
if (!(buttons = Alloc(buttons_size * sizeof(*buttons))))
|
||||
return 0;
|
||||
|
||||
/* Custom buttons */
|
||||
if (taskconfig->cButtons && taskconfig->pButtons)
|
||||
for (i = 0; i < taskconfig->cButtons; i++)
|
||||
taskdialog_init_button(&buttons[count++], desc, taskconfig->pButtons[i].nButtonID,
|
||||
taskconfig->pButtons[i].pszButtonText, TRUE);
|
||||
|
||||
/* Common buttons */
|
||||
taskdialog_init_common_buttons(desc, buttons, &count);
|
||||
|
||||
/* There must be at least one button */
|
||||
if (count == 0)
|
||||
taskdialog_init_button(&buttons[count++], desc, IDOK, MAKEINTRESOURCEW(IDS_BUTTON_OK), FALSE);
|
||||
|
||||
/* For easy handling just allocate as many lines as buttons, the worst case. */
|
||||
line_widths = Alloc(count * sizeof(*line_widths));
|
||||
|
||||
/* Separate buttons into lines */
|
||||
location_x = DIALOG_SPACING;
|
||||
for (i = 0, line_count = 0; i < count; i++)
|
||||
{
|
||||
if (location_x + buttons[i].width + DIALOG_SPACING > desc->dialog_width)
|
||||
{
|
||||
location_x = DIALOG_SPACING;
|
||||
line_count++;
|
||||
}
|
||||
|
||||
buttons[i].line = line_count;
|
||||
|
||||
location_x += buttons[i].width + DIALOG_SPACING;
|
||||
line_widths[line_count] += buttons[i].width + DIALOG_SPACING;
|
||||
}
|
||||
line_count++;
|
||||
|
||||
/* Try to balance lines so they are about the same size */
|
||||
for (i = 1; i < line_count - 1; i++)
|
||||
{
|
||||
int diff_now = abs(line_widths[i] - line_widths[i - 1]);
|
||||
unsigned int j, last_button = 0;
|
||||
int diff_changed;
|
||||
|
||||
for (j = 0; j < count; j++)
|
||||
if (buttons[j].line == i - 1)
|
||||
last_button = j;
|
||||
|
||||
/* Difference in length of both lines if we wrapped the last button from the last line into this one */
|
||||
diff_changed = abs(2 * buttons[last_button].width + line_widths[i] - line_widths[i - 1]);
|
||||
|
||||
if (diff_changed < diff_now)
|
||||
{
|
||||
buttons[last_button].line = i;
|
||||
line_widths[i] += buttons[last_button].width;
|
||||
line_widths[i - 1] -= buttons[last_button].width;
|
||||
}
|
||||
}
|
||||
|
||||
/* Calculate left alignment so all lines are as far right as possible. */
|
||||
for (i = 0; i < line_count; i++)
|
||||
{
|
||||
int new_alignment = desc->dialog_width - line_widths[i];
|
||||
if (new_alignment < alignment)
|
||||
alignment = new_alignment;
|
||||
}
|
||||
|
||||
/* Now that we got them all positioned, create all buttons */
|
||||
location_x = alignment;
|
||||
for (i = 0; i < count; i++)
|
||||
{
|
||||
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);
|
||||
|
||||
location_x += buttons[i].width + DIALOG_SPACING;
|
||||
}
|
||||
|
||||
/* Add height for last row and spacing */
|
||||
desc->dialog_height += DIALOG_BUTTON_HEIGHT + DIALOG_SPACING;
|
||||
|
||||
Free(line_widths);
|
||||
Free(buttons);
|
||||
|
||||
return size;
|
||||
}
|
||||
|
||||
@ -292,7 +426,7 @@ static DLGTEMPLATE *create_taskdialog_template(const TASKDIALOGCONFIG *taskconfi
|
||||
|
||||
size += taskdialog_add_main_instruction(&desc);
|
||||
size += taskdialog_add_content(&desc);
|
||||
size += taskdialog_add_common_buttons(&desc);
|
||||
size += taskdialog_add_buttons(&desc);
|
||||
|
||||
template = Alloc(size);
|
||||
if (!template)
|
||||
@ -371,3 +505,26 @@ HRESULT WINAPI TaskDialogIndirect(const TASKDIALOGCONFIG *taskconfig, int *butto
|
||||
|
||||
return S_OK;
|
||||
}
|
||||
|
||||
/***********************************************************************
|
||||
* TaskDialog [COMCTL32.@]
|
||||
*/
|
||||
HRESULT WINAPI TaskDialog(HWND owner, HINSTANCE hinst, const WCHAR *title, const WCHAR *main_instruction,
|
||||
const WCHAR *content, TASKDIALOG_COMMON_BUTTON_FLAGS common_buttons, const WCHAR *icon, int *button)
|
||||
{
|
||||
TASKDIALOGCONFIG taskconfig;
|
||||
|
||||
TRACE("%p, %p, %s, %s, %s, %#x, %s, %p\n", owner, hinst, debugstr_w(title), debugstr_w(main_instruction),
|
||||
debugstr_w(content), common_buttons, debugstr_w(icon), button);
|
||||
|
||||
memset(&taskconfig, 0, sizeof(taskconfig));
|
||||
taskconfig.cbSize = sizeof(taskconfig);
|
||||
taskconfig.hwndParent = owner;
|
||||
taskconfig.hInstance = hinst;
|
||||
taskconfig.dwCommonButtons = common_buttons;
|
||||
taskconfig.pszWindowTitle = title;
|
||||
taskconfig.u.pszMainIcon = icon;
|
||||
taskconfig.pszMainInstruction = main_instruction;
|
||||
taskconfig.pszContent = content;
|
||||
return TaskDialogIndirect(&taskconfig, button, NULL, NULL);
|
||||
}
|
||||
|
@ -1377,7 +1377,7 @@ TOOLBAR_CalcStrings (const TOOLBAR_INFO *infoPtr, LPSIZE lpSize)
|
||||
SelectObject (hdc, hOldFont);
|
||||
ReleaseDC (infoPtr->hwndSelf, hdc);
|
||||
|
||||
TRACE("max string size %d x %d!\n", lpSize->cx, lpSize->cy);
|
||||
TRACE("max string size %d x %d\n", lpSize->cx, lpSize->cy);
|
||||
}
|
||||
|
||||
/***********************************************************************
|
||||
@ -1914,13 +1914,13 @@ TOOLBAR_InternalHitTest (const TOOLBAR_INFO *infoPtr, const POINT *lpPt, BOOL *b
|
||||
|
||||
if (btnPtr->fsStyle & BTNS_SEP) {
|
||||
if (PtInRect (&btnPtr->rect, *lpPt)) {
|
||||
TRACE(" ON SEPARATOR %d!\n", i);
|
||||
TRACE(" ON SEPARATOR %d\n", i);
|
||||
return -i;
|
||||
}
|
||||
}
|
||||
else {
|
||||
if (PtInRect (&btnPtr->rect, *lpPt)) {
|
||||
TRACE(" ON BUTTON %d!\n", i);
|
||||
TRACE(" ON BUTTON %d\n", i);
|
||||
if (button)
|
||||
*button = TRUE;
|
||||
return i;
|
||||
@ -1928,7 +1928,7 @@ TOOLBAR_InternalHitTest (const TOOLBAR_INFO *infoPtr, const POINT *lpPt, BOOL *b
|
||||
}
|
||||
}
|
||||
|
||||
TRACE(" NOWHERE!\n");
|
||||
TRACE(" NOWHERE\n");
|
||||
return TOOLBAR_NOWHERE;
|
||||
}
|
||||
|
||||
@ -2074,7 +2074,6 @@ TOOLBAR_RelayEvent (HWND hwndTip, HWND hwndMsg, UINT uMsg,
|
||||
SendMessageW (hwndTip, TTM_RELAYEVENT, 0, (LPARAM)&msg);
|
||||
}
|
||||
|
||||
|
||||
static void
|
||||
TOOLBAR_TooltipAddTool(const TOOLBAR_INFO *infoPtr, const TBUTTON_INFO *button)
|
||||
{
|
||||
@ -2735,7 +2734,7 @@ TOOLBAR_CustomizeDialogProc(HWND hwnd, UINT uMsg, WPARAM wParam, LPARAM lParam)
|
||||
btnInfo = (PCUSTOMBUTTON)SendDlgItemMessageW (hwnd, wParam, LB_GETITEMDATA, lpdis->itemID, 0);
|
||||
if (btnInfo == NULL)
|
||||
{
|
||||
FIXME("btnInfo invalid!\n");
|
||||
FIXME("btnInfo invalid\n");
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
@ -2917,18 +2916,22 @@ TOOLBAR_AddBitmap (TOOLBAR_INFO *infoPtr, INT count, const TBADDBITMAP *lpAddBmp
|
||||
switch (lpAddBmp->nID)
|
||||
{
|
||||
case IDB_STD_SMALL_COLOR:
|
||||
case 2:
|
||||
info.nButtons = 15;
|
||||
info.nID = IDB_STD_SMALL;
|
||||
break;
|
||||
case IDB_STD_LARGE_COLOR:
|
||||
case 3:
|
||||
info.nButtons = 15;
|
||||
info.nID = IDB_STD_LARGE;
|
||||
break;
|
||||
case IDB_VIEW_SMALL_COLOR:
|
||||
case 6:
|
||||
info.nButtons = 12;
|
||||
info.nID = IDB_VIEW_SMALL;
|
||||
break;
|
||||
case IDB_VIEW_LARGE_COLOR:
|
||||
case 7:
|
||||
info.nButtons = 12;
|
||||
info.nID = IDB_VIEW_LARGE;
|
||||
break;
|
||||
@ -2941,10 +2944,11 @@ TOOLBAR_AddBitmap (TOOLBAR_INFO *infoPtr, INT count, const TBADDBITMAP *lpAddBmp
|
||||
info.nID = IDB_HIST_LARGE;
|
||||
break;
|
||||
default:
|
||||
WARN("unknown bitmap id, %ld\n", lpAddBmp->nID);
|
||||
return -1;
|
||||
}
|
||||
|
||||
TRACE ("adding %d internal bitmaps!\n", info.nButtons);
|
||||
TRACE ("adding %d internal bitmaps\n", info.nButtons);
|
||||
|
||||
/* Windows resize all the buttons to the size of a newly added standard image */
|
||||
if (lpAddBmp->nID & 1)
|
||||
@ -2965,7 +2969,7 @@ TOOLBAR_AddBitmap (TOOLBAR_INFO *infoPtr, INT count, const TBADDBITMAP *lpAddBmp
|
||||
info.nButtons = count;
|
||||
info.hInst = lpAddBmp->hInst;
|
||||
info.nID = lpAddBmp->nID;
|
||||
TRACE("adding %d bitmaps!\n", info.nButtons);
|
||||
TRACE("adding %d bitmaps\n", info.nButtons);
|
||||
}
|
||||
|
||||
/* check if the bitmap is already loaded and compute iSumButtons */
|
||||
@ -2980,7 +2984,7 @@ TOOLBAR_AddBitmap (TOOLBAR_INFO *infoPtr, INT count, const TBADDBITMAP *lpAddBmp
|
||||
|
||||
if (!infoPtr->cimlDef) {
|
||||
/* create new default image list */
|
||||
TRACE ("creating default image list!\n");
|
||||
TRACE ("creating default image list\n");
|
||||
|
||||
himlDef = ImageList_Create (infoPtr->nBitmapWidth, infoPtr->nBitmapHeight,
|
||||
ILC_COLOR32 | ILC_MASK, info.nButtons, 2);
|
||||
@ -3013,7 +3017,7 @@ TOOLBAR_AddBitmap (TOOLBAR_INFO *infoPtr, INT count, const TBADDBITMAP *lpAddBmp
|
||||
static LRESULT
|
||||
TOOLBAR_AddButtonsT(TOOLBAR_INFO *infoPtr, INT nAddButtons, const TBBUTTON* lpTbb, BOOL fUnicode)
|
||||
{
|
||||
TRACE("adding %d buttons (unicode=%d)!\n", nAddButtons, fUnicode);
|
||||
TRACE("adding %d buttons (unicode=%d)\n", nAddButtons, fUnicode);
|
||||
|
||||
return TOOLBAR_InternalInsertButtonsT(infoPtr, -1, nAddButtons, lpTbb, fUnicode);
|
||||
}
|
||||
@ -3139,7 +3143,7 @@ TOOLBAR_AddStringA (TOOLBAR_INFO *infoPtr, HINSTANCE hInstance, LPARAM lParam)
|
||||
static LRESULT
|
||||
TOOLBAR_AutoSize (TOOLBAR_INFO *infoPtr)
|
||||
{
|
||||
TRACE("auto sizing, style=%x!\n", infoPtr->dwStyle);
|
||||
TRACE("auto sizing, style=%#x\n", infoPtr->dwStyle);
|
||||
TRACE("nRows: %d, infoPtr->nButtonHeight: %d\n", infoPtr->nRows, infoPtr->nButtonHeight);
|
||||
|
||||
if (!(infoPtr->dwStyle & CCS_NORESIZE))
|
||||
@ -3336,7 +3340,7 @@ TOOLBAR_DeleteButton (TOOLBAR_INFO *infoPtr, INT nIndex)
|
||||
TOOLBAR_TooltipDelTool(infoPtr, &infoPtr->buttons[nIndex]);
|
||||
|
||||
if (infoPtr->nNumButtons == 1) {
|
||||
TRACE(" simple delete!\n");
|
||||
TRACE(" simple delete\n");
|
||||
free_string( infoPtr->buttons );
|
||||
Free (infoPtr->buttons);
|
||||
infoPtr->buttons = NULL;
|
||||
@ -3344,7 +3348,7 @@ TOOLBAR_DeleteButton (TOOLBAR_INFO *infoPtr, INT nIndex)
|
||||
}
|
||||
else {
|
||||
TBUTTON_INFO *oldButtons = infoPtr->buttons;
|
||||
TRACE("complex delete! [nIndex=%d]\n", nIndex);
|
||||
TRACE("complex delete [nIndex=%d]\n", nIndex);
|
||||
|
||||
infoPtr->nNumButtons--;
|
||||
infoPtr->buttons = Alloc (sizeof (TBUTTON_INFO) * infoPtr->nNumButtons);
|
||||
@ -4660,7 +4664,7 @@ TOOLBAR_SetCmdId (TOOLBAR_INFO *infoPtr, INT nIndex, INT nId)
|
||||
|
||||
if (infoPtr->hwndToolTip) {
|
||||
|
||||
FIXME("change tool tip!\n");
|
||||
FIXME("change tool tip\n");
|
||||
|
||||
}
|
||||
|
||||
@ -5343,7 +5347,7 @@ TOOLBAR_GetStringW (const TOOLBAR_INFO *infoPtr, WPARAM wParam, LPWSTR str)
|
||||
static LRESULT TOOLBAR_SetBoundingSize(HWND hwnd, WPARAM wParam, LPARAM lParam)
|
||||
{
|
||||
SIZE * pSize = (SIZE*)lParam;
|
||||
FIXME("hwnd=%p, wParam=0x%08lx, size.cx=%d, size.cy=%d stub!\n", hwnd, wParam, pSize->cx, pSize->cy);
|
||||
FIXME("hwnd=%p, wParam=0x%08lx, size.cx=%d, size.cy=%d stub\n", hwnd, wParam, pSize->cx, pSize->cy);
|
||||
return 0;
|
||||
}
|
||||
|
||||
@ -6596,7 +6600,7 @@ TOOLBAR_SetRedraw (TOOLBAR_INFO *infoPtr, WPARAM wParam)
|
||||
static LRESULT
|
||||
TOOLBAR_Size (TOOLBAR_INFO *infoPtr)
|
||||
{
|
||||
TRACE("sizing toolbar!\n");
|
||||
TRACE("sizing toolbar\n");
|
||||
|
||||
if (infoPtr->dwExStyle & TBSTYLE_EX_HIDECLIPPEDBUTTONS)
|
||||
{
|
||||
@ -7177,6 +7181,10 @@ static HIMAGELIST TOOLBAR_InsertImageList(PIMLENTRY **pies, INT *cies, HIMAGELIS
|
||||
/* Check if the entry already exists */
|
||||
c = TOOLBAR_GetImageListEntry(*pies, *cies, id);
|
||||
|
||||
/* Don't add new entry for NULL imagelist */
|
||||
if (!c && !himl)
|
||||
return NULL;
|
||||
|
||||
/* If this is a new entry we must create it and insert into the array */
|
||||
if (!c)
|
||||
{
|
||||
|
@ -54,7 +54,7 @@ reactos/dll/win32/browseui # Out of sync
|
||||
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.9
|
||||
reactos/dll/win32/comctl32 # Synced to WineStaging-2.16
|
||||
reactos/dll/win32/comdlg32 # Synced to WineStaging-2.9
|
||||
reactos/dll/win32/compstui # Synced to WineStaging-2.9
|
||||
reactos/dll/win32/credui # Synced to WineStaging-2.9
|
||||
|
Loading…
Reference in New Issue
Block a user