17#if defined(__BORLANDC__)
29template <
class T1,
class T2>
48class TFormattedStatic:
public TStatic {
66: TStatic(parent,
resId, 0),
75TFormattedStatic::SetupWindow()
77 TStatic::SetupWindow();
83 int len =
static_cast<int>(
c.length() + Text.length() + Text2.length() + 5);
95class TNumericStatic:
public TStatic
98 TNumericStatic(TWindow* parent,
int resId,
int number);
101 TResult EvSetNumber(TParam1, TParam2);
109#define WM_SETNUMBER WM_USER+100
128TNumericStatic::EvSetNumber(TParam1
param1, TParam2)
130 Number =
static_cast<int>(
param1);
136 int len =
static_cast<int>(
::_tcslen(
c) +
sizeof(Number) + 5);
142 THandle
hWndDefault = GetParentO()->GetDlgItem(-1);
146 SetWindowPos(
HWND_TOP, 0, 0, 0, 0, flags);
171 new TNumericStatic(
this,
ID_PAGE, 0);
215 int id =
w ?
w->GetId() : 0;
221 WARN(
true,
_T(
"TPrinterAbortDlg control failure [id=") <<
id <<
_T(
"]: ") << x.
what());
319 TModule&
module = m ? *m : GetGlobalModule();
340 return module.LoadString(errorMsgId);
360 if (
r !=
IDOK)
throw TXPrinter{};
378HDC TPrinter::UserAbortDC =
nullptr;
389 b.resize(
b.capacity());
390 auto n =
static_cast<DWORD>(
b.size()) + 1;
397 switch (GetLastError())
418 : Error{0}, Data{
nullptr}, PageSize{}, PageSizeInch{}, OutputFile{}
428 PageSize{
other.PageSize}, PageSizeInch{
other.PageSizeInch},
431 other.Data =
nullptr;
468 const auto d = GetData();
CHECK(
d);
469 const auto dc =
d->TransferDC();
511 if (
data == Data)
return;
512 if (Data)
delete Data;
570 const auto n = p.GetCapability(
c,
nullptr);
571 if (
n ==
static_cast<DWORD>(-1))
return r;
573 const auto m = p.GetCapability(
c,
reinterpret_cast<LPTSTR>(
b.data()));
574 if (
m ==
static_cast<DWORD>(-1))
return r;
576 for (
auto i = 0;
i != min(
m,
n); ++
i)
608 const auto n = f(
nullptr);
611 const auto m = f(
reinterpret_cast<LPTSTR>(
r.data()));
645 if (
n ==
static_cast<DWORD>(-1))
return 0;
646 return static_cast<int>(
n);
678 const auto n = f(
nullptr);
679 if (
n ==
static_cast<DWORD>(-1))
return r;
681 const auto m = f(
reinterpret_cast<LPTSTR>(
b.data()));
682 if (
m ==
static_cast<DWORD>(-1))
return r;
684 for (
auto i = 0;
i != 2 * min(
m,
n);
i += 2)
685 r.emplace_back(
b[
i],
b[
i + 1]);
698 if (
n ==
static_cast<DWORD>(-1))
return 0;
699 return static_cast<int>(
n);
731 if (
m ==
static_cast<DWORD>(-1))
return TSize{0, 0};
765 const auto n = f(
nullptr);
768 const auto m = f(
reinterpret_cast<LPTSTR>(
r.data()));
782 if (
m ==
static_cast<DWORD>(-1))
return TSize{0, 0};
797 if (
r ==
static_cast<DWORD>(-1))
return 0;
798 return static_cast<int>(
r);
811 const auto n = f(
nullptr);
814 CHECK(
sizeof(TNupConfigurations::value_type) ==
sizeof(
DWORD));
815 const auto m = f(
reinterpret_cast<LPTSTR>(
r.data()));
842 const auto n = f(
nullptr);
845 const auto m = f(
reinterpret_cast<LPTSTR>(
r.data()));
861 const auto n = f(
nullptr);
862 if (
n ==
static_cast<DWORD>(-1))
return r;
864 const auto m = f(
reinterpret_cast<LPTSTR>(
b.data()));
865 if (
m ==
static_cast<DWORD>(-1))
return r;
867 for (
auto i = 0;
i != min(
m,
n); ++
i)
868 r.emplace_back(
b[
i].x,
b[
i].y);
890 if (
r ==
static_cast<int>(-1))
return 0;
891 return static_cast<int>(
r);
903 if (
r ==
static_cast<int>(-1))
return 0;
904 return static_cast<int>(
r);
915 if (
r ==
static_cast<int>(-1))
return 0;
916 return static_cast<int>(
r);
951 if (
n ==
static_cast<DWORD>(-1))
return 0;
952 return static_cast<int>(
n);
974 if (
r ==
static_cast<DWORD>(-1))
return 0;
996 appl->PumpWaitingMessages();
1021#if !defined(__GNUC__)
1035#if !defined(__GNUC__)
1053 dc ?
HDC(*dc) :
HDC(-1));
1064 return OutputFile.c_str();
1094 struct TPrintErrorHandler
1096 friend int operator %(
int r,
const TPrintErrorHandler&)
1112 TPrintErrorHandler
eh;
1114 TPrintDC& dc = *printout.GetPrintDC();
1117 const TRect
pageRect(TPoint(0, 0), printout.GetPageSize());
1133 TPrintErrorHandler
eh;
1134 TPrintDC& dc = *printout.GetPrintDC();
1135 TRect
bandRect(TPoint(0, 0), printout.GetPageSize());
1153 TPrintErrorHandler
eh;
1154 TPrintDC& dc = *printout.GetPrintDC();
1156 TRect
pageRect(TPoint(0, 0), printout.GetPageSize());
1169 struct TPrintingScope
1172 TPrintout& printout;
1174 TPrintingScope(TWindow& p, TPrintout&
po) : parent(p), printout(
po)
1176 parent.EnableWindow(
false);
1177 printout.BeginPrinting();
1182 printout.EndPrinting();
1183 parent.EnableWindow(
true);
1190 struct TDocumentScope
1192 TPrintout& printout;
1194 TDocumentScope(TPrintout& p,
int fromPage,
int toPage) : printout(p)
1201 printout.EndDocument();
1222 TPrintErrorHandler
eh;
1223 TPrintDC& dc = *printout.GetPrintDC();
1231 dc.StartDoc(printout.GetTitle(),
out) %
eh;
1423#if OWL_PERSISTENT_STREAMS
1431 GetObject()->Data->Read(
is, version);
1439TPrinter::Streamer::Write(opstream&
os)
const
1441 GetObject()->Data->Write(
os);
Definition of class TAppDictionary.
Definition of class TApplication.
#define WARN(condition, message)
#define PRECONDITION(condition)
TApplication * GetApplication(uint pid=0)
Looks up and returns the application associated with a given process ID.
Derived from TModule and TMsgThread and virtually derived from TEventHandler, TApplication acts as an...
static const TColor Black
Static TColor object with fixed Value set by RGB(0, 0, 0).
TDC is the root class for GDI DC wrappers.
Typically used to obtain information from a user, a dialog box is a window inside of which other cont...
auto Execute() -> int override
Creates and executes a modal dialog box interface element associated with the TDialog object.
void SetupWindow() override
Overrides the virtual function defined in TWindow.
ObjectWindows dynamic-link libraries (DLLs) construct an instance of TModule, which acts as an object...
A DC class that provides access to a printer.
TPrintDialog::TData contains information required to initialize the printer dialog box with the user'...
LPCTSTR GetOutputName() const
Gets the name of the physical output medium.
const DEVMODE * GetDevMode() const
Gets a pointer to a DEVMODE structure (a structure containing information necessary to initialize the...
uint32 Error
If the dialog box is successfully executed, Error returns 0.
int MaxPage
MaxPage indicates the maximum number of pages that can be printed.
TPrintDC * TransferDC()
Transfers the printers device context.
void ClearDevNames()
Accessors and mutators for the internal Win32 DEVNAMES structure.
int FromPage
FromPage indicates the beginning page to print.
LPCTSTR GetDeviceName() const
Gets the name of the output device.
uint32 Flags
Flags , which are used to initialize the printer dialog box, can be one or more of the following valu...
int ToPage
ToPage indicates the ending page to print.
int MinPage
MinPage indicates the minimum number of pages that can be printed.
void ClearDevMode()
Accessors and mutators for the internal Win32 DEVMODE structure.
int Copies
Copies indicates the actual number of pages to be printed.
bool DoPageSetup
Flag to do page setup?
TPrintDialog displays a modal print or a page setup dialog.
Contains information about the initialization and environment of a printer device.
TDevMode(const tstring &device)
Retrieves the DEVMODE device data for the given device.
TPrinterAbortDlg is the object type of the default printer-abort dialog box.
HDC PrnDC
Device context to print on.
void SetupWindow() override
Overrides SetupWindow. This function disables the Close system menu option.
void CmCancel()
Handles the print-cancel button by setting the user print abort flag in the application.
TPrinter is an encapsulation around the Windows printer device interface, and represents the physical...
static void SetUserAbort(HDC abortDC=HDC(-1))
Sets the user abort DC for the printer.
TSize GetPageSize() const
Returns the size of the page.
virtual ~TPrinter()
Frees the resources allocated to TPrinter.
auto GetPapers() const -> TPapers
Returns a list of supported paper sizes.
auto GetPrintRateUnit() const -> TPrintRateUnit
Returns the printer's print rate units.
void SetData(TPrintDialog::TData *data)
Sets the common dialog data; takes ownership.
std::vector< tstring > TDescriptionLanguages
Return type for GetDescriptionsLanguages.
std::vector< tstring > TPaperNames
Return type for GetPaperNames.
void SetDevice(const tstring &device)
Assigns the device to be represented by this TPrinter object.
int GetError()
Returns the error code from the printer.
auto GetLandscapeOrientation() const -> int
Returns the angle of rotation between portrait and landscape orientation.
std::vector< tstring > TPaperForms
Return type for GetReadyMedia.
auto CanStaple() const -> bool
Returns whether the printer supports stapling.
auto GetResolutions() const -> TResolutions
Retrieves a list of the resolutions supported by the printer.
auto HasDuplexSupport() const -> bool
Returns whether the printer supports duplex printing.
TPrintDialog::TData * GetData()
Returns the common dialog data associated with the printer.
auto GetDescriptionLanguages() const -> TDescriptionLanguages
Returns a list of printer description languages supported by the printer.
virtual TWindow * CreateAbortWindow(TWindow *parent, TPrintout &printout)
Virtual called from withing Print() just before the main printing loop to construct and create the pr...
TPrinter(const tstring &device=GetDefaultPrinter())
Associates this TPrinter object with the given printer device.
auto GetPrintRate() const -> int
Returns the printer's print rate.
virtual void SetPageSizes(const TPrintDC &dc)
Updates the PageSize variables by querying the device capabilities of the specified device context.
auto GetMaxCopies() const -> int
Return the maximum number of copies the printer can print.
TPrintDialog::TData & GetSetup()
Returns a reference to the TPrintDialog data structure.
auto GetReadyMedia() const -> TPaperForms
Returns the names of the paper forms that are currently available for use.
std::vector< WORD > TBins
Return type for GetBins.
std::vector< tstring > TMediaTypeNames
Return type for GetMediaTypeNames.
std::vector< tstring > TBinNames
Return type for GetBinNames.
std::vector< tstring > TFileDependencies
Return type for GetDriverDependencies.
auto GetTrueTypeCapabilities() const -> DWORD
Retrieves the abilities of the printer to use TrueType fonts.
TPrintRateUnit
Return type for GetPrintRateUnit.
virtual void Setup(TWindow *parent)
Setup lets the user select and/or configure the currently associated printer.
static auto GetDefaultPrinter() -> tstring
Retrieves the printer name of the default printer for the current user on the local computer.
auto GetMinExtent() const -> TSize
Returns the minimum paper size that the printer supports.
LPCTSTR GetOutputFile() const
Returns the filename for output redirection.
std::vector< int > TNupConfigurations
Return type for GetNupConfigurations.
auto GetMediaTypeNames() const -> TMediaTypeNames
Returns the names of the supported media types.
std::vector< DWORD > TMediaTypes
Return type for GetMediaTypes.
TCapability
Encapsulates the capability constants defined for the Windows API function DeviceCapabilities.
virtual bool ExecPrintDialog(TWindow *parent)
Virtual called from within Print() to construct and execute a print dialog before actual printing occ...
std::vector< TSize > TPaperSizes
Return type for GetPaperSizes.
auto GetDevModeFields() const -> DWORD
Returns the dmFields member of the printer driver's DEVMODE structure.
auto GetMaxExtent() const -> TSize
Returns the maximum paper size that the printer supports.
auto GetDevModeSize() const -> int
Returns the dmSize member of the printer driver's DEVMODE structure.
virtual void ClearDevice()
Called by the Destructor, ClearDevice disassociates the device with the current printer.
virtual bool Print(TWindow *parent, TPrintout &printout, bool prompt)
Print renders the given printout object on the associated printer device and displays an Abort dialog...
auto GetMediaTypes() const -> TMediaTypes
Returns a list of supported media types.
std::vector< WORD > TPapers
Return type for GetPapers.
auto GetDriverSpecificationVersion() const -> DWORD
Returns the specification version to which the printer driver conforms.
auto GetMemoryCapacity() const -> int
Returns the amount of available printer memory, in kilobytes.
auto GetBins() const -> TBins
Retrieves a list of available paper bins.
auto GetDriverDependencies() const -> TFileDependencies
Returns the names of any additional files that need to be loaded for the printer driver.
auto GetNupConfigurations() const -> TNupConfigurations
Retrieves a list of integers that indicate the printers ability to print multiple document pages per ...
auto GetDriverVersion() const -> DWORD
Returns the version number of the printer driver.
auto GetDevModeExtra() const -> int
Returns the number of bytes required for the device-specific portion of the DEVMODE structure for the...
void SetOutputFile(const tstring &outputFile)
Sets the filename for output redirection.
auto GetPaperNames() const -> TPaperNames
Returns a list of supported paper names.
virtual bool ExecPageSetupDialog(TWindow *parent)
Page setup dialog for Win95 support.
auto CanCollate() const -> bool
Returns whether the printer supports collating.
auto GetPaperSizes() const -> TPaperSizes
Retrieves the dimensions of each supported paper size.
auto GetBinNames() const -> TBinNames
Retrieves the names of the printer's paper bins.
auto GetDC() -> std::unique_ptr< TPrintDC >
Returns the device context already obtained in our setup data, or if none, creates a new one based on...
auto GetCapability(TCapability capability, TCHAR *output) const -> DWORD
Get information about the device.
void SetPageSizeInch(const TSize &pageSizeInch)
Sets the size of an inch on the page.
std::vector< TSize > TResolutions
Return type for GetResolutions.
auto IsColorDevice() const -> bool
Returns whether the printer supports color printing.
virtual void ReportError(TWindow *parent, TPrintout &printout)
Reports the current error by bringing up a system message box with an error message composed of the e...
void SetPageSize(const TSize &pagesize)
Sets the page's size.
auto GetPrintRatePpm() const -> int
Returns the printer's print rate in pages per minute.
static HDC GetUserAbort()
Returns the abort DC.
TSize GetPageSizeInch() const
Returns the size of an inch the page.
TPrintout represents the physical printed document that is to sent to a printer to be printed.
LPCTSTR GetTitle() const
Returns the title of the current printout.
TPrintDC * GetPrintDC()
Returns the DC associated with the printout.
virtual void SetPrintParams(TPrintDC *dc, TSize pageSize)
SetPrintParams sets DC to dc and PageSize to pageSize.
bool WantBanding() const
Returns true if banding is desired.
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...
The tagSIZE struct is defined as.
An interface object that represents a static text interface element.
TWindow, derived from TEventHandler and TStreamableBase, provides window-specific behavior and encaps...
tstring LoadString(uint id) const
TWindow()
Protected constructor for use by immediate virtually derived classes.
virtual bool EnableWindow(bool enable)
Allows the given window to receive input from the keyboard of mouse.
HWND GetDlgItem(int childId) const
Retrieves the handle of a control specified by childId.
virtual bool Create()
Creates the window interface element to be associated with this ObjectWindows interface element.
auto FormatMessageBox(const tstring &formatStr, const tstring &caption, uint flags,...) const -> int
TModule * GetModule() const
Returns a pointer to the module object.
HMENU GetSystemMenu(bool revert=false) const
Returns a handle to the system menu so that an application can access the system menu.
const char * what() const noexcept
TXOwl is root class of the ObjectWindows exception hierarchy.
TXPrinter describes an exception that results from an invalid printer object.
TXPrinter * Clone()
Clone the exception object for safe throwing across stack frames.
void Throw()
Throws the exception.
TXPrinter(uint resId=IDS_PRINTERERROR)
Constructs a TXPrinter object with a default IDS_PRINTERERROR message.
static void Raise(uint resId=IDS_PRINTERERROR)
Creates the exception object and throws it.
TXPrinting describes an exception that indicates that printing failed.
tstring GetErrorMessage(TModule *=0) const
Returns the error message for the current error code.
TXPrinting(int error=SP_ERROR)
Constructs a TXPrinting object with a default IDS_PRINTERERROR message.
void Throw()
Throws the exception.
static void Raise(int error=SP_ERROR)
Creates the exception object and throws it.
A nested class, TXWindow describes an exception that results from trying to create an invalid window.
TWindow * GetWindow() const
ipstream, a specialized input stream derivative of pstream, is the base class for reading (extracting...
Definition of GDI DC encapsulation classes: TDC, TWindowDC, TScreenDC, TDesktopDC,...
#define DECLARE_RESPONSE_TABLE(cls)
#define END_RESPONSE_TABLE
#define DEFINE_RESPONSE_TABLE1(cls, base)
Macro to define a response table for a class with one base.
Definition of class TFrameWindow.
#define IMPLEMENT_STREAMABLE(cls)
@ pfText
Current band accepts text.
@ pfBoth
Current band accepts both text and graphics.
@ pfGraphics
Current band accepts graphics.
Object Windows Library (OWLNext Core)
int CALLBACK TPrinterAbortProc(HDC hDC, int code)
TAppDictionary & OWLGetAppDictionary()
Global exported TAppDictionary in Owl.
LRESULT TResult
Result type.
void SetClear(T1 &var, T2 bitsOn, T2 bitsOff)
Definition of class TStatic, the class for static controls and base for any control that manages simp...
Base window class TWindow definition, including HWND encapsulation.
#define EV_MESSAGE(message, method)
Response table entry for raw message handling Uses a dispatcher that just forwards WPARAM and LPARAM.
#define EV_COMMAND(id, method)
Response table entry for a menu/accelerator/push button message.