20 inline bool SetWindowExt(HDC hdc,
int w,
int h) {return ::SetWindowExtEx(hdc, w, h,
nullptr);}
21 inline bool SetWindowOrg(HDC hdc,
int w,
int h) {return ::SetWindowOrgEx(hdc, w, h,
nullptr);}
22 inline bool SetViewportExt(HDC hdc,
int w,
int h) {return ::SetViewportExtEx(hdc, w, h,
nullptr);}
23 inline bool SetViewportOrg(HDC hdc,
int x,
int y) {return ::SetViewportOrgEx(hdc, x, y,
nullptr);}
60 CurrentPreviewFont(nullptr)
90 delete CurrentPreviewFont;
102 if ((HFONT)newFont) {
105 TFont* oldPreviewF = CurrentPreviewFont;
106 CurrentPreviewFont =
new TFont(lf);
111 if ((HFONT)(*CurrentPreviewFont) != PrnFont) {
112 PrnFont = (HFONT)(*CurrentPreviewFont);
126 case ANSI_FIXED_FONT:
128 case DEVICE_DEFAULT_FONT:
131 case SYSTEM_FIXED_FONT: {
132 HFONT stockFont = (HFONT)GetStockObject(index);
133 if (stockFont != PrnFont) {
185 return tm.tmHeight < 0
187 : -(tm.tmHeight - tm.tmInternalLeading);
222 ::GetObject(PrnFont,
sizeof(lf), &lf);
228 lf.lfWidth = tm.tmAveCharWidth;
229 lf.lfWeight = tm.tmWeight;
230 lf.lfItalic = tm.tmItalic;
231 lf.lfUnderline = tm.tmUnderlined;
232 lf.lfStrikeOut = tm.tmStruckOut;
233 lf.lfCharSet = tm.tmCharSet;
234 lf.lfOutPrecision = OUT_TT_PRECIS;
235 lf.lfClipPrecision = CLIP_DEFAULT_PRECIS;
236 lf.lfQuality = DRAFT_QUALITY;
240 lf.lfPitchAndFamily =
uint8((tm.tmPitchAndFamily & 0x0003) | FF_DONTCARE);
241 PrnDC.
GetTextFace(
sizeof(lf.lfFaceName)/
sizeof(lf.lfFaceName[0]), lf.lfFaceName);
249 if (abs(abs(
static_cast<int>(lf.lfHeight)) - abs(
GlyphHeight(tm))) > 2) {
250 if (lf.lfPitchAndFamily & FF_DECORATIVE)
251 lf.lfPitchAndFamily = DEFAULT_PITCH | FF_DECORATIVE;
253 lf.lfPitchAndFamily = DEFAULT_PITCH | FF_DONTCARE;
254 lf.lfFaceName[0] = 0;
290 TSize we(MulDiv(page.cx, pwe.cx, pve.cx), MulDiv(page.cy, pwe.cy, pve.cy));
295 ::SetWindowExtEx(
GetHDC(), we.cx, we.cy,
nullptr);
296 ::SetViewportExtEx(
GetHDC(), ve.cx, ve.cy,
nullptr);
317 TPoint vo(MulDiv(pvo.x, ve.cx, page.cx), MulDiv(pvo.y, ve.cy, page.cy));
325 ::SetWindowOrgEx(
GetHDC(), wo.x, wo.y,
nullptr);
326 ::SetViewportOrgEx(
GetHDC(), vo.x, vo.y,
nullptr);
479 PrintExtent(printExtent),
483 Attr.Style = WS_CHILD | WS_BORDER | WS_VISIBLE;
513 Printout.SetPrintParams(&pdc, PrintExtent);
515 if (Printout.HasPage(PageNum)) {
516 Printout.BeginPrinting();
517 Printout.BeginDocument(PageNum, PageNum,
pfBoth);
522 Printout.PrintPage(PageNum, clip,
pfBoth);
524 Printout.EndDocument();
525 Printout.EndPrinting();
528 dc.
PatBlt(0, 0, Attr.W, Attr.H, WHITENESS);
Class wrapper for management of color values.
static const TColor White
Static TColor object with fixed Value set by RGB(255, 255, 255).
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 GetTextFace(int count, TCHAR *facename) const
Retrieves the typeface name for the current font on this DC.
TColor GetBkColor() const
Returns the current background color of this DC.
virtual int GetDeviceCaps(int index) const
Used under WIN3.1 or later, GetDeviceCaps returns capability information about this DC.
bool GetViewportOrg(TPoint &point) const
The first version sets in the point argument the x- and y-extents (in device-units) of this DC's view...
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.
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.
virtual int SetMapMode(int mode)
Sets the current window mapping mode of this DC to mode.
HANDLE GetCurrentObject(uint objectType) const
Returns a handle to the currently selected object of the given objectType associated with this DC.
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 SetWindowExt(const TSize &extent, TSize *oldExtent=nullptr)
Sets this DC's window x- and y-extents to the given extent values.
int SelectClipRgn(const TRegion ®ion)
Selects the given region as the current clipping region for this DC.
virtual void RestoreFont()
Restores the original GDI font object to this DC.
bool GetViewportExt(TSize &extent) const
The first version retrieves this DC's current viewport's x- and y-extents (in device units) and place...
virtual void SelectStockObject(int index)
Selects into the DC a predefined stock pen, brush, font, or palette.
bool GetWindowOrg(TPoint &point) const
Places in point the x- and y-coordinates of the origin of the window associated with this DC.
virtual bool OffsetViewportOrg(const TPoint &delta, TPoint *oldOrg=nullptr)
Modifies this DC's viewport origin relative to the current values.
bool GetTextMetrics(TEXTMETRIC &metrics) const
Fills the metrics structure with metrics data for the current font on this DC.
virtual TColor SetTextColor(const TColor &color)
Sets the current text color of this DC to the given color value.
TColor GetTextColor() const
Returns the current text color of this DC.
bool GetWindowExt(TSize &extent) const
Retrieves this DC's window current x- and y-extents (in device units).
bool PatBlt(int x, int y, int w, int h, uint32 rop=PATCOPY)
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.
TFont derived from TGdiObject provides constructors for creating font objects from explicit informati...
LOGFONT GetObject() const
Returns information about this font object.
TFont(HFONT handle, TAutoDelete autoDelete=NoAutoDelete)
TFont encapsulates an HFONT.
TPoint is a support class, derived from tagPOINT.
HDC GetAttributeHDC() const
Overriden to return printer's HDC.
TPrintDC & PrnDC
DC of 'real' device (aka TargetDevice) whose output we're previewing.
TPreviewDCBase(TDC &screen, TPrintDC &printdc)
Constructs a basic Preview DC.
TPreviewPage encapsulates a window which displays print-preview data.
void Paint(TDC &, bool, TRect &) override
Using a TPrintPreviewDC, 'print' the current page (PageNum) of Printout onto the window DC provided.
TPreviewPage(TWindow *parent, TPrintout &printout, TPrintDC &prndc, TSize &printExtent, int pagenum=1)
Constructs a TPreviewPage object where parent is the parent window, printout is a reference to the co...
void EvSize(uint sizeType, const TSize &size)
Invalidates the entire window when the size of the page displayed in the preview window changes.
void SetPageNumber(int newNum)
Sets newNum to the number of the page currently displayed in the preview window.
A DC class that provides access to a printer.
TPrintDC(HDC handle, TAutoDelete autoDelete=NoAutoDelete)
Creates a TPrintDC object for the DC given by handle.
Derived from TPrintDC, TPrintPreviewDC maps printer device coordinates to logical screen coordinates.
~TPrintPreviewDC()
Destroys a TPrintPreviewDC object.
bool SDPtoLP(TPoint *points, int count=1) const
Converts each of the count points in the points array from screen device points to logical points of ...
TColor SetBkColor(const TColor &color)
Sets the current background color of this DC to the given color value or the nearest available.
void RestoreFont()
Restores the original GDI font object to this DC.
bool ScaleWindowExt(int xNum, int xDenom, int yNum, int yDenom, TSize *oldExtent=0)
Modifies this DC's window extents relative to the current values.
virtual void ReOrg()
Gets the x- and y- extents of the viewport, equalizes the logical and screen points,...
TColor SetTextColor(const TColor &color)
Sets the current text color of this DC to the given color value.
virtual void ReScale()
Maps the points of the printer DC to the screen DC.
bool SetWindowExt(const TSize &extent, TSize *oldExtent=0)
Sets the DC's window x- and y-extents to the given extent values.
void SelectStockObject(int index)
Retrieves a handle to a predefined stock font.
TPrintPreviewDC(TDC &screen, TPrintDC &printdc, const TRect &client, const TRect &clip)
TPrintPreviewDC's constructor takes a screen DC as well as a printer DC.
virtual void SyncFont()
Sets the screen font equal to the current printer font.
bool ScaleViewportExt(int xNum, int xDenom, int yNum, int yDenom, TSize *oldExtent=0)
Modifies this DC's viewport extents relative to the current values.
bool SetViewportOrg(const TPoint &origin, TPoint *oldOrg=0)
Sets the printer DC's viewport origin to the given origin value, and saves the previous origin in old...
bool OffsetViewportOrg(const TPoint &delta, TPoint *oldOrg=0)
Modifies this DC's viewport origin relative to the current values.
int SetMapMode(int mode)
Sets the current window mapping mode of this DC to mode.
int GetDeviceCaps(int index) const
GetDeviceCaps returns capability information, such as font and pitch attributes, about the printer DC...
void SelectObject(const TFont &newFont)
Selects the given font object into this DC.
bool SetViewportExt(const TSize &extent, TSize *oldExtent=0)
Sets the screen's viewport x- and y-extents to the given extent values.
TPrintout represents the physical printed document that is to sent to a printer to be printed.
TRect is a mathematical class derived from tagRect.
int Height() const
Returns the height of this rectangle (bottom - top).
int Width() const
Returns the width of this rectangle (right - left).
The tagSIZE struct is defined as.
TSize()
Default constructor that does nothing.
TWindow, derived from TEventHandler and TStreamableBase, provides window-specific behavior and encaps...
void SetBkgndColor(TColor color, bool shouldUpdate=true)
Sets the background color for the window.
TWindow(TWindow *parent, LPCTSTR title=nullptr, TModule *module=nullptr)
Adds this to the child list of parent if nonzero, and calls EnableAutoCreate so that this will be cre...
void EvSize(uint sizeType, const TSize &size)
Response method for an incoming WM_SIZE message.
void GetClientRect(TRect &rect) const
Gets the coordinates of the window's client area and then copies them into the object referred to by ...
virtual void Invalidate(bool erase=true)
Invalidates (mark for painting) the entire client area of a window.
HWND GetHandle() const
Returns the handle of the window.
Definition of GDI DC encapsulation classes: TDC, TWindowDC, TScreenDC, TDesktopDC,...
#define DEFINE_RESPONSE_TABLE1(cls, base)
Macro to define a response table for a class with one base.
Definition of abstract GDI object class and derived classes.
@ pfBoth
Current band accepts both text and graphics.
Object Windows Library (OWLNext Core).
int GlyphHeight(TEXTMETRIC &tm)
bool SetViewportExt(HDC hdc, int w, int h)
bool SetWindowExt(HDC hdc, int w, int h)
bool SetWindowOrg(HDC hdc, int w, int h)
bool SetViewportOrg(HDC hdc, int x, int y)
Definition of print preview classes.
Definition of Print and PrintSetup common Dialogs classes.