Leaked source code of windows server 2003
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

312 lines
9.6 KiB

  1. /**********************************************************************/
  2. /** Microsoft Windows/NT **/
  3. /** Copyright(c) Microsoft Corp., 1991 **/
  4. /**********************************************************************/
  5. /*
  6. focusdlg.hxx
  7. Common dialog for setting the app's focus
  8. FILE HISTORY:
  9. kevinl 14-Jun-91 Created
  10. rustanl 04-Sep-1991 Modified to let this dialog do more
  11. work (rather than letting ADMIN_APP
  12. do the work after this dialog is
  13. dismissed)
  14. KeithMo 06-Oct-1991 Win32 Conversion.
  15. TerryK 15-Nov-1991 move from admin\common\h\setfocus.hxx to here
  16. TerryK 18-Nov-1991 added ssfdlg.hxx to the end of the file
  17. Chuckc 23-Feb-1992 Added SELECTION_TYPE
  18. KeithMo 23-Jul-1992 Added maskDomainSources and
  19. pszDefaultSelection.
  20. KeithMo 07-Aug-1992 Added HelpContext parameters.
  21. YiHsinS 08-Mar-1993 Added second worker thread FOCUSDLG_DATA_THREAD
  22. */
  23. #ifndef _FOCUSDLG_HXX_
  24. #define _FOCUSDLG_HXX_
  25. extern "C"
  26. {
  27. #include "domenum.h" // for BROWSE_*_DOMAIN[S] flags
  28. #include "uimsg.h"
  29. } // extern "C"
  30. #include "string.hxx"
  31. #include "fontedit.hxx" // for SLE_FONT
  32. #include "olb.hxx" // get LM_OLLB
  33. #include "focus.hxx" // for FOCUS_TYPE, SELECTION_TYPE and FOCUS_CACHE_SETTING
  34. #include "w32event.hxx" // for WIN32_EVENT
  35. #include "w32thred.hxx" // for WIN32_THREAD
  36. #include "domenum.hxx" // for BROWSE_DOMAIN_ENUM
  37. #include "lmoesrv.hxx" // for SERVER1_ENUM
  38. #define IERR_DONT_DISMISS_FOCUS_DLG ( IDS_UI_APPLIB_LAST - 5 )
  39. #define WM_FOCUS_LB_FILLED ( WM_USER + 138 )
  40. typedef struct {
  41. BROWSE_DOMAIN_ENUM *pEnumDomains; // Contains the list of domains
  42. SERVER1_ENUM *pEnumServers; // Contains the list of servers if needed
  43. const TCHAR *pszSelection; // The default selection
  44. } FOCUSDLG_RETURN_DATA;
  45. DLL_CLASS FOCUSDLG_DATA_THREAD;
  46. /*************************************************************************
  47. NAME: BASE_SET_FOCUS_DLG
  48. SYNOPSIS: This is the base class of SET_FOCUS_DLG. Currently, it
  49. has 2 children classes as:
  50. BASE_SET_FOCUS_DLG
  51. / \
  52. / \
  53. SET_FOCUS_DLG STANDALONE_SET_FOCUS_DLG
  54. where SET_FOCUS_DLG is associated with the ADMINAPP
  55. object and STANDALONE_SET_FOCUS_DLG is completely
  56. independent.
  57. The purpose of this class is to popup a dialog window
  58. and display a SLE and a listbox which contains the
  59. current domain and servers available and let the user
  60. selects either the domain or server.
  61. INTERFACE:
  62. BASE_SET_FOCUS_DLG() - constructor
  63. ~BASE_SET_FOCUS_DLG() - destructor
  64. PARENT: DIALOG_WINDOW
  65. USES: SLE, LM_OLLB, CONTROL_EVENT, HWND
  66. HISTORY:
  67. terryk 18-Nov-91 Created
  68. KeithMo 23-Jul-1992 Added maskDomainSources and
  69. pszDefaultSelection.
  70. **************************************************************************/
  71. DLL_CLASS BASE_SET_FOCUS_DLG : public DIALOG_WINDOW
  72. {
  73. private:
  74. SLE _sleFocusPath;
  75. // Note, _iCurrShowSelection must always be in sync with the current
  76. // selection of _olb. This means that every time SelectItem or
  77. // RemoveSelection is called on _olb, _iCurrShowSelection must
  78. // be updated.
  79. INT _iCurrShowSelection;
  80. LM_OLLB _olb;
  81. SLE_FONT _sleGetInfo;
  82. SLT _sltLBTitle;
  83. SELECTION_TYPE _seltype ;
  84. ULONG _nHelpContext;
  85. NLS_STR _nlsHelpFile ;
  86. SLT _sltBoundary;
  87. XYDIMENSION _xyOriginal;
  88. CHECKBOX _chkboxRasMode;
  89. SLT _sltRasModeMessage;
  90. RESOURCE_STR _resstrRasServerSlow;
  91. RESOURCE_STR _resstrRasServerFast;
  92. RESOURCE_STR _resstrRasDomainSlow;
  93. RESOURCE_STR _resstrRasDomainFast;
  94. FOCUSDLG_DATA_THREAD *_pDataThread;
  95. VOID OnDomainLBChange();
  96. APIERR ProcessNetPath( NLS_STR * pnlsPath, MSGID *pmsgid );
  97. VOID SelectNetPathString();
  98. /*
  99. * The RasMode checkbox is updated (if active) when the edit field changes
  100. */
  101. VOID UpdateRasMode();
  102. protected:
  103. virtual BOOL OnCommand( const CONTROL_EVENT & event );
  104. virtual BOOL OnUserMessage( const EVENT & event );
  105. virtual BOOL OnOK();
  106. virtual APIERR SetNetworkFocus( HWND hwndOwner,
  107. const TCHAR * pszNetworkFocus,
  108. FOCUS_CACHE_SETTING setting );
  109. virtual ULONG QueryHelpContext();
  110. virtual const TCHAR * QueryHelpFile( ULONG nHelpContext );
  111. /*
  112. * Determine whether the given focus is know to be slow or fast
  113. */
  114. virtual FOCUS_CACHE_SETTING ReadFocusCache( const TCHAR * pszFocus ) const;
  115. /*
  116. * Return the supplied helpfile name if any
  117. */
  118. const TCHAR * QuerySuppliedHelpFile(void)
  119. { return _nlsHelpFile.QueryPch() ; }
  120. /*
  121. * Return the supplied help context if any
  122. */
  123. DWORD QuerySuppliedHelpContext(void)
  124. { return _nHelpContext ; }
  125. VOID ShowArea( BOOL fFull ); // Change dialog size
  126. BOOL IsExpanded() const;
  127. public:
  128. BASE_SET_FOCUS_DLG( const HWND wndOwner,
  129. SELECTION_TYPE seltype,
  130. ULONG maskDomainSources,
  131. const TCHAR * pszDefaultSelection,
  132. ULONG nHelpContext,
  133. const TCHAR *pszHelpFile = NULL,
  134. ULONG nServerTypes = (ULONG) -1L );
  135. ~BASE_SET_FOCUS_DLG();
  136. // Overloaded 'Process' members for reducing initial dialog extent
  137. APIERR Process( UINT *pnRetVal = NULL );
  138. APIERR Process( BOOL *pfRetVal );
  139. VOID SetRasMode( BOOL fRasMode )
  140. { _chkboxRasMode.SetCheck( fRasMode ); }
  141. BOOL InRasMode( VOID ) const
  142. { return _chkboxRasMode.QueryCheck(); }
  143. };
  144. /*************************************************************************
  145. NAME: FOCUSDLG_DATA_THREAD
  146. SYNOPSIS: Worker thread to get all the domains, servers...
  147. INTERFACE: FOCUSDLG_DATA_THREAD() - Constructor
  148. ~FOCUSDLG_DATA_THREAD() - Destructor
  149. ExitThread() - Signals the thread to exit
  150. PARENT: WIN32_THREAD
  151. USES: WIN32_EVENT
  152. HISTORY:
  153. YiHsinS 10-Mar-1993 Created
  154. **************************************************************************/
  155. DLL_CLASS FOCUSDLG_DATA_THREAD : public WIN32_THREAD
  156. {
  157. private:
  158. //
  159. // Information needed to do the enumeration
  160. //
  161. HWND _hwndDlg;
  162. ULONG _maskDomainSources;
  163. SELECTION_TYPE _seltype;
  164. NLS_STR _nlsSelection;
  165. ULONG _nServerTypes;
  166. //
  167. // Exit thread event
  168. //
  169. WIN32_EVENT _eventExitThread;
  170. //
  171. // Set when the main dialog is exiting
  172. //
  173. BOOL _fThreadIsTerminating;
  174. protected:
  175. //
  176. // Main routine to enumerate the information
  177. //
  178. virtual APIERR Main( VOID );
  179. //
  180. // THIS DELETES *this!
  181. //
  182. virtual APIERR PostMain( VOID );
  183. public:
  184. FOCUSDLG_DATA_THREAD( HWND hwndDlg,
  185. ULONG maskDomainSources,
  186. SELECTION_TYPE seltype,
  187. const TCHAR *pszSelection,
  188. ULONG nServerTypes );
  189. virtual ~FOCUSDLG_DATA_THREAD();
  190. //
  191. // This signals the thread to *asynchronously* clean up and die.
  192. //
  193. // THIS OBJECT WILL BE DELETED SOMETIME AFTER THIS CALL!
  194. //
  195. APIERR ExitThread( VOID )
  196. { _fThreadIsTerminating = TRUE;
  197. return _eventExitThread.Set(); }
  198. };
  199. /*************************************************************************
  200. NAME: STANDALONE_SET_FOCUS_DLG
  201. SYNOPSIS: Popup a dialog box and let the user selects a domain or
  202. server
  203. INTERFACE:
  204. STANDALONE_SET_FOCUS_DLG() - constructor.
  205. PARENT: BASE_SET_FOCUS_DLG
  206. USES: NLS_STR
  207. HISTORY:
  208. terryk 18-Nov-1991 Created
  209. KeithMo 23-Jul-1992 Added maskDomainSources and
  210. pszDefaultSelection.
  211. **************************************************************************/
  212. DLL_CLASS STANDALONE_SET_FOCUS_DLG : public BASE_SET_FOCUS_DLG
  213. {
  214. private:
  215. NLS_STR *_pnlsName;
  216. protected:
  217. virtual APIERR SetNetworkFocus( HWND hwndOwner,
  218. const TCHAR * pszNetworkFocus,
  219. FOCUS_CACHE_SETTING setting );
  220. public:
  221. // the NLS_STR is a pointer which points to the string receive
  222. // buffer for the domain or server name.
  223. STANDALONE_SET_FOCUS_DLG( HWND wndOwner,
  224. NLS_STR *pnlsName,
  225. ULONG nHelpContext,
  226. SELECTION_TYPE seltype = SEL_SRV_AND_DOM,
  227. ULONG maskDomainSources = BROWSE_LM2X_DOMAINS,
  228. const TCHAR * pszDefaultSelection = NULL,
  229. const TCHAR * pszHelpFile = NULL,
  230. ULONG nServerTypes = (ULONG)-1L );
  231. };
  232. #endif // _FOCUSDLG_HXX_