]>
git.saurik.com Git - wxWidgets.git/blob - src/common/textentrycmn.cpp
956d5d591407408e4b8e0809341c050ef612d05a
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"
32 #include "wx/clipbrd.h"
34 // ============================================================================
35 // wxTextEntryBase implementation
36 // ============================================================================
38 wxString
wxTextEntryBase::GetRange(long from
, long to
) const
43 sel
= GetValue().substr(from
, to
- from
);
49 void wxTextEntryBase::AppendText(const wxString
& text
)
51 SetInsertionPointEnd();
55 void wxTextEntryBase::DoSetValue(const wxString
& value
, int flags
)
57 EventsSuppressor
noeventsIf(this, !(flags
& SetValue_SendEvent
));
63 void wxTextEntryBase::Replace(long from
, long to
, const wxString
& value
)
66 EventsSuppressor
noevents(this);
73 bool wxTextEntryBase::HasSelection() const
76 GetSelection(&from
, &to
);
81 wxString
wxTextEntryBase::GetStringSelection() const
84 GetSelection(&from
, &to
);
86 return GetRange(from
, to
);
89 bool wxTextEntryBase::CanCopy() const
91 return HasSelection();
94 bool wxTextEntryBase::CanCut() const
96 return CanCopy() && IsEditable();
99 bool wxTextEntryBase::CanPaste() const
104 // check if there is any text on the clipboard
105 if ( wxTheClipboard
->IsSupported(wxDF_TEXT
) )
107 #endif // wxUSE_CLIPBOARD
113 #endif // wxUSE_TEXTCTRL || wxUSE_COMBOBOX