textentry.h 2.7 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586
  1. ///////////////////////////////////////////////////////////////////////////////
  2. // Name: wx/gtk/textentry.h
  3. // Purpose: wxGTK-specific wxTextEntry implementation
  4. // Author: Vadim Zeitlin
  5. // Created: 2007-09-24
  6. // Copyright: (c) 2007 Vadim Zeitlin <vadim@wxwindows.org>
  7. // Licence: wxWindows licence
  8. ///////////////////////////////////////////////////////////////////////////////
  9. #ifndef _WX_GTK_TEXTENTRY_H_
  10. #define _WX_GTK_TEXTENTRY_H_
  11. typedef struct _GdkEventKey GdkEventKey;
  12. typedef struct _GtkEditable GtkEditable;
  13. typedef struct _GtkEntry GtkEntry;
  14. // ----------------------------------------------------------------------------
  15. // wxTextEntry: roughly corresponds to GtkEditable
  16. // ----------------------------------------------------------------------------
  17. class WXDLLIMPEXP_CORE wxTextEntry : public wxTextEntryBase
  18. {
  19. public:
  20. wxTextEntry() { }
  21. // implement wxTextEntryBase pure virtual methods
  22. virtual void WriteText(const wxString& text);
  23. virtual void Remove(long from, long to);
  24. virtual void Copy();
  25. virtual void Cut();
  26. virtual void Paste();
  27. virtual void Undo();
  28. virtual void Redo();
  29. virtual bool CanUndo() const;
  30. virtual bool CanRedo() const;
  31. virtual void SetInsertionPoint(long pos);
  32. virtual long GetInsertionPoint() const;
  33. virtual long GetLastPosition() const;
  34. virtual void SetSelection(long from, long to);
  35. virtual void GetSelection(long *from, long *to) const;
  36. virtual bool IsEditable() const;
  37. virtual void SetEditable(bool editable);
  38. virtual void SetMaxLength(unsigned long len);
  39. // implementation only from now on
  40. void SendMaxLenEvent();
  41. bool GTKEntryOnInsertText(const char* text);
  42. protected:
  43. // This method must be called from the derived class Create() to connect
  44. // the handlers for the clipboard (cut/copy/paste) events.
  45. void GTKConnectClipboardSignals(GtkWidget* entry);
  46. // And this one to connect "insert-text" signal.
  47. void GTKConnectInsertTextSignal(GtkEntry* entry);
  48. virtual void DoSetValue(const wxString& value, int flags);
  49. virtual wxString DoGetValue() const;
  50. // margins functions
  51. virtual bool DoSetMargins(const wxPoint& pt);
  52. virtual wxPoint DoGetMargins() const;
  53. virtual bool DoAutoCompleteStrings(const wxArrayString& choices);
  54. // Override the base class method to use GtkEntry IM context.
  55. virtual int GTKIMFilterKeypress(GdkEventKey* event) const;
  56. private:
  57. // implement this to return the associated GtkEntry or another widget
  58. // implementing GtkEditable
  59. virtual GtkEditable *GetEditable() const = 0;
  60. // implement this to return the associated GtkEntry
  61. virtual GtkEntry *GetEntry() const = 0;
  62. };
  63. #endif // _WX_GTK_TEXTENTRY_H_