10#include <owl/prevwin.rh>
11#include <owl/editfile.rh>
109 Attr.Style = WS_VISIBLE | WS_POPUPWINDOW | WS_MINIMIZEBOX;
219 return new TPreviewPage(parent, printout, prndc, printExtent, pagenum);
238 TRect r = Client->GetClientRect();
246 bool xMajor = (((r.
Width() * ratio) / 100) > r.
Height());
256 Client->SetChildLayoutMetrics(*
Page1, metrics1);
269 Client->SetChildLayoutMetrics(*
Page2, metrics2);
314TPreviewWin::CeNext (TCommandEnabler& ce)
319 ce.Enable(printerData.ToPage < printerData.MaxPage);
326TPreviewWin::CmPrevious()
330 if (printerData.FromPage > printerData.MinPage) {
331 printerData.FromPage--;
332 printerData.ToPage--;
350 if (printerData.ToPage < printerData.MaxPage) {
351 printerData.FromPage++;
352 printerData.ToPage++;
365TPreviewWin::CmOneUp ()
368 Client->RemoveChildLayoutMetrics(*
Page2);
376 printerData.
ToPage = printerData.FromPage;
397TPreviewWin::CmTwoUp()
399 if (
Page2 ==
nullptr) {
411 if (printerData.FromPage == printerData.MaxPage) {
412 if (printerData.FromPage > 1) {
413 printerData.FromPage--;
414 printerData.ToPage = printerData.FromPage + 1;
423 printerData.ToPage = printerData.FromPage + 1;
#define PRECONDITION(condition)
static const TColor SysAppWorkspace
The symbolic system color value for the background of multiple document interface (MDI) applications.
Base class for an extensible interface for auto enabling/disabling of commands (menu items,...
virtual void Enable(bool enable=true)
Enables or disables the command sender.
TControlBar(TWindow *parent=0, TTileDirection direction=Horizontal, TFont *font=0, TModule *module=0)
Constructs a TControlBar interface object with the specified direction (either horizontal or vertical...
TDecoratedFrame automatically positions its client window (you must supply a client window) so that i...
TDecoratedFrame(TWindow *parent, LPCTSTR title, TWindow *clientWnd, bool trackMenuSelection=false, TModule *module=0)
Constructs a TDecoratedFrame object with the specified parent window (parent), window caption (title)...
@ Top
Refers to top edge of frame.
void SetupWindow() override
Override SetupWindow in order to layout & position decorations Calls TLayoutWindow::Layout to size an...
virtual void Insert(TWindow &decoration, TLocation location=Top)
Insert a decoration window into position at one of the four edges.
@ Recessed
Recessed into the window.
TGadget * GadgetWithId(int id) const
Returns the gadget with a given ID, or 0 if none is found.
void Insert(TGadget &, TPlacement=After, TGadget *sibling=nullptr) override
Inserts a gadget before or after a sibling gadget (TPlacement).
When specifying the layout metrics for a window, four layout constraints are needed.
TEdgeConstraint Y
Y contains the Y (top, center, bottom) edge constraint of the window.
TEdgeOrWidthConstraint Width
Contains the width size constraint, center edge constraint, or right edge (lmRight) constraint of the...
TEdgeOrHeightConstraint Height
Contains the height size constraint, center edge constraint, or bottom edge constraint of the window.
TEdgeConstraint X
X contains the X (left, center, right) edge constraint of the window.
Derived from TWindow, TLayoutWindow provides functionality for defining the layout metrics for a wind...
TPoint is a support class, derived from tagPOINT.
TPreviewPage encapsulates a window which displays print-preview data.
int GetPageNumber() const
Retrieves the index of the page currently being previewed (painted) on the preview page window.
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 SetPageNumber(int newNum)
Sets newNum to the number of the page currently displayed in the preview window.
TPreviewWin encapsulates a simple preview window frame.
TPrinter & Printer
Printer device object.
void SetupWindow() override
Overriden virtual of TWindow to allow preview frame to create the preview page(s).
TPreviewWin(TWindow *parentWindow, TPrinter &printer, TPrintout &printout, TWindow &dataWindow, LPCTSTR title, TLayoutWindow *client)
Destructor of Preview frame window. Performs general cleanup.
TPrintDC * PrnDC
Printer DC.
TPreviewPage * Page1
Pointer to first preview page.
TWindow & DataWindow
Window /w data we're previewing.
virtual void SetupSpeedBar()
virtual void LayoutPages()
Repositions the preview page(s) using the aspect ratio of the printer when determining the dimensions...
TPrintout & Printout
Printer document object.
virtual TPreviewPage * GetNewPreviewPage(TWindow *parent, TPrintout &printout, TPrintDC &prndc, TSize &printExtent, int pagenum=1)
Returns a pointer to a TPreviewPage object.
TControlBar * PreviewSpeedBar
Pointer to toolbar object.
TSize PrinterPageSize
Printer's page size.
virtual void UpdateSpeedBar()
TPreviewPage * Page2
Pointer to second preview page.
A DC class that provides access to a printer.
TPrintDialog::TData contains information required to initialize the printer dialog box with the user'...
const DEVMODE * GetDevMode() const
Gets a pointer to a DEVMODE structure (a structure containing information necessary to initialize the...
int MaxPage
MaxPage indicates the maximum number of pages that can be printed.
int FromPage
FromPage indicates the beginning page to print.
LPCTSTR GetDeviceName() const
Gets the name of the output device.
int ToPage
ToPage indicates the ending page to print.
int MinPage
MinPage indicates the minimum number of pages that can be printed.
TPrinter is an encapsulation around the Windows printer device interface, and represents the physical...
TSize GetPageSize() const
Returns the size of the page.
virtual void SetPageSizes(const TPrintDC &dc)
Updates the PageSize variables by querying the device capabilities of the specified device context.
TPrintDialog::TData & GetSetup()
Returns a reference to the TPrintDialog data structure.
TPrintout represents the physical printed document that is to sent to a printer to be printed.
virtual void SetPrintParams(TPrintDC *dc, TSize pageSize)
SetPrintParams sets DC to dc and PageSize to pageSize.
virtual void GetDialogInfo(int &minPage, int &maxPage, int &selFromPage, int &selToPage)
Retrieves information needed to allow the printing of selected pages of the document and returns true...
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).
TSeparatorGadget(int size=0, int id=0, bool showseparator=true)
Used for both the width and the height of the separator, the default size is TUIMetric::CxSizeFrame t...
The tagSIZE struct is defined as.
Derived from TGadget, TTextGadget is a text gadget object.
@ Left
Aligns the text at the left edge of the bounding rectangle.
void SetText(LPCTSTR text)
Set the text for this gadget.
TTextGadget(int id=0, TBorderStyle=Recessed, TAlign=Left, uint numChars=10, LPCTSTR text=0, TFont *font=0)
Constructs a TTextGadget object with the specified ID, border style, and alignment.
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.
virtual bool Create()
Creates the window interface element to be associated with this ObjectWindows interface element.
TWindow * GetParentO() const
Return the OWL's parent for this window.
void GetClientRect(TRect &rect) const
Gets the coordinates of the window's client area and then copies them into the object referred to by ...
HWND GetHandle() const
Returns the handle of the window.
virtual void CloseWindow(int retVal=0)
Determines if it is okay to close a window before actually closing the window.
#define DEFINE_RESPONSE_TABLE1(cls, base)
Macro to define a response table for a class with one base.
#define lmParent
Use to represent the parent in layout metrics.
@ lmTop
The top edge of the window.
@ lmBottom
The bottom edge of the window.
@ lmRight
The right edge of the window.
@ lmLeft
The left edge of the window.
Object Windows Library (OWLNext Core).
EV_COMMAND_ENABLE(CM_FILENEW, CeFileNew)
EV_COMMAND(IDOK, CmOkCancel)
#define TYPESAFE_DOWNCAST(object, toClass)
Definition of TPreviewWin, the Preview Window class.
void SameAs(TWindow *otherWin, TEdge edge)
Sets the edge of your window indicated by edge equivalent to the corresponding edge of the window in ...
void Set(TEdge edge, TRelationship rel, TWindow *otherWin, TEdge otherEdge, int value=0)
For setting arbitrary edge constraints.
void PercentOf(TWindow *otherWin, TEdge edge, int percent)
void SameAs(TWindow *otherWin, TEdge edge)
void PercentOf(TWindow *otherWin, TEdge edge, int percent)
void SameAs(TWindow *otherWin, TEdge edge)