ReactOS  0.4.15-dev-1171-gab82533
taskdialog.c File Reference
#include <stdarg.h>
#include <stdlib.h>
#include <string.h>
#include "windef.h"
#include "winbase.h"
#include "wingdi.h"
#include "winuser.h"
#include "commctrl.h"
#include "winerror.h"
#include "comctl32.h"
#include "wine/debug.h"
#include "wine/list.h"
#include "wine/unicode.h"
Include dependency graph for taskdialog.c:

Go to the source code of this file.

Classes

struct  taskdialog_control
 
struct  taskdialog_button_desc
 
struct  taskdialog_template_desc
 
struct  taskdialog_info
 

Macros

#define NONAMELESSUNION
 
#define ALIGNED_LENGTH(_Len, _Align)   (((_Len)+(_Align))&~(_Align))
 
#define ALIGNED_POINTER(_Ptr, _Align)   ((LPVOID)ALIGNED_LENGTH((ULONG_PTR)(_Ptr), _Align))
 
#define ALIGN_LENGTH(_Len, _Align)   _Len = ALIGNED_LENGTH(_Len, _Align)
 
#define ALIGN_POINTER(_Ptr, _Align)   _Ptr = ALIGNED_POINTER(_Ptr, _Align)
 
#define TASKDIALOG_INIT_COMMON_BUTTON(id)
 

Functions

 WINE_DEFAULT_DEBUG_CHANNEL (taskdialog)
 
static void pixels_to_dialogunits (const struct taskdialog_template_desc *desc, LONG *width, LONG *height)
 
static void dialogunits_to_pixels (const struct taskdialog_template_desc *desc, LONG *width, LONG *height)
 
static void template_write_data (char **ptr, const void *src, unsigned int size)
 
static void taskdialog_get_text_extent (const struct taskdialog_template_desc *desc, const WCHAR *text, BOOL user_resource, SIZE *sz)
 
static unsigned int taskdialog_add_control (struct taskdialog_template_desc *desc, WORD id, const WCHAR *class, HINSTANCE hInstance, const WCHAR *text, DWORD style, short x, short y, short cx, short cy)
 
static unsigned int taskdialog_add_static_label (struct taskdialog_template_desc *desc, WORD id, const WCHAR *str)
 
static unsigned int taskdialog_add_main_instruction (struct taskdialog_template_desc *desc)
 
static unsigned int taskdialog_add_content (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)
 
static void taskdialog_init_common_buttons (struct taskdialog_template_desc *desc, struct taskdialog_button_desc *buttons, unsigned int *button_count)
 
static unsigned int taskdialog_add_buttons (struct taskdialog_template_desc *desc)
 
static void taskdialog_clear_controls (struct list *controls)
 
static unsigned int taskdialog_get_reference_rect (const struct taskdialog_template_desc *desc, RECT *ret)
 
static WCHARtaskdialog_get_exe_name (const TASKDIALOGCONFIG *taskconfig, WCHAR *name, DWORD length)
 
static DLGTEMPLATEcreate_taskdialog_template (const TASKDIALOGCONFIG *taskconfig)
 
static HRESULT taskdialog_notify (struct taskdialog_info *dialog_info, UINT notification, WPARAM wparam, LPARAM lparam)
 
static void taskdialog_on_button_click (struct taskdialog_info *dialog_info, WORD command_id)
 
static INT_PTR CALLBACK taskdialog_proc (HWND hwnd, UINT msg, WPARAM wParam, LPARAM lParam)
 
HRESULT WINAPI TaskDialogIndirect (const TASKDIALOGCONFIG *taskconfig, int *button, int *radio_button, BOOL *verification_flag_checked)
 
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)
 

Variables

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
 
static const UINT ID_MAIN_INSTRUCTION = 0xf000
 
static const UINT ID_CONTENT = 0xf001
 

Macro Definition Documentation

◆ ALIGN_LENGTH

#define ALIGN_LENGTH (   _Len,
  _Align 
)    _Len = ALIGNED_LENGTH(_Len, _Align)

Definition at line 44 of file taskdialog.c.

◆ ALIGN_POINTER

#define ALIGN_POINTER (   _Ptr,
  _Align 
)    _Ptr = ALIGNED_POINTER(_Ptr, _Align)

Definition at line 45 of file taskdialog.c.

◆ ALIGNED_LENGTH

#define ALIGNED_LENGTH (   _Len,
  _Align 
)    (((_Len)+(_Align))&~(_Align))

Definition at line 42 of file taskdialog.c.

◆ ALIGNED_POINTER

#define ALIGNED_POINTER (   _Ptr,
  _Align 
)    ((LPVOID)ALIGNED_LENGTH((ULONG_PTR)(_Ptr), _Align))

Definition at line 43 of file taskdialog.c.

◆ NONAMELESSUNION

#define NONAMELESSUNION

Definition at line 26 of file taskdialog.c.

◆ TASKDIALOG_INIT_COMMON_BUTTON

