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

  1. #ifndef _IFONTDLG_
  2. #define _IFONTDLG_
  3. /*******************************************************************************
  4. * FILE NAME: IFONTDLG.HPP                                                      *
  5. *                                                                              *
  6. * DESCRIPTION:                                                                 *
  7. *   Declaration of the classes:                                                *
  8. *     IFontDialog                                                              *
  9. *     IFontDialog::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.  
  22. extern "C" {
  23.    void* __stdcall _IFontDlgProc( void*         hwnd,
  24.                                   unsigned long ulMsg,
  25.                                   void*         mp1,
  26.                                   void*         mp2 );
  27. }
  28.  
  29. class IResourceId;
  30. class IPoint;
  31. class IFont;
  32. class IFontHandler;
  33. class IFontDialogData;
  34. class IFontDialogSettingsData;
  35. struct _FONTDLG;
  36. struct tagCHOOSEFONTA;
  37.  
  38. #pragma pack(4)
  39.  
  40. class IFontDialog : public IFrameWindow {
  41. typedef IFrameWindow
  42.   Inherited;
  43. public:
  44. class Style;
  45. class Settings;
  46. /*------------------------------ Constructors --------------------------------*/
  47.  IFontDialog(IWindow*        parent,
  48.              IWindow*        owner,
  49.              const Style&    style = defaultStyle() );
  50.  
  51.  IFontDialog(IWindow*        parent,
  52.              IWindow*        owner,
  53.              const Settings& settings,
  54.              const Style&    style = defaultStyle() );
  55.  
  56.  IFontDialog(IWindow*        parent,
  57.              IWindow*        owner,
  58.              const Style&    style,
  59.              const Settings& settings );
  60.  
  61.  IFontDialog(IWindow*        parent,
  62.              IWindow*        owner,
  63.              IHandler*       handler,
  64.              const Style&    style = defaultStyle(),
  65.              const Settings& settings = Settings(0) );
  66.  
  67. virtual
  68.  ~IFontDialog( );
  69.  
  70. /*---------------------------------- Styles ----------------------------------*/
  71.   INESTEDBITFLAGCLASSDEF0(Style, IFontDialog);
  72.  
  73. static const Style
  74.   IC_IMPORTU classDefaultStyle,
  75.   IC_IMPORTU noStyle,
  76.   IC_IMPORTU applyButton,
  77.   IC_IMPORTU bitmapOnly,
  78.   IC_IMPORTU fixedWidthOnly,
  79.   IC_IMPORTU helpButton,
  80.   IC_IMPORTU modeless,
  81.   IC_IMPORTU noSynthesize,
  82. #ifndef IC_WIN_FLAGNOP
  83.   IC_IMPORTU proportionalOnly,
  84. #endif
  85.   IC_IMPORTU resetButton,
  86.   IC_IMPORTU vectorOnly;
  87.  
  88. static void
  89.   setDefaultStyle        ( const Style& newDefault );
  90. static Style
  91.   defaultStyle           ( );
  92.  
  93. virtual unsigned long
  94.   convertToGUIStyle ( const IBitFlag& style,
  95.                       Boolean         extendedOnly = false ) const;
  96.  
  97. class Settings : public IBase {
  98. public:
  99. /*------------------------------- Constructors -------------------------------*/
  100.   Settings   ( IFont*         font = 0 );
  101.  ~Settings   ( );
  102.  
  103. /*--------------------------- Dialog Customization ---------------------------*/
  104. Settings
  105.  &setTitle            ( const char*        title       ),
  106.  &setTitle            ( const IResourceId& text        ),
  107.  &setPreviewText      ( const char*        previewText ),
  108.  &setPosition         ( const IPoint&      position    );
  109.  
  110. Settings
  111.  &setDialogTemplate   ( const IResourceId& templateId  );
  112.  
  113. /*------------------- Setting the Presentation Space -------------------------*/
  114. Settings
  115.  &setDisplayPS        ( const IPresSpaceHandle& presSpaceHandle ),
  116.  &setPrinterPS        ( const IPresSpaceHandle& presSpaceHandle );
  117.  
  118. /*----------- Setting Information About the Initial Font ---------------------*/
  119. Settings
  120.  &setFont             ( IFont*        font       );
  121.  
  122.  
  123. private:
  124. /*------------------------------ Hidden Members ------------------------------*/
  125. Settings    ( const Settings& settings );
  126. Settings
  127.  &operator= ( const Settings& settings );
  128.  
  129. /*--------------------------------- Private ----------------------------------*/
  130. friend IFontDialog;
  131.  
  132. IFont
  133.  *fApplyFont;
  134.  
  135.  
  136. struct tagCHOOSEFONTA
  137.  *fData;
  138.  
  139. IString
  140.   fTitle,
  141.   fPreview;
  142.  
  143. IPoint
  144.   fPosition;
  145.  
  146. unsigned long
  147.   dlgId,
  148.   fSettingsChanged;
  149.  
  150. IFontDialogSettingsData
  151.  *fSettingsData;
  152. }; // IFontDialog::Settings
  153.  
  154.  
  155. /*---------------- Setting Information About the Dialog ----------------------*/
  156. IFontDialog
  157.  &setId                  ( unsigned long  newIdentifier );
  158.  
  159. /*---------------- Getting Information About the Dialog ----------------------*/
  160.  
  161. static const unsigned long
  162.   IC_IMPORTU ok,
  163.   IC_IMPORTU cancel;
  164.  
  165. unsigned long
  166.   id                     ( ) const,
  167.   buttonPressedId        ( ) const;
  168.  
  169. long
  170.   returnValue            ( ) const;
  171.  
  172. Boolean
  173.   isModeless             ( ) const,
  174.   pressedOK              ( ) const;
  175.  
  176. /*---------------- Getting Information About the Chosen Font -----------------*/
  177. unsigned long
  178.   pointSize             ( ) const;
  179.  
  180.  
  181. /*----------------------------- Color Functions ------------------------------*/
  182. virtual IColor
  183.   backgroundColor              ( ) const;
  184.  
  185. virtual IFontDialog
  186.  &setBackgroundColor           ( const IColor& color );
  187.  
  188. private:
  189. /*------------------------------ Hidden Members ------------------------------*/
  190. IFontDialog   ( const IFontDialog& fontDialog );
  191. IFontDialog
  192.  &operator=   ( const IFontDialog& fontDialog );
  193.  
  194. /*--------------------------------- Private ----------------------------------*/
  195. friend void* __stdcall
  196.   _IFontDlgProc( void*         hwnd,
  197.                  unsigned long ulMsg,
  198.                  void*         mp1,
  199.                  void*         mp2 );
  200. friend IFont;
  201. friend IFontHandler;
  202.  
  203. void IFontDialog  :: initialize (IWindow*        parent,
  204.                                  IWindow*        owner,
  205.                                  const Style&    style,
  206.                                  IHandler*       handler,
  207.                                  const Settings& settings);
  208.  
  209. static Style
  210.   currentDefaultStyle;
  211.  
  212. IFont
  213.  *fApplyFont;
  214. IHandler*
  215.   _handlerToAdd;
  216.  
  217.  
  218. struct tagCHOOSEFONTA
  219.  *fData;
  220.  
  221. long
  222.   fSRC,
  223.   fReturnVal;
  224.  
  225. IString
  226.   fTitle,
  227.   fPreview;
  228.  
  229. IPoint
  230.   fPosition;
  231.  
  232. unsigned long
  233.   fDialogId,
  234.   fSettingsChanged;
  235.  
  236. IFontDialogData
  237.  *fFontDialogData;
  238.  
  239. }; // IFontDialog
  240.  
  241. #pragma pack()
  242.  
  243.   #include <ifontdlg.inl>
  244.  
  245. #endif // _IFONTDLG_
  246.