+
+// 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 WXDLLEXPORT wxHtmlSelection
+{
+public:
+ wxHtmlSelection()
+ : m_fromPos(wxDefaultPosition), m_toPos(wxDefaultPosition),
+ m_fromCell(NULL), m_toCell(NULL) {}
+
+ void Set(const wxPoint& fromPos, wxHtmlCell *fromCell,
+ const wxPoint& toPos, wxHtmlCell *toCell)
+ {
+ m_fromCell = fromCell;
+ m_toCell = toCell;
+ m_fromPos = fromPos;
+ m_toPos = toPos;
+ }
+
+ const wxHtmlCell *GetFromCell() const { return m_fromCell; }
+ const wxHtmlCell *GetToCell() const { return m_toCell; }
+
+ // these values are *relative* to From/To cell's origin:
+ const wxPoint& GetFromPos() const { return m_fromPos; }
+ const wxPoint& GetToPos() const { return m_toPos; }
+
+ const bool IsEmpty() const
+ { return m_fromPos == wxDefaultPosition &&
+ m_toPos == wxDefaultPosition; }
+
+private:
+ wxPoint m_fromPos, m_toPos;
+ 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 WXDLLEXPORT wxHtmlRenderingState
+{
+public:
+ wxHtmlRenderingState(wxHtmlSelection *s)
+ : m_selection(s), m_selState(wxHTML_SEL_OUT) {}
+ wxHtmlSelection *GetSelection() const { return m_selection; }
+
+ 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:
+ wxHtmlSelection *m_selection;
+ wxHtmlSelectionState m_selState;
+ wxColour m_fgColour, m_bgColour;
+};
+
+// Flags for wxHtmlCell::FindCellByPos
+enum
+{
+ wxHTML_FIND_TERMINAL = 0x0001,
+ wxHTML_FIND_NONTERMINAL = 0x0002
+};
+
+
+// ---------------------------------------------------------------------------