#define TASKDIALOG_INIT_COMMON_BUTTON (   id)
Value:
do { \
taskdialog_init_button(&buttons[(*button_count)++], desc, ID##id, MAKEINTRESOURCEW(IDS_BUTTON_##id), FALSE); \
} while(0)
#define FALSE
Definition: types.h:117
static const WCHAR desc[]
Definition: protectdata.c:36
#define ID
Definition: ruserpass.c:36
HWND buttons[5]
Definition: sndrec32.cpp:40
#define MAKEINTRESOURCEW(i)
Definition: winuser.h:582

Function Documentation

◆ create_taskdialog_template()

static DLGTEMPLATE* create_taskdialog_template ( const TASKDIALOGCONFIG taskconfig)
static

Definition at line 425 of file taskdialog.c.

426 {
427  struct taskdialog_control *control, *control2;
428  unsigned int size, title_size, screen_width;
430  static const WORD fontsize = 0x7fff;
431  static const WCHAR emptyW[] = { 0 };
432  const WCHAR *titleW = NULL;
433  DLGTEMPLATE *template;
434  NONCLIENTMETRICSW ncm;
435  WCHAR pathW[MAX_PATH];
436  RECT ref_rect;
437  char *ptr;
438  HDC hdc;
439 
440  /* Window title */
444  {
447  }
448  else
450  if (!titleW)
451  titleW = emptyW;
452  title_size = (strlenW(titleW) + 1) * sizeof(WCHAR);
453 
454  size = sizeof(DLGTEMPLATE) + 2 * sizeof(WORD);
455  size += title_size;
456  size += 2; /* font size */
457 
458  list_init(&desc.controls);
459  desc.taskconfig = taskconfig;
460  desc.control_count = 0;
461 
462  ncm.cbSize = sizeof(ncm);
463  SystemParametersInfoW(SPI_GETNONCLIENTMETRICS, ncm.cbSize, &ncm, 0);
464  desc.font = CreateFontIndirectW(&ncm.lfMessageFont);
465 
466  hdc = GetDC(0);
467  SelectObject(hdc, desc.font);
468  desc.x_baseunit = GdiGetCharDimensions(hdc, NULL, &desc.y_baseunit);
469  ReleaseDC(0, hdc);
470 
471  screen_width = taskdialog_get_reference_rect(&desc, &ref_rect);
472 
473  desc.dialog_height = 0;
474  desc.dialog_width = max(taskconfig->cxWidth, DIALOG_MIN_WIDTH);
475  desc.dialog_width = min(desc.dialog_width, screen_width);
476  desc.default_button = NULL;
477 
481 
482  template = Alloc(size);
483  if (!template)
484  {
485  taskdialog_clear_controls(&desc.controls);
486  DeleteObject(desc.font);
487  return NULL;
488  }
489 
490  template->style = DS_MODALFRAME | DS_SETFONT | WS_CAPTION | WS_VISIBLE | WS_SYSMENU;
491  template->cdit = desc.control_count;
492  template->x = (ref_rect.left + ref_rect.right + desc.dialog_width) / 2;
493  template->y = (ref_rect.top + ref_rect.bottom + desc.dialog_height) / 2;
494  template->cx = desc.dialog_width;
495  template->cy = desc.dialog_height;
496 
497  ptr = (char *)(template + 1);
498  ptr += 2; /* menu */
499  ptr += 2; /* class */
500  template_write_data(&ptr, titleW, title_size);
501  template_write_data(&ptr, &fontsize, sizeof(fontsize));
502 
503  /* write control entries */
504  LIST_FOR_EACH_ENTRY_SAFE(control, control2, &desc.controls, struct taskdialog_control, entry)
505  {
506  ALIGN_POINTER(ptr, 3);
507 
508  template_write_data(&ptr, control->template, control->template_size);
509 
510  /* list item won't be needed later */
511  list_remove(&control->entry);
512  Free(control->template);
513  Free(control);
514  }
515 
516  DeleteObject(desc.font);
517  return template;
518 }
#define max(a, b)
Definition: svc.c:63
WINE_UNICODE_INLINE unsigned int strlenW(const WCHAR *str)
Definition: unicode.h:212
static void taskdialog_clear_controls(struct list *controls)
Definition: taskdialog.c:377
HDC WINAPI GetDC(_In_opt_ HWND)
static HDC
Definition: imagelist.c:92
LONG top
Definition: windef.h:307
HGDIOBJ WINAPI SelectObject(_In_ HDC, _In_ HGDIOBJ)
Definition: dc.c:1499
BOOL WINAPI DeleteObject(_In_ HGDIOBJ)
LONG left
Definition: windef.h:306
LONG right
Definition: windef.h:308
int WINAPI LoadStringW(_In_opt_ HINSTANCE hInstance, _In_ UINT uID, _Out_writes_to_(cchBufferMax, return+1) LPWSTR lpBuffer, _In_ int cchBufferMax)
static WCHAR * taskdialog_get_exe_name(const TASKDIALOGCONFIG *taskconfig, WCHAR *name, DWORD length)
Definition: taskdialog.c:411
_In_opt_ PALLOCATE_FUNCTION _In_opt_ PFREE_FUNCTION Free
Definition: exfuncs.h:814
static unsigned int taskdialog_add_buttons(struct taskdialog_template_desc *desc)
Definition: taskdialog.c:269
#define DS_MODALFRAME
Definition: winuser.h:375
static const UINT DIALOG_MIN_WIDTH
Definition: taskdialog.c:47
PCWSTR pszWindowTitle
Definition: commctrl.h:5200
static const WCHAR desc[]
Definition: protectdata.c:36
int WINAPI ReleaseDC(_In_opt_ HWND, _In_ HDC)
static PVOID ptr
Definition: dispmode.c:27
DLGITEMTEMPLATE * template
Definition: taskdialog.c:58
smooth NULL
Definition: ftsmooth.c:416
HFONT WINAPI CreateFontIndirectW(_In_ const LOGFONTW *)
struct list entry
Definition: taskdialog.c:57
static unsigned int taskdialog_get_reference_rect(const struct taskdialog_template_desc *desc, RECT *ret)
Definition: taskdialog.c:389
#define WS_CAPTION
Definition: pedump.c:624
BOOL WINAPI SystemParametersInfoW(_In_ UINT, _In_ UINT, _Inout_opt_ PVOID, _In_ UINT)
__WINE_SERVER_LIST_INLINE void list_remove(struct list *elem)
Definition: list.h:108
GLsizeiptr size
Definition: glext.h:5919
#define IS_INTRESOURCE(i)
Definition: winuser.h:580
static void template_write_data(char **ptr, const void *src, unsigned int size)
Definition: taskdialog.c:107
__wchar_t WCHAR
Definition: xmlstorage.h:180
#define MAX_PATH
Definition: compat.h:34
PVOID Alloc(IN DWORD dwFlags, IN SIZE_T dwBytes)
Definition: main.c:63
static const WCHAR titleW[]
Definition: htmlelem.c:1067
unsigned short WORD
Definition: ntddk_ex.h:93
#define ALIGN_POINTER(_Ptr, _Align)
Definition: taskdialog.c:45
HDC hdc
Definition: main.c:9
#define DS_SETFONT
Definition: winuser.h:378
uint32_t entry
Definition: isohybrid.c:63
static unsigned int taskdialog_add_main_instruction(struct taskdialog_template_desc *desc)
Definition: taskdialog.c:216
static unsigned int taskdialog_add_content(struct taskdialog_template_desc *desc)
Definition: taskdialog.c:221
unsigned int template_size
Definition: taskdialog.c:59
LONG WINAPI GdiGetCharDimensions(HDC, LPTEXTMETRICW, LONG *)
Definition: font.c:2145
HINSTANCE hInstance
Definition: commctrl.h:5197
#define LIST_FOR_EACH_ENTRY_SAFE(cursor, cursor2, list, type, field)
Definition: list.h:204
static const WCHAR emptyW[]
Definition: navigate.c:40
#define ARRAY_SIZE(a)
Definition: main.h:24
#define min(a, b)
Definition: monoChain.cc:55
__WINE_SERVER_LIST_INLINE void list_init(struct list *list)
Definition: list.h:149
LONG bottom
Definition: windef.h:309
const TASKDIALOGCONFIG * taskconfig
Definition: taskdialog.c:73
#define WS_VISIBLE
Definition: pedump.c:620
#define WS_SYSMENU
Definition: pedump.c:629
#define LOWORD(l)
Definition: pedump.c:82

Referenced by TaskDialogIndirect().

◆ dialogunits_to_pixels()

static void dialogunits_to_pixels ( const struct taskdialog_template_desc desc,
LONG width,
LONG height 
)
static

Definition at line 99 of file taskdialog.c.

100 {
101  if (width)
102  *width = MulDiv(*width, desc->x_baseunit, 4);
103  if (height)
104  *height = MulDiv(*height, desc->y_baseunit, 8);
105 }
GLint GLint GLsizei width
Definition: gl.h:1546
static const WCHAR desc[]
Definition: protectdata.c:36
GLint GLint GLsizei GLsizei height
Definition: gl.h:1546
#define MulDiv(x, y, z)
Definition: gdifloat.h:86

Referenced by taskdialog_get_text_extent().

◆ pixels_to_dialogunits()

static void pixels_to_dialogunits ( const struct taskdialog_template_desc desc,
LONG width,
LONG height 
)
static

Definition at line 91 of file taskdialog.c.

92 {
93  if (width)
94  *width = MulDiv(*width, 4, desc->x_baseunit);
95  if (height)
96  *height = MulDiv(*height, 8, desc->y_baseunit);
97 }
GLint GLint GLsizei width
Definition: gl.h:1546
static const WCHAR desc[]
Definition: protectdata.c:36
GLint GLint GLsizei GLsizei height
Definition: gl.h:1546
#define MulDiv(x, y, z)
Definition: gdifloat.h:86

Referenced by taskdialog_get_reference_rect(), and taskdialog_get_text_extent().

◆ TaskDialog()

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 
)

