41 _T(
" from handle ") <<
static_cast<void*
>(
handle));
64 _T(
" from handle") <<
static_cast<void*
>(
handle));
94 _T(
" pen @") << (
void*)&
pen);
116 _T(
" brush @") << (
void*)&
brush);
138 _T(
" font @") << (
void*)&
font);
209 TRACEX(
OwlGDI, 1,
_T(
"TDC::SelectStockObject @") << (
void*)
this <<
210 _T(
" index ") << index);
264 OrgPalette =
nullptr;
335 int width =
r.Width() -
xThick;
336 int height =
r.Height() -
yThick;
354 return ::SaveDC(
GetHDC());
576 return ::TextOut(
GetHDC(), x, y, str.c_str(), count>=0 ? count :
static_cast<int>(str.length()));
604 const tstring& str,
int count,
const int *
dx)
606 const int strLength =
static_cast<int>(str.length());
638 count >= 0 ? count :
static_cast<int>(str.length()),
848 TGetTextFace(
const TDC&
d) : dc(
d) {}
#define PRECONDITION(condition)
#define DIAG_DECLARE_GROUP(group)
#define TRACEX(group, level, message)
TBitmap is the GDI bitmap class derived from TGdiObject.
The GDI Brush class is derived from TGdiObject.
Class wrapper for management of color values.
static const TColor Sys3dHilight
The symbolic system color value for highlighted 3-dimensional display elements (for edges facing the ...
static const TColor Sys3dDkShadow
The symbolic system color value for dark shadow regions of 3-dimensional display elements.
static const TColor SysWindowFrame
The symbolic system color value for the frame around each window.
static const TColor Sys3dShadow
The symbolic system color value for the shadow regions of 3-dimensional display elements (for edges f...
static const TColor Sys3dFace
The symbolic system color value for the face color of 3-dimensional display elements.
static const TColor Sys3dLight
The symbolic system color value for the light color for 3-dimensional display elements (for edges fac...
static const TColor SysWindow
The symbolic system color value for the background of each window.
TDC is the root class for GDI DC wrappers.
virtual bool SetViewportOrg(const TPoint &origin, TPoint *oldOrg=nullptr)
Sets this DC's viewport origin to the given origin value, and saves the previous origin in oldOrg.
int GetTextFaceLength() const
Retrieves the length of the typeface name for the current font on this DC.
int GetTextFace(int count, TCHAR *facename) const
Retrieves the typeface name for the current font on this DC.
void RestoreBitmap()
Restores the original GDI bitmap object into this DC.
@ EdgeOuter
Mask for outer edge bits.
@ SunkenOuter
Sunken outer edge only.
@ EdgeInner
Mask for inner edge bits.
virtual bool TextOut(int x, int y, const tstring &str, int count=-1)
Draws up to count characters of the given null-terminated string in the current font on this DC.
virtual int DrawTextEx(TCHAR *str, int count, TRect *=nullptr, uint format=0, LPDRAWTEXTPARAMS=nullptr)
Formats and draws in the given rectangle, r, up to count characters of the null-terminated string usi...
bool DrawEdge(const TRect &frame, uint edge, uint flags)
void Init()
Sets OrgBrush, OrgPen, OrgFont, OrgBitmap, and OrgPalette to 0, and sets ShouldDelete to true.
virtual int GetDeviceCaps(int index) const
Used under WIN3.1 or later, GetDeviceCaps returns capability information about this DC.
virtual bool ScaleWindowExt(int xNum, int xDenom, int yNum, int yDenom, TSize *oldExtent=nullptr)
Modifies this DC's window extents relative to the current values.
void SelectObject(const TBrush &brush)
Selects the given GDI brush object into this DC.
void RestorePalette()
Restores the original GDI palette object to this DC.
virtual bool ScaleViewportExt(int xNum, int xDenom, int yNum, int yDenom, TSize *oldExtent=nullptr)
Modifies this DC's viewport extents relative to the current values.
TEXTMETRIC GetTextMetrics() const
Functional style overload.
virtual int SetMapMode(int mode)
Sets the current window mapping mode of this DC to mode.
void RestorePen()
Restores the original GDI pen object to this DC.
void PaintFrame(const TRect &fr, uint flags, const TColor &tlColor, const TColor &brColor)
bool OffsetWindowOrg(const TPoint &delta, TPoint *oldOrg=nullptr)
Modifies this DC's window origin relative to the current values.
@ Soft
Soft edge look for buttons.
@ Flat
Flat instead of 3d for use in non-3d windows.
TDC()
for derived classes only
virtual bool RestoreDC(int savedDC=-1)
Restores the given savedDC.
virtual bool ExtTextOut(int x, int y, uint16 options, const TRect *r, const tstring &str, int count=-1, const int *dx=nullptr)
Draws up to count characters of the given null-terminated string in the current font on this DC.
virtual HDC GetAttributeHDC() const
Returns the attributes of the DC object.
HANDLE GetCurrentObject(uint objectType) const
Returns a handle to the currently selected object of the given objectType associated with this DC.
tstring GetTextFace() const
virtual TColor SetBkColor(const TColor &color)
Sets the current background color of this DC to the given color value or the nearest available.
virtual bool ResetDC(const DEVMODE &devMode)
Updates this DC using data in the given devMode structure.
virtual bool GrayString(const TBrush &brush, GRAYSTRINGPROC outputFunc, const tstring &str, int count, const TRect &r)
Draws in the given rectangle (r) up to count characters of gray text from string using the given brus...
virtual bool SetWindowExt(const TSize &extent, TSize *oldExtent=nullptr)
Sets this DC's window x- and y-extents to the given extent values.
virtual bool TabbedTextOut(const TPoint &p, const tstring &str, int count, int numPositions, const int *positions, int tabOrigin, TSize &size)
Draws up to count characters of the given null-terminated string in the current font on this DC.
void RestoreBrush()
Restores the original GDI brush object to this DC.
virtual void RestoreFont()
Restores the original GDI font object to this DC.
void RestoreObjects()
Restores all the original GDI objects to this DC.
virtual void SelectStockObject(int index)
Selects into the DC a predefined stock pen, brush, font, or palette.
bool DrawFrameControl(TRect lpRect, UINT nType, UINT nState)
virtual bool OffsetViewportOrg(const TPoint &delta, TPoint *oldOrg=nullptr)
Modifies this DC's viewport origin relative to the current values.
virtual TColor SetTextColor(const TColor &color)
Sets the current text color of this DC to the given color value.
bool SetWindowOrg(const TPoint &origin, TPoint *oldOrg=nullptr)
Sets the origin of the window associated with this DC to the given origin value, and saves the previo...
void RestoreTextBrush()
Restores the original GDI text brush object to this DC.
void OWLFastWindowFrame(TBrush &brush, TRect &r, int xWidth, int yWidth, uint32 rop=PATCOPY)
Draws a frame of the specified size and thickness with the given brush.
bool PatBlt(int x, int y, int w, int h, uint32 rop=PATCOPY)
virtual ~TDC()
Default dtor does not delete Handle Calls RestoreObjects.
HANDLE Handle
< make this function available to derivatives
virtual bool SetViewportExt(const TSize &extent, TSize *oldExtent=nullptr)
Sets this DC's viewport x- and y-extents to the given extent values.
HDC GetHDC() const
Return the handle of the device context.
virtual int SaveDC() const
Saves the current state of this DC on a context stack.
int DrawText(const tstring &str, int count, const TRect &, uint16 format=0)
Overload for const TRect& For obvious reasons, this overload does not support the DT_CALCRECT format ...
TFont derived from TGdiObject provides constructors for creating font objects from explicit informati...
Root and abstract class for Windows object wrappers.
static void RefInc(HANDLE handle)
Increments by 1 the reference count of the object associated with the given handle.
static void RefDec(HANDLE handle, bool wantDelete)
Decrements this object's reference count by 1 and deletes the object when the reference count reaches...
TPalette is the GDI Palette class derived from TGdiObject.
TPen is derived from TGdiObject.
TPoint is a support class, derived from tagPOINT.
TRect is a mathematical class derived from tagRect.
int Height() const
Returns the height of this rectangle (bottom - top).
TRect & Inflate(int dx, int dy)
Inflates a rectangle inflated by the given delta arguments.
int Width() const
Returns the width of this rectangle (right - left).
The tagSIZE struct is defined as.
Describes an exception resulting from GDI failures such as creating too many TWindow device contexts ...
Definition of GDI DC encapsulation classes: TDC, TWindowDC, TScreenDC, TDesktopDC,...
TAutoDelete
Flag for Handle ctors to control Handle deletion in dtor.
Object Windows Library (OWLNext Core)
tstring CopyText(int size, TGetText get_text)
Copies text from a C-string (null-terminated character array) into a string object,...