wxTextCtrl::wxTextCtrl()
{
m_modified = FALSE;
+ m_text =
+ m_vScrollbar = (GtkWidget *)NULL;
}
wxTextCtrl::wxTextCtrl( wxWindow *parent,
{
gtk_entry_set_text( GTK_ENTRY(m_text), tmp.mbc_str() );
}
+
+ // GRG, Jun/2000: Changed this after a lot of discussion in
+ // the lists. wxWindows 2.2 will have a set of flags to
+ // customize this behaviour.
+ SetInsertionPoint(0);
+
+ m_modified = FALSE;
}
void wxTextCtrl::WriteText( const wxString &text )
gtk_entry_set_editable( GTK_ENTRY(m_text), editable );
}
+bool wxTextCtrl::Enable( bool enable )
+{
+ if (!wxWindowBase::Enable(enable))
+ {
+ // nothing to do
+ return FALSE;
+ }
+
+ if (m_windowStyle & wxTE_MULTILINE)
+ {
+ gtk_text_set_editable( GTK_TEXT(m_text), enable );
+ }
+ else
+ {
+ gtk_widget_set_sensitive( m_text, enable );
+ }
+
+ return TRUE;
+}
+
void wxTextCtrl::DiscardEdits()
{
m_modified = FALSE;
// Can cut if there's a selection
long from, to;
GetSelection(& from, & to);
- return (from != to) ;
+ return (from != to) && (IsEditable());
}
bool wxTextCtrl::CanPaste() const
if (!(GTK_EDITABLE(m_text)->has_selection))
{
- if (from) *from = 0;
- if (to) *to = 0;
+ long i = GetInsertionPoint();
+ if (from) *from = i;
+ if (to) *to = i;
return;
}
{
wxCommandEvent event(wxEVT_COMMAND_TEXT_ENTER, m_windowId);
event.SetEventObject(this);
+ event.SetString(GetValue());
if (GetEventHandler()->ProcessEvent(event)) return;
}