]> git.saurik.com Git - wxWidgets.git/blobdiff - src/msw/textctrl.cpp
Also the radiobox was unitialised.
[wxWidgets.git] / src / msw / textctrl.cpp
index 64f4d4314ed35b69503c8c3677871c6eae82badc..63bcc632f2f906f6d54b051bc72bfd1525bff81d 100644 (file)
@@ -95,7 +95,6 @@ bool wxTextCtrl::Create(wxWindow *parent, wxWindowID id,
                         const wxValidator& validator,
                         const wxString& name)
 {
-  m_fileName = "";
   SetName(name);
   SetValidator(validator);
   if (parent) parent->AddChild(this);
@@ -312,7 +311,7 @@ void wxTextCtrl::SetValue(const wxString& value)
     SetWindowText((HWND) GetHWND(), (const char *)value);
 }
 
-void wxTextCtrl::SetSize(int x, int y, int width, int height, int sizeFlags)
+void wxTextCtrl::DoSetSize(int x, int y, int width, int height, int sizeFlags)
 {
   int currentX, currentY;
   GetPosition(&currentX, &currentY);
@@ -444,7 +443,7 @@ long wxTextCtrl::GetLastPosition() const
 
     // This gets the char index for the _beginning_ of the last line
     int charIndex = (int)SendMessage(hWnd, EM_LINEINDEX, (WPARAM)(noLines-1), (LPARAM)0L);
-    
+
     // Get number of characters in the last line. We'll add this to the character
     // index for the last line, 1st position.
     int lineLength = (int)SendMessage(hWnd, EM_LINELENGTH, (WPARAM)charIndex, (LPARAM)0L);
@@ -454,10 +453,11 @@ long wxTextCtrl::GetLastPosition() const
 
 void wxTextCtrl::Replace(long from, long to, const wxString& value)
 {
+#if wxUSE_CLIPBOARD
     HWND hWnd = (HWND) GetHWND();
     long fromChar = from;
     long toChar = to;
-    
+
     // Set selection and remove it
 #ifdef __WIN32__
     SendMessage(hWnd, EM_SETSEL, fromChar, toChar);
@@ -471,6 +471,9 @@ void wxTextCtrl::Replace(long from, long to, const wxString& value)
 
     // Paste into edit control
     SendMessage(hWnd, WM_PASTE, (WPARAM)0, (LPARAM)0L);
+#else
+    wxFAIL_MSG("wxTextCtrl::Replace not implemented if wxUSE_CLIPBOARD is 0.");
+#endif
 }
 
 void wxTextCtrl::Remove(long from, long to)
@@ -478,7 +481,7 @@ void wxTextCtrl::Remove(long from, long to)
     HWND hWnd = (HWND) GetHWND();
     long fromChar = from;
     long toChar = to;
-    
+
     // Cut all selected text
 #ifdef __WIN32__
     SendMessage(hWnd, EM_SETSEL, fromChar, toChar);
@@ -501,7 +504,7 @@ void wxTextCtrl::SetSelection(long from, long to)
       fromChar = 0;
       toChar = -1;
     }
-    
+
 #ifdef __WIN32__
     SendMessage(hWnd, EM_SETSEL, (WPARAM)fromChar, (LPARAM)toChar);
     SendMessage(hWnd, EM_SCROLLCARET, (WPARAM)0, (LPARAM)0);
@@ -656,7 +659,7 @@ void wxTextCtrl::DiscardEdits()
  * Some of the following functions are yet to be implemented
  *
  */
+
 int wxTextCtrl::GetNumberOfLines() const
 {
     return (int)SendMessage((HWND) GetHWND(), EM_GETLINECOUNT, (WPARAM)0, (LPARAM)0);
@@ -702,13 +705,8 @@ void wxTextCtrl::ShowPosition(long pos)
     int currentLineLineNo = (int)SendMessage(hWnd, EM_GETFIRSTVISIBLELINE, (WPARAM)0, (LPARAM)0L);
 
     int specifiedLineLineNo = (int)SendMessage(hWnd, EM_LINEFROMCHAR, (WPARAM)pos, (LPARAM)0L);
-    
-    int linesToScroll = specifiedLineLineNo - currentLineLineNo;
 
-/*
-    wxDebugMsg("Caret line: %d; Current visible line: %d; Specified line: %d; lines to scroll: %d\n",
-      currentLineLineNo1, currentLineLineNo, specifiedLineLineNo, linesToScroll);
-*/
+    int linesToScroll = specifiedLineLineNo - currentLineLineNo;
 
     if (linesToScroll != 0)
       (void)SendMessage(hWnd, EM_LINESCROLL, (WPARAM)0, (LPARAM)MAKELPARAM(linesToScroll, 0));
@@ -734,7 +732,7 @@ wxString wxTextCtrl::GetLineText(long lineNo) const
 /*
  * Text item
  */
+
 void wxTextCtrl::Command(wxCommandEvent & event)
 {
   SetValue (event.GetString());
@@ -754,7 +752,7 @@ void wxTextCtrl::OnDropFiles(wxDropFilesEvent& event)
 // AT&T's "C++ Lanuage System Release 3.0 Library Manual" - Stein Somers
 
 //=========================================================================
-// Called then the buffer is full (gcc 2.6.3) 
+// Called then the buffer is full (gcc 2.6.3)
 // or when "endl" is output (Borland 4.5)
 //=========================================================================
 // Class declaration using multiple inheritance doesn't work properly for
@@ -772,7 +770,7 @@ int wxTextCtrl::overflow(int c)
     return EOF;
   }
 #endif
-  
+
   // Verify that there are no characters in get area
   if ( gptr() && gptr() < egptr() )
   {
@@ -957,24 +955,8 @@ void wxTextCtrl::OnChar(wxKeyEvent& event)
 {
     switch( event.KeyCode() )
     {
-        // Fix by Marcel Rasche to allow Alt-Ctrl insertion of special characters
-        case '{':
-        case '}':
-        case '[':
-        case ']':
-        case '|':
-        case '~':
-        case '\\':
-            {
-                char c = (char)event.KeyCode();
-                *this << c;
-            }
-            break;
-
         case WXK_RETURN:
-            wxASSERT_MSG( m_windowStyle & wxTE_PROCESS_ENTER,
-                          "this text ctrl should never receive return" );
-            if ( m_windowStyle & wxTE_MULTILINE == 0 )
+            if ( !(m_windowStyle & wxTE_MULTILINE) )
             {
                 wxCommandEvent event(wxEVT_COMMAND_TEXT_ENTER, m_windowId);
                 event.SetEventObject( this );
@@ -998,16 +980,22 @@ void wxTextCtrl::OnChar(wxKeyEvent& event)
                 eventNav.SetDirection(!event.ShiftDown());
                 eventNav.SetWindowChange(FALSE);
                 eventNav.SetEventObject(this);
-    
+
                 if ( GetEventHandler()->ProcessEvent(eventNav) )
                     return;
             }
+            break;
+
+        default:
+            event.Skip();
+            return;
     }
-    
+
     // don't just call event.Skip() because this will cause TABs and ENTERs
     // be passed upwards and we don't always want this - instead process it
     // right here
     Default();
+//    event.Skip();
 }
 
 long wxTextCtrl::MSWGetDlgCode()
@@ -1026,7 +1014,7 @@ long wxTextCtrl::MSWGetDlgCode()
         lRc |= DLGC_WANTMESSAGE;
     if ( m_windowStyle & wxTE_PROCESS_TAB )
         lRc |= DLGC_WANTTAB;
-    
+
     return lRc;
 }