Add IM and full wxEVT_CHAR support to wxTextCtrl and wxComboBox in wxGTK.
Generate wxEVT_CHAR events for non-ASCII characters entered in these controls by intercepting their insert-text signal. Also try to use GtkEntry/GtkTextView internal IM objects but unsuccessfully so far. Closes #3158. git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@73695 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
This commit is contained in:
@@ -166,6 +166,10 @@ protected:
|
||||
|
||||
virtual void DoSetValue(const wxString &value, int flags = 0);
|
||||
|
||||
// Override this to use either GtkEntry or GtkTextView IME depending on the
|
||||
// kind of control we are.
|
||||
virtual int GTKIMFilterKeypress(GdkEventKey* event) const;
|
||||
|
||||
virtual wxPoint DoPositionToCoords(long pos) const;
|
||||
|
||||
// wrappers hiding the differences between functions doing the same thing
|
||||
|
@@ -50,12 +50,17 @@ public:
|
||||
|
||||
// implementation only from now on
|
||||
void SendMaxLenEvent();
|
||||
bool GTKEntryOnInsertText(const char* text);
|
||||
|
||||
protected:
|
||||
// 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);
|
||||
|
||||
// And this one to connect "insert-text" signal.
|
||||
void GTKConnectInsertTextSignal(GtkEntry* entry);
|
||||
|
||||
|
||||
virtual void DoSetValue(const wxString& value, int flags);
|
||||
virtual wxString DoGetValue() const;
|
||||
|
||||
@@ -65,6 +70,9 @@ protected:
|
||||
|
||||
virtual bool DoAutoCompleteStrings(const wxArrayString& choices);
|
||||
|
||||
// Override the base class method to use GtkEntry IM context.
|
||||
virtual int GTKIMFilterKeypress(GdkEventKey* event) const;
|
||||
|
||||
private:
|
||||
// implement this to return the associated GtkEntry or another widget
|
||||
// implementing GtkEditable
|
||||
|
@@ -297,6 +297,18 @@ public:
|
||||
// methods for accessing it such gtk_entry_im_context_filter_keypress().
|
||||
virtual int GTKIMFilterKeypress(GdkEventKey* event) const;
|
||||
|
||||
// This method must be called from the derived classes "insert-text" signal
|
||||
// handlers to check if the text is not being inserted by the IM and, if
|
||||
// this is the case, generate appropriate wxEVT_CHAR events for it.
|
||||
//
|
||||
// Returns true if we did generate and process events corresponding to this
|
||||
// text or false if we didn't handle it.
|
||||
bool GTKOnInsertText(const char* text);
|
||||
|
||||
// This is just a helper of GTKOnInsertText() which is also used by GTK+
|
||||
// "commit" signal handler.
|
||||
bool GTKDoInsertTextFromIM(const char* text);
|
||||
|
||||
|
||||
// indices for the arrays below
|
||||
enum ScrollDir { ScrollDir_Horz, ScrollDir_Vert, ScrollDir_Max };
|
||||
|
Reference in New Issue
Block a user