2007-09-25 20:30:22 -04:00
|
|
|
///////////////////////////////////////////////////////////////////////////////
|
|
|
|
// Name: wx/gtk/textentry.h
|
|
|
|
// Purpose: wxGTK-specific wxTextEntry implementation
|
|
|
|
// Author: Vadim Zeitlin
|
|
|
|
// Created: 2007-09-24
|
|
|
|
// Copyright: (c) 2007 Vadim Zeitlin <vadim@wxwindows.org>
|
|
|
|
// Licence: wxWindows licence
|
|
|
|
///////////////////////////////////////////////////////////////////////////////
|
|
|
|
|
|
|
|
#ifndef _WX_GTK_TEXTENTRY_H_
|
|
|
|
#define _WX_GTK_TEXTENTRY_H_
|
|
|
|
|
2013-03-22 10:13:02 -04:00
|
|
|
typedef struct _GdkEventKey GdkEventKey;
|
2007-09-25 20:30:22 -04:00
|
|
|
typedef struct _GtkEditable GtkEditable;
|
2009-09-05 08:39:12 -04:00
|
|
|
typedef struct _GtkEntry GtkEntry;
|
2007-09-25 20:30:22 -04:00
|
|
|
|
|
|
|
// ----------------------------------------------------------------------------
|
|
|
|
// wxTextEntry: roughly corresponds to GtkEditable
|
|
|
|
// ----------------------------------------------------------------------------
|
|
|
|
|
|
|
|
class WXDLLIMPEXP_CORE wxTextEntry : public wxTextEntryBase
|
|
|
|
{
|
|
|
|
public:
|
|
|
|
wxTextEntry() { }
|
|
|
|
|
|
|
|
// implement wxTextEntryBase pure virtual methods
|
2014-03-29 20:02:23 -04:00
|
|
|
virtual void WriteText(const wxString& text) wxOVERRIDE;
|
|
|
|
virtual void Remove(long from, long to) wxOVERRIDE;
|
2007-09-25 20:30:22 -04:00
|
|
|
|
2014-03-29 20:02:23 -04:00
|
|
|
virtual void Copy() wxOVERRIDE;
|
|
|
|
virtual void Cut() wxOVERRIDE;
|
|
|
|
virtual void Paste() wxOVERRIDE;
|
2007-09-25 20:30:22 -04:00
|
|
|
|
2014-03-29 20:02:23 -04:00
|
|
|
virtual void Undo() wxOVERRIDE;
|
|
|
|
virtual void Redo() wxOVERRIDE;
|
|
|
|
virtual bool CanUndo() const wxOVERRIDE;
|
|
|
|
virtual bool CanRedo() const wxOVERRIDE;
|
2007-09-25 20:30:22 -04:00
|
|
|
|
2014-03-29 20:02:23 -04:00
|
|
|
virtual void SetInsertionPoint(long pos) wxOVERRIDE;
|
|
|
|
virtual long GetInsertionPoint() const wxOVERRIDE;
|
|
|
|
virtual long GetLastPosition() const wxOVERRIDE;
|
2007-09-25 20:30:22 -04:00
|
|
|
|
2014-03-29 20:02:23 -04:00
|
|
|
virtual void SetSelection(long from, long to) wxOVERRIDE;
|
|
|
|
virtual void GetSelection(long *from, long *to) const wxOVERRIDE;
|
2007-09-25 20:30:22 -04:00
|
|
|
|
2014-03-29 20:02:23 -04:00
|
|
|
virtual bool IsEditable() const wxOVERRIDE;
|
|
|
|
virtual void SetEditable(bool editable) wxOVERRIDE;
|
2007-09-25 20:30:22 -04:00
|
|
|
|
2014-03-29 20:02:23 -04:00
|
|
|
virtual void SetMaxLength(unsigned long len) wxOVERRIDE;
|
2007-09-25 20:30:22 -04:00
|
|
|
|
2013-12-02 12:46:27 -05:00
|
|
|
#ifdef __WXGTK3__
|
2014-03-29 20:02:23 -04:00
|
|
|
virtual bool SetHint(const wxString& hint) wxOVERRIDE;
|
|
|
|
virtual wxString GetHint() const wxOVERRIDE;
|
2013-12-02 12:46:27 -05:00
|
|
|
#endif
|
|
|
|
|
2007-09-25 20:30:22 -04:00
|
|
|
// implementation only from now on
|
|
|
|
void SendMaxLenEvent();
|
2013-03-21 18:37:09 -04:00
|
|
|
bool GTKEntryOnInsertText(const char* text);
|
2007-09-25 20:30:22 -04:00
|
|
|
|
2009-03-02 08:31:29 -05:00
|
|
|
protected:
|
2012-07-29 18:08:15 -04:00
|
|
|
// This method must be called from the derived class Create() to connect
|
|
|
|
// the handlers for the clipboard (cut/copy/paste) events.
|
|
|
|
void GTKConnectClipboardSignals(GtkWidget* entry);
|
|
|
|
|
2013-03-21 18:37:09 -04:00
|
|
|
// And this one to connect "insert-text" signal.
|
|
|
|
void GTKConnectInsertTextSignal(GtkEntry* entry);
|
|
|
|
|
|
|
|
|
2014-03-29 20:02:23 -04:00
|
|
|
virtual void DoSetValue(const wxString& value, int flags) wxOVERRIDE;
|
|
|
|
virtual wxString DoGetValue() const wxOVERRIDE;
|
2009-03-02 08:31:29 -05:00
|
|
|
|
2009-09-05 08:39:12 -04:00
|
|
|
// margins functions
|
2014-03-29 20:02:23 -04:00
|
|
|
virtual bool DoSetMargins(const wxPoint& pt) wxOVERRIDE;
|
|
|
|
virtual wxPoint DoGetMargins() const wxOVERRIDE;
|
2009-09-05 08:39:12 -04:00
|
|
|
|
2014-03-29 20:02:23 -04:00
|
|
|
virtual bool DoAutoCompleteStrings(const wxArrayString& choices) wxOVERRIDE;
|
2011-04-16 13:27:04 -04:00
|
|
|
|
2013-03-21 18:37:09 -04:00
|
|
|
// Override the base class method to use GtkEntry IM context.
|
|
|
|
virtual int GTKIMFilterKeypress(GdkEventKey* event) const;
|
|
|
|
|
2007-09-25 20:30:22 -04:00
|
|
|
private:
|
|
|
|
// implement this to return the associated GtkEntry or another widget
|
|
|
|
// implementing GtkEditable
|
|
|
|
virtual GtkEditable *GetEditable() const = 0;
|
2009-09-05 08:39:12 -04:00
|
|
|
|
|
|
|
// implement this to return the associated GtkEntry
|
|
|
|
virtual GtkEntry *GetEntry() const = 0;
|
2007-09-25 20:30:22 -04:00
|
|
|
};
|
|
|
|
|
|
|
|
#endif // _WX_GTK_TEXTENTRY_H_
|
|
|
|
|