aduiMessage.h 10 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269
  1. //////////////////////////////////////////////////////////////////////////////
  2. //
  3. // Copyright 2015 Autodesk, Inc. All rights reserved.
  4. //
  5. // Use of this software is subject to the terms of the Autodesk license
  6. // agreement provided at the time of installation or download, or which
  7. // otherwise accompanies this software in either electronic or hard copy form.
  8. //
  9. //////////////////////////////////////////////////////////////////////////////
  10. // DESCRIPTION
  11. //
  12. // Declarations to support AdUi registered messages.
  13. //
  14. //////////////////////////////////////////////////////////////////////////////
  15. #ifndef _aduiMessage_h
  16. #define _aduiMessage_h
  17. #pragma pack (push, 8)
  18. #pragma once
  19. /////////////////////////////////////////////////////////////////////////////
  20. // AdUi registered message
  21. //
  22. // Notifications are usually sent via SendMessage() as follows:
  23. // message set to the registered message, AdUiMessage().
  24. // wParam HIWORD is ADUI_NOTIFY code, LOWORD varies with notification
  25. // but is usually a control's ID (may be 0).
  26. // lParam usually points to notification-specific data, may be NULL.
  27. //
  28. // Handlers are expected to respond by at least returning an ADUI_REPLY,
  29. // where kAdUiReply_Nothing indicates the message was ignored, kAdUiReply_Ok
  30. // is a general-purpose acknowledgement that the notification was handled.
  31. typedef enum {
  32. // Nothing: never sent, ignore it, it's a rogue notification.
  33. kAdUiNotify_Nothing,
  34. // Generic: provided to support application-specific messaging.
  35. // Expects to process generic wParam, lParam and reply, as described above.
  36. kAdUiNotify_Generic,
  37. // Application's Main Window:
  38. // lParam points to a CWnd pointer that will receive the application's
  39. // main window.
  40. kAdUiNotify_AppMainWindow,
  41. // Application's Resource Instance:
  42. // lParam points to an HINSTANCE that will receive the handle of the
  43. // module containing the application's resources.
  44. kAdUiNotify_AppResourceInstance,
  45. // AutoLoad or Reload:
  46. // For Reload lParam is an LPCTSTR identifying a resource, for AutoLoad
  47. // lParam is 0. Reply Ok if the control is sucessfully initialized (or
  48. // re-initialized).
  49. kAdUiNotify_AutoLoad,
  50. kAdUiNotify_Reload,
  51. // GetTipSupport: request for tool-tip support.
  52. // A control receives this request to determine what kind of tool tip
  53. // should be displayed. If processed, the control responds with an
  54. // appropriate ADUI_REPLY code. lParam is a pointer to a CPoint
  55. // containing the cursor's current position on the display.
  56. kAdUiNotify_GetTipSupport,
  57. // GetTipText: request for tool-tip text.
  58. // lParam is a pointer to a CString to receive the text, initially
  59. // empty. Reply Ok, optionally setting the text. If the returned
  60. // text is empty the message is deemed to be handled and the tool
  61. // tip will be suppressed. A dialog usually sends this to a control
  62. // and if ignored, attempts to process it itself.
  63. kAdUiNotify_GetTipText,
  64. // Get Tip Placement:
  65. // lParam is a pointer to a CRect to receive display co-ordinates for
  66. // a tool-tip. Set the rectangle and reply Ok to have the control
  67. // receive DrawTip.
  68. kAdUiNotify_GetTipRect,
  69. // Query if in item rectangle related to Tip:
  70. // lParam is a pointer to a CPoint containing the cursor's current
  71. // position on the display, usually within a tip window. Return Ok if
  72. // the position is still within the visible part of the item related
  73. // to the tip. Otherwise, the sender assumes the tip can be removed.
  74. kAdUiNotify_HitTipRect,
  75. // Draw Tip:
  76. // lParam is a pointer to a CDC. The control should render tip data in
  77. // the DC.
  78. kAdUiNotify_DrawTip,
  79. // Draw Tip Text:
  80. // lParam is a pointer to a CAdUiDrawTipText. The control should set up
  81. // the DC passed in the object and possibly render the text. Returning
  82. // Ok indicates the request was fully handled, otherwise the caller
  83. // (usually a tip window) will draw the text.
  84. kAdUiNotify_DrawTipText,
  85. // Update Tip:
  86. // A control may send this to its container when the pointer moves over
  87. // the control. The container may respond by sending GetTipSupport or by
  88. // executing its normal tool-tip processing. lParam should be a pointer
  89. // to the control's CWnd.
  90. kAdUiNotify_UpdateTip,
  91. // Hide or Show window:
  92. // Sent to a dialog to hide or restore the window and it's parents.
  93. kAdUiNotify_HideWindow,
  94. kAdUiNotify_ShowWindow,
  95. // Restore focus:
  96. // wParam LOWORD is a control ID. "Smart" controls often validate their
  97. // contents on WM_KILLFOCUS. If not valid the control may want to keep
  98. // focus. Problem is that WM_KILLFOCUS is usually sent after focus has
  99. // been scheduled for some other window. A control may post this to its
  100. // container which should respond by setting focus back to the control
  101. // (assuming the container is still active).
  102. kAdUiNotify_RestoreFocus,
  103. // Content changed:
  104. // A control send this notification to its container when the control's
  105. // content has changed. The container is free to handle this as it sees
  106. // fit. The reply is usually ignored.
  107. kAdUiNotify_Change,
  108. // NotValid content:
  109. // A control send this notification to its container upon determining
  110. // that it contains non-valid data. The container is free to handle this
  111. // as it sees fit, possibly by disabling other controls (ex. OK button).
  112. // The reply is ignored.
  113. kAdUiNotify_NotValid,
  114. // Valid content:
  115. // A control send this notification to its container upon determining
  116. // that it contains valid data. The container is free to handle this as
  117. // it sees fit, possibly by enabling other controls. The reply is ignored.
  118. kAdUiNotify_Valid,
  119. // Validate: request to validate content.
  120. // A control that receives this notification should determine if it
  121. // contains valid data. If so it replies Valid, otherwise NotValid.
  122. // A container that processes this notification will usually inspect
  123. // each control. If any replies NotValid the container should reply
  124. // NotValid, and valid otherwise. Controls that handle this message do
  125. // not need to notify Valid/NotValid during processing (the reply code
  126. // is sufficient).
  127. kAdUiNotify_Validate,
  128. // Command state:
  129. // LParam is a ADUI_COMMAND_STATE code. This notification is passed to
  130. // a dialog and it's parents to inform about the state of a command in
  131. // progress in the drawing editor.
  132. kAdUiNotify_CommandState,
  133. // Modal state:
  134. // LParam is a ADUI_MODAL_STATE code. This notification is passed to
  135. // a dialog and it's parents to inform about the state of the dialog
  136. // whether it is starting or ending.
  137. kAdUiNotify_ModalState,
  138. } ADUI_NOTIFY;
  139. typedef enum {
  140. // Nothing: implies notification wasn't processed.
  141. kAdUiReply_Nothing,
  142. // Ok: implies notification has been handled.
  143. kAdUiReply_Ok,
  144. // NotValid:
  145. // Recipient of a Validate request replies that (some) content is
  146. // not valid.
  147. kAdUiReply_NotValid,
  148. // Valid:
  149. // Recipient of a Validate request replies that all content is either
  150. // valid or in an indeterminate state (assumed to be valid). In other
  151. // words, there is no content that is definitely "not valid" (yeech).
  152. kAdUiReply_Valid,
  153. // TextTip:
  154. // Recipient of a GetTipSupport request replies that a standard text-tip
  155. // should be displayed. The sender will issue a GetTipRect to position a
  156. // text tip and then send GetTipText to obtain the tip text. DrawTipText
  157. // will be sent to prepare a DC and optionally draw the tip text.
  158. kAdUiReply_TextTip,
  159. // ToolTip:
  160. // Recipient of a GetTipSupport request replies that a standard tool-tip
  161. // should be displayed. The sender will issue a GetTipText request to
  162. // obtain the tip text.
  163. kAdUiReply_ToolTip,
  164. // DrawTip:
  165. // Recipient of a GetTipSupport request replies that an owner-drawn tip
  166. // should be displayed. The sender will issue a GetTipRect to position a
  167. // text tip and then send DrawTip to render the tip.
  168. kAdUiReply_DrawTip,
  169. } ADUI_REPLY;
  170. typedef enum {
  171. // Cancelled: notes that a command in the drawing editor was cancelled.
  172. kAdUiCommand_Cancelled = -1,
  173. // Completed: notes that a command in the drawing editor finished OK.
  174. // This also represents a default state (i.e. when no commands have been
  175. // issued, aka kAdUiCommand_None).
  176. kAdUiCommand_Completed,
  177. // Begun: notes that a command in the drawing editor has started.
  178. kAdUiCommand_Begun,
  179. } ADUI_COMMAND_STATE;
  180. typedef enum {
  181. // Begun: notifies that modal dialog is started.
  182. kAdUiModal_Begun = 1,
  183. // Ended: notifies that modal dialog is ended.
  184. kAdUiModal_Ended,
  185. } ADUI_MODAL_STATE;
  186. /////////////////////////////////////////////////////////////////////////////
  187. // Draw Tip Text packet
  188. class ADUI_PORT CAdUiDrawTipText {
  189. public:
  190. CAdUiDrawTipText (CDC& dc, CRect& rect, CString& text);
  191. public:
  192. CDC& m_dc;
  193. CRect& m_rect;
  194. CString& m_text;
  195. };
  196. /////////////////////////////////////////////////////////////////////////////
  197. const UINT ADUI_PORT AdUiMessage ();
  198. ADUI_NOTIFY ADUI_PORT AdUiNotification (WPARAM wp);
  199. #if !defined(_WIN64) && !defined (_AC64)
  200. ADUI_REPLY ADUI_PORT AdUiNotify (CWnd& w, UINT id, ADUI_NOTIFY n, DWORD_PTR lParam);
  201. ADUI_REPLY ADUI_PORT AdUiNotify (CWnd* w, UINT id, ADUI_NOTIFY n, DWORD_PTR lParam);
  202. #else
  203. ADUI_REPLY ADUI_PORT AdUiNotify (CWnd& w, UINT id, ADUI_NOTIFY n, LPARAM lParam);
  204. ADUI_REPLY ADUI_PORT AdUiNotify (CWnd* w, UINT id, ADUI_NOTIFY n, LPARAM lParam);
  205. #endif
  206. UINT ADUI_PORT AdUiNotifyId (WPARAM wp);
  207. #if !defined(_WIN64) && !defined (_AC64)
  208. BOOL ADUI_PORT AdUiPostNotify (CWnd& w, UINT id, ADUI_NOTIFY n, DWORD_PTR lParam);
  209. BOOL ADUI_PORT AdUiPostNotify (CWnd* w, UINT id, ADUI_NOTIFY n, DWORD_PTR lParam);
  210. #else
  211. BOOL ADUI_PORT AdUiPostNotify (CWnd& w, UINT id, ADUI_NOTIFY n, LPARAM lParam);
  212. BOOL ADUI_PORT AdUiPostNotify (CWnd* w, UINT id, ADUI_NOTIFY n, LPARAM lParam);
  213. #endif
  214. /////////////////////////////////////////////////////////////////////////////
  215. //{{AFX_INSERT_LOCATION}}
  216. // Microsoft Developer Studio will insert additional declarations immediately before the previous line.
  217. #pragma pack (pop)
  218. #endif
  219. //////////////////////////////////////////////////////////////////////////////