units_per_cm) : wxPrintout( title )
135wxPrintData printdata;
136printdata.SetPrintMode( wxPRINT_MODE_PRINTER );
137printdata.SetOrientation(
m_orient);
138printdata.SetNoCopies(1);
145 if(showPageSetupDialog)
153 if(dlg.ShowModal() == wxID_OK)
162wxPoint marginTopLeft =
m_page_setup.GetMarginTopLeft();
163wxPoint marginBottomRight =
m_page_setup.GetMarginBottomRight();
179std::cout <<
"user canceled at first dialog"<< std::endl;
238std::cout <<
"beginning to print document, from page "<< startPage
239<<
" to "<< endPage << std::endl;
240 returnwxPrintout::OnBeginDocument(startPage, endPage);
244 void GetPageInfo(
int*minPage,
int*maxPage,
int*pageSelFrom,
int*pageSelTo)
268std::cout <<
"printing page "<< pageNum << std::endl;
274wxRect fitRect = GetLogicalPageMarginsRect(
m_page_setup);
278OffsetLogicalOrigin(xoff, yoff);
281 if(ptr==
NULL|| !ptr->IsOk())
283std::cout <<
"DC is not Ok, interrupting printing"<< std::endl;
293 const intx1 = x0 + width;
294 const inty1 = y0 + height;
299std::cout <<
"printable area : ("<< x0 <<
", "<< y0 <<
") to (" 300<< x1 <<
", "<< y1 <<
")"<< std::endl;
333wxString
label(
wxT(
"This is page #") );
335dc.SetTextBackground( wxColour(255,255,0) );
336dc.SetTextForeground( wxColour(0,0,0) );
337dc.DrawText(
label, x0 + width/5, y0 + height - 50 );
const unsigned char * GetData(void) const
size_t GetWidth(void) const
size_t GetHeight(void) const
Shows a basic example of how to print stuff in wx.
int m_margin_left
margins, in millimeters
void OnBeginPrinting()
Called when printing starts.
bool OnPrintPage(int pageNum)
called by wx everytime it's time to render a specific page onto the printing device context
float m_units_per_cm
we'll use this to determine the coordinate system; it describes the number of units per centimeter (i...
bool performPageSetup(const bool showPageSetupDialog)
shows the page setup dialog, OR sets up defaults
bool HasPage(int pageNum)
called by wx to know what pages this document has
int m_coord_system_height
wxPaperSize m_paper_type
the type of paper (letter, A4, etc...)
void GetPageInfo(int *minPage, int *maxPage, int *pageSelFrom, int *pageSelTo)
wx will call this to know how many pages can be printed
int m_coord_system_width
will contain the dimensions of the coordinate system, once it's calculated.
void OnEndPrinting()
Called when printing is done.
CPrintHanderWx(CRef< CImage > img, int page_amount, wxString title, float units_per_cm)
wxPageSetupDialogData m_page_setup
bool OnBeginDocument(int startPage, int endPage)
Called when starting to print a document.
wxPrintData getPrintData()
returns the data obtained from the page setup dialog (or the defaults, if dialog was not shown)
int m_page_amount
number of pages we want to print.
void SetImage(CRef< CImage > img)
wxPrintOrientation m_orient
horizontal or vertical
int GetPrintOffsetY() const
int GetTargetImageHeight() const
virtual wxPageSetupDialogData & GetPageSetupDialogData()
Required as a subclass of wxPageSetupDialogBase.
int GetDrawAreaWidth() const
int GetTargetImageWidth() const
int GetDrawAreaHeight() const
int GetPrintOffsetX() const
Include a standard set of the NCBI C++ Toolkit most basic headers.
#define END_NCBI_SCOPE
End previously defined NCBI scope.
#define BEGIN_NCBI_SCOPE
Define ncbi namespace.
static const char label[]
Portable reference counted smart and weak pointers using CWeakRef, CRef, CObject and CObjectEx.
static const int brush_size
RetroSearch is an open source project built by @garambo | Open a GitHub Issue
Search and Browse the WWW like it's 1997 | Search results from DuckDuckGo
HTML:
3.2
| Encoding:
UTF-8
| Version:
0.7.4