home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
OS/2 Shareware BBS: 10 Tools
/
10-Tools.zip
/
ool.zip
/
OOL
/
source
/
xfontdlg.cpp
< prev
next >
Wrap
C/C++ Source or Header
|
1997-04-05
|
3KB
|
94 lines
#include "xfontdlg.h"
#include <stdlib.h>
/*@
@class XFontDialog
@parent XSystemDialog
@type overview
@symbol _
*/
/*@ XFontDialog :: XFontDialog(const XWindow * owner, const char *fontName, const SHORT fontSize, const LONG style, const LONG attr, const char *title, const char *preView)
@group constructors/destructors
@remarks Open the stystem-defined dialog to select a font.
@parameters <t '°' c=2>
°XWindow * owner °owner of the dialog
°char * fontName °default font name
°SHORT fontSize °default font size
°LONG style °style of the font, valid values are:
°LONG atrributes °dialog attributes, valid values are:
<t '°' c=1>
°FDLG_CENTER
°FDLG_HELPBUTTON
°FDLG_APPLYBUTTON
°FDLG_RESETBUTTON
°FDLG_MODELESS
°FDLG_INITFROMFATTRS
°FDLG_BITMAPONLY
°FDLG_VECTORONLY
°FDLG_FIXEDWIDTHONLY
°FDLG_PROPORTIONALONLY
°FDLG_NOSYNTHESIZEDFONTS
°FDLG_NATIONAL_LANGUAGE
</t>
°char * preview °text for the preview-window of the dialog
</t>
*/
XFontDialog :: XFontDialog(const XWindow * owner, const char *fontName, const SHORT fontSize, const LONG style, const LONG attr, const char *title, const char *preView)
{
memset(&fdlg, 0, sizeof(fdlg));
fdlg.cbSize = sizeof(fdlg);
fdlg.pszFamilyname = (PSZ) malloc(FACESIZE);
fdlg.usFamilyBufLen = 100;
fdlg.hpsScreen = WinGetPS(owner->GetHandle());
fdlg.pszTitle = (PSZ) title;
fdlg.pszPreview = (PSZ) preView;
fdlg.fl = attr;
fdlg.clrFore = CLR_BLACK;
fdlg.clrBack = CLR_WHITE;
fdlg.fAttrs.usCodePage = 437;
strcpy((char *) fdlg.pszFamilyname, fontName);
fdlg.fxPointSize = MAKEFIXED(fontSize, 0);
fdlg.flStyle = style;
WinFontDlg(HWND_DESKTOP, owner->GetHandle(), &fdlg);
command = fdlg.lReturn;
}
/*@ XFontDialog::GetFontName(XString * buffer)
@group misc
@remarks Query the name of the selected font.
@parameters XString * buffer buffer to hold the data
*/
void XFontDialog::GetFontName(XString * buffer)
{
SHORT l = strlen((char *) fdlg.fAttrs.szFacename) + 1;
memcpy(buffer->GetBuffer(l), fdlg.fAttrs.szFacename, l);
buffer->ReleaseBuffer(l - 1);
}
/*@ XFontDialog::GetFontSize()
@group misc
@remarks Query the selected font-size
@returns SHORT size
*/
XFontDialog :: ~XFontDialog()
{
free(fdlg.pszFamilyname);
}
/*@ XSystemDialog::GetCommand()
@group misc
@remarks Return the users action.
@returns SHORT action ID of the users action:<BR>
USER_OK<BR>
USER_CANCEL
*/