Definition at line 605 of file taskdialog.c.

607 {
609 
610  TRACE("%p, %p, %s, %s, %s, %#x, %s, %p\n", owner, hinst, debugstr_w(title), debugstr_w(main_instruction),
611  debugstr_w(content), common_buttons, debugstr_w(icon), button);
612 
613  memset(&taskconfig, 0, sizeof(taskconfig));
614  taskconfig.cbSize = sizeof(taskconfig);
615  taskconfig.hwndParent = owner;
617  taskconfig.dwCommonButtons = common_buttons;
619  taskconfig.u.pszMainIcon = icon;
620  taskconfig.pszMainInstruction = main_instruction;
623 }
PCWSTR pszMainIcon
Definition: commctrl.h:5204
DWORD button
Definition: button.c:166
HRESULT WINAPI TaskDialogIndirect(const TASKDIALOGCONFIG *taskconfig, int *button, int *radio_button, BOOL *verification_flag_checked)
Definition: taskdialog.c:575
PCWSTR pszWindowTitle
Definition: commctrl.h:5200
#define debugstr_w
Definition: kernel32.h:32
content
Definition: atl_ax.c:993
smooth NULL
Definition: ftsmooth.c:416
#define TRACE(s)
Definition: solgame.cpp:4
HINSTANCE hInstance
Definition: commctrl.h:5197
PCWSTR pszMainInstruction
Definition: commctrl.h:5206
TASKDIALOG_COMMON_BUTTON_FLAGS dwCommonButtons
Definition: commctrl.h:5199
static HINSTANCE hinst
Definition: edit.c:551
const TASKDIALOGCONFIG * taskconfig
Definition: taskdialog.c:73
#define memset(x, y, z)
Definition: compat.h:39
static char title[]
Definition: ps.c:92

◆ taskdialog_add_buttons()

static unsigned int taskdialog_add_buttons ( struct taskdialog_template_desc desc)
static

Definition at line 269 of file taskdialog.c.

