X-Git-Url: https://git.saurik.com/wxWidgets.git/blobdiff_plain/07071479f273ec269eef512ffe3208b407af666a..43a18898651f71010606d8682fdf88cfc1c02193:/user/wxLayout/wxllist.h diff --git a/user/wxLayout/wxllist.h b/user/wxLayout/wxllist.h index 9124a69205..a172072a87 100644 --- a/user/wxLayout/wxllist.h +++ b/user/wxLayout/wxllist.h @@ -44,6 +44,8 @@ # 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 }; @@ -79,7 +81,8 @@ public: */ virtual void Layout(wxDC & dc, wxPoint position, - CoordType baseLine) {} + CoordType baseLine) + { m_Position = position; } /** Draws an object. @param dc the wxDC to draw on @@ -278,6 +281,13 @@ public: 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 @@ -343,11 +353,11 @@ public: 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; } @@ -355,7 +365,7 @@ public: 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: @@ -402,12 +412,16 @@ protected: //---- 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; @@ -432,18 +446,23 @@ private: 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; };