]>
git.saurik.com Git - wxWidgets.git/blob - src/common/textentrycmn.cpp
1 ///////////////////////////////////////////////////////////////////////////////
2 // Name: src/common/textentrycmn.cpp
3 // Purpose: wxTextEntryBase implementation
4 // Author: Vadim Zeitlin
7 // Copyright: (c) 2007 Vadim Zeitlin <vadim@wxwindows.org>
8 // Licence: wxWindows licence
9 ///////////////////////////////////////////////////////////////////////////////
11 // ============================================================================
13 // ============================================================================
15 // ----------------------------------------------------------------------------
17 // ----------------------------------------------------------------------------
19 // for compilers that support precompilation, includes "wx.h".
20 #include "wx/wxprec.h"
26 #if wxUSE_TEXTCTRL || wxUSE_COMBOBOX
31 #include "wx/textentry.h"
33 // ============================================================================
34 // wxTextEntryBase implementation
35 // ============================================================================
37 wxString
wxTextEntryBase::GetRange(long from
, long to
) const
42 sel
= GetValue().substr(from
, to
- from
);
48 void wxTextEntryBase::AppendText(const wxString
& text
)
50 SetInsertionPointEnd();
54 void wxTextEntryBase::DoSetValue(const wxString
& value
, int flags
)
56 EventsSuppressor
noeventsIf(this, !(flags
& SetValue_SendEvent
));
62 void wxTextEntryBase::Replace(long from
, long to
, const wxString
& value
)
65 EventsSuppressor
noevents(this);
72 bool wxTextEntryBase::HasSelection() const
75 GetSelection(&from
, &to
);
80 wxString
wxTextEntryBase::GetStringSelection() const
83 GetSelection(&from
, &to
);
85 return GetRange(from
, to
);
88 bool wxTextEntryBase::CanCopy() const
90 return HasSelection();
93 bool wxTextEntryBase::CanCut() const
95 return CanCopy() && IsEditable();
98 bool wxTextEntryBase::CanPaste() const
103 #endif // wxUSE_TEXTCTRL || wxUSE_COMBOBOX