270 {
271  unsigned int count = 0, buttons_size, i, line_count, size = 0;
272  unsigned int location_x, *line_widths, alignment = ~0u;
273  const TASKDIALOGCONFIG *taskconfig = desc->taskconfig;
275 
276  /* Allocate enough memory for the custom and the default buttons. Maximum 6 default buttons possible. */
277  buttons_size = 6;
278  if (taskconfig->cButtons && taskconfig->pButtons)
279  buttons_size += taskconfig->cButtons;
280 
281  if (!(buttons = Alloc(buttons_size * sizeof(*buttons))))
282  return 0;
283 
284  /* Custom buttons */
285  if (taskconfig->cButtons && taskconfig->pButtons)
286  for (i = 0; i < taskconfig->cButtons; i++)
288  taskconfig->pButtons[i].pszButtonText, TRUE);
289 
290  /* Common buttons */
292 
293  /* There must be at least one button */
294  if (count == 0)
296 
297  if (!desc->default_button)
298  desc->default_button = &buttons[0];
299 
300  /* For easy handling just allocate as many lines as buttons, the worst case. */
301  line_widths = Alloc(count * sizeof(*line_widths));
302 
303  /* Separate buttons into lines */
304  location_x = DIALOG_SPACING;
305  for (i = 0, line_count = 0; i < count; i++)
306  {
307  if (location_x + buttons[i].width + DIALOG_SPACING > desc->dialog_width)
308  {
309  location_x = DIALOG_SPACING;
310  line_count++;
311  }
312 
313  buttons[i].line = line_count;
314 
315  location_x += buttons[i].width + DIALOG_SPACING;
316  line_widths[line_count] += buttons[i].width + DIALOG_SPACING;
317  }
318  line_count++;
319 
320  /* Try to balance lines so they are about the same size */
321  for (i = 1; i < line_count - 1; i++)
322  {
323  int diff_now = abs(line_widths[i] - line_widths[i - 1]);
324  unsigned int j, last_button = 0;
325  int diff_changed;
326 
327  for (j = 0; j < count; j++)
328  if (buttons[j].line == i - 1)
329  last_button = j;
330 
331  /* Difference in length of both lines if we wrapped the last button from the last line into this one */
332  diff_changed = abs(2 * buttons[last_button].width + line_widths[i] - line_widths[i - 1]);
333 
334  if (diff_changed < diff_now)
335  {
336  buttons[last_button].line = i;
337  line_widths[i] += buttons[last_button].width;
338  line_widths[i - 1] -= buttons[last_button].width;
339  }
340  }
341 
342  /* Calculate left alignment so all lines are as far right as possible. */
343  for (i = 0; i < line_count; i++)
344  {
345  int new_alignment = desc->dialog_width - line_widths[i];
346  if (new_alignment < alignment)
347  alignment = new_alignment;
348  }
349 
350  /* Now that we got them all positioned, create all buttons */
351  location_x = alignment;
352  for (i = 0; i < count; i++)
353  {
354  DWORD style = &buttons[i] == desc->default_button ? BS_DEFPUSHBUTTON : BS_PUSHBUTTON;
355 
356  if (i > 0 && buttons[i].line != buttons[i - 1].line) /* New line */
357  {
358  location_x = alignment;
359  desc->dialog_height += DIALOG_BUTTON_HEIGHT + DIALOG_SPACING;
360  }
361 
363  location_x, desc->dialog_height, buttons[i].width, DIALOG_BUTTON_HEIGHT);
364 
365  location_x += buttons[i].width + DIALOG_SPACING;
366  }
367 
368  /* Add height for last row and spacing */
369  desc->dialog_height += DIALOG_BUTTON_HEIGHT + DIALOG_SPACING;
370 
371  Free(line_widths);
372  Free(buttons);
373 
374  return size;
375 }
GLsizei GLenum const GLvoid GLsizei GLenum GLbyte GLbyte GLbyte GLdouble GLdouble GLdouble GLfloat GLfloat GLfloat GLint GLint GLint GLshort GLshort GLshort GLubyte GLubyte GLubyte GLuint GLuint GLuint GLushort GLushort GLushort GLbyte GLbyte GLbyte GLbyte GLdouble GLdouble GLdouble GLdouble GLfloat GLfloat GLfloat GLfloat GLint GLint GLint GLint GLshort GLshort GLshort GLshort GLubyte GLubyte GLubyte GLubyte GLuint GLuint GLuint GLuint GLushort GLushort GLushort GLushort GLboolean const GLdouble const GLfloat const GLint const GLshort const GLbyte const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLdouble const GLfloat const GLfloat const GLint const GLint const GLshort const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort GLenum GLenum GLenum GLfloat GLenum GLint GLenum GLenum GLenum GLfloat GLenum GLenum GLint GLenum GLfloat GLenum GLint GLint GLushort GLenum GLenum GLfloat GLenum GLenum GLint GLfloat const GLubyte GLenum GLenum GLenum const GLfloat GLenum GLenum const GLint GLenum GLint GLint GLsizei GLsizei GLint GLenum GLenum const GLvoid GLenum GLenum const GLfloat GLenum GLenum const GLint GLenum GLenum const GLdouble GLenum GLenum const GLfloat GLenum GLenum const GLint GLsizei GLuint GLfloat GLuint GLbitfield GLfloat GLint GLuint GLboolean GLenum GLfloat GLenum GLbitfield GLenum GLfloat GLfloat GLint GLint const GLfloat GLenum GLfloat GLfloat GLint GLint GLfloat GLfloat GLint GLint const GLfloat GLint GLfloat GLfloat GLint GLfloat GLfloat GLint GLfloat GLfloat const GLdouble * u
Definition: glfuncs.h:240
#define abs(i)
Definition: fconv.c:206
GLint GLint GLsizei width
Definition: gl.h:1546
#define IDOK
Definition: winuser.h:824
#define TRUE
Definition: types.h:120
const WCHAR * text
Definition: package.c:1827
GLuint GLuint GLsizei count
Definition: gl.h:1545
#define BS_DEFPUSHBUTTON
Definition: pedump.c:652
static void taskdialog_init_button(struct taskdialog_button_desc *button, struct taskdialog_template_desc *desc, int id, const WCHAR *text, BOOL custom_button)
Definition: taskdialog.c:226
PCWSTR pszButtonText
Definition: commctrl.h:5182
_In_opt_ PALLOCATE_FUNCTION _In_opt_ PFREE_FUNCTION Free
Definition: exfuncs.h:814
GLsizei GLenum const GLvoid GLsizei GLenum GLbyte GLbyte GLbyte GLdouble GLdouble GLdouble GLfloat GLfloat GLfloat GLint GLint GLint GLshort GLshort GLshort GLubyte GLubyte GLubyte GLuint GLuint GLuint GLushort GLushort GLushort GLbyte GLbyte GLbyte GLbyte GLdouble GLdouble GLdouble GLdouble GLfloat GLfloat GLfloat GLfloat GLint GLint GLint GLint GLshort GLshort GLshort GLshort GLubyte GLubyte GLubyte GLubyte GLuint GLuint GLuint GLuint GLushort GLushort GLushort GLushort GLboolean const GLdouble const GLfloat const GLint const GLshort const GLbyte const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLdouble const GLfloat const GLfloat const GLint const GLint const GLshort const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort GLenum GLenum GLenum GLfloat GLenum GLint GLenum GLenum GLenum GLfloat GLenum GLenum GLint GLenum GLfloat GLenum GLint GLint GLushort GLenum GLenum GLfloat GLenum GLenum GLint GLfloat const GLubyte GLenum GLenum GLenum const GLfloat GLenum GLenum const GLint GLenum GLint GLint GLsizei GLsizei GLint GLenum GLenum const GLvoid GLenum GLenum const GLfloat GLenum GLenum const GLint GLenum GLenum const GLdouble GLenum GLenum const GLfloat GLenum GLenum const GLint GLsizei GLuint GLfloat GLuint GLbitfield GLfloat GLint GLuint GLboolean GLenum GLfloat GLenum GLbitfield GLenum GLfloat GLfloat GLint GLint const GLfloat GLenum GLfloat GLfloat GLint GLint GLfloat GLfloat GLint GLint const GLfloat GLint GLfloat GLfloat GLint GLfloat GLfloat GLint GLfloat GLfloat const GLdouble const GLfloat const GLdouble const GLfloat GLint i
Definition: glfuncs.h:248
#define FALSE
Definition: types.h:117
static const WCHAR desc[]
Definition: protectdata.c:36
static const UINT DIALOG_SPACING
Definition: taskdialog.c:48
Definition: parser.c:48
GLsizei GLenum const GLvoid GLsizei GLenum GLbyte GLbyte GLbyte GLdouble GLdouble GLdouble GLfloat GLfloat GLfloat GLint GLint GLint GLshort GLshort GLshort GLubyte GLubyte GLubyte GLuint GLuint GLuint GLushort GLushort GLushort GLbyte GLbyte GLbyte GLbyte GLdouble GLdouble GLdouble GLdouble GLfloat GLfloat GLfloat GLfloat GLint GLint GLint GLint GLshort GLshort GLshort GLshort GLubyte GLubyte GLubyte GLubyte GLuint GLuint GLuint GLuint GLushort GLushort GLushort GLushort GLboolean const GLdouble const GLfloat const GLint const GLshort const GLbyte const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLdouble const GLfloat const GLfloat const GLint const GLint const GLshort const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort GLenum GLenum GLenum GLfloat GLenum GLint GLenum GLenum GLenum GLfloat GLenum GLenum GLint GLenum GLfloat GLenum GLint GLint GLushort GLenum GLenum GLfloat GLenum GLenum GLint GLfloat const GLubyte GLenum GLenum GLenum const GLfloat GLenum GLenum const GLint GLenum GLint GLint GLsizei GLsizei GLint GLenum GLenum const GLvoid GLenum GLenum const GLfloat GLenum GLenum const GLint GLenum GLenum const GLdouble GLenum GLenum const GLfloat GLenum GLenum const GLint GLsizei GLuint GLfloat GLuint GLbitfield GLfloat GLint GLuint GLboolean GLenum GLfloat GLenum GLbitfield GLenum GLfloat GLfloat GLint GLint const GLfloat GLenum GLfloat GLfloat GLint GLint GLfloat GLfloat GLint GLint const GLfloat GLint GLfloat GLfloat GLint GLfloat GLfloat GLint GLfloat GLfloat const GLdouble const GLfloat const GLdouble const GLfloat GLint GLint GLint j
Definition: glfuncs.h:250
GLsizeiptr size
Definition: glext.h:5919
PVOID Alloc(IN DWORD dwFlags, IN SIZE_T dwBytes)
Definition: main.c:63
unsigned long DWORD
Definition: ntddk_ex.h:95
#define IDS_BUTTON_OK
Definition: comctl32.h:107
#define BS_PUSHBUTTON
Definition: pedump.c:651
HWND buttons[5]
Definition: sndrec32.cpp:40
#define WC_BUTTONW
Definition: commctrl.h:4619
static HINSTANCE hinst
Definition: edit.c:551
static void taskdialog_init_common_buttons(struct taskdialog_template_desc *desc, struct taskdialog_button_desc *buttons, unsigned int *button_count)
Definition: taskdialog.c:243
const TASKDIALOGCONFIG * taskconfig
Definition: taskdialog.c:73
#define MAKEINTRESOURCEW(i)
Definition: winuser.h:582
Arabic default style
Definition: afstyles.h:93
const TASKDIALOG_BUTTON * pButtons
Definition: commctrl.h:5209
static unsigned int taskdialog_add_control(struct taskdialog_template_desc *desc, WORD id, const WCHAR *class, HINSTANCE hInstance, const WCHAR *text, DWORD style, short x, short y, short cx, short cy)
Definition: taskdialog.c:154
static const UINT DIALOG_BUTTON_HEIGHT
Definition: taskdialog.c:50

