12#if !defined(DEFAULT_GUI_FONT)
13# define DEFAULT_GUI_FONT 17
16#if defined(__BORLANDC__)
49 int height,
int width,
int escapement,
int orientation,
55 Handle = ::CreateFont(height, width, escapement, orientation, weight,
56 italic, underline, strikeout, charSet,
57 outputPrecision, clipPrecision, quality,
58 pitchAndFamily, facename.length() > 0 ? facename.c_str() :
nullptr);
59 WARNX(OwlGDI, !
Handle, 0,
_T(
"Cannot create TFont (") << facename <<
60 _T(
" ") << height <<
_T(
"pt)"));
69TFont::TFont(
int height,
int width,
int escapement,
int orientation,
73 uint8 outputPrecision,
79 Handle = ::CreateFont(height, width, escapement, orientation, weight,
80 italic, underline, strikeout, charSet,
81 outputPrecision, clipPrecision, quality,
82 pitchAndFamily, facename.length() > 0 ? facename.c_str() :
nullptr);
83 WARNX(OwlGDI, !
Handle, 0,
_T(
"Cannot create TFont (") << facename <<
84 _T(
" ") << height <<
_T(
"pt)"));
94 Handle = ::CreateFontIndirect(&logFont);
95 WARNX(OwlGDI, !
Handle, 0,
"Cannot create TFont from logfont @" <<
static_cast<const void*
>(&logFont));
100#if defined(OWL5_COMPAT)
109 Handle = ::CreateFontIndirect((LPLOGFONT)logFont);
110 WARNX(OwlGDI, !
Handle, 0,
_T(
"Cannot create TFont from logfont @") <<
static_cast<const void*
>(logFont));
130#if !defined(NO_GDI_SHARE_HANDLES)
138 Handle = ::CreateFontIndirect(&logFont);
139 WARNX(OwlGDI, !
Handle, 0,
_T(
"Cannot create TFont from TFont @") <<
140 hex <<
uint32(LPVOID(&src)));
258 return f.GetObject();
263 ICONMETRICS im = {
sizeof(im)};
264 bool r = SystemParametersInfo(SPI_GETICONMETRICS,
sizeof(im), &im, 0);
271 typedef LOGFONT (NONCLIENTMETRICS::*TNonClientMetricsMember);
272 TNonClientMetricsMember font =
274 (element ==
TDefaultGuiFont::sfiSmallCaption) ? &NONCLIENTMETRICS::lfSmCaptionFont :
275 (element ==
TDefaultGuiFont::sfiMenu) ? &NONCLIENTMETRICS::lfMenuFont :
276 (element ==
TDefaultGuiFont::sfiStatus) ? &NONCLIENTMETRICS::lfStatusFont :
277 (element ==
TDefaultGuiFont::sfiMessage) ? &NONCLIENTMETRICS::lfMessageFont :
281 NONCLIENTMETRICS ncm = {
sizeof(ncm)};
282 bool r = SystemParametersInfo(SPI_GETNONCLIENTMETRICS,
sizeof(ncm), &ncm, 0);
297 :
TFont(GetSystemFont_(element))
#define WARNX(group, condition, level, message)
#define PRECONDITION(condition)
#define DIAG_DECLARE_GROUP(group)
TDC is the root class for GDI DC wrappers.
void SelectObject(const TBrush &brush)
Selects the given GDI brush object into this DC.
bool GetTextExtent(const tstring &str, int stringLen, TSize &size) const
Computes the extent (width and height) in logical units of the text line consisting of stringLen char...
virtual void RestoreFont()
Restores the original GDI font object to this DC.
bool GetTextMetrics(TEXTMETRIC &metrics) const
Fills the metrics structure with metrics data for the current font on this DC.
Encapsulates the system font used for a specific GUI element, e.g. icon, caption, menu,...
TSystemFontId
Defines the various GUI elements for which a default font can be created.
@ sfiCaption
Represents NONCLIENTMETRICS::lfCaptionFont.
@ sfiLegacyDefault
Represents the font returned by GetStockObject (DEFAULT_GUI_FONT).
@ sfiIcon
Represents ICONMETRICS::lfFont.
TDefaultGuiFont(TSystemFontId=sfiLegacyDefault)
Create a wrapper for the given system font.
TFont derived from TGdiObject provides constructors for creating font objects from explicit informati...
tstring GetFaceName() const
Returns the font's name.
uint8 GetPitchAndFamily() const
Returns the pitch and family flags for this logical font.
LOGFONT GetObject() const
Returns information about this font object.
TSize GetTextExtent(const tstring &text) const
Returns the extent of a given string using this particular font.
TEXTMETRIC GetTextMetrics() const
Retrieves information about this font when selected in a screen DC.
TEXTMETRIC GetTextMetrics(TDC &dc) const
Retrieves information about this font when selected in the specified dc.
TFont(HFONT handle, TAutoDelete autoDelete=NoAutoDelete)
TFont encapsulates an HFONT.
void CheckValid(uint resId=IDS_GDIFAILURE)
int GetObject(int count, void *object) const
Retrieve the object's attributes into a buffer.
bool ShouldDelete
Should object delete GDI handle in dtor?
static void RefAdd(HANDLE handle, TType type)
RefAdd adds a reference entry for the object with the given handle and type.
TGdiObject()
This default constructor sets Handle to 0 and ShouldDelete to true.
HANDLE Handle
GDI handle of this object.
Derived from TWindowDC, TScreenDC is a DC class that provides direct access to the screen bitmap.
The tagSIZE struct is defined as.
TXGdi(uint resId=IDS_GDIFAILURE, HANDLE handle=0)
Constructs a TXGdi object with a default IDS_GDIFAILURE message.
Definition of abstract GDI object class and derived classes.
TAutoDelete
Flag for Handle ctors to control Handle deletion in dtor.
Object Windows Library (OWLNext Core).
void InUse(const T &arg)
Handy utility to avoid compiler warnings about unused parameters.
Definition of TUIMetric, a UI metrics provider class.