X-Git-Url: https://git.saurik.com/wxWidgets.git/blobdiff_plain/61b6c82294f4af6c5d53fb65b21e92f4fe83887a..6bf921176c7ca7a738e057648dde7fbc57f3e682:/interface/wx/html/htmlcell.h diff --git a/interface/wx/html/htmlcell.h b/interface/wx/html/htmlcell.h index 26a050e017..4f23a89c14 100644 --- a/interface/wx/html/htmlcell.h +++ b/interface/wx/html/htmlcell.h @@ -3,10 +3,85 @@ // Purpose: interface of wxHtml*Cell // Author: wxWidgets team // RCS-ID: $Id$ -// Licence: wxWindows license +// Licence: wxWindows licence ///////////////////////////////////////////////////////////////////////////// +/** + @class wxHtmlRenderingStyle + + wxHtmlSelection is data holder with information about text selection. + Selection is defined by two positions (beginning and end of the selection) + and two leaf(!) cells at these positions. + + @library{wxhtml} + @category{html} +*/ +class wxHtmlSelection +{ +public: + wxHtmlSelection(); + + // this version is used for the user selection defined with the mouse + void Set(const wxPoint& fromPos, const wxHtmlCell *fromCell, + const wxPoint& toPos, const wxHtmlCell *toCell); + void Set(const wxHtmlCell *fromCell, const wxHtmlCell *toCell); + + const wxHtmlCell *GetFromCell() const; + const wxHtmlCell *GetToCell() const; + + // these values are in absolute coordinates: + const wxPoint& GetFromPos() const; + const wxPoint& GetToPos() const; + + // these are From/ToCell's private data + void ClearFromToCharacterPos(); + bool AreFromToCharacterPosSet() const; + + void SetFromCharacterPos (wxCoord pos); + void SetToCharacterPos (wxCoord pos); + wxCoord GetFromCharacterPos () const; + wxCoord GetToCharacterPos () const; + + bool IsEmpty() const; +}; + + + +enum wxHtmlSelectionState +{ + wxHTML_SEL_OUT, // currently rendered cell is outside the selection + wxHTML_SEL_IN, // ... is inside selection + wxHTML_SEL_CHANGING // ... is the cell on which selection state changes +}; + + +/** + @class wxHtmlRenderingState + + Selection state is passed to wxHtmlCell::Draw so that it can render itself + differently e.g. when inside text selection or outside it. + + @library{wxhtml} + @category{html} +*/ +class wxHtmlRenderingState +{ +public: + wxHtmlRenderingState(); + + void SetSelectionState(wxHtmlSelectionState s); + wxHtmlSelectionState GetSelectionState() const; + + void SetFgColour(const wxColour& c); + const wxColour& GetFgColour() const; + void SetBgColour(const wxColour& c); + const wxColour& GetBgColour() const; + void SetBgMode(int m); + int GetBgMode() const; +}; + + /** @class wxHtmlRenderingStyle @@ -69,6 +144,25 @@ public: }; + +// Flags for wxHtmlCell::FindCellByPos +enum +{ + wxHTML_FIND_EXACT = 1, + wxHTML_FIND_NEAREST_BEFORE = 2, + wxHTML_FIND_NEAREST_AFTER = 4 +}; + + +// Superscript/subscript/normal script mode of a cell +enum wxHtmlScriptMode +{ + wxHTML_SCRIPT_NORMAL, + wxHTML_SCRIPT_SUB, + wxHTML_SCRIPT_SUP +}; + + /** @class wxHtmlCell @@ -95,19 +189,33 @@ public: /** This method is used to adjust pagebreak position. - The parameter is variable that contains y-coordinate of page break + The first parameter is a variable that contains the y-coordinate of the page break (= horizontal line that should not be crossed by words, images etc.). If this cell cannot be divided into two pieces (each one on another page) - then it moves the pagebreak few pixels up. + then it either moves the pagebreak a few pixels up, if possible, or, if + the cell cannot fit on the page at all, then the cell is forced to + split unconditionally. + Returns @true if pagebreak was modified, @false otherwise. + @param pagebreak + position in pixel of the pagebreak. + + @param known_pagebreaks + the list of the previous pagebreaks + + @param pageHeight + the height in pixel of the page drawable area + Usage: @code - while (container->AdjustPagebreak(&p)) {} + while (container->AdjustPagebreak(&p, kp, ph)) {} @endcode + */ virtual bool AdjustPagebreak(int* pagebreak, - wxArrayInt& known_pagebreaks) const; + const wxArrayInt& known_pagebreaks, + int pageHeight) const; /** Renders the cell. @@ -262,7 +370,7 @@ public: This function is simple event handler. Each time the user clicks mouse button over a cell within wxHtmlWindow this method of that cell is called. - Default behavior is to call wxHtmlWindow::LoadPage. + Default behaviour is to call wxHtmlWindow::LoadPage. @param window interface to the parent HTML window @@ -413,8 +521,10 @@ public: Colour of top and left lines @param clr2 Colour of bottom and right lines + @param border + Size of the border in pixels */ - void SetBorder(const wxColour& clr1, const wxColour& clr2); + void SetBorder(const wxColour& clr1, const wxColour& clr2, int border = 1); /** Sets the indentation (free space between borders of container and subcells).