Referenced by create_taskdialog_template().

◆ taskdialog_add_content()

static unsigned int taskdialog_add_content ( struct taskdialog_template_desc desc)
static

Definition at line 221 of file taskdialog.c.

222 {
223  return taskdialog_add_static_label(desc, ID_CONTENT, desc->taskconfig->pszContent);
224 }
static const WCHAR desc[]
Definition: protectdata.c:36
static const UINT ID_CONTENT
Definition: taskdialog.c:53
static unsigned int taskdialog_add_static_label(struct taskdialog_template_desc *desc, WORD id, const WCHAR *str)
Definition: taskdialog.c:199

Referenced by create_taskdialog_template().

◆ taskdialog_add_control()

static unsigned int taskdialog_add_control ( struct taskdialog_template_desc desc,
WORD  id,
const WCHAR class,
HINSTANCE  hInstance,
const WCHAR text,
DWORD  style,
short  x,
short  y,
short  cx,
short  cy 
)
static

Definition at line 154 of file taskdialog.c.

156 {
157  struct taskdialog_control *control = Alloc(sizeof(*control));
158  unsigned int size, class_size, text_size;
159  DLGITEMTEMPLATE *template;
160  static const WCHAR nulW;
161  const WCHAR *textW;
162  char *ptr;
163 
164  class_size = (strlenW(class) + 1) * sizeof(WCHAR);
165 
166  if (IS_INTRESOURCE(text))
167  text_size = LoadStringW(hInstance, (UINT_PTR)text, (WCHAR *)&textW, 0) * sizeof(WCHAR);
168  else
169  {
170  textW = text;
171  text_size = strlenW(textW) * sizeof(WCHAR);
172  }
173 
174  size = sizeof(DLGITEMTEMPLATE);
175  size += class_size;
176  size += text_size + sizeof(WCHAR);
177  size += sizeof(WORD); /* creation data */
178 
179  control->template = template = Alloc(size);
180  control->template_size = size;
181 
182  template->style = WS_VISIBLE | style;
183  template->dwExtendedStyle = 0;
184  template->x = x;
185  template->y = y;
186  template->cx = cx;
187  template->cy = cy;
188  template->id = id;
189  ptr = (char *)(template + 1);
190  template_write_data(&ptr, class, class_size);
191  template_write_data(&ptr, textW, text_size);
192  template_write_data(&ptr, &nulW, sizeof(nulW));
193 
194  list_add_tail(&desc->controls, &control->entry);
195  desc->control_count++;
196  return ALIGNED_LENGTH(size, 3);
197 }
WINE_UNICODE_INLINE unsigned int strlenW(const WCHAR *str)
Definition: unicode.h:212
const WCHAR * text
Definition: package.c:1827
GLint GLint GLint GLint GLint x
Definition: gl.h:1548
int WINAPI LoadStringW(_In_opt_ HINSTANCE hInstance, _In_ UINT uID, _Out_writes_to_(cchBufferMax, return+1) LPWSTR lpBuffer, _In_ int cchBufferMax)
__WINE_SERVER_LIST_INLINE void list_add_tail(struct list *list, struct list *elem)
Definition: list.h:102
HINSTANCE hInstance
Definition: charmap.c:20
static const WCHAR desc[]
Definition: protectdata.c:36
static PVOID ptr
Definition: dispmode.c:27
DLGITEMTEMPLATE * template
Definition: taskdialog.c:58
_Out_opt_ int _Out_opt_ int * cy
Definition: commctrl.h:581
struct list entry
Definition: taskdialog.c:57
GLsizeiptr size
Definition: glext.h:5919
#define IS_INTRESOURCE(i)
Definition: winuser.h:580
static void template_write_data(char **ptr, const void *src, unsigned int size)
Definition: taskdialog.c:107
__wchar_t WCHAR
Definition: xmlstorage.h:180
PVOID Alloc(IN DWORD dwFlags, IN SIZE_T dwBytes)
Definition: main.c:63
unsigned short WORD
Definition: ntddk_ex.h:93
unsigned __int3264 UINT_PTR
Definition: mstsclib_h.h:274
#define ALIGNED_LENGTH(_Len, _Align)
Definition: taskdialog.c:42
static const WCHAR textW[]
Definition: itemdlg.c:1559
unsigned int template_size
Definition: taskdialog.c:59
GLint GLint GLint GLint GLint GLint y
Definition: gl.h:1548
_Out_opt_ int * cx
Definition: commctrl.h:581
GLenum GLuint id
Definition: glext.h:5579
Arabic default style
Definition: afstyles.h:93
#define WS_VISIBLE
Definition: pedump.c:620

Referenced by taskdialog_add_buttons(), and taskdialog_add_static_label().

◆ taskdialog_add_main_instruction()

static unsigned int taskdialog_add_main_instruction ( struct taskdialog_template_desc desc)
static

Definition at line 216 of file taskdialog.c.

217 {
218  return taskdialog_add_static_label(desc, ID_MAIN_INSTRUCTION, desc->taskconfig->pszMainInstruction);
219 }
static const WCHAR desc[]
Definition: protectdata.c:36
static const UINT ID_MAIN_INSTRUCTION
Definition: taskdialog.c:52
static unsigned int taskdialog_add_static_label(struct taskdialog_template_desc *desc, WORD id, const WCHAR *str)
Definition: taskdialog.c:199

Referenced by create_taskdialog_template().

◆ taskdialog_add_static_label()

static unsigned int taskdialog_add_static_label ( struct taskdialog_template_desc desc,
WORD  id,
const WCHAR str 
)
static

Definition at line 199 of file taskdialog.c.

