]> git.saurik.com Git - wxWidgets.git/blob - samples/richedit/wxllist.h
fixed id values to be more standard
[wxWidgets.git] / samples / richedit / wxllist.h
1 /*-*- c++ -*-********************************************************
2 * wxLayoutList.h - a formatted text rendering engine for wxWidgets *
3 * *
4 * (C) 1999-2000 by Karsten Ballüder (ballueder@gmx.net) *
5 * *
6 * $Id$
7 *******************************************************************/
8
9
10 #ifndef WXLLIST_H
11 #define WXLLIST_H
12
13 #ifdef __GNUG__
14 # pragma interface "wxllist.h"
15 #endif
16
17 #include "kbList.h"
18
19 #include "wx/wx.h"
20 #include "wx/print.h"
21 #include "wx/printdlg.h"
22 #include "wx/generic/printps.h"
23 #include "wx/generic/prntdlgg.h"
24 #include "wx/dataobj.h"
25
26 // skip the following defines if embedded in M application
27 #ifndef M_BASEDIR
28 # define WXMENU_LAYOUT_LCLICK 1111
29 # define WXMENU_LAYOUT_RCLICK 1112
30 # define WXMENU_LAYOUT_DBLCLICK 1113
31 #else // for Mahogany only
32 # include "MObject.h"
33 #endif
34
35 // use the wxWidgets caret class instead of home grown cursor whenever possible
36 #ifdef __WXMSW__
37 # undef WXLAYOUT_USE_CARET
38 # define WXLAYOUT_USE_CARET 1
39 #endif // __WXMSW__
40
41 // do not enable debug mode within Mahogany unless in debug mode
42 #if defined(__WXDEBUG__) && (( ! defined(M_BASEDIR) )|| defined(DEBUG))
43 # define WXLAYOUT_DEBUG
44 #endif
45
46 #ifdef WXLAYOUT_DEBUG
47 # define WXLO_TRACE(x) wxLogDebug(x)
48 // activate profiling: # define WXLO_PROFILE
49 #else
50 # define WXLO_TRACE(x)
51 #endif
52
53 /* Some profiling code: */
54 #if defined (WXLO_PROFILE)
55 #include <sys/time.h>
56 #include <unistd.h>
57
58 # define WXLO_TIMER_DEFINE(x) static struct timeval x
59 # define WXLO_TIMER_START(x) gettimeofday(&x,NULL)
60 # define WXLO_TIMER_STOP(x) { struct timeval y; \
61 gettimeofday(&y,NULL); \
62 x.tv_sec -= y.tv_sec; x.tv_usec -= y.tv_usec; }
63 # define WXLO_TIMER_PRINT(x) wxLogDebug("Timer " #x " elapsed: %ld", \
64 (long)(x.tv_sec * -1000 - x.tv_usec));
65 #else
66 # define WXLO_TIMER_DEFINE(x)
67 # define WXLO_TIMER_START(x)
68 # define WXLO_TIMER_STOP(x)
69 # define WXLO_TIMER_PRINT(x)
70 #endif
71
72
73 #define WXLO_DEBUG_URECT 0
74
75 #ifndef WXLO_DEFAULTFONTSIZE
76 # define WXLO_DEFAULTFONTSIZE 12
77 #endif
78
79 #ifdef __WXMSW__
80 # define WXLO_BITMAP_FORMAT wxBITMAP_TYPE_BMP
81 #else
82 # define WXLO_BITMAP_FORMAT wxBITMAP_TYPE_PNG
83 #endif
84
85 /// Types of currently supported layout objects.
86 enum wxLayoutObjectType
87 {
88 /// illegal object type, should never appear
89 WXLO_TYPE_INVALID = 0,
90
91 /// text object, containing normal text
92 WXLO_TYPE_TEXT,
93
94 /// command object, containing font or colour changes
95 WXLO_TYPE_CMD,
96
97 /// icon object, any kind of image
98 WXLO_TYPE_ICON,
99
100 /// a linebreak, does not exist as an object
101 WXLO_TYPE_LINEBREAK
102 };
103
104 /// Type used for coordinates in drawing. Must be signed.
105 typedef long CoordType;
106
107 // Forward declarations.
108 class wxLayoutList;
109 class wxLayoutLine;
110 class wxLayoutObject;
111
112 class WXDLLEXPORT wxCaret;
113 class WXDLLEXPORT wxColour;
114 class WXDLLEXPORT wxDC;
115 class WXDLLEXPORT wxFont;
116
117 /* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
118
119 The wxLayout objects which make up the lines.
120
121 * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
122
123 /** The base class defining the interface to each object which can be
124 part of the layout. Each object needs to draw itself and calculate
125 its size.
126 */
127 class wxLayoutObject
128 #ifdef M_BASEDIR
129 : public MObject
130 #endif
131 {
132 public:
133 /** This structure can be used to contain data associated with the
134 object.
135 It is refcounted, so the caller has to do a DecRef() on it
136 instead of a delete.
137 */
138 struct UserData
139 {
140 UserData() { m_refcount = 1; }
141 inline void IncRef() { m_refcount++; }
142 inline void DecRef() { m_refcount--; if(m_refcount == 0) delete this;}
143 inline void SetLabel(const wxString &l) { m_label = l; }
144 inline const wxString & GetLabel() const { return m_label; }
145 private:
146 int m_refcount;
147 wxString m_label;
148 protected:
149 virtual ~UserData() { wxASSERT(m_refcount == 0); }
150 /// prevents gcc from generating stupid warnings
151 friend class dummy_UserData;
152 };
153
154 /// return the type of this object
155 virtual wxLayoutObjectType GetType() const { return WXLO_TYPE_INVALID; }
156 /** Calculates the size of an object.
157 @param dc the wxDC to draw on
158 @param llist the wxLayoutList
159 */
160 virtual void Layout(wxDC &dc, wxLayoutList *llist) = 0;
161
162 /** Draws an object.
163 @param dc the wxDC to draw on
164 @param coords where to draw the baseline of the object.
165 @param wxllist pointer to wxLayoutList
166 @param begin if !=-1, from which position on to highlight it
167 @param end if begin !=-1, how many positions to highlight it
168 */
169 virtual void Draw(wxDC & /* dc */,
170 wxPoint const & /* coords */,
171 wxLayoutList *WXUNUSED(wxllist),
172 CoordType WXUNUSED(begin) = -1,
173 CoordType WXUNUSED(end) = -1) { }
174
175 /** Calculates and returns the size of the object.
176 @param top where to store height above baseline
177 @param bottom where to store height below baseline
178 @return the size of the object's box in pixels
179 */
180 virtual wxPoint GetSize(CoordType * top, CoordType *bottom) const
181 { *top = 0; *bottom = 0; return wxPoint(0,0); }
182
183 /// Return just the width of the object on the screen.
184 virtual CoordType GetWidth() const { return 0; }
185
186 /// returns the number of cursor positions occupied by this object
187 virtual CoordType GetLength() const { return 1; }
188
189 /** Returns the cursor offset relating to the screen x position
190 relative to begin of object.
191 @param dc the wxDC to use for calculations
192 @param xpos relative x position from head of object
193 @return cursor coordinate offset
194 */
195 virtual CoordType GetOffsetScreen( wxDC & WXUNUSED(dc),
196 CoordType WXUNUSED(xpos) ) const
197 {
198 return 0;
199 }
200
201 /// constructor
202 wxLayoutObject() { m_UserData = NULL; }
203
204 /// delete the user data
205 virtual ~wxLayoutObject() { if(m_UserData) m_UserData->DecRef(); }
206
207 #ifdef WXLAYOUT_DEBUG
208 virtual wxString DebugDump() const;
209 #endif
210
211 /** Tells the object about some user data. This data is associated
212 with the object and will be deleted at destruction time.
213 It is reference counted.
214 */
215 void SetUserData(UserData *data)
216 {
217 if(m_UserData)
218 m_UserData->DecRef();
219
220 m_UserData = data;
221
222 if(m_UserData)
223 m_UserData->IncRef();
224 }
225
226 /** Return the user data.
227 Increments the object's reference count. When no longer needed,
228 caller must call DecRef() on the pointer returned.
229 */
230 UserData * GetUserData() const { if(m_UserData) m_UserData->IncRef(); return m_UserData; }
231
232 /** Makes a copy of this object.
233 */
234 virtual wxLayoutObject *Copy() = 0;
235
236 /** Clipboard support function. Read and write objects to
237 strings. */
238 //@{
239 /// Writes the object to the string.
240 virtual void Write(wxString &ostr) = 0;
241
242 /** Reads an object.
243 @param str stream to read from, will bee changed
244 @return true on success
245 */
246 static wxLayoutObject *Read(wxString &istr);
247 //@}
248
249 /// returns true if the object is shown on the screen (i.e. not cmd object)
250 bool IsVisibleObject() const { return GetType() != WXLO_TYPE_CMD; }
251
252 protected:
253 /// optional data for application's use
254 UserData *m_UserData;
255 #if defined (M_BASEDIR) && defined (DEBUG)
256 MOBJECT_NAME(wxLayoutObject)
257 #endif
258 };
259
260 /// Define a list type of wxLayoutObject pointers.
261 KBLIST_DEFINE(wxLayoutObjectList, wxLayoutObject);
262
263 /// The iterator type.
264 typedef wxLayoutObjectList::iterator wxLOiterator;
265
266 /* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
267
268 wxLayoutObjectText
269
270 * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
271 /** This class implements a wxLayoutObject holding plain text.
272 */
273 class wxLayoutObjectText : public wxLayoutObject
274 {
275 public:
276 wxLayoutObjectText(const wxString &txt = wxEmptyString);
277
278 virtual wxLayoutObjectType GetType() const { return WXLO_TYPE_TEXT; }
279 virtual void Layout(wxDC &dc, wxLayoutList *llist);
280 virtual void Draw(wxDC &dc, wxPoint const &coords,
281 wxLayoutList *wxllist,
282 CoordType begin = -1,
283 CoordType end = -1);
284
285 /** Calculates and returns the size of the object.
286 @param top where to store height above baseline
287 @param bottom where to store height below baseline
288 @return the size of the object's box in pixels
289 */
290 virtual wxPoint GetSize(CoordType * top, CoordType *bottom) const;
291
292 /// Return just the width of the object on the screen.
293 virtual CoordType GetWidth() const { return m_Width; }
294
295 /** Returns the cursor offset relating to the screen x position
296 relative to begin of object.
297 @param dc the wxDC to use for calculations
298 @param xpos relative x position from head of object
299 @return cursor coordinate offset
300 */
301 virtual CoordType GetOffsetScreen(wxDC &dc, CoordType xpos) const;
302
303 virtual void Write(wxString &ostr);
304 static wxLayoutObjectText *Read(wxString &istr);
305
306 #ifdef WXLAYOUT_DEBUG
307 virtual wxString DebugDump() const;
308 #endif
309
310 virtual CoordType GetLength() const { return wxStrlen(m_Text.c_str()); }
311
312 // for editing:
313 wxString & GetText() { return m_Text; }
314
315 void SetText(wxString const &text) { m_Text = text; }
316 /** Makes a copy of this object.
317 */
318 virtual wxLayoutObject *Copy();
319
320 private:
321 wxString m_Text;
322
323 /// size of the box containing text
324 long m_Width, m_Height;
325
326 /// Height above baseline.
327 long m_Top;
328
329 /// Height below baseline.
330 long m_Bottom;
331 };
332
333 /* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
334
335 wxLayoutObjectIcon
336
337 * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
338 /** This class implements a wxLayoutObject holding a graphic.
339 */
340 class wxLayoutObjectIcon : public wxLayoutObject
341 {
342 public:
343 wxLayoutObjectIcon(wxBitmap *icon = NULL);
344 wxLayoutObjectIcon(wxBitmap const &icon);
345
346 ~wxLayoutObjectIcon() { if(m_Icon) delete m_Icon; }
347
348 virtual wxLayoutObjectType GetType() const { return WXLO_TYPE_ICON; }
349 virtual void Layout(wxDC &dc, wxLayoutList *llist);
350 virtual void Draw(wxDC &dc, wxPoint const &coords,
351 wxLayoutList *wxllist,
352 CoordType begin = -1,
353 CoordType end = -1);
354
355 /** Calculates and returns the size of the object.
356 @param top where to store height above baseline
357 @param bottom where to store height below baseline
358 @return the size of the object's box in pixels
359 */
360 virtual wxPoint GetSize(CoordType * top, CoordType *bottom) const;
361
362 /// Return just the width of the object on the screen.
363 virtual CoordType GetWidth() const { return m_Icon->GetWidth(); }
364
365 // return a pointer to the icon
366 wxBitmap *GetIcon() const { return m_Icon; }
367
368 /** Makes a copy of this object.
369 */
370 virtual wxLayoutObject *Copy();
371 virtual void Write(wxString &ostr);
372 static wxLayoutObjectIcon *Read(wxString &istr);
373
374 private:
375 wxBitmap *m_Icon;
376 };
377
378 /** This structure holds all formatting information.
379 */
380 struct wxLayoutStyleInfo
381 {
382 wxLayoutStyleInfo(int ifamily = -1,
383 int isize = -1,
384 int istyle = -1,
385 int iweight = -1,
386 int iul = -1,
387 wxColour *fg = NULL,
388 wxColour *bg = NULL);
389
390 wxLayoutStyleInfo & operator=(const wxLayoutStyleInfo &right);
391
392 wxColour & GetBGColour() { return m_bg; }
393
394 /// Font change parameters.
395 int size, family, style, weight, underline;
396
397 /// Colours
398 wxColour m_bg, m_fg;
399 int m_fg_valid, m_bg_valid; // bool, but must be int!
400 };
401
402 /// a cached font
403 class wxFontCacheEntry
404 {
405 public:
406 wxFontCacheEntry(int family, int size, int style, int weight,
407 bool underline)
408 {
409 m_Family = family; m_Size = size; m_Style = style;
410 m_Weight = weight; m_Underline = underline;
411 m_Font = new wxFont(m_Size, m_Family,
412 m_Style, m_Weight, m_Underline);
413 }
414
415 bool Matches(int family, int size, int style, int weight,
416 bool underline) const
417 {
418 return size == m_Size && family == m_Family
419 && style == m_Style && weight == m_Weight
420 && underline == m_Underline;
421 }
422
423 wxFont & GetFont() { return *m_Font; }
424 ~wxFontCacheEntry()
425 {
426 delete m_Font;
427 }
428
429 private:
430 wxFont *m_Font;
431
432 // VZ: I wonder why it doesn't use wxLayoutStyleInfo instead of those?
433 int m_Family, m_Size, m_Style, m_Weight;
434 bool m_Underline;
435 };
436
437 KBLIST_DEFINE(wxFCEList, wxFontCacheEntry);
438
439 class wxFontCache
440 {
441 public:
442 wxFont & GetFont(int family, int size, int style, int weight,
443 bool underline);
444
445 wxFont & GetFont(wxLayoutStyleInfo const &si)
446 {
447 return GetFont(si.family, si.size, si.style, si.weight,
448 si.underline != 0);
449 }
450
451 private:
452 wxFCEList m_FontList;
453 };
454
455 /* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
456
457 wxLayoutObjectCmd
458
459 * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
460 /** This class implements a wxLayoutObject holding style change commands.
461 */
462 class wxLayoutObjectCmd : public wxLayoutObject
463 {
464 public:
465 virtual wxLayoutObjectType GetType() const { return WXLO_TYPE_CMD; }
466 virtual void Layout(wxDC &dc, wxLayoutList *llist);
467 virtual void Draw(wxDC &dc, wxPoint const &coords,
468 wxLayoutList *wxllist,
469 CoordType begin = -1,
470 CoordType end = -1);
471
472 wxLayoutObjectCmd(int family = -1,
473 int size = -1,
474 int style = -1,
475 int weight = -1,
476 int underline = -1,
477 wxColour *fg = NULL,
478 wxColour *bg = NULL);
479
480 wxLayoutObjectCmd(const wxLayoutStyleInfo &si);
481 ~wxLayoutObjectCmd();
482 /** Stores the current style in the styleinfo structure */
483 wxLayoutStyleInfo * GetStyle() const;
484 /** Makes a copy of this object.
485 */
486 virtual wxLayoutObject *Copy();
487 virtual void Write(wxString &ostr);
488 static wxLayoutObjectCmd *Read(wxString &istr);
489
490 private:
491 wxLayoutStyleInfo *m_StyleInfo;
492 };
493
494 /* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
495
496 The wxLayoutLine object
497
498 * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
499
500 /** This class represents a single line of objects to be displayed.
501 It knows its height and total size and whether it needs to be
502 redrawn or not.
503 It has pointers to its first and next line so it can automatically
504 update them as needed.
505 */
506 class wxLayoutLine
507 {
508 public:
509 /** Constructor.
510 @param prev pointer to previous line or NULL
511 @param next pointer to following line or NULL
512 @param llist pointer to layout list
513 */
514 wxLayoutLine(wxLayoutLine *prev, wxLayoutList *llist);
515 /** This function inserts a new object at cursor position xpos.
516 @param xpos where to insert new object
517 @param obj the object to insert
518 @return true if that xpos existed and the object was inserted
519 */
520 bool Insert(CoordType xpos, wxLayoutObject *obj);
521
522 /** This function inserts text at cursor position xpos.
523 @param xpos where to insert
524 @param text the text to insert
525 @return true if that xpos existed and the object was inserted
526 */
527 bool Insert(CoordType xpos, const wxString& text);
528
529 /** This function appends an object to the line.
530 @param obj the object to insert
531 */
532 void Append(wxLayoutObject * obj)
533 {
534 wxASSERT(obj);
535 m_ObjectList.push_back(obj);
536 m_Length += obj->GetLength();
537 }
538
539 /** This function prepends an object to the line. */
540 void Prepend(wxLayoutObject * obj)
541 {
542 wxASSERT(obj);
543 m_ObjectList.push_front(obj);
544 m_Length += obj->GetLength();
545 }
546
547 /** This function appens the next line to this, i.e. joins the two
548 lines into one.
549 */
550 void MergeNextLine(wxLayoutList *llist);
551
552 /** This function deletes npos cursor positions from position xpos.
553 @param xpos where to delete
554 @param npos how many positions
555 @return number of positions still to be deleted
556 */
557 CoordType Delete(CoordType xpos, CoordType npos);
558
559 /** This function breaks the line at a given cursor position.
560 @param xpos where to break it
561 @return pointer to the new line object replacing the old one
562 */
563 wxLayoutLine *Break(CoordType xpos, wxLayoutList *llist);
564
565 /** This function wraps the line: breaks it at a suitable point
566 and merges it with the next.
567 @param wrapmargin
568 @return true if broken
569 */
570 bool Wrap(CoordType wrapmargin, wxLayoutList *llist);
571
572 /** Deletes the next word from this position, including leading
573 whitespace.
574 This function does not delete over font changes, i.e. a word
575 with formatting instructions in the middle of it is treated as
576 two (three actually!) words. In fact, if the cursor is on a non-text object, that
577 one is treated as a word.
578 @param xpos from where to delete
579 @return true if a word was deleted
580 */
581 bool DeleteWord(CoordType npos);
582
583 /** Finds a suitable position left to the given column to break the
584 line.
585 @param column we want to break the line to the left of this
586 @return column for breaking line or -1 if no suitable location found
587 */
588 CoordType GetWrapPosition(CoordType column);
589
590 /** Finds the object which covers the cursor position xpos in this
591 line.
592 @param xpos the column number
593 @param offset where to store the difference between xpos and
594 the object's head
595 @return iterator to the object or iterator to NULL
596 */
597 wxLayoutObjectList::iterator FindObject(CoordType xpos, CoordType
598 *offset) const ;
599
600 /** Finds the object which covers the screen position xpos in this
601 line.
602 @param dc the wxDC to use for calculations
603 @param llist the layout list to which this line belongs
604 @param xpos the screen x coordinate
605 @param offset where to store the difference between xpos and
606 the object's head
607 @return iterator to the object or iterator to NULL
608 */
609 wxLayoutObjectList::iterator FindObjectScreen(wxDC &dc,
610 wxLayoutList *llist,
611 CoordType xpos,
612 CoordType *offset,
613 bool *found = NULL) const ;
614
615 /** Finds text in this line.
616 @param needle the text to find
617 @param xpos the position where to start the search
618 @return the cursoor coord where it was found or -1
619 */
620 CoordType FindText(const wxString &needle, CoordType xpos = 0) const;
621
622 /** Get the first object in the list. This is used by the wxlparser
623 functions to export the list.
624 @return iterator to the first object
625 */
626 wxLayoutObjectList::iterator GetFirstObject() const
627 {
628 return m_ObjectList.begin();
629 }
630
631 /// Get the last object in the list.
632 wxLayoutObjectList::iterator GetLastObject() const
633 {
634 return m_ObjectList.tail();
635 }
636
637 /** Deletes this line, returns pointer to next line.
638 @param update If true, update all following lines.
639 */
640 wxLayoutLine *DeleteLine(bool update, wxLayoutList *llist);
641
642 /**@name Cursor Management */
643 //@{
644 /** Return the line number of this line.
645 @return the line number
646 */
647 inline CoordType GetLineNumber() const { return m_LineNumber; }
648
649 /** Return the length of the line.
650 @return line length in cursor positions
651 */
652 inline CoordType GetLength() const { return m_Length; }
653 //@}
654
655 /**@name Drawing and Layout */
656 //@{
657 /** Draws the line on a wxDC.
658 @param dc the wxDC to draw on
659 @param llist the wxLayoutList
660 @param offset an optional offset to shift printout
661 */
662 void Draw(wxDC &dc,
663 wxLayoutList *llist,
664 const wxPoint &offset = wxPoint(0,0)) const;
665
666 /** Recalculates the positions of objects and the height of the
667 line.
668 @param dc the wxDC to draw on
669 @param llist th e wxLayoutList
670 @param cursorPos if not NULL, set cursor screen position in there
671 @param cursorSize if not cursorPos != NULL, set cursor size in there
672 @param cursorStyle if non NULL where to store styleinfo for cursor pos
673 @param cx if cursorPos != NULL, the cursor x position
674 @param suppressStyleUpdate FALSe normally, only to suppress updating of m_StyleInfo
675 */
676 void Layout(wxDC &dc,
677 wxLayoutList *llist,
678 wxPoint *cursorPos = NULL,
679 wxPoint *cursorSize = NULL,
680 wxLayoutStyleInfo *cursorStyle = NULL,
681 int cx = 0,
682 bool suppressStyleUpdate = false);
683
684 /** This function finds an object belonging to a given cursor
685 position. It assumes that Layout() has been called before.
686 @param dc the wxDC to use for calculations
687 @param xpos screen x position
688 @param found if non-NULL set to false if we return the last
689 object before the cursor, to true if we really have an object
690 for that position
691 @return pointer to the object
692 */
693 wxLayoutObject * FindObjectScreen(wxDC &dc,
694 CoordType xpos,
695 bool *found = NULL);
696
697 /** This sets the style info for the beginning of this line.
698 @param si styleinfo structure
699 */
700 void ApplyStyle(const wxLayoutStyleInfo &si)
701 { m_StyleInfo = si; }
702
703 //@}
704
705 /**@name List traversal */
706 //@{
707 /// Returns pointer to next line.
708 wxLayoutLine *GetNextLine() const { return m_Next; }
709
710 /// Returns pointer to previous line.
711 wxLayoutLine *GetPreviousLine() const { return m_Previous; }
712
713 /// Sets the link to the next line.
714 void SetNext(wxLayoutLine *next)
715 { m_Next = next; if(next) next->m_Previous = this; }
716
717 /// Sets the link to the previous line.
718 void SetPrevious(wxLayoutLine *previous)
719 { m_Previous = previous; if(previous) previous->m_Next = this; }
720 //@}
721
722 /// Returns the position of this line on the canvas.
723 wxPoint GetPosition() const { return m_Position; }
724
725 /// Returns the height of this line.
726 CoordType GetHeight() const { return m_Height; }
727
728 /// Returns the width of this line.
729 CoordType GetWidth() const { return m_Width; }
730
731 /// Recalculates the position of this line on the canvas.
732 wxPoint RecalculatePosition(wxLayoutList *llist);
733
734 /** Copies the contents of this line to another wxLayoutList
735 @param llist the wxLayoutList destination
736 @param from x cursor coordinate where to start
737 @param to x cursor coordinate where to stop, -1 for end of line
738 */
739 void Copy(wxLayoutList *llist,
740 CoordType from = 0,
741 CoordType to = -1);
742
743 #ifdef WXLAYOUT_DEBUG
744 void Debug() const;
745 #endif
746 wxLayoutStyleInfo const & GetStyleInfo() const { return m_StyleInfo; }
747
748 /// Returns dirty state
749 bool IsDirty() const { return m_Dirty; }
750
751 /** Marks this line as diry.
752 @param left xpos from where it is dirty or -1 for all
753 */
754 void MarkDirty(CoordType left = -1)
755 {
756 if ( left != -1 )
757 {
758 if ( m_updateLeft == -1 || left < m_updateLeft )
759 m_updateLeft = left;
760 }
761
762 m_Dirty = true;
763 if(m_Next) m_Next->MarkDirty();
764 }
765
766 /// Reset the dirty flag
767 void MarkClean() { m_Dirty = false; m_updateLeft = -1; }
768
769 private:
770 /// Destructor is private. Use DeleteLine() to remove it.
771 ~wxLayoutLine(){};
772
773 /**@name Functions to let the lines synchronise with each other. */
774 //@{
775 /** Sets the height of this line. Will mark following lines as
776 dirty.
777 @param height new height
778 */
779 void SetHeight( CoordType height, wxLayoutList * WXUNUSED(llist) )
780 {
781 m_Height = height; MarkDirty();
782 }
783
784 /** Updates the line numbers. */
785 void ReNumber();
786 //@}
787
788 private:
789 /// The line number.
790 CoordType m_LineNumber;
791
792 /// The line length in cursor positions.
793 CoordType m_Length;
794
795 /// The total height of the line.
796 CoordType m_Height;
797
798 /// The total width of the line on screen.
799 CoordType m_Width;
800
801 /// The baseline for drawing objects
802 CoordType m_BaseLine;
803
804 /// The position on the canvas.
805 wxPoint m_Position;
806
807 /// The list of objects
808 wxLayoutObjectList m_ObjectList;
809
810 /// Have we been changed since the last layout?
811 bool m_Dirty;
812
813 /// The coordinate of the left boundary of the update rectangle (if m_Dirty)
814 CoordType m_updateLeft;
815
816 /// Pointer to previous line if it exists.
817 wxLayoutLine *m_Previous;
818
819 /// Pointer to next line if it exists.
820 wxLayoutLine *m_Next;
821
822 /// A StyleInfo structure, holding the current settings.
823 wxLayoutStyleInfo m_StyleInfo;
824
825 /// Just to suppress gcc compiler warnings.
826 friend class dummy;
827
828 private:
829 wxLayoutLine(const wxLayoutLine &);
830 };
831
832
833 /* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
834
835 The wxLayoutList object
836
837 * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
838 /** The wxLayoutList is a list of wxLayoutLine objects. It provides a
839 higher level of abstraction for the text and can generally be considered
840 as representing "the text".
841 */
842 class wxLayoutList
843 {
844 public:
845 /// Constructor.
846 wxLayoutList();
847
848 /// Destructor.
849 ~wxLayoutList();
850
851 #ifdef WXLAYOUT_USE_CARET
852 /// give us the pointer to the caret to use
853 void SetCaret(wxCaret *caret) { m_caret = caret; }
854 #endif // WXLAYOUT_USE_CARET
855
856 /// Clear the list.
857 void Clear(int family = wxROMAN,
858 int size=WXLO_DEFAULTFONTSIZE,
859 int style=wxNORMAL,
860 int weight=wxNORMAL,
861 int underline=0,
862 wxColour *fg=NULL,
863 wxColour *bg=NULL);
864
865 /// Empty: clear the list but leave font settings.
866 void Empty();
867
868 /** Enable or disable auto-formatting. Normally, while editing this
869 should be enabled which is the default. While
870 inserting/deleting lots of text, it makes sense to temporarily
871 disable this.
872 @param enable true to enable, false to disable
873 */
874
875 void SetAutoFormatting(bool enable = true)
876 { m_AutoFormat = enable; }
877
878 /**@name Cursor Management */
879 //@{
880 /** Set new cursor position.
881 @param p new position
882 @return bool if it could be set
883 */
884 bool MoveCursorTo(wxPoint const &p);
885
886 /** Move cursor up or down.
887 @param n
888 @return bool if it could be moved
889 */
890 bool MoveCursorVertically(int n);
891
892 /** Move cursor left or right.
893 @param n = number of positions to move
894 @return bool if it could be moved
895 */
896 bool MoveCursorHorizontally(int n);
897
898 /** Move cursor to the left or right counting in words
899 @param n = number of positions in words
900 @param untilNext: puts the cursor at the start of the next word if true,
901 leaves it at the end of the current one otherwise
902 @return bool if it could be moved
903 */
904 bool MoveCursorWord(int n, bool untilNext = true);
905
906 /// Move cursor to end of line.
907 void MoveCursorToEndOfLine()
908 {
909 wxASSERT(m_CursorLine);
910 MoveCursorHorizontally(m_CursorLine->GetLength()-m_CursorPos.x);
911 }
912
913 /// Move cursor to the start of line.
914 void MoveCursorToBeginOfLine()
915 { MoveCursorHorizontally(-m_CursorPos.x); }
916
917 /// get the number of lines in the list
918 size_t GetNumLines() const { return m_numLines; }
919
920 /// Returns current cursor position.
921 const wxPoint &GetCursorPos(wxDC & WXUNUSED(dc) ) const
922 { return m_CursorPos; }
923 const wxPoint &GetCursorPos() const { return m_CursorPos; }
924 wxLayoutLine * GetCursorLine() { return m_CursorLine; }
925
926 /// move cursor to the end of text
927 void MoveCursorToEnd()
928 {
929 MoveCursorTo(wxPoint(0, GetNumLines() - 1));
930 MoveCursorToEndOfLine();
931 }
932
933 //@}
934
935 /**@name Editing functions.
936 All of these functions return true on success and false on
937 failure. */
938 //@{
939 /// Insert text at current cursor position.
940 bool Insert(wxString const &text);
941
942 /// Insert some other object at current cursor position.
943 bool Insert(wxLayoutObject *obj);
944
945 /// Inserts objects at current cursor positions
946 bool Insert(wxLayoutList *llist);
947
948 /// Inserts a linebreak at current cursor position.
949 bool LineBreak();
950 /** Wraps the current line. Searches to the left of the cursor to
951 break the line. Does nothing if the cursor position is before
952 the break position parameter.
953 @param column the break position for the line, maximum length
954 @return true if line got broken
955 */
956 bool WrapLine(CoordType column);
957
958 /** Wraps the complete buffer.
959 @param column the break position for the line, maximum length
960 @return true if line got broken
961 */
962 bool WrapAll(CoordType column);
963 /** This function deletes npos cursor positions.
964 @param npos how many positions
965 @return true if everything got deleted
966 */
967 bool Delete(CoordType npos);
968
969 /** Delete the next n lines.
970 @param n how many lines to delete
971 @return how many it could not delete
972 */
973 int DeleteLines(int n);
974
975 /// Delete to end of line.
976 void DeleteToEndOfLine()
977 {
978 wxASSERT(m_CursorLine);
979 Delete(m_CursorLine->GetLength()-m_CursorPos.x);
980 }
981
982 /// Delete to begin of line.
983 void DeleteToBeginOfLine()
984 {
985 wxASSERT(m_CursorLine);
986 CoordType n = m_CursorPos.x;
987 #ifdef WXLAYOUT_DEBUG
988 wxASSERT(MoveCursorHorizontally(-n));
989 #else
990 MoveCursorHorizontally(-n);
991 #endif
992 Delete(n);
993 }
994
995 /** Delete the next word.
996 */
997 void DeleteWord()
998 {
999 wxASSERT(m_CursorLine);
1000 m_CursorLine->DeleteWord(m_CursorPos.x);
1001 }
1002
1003 //@}
1004
1005 /** Finds text in this list.
1006 @param needle the text to find
1007 @param cpos the position where to start the search
1008 @return the cursor coord where it was found or (-1,-1)
1009 */
1010 wxPoint FindText(const wxString &needle, const wxPoint &cpos = wxPoint(0,0)) const;
1011
1012 /**@name Formatting options */
1013 //@{
1014 /// sets font parameters
1015 void SetFont(int family, int size, int style,
1016 int weight, int underline,
1017 wxColour *fg,
1018 wxColour *bg);
1019
1020 /// sets font parameters, colours by name
1021 void SetFont(int family=-1, int size = -1, int style=-1,
1022 int weight=-1, int underline = -1,
1023 wxChar const *fg = NULL,
1024 wxChar const *bg = NULL);
1025
1026 /// changes to the next larger font size
1027 inline void SetFontLarger()
1028 { SetFont(-1,(12*m_CurrentStyleInfo.size)/10); }
1029
1030 /// changes to the next smaller font size
1031 inline void SetFontSmaller()
1032 { SetFont(-1,(10*m_CurrentStyleInfo.size)/12); }
1033
1034 /// set font family
1035 inline void SetFontFamily(int family) { SetFont(family); }
1036
1037 /// set font size
1038 inline void SetFontSize(int size) { SetFont(-1,size); }
1039
1040 /// set font style
1041 inline void SetFontStyle(int style) { SetFont(-1,-1,style); }
1042
1043 /// set font weight
1044 inline void SetFontWeight(int weight) { SetFont(-1,-1,-1,weight); }
1045
1046 /// toggle underline flag
1047 inline void SetFontUnderline(bool ul) { SetFont(-1,-1,-1,-1,(int)ul); }
1048
1049 /// set font colours by name
1050 inline void SetFontColour(wxChar const *fg, wxChar const *bg = NULL)
1051 { SetFont(-1,-1,-1,-1,-1,fg,bg); }
1052
1053 /// set font colours by colour
1054 inline void SetFontColour(wxColour *fg, wxColour *bg = NULL)
1055 { SetFont(-1,-1,-1,-1,-1,fg,bg); }
1056
1057 /**
1058 Returns a pointer to the default settings.
1059 This is only valid temporarily and should not be stored
1060 anywhere.
1061 @return the default settings of the list
1062 */
1063 wxLayoutStyleInfo &GetDefaultStyleInfo() { return m_DefaultStyleInfo ; }
1064 wxLayoutStyleInfo &GetStyleInfo() { return m_CurrentStyleInfo ; }
1065 const wxLayoutStyleInfo &GetStyleInfo() const { return m_CurrentStyleInfo ; }
1066 const wxLayoutStyleInfo &GetCursorStyleInfo() const { return m_CursorStyleInfo ; }
1067
1068 /// is the current font underlined?
1069 bool IsFontUnderlined() const { return GetCursorStyleInfo().underline != 0; }
1070
1071 /// is the current font bold?
1072 bool IsFontBold() const { return GetCursorStyleInfo().weight == wxBOLD; }
1073
1074 /// is the current font italic?
1075 bool IsFontItalic() const { return GetCursorStyleInfo().style == wxITALIC; }
1076
1077 /// set underline if it was off, turn it off if it was on
1078 void ToggleFontUnderline()
1079 { SetFontUnderline(!IsFontUnderlined()); }
1080
1081 /// make font bold if it was normal or make it normal if it was bold
1082 void ToggleFontWeight()
1083 { SetFontWeight(IsFontBold() ? wxNORMAL : wxBOLD); }
1084
1085 /// make font italic if it was normal or make it normal if it was italic
1086 void ToggleFontItalics()
1087 { SetFontStyle(IsFontItalic() ? wxNORMAL : wxITALIC); }
1088
1089 //@}
1090
1091 /**@name Drawing */
1092 //@{
1093 /** Draws the complete list on a wxDC.
1094 @param dc the wxDC to draw on
1095 @param offset an optional offset to shift printout
1096 @param top optional y coordinate where to start drawing
1097 @param bottom optional y coordinate where to stop drawing
1098 @param clipStrictly if set, do not draw objects which reach
1099 beyond "bottom". Set this when printing.
1100 */
1101 void Draw(wxDC &dc,
1102 const wxPoint &offset = wxPoint(0,0),
1103 CoordType top = -1, CoordType bottom = -1,
1104 bool clipStrictly = false);
1105
1106 /** Calculates new layout for the list, like Draw() but does not
1107 actually draw it.
1108 @param dc the wxDC to draw on
1109 @param bottom optional y coordinate where to stop calculating
1110 @param forceAll force re-layout of all lines
1111 @param cpos Can hold a cursorposition, and will be overwritten
1112 with the corresponding DC position.
1113 @param csize Will hold the cursor size relating to cpos.
1114 */
1115 void Layout(wxDC &dc, CoordType bottom = -1, bool forceAll = false,
1116 wxPoint *cpos = NULL,
1117 wxPoint *csize = NULL);
1118
1119 /** Ensure that the whole list will be recalculate on the next call
1120 to Layout() or Draw().
1121 @param redrawAll true or false to reset it
1122 */
1123 void ForceTotalLayout(bool redrawAll = true)
1124 { m_ReLayoutAll = redrawAll; }
1125
1126 /** Returns the screen coordinates relating to a given cursor
1127 position and the size of the cursor at that position.
1128 @param dc for which to calculate it
1129 @param cpos Cursor position to look for.
1130 @param csize If non-NULL, will be set to the cursor size.
1131 @return The cursor position on the DC.
1132 */
1133 wxPoint GetScreenPos(wxDC &dc, const wxPoint &cpos, wxPoint *csize = NULL);
1134
1135 /** Calculates new sizes for everything in the list, like Layout()
1136 but this is needed after the list got changed.
1137 @param dc the wxDC to draw on
1138 @param bottom optional y coordinate where to stop calculating
1139 */
1140 void Recalculate(wxDC &dc, CoordType bottom = -1);
1141
1142 /** Returns the size of the list in screen coordinates.
1143 The return value only makes sense after the list has been
1144 drawn.
1145 @return a wxPoint holding the maximal x/y coordinates used for
1146 drawing
1147 */
1148 wxPoint GetSize() const;
1149
1150 /** Returns the cursor position on the screen.
1151 */
1152 wxPoint GetCursorScreenPos() const;
1153
1154 /** Draws the cursor.
1155 @param active If true, draw a bold cursor to mark window as
1156 active.
1157 @param translate optional translation of cursor coords on screen
1158 */
1159 void DrawCursor(wxDC &dc,
1160 bool active = true,
1161 const wxPoint & translate = wxPoint(0,0));
1162
1163 /** This function finds an object belonging to a given screen
1164 position. It assumes that Layout() has been called before.
1165 @param pos screen position
1166 @param cursorPos if non NULL, store cursor position in there
1167 @param found if used, set this to true if we really found an
1168 object, to false if we had to take the object near to it
1169 @return pointer to the object
1170 */
1171 wxLayoutObject * FindObjectScreen(wxDC &dc,
1172 wxPoint const pos,
1173 wxPoint *cursorPos = NULL,
1174 bool *found = NULL);
1175
1176 /** Called by the objects to update the update rectangle.
1177 @param x horizontal coordinate to include in rectangle
1178 @param y vertical coordinate to include in rectangle
1179 */
1180 void SetUpdateRect(CoordType x, CoordType y);
1181
1182 /** Called by the objects to update the update rectangle.
1183 @param p a point to include in it
1184 */
1185 void SetUpdateRect(const wxPoint &p)
1186 { SetUpdateRect(p.x,p.y); }
1187
1188 /// adds the cursor position to the update rectangle
1189 void AddCursorPosToUpdateRect()
1190 {
1191 #ifndef WXLAYOUT_USE_CARET
1192 SetUpdateRect(m_CursorScreenPos);
1193 SetUpdateRect(m_CursorScreenPos+m_CursorSize);
1194 //#else - the caret will take care of refreshing itself
1195 #endif // !WXLAYOUT_USE_CARET
1196 }
1197
1198 /// Invalidates the update rectangle.
1199 void InvalidateUpdateRect() { m_UpdateRectValid = false; }
1200
1201 /// Returns the update rectangle.
1202 const wxRect *GetUpdateRect() const { return &m_UpdateRect; }
1203 //@}
1204
1205 /// get the current cursor size
1206 const wxPoint& GetCursorSize() const { return m_CursorSize; }
1207
1208 /**@name For exporting one object after another. */
1209 //@{
1210 /** Returns a pointer to the first line in the list. */
1211 wxLayoutLine *GetFirstLine()
1212 {
1213 wxASSERT(m_FirstLine);
1214 return m_FirstLine;
1215 }
1216 //@}
1217
1218 /// Begin selecting text
1219 void StartSelection(const wxPoint& cpos = wxPoint(-1,-1),
1220 const wxPoint& spos = wxPoint(-1,-1));
1221
1222 // Continue selecting text
1223 void ContinueSelection(const wxPoint& cpos = wxPoint(-1,-1),
1224 const wxPoint& spos = wxPoint(-1,-1));
1225
1226 /// End selecting text.
1227 void EndSelection(const wxPoint& cpos = wxPoint(-1,-1),
1228 const wxPoint& spos = wxPoint(-1,-1));
1229
1230 /// Discard the current selection
1231 void DiscardSelection();
1232
1233 /// Are we still selecting text?
1234 bool IsSelecting() const;
1235
1236 /// Is the given point (text coords) selected?
1237 bool IsSelected(const wxPoint &cursor) const;
1238
1239 /// Do we have a non null selection?
1240 bool HasSelection() const
1241 { return m_Selection.m_valid || m_Selection.m_selecting; }
1242
1243 /** Return the selection as a wxLayoutList.
1244 @param invalidate if true, the selection will be invalidated after this and can no longer be used.
1245 @return Another layout list object holding the selection, must be freed by caller
1246 */
1247 wxLayoutList *GetSelection(class wxLayoutDataObject *wxldo = NULL, bool invalidate = true);
1248
1249 /// Delete selected bit
1250 void DeleteSelection();
1251
1252 wxLayoutList *Copy(const wxPoint &from = wxPoint(0,0),
1253 const wxPoint &to = wxPoint(-1,-1));
1254
1255 /// starts highlighting of text for selections
1256 void StartHighlighting(wxDC &dc);
1257
1258 /// ends highlighting of text for selections
1259 void EndHighlighting(wxDC &dc);
1260
1261 /** Tests whether this layout line is selected and needs
1262 highlighting.
1263 @param line to test for
1264 @param from set to first cursorpos to be highlighted (for returncode == -1)
1265 @param to set to last cursorpos to be highlighted (for returncode == -1)
1266 @return 0 = not selected, 1 = fully selected, -1 = partially
1267 selected
1268 */
1269 int IsSelected(const wxLayoutLine *line, CoordType *from, CoordType *to);
1270
1271 void ApplyStyle(wxLayoutStyleInfo const &si, wxDC &dc);
1272 #ifdef WXLAYOUT_DEBUG
1273 void Debug();
1274 #endif
1275
1276 // for wxLayoutLine usage only
1277 void IncNumLines() { m_numLines++; }
1278 void DecNumLines() { m_numLines--; }
1279
1280 /// get the line by number
1281 wxLayoutLine *GetLine(CoordType index) const;
1282
1283 /** Reads objects from a string and inserts them. Returns NULL if
1284 string is empty or a linebreak was found.
1285 @param istr stream to read from, will bee changed
1286 */
1287 void Read(wxString &istr);
1288
1289 private:
1290 /// Clear the list.
1291 void InternalClear();
1292
1293 /// The list of lines.
1294 wxLayoutLine *m_FirstLine;
1295
1296 /// The number of lines in the list (store instead recalculating for speed)
1297 size_t m_numLines;
1298
1299 /// The update rectangle which needs to be refreshed:
1300 wxRect m_UpdateRect;
1301
1302 /// Is the update rectangle valid?
1303 bool m_UpdateRectValid;
1304
1305 /// Shall we auto-format?
1306 bool m_AutoFormat;
1307
1308 /// Shall we re-layout everything?
1309 bool m_ReLayoutAll;
1310
1311 /**@name Cursor Management */
1312 //@{
1313 /// Where the text cursor (column,line) is.
1314 wxPoint m_CursorPos;
1315
1316 /// Where the cursor should be drawn.
1317 wxPoint m_CursorScreenPos;
1318
1319 /// The line where the cursor is.
1320 wxLayoutLine *m_CursorLine;
1321
1322 /// The size of the cursor.
1323 wxPoint m_CursorSize;
1324
1325 /// Has the cursor moved (is m_CursorScreenPos up to date)?
1326 bool m_movedCursor;
1327
1328 #ifdef WXLAYOUT_USE_CARET
1329 /// the caret
1330 wxCaret *m_caret;
1331 #endif // WXLAYOUT_USE_CARET
1332 //@}
1333
1334 /// selection.state and begin/end coordinates
1335 struct Selection
1336 {
1337 Selection() { m_valid = m_selecting = m_discarded = false; }
1338
1339 bool m_valid;
1340 bool m_selecting;
1341 bool m_discarded; // may be true only until the next redraw
1342
1343 // returns true if we already have the screen coordinates of the
1344 // selection start and end
1345 bool HasValidScreenCoords() const
1346 { return m_ScreenA.x != -1 && m_ScreenB.x != -1; }
1347
1348 // the start and end of the selection coordinates in pixels
1349 wxPoint m_ScreenA, m_ScreenB;
1350
1351 // these coordinates are in text positions, not in pixels
1352 wxPoint m_CursorA, m_CursorB;
1353 } m_Selection;
1354 /** @name Font parameters. */
1355 //@{
1356 /// this object manages the fonts for us
1357 wxFontCache m_FontCache;
1358
1359 /// the default setting:
1360 wxLayoutStyleInfo m_DefaultStyleInfo;
1361
1362 /// the current setting:
1363 wxLayoutStyleInfo m_CurrentStyleInfo;
1364
1365 /// the current setting:
1366 wxLayoutStyleInfo m_CursorStyleInfo;
1367 //@}
1368 };
1369
1370 /* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
1371
1372 The wxLayoutDataObject for exporting data to the clipboard in our
1373 own format.
1374
1375 * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
1376 class wxLayoutDataObject : public wxCustomDataObject
1377 {
1378 public:
1379 wxLayoutDataObject()
1380 {
1381 SetFormat(wxT("application/wxlayoutlist"));
1382 }
1383
1384 // type safe wrappers
1385 void SetLayoutData(const wxString& text)
1386 { SetData(text.length() + 1, text.c_str()); }
1387
1388 const wxChar *GetLayoutData() const { return (const wxChar *)GetData(); }
1389 };
1390
1391 /* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
1392
1393 The wxLayoutPrintout object for printing within the wxWidgets print
1394 framework.
1395
1396 * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
1397 /** This class implements a wxPrintout for printing a wxLayoutList within
1398 the wxWidgets printing framework.
1399 */
1400 class wxLayoutPrintout: public wxPrintout
1401 {
1402 public:
1403 /** Constructor.
1404 @param llist pointer to the wxLayoutList to be printed
1405 @param title title for PS file or windows
1406 */
1407 wxLayoutPrintout(wxLayoutList *llist,
1408 wxString const & title =
1409 _T("wxLayout Printout"));
1410
1411 /// Destructor.
1412 ~wxLayoutPrintout(){};
1413
1414 /** Function which prints the n-th page.
1415 @param page the page number to print
1416 @return bool true if we are not at end of document yet
1417 */
1418 bool OnPrintPage(int page);
1419 /** Checks whether page exists in document.
1420 @param page number of page
1421 @return true if page exists
1422 */
1423 bool HasPage(int page);
1424
1425 /** Gets called from wxWidgets to find out which pages are existing.
1426 I'm not totally sure about the parameters though.
1427 @param minPage the first page in the document
1428 @param maxPage the last page in the document
1429 @param selPageFrom the first page to be printed
1430 @param selPageTo the last page to be printed
1431 */
1432 void GetPageInfo(int *minPage, int *maxPage,
1433 int *selPageFrom, int *selPageTo);
1434 protected:
1435 /** This little function scales the DC so that the printout has
1436 roughly the same size as the output on screen.
1437 @param dc the wxDC to scale
1438 @return the scale that was applied
1439 */
1440 float ScaleDC(wxDC *dc);
1441
1442 /* no longer used
1443 virtual void DrawHeader(wxDC &dc, wxPoint topleft, wxPoint bottomright, int pageno);
1444 */
1445
1446 private:
1447 /// The list to print.
1448 wxLayoutList *m_llist;
1449
1450 /// Title for PS file or window.
1451 wxString m_title;
1452
1453 /// The real paper size.
1454 int m_PageHeight, m_PageWidth;
1455
1456 /// How much we actually print per page.
1457 int m_PrintoutHeight;
1458
1459 /// How many pages we need to print.
1460 int m_NumOfPages;
1461
1462 /// Top left corner where we start printing.
1463 wxPoint m_Offset;
1464 };
1465
1466
1467 #endif // WXLLIST_H