]>
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
29 #include "wx/window.h"
30 #include "wx/dataobj.h"
33 #include "wx/textentry.h"
34 #include "wx/clipbrd.h"
36 // ============================================================================
37 // wxTextEntryBase implementation
38 // ============================================================================
40 wxString
wxTextEntryBase::GetRange(long from
, long to
) const
45 sel
= GetValue().substr(from
, to
- from
);
51 void wxTextEntryBase::AppendText(const wxString
& text
)
53 SetInsertionPointEnd();
57 void wxTextEntryBase::DoSetValue(const wxString
& value
, int flags
)
59 EventsSuppressor
noeventsIf(this, !(flags
& SetValue_SendEvent
));
65 void wxTextEntryBase::Replace(long from
, long to
, const wxString
& value
)
68 EventsSuppressor
noevents(this);
75 bool wxTextEntryBase::HasSelection() const
78 GetSelection(&from
, &to
);
83 wxString
wxTextEntryBase::GetStringSelection() const
86 GetSelection(&from
, &to
);
88 return GetRange(from
, to
);
91 bool wxTextEntryBase::CanCopy() const
93 return HasSelection();
96 bool wxTextEntryBase::CanCut() const
98 return CanCopy() && IsEditable();
101 bool wxTextEntryBase::CanPaste() const
106 // check if there is any text on the clipboard
107 if ( wxTheClipboard
->IsSupported(wxDF_TEXT
)
109 || wxTheClipboard
->IsSupported(wxDF_UNICODETEXT
)
110 #endif // wxUSE_UNICODE
115 #endif // wxUSE_CLIPBOARD
121 #endif // wxUSE_TEXTCTRL || wxUSE_COMBOBOX