200 {
201  unsigned int size;
202  SIZE sz;
203 
204  if (!str)
205  return 0;
206 
208 
209  desc->dialog_height += DIALOG_SPACING;
210  size = taskdialog_add_control(desc, id, WC_STATICW, desc->taskconfig->hInstance, str, 0, DIALOG_SPACING,
211  desc->dialog_height, sz.cx, sz.cy);
212  desc->dialog_height += sz.cy + DIALOG_SPACING;
213  return size;
214 }
static void taskdialog_get_text_extent(const struct taskdialog_template_desc *desc, const WCHAR *text, BOOL user_resource, SIZE *sz)
Definition: taskdialog.c:114
#define TRUE
Definition: types.h:120
static const WCHAR desc[]
Definition: protectdata.c:36
static const UINT DIALOG_SPACING
Definition: taskdialog.c:48
const WCHAR * str
LONG cx
Definition: windef.h:334
GLsizeiptr size
Definition: glext.h:5919
#define WC_STATICW
Definition: commctrl.h:4676
LONG cy
Definition: windef.h:335
static unsigned int taskdialog_add_control(struct taskdialog_template_desc *desc, WORD id, const WCHAR *class, HINSTANCE hInstance, const WCHAR *text, DWORD style, short x, short y, short cx, short cy)
Definition: taskdialog.c:154

Referenced by taskdialog_add_content(), and taskdialog_add_main_instruction().

◆ taskdialog_clear_controls()

static void taskdialog_clear_controls ( struct list controls)
static

Definition at line 377 of file taskdialog.c.

378 {
379  struct taskdialog_control *control, *control2;
380 
381  LIST_FOR_EACH_ENTRY_SAFE(control, control2, controls, struct taskdialog_control, entry)
382  {
383  list_remove(&control->entry);
384  Free(control->template);
385  Free(control);
386  }
387 }
_In_opt_ PALLOCATE_FUNCTION _In_opt_ PFREE_FUNCTION Free
Definition: exfuncs.h:814
DLGITEMTEMPLATE * template
Definition: taskdialog.c:58
struct list entry
Definition: taskdialog.c:57
__WINE_SERVER_LIST_INLINE void list_remove(struct list *elem)
Definition: list.h:108
uint32_t entry
Definition: isohybrid.c:63
#define LIST_FOR_EACH_ENTRY_SAFE(cursor, cursor2, list, type, field)
Definition: list.h:204

Referenced by create_taskdialog_template().

◆ taskdialog_get_exe_name()

static WCHAR* taskdialog_get_exe_name ( const TASKDIALOGCONFIG taskconfig,
WCHAR name,
DWORD  length 
)
static

Definition at line 411 of file taskdialog.c.

412 {
414  if (len && len < length)
415  {
416  WCHAR *p;
417  if ((p = strrchrW(name, '/'))) name = p + 1;
418  if ((p = strrchrW(name, '\\'))) name = p + 1;
419  return name;
420  }
421  else
422  return NULL;
423 }
DWORD WINAPI GetModuleFileNameW(HINSTANCE hModule, LPWSTR lpFilename, DWORD nSize)
Definition: loader.c:600
smooth NULL
Definition: ftsmooth.c:416
__wchar_t WCHAR
Definition: xmlstorage.h:180
GLenum GLuint GLenum GLsizei length
Definition: glext.h:5579
unsigned long DWORD
Definition: ntddk_ex.h:95
GLenum GLsizei len
Definition: glext.h:6722
WINE_UNICODE_INLINE WCHAR * strrchrW(const WCHAR *str, WCHAR ch)
Definition: unicode.h:254
Definition: name.c:38
GLfloat GLfloat p
Definition: glext.h:8902
GLuint const GLchar * name
Definition: glext.h:6031

Referenced by create_taskdialog_template().

◆ taskdialog_get_reference_rect()

static unsigned int taskdialog_get_reference_rect ( const struct taskdialog_template_desc desc,
RECT ret 
)
static

Definition at line 389 of file taskdialog.c.

390 {
391  HMONITOR monitor = MonitorFromWindow(desc->taskconfig->hwndParent ? desc->taskconfig->hwndParent : GetActiveWindow(),
392  MONITOR_DEFAULTTOPRIMARY);
394 
395  info.cbSize = sizeof(info);
396  GetMonitorInfoW(monitor, &info);
397 
398  if (desc->taskconfig->dwFlags & TDF_POSITION_RELATIVE_TO_WINDOW && desc->taskconfig->hwndParent)
399  GetWindowRect(desc->taskconfig->hwndParent, ret);
400  else
401  *ret = info.rcWork;
402 
403  pixels_to_dialogunits(desc, &ret->left, &ret->top);
404  pixels_to_dialogunits(desc, &ret->right, &ret->bottom);
405 
406  pixels_to_dialogunits(desc, &info.rcWork.left, &info.rcWork.top);
407  pixels_to_dialogunits(desc, &info.rcWork.right, &info.rcWork.bottom);
408  return info.rcWork.right - info.rcWork.left;
409 }
struct _test_info info[]
Definition: SetCursorPos.c:19
static const WCHAR desc[]
Definition: protectdata.c:36
static void pixels_to_dialogunits(const struct taskdialog_template_desc *desc, LONG *width, LONG *height)
Definition: taskdialog.c:91
BOOL WINAPI GetMonitorInfoW(_In_ HMONITOR, _Inout_ LPMONITORINFO)
int ret
HMONITOR WINAPI MonitorFromWindow(HWND, DWORD)
BOOL WINAPI GetWindowRect(_In_ HWND, _Out_ LPRECT)
HWND WINAPI GetActiveWindow(void)
Definition: winpos.c:138

Referenced by create_taskdialog_template().

◆ taskdialog_get_text_extent()

static void taskdialog_get_text_extent ( const struct taskdialog_template_desc desc,
const WCHAR text,
BOOL  user_resource,
SIZE sz 
)
static

Definition at line 114 of file taskdialog.c.

