home *** CD-ROM | disk | FTP | other *** search
/ PC World Komputer 1997 May / Pcwk0597.iso / sybase / starbuck / hpp.z / WFONTDLG.HPP < prev    next >
C/C++ Source or Header  |  1996-10-18  |  6KB  |  179 lines

  1. /* %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
  2.    %     Copyright (C) 1994, by WATCOM International Inc.  All rights    %
  3.    %     reserved.  No part of this software may be reproduced or        %
  4.    %     used in any form or by any means - graphic, electronic or       %
  5.    %     mechanical, including photocopying, recording, taping or        %
  6.    %     information storage and retrieval systems - except with the     %
  7.    %     written permission of WATCOM International Inc.                 %
  8.    %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
  9. */
  10.  
  11. /*************************************************************************
  12.  *
  13.  * WFontDialog -- Wrapper for the Windows 95 Font dialog control.
  14.  *
  15.  *   Events:
  16.  *
  17.  *************************************************************************/
  18.  
  19. #ifndef _WFONTDIALOG_HPP_INCLUDED
  20. #define _WFONTDIALOG_HPP_INCLUDED
  21.  
  22. #ifndef _WNO_PRAGMA_PUSH
  23. #pragma pack(push,8);
  24. #pragma enum int;
  25. #endif
  26.  
  27. #ifndef _WCOMDLG_HPP_INCLUDED
  28. #  include "wcomdlg.hpp"
  29. #endif
  30. #ifndef _WCANVAS_HPP_INCLUDED
  31. #  include "wcanvas.hpp"
  32. #endif
  33. #ifndef _WFONT_HPP_INCLUDED
  34. #  include "wfont.hpp"
  35. #endif
  36.  
  37. typedef WStyle          WFontDStyle;
  38.  
  39. //
  40. // WFontDialog styles
  41. //
  42.  
  43. #define WFontDSScreenFonts             ((WStyle)0x00000001L)
  44. #define WFontDSPrinterFonts            ((WStyle)0x00000002L)
  45. #define WFontDSBoth                    ((WStyle)0x00000003L)
  46. #define WFontDSShowHelp                ((WStyle)0x00000004L)
  47. #define WFontDSEnableHook              ((WStyle)0x00000008L)
  48. #define WFontDSEnableTemplate          ((WStyle)0x00000010L)
  49. #define WFontDSEnableTemplateHandle    ((WStyle)0x00000020L)
  50. #define WFontDSInitToLogFontStruct     ((WStyle)0x00000040L)
  51. #define WFontDSUseStyle                ((WStyle)0x00000080L)
  52. #define WFontDSEffects                 ((WStyle)0x00000100L)
  53. #define WFontDSApply                   ((WStyle)0x00000200L)
  54. #define WFontDSScriptsOnly             ((WStyle)0x00000400L)
  55. #define WFontDSNoVectorFonts           ((WStyle)0x00000800L)
  56. #define WFontDSNoSimulations           ((WStyle)0x00001000L)
  57. #define WFontDSLimitSize               ((WStyle)0x00002000L)
  58. #define WFontDSFixedPitchOnly          ((WStyle)0x00004000L)
  59. #define WFontDSWYSIWYG                 ((WStyle)0x00008000L)
  60. #define WFontDSForceFontExist          ((WStyle)0x00010000L)
  61. #define WFontDSScalableOnly            ((WStyle)0x00020000L)
  62. #define WFontDSTTOnly                  ((WStyle)0x00040000L)
  63. #define WFontDSNoFaceSel               ((WStyle)0x00080000L)
  64. #define WFontDSNoStyleSel              ((WStyle)0x00100000L)
  65. #define WFontDSNoSizeSel               ((WStyle)0x00200000L)
  66. #define WFontDSSelectScript            ((WStyle)0x00400000L)
  67. #define WFontDSNoScriptSel             ((WStyle)0x00800000L)
  68. #define WFontDSNoVertFonts             ((WStyle)0x01000000L)
  69.  
  70.  
  71. class WCMCLASS WFontDialog : public WCommonDialog {
  72.     WDeclareSubclass( WFontDialog, WCommonDialog );
  73.  
  74.     public:
  75.     
  76.         /*******************************************************
  77.          * Constructors and Destructors
  78.          *******************************************************/
  79.  
  80.         WFontDialog();
  81.     
  82.         ~WFontDialog();
  83.     
  84.         /*******************************************************
  85.          * Properties
  86.          *******************************************************/
  87.  
  88.         // Color
  89.         //
  90.         //    Set/get the color chosen by the user.
  91.         //    For use, WFontDSEffects must be specified.
  92.  
  93.         WBool SetColor( const WColor & color );
  94.         WColor GetColor() const;
  95.  
  96.         // Font
  97.         //
  98.         //    Set/get the font chosen by the user.
  99.  
  100.         WBool SetFont( const WFont & font );
  101.         WFont GetFont() const;
  102.  
  103.         // MaximumPointSize
  104.         //
  105.         //    Set/get the maximum point size of the font.
  106.         //    For use, WFontDSLimitSize must be specified.
  107.  
  108.         WBool SetMaximumPointSize( WInt pointSize );
  109.         WInt GetMaximumPointSize() const;
  110.  
  111.         // MinimumPointSize
  112.         //
  113.         //    Set/get the minimum point size of the font.
  114.         //    For use, WFontDSLimitSize must be specified.
  115.  
  116.         WBool SetMinimumPointSize( WInt pointSize );
  117.         WInt GetMinimumPointSize() const;
  118.  
  119.         // Style
  120.         //
  121.         //    Set the styles used by the file dialog.  Note that
  122.         //    the WFontDSEnableHook style will ALWAYS be enabled.
  123.  
  124.         WFontDStyle GetStyle() const;
  125.         WBool       SetStyle( WFontDStyle style );
  126.  
  127.         /*******************************************************
  128.          * Methods
  129.          *******************************************************/
  130.  
  131.         // ChangeStyle
  132.         //
  133.         //    Use to turn a specific style on or off.
  134.  
  135.         WBool ChangeStyle( WFontDStyle style, WBool on );
  136.  
  137.         // Prompt
  138.         //
  139.         //    Display the dialog and wait for it to be dismissed.
  140.         //    The first form uses the current settings.  The second
  141.         //    is a convenience function.
  142.  
  143.         WBool Prompt( const WInfoCanvas *canvas=NULL );
  144.  
  145.         WBool Prompt( WWindow * owner, const WChar * title,
  146.                       const WFont & initialFont,
  147.                       const WInfoCanvas *canvas=NULL );
  148.  
  149.         /********************************************************
  150.          * Notifications
  151.          ********************************************************/
  152.  
  153.         void OnDialogInitialize( WWindowHandle hWnd, WWindowHandle focus );
  154.  
  155.         /********************************************************
  156.          * Others
  157.          ********************************************************/
  158.  
  159.     private:
  160.         void  *PackCF( WDeviceHandle dc );
  161.         WBool  UnpackCF( WBool ok );
  162.  
  163.         /********************************************************
  164.          * Data members
  165.          ********************************************************/
  166.  
  167.     private:
  168.         void               *_cf;
  169.         WSystemLogicalFont *_logFont;
  170.         WFont               _font;
  171. };
  172.  
  173. #ifndef _WNO_PRAGMA_PUSH
  174. #pragma enum pop;
  175. #pragma pack(pop);
  176. #endif
  177.  
  178. #endif // _WFONTDIALOG_HPP_INCLUDED
  179.