rxmfcapi.h 8.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253
  1. //
  2. //////////////////////////////////////////////////////////////////////////////
  3. //
  4. // Copyright 2015 Autodesk, Inc. All rights reserved.
  5. //
  6. // Use of this software is subject to the terms of the Autodesk license
  7. // agreement provided at the time of installation or download, or which
  8. // otherwise accompanies this software in either electronic or hard copy form.
  9. //
  10. //////////////////////////////////////////////////////////////////////////////
  11. //
  12. // Name: rxmfcapi.h
  13. //
  14. // Remarks: This module contains the implementation for ARXMFC API.
  15. // You need to include windows and/or ole header files
  16. //
  17. //////////////////////////////////////////////////////////////////////////////
  18. #include "adesk.h"
  19. #include "AdAChar.h"
  20. #include "AcStatusBar.h"
  21. #include "core_rxmfcapi.h"
  22. #ifndef AD_RXMFCAPI_H
  23. #define AD_RXMFCAPI_H 1
  24. #pragma pack (push, 8)
  25. // AutoCAD WM_ACAD_KEEPFOCUS
  26. // Create custom window message. This message is used by the OnIdle
  27. // handler to test if a top-level window will relinquish focus. If
  28. // a window handles this message and does not want to lose focus then
  29. // it should return a TRUE result.
  30. // lParam & wParam not used
  31. // Return 1 to maintain focus else 0 if focus can be shifted.
  32. #ifndef WM_ACAD_KEEPFOCUS
  33. #define WM_ACAD_KEEPFOCUS (WM_USER+0x6D01)
  34. #endif // WM_ACAD_KEEPFOCUS
  35. class AcDbDatabase;
  36. class AcApStatusBar;
  37. class CDialogBar;
  38. class AdApplicationFrame;
  39. #ifdef _ADESK_WINDOWS_
  40. //////////////////////////
  41. // AutoCAD Window pointers
  42. //////////////////////////
  43. // The pointer to a window or a frame should be used only when the
  44. // ARX apps share the SAME MFC DLL with AutoCAD.
  45. // In some cases, when using static MFC or different MFC DLL,
  46. // the window handle should be used instead.
  47. // instead of using
  48. // acedGetAcadDwgView()->UpdateWindow();
  49. // CMyDialog Mydia(acedGetAcadFrame());
  50. // use
  51. // ::UpdateWindow(acedGetAcadDwgView()->m_hWnd);
  52. // CMyDialog Mydia(CWnd::FromHandle(acedGetAcadFrame()->m_hWnd));
  53. /* acedGetAcadWinApp
  54. * Returns the pointer to AutoCAD CWinApp object.
  55. */
  56. CWinApp* acedGetAcadWinApp();
  57. /* acedGetAcadDoc
  58. * Returns the pointer to AutoCAD CDocument object
  59. * There's only one document in AutoCAD.
  60. */
  61. CDocument* acedGetAcadDoc();
  62. /* acedGetAcadDwgView
  63. * Returns the pointer to AutoCAD CView object
  64. * There's only one Dwg view in AutoCAD.
  65. */
  66. CView* acedGetAcadDwgView();
  67. /* acedGetAcadFrame
  68. * Returns the pointer to AutoCAD CMDIFrameWnd object
  69. */
  70. CMDIFrameWnd* acedGetAcadFrame();
  71. /* acedGetAcadDockCmdLine
  72. * Returns the pointer to AutoCAD command line window
  73. */
  74. CWnd* acedGetAcadDockCmdLine();
  75. /* acedGetAcadTextCmdLine
  76. * Returns the pointer to AutoCAD Text window.
  77. */
  78. CWnd* acedGetAcadTextCmdLine();
  79. #endif // _ADESK_WINDOWS_
  80. /* acedGetAcadBrandingResourceInstance()
  81. * Returns the Instance of AutoCAD's Branding resource
  82. * e.g. splash screen, about box, mainframe icon
  83. */
  84. HINSTANCE acedGetAcadBrandingResourceInstance();
  85. #ifdef _ADESK_WINDOWS_
  86. // AutoCAD MDI Child Window Frame settings
  87. typedef struct tagChildFrmSettings {
  88. // More to come later
  89. AcColorSettings m_ColorSettings;
  90. bool m_bShowLayoutBar;
  91. bool m_bShowScrollBar;
  92. CDialogBar *m_pDialogBar;
  93. bool m_bIsBedit;
  94. } AcChildFrmSettings;
  95. BOOL acedGetChildFrameSettings(AcChildFrmSettings* pChildFrmSettings,
  96. CMDIChildWnd *pWnd);
  97. BOOL acedSetChildFrameSettings(AcChildFrmSettings* pChildFrmSettings,
  98. CMDIChildWnd *pWnd);
  99. #endif
  100. #ifdef _ADESK_WINDOWS_
  101. // Custom Drag and Drop
  102. // In order to enable custom drag&drop, you have to
  103. // #define _ARX_CUSTOM_DRAG_N_DROP_
  104. // before including this header file, and you need to include <afxole.h> also.
  105. #ifdef _ARX_CUSTOM_DRAG_N_DROP_
  106. /* acedRegisterCustomDropTarget
  107. * Registers a new IDroptarget to the AutoCAD's drawing window.
  108. * Only one IDropTarget can be registered at one moment.
  109. * AutoCAD's default Drag & Drop handling capabilities are not available
  110. * until the IDroptarget is revoke.
  111. * This is replaced by acedStartOverrideDropTarget(). It will be removed
  112. * in next release.
  113. */
  114. BOOL acedRegisterCustomDropTarget(IDropTarget* pItarget);
  115. BOOL acedStartOverrideDropTarget(COleDropTarget* pTarget);
  116. /* acedRevokeCustomDropTarget
  117. * Revokes the previously set IDroptarget.
  118. * The default AutoCAD's handling of Drag&Drop event is restored.
  119. * This is replaced by acedRemoveDropTarget(). It will be removed
  120. * in next release.
  121. */
  122. BOOL acedRevokeCustomDropTarget();
  123. BOOL acedEndOverrideDropTarget(COleDropTarget* pTarget);
  124. /* acedAddDropTarget
  125. * Add a hook to participate in DragDrop Event started not from
  126. * 3rd party ARX app.
  127. */
  128. BOOL acedAddDropTarget(COleDropTarget* pTarget);
  129. /* acedRemoveDropTarget
  130. * Remove the hook to AutoCAD DragDrop event.
  131. */
  132. BOOL acedRemoveDropTarget(COleDropTarget* pTarget);
  133. #endif // _ARX_CUSTOM_DRAG_N_DROP_
  134. #endif // _ADESK_WINDOWS_
  135. #ifdef _ADESK_WINDOWS_
  136. // Get Database correpont to on AutoCAD Drawing Window.
  137. AcDbDatabase* AcApGetDatabase(CView *pView);
  138. #endif
  139. // AutoCAD company name for registry access. For all except AutoCAD
  140. // OEM, this will return "Autodesk". For AutoCAD OEM, it is at the
  141. // discretion of the AutoCAD OEM developer, via an entry in aoemres2.rc,
  142. // to specify the company name for use in registry accesses.
  143. const CString& acedGetRegistryCompany();
  144. // Register the fact that the application with name "szAppName"
  145. // may want to add a tab to the tabbed dialog named "szDialogName".
  146. // This function creates the key necessary to register the added
  147. // tab(s) if it is not there. Returns TRUE on success.
  148. BOOL acedRegisterExtendedTab(LPCTSTR szAppName, LPCTSTR szDialogName);
  149. // Return an HMENU given a .MNU file alias.
  150. HMENU acedGetMenu(LPCTSTR pszAlias);
  151. // This routine is exported primarily for use by AcUi. The routine is called
  152. // from a dialog to determine if input is queued after an interactive command
  153. // has been cancelled. Generally, if there's no input queued then the dialog
  154. // will be restored, otherwise the dialog will terminate and allow the queued
  155. // commands to be processed.
  156. BOOL acedIsInputPending ();
  157. BOOL acedSetIUnknownForCurrentCommand(const LPUNKNOWN);
  158. BOOL acedGetIUnknownForCurrentCommand(LPUNKNOWN &pUnk);
  159. /* acedGetApplicationStatusBar
  160. * Returns the pointer to AutoCAD Application Status Bar.
  161. */
  162. AcApStatusBar* acedGetApplicationStatusBar();
  163. /* acedShowDrawingStatusBars
  164. * Shows or hides the drawing status bars.
  165. */
  166. BOOL acedShowDrawingStatusBars(BOOL bShow = TRUE);
  167. /* acedDrawingStatusBarsVisible
  168. * Returns TRUE if the drawing status bar are visible
  169. * in AutoCAD, otherwise FALSE.
  170. */
  171. BOOL acedDrawingStatusBarsVisible();
  172. #ifdef _ADESK_WINDOWS_
  173. /* acedRegisterStatusBarMenuItem
  174. * Returns TRUE if the status bar item is successfully
  175. * registered in AutoCAD, otherwise FALSE.
  176. */
  177. BOOL acedRegisterStatusBarMenuItem(AcStatusBarMenuItem* pItem,
  178. AcStatusBarMenuItem::AcStatusBarType nType);
  179. /* acedUnregisterStatusBarMenuItem
  180. * Returns TRUE if the status bar item is successfully
  181. * unregistered in AutoCAD, otherwise FALSE.
  182. */
  183. BOOL acedUnregisterStatusBarMenuItem(AcStatusBarMenuItem* pItem,
  184. AcStatusBarMenuItem::AcStatusBarType nType);
  185. /* acedSetStatusBarPaneId
  186. * Sets the id of the given status bar pane. Returns TRUE if
  187. * successful, otherwise FALSE.
  188. */
  189. BOOL acedSetStatusBarPaneID(AcPane* pPane,
  190. AcStatusBarMenuItem::AcStatusBarType nType,
  191. int nID);
  192. #endif // _ADESK_WINDOWS_
  193. // Controls whether or not file open adds the filename to the 'File' MRU list.
  194. void acedSuppressFileMRU(bool bSuppress);
  195. // acedGetApplicationFrame
  196. // Returns the pointer to AutoCAD Application Frame.
  197. AdApplicationFrame* acedGetApplicationFrame();
  198. // Define callback function for apps that want windows messages
  199. typedef BOOL (* AcedPreTranslateMsgFn)(MSG*);
  200. // acedRegisterMainFramePretranslateObserver
  201. /* Register a filter message hook into AutoCAD's main frame message pre-translator.
  202. * The message passed to your application can be changed and can be blocked out.
  203. * If the function returns TRUE, the message WON'T be passed the message handlers
  204. * of AutoCAD. The message is terminated.
  205. * Returns TRUE if successfully registers the hook. Otherwise FALSE.
  206. */
  207. BOOL acedRegisterMainFramePreTranslateObserver(const AcedPreTranslateMsgFn pfn);
  208. /* acedRemoveMainFramePretranslateObserver
  209. * Takes a message hook function pointer and remove it
  210. * Returns TRUE if successfully registers the hook. Otherwise FALSE.
  211. */
  212. BOOL acedRemoveMainFramePreTranslateObserver(const AcedPreTranslateMsgFn pfn);
  213. #pragma pack (pop)
  214. #endif // AD_RXMFCAPI_H