116 {
117  RECT rect = { 0, 0, desc->dialog_width - DIALOG_SPACING * 2, 0}; /* padding left and right of the control */
118  const WCHAR *textW = NULL;
119  static const WCHAR nulW;
120  unsigned int length;
121  HFONT oldfont;
122  HDC hdc;
123 
124  if (IS_INTRESOURCE(text))
125  {
126  if (!(length = LoadStringW(user_resource ? desc->taskconfig->hInstance : COMCTL32_hModule,
127  (UINT_PTR)text, (WCHAR *)&textW, 0)))
128  {
129  WARN("Failed to load text\n");
130  textW = &nulW;
131  length = 0;
132  }
133  }
134  else
135  {
136  textW = text;
137  length = strlenW(textW);
138  }
139 
140  hdc = GetDC(0);
141  oldfont = SelectObject(hdc, desc->font);
142 
145  pixels_to_dialogunits(desc, &rect.right, &rect.bottom);
146 
147  SelectObject(hdc, oldfont);
148  ReleaseDC(0, hdc);
149 
150  sz->cx = rect.right - rect.left;
151  sz->cy = rect.bottom - rect.top;
152 }
#define DT_EXPANDTABS
Definition: winuser.h:532
WINE_UNICODE_INLINE unsigned int strlenW(const WCHAR *str)
Definition: unicode.h:212
HDC WINAPI GetDC(_In_opt_ HWND)
const WCHAR * text
Definition: package.c:1827
#define DT_WORDBREAK
Definition: winuser.h:544
#define WARN(fmt,...)
Definition: debug.h:112
static HDC
Definition: imagelist.c:92
HGDIOBJ WINAPI SelectObject(_In_ HDC, _In_ HGDIOBJ)
Definition: dc.c:1499
int WINAPI LoadStringW(_In_opt_ HINSTANCE hInstance, _In_ UINT uID, _Out_writes_to_(cchBufferMax, return+1) LPWSTR lpBuffer, _In_ int cchBufferMax)
& rect
Definition: startmenu.cpp:1413
#define DT_LEFT
Definition: winuser.h:534
#define DT_CALCRECT
Definition: winuser.h:526
static void dialogunits_to_pixels(const struct taskdialog_template_desc *desc, LONG *width, LONG *height)
Definition: taskdialog.c:99
static const WCHAR desc[]
Definition: protectdata.c:36
int WINAPI ReleaseDC(_In_opt_ HWND, _In_ HDC)
static const UINT DIALOG_SPACING
Definition: taskdialog.c:48
static void pixels_to_dialogunits(const struct taskdialog_template_desc *desc, LONG *width, LONG *height)
Definition: taskdialog.c:91
smooth NULL
Definition: ftsmooth.c:416
LONG cx
Definition: windef.h:334
#define IS_INTRESOURCE(i)
Definition: winuser.h:580
__wchar_t WCHAR
Definition: xmlstorage.h:180
GLenum GLuint GLenum GLsizei length
Definition: glext.h:5579
unsigned __int3264 UINT_PTR
Definition: mstsclib_h.h:274
HDC hdc
Definition: main.c:9
static const WCHAR textW[]
Definition: itemdlg.c:1559
HMODULE COMCTL32_hModule
Definition: commctrl.c:79
static DWORD *static HFONT(WINAPI *pCreateFontIndirectExA)(const ENUMLOGFONTEXDVA *)
LONG cy
Definition: windef.h:335
INT WINAPI DrawTextW(HDC hdc, LPCWSTR str, INT count, LPRECT rect, UINT flags)
Definition: defwnd.c:17

Referenced by taskdialog_add_static_label(), and taskdialog_init_button().

◆ taskdialog_init_button()

static void taskdialog_init_button ( struct taskdialog_button_desc button,
struct taskdialog_template_desc desc,
int  id,
const WCHAR text,
BOOL  custom_button 
)
static

Definition at line 226 of file taskdialog.c.

228 {
229  SIZE sz;
230 
231  taskdialog_get_text_extent(desc, text, custom_button, &sz);
232 
233  button->id = id;
234  button->text = text;
235  button->width = max(DIALOG_BUTTON_WIDTH, sz.cx + DIALOG_SPACING * 2);
236  button->line = 0;
237  button->hinst = custom_button ? desc->taskconfig->hInstance : COMCTL32_hModule;
238 
239  if (id == desc->taskconfig->nDefaultButton)
240  desc->default_button = button;
241 }
#define max(a, b)
Definition: svc.c:63
static void taskdialog_get_text_extent(const struct taskdialog_template_desc *desc, const WCHAR *text, BOOL user_resource, SIZE *sz)
Definition: taskdialog.c:114
const WCHAR * text
Definition: package.c:1827
DWORD button
Definition: button.c:166
static const UINT DIALOG_BUTTON_WIDTH
Definition: taskdialog.c:49
static const WCHAR desc[]
Definition: protectdata.c:36
static const UINT DIALOG_SPACING
Definition: taskdialog.c:48
LONG cx
Definition: windef.h:334
HMODULE COMCTL32_hModule
Definition: commctrl.c:79
GLenum GLuint id
Definition: glext.h:5579

Referenced by taskdialog_add_buttons().

◆ taskdialog_init_common_buttons()

static void taskdialog_init_common_buttons ( struct taskdialog_template_desc desc,
struct taskdialog_button_desc buttons,
unsigned int button_count 
)
static

Definition at line 243 of file taskdialog.c.

