home *** CD-ROM | disk | FTP | other *** search
/ Power GUI Programming with VisualAge C++ / powergui.iso / trialva / ibmcppw / include / ifiledlg.hpp < prev    next >
Encoding:
C/C++ Source or Header  |  1996-02-22  |  7.4 KB  |  246 lines

  1. #ifndef _IFILEDLG_
  2. #define _IFILEDLG_
  3. /*******************************************************************************
  4. * FILE NAME: ifiledlg.hpp                                                      *
  5. *                                                                              *
  6. * DESCRIPTION:                                                                 *
  7. *   Declaration of the classes:                                                *
  8. *     IFileDialog                                                              *
  9. *     IFileDialog::Settings                                                    *
  10. *                                                                              *
  11. * COPYRIGHT:                                                                   *
  12. *   IBM Open Class Library                                                     *
  13. *   (C) Copyright International Business Machines Corporation 1992, 1996       *
  14. *   Licensed Material - Program-Property of IBM - All Rights Reserved.         *
  15. *   US Government Users Restricted Rights - Use, duplication, or disclosure    *
  16. *   restricted by GSA ADP Schedule Contract with IBM Corp.                     *
  17. *                                                                              *
  18. *******************************************************************************/
  19. #include <iframe.hpp>
  20. #include <istring.hpp>
  21. #include <ipoint.hpp>
  22.  
  23. extern "C" {
  24.    void* __stdcall _IFileDlgProc( void*         hwnd,
  25.                                   unsigned long ulMsg,
  26.                                   void*         mp1,
  27.                                   void*         mp2 );
  28. }
  29.  
  30. class StringSeq;
  31. class IResourceId;
  32. class IFileDialogSettingsData;
  33. class IFileDialogData;
  34. class IFileDialogHandler;
  35. struct _FILEDLG;
  36. struct _WidgetRec;
  37. struct tagOFNA;
  38.  
  39. #pragma pack(4)
  40.  
  41. class IFileDialog : public IFrameWindow {
  42. typedef IFrameWindow
  43.   Inherited;
  44. public:
  45.  
  46. class Style;
  47. class Settings;
  48.  
  49. /*----------------------------- Constructors ---------------------------------*/
  50.  
  51.   IFileDialog(IWindow*        parent,
  52.               IWindow*        owner,
  53.               const Style&    style = defaultStyle() );
  54.  
  55.   IFileDialog(IWindow*        parent,
  56.               IWindow*        owner,
  57.               const Settings& settings,
  58.               const Style&    style = defaultStyle() );
  59.  
  60.   IFileDialog(IWindow*        parent,
  61.               IWindow*        owner,
  62.               const Style&    style,
  63.               const Settings& settings );
  64.  
  65.   IFileDialog(IWindow*        parent,
  66.               IWindow*        owner,
  67.               IHandler*       handler,
  68.               const Style&    style = defaultStyle(),
  69.               const Settings& settings = Settings() );
  70.  
  71. virtual
  72.  ~IFileDialog( );
  73.  
  74. /*-------------------------------- Styles ------------------------------------*/
  75.   INESTEDBITFLAGCLASSDEF0(Style, IFileDialog);
  76.  
  77. static const Style
  78.   IC_IMPORTU classDefaultStyle,
  79.   IC_IMPORTU noStyle,
  80.   IC_IMPORTU modeless,
  81. #ifndef IC_WIN_FLAGNOP
  82.   IC_IMPORTU applyButton,
  83.   IC_IMPORTU includeEAS,
  84.   IC_IMPORTU filter,
  85. #endif
  86.   IC_IMPORTU helpButton,
  87.   IC_IMPORTU multiSelection,
  88.   IC_IMPORTU selectableListbox,
  89.   IC_IMPORTU preload;
  90.  
  91. static void
  92.   setDefaultStyle   ( const Style&    style );
  93. static Style
  94.   defaultStyle      ( );
  95.  
  96. virtual unsigned long
  97.   convertToGUIStyle ( const IBitFlag& style,
  98.                       Boolean         extendedOnly = false ) const;
  99.  
  100. class Settings : public IBase {
  101. public:
  102. /*------------------------------ Constructors --------------------------------*/
  103.   Settings();
  104.  ~Settings();
  105.  
  106. /*---------------------- Dialog Customization --------------------------------*/
  107. Settings
  108.  &setTitle                 (const char*        newTitle ),
  109.  &setTitle                 (const IResourceId& resId    ),
  110.  &setOKButtonText          (const char*        newText  ),
  111.  &setOKButtonText          (const IResourceId& resId    ),
  112.  &setDialogTemplate        (const IResourceId& resId    ),
  113.  &setPosition              (const IPoint&     position  );
  114.  
  115. IPoint
  116.   position                 ( ) const;
  117.  
  118. IString
  119.   title                    ( ) const,
  120.   okButtonText             ( ) const;
  121.  
  122. Boolean
  123.   isPositionSet            ( ) const,
  124.   isDialogTemplateSet      ( ) const;
  125.  
  126. /*---------------- Setting Information About the Dialog ----------------------*/
  127. Settings
  128.  &setOpenDialog            ( ),
  129.  &setSaveAsDialog          ( ),
  130.  &setInitialFileType       (const char* fileType    ),
  131.  &setInitialDrive          (const char* drive       ),
  132.  &setFileName              (const char* fileName    );
  133.  
  134. IString
  135.   fileName                 ( ) const,
  136.   initialDrive             ( ) const,
  137.   initialFileType          ( ) const;
  138.  
  139. Boolean
  140.   isOpenDialog             ( ) const;
  141.  
  142. private:
  143. /*------------------------------ Hidden Members ------------------------------*/
  144. Settings    ( const Settings& settings );
  145. Settings
  146.  &operator= ( const Settings& settings );
  147.  
  148. /*--------------------------------- Private ----------------------------------*/
  149. friend class IFileDialog;
  150.  
  151. StringSeq
  152.  *fileTypes                ( ) const;
  153.  
  154. IString
  155.   titleStr,
  156.   OKButtonStr,
  157.   fileNameStr,
  158.   initialDriveStr,
  159.   initialFileTypeStr;
  160.  
  161. IPoint
  162.   pos;
  163.  
  164. Boolean
  165.   isOpenDlg,
  166.   isPosSet;
  167.  
  168. IFileDialogSettingsData
  169.  *fSettingsData;
  170. };   /* Settings */
  171.  
  172. /*---------------- Setting Information About the Dialog ----------------------*/
  173. virtual IFileDialog
  174.  &setId                            ( unsigned long  newIdentifier );
  175.  
  176. /*---------------- Getting Information About the Dialog ----------------------*/
  177. Boolean
  178.   isModeless                       ( ) const,
  179.   pressedOK                        ( ) const;
  180.  
  181. static const unsigned long
  182.   IC_IMPORTU ok,
  183.   IC_IMPORTU cancel;
  184.  
  185. unsigned long
  186.   id                               ( ) const,
  187.   buttonPressedId                  ( ) const;
  188.  
  189. long
  190.   returnValue                      ( ) const;
  191.  
  192.  
  193. /*----------- Getting Information About the Chosen File ----------------------*/
  194. unsigned
  195.   selectedFileCount                ( ) const;
  196.  
  197. IString
  198.   fileName                         (unsigned fileNumber = 0) const;
  199.  
  200.  
  201. /*----------------------------- Color Functions ------------------------------*/
  202. virtual IColor
  203.   backgroundColor              ( ) const;
  204.  
  205. virtual IFileDialog
  206.  &setBackgroundColor           ( const IColor& color );
  207.  
  208. protected:
  209. /*-------------------------------Overrides------------------------------------*/
  210.  
  211. private:
  212. /*------------------------------ Hidden Members ------------------------------*/
  213.   IFileDialog  (const IFileDialog& fileDialog );
  214. IFileDialog
  215.  &operator=    (const IFileDialog& fileDialog );
  216.  
  217. /*--------------------------------- Private ----------------------------------*/
  218. friend IFileDialogHandler;
  219. struct tagOFNA
  220.  *pFileDlgData;
  221.  
  222. friend void* __stdcall
  223.   _IFileDlgProc( void*         hwnd,
  224.                  unsigned long ulMsg,
  225.                  void*         mp1,
  226.                  void*         mp2 );
  227.  
  228. void IFileDialog :: initialize (IWindow*        parent,
  229.                                 IWindow*        owner,
  230.                                 const Style&    style,
  231.                                 IHandler*       handler,
  232.                                 const Settings& settings);
  233.  
  234. static Style
  235.   currentDefaultStyle;
  236.  
  237. IFileDialogData
  238.  *fFileDialogData;
  239. }; /* IFileDialog */
  240.  
  241. #pragma pack()
  242.  
  243.   #include <ifiledlg.inl>
  244.  
  245. #endif // _IFILEDLG_
  246.