Derive from wxTextEntry instead of wxTextCtrlBase
This commit is contained in:
committed by
Vadim Zeitlin
parent
c09db9c23d
commit
020b6ebcb8
@@ -67,26 +67,6 @@ public:
|
||||
virtual void SetDescriptiveText(const wxString& text) wxOVERRIDE;
|
||||
virtual wxString GetDescriptiveText() const wxOVERRIDE;
|
||||
|
||||
// accessors
|
||||
// ---------
|
||||
virtual int GetLineLength(long lineNo) const wxOVERRIDE;
|
||||
virtual wxString GetLineText(long lineNo) const wxOVERRIDE;
|
||||
virtual int GetNumberOfLines() const wxOVERRIDE;
|
||||
|
||||
virtual bool IsModified() const wxOVERRIDE;
|
||||
|
||||
// sets/clears the dirty flag
|
||||
virtual void MarkDirty() wxOVERRIDE;
|
||||
virtual void DiscardEdits() wxOVERRIDE;
|
||||
|
||||
// translate between the position (which is just an index in the text ctrl
|
||||
// considering all its contents as a single strings) and (x, y) coordinates
|
||||
// which represent column and line.
|
||||
virtual long XYToPosition(long x, long y) const wxOVERRIDE;
|
||||
virtual bool PositionToXY(long pos, long *x, long *y) const wxOVERRIDE;
|
||||
|
||||
virtual void ShowPosition(long pos) wxOVERRIDE;
|
||||
|
||||
virtual void Clear() wxOVERRIDE;
|
||||
|
||||
#if wxUSE_MENUS
|
||||
@@ -95,7 +75,6 @@ public:
|
||||
|
||||
private:
|
||||
// From wxTextEntry:
|
||||
virtual wxWindow *GetEditableWindow() wxOVERRIDE { return this; }
|
||||
virtual GtkEditable *GetEditable() const wxOVERRIDE;
|
||||
|
||||
|
||||
@@ -127,7 +106,6 @@ private:
|
||||
wxMenu *m_menu;
|
||||
#endif // wxUSE_MENUS
|
||||
|
||||
bool m_modified;
|
||||
bool m_cancelButtonVisible;
|
||||
|
||||
wxDECLARE_DYNAMIC_CLASS(wxSearchCtrl);
|
||||
|
@@ -38,7 +38,12 @@
|
||||
// otherwise.
|
||||
#define wxUSE_NATIVE_SEARCH_CONTROL 1
|
||||
|
||||
#define wxSearchCtrlBaseBaseClass wxTextCtrlBase
|
||||
class WXDLLIMPEXP_CORE wxGTKSearchCtrlBase
|
||||
: public wxControl, public wxTextEntry
|
||||
{
|
||||
};
|
||||
|
||||
#define wxSearchCtrlBaseBaseClass wxGTKSearchCtrlBase
|
||||
#endif
|
||||
|
||||
// ----------------------------------------------------------------------------
|
||||
|
@@ -101,13 +101,13 @@ wx_gtk_icon_press(GtkEntry* WXUNUSED(entry),
|
||||
// ============================================================================
|
||||
// wxSearchCtrl implementation
|
||||
// ============================================================================
|
||||
wxBEGIN_EVENT_TABLE(wxSearchCtrl, wxSearchCtrlBase)
|
||||
wxBEGIN_EVENT_TABLE(wxSearchCtrl, wxControl)
|
||||
EVT_CHAR(wxSearchCtrl::OnChar)
|
||||
EVT_TEXT(wxID_ANY, wxSearchCtrl::OnText)
|
||||
EVT_TEXT_ENTER(wxID_ANY, wxSearchCtrl::OnTextEnter)
|
||||
wxEND_EVENT_TABLE()
|
||||
|
||||
wxIMPLEMENT_DYNAMIC_CLASS(wxSearchCtrl, wxSearchCtrlBase);
|
||||
wxIMPLEMENT_DYNAMIC_CLASS(wxSearchCtrl, wxControl);
|
||||
|
||||
// ----------------------------------------------------------------------------
|
||||
// creation/destruction
|
||||
@@ -225,71 +225,6 @@ void wxSearchCtrl::Clear()
|
||||
ShowCancelButton(false);
|
||||
}
|
||||
|
||||
bool wxSearchCtrl::IsModified() const
|
||||
{
|
||||
return m_modified;
|
||||
}
|
||||
|
||||
void wxSearchCtrl::MarkDirty()
|
||||
{
|
||||
m_modified = true;
|
||||
}
|
||||
|
||||
void wxSearchCtrl::DiscardEdits()
|
||||
{
|
||||
m_modified = false;
|
||||
}
|
||||
|
||||
bool wxSearchCtrl::PositionToXY(long pos, long *x, long *y ) const
|
||||
{
|
||||
if (pos <= GTKGetEntryTextLength(GetEntry()))
|
||||
{
|
||||
if ( y )
|
||||
*y = 0;
|
||||
if ( x )
|
||||
*x = pos;
|
||||
}
|
||||
else
|
||||
{
|
||||
// index out of bounds
|
||||
return false;
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
long wxSearchCtrl::XYToPosition(long x, long y ) const
|
||||
{
|
||||
if ( y != 0 || x > GTKGetEntryTextLength(GetEntry()) )
|
||||
return -1;
|
||||
|
||||
return x;
|
||||
}
|
||||
|
||||
int wxSearchCtrl::GetLineLength(long lineNo) const
|
||||
{
|
||||
const wxString str = GetLineText(lineNo);
|
||||
return (int) str.length();
|
||||
}
|
||||
|
||||
int wxSearchCtrl::GetNumberOfLines() const
|
||||
{
|
||||
return 1;
|
||||
}
|
||||
|
||||
wxString wxSearchCtrl::GetLineText( long lineNo ) const
|
||||
{
|
||||
if ( lineNo == 0 )
|
||||
return GetValue();
|
||||
|
||||
return wxString();
|
||||
}
|
||||
|
||||
void wxSearchCtrl::ShowPosition( long pos )
|
||||
{
|
||||
gtk_editable_set_position(GetEditable(), pos);
|
||||
}
|
||||
|
||||
// search control specific interfaces
|
||||
// ----------------------------------
|
||||
#if wxUSE_MENUS
|
||||
|
Reference in New Issue
Block a user