+// Update the descent value when whe are in a <sub> or <sup>.
+// prevbase is the parent base
+void wxHtmlCell::SetScriptMode(wxHtmlScriptMode mode, long previousBase)
+{
+ m_ScriptMode = mode;
+
+ if (mode == wxHTML_SCRIPT_SUP)
+ m_ScriptBaseline = previousBase - (m_Height + 1) / 2;
+ else if (mode == wxHTML_SCRIPT_SUB)
+ m_ScriptBaseline = previousBase + (m_Height + 1) / 6;
+ else
+ m_ScriptBaseline = 0;
+
+ m_Descent += m_ScriptBaseline;
+}
+
+#if WXWIN_COMPATIBILITY_2_6
+
+struct wxHtmlCellOnMouseClickCompatHelper;
+
+static wxHtmlCellOnMouseClickCompatHelper *gs_helperOnMouseClick = NULL;
+
+// helper for routing calls to new ProcessMouseClick() method to deprecated
+// OnMouseClick() method
+struct wxHtmlCellOnMouseClickCompatHelper
+{
+ wxHtmlCellOnMouseClickCompatHelper(wxHtmlWindowInterface *window_,
+ const wxPoint& pos_,
+ const wxMouseEvent& event_)
+ : window(window_), pos(pos_), event(event_), retval(false)
+ {
+ }
+
+ bool CallOnMouseClick(wxHtmlCell *cell)
+ {
+ wxHtmlCellOnMouseClickCompatHelper *oldHelper = gs_helperOnMouseClick;
+ gs_helperOnMouseClick = this;
+ cell->OnMouseClick
+ (
+ window ? window->GetHTMLWindow() : NULL,
+ pos.x, pos.y,
+ event
+ );
+ gs_helperOnMouseClick = oldHelper;
+ return retval;
+ }
+
+ wxHtmlWindowInterface *window;
+ const wxPoint& pos;
+ const wxMouseEvent& event;
+ bool retval;
+};
+#endif // WXWIN_COMPATIBILITY_2_6
+
+bool wxHtmlCell::ProcessMouseClick(wxHtmlWindowInterface *window,
+ const wxPoint& pos,
+ const wxMouseEvent& event)
+{
+ wxCHECK_MSG( window, false, _T("window interface must be provided") );
+
+#if WXWIN_COMPATIBILITY_2_6
+ // NB: this hack puts the body of ProcessMouseClick() into OnMouseClick()
+ // (for which it has to pass the arguments and return value via a
+ // helper variable because these two methods have different
+ // signatures), so that old code overriding OnMouseClick will continue
+ // to work
+ wxHtmlCellOnMouseClickCompatHelper compat(window, pos, event);
+ return compat.CallOnMouseClick(this);
+}