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