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.

323 lines
9.0 KiB

  1. /*****************************************************************/
  2. /** Microsoft LAN Manager **/
  3. /** Copyright(c) Microsoft Corp., 1990, 1991 **/
  4. /*****************************************************************/
  5. /*
  6. * browdlg.hxx
  7. *
  8. * History:
  9. * RustanL 05-Nov-1991 Created
  10. * RustanL 20-Feb-1991 Consequnces of new BLT_LISTBOX class
  11. * JohnL 15-Mar-1991 Added SelectNetPathString
  12. * rustanl 24-Mar-1991 Rolled in code review changes from
  13. * CR on 8-Feb-1991 attended by ThomasPa,
  14. * DavidBul, TerryK, RustanL.
  15. * rustanl 27-Apr-1991 Made SetFocusToNewConnections protected.
  16. * JohnL 17-Jun-1991 Added ClearNetPathString for DCR 2041
  17. *
  18. */
  19. #ifndef _BROWDLG_HXX_
  20. #define _BROWDLG_HXX_
  21. #include <lmobj.hxx> // get LMO_DEVICE
  22. #include <olb.hxx> // get LM_OLLB
  23. #include <reslb.hxx> // get RESOURCE_LB
  24. #include <devcb.hxx> // get DEVICE_COMBO
  25. class NLS_STR; // class declared in string.hxx
  26. class BROWSE_BASE : public DIALOG_WINDOW
  27. {
  28. private:
  29. LMO_DEVICE _lmodev;
  30. SLT _sltResourceText;
  31. SLE _sleNetworkPath;
  32. // Note, _iCurrShowSelection must always be in sync with the current
  33. // selection of _olbShow. This means that every time SelectItem or
  34. // RemoveSelection is called on _olbShow, _iCurrShowSelection must
  35. // be updated.
  36. INT _iCurrShowSelection;
  37. LM_OLLB _olbShow;
  38. SLT _sltShowText;
  39. RESOURCE_LB _lbResource;
  40. /* This static text field is affixed "on" the resources listbox. For some
  41. * common error messages, we fill and display this SLT thus it appears
  42. * to be contained inside the listbox. This of course means the listbox
  43. * must be empty.
  44. */
  45. SLT _sltCommonErrorsDisplay ;
  46. BOOL _fNotifyOnNewSelection;
  47. USHORT QueryShareType( void ) const;
  48. APIERR OnShowResourcesChange( void );
  49. void SetResourceText( const NLS_STR & nlsResourceName,
  50. MSGID MsgIDOffset );
  51. APIERR OnResourceChange( void );
  52. APIERR SelectNewServer( const TCHAR * pchServer );
  53. #if ENTERPRISE
  54. APIERR OnEnterpriseSelect( OLLB_ENTRY * pollbe );
  55. #endif
  56. APIERR OnDomainSelect( OLLB_ENTRY * pollbe );
  57. APIERR OnServerSelect( OLLB_ENTRY * pollbe );
  58. virtual void OnNewSelection( BOOL fIsNetPathEmpty );
  59. protected:
  60. BROWSE_BASE( HWND hwndOwner,
  61. LMO_DEVICE lmodev,
  62. const TCHAR * pszDlgResource );
  63. ~BROWSE_BASE();
  64. LMO_DEVICE QueryDeviceType( void ) const
  65. { return _lmodev; }
  66. short QueryUseType( void ) const;
  67. MSGID QueryBrowseIDSBase( void ) const;
  68. BOOL OnCommand( const CONTROL_EVENT & e );
  69. void ClearBrowseBaseDialog( void );
  70. virtual BOOL OnConnect( void );
  71. BOOL ProcessNetPath( NLS_STR * pnlsPath );
  72. /* Set the focus to and hilite the current string in the
  73. * _sleNetworkPath control (used, e.g., after determining the network
  74. * path is invalid)
  75. */
  76. void SelectNetPathString( void ) ;
  77. /* Clears the network path SLE.
  78. */
  79. void ClearNetPathString( void ) ;
  80. /* SetFocusToNewConnections shifts the user's focus point away from the
  81. * upper portion of the dialog to the lower portion of the dialog box
  82. * where the new connection stuff is. The focus is shifted by calling
  83. * OnNewSelection, which removes the hi-lite bar from the current
  84. * connections dialog.
  85. */
  86. void SetFocusToNewConnections( void ) ;
  87. /* DisplayCommonError takes the passed error and displays it "in" the
  88. * resources listbox. This generally occurs after selecting a server
  89. * and you can't display the shares (downlevel, no longer exists etc.).
  90. * The resources listbox must be empty before calling this.
  91. *
  92. * fShow == TRUE means display the error contained in err
  93. * fShow == FALSE means dismiss the error.
  94. *
  95. * Returns TRUE if the error was successfully displayed, FALSE otherwise.
  96. */
  97. BOOL DisplayCommonError( BOOL fShow, APIERR err = 0 ) ;
  98. public:
  99. static LMO_DEVICE ToLmodevType( UINT nType );
  100. }; // class BROWSE_BASE
  101. class BROWSE_DIALOG : public BROWSE_BASE
  102. {
  103. private:
  104. NLS_STR * _pnlsPathReturnBuffer;
  105. protected:
  106. BOOL OnOK( void );
  107. ULONG QueryHelpContext( void );
  108. BOOL OnConnect( void );
  109. public:
  110. BROWSE_DIALOG( HWND hwndOwner,
  111. LMO_DEVICE lmodev,
  112. NLS_STR * pnlsPathReturnBuffer );
  113. ~BROWSE_DIALOG();
  114. }; // class BROWSE_DIALOG
  115. /*************************************************************************
  116. NAME: CONNECT_BASE
  117. SYNOPSIS: This class defines the commonality between the File
  118. connect dialog and the printer connect dialog in the
  119. winnet driver.
  120. INTERFACE:
  121. PARENT: BROWSE_BASE
  122. USES:
  123. CAVEATS:
  124. NOTES:
  125. HISTORY:
  126. Johnl 12-May-1991 Made _sltDeviceText & _devcombo protected
  127. (as opposed to private). This allows the
  128. file connection dialog to set the focus
  129. to the _devcombo.
  130. **************************************************************************/
  131. class CONNECT_BASE : public BROWSE_BASE
  132. {
  133. protected:
  134. SLT _sltDeviceText;
  135. DEVICE_COMBO _devcombo;
  136. CONNECT_BASE( HWND hwndOwner,
  137. LMO_DEVICE lmodev,
  138. const TCHAR * pszDlgResource );
  139. ~CONNECT_BASE();
  140. BOOL OnCommand( const CONTROL_EVENT & e );
  141. APIERR RefreshDeviceNames( void );
  142. BOOL DoConnect( const NLS_STR & nlsPath );
  143. inline BOOL IsDeviceComboEmpty( void );
  144. }; // class CONNECT_BASE
  145. /*******************************************************************
  146. NAME: BROWSE_BASE::SelectNetPathString
  147. SYNOPSIS: Set focus & select the network path. Used after the network
  148. path is determined to be invalid.
  149. ENTRY:
  150. EXIT: The string in the Network Path SLE will have the focus and
  151. be hi-lited.
  152. NOTES:
  153. HISTORY:
  154. Johnl 15-Mar-1991 Created - Part of solution to BUG 1218
  155. ********************************************************************/
  156. inline void BROWSE_BASE::SelectNetPathString( void )
  157. {
  158. _sleNetworkPath.ClaimFocus() ;
  159. _sleNetworkPath.SelectString() ;
  160. }
  161. /*******************************************************************
  162. NAME: BROWSE_BASE::SetFocusToNewConnections
  163. SYNOPSIS: Changes the user's focus from the upper portion of the
  164. connection dialog to the lower portion where the new
  165. connections are performed. Is done when it looks like
  166. the user wants to make a new connection by changing
  167. one of the new connection controls.
  168. ENTRY:
  169. EXIT:
  170. NOTES:
  171. HISTORY:
  172. Johnl 26-Mar-1991 Created
  173. ********************************************************************/
  174. inline void BROWSE_BASE::SetFocusToNewConnections( void )
  175. {
  176. OnNewSelection( _sleNetworkPath.QueryTextLength() == 0 ) ;
  177. }
  178. /*******************************************************************
  179. NAME: BROWSE_BASE::ClearNetPathString
  180. SYNOPSIS: Deletes the text from the network path SLE of the browse
  181. dialog and leaves the focus there.
  182. NOTES: In the printer connections dialog, the text is cleared
  183. after a successful connection so the default button is
  184. reset to the OK button. This method allows derived
  185. dialogs to clear the network path text.
  186. HISTORY:
  187. Johnl 17-Jun-1991 Created
  188. ********************************************************************/
  189. inline void BROWSE_BASE::ClearNetPathString( void )
  190. {
  191. _sleNetworkPath.ClaimFocus() ;
  192. _sleNetworkPath.ClearText() ;
  193. }
  194. /*******************************************************************
  195. NAME: CONNECT_BASE::IsDeviceComboEmpty
  196. SYNOPSIS: Returns whether or not the device combo is empty
  197. RETURNS: TRUE if device combo is empty; FALSE otherwise
  198. HISTORY:
  199. rustanl 20-May-1991 Created
  200. ********************************************************************/
  201. inline BOOL CONNECT_BASE::IsDeviceComboEmpty( void )
  202. {
  203. return ( _devcombo.QueryCount() == 0 );
  204. } // CONNECT_BASE::IsDeviceComboEmpty
  205. #if 0 // Debugging code
  206. class SEARCH_DIALOG : public DIALOG_WINDOW
  207. {
  208. private:
  209. SLE _sleNetworkPath;
  210. TCHAR *_pszResult ;
  211. UINT _cbResult ;
  212. protected:
  213. public:
  214. SEARCH_DIALOG( HWND hwndOwner,
  215. TCHAR *pszResult,
  216. UINT cbResult,
  217. const TCHAR *pszDlgResource );
  218. ~SEARCH_DIALOG();
  219. BOOL OnOK( void );
  220. };
  221. #endif
  222. #endif // _BROWDLG_HXX_