home *** CD-ROM | disk | FTP | other *** search
/ OS/2 Shareware BBS: 10 Tools / 10-Tools.zip / mod201j.zip / modula2.exe / os2api / winstdfo.def < prev    next >
Text File  |  1994-05-03  |  15KB  |  286 lines

  1. DEFINITION MODULE WINSTDFONT;
  2.  
  3. (************************************************************************
  4.   OS/2 2.0 interface for Presentation Manager
  5.            CUA standard font dialog.
  6.  
  7.   Copyright (c) 1992 by Juergen Neuhoff
  8. *************************************************************************)
  9.  
  10. (*$XL+       Modula-2 language extensions: '_' allowed for symbol names *)
  11. (*$CDECL+    C-style procedures                                         *)
  12. (*$A         default alignment for record fields                        *)
  13.  
  14. FROM OS2DEF        IMPORT TYPEPREFIX, HPS, PSZ, HMODULE, FATTRS, HWND;
  15. FROM WINDEF        IMPORT PFNWP, MPARAM, MRESULT;
  16. FROM GPIDEF        IMPORT FIXED;
  17. FROM WINDIALOGS    IMPORT DID_OK, DID_CANCEL;
  18. FROM WINMESSAGEMGR IMPORT WM_USER;
  19.  
  20. (*************************************************************************)
  21. (*    Font Dialog Creation Structure                                     *)
  22. (*************************************************************************)
  23. TYPE
  24.   FONTDLG                = RECORD    (* fntdlg *)
  25.     CASE                   : TYPEPREFIX OF
  26.     | TRUE                 :
  27.       cbSize               : LONGCARD; (* sizeof(FONTDLG)                 *)
  28.       hpsScreen            : HPS;      (* Screen presentation space       *)
  29.       hpsPrinter           : HPS;      (* Printer presentation space      *)
  30.       pszTitle             : PSZ;      (* Application supplied title      *)
  31.       pszPreview           : PSZ;      (* String to print in preview wndw *)
  32.       pszPtSizeList        : PSZ;      (* Application provided size list  *)
  33.       pfnDlgProc           : PFNWP;    (* Dialog subclass procedure       *)
  34.       pszFamilyname        : PSZ;      (* Family name of font             *)
  35.       fxPointSize          : FIXED;    (* Point size the user selected    *)
  36.       fl                   : LONGCARD; (* FNTS_* flags - dialog styles    *)
  37.       flFlags              : LONGCARD; (* FNTF_* state flags              *)
  38.       flType               : LONGCARD; (* Font type option bits           *)
  39.       flTypeMask           : LONGCARD; (* Mask of which font types to use *)
  40.       flStyle              : LONGCARD; (* The selected style bits         *)
  41.       flStyleMask          : LONGCARD; (* Mask of which style bits to use *)
  42.       clrFore              : LONGINT;  (* Selected foreground color       *)
  43.       clrBack              : LONGINT;  (* Selected background color       *)
  44.       ulUser               : LONGCARD; (* Blank field for application     *)
  45.       lReturn              : LONGINT;  (* Return Value of the Dialog      *)
  46.       lSRC                 : LONGINT;  (* System return code.             *)
  47.       lEmHeight            : LONGINT;  (* Em height of the current font   *)
  48.       lXHeight             : LONGINT;  (* X height of the current font    *)
  49.       lExternalLeading     : LONGINT;  (* External Leading of font        *)
  50.       hMod                 : HMODULE;  (* Module to load custom template  *)
  51.       fAttrs               : FATTRS;   (* Font attribute structure        *)
  52.       sNominalPointSize    : INTEGER;  (* Nominal Point Size of font      *)
  53.       usWeight             : CARDINAL; (* The boldness of the font        *)
  54.       usWidth              : CARDINAL; (* The width of the font           *)
  55.       x                    : INTEGER;  (* X coordinate of the dialog      *)
  56.       y                    : INTEGER;  (* Y coordinate of the dialog      *)
  57.       usDlgId              : CARDINAL; (* ID of a custom dialog template  *)
  58.       usFamilyBufLen       : CARDINAL; (* Length of family buffer provided*)
  59.       usReserved           : CARDINAL; (* reserved                        *)
  60.     | FALSE                :
  61.       Size                 : LONGCARD; (* sizeof(FONTDLG)                 *)
  62.       ScreenPresHandle     : HPS;      (* Screen presentation space       *)
  63.       PrinterPresHandle    : HPS;      (* Printer presentation space      *)
  64.       Title                : PSZ;      (* Application supplied title      *)
  65.       Preview              : PSZ;      (* String to print in preview wndw *)
  66.       PtSizeList           : PSZ;      (* Application provided size list  *)
  67.       DlgProc              : PFNWP;    (* Dialog subclass procedure       *)
  68.       Familyname           : PSZ;      (* Family name of font             *)
  69.       PointSize            : FIXED;    (* Point size the user selected    *)
  70.       StyleFlags           : LONGCARD; (* FNTS_* flags - dialog styles    *)
  71.       StateFlags           : LONGCARD; (* FNTF_* state flags              *)
  72.       Type                 : LONGCARD; (* Font type option bits           *)
  73.       TypeMask             : LONGCARD; (* Mask of which font types to use *)
  74.       Style                : LONGCARD; (* The selected style bits         *)
  75.       StyleMask            : LONGCARD; (* Mask of which style bits to use *)
  76.       ForeColor            : LONGINT;  (* Selected foreground color       *)
  77.       BackColor            : LONGINT;  (* Selected background color       *)
  78.       User                 : LONGCARD; (* Blank field for application     *)
  79.       Return               : LONGINT;  (* Return Value of the Dialog      *)
  80.       SRC                  : LONGINT;  (* System return code.             *)
  81.       EmHeight             : LONGINT;  (* Em height of the current font   *)
  82.       XHeight              : LONGINT;  (* X height of the current font    *)
  83.       ExternalLeading      : LONGINT;  (* External Leading of font        *)
  84.       ModHandle            : HMODULE;  (* Module to load custom template  *)
  85.       Attrs                : FATTRS;   (* Font attribute structure        *)
  86.       NominalPointSize     : INTEGER;  (* Nominal Point Size of font      *)
  87.       Weight               : CARDINAL; (* The boldness of the font        *)
  88.       Width                : CARDINAL; (* The width of the font           *)
  89.       xPos                 : INTEGER;  (* X coordinate of the dialog      *)
  90.       yPos                 : INTEGER;  (* Y coordinate of the dialog      *)
  91.       DlgId                : CARDINAL; (* ID of a custom dialog template  *)
  92.       FamilyBufLen         : CARDINAL; (* Length of family buffer provided*)
  93.       Reserved             : CARDINAL; (* reserved                        *)
  94.     END;                   END;
  95.   PFONTDLG               = POINTER TO FONTDLG;
  96.  
  97. (*************************************************************************)
  98. (*    Font Dialog Style Flags                                            *)
  99. (*************************************************************************)
  100. CONST
  101.   FNTS_CENTER               = 00000001H; (* Center in owner dialog*)
  102.   FNTS_CUSTOM               = 00000002H; (* Use custom template   *)
  103.   FNTS_OWNERDRAWPREVIEW     = 00000004H; (* Allow app to draw     *)
  104.   FNTS_HELPBUTTON           = 00000008H; (* Display Help button   *)
  105.   FNTS_APPLYBUTTON          = 00000010H; (* Display Apply button  *)
  106.   FNTS_RESETBUTTON          = 00000020H; (* Display Reset button  *)
  107.   FNTS_MODELESS             = 00000040H; (* Make dialog modeless  *)
  108.   FNTS_INITFROMFATTRS       = 00000080H; (* Initialize from FATTRs*)
  109.   FNTS_BITMAPONLY           = 00000100H; (* Only allow bitmap font*)
  110.   FNTS_VECTORONLY           = 00000200H; (* Only allow vector font*)
  111.   FNTS_FIXEDWIDTHONLY       = 00000400H; (* Only allow monospaced *)
  112.   FNTS_PROPORTIONALONLY     = 00000800H; (* Only proportional font*)
  113.   FNTS_NOSYNTHESIZEDFONTS   = 00001000H; (* Don't synthesize fonts*)
  114.  
  115. (*************************************************************************)
  116. (*    Font Dialog Flags                                                  *)
  117. (*************************************************************************)
  118. CONST
  119.   FNTF_NOVIEWSCREENFONTS    = 1;
  120.   FNTF_NOVIEWPRINTERFONTS   = 2;
  121.   FNTF_SCREENFONTSELECTED   = 4;
  122.   FNTF_PRINTERFONTSELECTED  = 8;
  123.  
  124. (*************************************************************************)
  125. (*    Color code definitions                                             *)
  126. (*************************************************************************)
  127. CONST
  128.   CLRC_FOREGROUND           = 1;
  129.   CLRC_BACKGROUND           = 2;
  130.  
  131. (*************************************************************************)
  132. (*    Filter List message string identifiers                             *)
  133. (*************************************************************************)
  134. CONST
  135.   FNTI_BITMAPFONT           = 0001H;
  136.   FNTI_VECTORFONT           = 0002H;
  137.   FNTI_FIXEDWIDTHFONT       = 0004H;
  138.   FNTI_PROPORTIONALFONT     = 0008H;
  139.   FNTI_SYNTHESIZED          = 0010H;
  140.   FNTI_DEFAULTLIST          = 0020H;
  141.   FNTI_FAMILYNAME           = 0100H;
  142.   FNTI_STYLENAME            = 0200H;
  143.   FNTI_POINTSIZE            = 0400H;
  144.  
  145. (*************************************************************************)
  146. (*    Error Return Codes from dialog (self defining)                     *)
  147. (*************************************************************************)
  148. CONST
  149.   FNTS_SUCCESSFUL            =  0;
  150.   FNTS_ERR_INVALID_DIALOG    =  3;
  151.   FNTS_ERR_ALLOC_SHARED_MEM  =  4;
  152.   FNTS_ERR_INVALID_PARM      =  5;
  153.   FNTS_ERR_OUT_OF_MEMORY     =  7;
  154.   FNTS_ERR_INVALID_VERSION   = 10;
  155.   FNTS_ERR_DIALOG_LOAD_ERROR = 12;
  156.  
  157. (*************************************************************************)
  158. (*    Font Dialog Messages                                               *)
  159. (*************************************************************************)
  160. CONST
  161.   FNTM_FACENAMECHANGED       = WM_USER+50;    (* mp1 = PSZ pszFacename   *)
  162.   FNTM_POINTSIZECHANGED      = WM_USER+51;    (* mp1 = PSZ pszPointSize, *)
  163.                                               (* mp2 = FIXED fxPointSize *)
  164.   FNTM_STYLECHANGED          = WM_USER+52;    (* mp1 = PSTYLECHANGE pstyc*)
  165.   FNTM_COLORCHANGED          = WM_USER+53;    (* mp1 = LONG clr          *)
  166.                                               (* mp2 = USHORT codeClr    *)
  167.   FNTM_UPDATEPREVIEW         = WM_USER+54;    (* mp1 = HWND hWndPreview  *)
  168.   FNTM_FILTERLIST            = WM_USER+55;    (* mp1 = PSZ pszFacename   *)
  169.                                               (* mp2 = USHORT usStrStyle *)
  170.                                               (* mr=TRUE(Add),FALSE(Dont)*)
  171.  
  172. (*************************************************************************)
  173. (*    Stylechange message parameter structure                            *)
  174. (*************************************************************************)
  175. TYPE
  176.   STYLECHANGE                = RECORD         (* stylc *)
  177.     CASE                       : TYPEPREFIX OF
  178.     | TRUE                     :
  179.       usWeight                 : CARDINAL;
  180.       usWeightOld              : CARDINAL;
  181.       usWidth                  : CARDINAL;
  182.       usWidthOld               : CARDINAL;
  183.       flType                   : LONGCARD;
  184.       flTypeOld                : LONGCARD;
  185.       flTypeMask               : LONGCARD;
  186.       flTypeMaskOld            : LONGCARD;
  187.       flStyle                  : LONGCARD;
  188.       flStyleOld               : LONGCARD;
  189.       flStyleMask              : LONGCARD;
  190.       flStyleMaskOld           : LONGCARD;
  191.     | FALSE                    :
  192.       Weight                   : CARDINAL;
  193.       WeightOld                : CARDINAL;
  194.       Width                    : CARDINAL;
  195.       WidthOld                 : CARDINAL;
  196.       Type                     : LONGCARD;
  197.       TypeOld                  : LONGCARD;
  198.       TypeMask                 : LONGCARD;
  199.       TypeMaskOld              : LONGCARD;
  200.       Style                    : LONGCARD;
  201.       StyleOld                 : LONGCARD;
  202.       StyleMask                : LONGCARD;
  203.       StyleMaskOld             : LONGCARD;
  204.     END;                       END;
  205.   PSTYLECHANGE               = POINTER TO STYLECHANGE;
  206.  
  207. (*************************************************************************)
  208. (*    Font Dialog Function Prototypes                                    *)
  209. (*************************************************************************)
  210.  
  211. PROCEDURE WinFontDlg
  212. ( ParentWinHandle            : HWND;
  213.   OwnerWinHandle             : HWND;
  214.   VAR FontDlg                : FONTDLG
  215. )                            : HWND;
  216.  
  217. PROCEDURE WinDefFontDlgProc
  218. ( DlgWinHandle               : HWND;
  219.   MsgId                      : LONGCARD;
  220.   Param1                     : MPARAM;
  221.   Param2                     : MPARAM
  222. )                            : MRESULT;
  223.  
  224. (*************************************************************************)
  225. (*    font dialog and control id's                                       *)
  226. (*************************************************************************)
  227. CONST
  228.   DID_FONT_DIALOG          = 300;
  229.   DID_NAME                 = 301;
  230.   DID_STYLE                = 302;
  231.   DID_DISPLAY_FILTER       = 303;
  232.   DID_PRINTER_FILTER       = 304;
  233.   DID_SIZE                 = 305;
  234.   DID_SAMPLE               = 306;
  235.   DID_OUTLINE              = 307;
  236.   DID_UNDERSCORE           = 308;
  237.   DID_STRIKEOUT            = 309;
  238.   DID_HELP_BUTTON          = 310;
  239.   DID_APPLY_BUTTON         = 311;
  240.   DID_RESET_BUTTON         = 312;
  241.   DID_OK_BUTTON            = DID_OK;
  242.   DID_CANCEL_BUTTON        = DID_CANCEL;
  243.   DID_NAME_PREFIX          = 313;
  244.   DID_STYLE_PREFIX         = 314;
  245.   DID_SIZE_PREFIX          = 315;
  246.   DID_SAMPLE_GROUPBOX      = 316;
  247.   DID_EMPHASIS_GROUPBOX    = 317;
  248.  
  249. (*************************************************************************)
  250. (*    Stringtable id's                                                   *)
  251. (*************************************************************************)
  252. CONST
  253.   IDS_FONT_SAMPLE          = 350;
  254.   IDS_FONT_BLANK           = 351;
  255.   IDS_FONT_KEY_0           = 352;
  256.   IDS_FONT_KEY_9           = 353;
  257.   IDS_FONT_KEY_SEP         = 354;
  258.   IDS_FONT_DISP_ONLY       = 355;
  259.   IDS_FONT_PRINTER_ONLY    = 356;
  260.   IDS_FONT_COMBINED        = 357;
  261.   IDS_FONT_WEIGHT1         = 358;
  262.   IDS_FONT_WEIGHT2         = 359;
  263.   IDS_FONT_WEIGHT3         = 360;
  264.   IDS_FONT_WEIGHT4         = 361;
  265.   IDS_FONT_WEIGHT5         = 362;
  266.   IDS_FONT_WEIGHT6         = 363;
  267.   IDS_FONT_WEIGHT7         = 364;
  268.   IDS_FONT_WEIGHT8         = 365;
  269.   IDS_FONT_WEIGHT9         = 366;
  270.   IDS_FONT_WIDTH1          = 367;
  271.   IDS_FONT_WIDTH2          = 368;
  272.   IDS_FONT_WIDTH3          = 369;
  273.   IDS_FONT_WIDTH4          = 370;
  274.   IDS_FONT_WIDTH5          = 371;
  275.   IDS_FONT_WIDTH6          = 372;
  276.   IDS_FONT_WIDTH7          = 373;
  277.   IDS_FONT_WIDTH8          = 374;
  278.   IDS_FONT_WIDTH9          = 375;
  279.   IDS_FONT_OPTION0         = 376;
  280.   IDS_FONT_OPTION1         = 377;
  281.   IDS_FONT_OPTION2         = 378;
  282.   IDS_FONT_OPTION3         = 379;
  283.   IDS_FONT_POINT_SIZE_LIST = 380;
  284.  
  285. END WINSTDFONT.
  286.