]> git.saurik.com Git - wxWidgets.git/commitdiff
use wxRTTI to construct the right class of wxHtmlCell
authorRobin Dunn <robin@alldunn.com>
Fri, 10 Feb 2006 18:38:43 +0000 (18:38 +0000)
committerRobin Dunn <robin@alldunn.com>
Fri, 10 Feb 2006 18:38:43 +0000 (18:38 +0000)
git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@37456 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775

wxPython/demo/HtmlWindow.py
wxPython/include/wx/wxPython/wxPython_int.h
wxPython/src/html.i

index 3e39f7ebd551771bccf1c2db7d4c213b0cfc94fa..42e24bddd66d0b15698baa169b6ad29cef83a93b 100644 (file)
@@ -33,6 +33,9 @@ class MyHtmlWindow(html.HtmlWindow):
 
     def OnCellClicked(self, cell, x, y, evt):
         self.log.WriteText('OnCellClicked: %s, (%d %d)\n' % (cell, x, y))
+        if isinstance(cell, html.HtmlWordCell):
+            sel = html.HtmlSelection()
+            self.log.WriteText('     %s\n' % cell.ConvertToText(sel))
         super(MyHtmlWindow, self).OnCellClicked(cell, x, y, evt)
 
 
index ca3fbcc6a59dae83660a88e47105a3f2c81f9185..302288b4aa4c517d6ee6653fbceb2201c0dcdafc 100644 (file)
@@ -1451,7 +1451,7 @@ extern wxPyApp *wxPythonApp;
         bool found;                                                             \
         wxPyBlock_t blocked = wxPyBeginBlockThreads();                                 \
         if ((found = wxPyCBH_findCallback(m_myInst, #CBNAME))) {                \
-            PyObject* obj = wxPyConstructObject((void*)cell, wxT("wxHtmlCell"), 0);  \
+            PyObject* obj = wxPyMake_wxObject(cell, 0);                         \
             wxPyCBH_callCallbackObj(m_myInst, Py_BuildValue("(Oii)",obj,x,y));  \
             Py_DECREF(obj);                                                     \
         }                                                                       \
@@ -1489,7 +1489,7 @@ extern wxPyApp *wxPythonApp;
         bool found;                                                                     \
         wxPyBlock_t blocked = wxPyBeginBlockThreads();                                         \
         if ((found = wxPyCBH_findCallback(m_myInst, #CBNAME))) {                        \
-            PyObject* obj = wxPyConstructObject((void*)cell, wxT("wxHtmlCell"), 0);     \
+            PyObject* obj = wxPyMake_wxObject(cell, 0);                                 \
             PyObject* o2  = wxPyConstructObject((void*)&e, wxT("wxMouseEvent"), 0);     \
             wxPyCBH_callCallbackObj(m_myInst, Py_BuildValue("(OiiO)",obj,x,y,o2));      \
             Py_DECREF(obj);                                                             \
index e7160365caa0bab9da606c964a8a23f054912f51..12396332c1bd643edb8a2cb68acf5cb91c03c320 100644 (file)
@@ -384,6 +384,10 @@ private:
 
 
 //---------------------------------------------------------------------------
+
+%typemap(out) wxHtmlCell*         { $result = wxPyMake_wxObject($1, $owner); }
+%typemap(out) const wxHtmlCell*   { $result = wxPyMake_wxObject($1, $owner); }
+
 //---------------------------------------------------------------------------
 %newgroup
 
@@ -499,8 +503,13 @@ enum
 
 class wxHtmlCell : public wxObject {
 public:
+    %typemap(out) wxHtmlCell*;    // turn off this typemap
+
     wxHtmlCell();
 
+    // Turn it back on again
+    %typemap(out) wxHtmlCell* { $result = wxPyMake_wxObject($1, $owner); }
+
     int GetPosX();
     int GetPosY();
     int GetWidth();
@@ -582,6 +591,9 @@ class  wxHtmlWordCell : public wxHtmlCell
 {
 public:
     wxHtmlWordCell(const wxString& word, wxDC& dc);
+    wxString ConvertToText(wxHtmlSelection *sel) const;
+    bool IsLinebreakAllowed() const;
+    void SetPreviousWord(wxHtmlWordCell *cell);
 };
 
 
@@ -1138,10 +1150,6 @@ public:
     int GetCurIndex();
     int GetMaxIndex();
     const wxString& GetName();
-    // WXWIN_COMPATIBILITY_2_4
-#if 0
-    wxHtmlContentsItem* GetContentsItem();
-#endif
 };
 
 //---------------------------------------------------------------------------
@@ -1164,13 +1172,6 @@ public:
     // TODO: this one needs fixed...
     const wxHtmlBookRecArray& GetBookRecArray();
 
-    // WXWIN_COMPATIBILITY_2_4
-#if 0
-    wxHtmlContentsItem* GetContents();
-    int GetContentsCnt();
-    wxHtmlContentsItem* GetIndex();
-    int GetIndexCnt();
-#endif
 };
 
 //---------------------------------------------------------------------------