245 {
246  DWORD flags = desc->taskconfig->dwCommonButtons;
247 
248 #define TASKDIALOG_INIT_COMMON_BUTTON(id) \
249  do { \
250  taskdialog_init_button(&buttons[(*button_count)++], desc, ID##id, MAKEINTRESOURCEW(IDS_BUTTON_##id), FALSE); \
251  } while(0)
252 
253  if (flags & TDCBF_OK_BUTTON)
255  if (flags & TDCBF_YES_BUTTON)
257  if (flags & TDCBF_NO_BUTTON)
265 
266 #undef TASKDIALOG_INIT_COMMON_BUTTON
267 }
#define TASKDIALOG_INIT_COMMON_BUTTON(id)
#define OK(condition, fail_message,...)
static const WCHAR desc[]
Definition: protectdata.c:36
unsigned long DWORD
Definition: ntddk_ex.h:95
GLbitfield flags
Definition: glext.h:7161

Referenced by taskdialog_add_buttons().

◆ taskdialog_notify()

static HRESULT taskdialog_notify ( struct taskdialog_info dialog_info,
UINT  notification,
WPARAM  wparam,
LPARAM  lparam 
)
static

Definition at line 520 of file taskdialog.c.

521 {
522  return dialog_info->callback ? dialog_info->callback(dialog_info->hwnd, notification, wparam, lparam,
523  dialog_info->callback_data) : S_OK;
524 }
LONG_PTR callback_data
Definition: taskdialog.c:88
static UINT WPARAM LPARAM lparam
Definition: combo.c:716
#define S_OK
Definition: intsafe.h:51
PFTASKDIALOGCALLBACK callback
Definition: taskdialog.c:87
static UINT WPARAM wparam
Definition: combo.c:716

Referenced by taskdialog_on_button_click(), and taskdialog_proc().

◆ taskdialog_on_button_click()

static void taskdialog_on_button_click ( struct taskdialog_info dialog_info,
WORD  command_id 
)
static

Definition at line 526 of file taskdialog.c.

527 {
528  if (taskdialog_notify(dialog_info, TDN_BUTTON_CLICKED, command_id, 0) == S_OK)
529  EndDialog(dialog_info->hwnd, command_id);
530 }
BOOL WINAPI EndDialog(_In_ HWND, _In_ INT_PTR)
static HRESULT taskdialog_notify(struct taskdialog_info *dialog_info, UINT notification, WPARAM wparam, LPARAM lparam)
Definition: taskdialog.c:520
#define S_OK
Definition: intsafe.h:51

Referenced by taskdialog_proc().

◆ taskdialog_proc()

static INT_PTR CALLBACK taskdialog_proc ( HWND  hwnd,
UINT  msg,
WPARAM  wParam,
LPARAM  lParam 
)
static

Definition at line 532 of file taskdialog.c.

533 {
534  static const WCHAR taskdialog_info_propnameW[] = {'T','a','s','k','D','i','a','l','o','g','I','n','f','o',0};
535  struct taskdialog_info *dialog_info;
536 
537  TRACE("hwnd=%p msg=0x%04x wparam=%lx lparam=%lx\n", hwnd, msg, wParam, lParam);
538 
539  if (msg != WM_INITDIALOG)
540  dialog_info = GetPropW(hwnd, taskdialog_info_propnameW);
541 
542  switch (msg)
543  {
544  case TDM_CLICK_BUTTON:
546  break;
547  case WM_INITDIALOG:
548  dialog_info = (struct taskdialog_info *)lParam;
549  dialog_info->hwnd = hwnd;
550  SetPropW(hwnd, taskdialog_info_propnameW, dialog_info);
551 
552  taskdialog_notify(dialog_info, TDN_DIALOG_CONSTRUCTED, 0, 0);
553  break;
554  case WM_SHOWWINDOW:
555  taskdialog_notify(dialog_info, TDN_CREATED, 0, 0);
556  break;
557  case WM_COMMAND:
558  if (HIWORD(wParam) == BN_CLICKED)
559  {
561  return TRUE;
562  }
563  break;
564  case WM_DESTROY:
565  taskdialog_notify(dialog_info, TDN_DESTROYED, 0, 0);
566  RemovePropW(hwnd, taskdialog_info_propnameW);
567  break;
568  }
569  return FALSE;
570 }
const DOCKBAR PVOID HWND HWND * hwnd
Definition: tooldock.h:22
#define TRUE
Definition: types.h:120
static void taskdialog_on_button_click(struct taskdialog_info *dialog_info, WORD command_id)
Definition: taskdialog.c:526
#define WM_SHOWWINDOW
Definition: winuser.h:1610
WPARAM wParam
Definition: combotst.c:138
HANDLE WINAPI RemovePropW(_In_ HWND, _In_ LPCWSTR)
#define FALSE
Definition: types.h:117
#define WM_DESTROY
Definition: winuser.h:1591
static HRESULT taskdialog_notify(struct taskdialog_info *dialog_info, UINT notification, WPARAM wparam, LPARAM lparam)
Definition: taskdialog.c:520
#define TRACE(s)
Definition: solgame.cpp:4
BOOL WINAPI SetPropW(_In_ HWND, _In_ LPCWSTR, _In_opt_ HANDLE)
__wchar_t WCHAR
Definition: xmlstorage.h:180
#define BN_CLICKED
Definition: winuser.h:1907
#define WM_COMMAND
Definition: winuser.h:1722
HANDLE WINAPI GetPropW(_In_ HWND, _In_ LPCWSTR)
#define msg(x)
Definition: auth_time.c:54
#define HIWORD(l)
Definition: typedefs.h:247
#define WM_INITDIALOG
Definition: winuser.h:1721
LPARAM lParam
Definition: combotst.c:139
#define LOWORD(l)
Definition: pedump.c:82

Referenced by TaskDialogIndirect().

◆ TaskDialogIndirect()

HRESULT WINAPI TaskDialogIndirect ( const TASKDIALOGCONFIG taskconfig,
int button,
int radio_button,
BOOL verification_flag_checked 
)

Definition at line 575 of file taskdialog.c.

577 {
578  struct taskdialog_info dialog_info;
579  DLGTEMPLATE *template;
580  INT ret;
581 
582  TRACE("%p, %p, %p, %p\n", taskconfig, button, radio_button, verification_flag_checked);
583 
584  if (!taskconfig || taskconfig->cbSize != sizeof(TASKDIALOGCONFIG))
585  return E_INVALIDARG;
586 
587  dialog_info.callback = taskconfig->pfCallback;
588  dialog_info.callback_data = taskconfig->lpCallbackData;
589 
590  template = create_taskdialog_template(taskconfig);
591  ret = (short)DialogBoxIndirectParamW(taskconfig->hInstance, template, taskconfig->hwndParent,
592  taskdialog_proc, (LPARAM)&dialog_info);
593  Free(template);
594 
595  if (button) *button = ret;
596  if (radio_button) *radio_button = taskconfig->nDefaultButton;
597  if (verification_flag_checked) *verification_flag_checked = TRUE;
598 
599  return S_OK;
600 }
#define TRUE
Definition: types.h:120
DWORD button
Definition: button.c:166
static INT_PTR CALLBACK taskdialog_proc(HWND hwnd, UINT msg, WPARAM wParam, LPARAM lParam)
Definition: taskdialog.c:532
int32_t INT
Definition: typedefs.h:58
_In_opt_ PALLOCATE_FUNCTION _In_opt_ PFREE_FUNCTION Free
Definition: exfuncs.h:814
unsigned short(__cdecl typeof(TIFFCurrentDirectory))(struct tiff *)
Definition: typeof.h:94
#define E_INVALIDARG
Definition: ddrawi.h:101
LONG_PTR LPARAM
Definition: windef.h:208
static DLGTEMPLATE * create_taskdialog_template(const TASKDIALOGCONFIG *taskconfig)
Definition: taskdialog.c:425
#define TRACE(s)
Definition: solgame.cpp:4
int ret
#define S_OK
Definition: intsafe.h:51
HINSTANCE hInstance
Definition: commctrl.h:5197
PFTASKDIALOGCALLBACK pfCallback
Definition: commctrl.h:5224
INT_PTR WINAPI DialogBoxIndirectParamW(_In_opt_ HINSTANCE, _In_ LPCDLGTEMPLATE, _In_opt_ HWND, _In_opt_ DLGPROC, _In_ LPARAM)
LONG_PTR lpCallbackData
Definition: commctrl.h:5225

Referenced by TaskDialog().

◆ template_write_data()

static void template_write_data ( char **  ptr,
const void src,
unsigned int  size 
)
static

Definition at line 107 of file taskdialog.c.

108 {
109  memcpy(*ptr, src, size);
110  *ptr += size;
111 }
static PVOID ptr
Definition: dispmode.c:27
GLsizeiptr size
Definition: glext.h:5919
#define memcpy(s1, s2, n)
Definition: mkisofs.h:878
GLenum src
Definition: glext.h:6340

Referenced by create_taskdialog_template(), and taskdialog_add_control().

◆ WINE_DEFAULT_DEBUG_CHANNEL()

WINE_DEFAULT_DEBUG_CHANNEL ( taskdialog  )

Variable Documentation

◆ DIALOG_BUTTON_HEIGHT

const UINT DIALOG_BUTTON_HEIGHT = 14
static

Definition at line 50 of file taskdialog.c.

Referenced by taskdialog_add_buttons().

◆ DIALOG_BUTTON_WIDTH

const UINT DIALOG_BUTTON_WIDTH = 50
static

Definition at line 49 of file taskdialog.c.

Referenced by taskdialog_init_button().

◆ DIALOG_MIN_WIDTH

const UINT DIALOG_MIN_WIDTH = 240
static

Definition at line 47 of file taskdialog.c.

Referenced by create_taskdialog_template().

◆ DIALOG_SPACING

◆ ID_CONTENT

const UINT ID_CONTENT = 0xf001
static

Definition at line 53 of file taskdialog.c.

Referenced by taskdialog_add_content().

◆ ID_MAIN_INSTRUCTION

const UINT ID_MAIN_INSTRUCTION = 0xf000
static

Definition at line 52 of file taskdialog.c.

Referenced by taskdialog_add_main_instruction().