home *** CD-ROM | disk | FTP | other *** search
- #ifndef _IFONTDLG_
- #define _IFONTDLG_
- /*******************************************************************************
- * FILE NAME: IFONTDLG.HPP *
- * *
- * DESCRIPTION: *
- * Declaration of the class(es): *
- * IFontPkg - Package of font information for the font dialog. *
- * IFontDialog - A dialog box to select a font. *
- * *
- * COPYRIGHT: *
- * (C) Copyright IBM Corporation 1992 *
- * All Rights Reserved *
- * Licensed Materials * Property of IBM *
- * *
- * HISTORY: *
- *$Log: R:/IBMCLASS/IBASEAPP/VCS/IFONTDLG.HPV $ *
- //
- // Rev 1.1 25 Oct 1992 16:57:06 nunn
- //changed library name to ICLUI
- //
- // Rev 1.0 25 Oct 1992 11:46:08 tsuji
- //Initial revision.
- *******************************************************************************/
- #ifndef _IVBASE_
- #include <ivbase.hpp>
- #endif
- #ifndef _IDIALOG_
- #include <idialog.hpp>
- #endif
- #ifndef _IHANDLE_
- #include <ihandle.hpp>
- #endif
-
- // Forward declarations for other classes:
- class IFontPkg;
- class IFontDialog;
- class IFontMgr;
- class IString;
-
- class IFontPkg : public IVBase
- {
- /*******************************************************************************
- * This class stores information needed to run the font dialog. *
- * *
- * The type of information includes information about the initial font to *
- * display in the dialog, information about how to display the font dialog, *
- * and information about the selected font. *
- * *
- * Once a font is selected with the font dialog, it can be used by creating *
- * an IFontMgr class with the constructor that takes a font package, or by *
- * calling the method setFont on an existing IFontMgr. *
- * *
- * EXAMPLE: *
- * // To create a font dialog and then create an IFontMgr with the result *
- * IFontPkg fntp; *
- * IFontDlg fntd((IWindow*)0, (IWindow*)pwin, fntp); *
- * if (fntp.buttonPressedId() == DID_OK) { *
- * IFontMgr fntm(fntp); *
- * // The IFontMgr is now set with the new font. *
- * } *
- *******************************************************************************/
- public:
- /*------------------------ CONSTRUCTORS/DESTRUCTORS ----------------------------
- | There are 3 ways to construct instances of this class: |
- | 1. default |
- | Constructs a font package with all default values. |
- | 2. From an IFontMgr |
- | Constructs a font package set with the same font as the font manager. |
- | 3. From another IFontPkg |
- | Constructs a font package set with the same values as another font pkg. |
- ------------------------------------------------------------------------------*/
- IFontPkg ();
- IFontPkg (const IFontMgr& fntm);
- IFontPkg (const IFontPkg& fntp);
-
- virtual
- ~IFontPkg ();
-
- /*------------------- SETTING THE PRESENTATION SPACE ---------------------------
- | These functions provide ways to set the presentation space that will be |
- | used to determine which fonts are available. |
- | setDisplayPS - Sets the display's presentation space. |
- | setPrinterPS - Sets the printer's presentation space. |
- | |
- ------------------------------------------------------------------------------*/
- void
- setDisplayPS (IPresSpaceHandle hpsDisplay),
- setPrinterPS (IPresSpaceHandle hpsPrinter);
-
- /*----------- SETTING INFORMATION ABOUT THE INITIAL FONT -----------------------
- | These functions provide ways to set information about the initial font that |
- | will be displayed in the font dialog. |
- | setFontFamily - Sets the font's family name. |
- | setPointSize - Sets the font's point size. |
- | setFontType - Sets the font type. |
- | setFontTypeMask - Sets the font type mask. |
- | setFontStyle - Sets the font style. |
- | setFontStyleMask - Sets the font style mask. |
- ------------------------------------------------------------------------------*/
- void
- setFontFamily (const char* pszFontFamily),
- setPointSize (unsigned long usPointSize),
- setFontType (unsigned long flFontType),
- setFontTypeMask (unsigned long flFontTypeMask),
- setFontStyle (unsigned long flFontStyle),
- setFontStyleMask (unsigned long flFontStyleMask);
-
- /*----------- GETTING INFORMATION ABOUT THE CHOOSEN FONT -----------------------
- | These functions provide ways to get information about the font that was |
- | selected in the font dialog. |
- | fontFamily - Returns the font's family name. |
- | pointSize - Returns the font's point size. |
- | fontType - Returns the font type. |
- | fontTypeMask - Returns the font type mask. |
- | fontStyle - Returns the font style. |
- | fontStyleMask - Returns the font style mask. |
- | fontWeight - Returns the weight class (boldness) of the font. |
- | fontWidth - Returns the width class of the font. |
- | emHeight - Returns the height of the 'M' square for the font. |
- | xHeight - Returns the height above the baseline for lowercase letters. |
- | externalLeaing - Returns the amount of whitespace between lines of text. |
- | nominalPointSize - Returns the point size the font was made for. |
- | fontAttributes - Returns a pointer to the font attributes structure. |
- ------------------------------------------------------------------------------*/
- IString
- fontFamily () const;
-
- unsigned long
- pointSize () const,
- fontType () const,
- fontTypeMask () const,
- fontStyle () const,
- fontStyleMask () const,
- fontWeight () const,
- fontWidth () const;
-
- long
- emHeight () const,
- xHeight () const,
- externalLeading () const,
- nominalPointSize () const;
-
- void* const
- fontAttributes () const;
-
- /*---------------- SETTING INFORMATION ABOUT THE DIALOG ------------------------
- | These functions provide ways to customize the font dialog. |
- | setDialogTitle - Sets the font dialog's title. |
- | setPreviewText - Sets the text to display in the font sample box |
- | setSizeList - Sets the list of point size choices. |
- | setDialogStyle - Sets the dialog's style. |
- | setDialogFlags - Sets the dialog flags. |
- | setForegroundColor - Sets the foreground color of the preview area. |
- | setBackgroundColor - Sets the background color of the preview area. |
- ------------------------------------------------------------------------------*/
- void
- setDialogTitle (const char* pszTtle),
- setPreviewText (const char* pszPrview),
- setSizeList (const char* pszSizeList),
- setDialogStyle (unsigned long flStyle = 0),
- setDialogFlags (unsigned long flFlags),
- setForegroundColor (long lColor),
- setBackgroundColor (long lColor);
-
- /*---------------- GETTING INFORMATION ABOUT THE DIALOG ------------------------
- | These functions provide ways to get information about the dialog |
- | dialogStyle - Returns the dialog's style. |
- | dialogFlags - Returns the dialog flags. |
- | buttonPressedId - Returns the id of the button that was pressed. |
- | returnCode - Returns the return code, if an error occurred. |
- | foregroundColor - Returns the foreground color of the preview area. |
- | backgroundColor - Returns the background color of the preview area. |
- ------------------------------------------------------------------------------*/
- unsigned long
- dialogStyle () const,
- dialogFlags () const;
-
- long
- buttonPressedId () const,
- returnCode () const,
- foregroundColor () const,
- backgroundColor () const;
-
- /*------------------- CUSTOM MESSAGE PROCESSING --------------------------------
- | These functions are used to notify the dialog that you will be adding a font |
- | handler to the font dialog to process various messages that the font dialog |
- | receives. |
- | |
- | The default is to not enable custom processing and let the font dialog |
- | handle it all. Note you can call enableCustomProc and not add a font |
- | handler. It will act as if there is no default processing. |
- | |
- | enableCustomProc - Signals that you will be adding a font handler. |
- | disableCustomProc - Signals that you will not be adding a font handler. |
- | |
- ------------------------------------------------------------------------------*/
- void
- enableCustomProc (),
- disableCustomProc ();
-
- private:
- /*------------------------------ DATA MEMBERS ----------------------------------
- | pvFontData - pointer to the font dlg data structure. |
- ------------------------------------------------------------------------------*/
- void
- *pvFontData;
-
- friend IFontDialog;
- }; /* IFontPkg */
-
-
-
- class IFontDialog : public IDialogWindow
- {
- /*******************************************************************************
- * This class displays a font dialog for the use to choose a font. *
- * *
- * Once a font is selected with the font dialog, it can be used by creating *
- * an IFontMgr class with the constructor that takes a font package, or by *
- * calling the method setFont on an existing IFontMgr. *
- * *
- * EXAMPLE: *
- * // To create a font dialog and then create an IFontMgr with the result *
- * IFontPkg fntp; *
- * IFontDlg fntd((IWindow*)0, (IWindow*)pwin, fntp); *
- * if (fntp.buttonPressedId() == DID_OK) { *
- * IFontMgr fntm(fntp); *
- * // The IFontMgr is now set with the new font. *
- * } *
- *******************************************************************************/
- public:
- /*------------------------ CONSTRUCTORS/DESTRUCTORS ----------------------------
- | There are 2 ways to construct instances of this class: |
- | 1. default |
- | Constructs a font dialog with the specified parent and owner windows. |
- | 2. Custom dialog |
- | Constructs a font dialog with a custom template or with custom message |
- | processing. The create method must be called to begin processing the |
- | dialog. |
- ------------------------------------------------------------------------------*/
- IFontDialog (const IWindow* pwndParent,
- const IWindow* pwndOwner,
- IFontPkg& fntp);
- IFontDialog (const IWindow* pwndParent,
- const IWindow* pwndOwner,
- IFontPkg& fntp,
- const IResourceId& resid);
-
- virtual
- ~IFontDialog ();
-
- /*-------------------------- SHOW THE DIALOG -----------------------------------
- | This function creates and displays the font dialog. It must be called by |
- | the user of the font dialog if the second constructor is used (custom dlg). |
- ------------------------------------------------------------------------------*/
- unsigned long showDialog(State state=modal);
-
- /*-------------------------- DIALOG HANDLE -------------------------------------
- | This function gives access to the font dialog's window handle. |
- | handle - Returns the font dialog's window handle. |
- ------------------------------------------------------------------------------*/
- virtual const IWindowHandle&
- handle() const;
-
- protected:
- /*----------------------------- IMPLEMENTATION ---------------------------------
- | This function must be called to begin processing the font dialog. |
- | create - Creates the font dialog and begins processing it. |
- ------------------------------------------------------------------------------*/
- void
- create (const IWindow* pwndParent,
- const IWindow* pwndOwner,
- void* pvFontData);
-
- private:
- /*------------------------------ DATA MEMBERS ----------------------------------
- | hwndClDlg - The window handle of the font dialog. |
- | pwndClParent - A pointer to the parent window of the font dialog |
- | pwndClOwner - A pointer to the owner window of the font dialog |
- | pvClFontData - A pointer to the font data structure |
- ------------------------------------------------------------------------------*/
- IWindowHandle
- hwndClDlg;
-
- const IWindow
- *pwndClParent,
- *pwndClOwner;
-
- void
- *pvClFontData;
-
- }; /* IFontDialog */
-
- #endif