+
+// 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.
+class WXDLLIMPEXP_HTML wxHtmlSelection
+{
+public:
+ wxHtmlSelection()
+ : m_fromPos(wxDefaultPosition), m_toPos(wxDefaultPosition),
+ m_fromPrivPos(wxDefaultPosition), m_toPrivPos(wxDefaultPosition),
+ m_fromCell(NULL), m_toCell(NULL) {}
+
+ 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 { return m_fromCell; }
+ const wxHtmlCell *GetToCell() const { return m_toCell; }
+
+ // these values are in absolute coordinates:
+ const wxPoint& GetFromPos() const { return m_fromPos; }
+ const wxPoint& GetToPos() const { return m_toPos; }
+
+ // these are From/ToCell's private data
+ const wxPoint& GetFromPrivPos() const { return m_fromPrivPos; }
+ const wxPoint& GetToPrivPos() const { return m_toPrivPos; }
+ void SetFromPrivPos(const wxPoint& pos) { m_fromPrivPos = pos; }
+ void SetToPrivPos(const wxPoint& pos) { m_toPrivPos = pos; }
+ void ClearPrivPos() { m_toPrivPos = m_fromPrivPos = wxDefaultPosition; }
+
+ bool IsEmpty() const
+ { return m_fromPos == wxDefaultPosition &&
+ m_toPos == wxDefaultPosition; }
+
+private:
+ wxPoint m_fromPos, m_toPos;
+ wxPoint m_fromPrivPos, m_toPrivPos;
+ const wxHtmlCell *m_fromCell, *m_toCell;
+};
+
+
+
+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
+};
+
+// Selection state is passed to wxHtmlCell::Draw so that it can render itself
+// differently e.g. when inside text selection or outside it.
+class WXDLLIMPEXP_HTML wxHtmlRenderingState
+{
+public:
+ wxHtmlRenderingState() : m_selState(wxHTML_SEL_OUT) {}
+
+ void SetSelectionState(wxHtmlSelectionState s) { m_selState = s; }
+ wxHtmlSelectionState GetSelectionState() const { return m_selState; }
+
+ void SetFgColour(const wxColour& c) { m_fgColour = c; }
+ const wxColour& GetFgColour() const { return m_fgColour; }
+ void SetBgColour(const wxColour& c) { m_bgColour = c; }
+ const wxColour& GetBgColour() const { return m_bgColour; }
+
+private:
+ wxHtmlSelectionState m_selState;
+ wxColour m_fgColour, m_bgColour;
+};
+
+
+// HTML rendering customization. This class is used when rendering wxHtmlCells
+// as a callback:
+class WXDLLIMPEXP_HTML wxHtmlRenderingStyle
+{
+public:
+ virtual ~wxHtmlRenderingStyle() {}
+ virtual wxColour GetSelectedTextColour(const wxColour& clr) = 0;
+ virtual wxColour GetSelectedTextBgColour(const wxColour& clr) = 0;
+};
+
+// Standard style:
+class WXDLLIMPEXP_HTML wxDefaultHtmlRenderingStyle : public wxHtmlRenderingStyle
+{
+public:
+ virtual wxColour GetSelectedTextColour(const wxColour& clr);
+ virtual wxColour GetSelectedTextBgColour(const wxColour& clr);
+};
+
+
+// Information given to cells when drawing them. Contains rendering state,
+// selection information and rendering style object that can be used to
+// customize the output.
+class WXDLLIMPEXP_HTML wxHtmlRenderingInfo
+{
+public:
+ wxHtmlRenderingInfo() : m_selection(NULL), m_style(NULL) {}
+
+ void SetSelection(wxHtmlSelection *s) { m_selection = s; }
+ wxHtmlSelection *GetSelection() const { return m_selection; }
+
+ void SetStyle(wxHtmlRenderingStyle *style) { m_style = style; }
+ wxHtmlRenderingStyle& GetStyle() { return *m_style; }
+
+ wxHtmlRenderingState& GetState() { return m_state; }
+
+protected:
+ wxHtmlSelection *m_selection;
+ wxHtmlRenderingStyle *m_style;
+ wxHtmlRenderingState m_state;
+};
+
+
+// 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
+};
+
+
+// ---------------------------------------------------------------------------