aduiFileDialog.h 5.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164
  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. #ifndef _aduiFileDialog_h
  11. #define _aduiFileDialog_h
  12. #pragma pack (push, 8)
  13. #pragma once
  14. #ifndef kDialogOptionNone
  15. #define kDialogOptionNone 0
  16. #endif
  17. #ifndef kDialogOptionUseTips
  18. #define kDialogOptionUseTips 1
  19. #endif
  20. #ifndef kDialogOptionUseTipsForContextHelp
  21. #define kDialogOptionUseTipsForContextHelp 2
  22. #endif
  23. #ifndef _ADESK_MAC_
  24. //////////////////////////////////////////////////////////////////////////////
  25. // Common File Dialog
  26. //
  27. // Essentialy a straight port of CAdUiBaseDialog, except for the constructor.
  28. #pragma warning(push)
  29. #pragma warning(disable : 4275)
  30. class ADUI_PORT CAdUiFileDialog : public CFileDialog {
  31. DECLARE_DYNAMIC(CAdUiFileDialog);
  32. public:
  33. CAdUiFileDialog (
  34. BOOL bOpenFileDialog,
  35. LPCTSTR lpszDefExt=NULL,
  36. LPCTSTR lpszFileName=NULL,
  37. DWORD dwFlags=OFN_HIDEREADONLY | OFN_OVERWRITEPROMPT,
  38. LPCTSTR lpszFilter=NULL,
  39. CWnd *pParentWnd=NULL,
  40. HINSTANCE hDialogResource=NULL
  41. );
  42. virtual ~CAdUiFileDialog ();
  43. // AdUi message handlers
  44. protected:
  45. virtual ADUI_REPLY DoAdUiMessage (
  46. ADUI_NOTIFY notifyCode, UINT controlId, LPARAM lParam
  47. );
  48. virtual ADUI_REPLY OnNotifyControlChange (UINT controlId, LPARAM lParam);
  49. virtual ADUI_REPLY OnNotifyControlValid (UINT controlId, BOOL isValid);
  50. virtual ADUI_REPLY OnNotifyGeneric (UINT controlId, LPARAM lParam);
  51. virtual ADUI_REPLY OnNotifyUpdateTip (CWnd *control);
  52. // Drawing Editor Interaction
  53. private:
  54. HINSTANCE m_commandResourceInstance;
  55. BOOL m_commandWindowWasEnabled;
  56. HWND m_commandWindowWithFocus;
  57. protected:
  58. ADUI_COMMAND_STATE m_commandState;
  59. void BeginEditorCommand ();
  60. void CancelEditorCommand ();
  61. void CompleteEditorCommand (BOOL restoreDialogs=TRUE);
  62. void MakeDialogsVisible (BOOL visible);
  63. public:
  64. BOOL EditorCommandCancelled ();
  65. // Context help
  66. protected:
  67. CString m_contextHelpFileName;
  68. CString m_contextHelpFullPathName;
  69. CString m_contextHelpPrefix; // Must be 4 ASCII characters.
  70. virtual BOOL FindContextHelpFullPath (LPCTSTR fileName, CString& fullPath);
  71. public:
  72. LPCTSTR GetContextHelpFileName ();
  73. void SetContextHelpFileName (LPCTSTR pFileName);
  74. LPCTSTR GetContextHelpFullPathName ();
  75. void SetContextHelpFullPathName (LPCTSTR pFullPathName);
  76. LPCTSTR GetContextHelpPrefix ();
  77. void SetContextHelpPrefix (LPCTSTR pPrefix);
  78. void SetDialogName (LPCTSTR name);
  79. void SetDialogHelpTag (LPCTSTR tag) {m_dlgHelpTag = tag;}
  80. void GetDialogName (CString& name) {name = m_dlgName;}
  81. void GetDialogHelpTag (CString& tag) {tag = m_dlgHelpTag;}
  82. // Misc.
  83. private:
  84. HINSTANCE m_hDialogResourceSaved;
  85. CString m_dlgHelpTag; // The help string tag for this dialog.
  86. CString m_dlgName; // The name of our dialog
  87. protected:
  88. int m_bUseTips;
  89. HINSTANCE m_hDialogResource;
  90. HICON m_hIcon;
  91. CAdUiTextTip *m_pTextTip;
  92. CToolTipCtrl *m_pToolTip;
  93. CString m_rootKey;
  94. CWnd* m_pParent;
  95. virtual void OnInitDialogBegin ();
  96. virtual void OnInitDialogFinish ();
  97. public:
  98. virtual CWnd *AppMainWindow ();
  99. virtual HINSTANCE AppResourceInstance ();
  100. virtual LPCTSTR AppRootKey ();
  101. virtual void EnableFloatingWindows (BOOL allow);
  102. int GetUseTips ();
  103. void SetUseTips (int useTips);
  104. HICON GetDialogIcon();
  105. void SetDialogIcon(HICON hIcon);
  106. virtual void OnDialogHelp(); // Override this to provide dialog help.
  107. virtual BOOL DoDialogHelp();
  108. // ClassWizard-controlled
  109. public:
  110. //{{AFX_DATA(CAdUiFileDialog)
  111. enum { IDD = 0 };
  112. //}}AFX_DATA
  113. //{{AFX_VIRTUAL(CAdUiFileDialog)
  114. public:
  115. virtual BOOL PreTranslateMessage(MSG* pMsg);
  116. virtual INT_PTR DoModal();
  117. protected:
  118. virtual void DoDataExchange(CDataExchange* pDX); // DDX/DDV support
  119. virtual void PostNcDestroy();
  120. virtual BOOL PreCreateWindow(CREATESTRUCT& cs);
  121. //}}AFX_VIRTUAL
  122. protected:
  123. //{{AFX_MSG(CAdUiFileDialog)
  124. virtual BOOL OnInitDialog();
  125. afx_msg LRESULT OnAdUiMessage (WPARAM wParam, LPARAM lParam);
  126. afx_msg HBRUSH OnCtlColor(CDC* pDC, CWnd* pWnd, UINT nCtlColor);
  127. afx_msg BOOL OnHelpInfo(HELPINFO* lpHelpInfo);
  128. //}}AFX_MSG
  129. afx_msg BOOL OnNotify_ToolTipText(UINT id, NMHDR *pNMHDR, LRESULT *pResult);
  130. DECLARE_MESSAGE_MAP()
  131. };
  132. #pragma warning(pop)
  133. #endif //_ADESK_MAC_
  134. /////////////////////////////////////////////////////////////////////////////
  135. //{{AFX_INSERT_LOCATION}}
  136. // Microsoft Developer Studio will insert additional declarations immediately before the previous line.
  137. #pragma pack (pop)
  138. #endif
  139. /////////////////////////////////////////////////////////////////////////////