# define Str(str) str
#endif
+#define WXLO_DEFAULTFONTSIZE 12
+
/// Types of currently supported layout objects.
enum wxLayoutObjectType
{ WXLO_TYPE_INVALID = 0, WXLO_TYPE_TEXT, WXLO_TYPE_CMD, WXLO_TYPE_ICON, WXLO_TYPE_LINEBREAK };
*/
virtual void Layout(wxDC & dc,
wxPoint position,
- CoordType baseLine) {}
+ CoordType baseLine)
+ { m_Position = position; }
/** Draws an object.
@param dc the wxDC to draw on
int weight=-1, int underline = -1,
char const *fg = NULL,
char const *bg = NULL);
+ /// changes to the next larger font size
+ inline void SetFontLarger(void)
+ { SetFont(-1,(12*m_FontPtSize)/10); }
+ /// changes to the next smaller font size
+ inline void SetFontSmaller(void)
+ { SetFont(-1,(10*m_FontPtSize)/12); }
+
/// set font family
inline void SetFontFamily(int family) { SetFont(family); }
/// set font size
bool IsEditable(void) const { return m_Editable; }
/// move cursor, returns true if it could move to the desired position
bool MoveCursor(int dx = 0, int dy = 0);
- void SetCursor(wxPoint const &p) { m_CursorPosition = p; }
+ void SetCursor(wxPoint const &p) { m_CursorPos = p; }
void DrawCursor(wxDC &dc, bool erase = false);
/// Get current cursor position cursor coords
- wxPoint GetCursor(void) const { return m_CursorPosition; }
+ wxPoint GetCursor(void) const { return m_CursorPos; }
/// Gets graphical coordinates of cursor
wxPoint GetCursorCoords(void) const { return m_CursorCoords; }
void Delete(CoordType count = 1);
void Insert(String const &text);
void Insert(wxLayoutObjectBase *obj);
- void Clear(int family = wxROMAN, int size=12, int style=wxNORMAL, int weight=wxNORMAL,
+ void Clear(int family = wxROMAN, int size=WXLO_DEFAULTFONTSIZE, int style=wxNORMAL, int weight=wxNORMAL,
int underline=0, char const *fg="black", char const *bg="white");
/// return a pointer to the default settings (dangerous, why?) FIXME:
//---- this is needed for editing:
/// where is the text cursor (column,line):
- wxPoint m_CursorPosition;
+ wxPoint m_CursorPos;
/// where to draw the cursor
wxPoint m_CursorCoords;
/// how large to draw it
wxPoint m_CursorSize;
-
+ /// object iterator for current cursor position:
+ iterator m_CursorObject;
+ /// position of cursor within m_CursorObject:
+ int m_CursorOffset;
+
/// to store content overwritten by cursor
wxMemoryDC m_CursorMemDC;
class wxLayoutPrintout: public wxPrintout
{
public:
- wxLayoutPrintout(wxLayoutList &llist, wxString const & title = "My printout")
- :wxPrintout(title)
- { m_llist = &llist; }
+ wxLayoutPrintout(wxLayoutList &llist, wxString const & title =
+ "wxLayout Printout");
bool OnPrintPage(int page);
bool HasPage(int page);
bool OnBeginDocument(int startPage, int endPage);
void GetPageInfo(int *minPage, int *maxPage, int *selPageFrom, int
*selPageTo);
void OnPreparePrinting(void);
+protected:
+ virtual void DrawHeader(wxDC &dc, wxPoint topleft, wxPoint bottomright, int pageno);
+
private:
wxLayoutList *m_llist;
+ wxString m_title;
int m_PageHeight, m_PageWidth;
+ // how much we actually print per page
+ int m_PrintoutHeight;
wxLayoutMargins m_Margins;
int m_NumOfPages;
};