1 /*-*- c++ -*-********************************************************
2 * wxLayoutList.h - a formatted text rendering engine for wxWindows *
4 * (C) 1999 by Karsten Ballüder (Ballueder@usa.net) *
7 *******************************************************************/
14 # pragma interface "wxllist.h"
21 #include "wx/printdlg.h"
22 #include "wx/generic/printps.h"
23 #include "wx/generic/prntdlgg.h"
25 // skip the following defines if embedded in M application
27 # define WXMENU_LAYOUT_LCLICK 1111
28 # define WXMENU_LAYOUT_RCLICK 1112
29 # define WXMENU_LAYOUT_DBLCLICK 1113
33 # define WXLAYOUT_DEBUG
37 # define WXLO_TRACE(x) wxLogDebug(x)
39 # define WXLO_TRACE(x)
44 #ifndef WXLO_DEFAULTFONTSIZE
45 # define WXLO_DEFAULTFONTSIZE 12
49 /// Types of currently supported layout objects.
50 enum wxLayoutObjectType
52 /// illegal object type, should never appear
53 WXLO_TYPE_INVALID
= 0,
54 /// text object, containing normal text
56 /// command object, containing font or colour changes
58 /// icon object, any kind of image
62 /// Type used for coordinates in drawing. Must be signed.
63 typedef long CoordType
;
65 // Forward declarations.
73 /* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
75 The wxLayout objects which make up the lines.
77 * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
79 /** The base class defining the interface to each object which can be
80 part of the layout. Each object needs to draw itself and calculate
86 /** This structure can be used to contain data associated with the
88 It is refcounted, so the caller has to do a DecRef() on it
93 UserData() { m_refcount
= 1; }
94 void IncRef(void) { m_refcount
++; }
95 void DecRef(void) { m_refcount
--; if(m_refcount
== 0) delete this;}
99 virtual ~UserData() { wxASSERT(m_refcount
== 0); }
100 /// prevents gcc from generating stupid warnings
101 friend class dummy_UserData
;
104 /// return the type of this object
105 virtual wxLayoutObjectType
GetType(void) const { return WXLO_TYPE_INVALID
; }
106 /** Calculates the size of an object.
107 @param dc the wxDC to draw on
109 virtual void Layout(wxDC
&) = 0;
112 @param dc the wxDC to draw on
113 @param coords where to draw the baseline of the object.
115 virtual void Draw(wxDC
& /* dc */, wxPoint
const & /* coords */) { }
117 /** Calculates and returns the size of the object.
118 @param top where to store height above baseline
119 @param bottom where to store height below baseline
120 @return the size of the object's box in pixels
122 virtual wxPoint
GetSize(CoordType
* top
, CoordType
*bottom
) const
123 { *top
= 0; *bottom
= 0; return wxPoint(0,0); }
125 /// Return just the width of the object on the screen.
126 virtual CoordType
GetWidth(void) const { return 0; }
127 /// returns the number of cursor positions occupied by this object
128 virtual CoordType
GetLength(void) const { return 1; }
129 /** Returns the cursor offset relating to the screen x position
130 relative to begin of object.
131 @param dc the wxDC to use for calculations
132 @param xpos relative x position from head of object
133 @return cursor coordinate offset
135 virtual CoordType
GetOffsetScreen(wxDC
&dc
, CoordType xpos
) const { return 0; }
138 wxLayoutObject() { m_UserData
= NULL
; }
139 /// delete the user data
140 virtual ~wxLayoutObject() { if(m_UserData
) m_UserData
->DecRef(); }
142 #ifdef WXLAYOUT_DEBUG
143 virtual void Debug(void);
146 /** Tells the object about some user data. This data is associated
147 with the object and will be deleted at destruction time.
149 void SetUserData(UserData
*data
)
152 m_UserData
->DecRef();
154 m_UserData
->IncRef();
157 /** Return the user data. */
158 void * GetUserData(void) const { if(m_UserData
) m_UserData
->IncRef(); return m_UserData
; }
160 /** Makes a copy of this object.
162 virtual wxLayoutObject
*Copy(void) = 0;
164 /// optional data for application's use
165 UserData
*m_UserData
;
168 /// Define a list type of wxLayoutObject pointers.
169 KBLIST_DEFINE(wxLayoutObjectList
, wxLayoutObject
);
171 /// An illegal iterator to save typing.
172 #define NULLIT (wxLayoutObjectList::iterator(NULL))
173 /// The iterator type.
174 #define wxLOiterator wxLayoutObjectList::iterator
176 /* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
180 * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
181 /** This class implements a wxLayoutObject holding plain text.
183 class wxLayoutObjectText
: public wxLayoutObject
186 wxLayoutObjectText(const wxString
&txt
);
188 virtual wxLayoutObjectType
GetType(void) const { return WXLO_TYPE_TEXT
; }
189 virtual void Layout(wxDC
&dc
);
190 virtual void Draw(wxDC
&dc
, wxPoint
const &coords
);
191 /** Calculates and returns the size of the object.
192 @param top where to store height above baseline
193 @param bottom where to store height below baseline
194 @return the size of the object's box in pixels
196 virtual wxPoint
GetSize(CoordType
* top
, CoordType
*bottom
) const;
197 /// Return just the width of the object on the screen.
198 virtual CoordType
GetWidth(void) const { return m_Width
; }
199 /** Returns the cursor offset relating to the screen x position
200 relative to begin of object.
201 @param dc the wxDC to use for calculations
202 @param xpos relative x position from head of object
203 @return cursor coordinate offset
205 virtual CoordType
GetOffsetScreen(wxDC
&dc
, CoordType xpos
) const;
208 #ifdef WXLAYOUT_DEBUG
209 virtual void Debug(void);
212 virtual CoordType
GetLength(void) const { return strlen(m_Text
.c_str()); }
215 wxString
& GetText(void) { return m_Text
; }
216 void SetText(wxString
const &text
) { m_Text
= text
; }
217 /** Makes a copy of this object.
219 virtual wxLayoutObject
*Copy(void);
222 /// size of the box containing text
223 long m_Width
, m_Height
;
224 /// Height above baseline.
226 /// Height below baseline.
230 /* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
234 * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
235 /** This class implements a wxLayoutObject holding a graphic.
237 class wxLayoutObjectIcon
: public wxLayoutObject
240 wxLayoutObjectIcon(wxBitmap
*icon
);
241 wxLayoutObjectIcon(wxBitmap
const &icon
);
243 ~wxLayoutObjectIcon() { delete m_Icon
; }
245 virtual wxLayoutObjectType
GetType(void) const { return WXLO_TYPE_ICON
; }
246 virtual void Layout(wxDC
&dc
);
247 virtual void Draw(wxDC
&dc
, wxPoint
const &coords
);
249 /** Calculates and returns the size of the object.
250 @param top where to store height above baseline
251 @param bottom where to store height below baseline
252 @return the size of the object's box in pixels
254 virtual wxPoint
GetSize(CoordType
* top
, CoordType
*bottom
) const;
255 /// Return just the width of the object on the screen.
256 virtual CoordType
GetWidth(void) const { return m_Icon
->GetWidth(); }
257 // return a pointer to the icon
258 wxBitmap
*GetIcon(void) const { return m_Icon
; }
259 /** Makes a copy of this object.
261 virtual wxLayoutObject
*Copy(void);
266 /// for export to html:
267 struct wxLayoutStyleInfo
271 family
= -1; // this marks the styleinfo as uninitialised
273 int size
, family
, style
, weight
;
275 unsigned fg_red
, fg_green
, fg_blue
;
276 unsigned bg_red
, bg_green
, bg_blue
;
279 /* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
283 * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
284 /** This class implements a wxLayoutObject holding style change commands.
286 class wxLayoutObjectCmd
: public wxLayoutObject
289 virtual wxLayoutObjectType
GetType(void) const { return WXLO_TYPE_CMD
; }
290 virtual void Layout(wxDC
&dc
);
291 virtual void Draw(wxDC
&dc
, wxPoint
const &coords
);
292 wxLayoutObjectCmd(int size
, int family
, int style
, int weight
,
294 wxColour
&fg
, wxColour
&bg
);
295 ~wxLayoutObjectCmd();
296 /** Stores the current style in the styleinfo structure */
297 void GetStyle(wxLayoutStyleInfo
*si
) const;
298 /// return the background colour for setting colour of window
299 wxColour
&GetBGColour(void) { return m_ColourBG
; }
300 /** Makes a copy of this object.
302 virtual wxLayoutObject
*Copy(void);
306 /// foreground colour
308 /// background colour
312 /* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
314 The wxLayoutLine object
316 * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
318 /// forward declaration
321 /** This class represents a single line of objects to be displayed.
322 It knows its height and total size and whether it needs to be
324 It has pointers to its first and next line so it can automatically
325 update them as needed.
331 @param prev pointer to previous line or NULL
332 @param next pointer to following line or NULL
333 @param llist pointer to layout list
335 wxLayoutLine(wxLayoutLine
*prev
, wxLayoutList
*llist
);
336 /** This function inserts a new object at cursor position xpos.
337 @param xpos where to insert new object
338 @param obj the object to insert
339 @return true if that xpos existed and the object was inserted
341 bool Insert(CoordType xpos
, wxLayoutObject
*obj
);
343 /** This function inserts text at cursor position xpos.
344 @param xpos where to insert
345 @param text the text to insert
346 @return true if that xpos existed and the object was inserted
348 bool Insert(CoordType xpos
, wxString text
);
350 /** This function appends an object to the line.
351 @param obj the object to insert
353 void Append(wxLayoutObject
* obj
)
356 m_ObjectList
.push_back(obj
);
357 m_Length
+= obj
->GetLength();
360 /** This function appens the next line to this, i.e. joins the two
363 void MergeNextLine(wxLayoutList
*llist
);
365 /** This function deletes npos cursor positions from position xpos.
366 @param xpos where to delete
367 @param npos how many positions
368 @return number of positions still to be deleted
370 CoordType
Delete(CoordType xpos
, CoordType npos
);
372 /** This function breaks the line at a given cursor position.
373 @param xpos where to break it
374 @return pointer to the new line object replacing the old one
376 wxLayoutLine
*Break(CoordType xpos
, wxLayoutList
*llist
);
378 /** Deletes the next word from this position, including leading
380 This function does not delete over font changes, i.e. a word
381 with formatting instructions in the middle of it is treated as
382 two (three actually!) words. In fact, if the cursor is on a non-text object, that
383 one is treated as a word.
384 @param xpos from where to delete
385 @return true if a word was deleted
387 bool DeleteWord(CoordType npos
);
389 /** Finds a suitable position left to the given column to break the
391 @param column we want to break the line to the left of this
392 @return column for breaking line or -1 if no suitable location found
394 CoordType
GetWrapPosition(CoordType column
);
396 /** Finds the object which covers the cursor position xpos in this
398 @param xpos the column number
399 @param offset where to store the difference between xpos and
401 @return iterator to the object or NULLIT
403 wxLayoutObjectList::iterator
FindObject(CoordType xpos
, CoordType
406 /** Finds the object which covers the screen position xpos in this
408 @param dc the wxDC to use for calculations
409 @param xpos the screen x coordinate
410 @param offset where to store the difference between xpos and
412 @return iterator to the object or NULLIT
414 wxLayoutObjectList::iterator
FindObjectScreen(wxDC
&dc
,
416 CoordType
*offset
) const ;
418 /** Get the first object in the list. This is used by the wxlparser
419 functions to export the list.
420 @return iterator to the first object
422 wxLayoutObjectList::iterator
GetFirstObject(void)
424 return m_ObjectList
.begin();
427 /** Deletes this line, returns pointer to next line.
428 @param update If true, update all following lines.
430 wxLayoutLine
*DeleteLine(bool update
, wxLayoutList
*llist
);
432 /**@name Cursor Management */
434 /** Return the line number of this line.
435 @return the line number
437 CoordType
GetLineNumber(void) const { return m_LineNumber
; }
438 /** Return the length of the line.
439 @return line lenght in cursor positions
441 CoordType
GetLength(void) const { return m_Length
; }
444 /**@name Drawing and Layout */
446 /** Draws the line on a wxDC.
447 @param dc the wxDC to draw on
448 @param llist the wxLayoutList
449 @param offset an optional offset to shift printout
453 const wxPoint
&offset
= wxPoint(0,0)) const;
455 /** Recalculates the positions of objects and the height of the
457 @param dc the wxDC to draw on
458 @param llist th e wxLayoutList
459 @param cursorPos if not NULL, set cursor screen position in there
460 @param cursorSize if not cursorPos != NULL, set cursor size in there
461 @param cx if cursorPos != NULL, the cursor x position
463 void Layout(wxDC
&dc
,
465 wxPoint
*cursorPos
= NULL
,
466 wxPoint
*cursorSize
= NULL
,
468 /** This function finds an object belonging to a given cursor
469 position. It assumes that Layout() has been called before.
470 @param dc the wxDC to use for calculations
471 @param xpos screen x position
472 @return pointer to the object
474 wxLayoutObject
* FindObjectScreen(wxDC
&dc
, CoordType xpos
);
477 /**@name List traversal */
479 /// Returns pointer to next line.
480 wxLayoutLine
*GetNextLine(void) const { return m_Next
; }
481 /// Returns pointer to previous line.
482 wxLayoutLine
*GetPreviousLine(void) const { return m_Previous
; }
483 /// Sets the link to the next line.
484 void SetNext(wxLayoutLine
*next
)
485 { m_Next
= next
; if(next
) next
->m_Previous
= this; }
486 /// Sets the link to the previous line.
487 void SetPrevious(wxLayoutLine
*previous
)
488 { m_Previous
= previous
; if(previous
) previous
->m_Next
= this; }
491 /// Returns the position of this line on the canvas.
492 wxPoint
GetPosition(void) const { return m_Position
; }
493 /// Returns the height of this line.
494 CoordType
GetHeight(void) const { return m_Height
; }
495 /// Returns the width of this line.
496 CoordType
GetWidth(void) const { return m_Width
; }
497 /** This will recalculate the position and size of this line.
498 If called recursively it will abort if the position of an
499 object is unchanged, assuming that none of the following
500 objects need to move.
501 @param recurse if greater 0 then it will be used as the
502 minimum(!) recursion level, continue with all lines till the end of
503 the list or until the coordinates no longer changed.
505 void RecalculatePositions(int recurse
, wxLayoutList
*llist
);
506 /// Recalculates the position of this line on the canvas.
507 wxPoint
RecalculatePosition(wxLayoutList
*llist
);
509 /// Destructor is private. Use DeleteLine() to remove it.
512 /**@name Functions to let the lines synchronise with each other. */
514 /** Sets the height of this line. Will mark following lines as
516 @param height new height
518 void SetHeight(CoordType height
, wxLayoutList
*llist
)
519 { m_Height
= height
; RecalculatePositions(true, llist
); }
521 /** Moves the linenumbers one on, because a line has been inserted
523 @param delta either +1 or -1
525 void MoveLines(int delta
)
527 m_LineNumber
+= delta
;
528 if(m_Next
) m_Next
->MoveLines(delta
);
533 CoordType m_LineNumber
;
534 /// The line length in cursor positions.
536 /// The total height of the line.
538 /// The total width of the line on screen.
540 /// The baseline for drawing objects
541 CoordType m_BaseLine
;
542 /// The position on the canvas.
544 /// The list of objects
545 wxLayoutObjectList m_ObjectList
;
546 /// Have we been changed since the last layout?
548 /// Pointer to previous line if it exists.
549 wxLayoutLine
*m_Previous
;
550 /// Pointer to next line if it exists.
551 wxLayoutLine
*m_Next
;
552 /// Just to suppress gcc compiler warnings.
555 wxLayoutLine(const wxLayoutLine
&);
559 /* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
561 The wxLayoutList object
563 * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
564 /** The wxLayoutList is a list of wxLayoutLine objects. It provides a
565 higher level of abstraction for the text and can generally be considered
566 as representing "the text".
577 void Clear(int family
= wxROMAN
,
578 int size
=WXLO_DEFAULTFONTSIZE
,
584 /// Empty: clear the list but leave font settings.
587 /**@name Cursor Management */
589 /** Set new cursor position.
590 @param p new position
591 @return bool if it could be set
593 bool MoveCursorTo(wxPoint
const &p
);
594 /** Move cursor up or down.
596 @return bool if it could be moved
598 bool MoveCursorVertically(int n
);
599 /** Move cursor left or right.
601 @return bool if it could be moved
603 bool MoveCursorHorizontally(int n
);
605 /// Move cursor to end of line.
606 void MoveCursorToEndOfLine(void)
608 wxASSERT(m_CursorLine
);
609 MoveCursorHorizontally(m_CursorLine
->GetLength()-m_CursorPos
.x
);
612 /// Move cursor to begin of line.
613 void MoveCursorToBeginOfLine(void)
614 { MoveCursorHorizontally(-m_CursorPos
.x
); }
616 /// Returns current cursor position.
617 wxPoint
GetCursorPos(wxDC
&dc
) const { return m_CursorPos
; }
620 /**@name Editing functions.
621 All of these functions return true on success and false on
624 /// Insert text at current cursor position.
625 bool Insert(wxString
const &text
);
626 /// Insert some other object at current cursor position.
627 bool Insert(wxLayoutObject
*obj
);
628 /// Inserts a linebreak at current cursor position.
629 bool LineBreak(void);
630 /** Wraps the current line. Searches to the left of the cursor to
631 break the line. Does nothing if the cursor position is before
632 the break position parameter.
633 @param column the break position for the line, maximum length
634 @return true if line got broken
636 bool WrapLine(CoordType column
);
637 /** This function deletes npos cursor positions.
638 @param npos how many positions
639 @return true if everything got deleted
641 bool Delete(CoordType npos
);
643 /** Delete the next n lines.
644 @param n how many lines to delete
645 @return how many it could not delete
647 int DeleteLines(int n
);
649 /// Delete to end of line.
650 void DeleteToEndOfLine(void)
652 wxASSERT(m_CursorLine
);
653 Delete(m_CursorLine
->GetLength()-m_CursorPos
.x
);
655 /// Delete to begin of line.
656 void DeleteToBeginOfLine(void)
658 wxASSERT(m_CursorLine
);
659 CoordType n
= m_CursorPos
.x
;
660 #ifdef WXLAYOUT_DEBUG
661 wxASSERT(MoveCursorHorizontally(-n
));
663 MoveCursorHorizontally(-n
);
668 /** Delete the next word.
670 void DeleteWord(void)
672 wxASSERT(m_CursorLine
);
673 m_CursorLine
->DeleteWord(m_CursorPos
.x
);
678 /**@name Formatting options */
680 /// sets font parameters
681 void SetFont(int family
, int size
, int style
,
682 int weight
, int underline
,
685 /// sets font parameters, colours by name
686 void SetFont(int family
=-1, int size
= -1, int style
=-1,
687 int weight
=-1, int underline
= -1,
688 char const *fg
= NULL
,
689 char const *bg
= NULL
);
690 /// changes to the next larger font size
691 inline void SetFontLarger(void)
692 { SetFont(-1,(12*m_FontPtSize
)/10); }
693 /// changes to the next smaller font size
694 inline void SetFontSmaller(void)
695 { SetFont(-1,(10*m_FontPtSize
)/12); }
698 inline void SetFontFamily(int family
) { SetFont(family
); }
700 inline void SetFontSize(int size
) { SetFont(-1,size
); }
702 inline void SetFontStyle(int style
) { SetFont(-1,-1,style
); }
704 inline void SetFontWeight(int weight
) { SetFont(-1,-1,-1,weight
); }
705 /// toggle underline flag
706 inline void SetFontUnderline(bool ul
) { SetFont(-1,-1,-1,-1,(int)ul
); }
707 /// set font colours by name
708 inline void SetFontColour(char const *fg
, char const *bg
= NULL
) { SetFont(-1,-1,-1,-1,-1,fg
,bg
); }
710 Returns a pointer to the default settings.
711 This is only valid temporarily and should not be stored
713 @return the default settings of the list
715 wxLayoutObjectCmd
*GetDefaults(void) { return m_DefaultSetting
; }
720 /** Draws the complete list on a wxDC.
721 @param dc the wxDC to draw on
722 @param offset an optional offset to shift printout
723 @param top optional y coordinate where to start drawing
724 @param bottom optional y coordinate where to stop drawing
726 void Draw(wxDC
&dc
, const wxPoint
&offset
= wxPoint(0,0),
727 CoordType top
= -1, CoordType bottom
= -1);
729 /** Calculates new layout for the list, like Draw() but does not
731 @param dc the wxDC to draw on
732 @param bottom optional y coordinate where to stop calculating
734 void Layout(wxDC
&dc
, CoordType bottom
= -1);
736 /** Calculates new sizes for everything in the list, like Layout()
737 but this is needed after the list got changed.
738 @param dc the wxDC to draw on
739 @param bottom optional y coordinate where to stop calculating
741 void Recalculate(wxDC
&dc
, CoordType bottom
= -1);
743 /** Returns the size of the list in screen coordinates.
744 The return value only makes sense after the list has been
746 @return a wxPoint holding the maximal x/y coordinates used for
749 wxPoint
GetSize(void) const;
751 /** Returns the cursor position on the screen.
752 @return cursor position in pixels
754 wxPoint
GetCursorScreenPos(wxDC
&dc
);
756 /** Draws the cursor.
757 @param active If true, draw a bold cursor to mark window as
759 @param translate optional translation of cursor coords on screen
761 void DrawCursor(wxDC
&dc
,
763 const wxPoint
& translate
= wxPoint(0,0));
765 /** This function finds an object belonging to a given screen
766 position. It assumes that Layout() has been called before.
767 @param pos screen position
768 @param cursorPos if non NULL, store cursor position in there
769 @return pointer to the object
771 wxLayoutObject
* FindObjectScreen(wxDC
&dc
,
773 wxPoint
*cursorPos
= NULL
);
775 /** Called by the objects to update the update rectangle.
776 @param p a point to include in it
778 void SetUpdateRect(const wxPoint
&p
);
779 /// Invalidates the update rectangle.
780 void InvalidateUpdateRect(void) { m_UpdateRectValid
= false; }
781 /// Returns the update rectangle.
782 const wxRect
*GetUpdateRect(void) const { return &m_UpdateRect
; }
785 /**@name For exporting one object after another. */
787 /** Returns a pointer to the first line in the list. */
788 wxLayoutLine
*GetFirstLine(void)
790 wxASSERT(m_FirstLine
);
795 void StartSelection(void);
796 void EndSelection(void);
797 bool IsSelected(const wxPoint
&cursor
);
801 void InternalClear(void);
802 /** Calculates the cursor position on the screen.
804 void UpdateCursorScreenPos(wxDC
&dc
);
806 /// The list of lines.
807 wxLayoutLine
*m_FirstLine
;
808 /// The update rectangle which needs to be refreshed:
810 /// Is the update rectangle valid?
811 bool m_UpdateRectValid
;
812 /**@name Cursor Management */
814 /// Where the text cursor (column,line) is.
816 /// The size of the cursor.
817 wxPoint m_CursorSize
;
818 /// Where the cursor should be drawn.
819 wxPoint m_CursorScreenPos
;
820 /// The line where the cursor is.
821 wxLayoutLine
*m_CursorLine
;
824 /// A structure for the selection.
828 wxPoint m_CursorA
, m_CursorB
;
830 /** @name Font parameters. */
832 int m_FontFamily
, m_FontStyle
, m_FontWeight
;
834 bool m_FontUnderline
;
838 /// the default setting:
839 wxLayoutObjectCmd
*m_DefaultSetting
;
846 /* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
848 The wxLayoutPrintout object for printing within the wxWindows print
851 * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
852 /** This class implements a wxPrintout for printing a wxLayoutList within
853 the wxWindows printing framework.
855 class wxLayoutPrintout
: public wxPrintout
859 @param llist pointer to the wxLayoutList to be printed
860 @param title title for PS file or windows
862 wxLayoutPrintout(wxLayoutList
*llist
,
863 wxString
const & title
=
864 "wxLayout Printout");
865 /** Function which prints the n-th page.
866 @param page the page number to print
867 @return bool true if we are not at end of document yet
869 bool OnPrintPage(int page
);
870 /** Checks whether page exists in document.
871 @param page number of page
872 @return true if page exists
874 bool HasPage(int page
);
876 /** Gets called from wxWindows to find out which pages are existing.
877 I'm not totally sure about the parameters though.
878 @param minPage the first page in the document
879 @param maxPage the last page in the document
880 @param selPageFrom the first page to be printed
881 @param selPageTo the last page to be printed
883 void GetPageInfo(int *minPage
, int *maxPage
,
884 int *selPageFrom
, int *selPageTo
);
886 /** This little function scales the DC so that the printout has
887 roughly the same size as the output on screen.
888 @param dc the wxDC to scale
889 @return the scale that was applied
891 float ScaleDC(wxDC
*dc
);
894 virtual void DrawHeader(wxDC &dc, wxPoint topleft, wxPoint bottomright, int pageno);
897 /// The list to print.
898 wxLayoutList
*m_llist
;
899 /// Title for PS file or window.
901 /// The real paper size.
902 int m_PageHeight
, m_PageWidth
;
903 /// How much we actually print per page.
904 int m_PrintoutHeight
;
905 /// How many pages we need to print.
907 /// Top left corner where we start printing.