]> git.saurik.com Git - wxWidgets.git/blobdiff - samples/richedit/wxlwindow.cpp
Added test for wxUSE_STATLINE in statline.cpp
[wxWidgets.git] / samples / richedit / wxlwindow.cpp
index 1846e0a66813796c50f648c06300d026c797d950..63ce2369cf59a69922ed2e1a0f0332e8173e83c8 100644 (file)
@@ -212,7 +212,7 @@ void wxLayoutWindow::Refresh(bool eraseBackground, const wxRect *rect)
    wxScrolledWindow::Refresh(eraseBackground, rect);
 
    ResizeScrollbars();
-   ScrollToCursor();
+//FIXME is this needed? It causes problems...   ScrollToCursor();
 }
 
 void
@@ -313,16 +313,16 @@ wxLayoutWindow::OnMouse(int eventId, wxMouseEvent& event)
       case WXLOWIN_MENU_LDOWN:
          {
              // always move cursor to mouse click:
-             if ( obj )
+//             if ( obj )
              {
                 // we have found the real position
                 m_llist->MoveCursorTo(cursorPos);
              }
-             else
-             {
-                // click beyond the end of the text
-                m_llist->MoveCursorToEnd();
-             }
+//             else
+//             {
+//                // click beyond the end of the text
+//                m_llist->MoveCursorToEnd();
+//             }
 
              // clicking a mouse removes the selection
              if ( m_llist->HasSelection() )
@@ -385,7 +385,7 @@ wxLayoutWindow::OnMouse(int eventId, wxMouseEvent& event)
          m_llist->StartSelection();
          m_llist->MoveCursorWord(1, false);
          m_llist->EndSelection();
-
+         m_Selecting = false;
          DoPaint();     // TODO: we don't have to redraw everything!
          break;
    }
@@ -544,6 +544,9 @@ wxLayoutWindow::OnChar(wxKeyEvent& event)
                Copy();
                break;
             case WXK_DELETE :
+               if(! deletedSelection)
+                  m_llist->DeleteWord();
+               break;
             case 'd':
                if(! deletedSelection) // already done
                   m_llist->Delete(1);
@@ -1154,21 +1157,21 @@ void wxLayoutWindow::OnMenu(wxCommandEvent& event)
    switch (event.GetId())
    {
    case WXLOWIN_MENU_LARGER:
-      m_llist->SetFontLarger(); Refresh(FALSE); break;
+      m_llist->SetFontLarger(); DoPaint(); break;
    case WXLOWIN_MENU_SMALLER:
-      m_llist->SetFontSmaller(); Refresh(FALSE); break;
+      m_llist->SetFontSmaller(); DoPaint(); break;
    case WXLOWIN_MENU_UNDERLINE:
-      m_llist->ToggleFontUnderline(); Refresh(FALSE); break;
+      m_llist->ToggleFontUnderline(); DoPaint(); break;
    case WXLOWIN_MENU_BOLD:
-      m_llist->ToggleFontWeight(); Refresh(FALSE); break;
+      m_llist->ToggleFontWeight(); DoPaint(); break;
    case WXLOWIN_MENU_ITALICS:
-      m_llist->ToggleFontItalics(); Refresh(FALSE); break;
+      m_llist->ToggleFontItalics(); DoPaint(); break;
    case WXLOWIN_MENU_ROMAN:
-      m_llist->SetFontFamily(wxROMAN); Refresh(FALSE); break;
+      m_llist->SetFontFamily(wxROMAN); DoPaint(); break;
    case WXLOWIN_MENU_TYPEWRITER:
-      m_llist->SetFontFamily(wxFIXED); Refresh(FALSE); break;
+      m_llist->SetFontFamily(wxFIXED); DoPaint(); break;
    case WXLOWIN_MENU_SANSSERIF:
-      m_llist->SetFontFamily(wxSWISS); Refresh(FALSE); break;
+      m_llist->SetFontFamily(wxSWISS); DoPaint(); break;
    }
 }
 
@@ -1181,6 +1184,7 @@ wxLayoutWindow::OnSetFocus(wxFocusEvent &ev)
 {
    m_HaveFocus = true;
    ev.Skip();
+   DoPaint(); // cursor must change
 }
 
 void
@@ -1188,6 +1192,7 @@ wxLayoutWindow::OnKillFocus(wxFocusEvent &ev)
 {
    m_HaveFocus = false;
    ev.Skip();
+   DoPaint();// cursor must change
 }
 
 // ----------------------------------------------------------------------------