X-Git-Url: https://git.saurik.com/wxWidgets.git/blobdiff_plain/5e0394ae9b7f3bd5be7014f81a91b3d0385fb4f5..f05df5a85aa0162124d52384c2ef87de64df2131:/user/wxLayout/wxllist.h diff --git a/user/wxLayout/wxllist.h b/user/wxLayout/wxllist.h index bb86c03a55..4916b960b4 100644 --- a/user/wxLayout/wxllist.h +++ b/user/wxLayout/wxllist.h @@ -15,6 +15,10 @@ #include "kbList.h" #include "wx/wx.h" +#include "wx/print.h" +#include "wx/printdlg.h" +#include "wx/generic/printps.h" +#include "wx/generic/prntdlgg.h" // skip the following defines if embedded in M application #ifdef M_BASEDIR @@ -189,6 +193,8 @@ public: }; +class wxLayoutPrintout; + /** This class provides a high level abstraction to the wxFText classes. @@ -215,24 +221,28 @@ public: wxColour const *bg); void SetFont(int family=-1, int size = -1, int style=-1, int weight=-1, int underline = -1, - char const *fg = NULL, - char const *bg = NULL); + char const *fg = (const char *) NULL, + char const *bg = (const char *) NULL); inline void SetFontFamily(int family) { SetFont(family); } inline void SetFontSize(int size) { SetFont(-1,size); } inline void SetFontStyle(int style) { SetFont(-1,-1,style); } inline void SetFontWeight(int weight) { SetFont(-1,-1,-1,weight); } inline void SetFontUnderline(bool ul) { SetFont(-1,-1,-1,-1,(int)ul); } - inline void SetFontColour(char const *fg, char const *bg = NULL) { SetFont(-1,-1,-1,-1,-1,fg,bg); } + inline void SetFontColour(char const *fg, char const *bg = (const char *) NULL) { SetFont(-1,-1,-1,-1,-1,fg,bg); } /** Draw the list on a given DC. @param findObject if true, return the object occupying the position specified by coords @param coords position where to find the object + @pageNo if > 0, print only that page of a document (for + printing) + @reallyDraw set this to false if you don't want to draw but just calculate the coordinates @return if findObject == true, the object or NULL */ wxLayoutObjectBase *Draw(wxDC &dc, bool findObject = false, - wxPoint const &coords = wxPoint(0,0)); + wxPoint const &coords = wxPoint(0,0), + int pageNo = -1, bool reallyDraw = true); #ifdef WXLAYOUT_DEBUG void Debug(void); @@ -244,6 +254,7 @@ public: void GetSize(CoordType *max_x, CoordType *max_y, CoordType *lineHeight); + /**@name Functionality for editing */ //@{ /// set list editable or read only @@ -264,11 +275,13 @@ public: /// return a pointer to the default settings: wxLayoutObjectCmd const *GetDefaults(void) const { return m_DefaultSetting ; } - wxLayoutObjectList::iterator FindCurrentObject(CoordType *offset = NULL); + wxLayoutObjectList::iterator FindCurrentObject(CoordType *offset = (CoordType *) NULL); // get the length of the line with the object pointed to by i, offs // only used to decide whether we are before or after linebreak CoordType GetLineLength(wxLayoutObjectList::iterator i, CoordType offs = 0); + wxLayoutPrintout *MakePrintout(wxString const &name); + //@} protected: /// font parameters: @@ -303,8 +316,23 @@ protected: bool m_Editable; /// find the object to the cursor position and returns the offset /// in there - wxLayoutObjectList::iterator FindObjectCursor(wxPoint *cpos, CoordType *offset = NULL); + wxLayoutObjectList::iterator FindObjectCursor(wxPoint *cpos, CoordType *offset = (CoordType *) NULL); }; +class wxLayoutPrintout: public wxPrintout +{ + public: + wxLayoutPrintout(wxLayoutList &llist, wxString const & title = "My printout"):wxPrintout(title) + { m_llist = &llist; m_maxPage = 0; } + bool OnPrintPage(int page); + bool HasPage(int page); + bool OnBeginDocument(int startPage, int endPage); + void GetPageInfo(int *minPage, int *maxPage, int *selPageFrom, int + *selPageTo); +private: + wxLayoutList *m_llist; + int m_maxPage; +}; + #endif // WXLLIST_H