+ if (!wxGetWindowFromTable(w))
+ // Widget has been deleted!
+ return;
+
+ wxTextCtrl *tw = (wxTextCtrl *) clientData;
+ tw->SetModified(TRUE);
+}
+
+static void
+wxTextWindowModifyProc (Widget WXUNUSED(w), XtPointer clientData, XmTextVerifyCallbackStruct *cbs)
+{
+ wxTextCtrl *tw = (wxTextCtrl *) clientData;
+ tw->m_processedDefault = FALSE;
+
+ // First, do some stuff if it's a password control: in this case, we need
+ // to store the string inside the class because GetValue() can't retrieve
+ // it from the text ctrl. We do *not* do it in other circumstances because
+ // it would double the amount of memory needed.
+
+ if ( tw->GetWindowStyleFlag() & wxTE_PASSWORD )
+ {
+ MergeChangesIntoString(tw->m_value, cbs);
+
+ if ( cbs->text->length > 0 )
+ {
+ int i;
+ for (i = 0; i < cbs->text->length; ++i)
+ cbs->text->ptr[i] = '*';
+ cbs->text->ptr[i] = '\0';
+ }
+ }
+
+ // If we're already within an OnChar, return: probably a programmatic
+ // insertion.
+ if (tw->m_tempCallbackStruct)
+ return;
+
+ // Check for a backspace
+ if (cbs->startPos == (cbs->currInsert - 1))
+ {
+ tw->DoSendEvents((void *)cbs, WXK_DELETE);
+
+ return;
+ }
+
+ // Pasting operation: let it through without calling OnChar
+ if (cbs->text->length > 1)
+ return;
+
+ // Something other than text
+ if (cbs->text->ptr == NULL)
+ return;
+
+ // normal key press
+ char ch = cbs->text->ptr[0];
+ tw->DoSendEvents((void *)cbs, ch == '\n' ? '\r' : ch);
+}
+
+static void
+wxTextWindowGainFocusProc (Widget w, XtPointer clientData, XmAnyCallbackStruct *WXUNUSED(cbs))
+{
+ if (!wxGetWindowFromTable(w))
+ return;
+
+ wxTextCtrl *tw = (wxTextCtrl *) clientData;
+ wxFocusEvent event(wxEVT_SET_FOCUS, tw->GetId());
+ event.SetEventObject(tw);
+ tw->GetEventHandler()->ProcessEvent(event);
+}
+
+static void
+wxTextWindowLoseFocusProc (Widget w, XtPointer clientData, XmAnyCallbackStruct *WXUNUSED(cbs))
+{
+ if (!wxGetWindowFromTable(w))
+ return;
+
+ wxTextCtrl *tw = (wxTextCtrl *) clientData;
+ wxFocusEvent event(wxEVT_KILL_FOCUS, tw->GetId());
+ event.SetEventObject(tw);
+ tw->GetEventHandler()->ProcessEvent(event);
+}
+
+static void wxTextWindowActivateProc(Widget w, XtPointer clientData,
+ XmAnyCallbackStruct *WXUNUSED(ptr))
+{
+ if (!wxGetWindowFromTable(w))
+ return;
+
+ wxTextCtrl *tw = (wxTextCtrl *) clientData;
+
+ if (tw->InSetValue())
+ return;
+
+ wxCommandEvent event(wxEVT_COMMAND_TEXT_ENTER);
+ event.SetId(tw->GetId());
+ event.SetEventObject(tw);
+ tw->ProcessCommand(event);
+}
+
+void wxTextCtrl::OnCut(wxCommandEvent& WXUNUSED(event))
+{
+ Cut();