XTPTaskDialogAPI.h
上传用户:szled88
上传日期:2015-04-09
资源大小:43957k
文件大小:9k
源码类别:

对话框与窗口

开发平台:

Visual C++

  1. // XTPTaskDialogAPI.h
  2. //
  3. // This file is a part of the XTREME TOOLKIT PRO MFC class library.
  4. // (c)1998-2008 Codejock Software, All Rights Reserved.
  5. //
  6. // THIS SOURCE FILE IS THE PROPERTY OF CODEJOCK SOFTWARE AND IS NOT TO BE
  7. // RE-DISTRIBUTED BY ANY MEANS WHATSOEVER WITHOUT THE EXPRESSED WRITTEN
  8. // CONSENT OF CODEJOCK SOFTWARE.
  9. //
  10. // THIS SOURCE CODE CAN ONLY BE USED UNDER THE TERMS AND CONDITIONS OUTLINED
  11. // IN THE XTREME TOOLKIT PRO LICENSE AGREEMENT. CODEJOCK SOFTWARE GRANTS TO
  12. // YOU (ONE SOFTWARE DEVELOPER) THE LIMITED RIGHT TO USE THIS SOFTWARE ON A
  13. // SINGLE COMPUTER.
  14. //
  15. // CONTACT INFORMATION:
  16. // support@codejock.com
  17. // http://www.codejock.com
  18. //
  19. /////////////////////////////////////////////////////////////////////////////
  20. //{{AFX_CODEJOCK_PRIVATE
  21. #if !defined(__XTPTASKAPI_H__)
  22. #define __XTPTASKAPI_H__
  23. //}}AFX_CODEJOCK_PRIVATE
  24. #if _MSC_VER > 1000
  25. #pragma once
  26. #endif // _MSC_VER > 1000
  27. class CXTPMarkupUIElement;
  28. class CXTPMarkupContext;
  29. //{{AFX_CODEJOCK_PRIVATE
  30. namespace XTPTaskDialogAPI
  31. {
  32. #ifndef PBST_NORMAL
  33. #define PBST_NORMAL 0x0001
  34. #endif
  35. #ifndef PBST_ERROR
  36. #define PBST_ERROR  0x0002
  37. #endif
  38. #ifndef PBST_PAUSED
  39. #define PBST_PAUSED 0x0003
  40. #endif
  41. #ifndef IS_INTRESOURCE
  42. #define IS_INTRESOURCE(x) (((size_t)(x) >> 16) == 0)
  43. #endif
  44. // Check if TaskDialog already included in comctrl.h.
  45. #ifndef TD_WARNING_ICON
  46. #pragma pack(push,1)
  47. typedef HRESULT (CALLBACK *PFTASKDIALOGCALLBACK)(HWND hwnd, UINT msg, WPARAM wParam, LPARAM lParam, LONG_PTR lpRefData);
  48. enum _TASKDIALOG_FLAGS
  49. {
  50. TDF_ENABLE_HYPERLINKS               = 0x0001,
  51. TDF_USE_HICON_MAIN                  = 0x0002,
  52. TDF_USE_HICON_FOOTER                = 0x0004,
  53. TDF_ALLOW_DIALOG_CANCELLATION       = 0x0008,
  54. TDF_USE_COMMAND_LINKS               = 0x0010,
  55. TDF_USE_COMMAND_LINKS_NO_ICON       = 0x0020,
  56. TDF_EXPAND_FOOTER_AREA              = 0x0040,
  57. TDF_EXPANDED_BY_DEFAULT             = 0x0080,
  58. TDF_VERIFICATION_FLAG_CHECKED       = 0x0100,
  59. TDF_SHOW_PROGRESS_BAR               = 0x0200,
  60. TDF_SHOW_MARQUEE_PROGRESS_BAR       = 0x0400,
  61. TDF_CALLBACK_TIMER                  = 0x0800,
  62. TDF_POSITION_RELATIVE_TO_WINDOW     = 0x1000,
  63. TDF_RTL_LAYOUT                      = 0x2000,
  64. TDF_NO_DEFAULT_RADIO_BUTTON         = 0x4000,
  65. TDF_CAN_BE_MINIMIZED                = 0x8000
  66. };
  67. typedef int TASKDIALOG_FLAGS;                         // Note: _TASKDIALOG_FLAGS is an int
  68. typedef enum _TASKDIALOG_MESSAGES
  69. {
  70. TDM_NAVIGATE_PAGE                   = WM_USER+101,
  71. TDM_CLICK_BUTTON                    = WM_USER+102, // wParam = Button ID
  72. TDM_SET_MARQUEE_PROGRESS_BAR        = WM_USER+103, // wParam = 0 (nonMarque) wParam != 0 (Marquee)
  73. TDM_SET_PROGRESS_BAR_STATE          = WM_USER+104, // wParam = new progress state
  74. TDM_SET_PROGRESS_BAR_RANGE          = WM_USER+105, // lParam = MAKELPARAM(nMinRange, nMaxRange)
  75. TDM_SET_PROGRESS_BAR_POS            = WM_USER+106, // wParam = new position
  76. TDM_SET_PROGRESS_BAR_MARQUEE        = WM_USER+107, // wParam = 0 (stop marquee), wParam != 0 (start marquee), lparam = speed (milliseconds between repaints)
  77. TDM_SET_ELEMENT_TEXT                = WM_USER+108, // wParam = element (TASKDIALOG_ELEMENTS), lParam = new element text (LPCWSTR)
  78. TDM_CLICK_RADIO_BUTTON              = WM_USER+110, // wParam = Radio Button ID
  79. TDM_ENABLE_BUTTON                   = WM_USER+111, // lParam = 0 (disable), lParam != 0 (enable), wParam = Button ID
  80. TDM_ENABLE_RADIO_BUTTON             = WM_USER+112, // lParam = 0 (disable), lParam != 0 (enable), wParam = Radio Button ID
  81. TDM_CLICK_VERIFICATION              = WM_USER+113, // wParam = 0 (unchecked), 1 (checked), lParam = 1 (set key focus)
  82. TDM_UPDATE_ELEMENT_TEXT             = WM_USER+114, // wParam = element (TASKDIALOG_ELEMENTS), lParam = new element text (LPCWSTR)
  83. TDM_SET_BUTTON_ELEVATION_REQUIRED_STATE = WM_USER+115, // wParam = Button ID, lParam = 0 (elevation not required), lParam != 0 (elevation required)
  84. TDM_UPDATE_ICON                     = WM_USER+116  // wParam = icon element (TASKDIALOG_ICON_ELEMENTS), lParam = new icon (hIcon if TDF_USE_HICON_* was set, PCWSTR otherwise)
  85. } TASKDIALOG_MESSAGES;
  86. typedef enum _TASKDIALOG_NOTIFICATIONS
  87. {
  88. TDN_CREATED                         = 0,
  89. TDN_NAVIGATED                       = 1,
  90. TDN_BUTTON_CLICKED                  = 2,            // wParam = Button ID
  91. TDN_HYPERLINK_CLICKED               = 3,            // lParam = (LPCWSTR)pszHREF
  92. TDN_TIMER                           = 4,            // wParam = Milliseconds since dialog created or timer reset
  93. TDN_DESTROYED                       = 5,
  94. TDN_RADIO_BUTTON_CLICKED            = 6,            // wParam = Radio Button ID
  95. TDN_DIALOG_CONSTRUCTED              = 7,
  96. TDN_VERIFICATION_CLICKED            = 8,             // wParam = 1 if checkbox checked, 0 if not, lParam is unused and always 0
  97. TDN_HELP                            = 9,
  98. TDN_EXPANDO_BUTTON_CLICKED          = 10            // wParam = 0 (dialog is now collapsed), wParam != 0 (dialog is now expanded)
  99. } TASKDIALOG_NOTIFICATIONS;
  100. typedef struct _TASKDIALOG_BUTTON
  101. {
  102. int     nButtonID;
  103. PCWSTR  pszButtonText;
  104. } TASKDIALOG_BUTTON;
  105. typedef enum _TASKDIALOG_ELEMENTS
  106. {
  107. TDE_CONTENT,
  108. TDE_EXPANDED_INFORMATION,
  109. TDE_FOOTER,
  110. TDE_MAIN_INSTRUCTION,
  111. } TASKDIALOG_ELEMENTS;
  112. typedef enum _TASKDIALOG_ICON_ELEMENTS
  113. {
  114. TDIE_ICON_MAIN,
  115. TDIE_ICON_FOOTER
  116. } TASKDIALOG_ICON_ELEMENTS;
  117. #define TD_WARNING_ICON         MAKEINTRESOURCEW(-1)
  118. #define TD_ERROR_ICON           MAKEINTRESOURCEW(-2)
  119. #define TD_INFORMATION_ICON     MAKEINTRESOURCEW(-3)
  120. #define TD_SHIELD_ICON          MAKEINTRESOURCEW(-4)
  121. enum _TASKDIALOG_COMMON_BUTTON_FLAGS
  122. {
  123. TDCBF_OK_BUTTON            = 0x0001, // selected control return value IDOK
  124. TDCBF_YES_BUTTON           = 0x0002, // selected control return value IDYES
  125. TDCBF_NO_BUTTON            = 0x0004, // selected control return value IDNO
  126. TDCBF_CANCEL_BUTTON        = 0x0008, // selected control return value IDCANCEL
  127. TDCBF_RETRY_BUTTON         = 0x0010, // selected control return value IDRETRY
  128. TDCBF_CLOSE_BUTTON         = 0x0020  // selected control return value IDCLOSE
  129. };
  130. typedef int TASKDIALOG_COMMON_BUTTON_FLAGS;           // Note: _TASKDIALOG_COMMON_BUTTON_FLAGS is an int
  131. typedef struct _TASKDIALOGCONFIG
  132. {
  133. UINT        cbSize;
  134. HWND        hwndParent;
  135. HINSTANCE   hInstance;                              // used for MAKEINTRESOURCE() strings
  136. TASKDIALOG_FLAGS                dwFlags;            // TASKDIALOG_FLAGS (TDF_XXX) flags
  137. TASKDIALOG_COMMON_BUTTON_FLAGS  dwCommonButtons;    // TASKDIALOG_COMMON_BUTTON (TDCBF_XXX) flags
  138. PCWSTR      pszWindowTitle;                         // string or MAKEINTRESOURCE()
  139. union
  140. {
  141. HICON   hMainIcon;
  142. PCWSTR  pszMainIcon;
  143. };
  144. PCWSTR      pszMainInstruction;
  145. PCWSTR      pszContent;
  146. UINT        cButtons;
  147. const TASKDIALOG_BUTTON  *pButtons;
  148. int         nDefaultButton;
  149. UINT        cRadioButtons;
  150. const TASKDIALOG_BUTTON  *pRadioButtons;
  151. int         nDefaultRadioButton;
  152. PCWSTR      pszVerificationText;
  153. PCWSTR      pszExpandedInformation;
  154. PCWSTR      pszExpandedControlText;
  155. PCWSTR      pszCollapsedControlText;
  156. union
  157. {
  158. HICON   hFooterIcon;
  159. PCWSTR  pszFooterIcon;
  160. };
  161. PCWSTR      pszFooter;
  162. PFTASKDIALOGCALLBACK pfCallback;
  163. LONG_PTR    lpCallbackData;
  164. UINT        cxWidth;                                // width of the Task Dialog's client area in DLU's. If 0, Task Dialog will calculate the ideal width.
  165. } TASKDIALOGCONFIG;
  166. #pragma pack(pop)
  167. #endif
  168. //}}AFX_CODEJOCK_PRIVATE
  169. _XTP_EXT_CLASS int AFXAPI XTPLoadStringInst(HINSTANCE hInstance, UINT nID, CString* pString);
  170. _XTP_EXT_CLASS CPoint AFXAPI XTPDlu2Pix(int dluX, int dluY);
  171. _XTP_EXT_CLASS CPoint AFXAPI XTPPix2Dlu(int pixX, int pixY);
  172. _XTP_EXT_CLASS BOOL AFXAPI XTPCalcTextSize(const CString& strText, CSize& pSizeText, CFont& font, BOOL* pbWordWrap = NULL);
  173. _XTP_EXT_CLASS BOOL AFXAPI XTPCalcIdealTextSize(const CString& strText, CSize& pSizeText, CFont& font, int dluMax = 330, int dluGrow = 7);
  174. _XTP_EXT_CLASS BOOL AFXAPI XTPCalcIdealTextSize(CXTPMarkupContext* pMarkupContext, CXTPMarkupUIElement* pUIElement, CSize& pSizeText, CFont& font, int dluMax = 330, int dluGrow = 7);
  175. _XTP_EXT_CLASS CString AFXAPI XTPExtractSubString(CString strFullString, int iSubString);
  176. _XTP_EXT_CLASS CRect AFXAPI XTPSize2Rect(CSize size);
  177. }
  178. using namespace XTPTaskDialogAPI;
  179. /////////////////////////////////////////////////////////////////////////////
  180. //{{AFX_INSERT_LOCATION}}
  181. // Microsoft Visual C++ will insert additional declarations immediately before the previous line.
  182. #endif // !defined(__XTPTASKAPI_H__)