]> git.saurik.com Git - wxWidgets.git/blobdiff - src/html/htmlwin.cpp
added wxTextCtrl::HitTest(); implemented it for MSW
[wxWidgets.git] / src / html / htmlwin.cpp
index 264f950c310679c721ebd5aba40572dcdc63bc18..d5f6f34ce5b294cb37e1e6237b0d0246fb1bc5ac 100644 (file)
@@ -201,7 +201,9 @@ wxHtmlWindow::~wxHtmlWindow()
 #endif // wxUSE_CLIPBOARD
     HistoryClear();
 
 #endif // wxUSE_CLIPBOARD
     HistoryClear();
 
-    if (m_Cell) delete m_Cell;
+    delete m_selection;
+
+    delete m_Cell;
 
     if ( m_Processors )
     {
 
     if ( m_Processors )
     {
@@ -754,7 +756,7 @@ wxString wxHtmlWindow::SelectionToText()
 
 #endif // wxUSE_CLIPBOARD
 
 
 #endif // wxUSE_CLIPBOARD
 
-void wxHtmlWindow::CopySelection(ClipboardType t)
+bool wxHtmlWindow::CopySelection(ClipboardType t)
 {
 #if wxUSE_CLIPBOARD
     if ( m_selection )
 {
 #if wxUSE_CLIPBOARD
     if ( m_selection )
@@ -767,7 +769,7 @@ void wxHtmlWindow::CopySelection(ClipboardType t)
         //
         // TODO: this should be abstracted at wxClipboard level!
         if ( t == Primary )
         //
         // TODO: this should be abstracted at wxClipboard level!
         if ( t == Primary )
-            return;
+            return false;
 #endif // __UNIX__/!__UNIX__
 
         if ( wxTheClipboard->Open() )
 #endif // __UNIX__/!__UNIX__
 
         if ( wxTheClipboard->Open() )
@@ -777,9 +779,13 @@ void wxHtmlWindow::CopySelection(ClipboardType t)
             wxTheClipboard->Close();
             wxLogTrace(_T("wxhtmlselection"),
                        _("Copied to clipboard:\"%s\""), txt.c_str());
             wxTheClipboard->Close();
             wxLogTrace(_T("wxhtmlselection"),
                        _("Copied to clipboard:\"%s\""), txt.c_str());
+
+            return true;
         }
     }
 #endif // wxUSE_CLIPBOARD
         }
     }
 #endif // wxUSE_CLIPBOARD
+
+    return false;
 }
 
 
 }
 
 
@@ -912,7 +918,7 @@ void wxHtmlWindow::OnMouseDown(wxMouseEvent& event)
         {
             SelectLine(CalcUnscrolledPosition(event.GetPosition()));
 
         {
             SelectLine(CalcUnscrolledPosition(event.GetPosition()));
 
-            CopySelection();
+            (void) CopySelection();
         }
         else
         {
         }
         else
         {
@@ -941,10 +947,8 @@ void wxHtmlWindow::OnMouseUp(wxMouseEvent& event)
         m_makingSelection = false;
 
         // did the user move the mouse far enough from starting point?
         m_makingSelection = false;
 
         // did the user move the mouse far enough from starting point?
-        if ( m_selection )
+        if ( CopySelection(Primary) )
         {
         {
-            CopySelection(Primary);
-
             // we don't want mouse up event that ended selecting to be
             // handled as mouse click and e.g. follow hyperlink:
             return;
             // we don't want mouse up event that ended selecting to be
             // handled as mouse click and e.g. follow hyperlink:
             return;
@@ -1213,15 +1217,13 @@ void wxHtmlWindow::OnKeyUp(wxKeyEvent& event)
     if ( IsSelectionEnabled() &&
          event.GetKeyCode() == 'C' && event.ControlDown() )
     {
     if ( IsSelectionEnabled() &&
          event.GetKeyCode() == 'C' && event.ControlDown() )
     {
-        if ( m_selection )
-            CopySelection();
+        (void) CopySelection();
     }
 }
 
 void wxHtmlWindow::OnCopy(wxCommandEvent& WXUNUSED(event))
 {
     }
 }
 
 void wxHtmlWindow::OnCopy(wxCommandEvent& WXUNUSED(event))
 {
-    if ( m_selection )
-        CopySelection();
+    (void) CopySelection();
 }
 
 void wxHtmlWindow::OnDoubleClick(wxMouseEvent& event)
 }
 
 void wxHtmlWindow::OnDoubleClick(wxMouseEvent& event)
@@ -1231,7 +1233,7 @@ void wxHtmlWindow::OnDoubleClick(wxMouseEvent& event)
     {
         SelectWord(CalcUnscrolledPosition(event.GetPosition()));
 
     {
         SelectWord(CalcUnscrolledPosition(event.GetPosition()));
 
-        CopySelection(Primary);
+        (void) CopySelection(Primary);
 
         m_lastDoubleClick = wxGetLocalTimeMillis();
     }
 
         m_lastDoubleClick = wxGetLocalTimeMillis();
     }
@@ -1310,7 +1312,26 @@ void wxHtmlWindow::SelectLine(const wxPoint& pos)
 
 IMPLEMENT_ABSTRACT_CLASS(wxHtmlProcessor,wxObject)
 
 
 IMPLEMENT_ABSTRACT_CLASS(wxHtmlProcessor,wxObject)
 
+#if wxUSE_EXTENDED_RTTI
+IMPLEMENT_DYNAMIC_CLASS_XTI(wxHtmlWindow, wxScrolledWindow,"wx/html/htmlwin.h")
+
+wxBEGIN_PROPERTIES_TABLE(wxHtmlWindow)
+/*
+       TODO PROPERTIES
+               style , wxHW_SCROLLBAR_AUTO
+               borders , (dimension)
+               url , string
+               htmlcode , string
+*/
+wxEND_PROPERTIES_TABLE()
+
+wxBEGIN_HANDLERS_TABLE(wxHtmlWindow)
+wxEND_HANDLERS_TABLE()
+
+wxCONSTRUCTOR_5( wxHtmlWindow , wxWindow* , Parent , wxWindowID , Id , wxPoint , Position , wxSize , Size , long , WindowStyle ) 
+#else
 IMPLEMENT_DYNAMIC_CLASS(wxHtmlWindow,wxScrolledWindow)
 IMPLEMENT_DYNAMIC_CLASS(wxHtmlWindow,wxScrolledWindow)
+#endif
 
 BEGIN_EVENT_TABLE(wxHtmlWindow, wxScrolledWindow)
     EVT_SIZE(wxHtmlWindow::OnSize)
 
 BEGIN_EVENT_TABLE(wxHtmlWindow, wxScrolledWindow)
     EVT_SIZE(wxHtmlWindow::OnSize)