- Allow building wxGTK3 with Broadway backend (Kolya Kosenko).
- Provide native implementation of wxNotificationMessage using libnotify.
+- Generate clipboard events for wxComboBox and not only wxTextCtrl.
- Improve drag-and-drop of URLs.
wxMSW:
void SendMaxLenEvent();
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);
+
virtual void DoSetValue(const wxString& value, int flags);
virtual wxString DoGetValue() const;
void OnCloseup(wxCommandEvent& event);
void OnComboBox(wxCommandEvent& event);
void OnComboText(wxCommandEvent& event);
+ void OnComboTextPasted(wxClipboardTextEvent& event);
void OnCheckOrRadioBox(wxCommandEvent& event);
EVT_COMBOBOX_CLOSEUP(ComboPage_Combo, ComboboxWidgetsPage::OnCloseup)
EVT_TEXT(ComboPage_Combo, ComboboxWidgetsPage::OnComboText)
EVT_TEXT_ENTER(ComboPage_Combo, ComboboxWidgetsPage::OnComboText)
+ EVT_TEXT_PASTE(ComboPage_Combo, ComboboxWidgetsPage::OnComboTextPasted)
EVT_CHECKBOX(wxID_ANY, ComboboxWidgetsPage::OnCheckOrRadioBox)
EVT_RADIOBOX(wxID_ANY, ComboboxWidgetsPage::OnCheckOrRadioBox)
}
}
+void ComboboxWidgetsPage::OnComboTextPasted(wxClipboardTextEvent& event)
+{
+ wxLogMessage("Text pasted from clipboard.");
+ event.Skip();
+}
+
void ComboboxWidgetsPage::OnComboBox(wxCommandEvent& event)
{
long sel = event.GetInt();
void OnText(wxCommandEvent& event);
void OnTextEnter(wxCommandEvent& event);
+ void OnTextPasted(wxClipboardTextEvent& event);
void OnCheckOrRadioBox(wxCommandEvent& event);
EVT_TEXT(TextPage_Textctrl, TextWidgetsPage::OnText)
EVT_TEXT_ENTER(TextPage_Textctrl, TextWidgetsPage::OnTextEnter)
+ EVT_TEXT_PASTE(TextPage_Textctrl, TextWidgetsPage::OnTextPasted)
EVT_CHECKBOX(wxID_ANY, TextWidgetsPage::OnCheckOrRadioBox)
EVT_RADIOBOX(wxID_ANY, TextWidgetsPage::OnCheckOrRadioBox)
event.Skip();
}
+void TextWidgetsPage::OnTextPasted(wxClipboardTextEvent& event)
+{
+ wxLogMessage("Text pasted from clipboard.");
+ event.Skip();
+}
+
void TextWidgetsPage::OnCheckOrRadioBox(wxCommandEvent& WXUNUSED(event))
{
CreateText();
event.SetEventObject( combo );
combo->HandleWindowEvent( event );
}
+
}
//-----------------------------------------------------------------------------
g_signal_connect_after (entry, "changed",
G_CALLBACK (gtkcombobox_text_changed_callback), this);
+
+ GTKConnectClipboardSignals(GTK_WIDGET(entry));
}
g_signal_connect_after (m_widget, "changed",
}
}
-//-----------------------------------------------------------------------------
-// clipboard events: "copy-clipboard", "cut-clipboard", "paste-clipboard"
-//-----------------------------------------------------------------------------
-
-// common part of the event handlers below
-static void
-handle_text_clipboard_callback( GtkWidget *widget, wxTextCtrl *win,
- wxEventType eventType, const gchar * signal_name)
-{
- wxClipboardTextEvent event( eventType, win->GetId() );
- event.SetEventObject( win );
- if ( win->HandleWindowEvent( event ) )
- {
- // don't let the default processing to take place if we did something
- // ourselves in the event handler
- g_signal_stop_emission_by_name (widget, signal_name);
- }
-}
-
-extern "C" {
-static void
-gtk_copy_clipboard_callback( GtkWidget *widget, wxTextCtrl *win )
-{
- handle_text_clipboard_callback(
- widget, win, wxEVT_COMMAND_TEXT_COPY, "copy-clipboard" );
-}
-
-static void
-gtk_cut_clipboard_callback( GtkWidget *widget, wxTextCtrl *win )
-{
- handle_text_clipboard_callback(
- widget, win, wxEVT_COMMAND_TEXT_CUT, "cut-clipboard" );
-}
-
-static void
-gtk_paste_clipboard_callback( GtkWidget *widget, wxTextCtrl *win )
-{
- handle_text_clipboard_callback(
- widget, win, wxEVT_COMMAND_TEXT_PASTE, "paste-clipboard" );
-}
-}
-
//-----------------------------------------------------------------------------
// "mark_set"
//-----------------------------------------------------------------------------
}
- g_signal_connect (m_text, "copy-clipboard",
- G_CALLBACK (gtk_copy_clipboard_callback), this);
- g_signal_connect (m_text, "cut-clipboard",
- G_CALLBACK (gtk_cut_clipboard_callback), this);
- g_signal_connect (m_text, "paste-clipboard",
- G_CALLBACK (gtk_paste_clipboard_callback), this);
+ GTKConnectClipboardSignals(m_text);
m_cursor = wxCursor( wxCURSOR_IBEAM );
// signal handlers implementation
// ============================================================================
-extern "C"
-{
-
// "insert_text" handler for GtkEntry
-static void
+extern "C"
+void
wx_gtk_insert_text_callback(GtkEditable *editable,
const gchar * WXUNUSED(new_text),
gint WXUNUSED(new_text_length),
}
}
+//-----------------------------------------------------------------------------
+// clipboard events: "copy-clipboard", "cut-clipboard", "paste-clipboard"
+//-----------------------------------------------------------------------------
+
+// common part of the event handlers below
+static void
+DoHandleClipboardCallback( GtkWidget *widget,
+ wxWindow *win,
+ wxEventType eventType,
+ const gchar* signal_name)
+{
+ wxClipboardTextEvent event( eventType, win->GetId() );
+ event.SetEventObject( win );
+ if ( win->HandleWindowEvent( event ) )
+ {
+ // don't let the default processing to take place if we did something
+ // ourselves in the event handler
+ g_signal_stop_emission_by_name (widget, signal_name);
+ }
+}
+
+extern "C"
+{
+
+static void
+wx_gtk_copy_clipboard_callback( GtkWidget *widget, wxWindow *win )
+{
+ DoHandleClipboardCallback(
+ widget, win, wxEVT_COMMAND_TEXT_COPY, "copy-clipboard" );
+}
+
+static void
+wx_gtk_cut_clipboard_callback( GtkWidget *widget, wxWindow *win )
+{
+ DoHandleClipboardCallback(
+ widget, win, wxEVT_COMMAND_TEXT_CUT, "cut-clipboard" );
+}
+
+static void
+wx_gtk_paste_clipboard_callback( GtkWidget *widget, wxWindow *win )
+{
+ DoHandleClipboardCallback(
+ widget, win, wxEVT_COMMAND_TEXT_PASTE, "paste-clipboard" );
+}
+
} // extern "C"
// ============================================================================
// clipboard operations
// ----------------------------------------------------------------------------
+void wxTextEntry::GTKConnectClipboardSignals(GtkWidget* entry)
+{
+ g_signal_connect(entry, "copy-clipboard",
+ G_CALLBACK (wx_gtk_copy_clipboard_callback),
+ GetEditableWindow());
+ g_signal_connect(entry, "cut-clipboard",
+ G_CALLBACK (wx_gtk_cut_clipboard_callback),
+ GetEditableWindow());
+ g_signal_connect(entry, "paste-clipboard",
+ G_CALLBACK (wx_gtk_paste_clipboard_callback),
+ GetEditableWindow());
+}
+
void wxTextEntry::Copy()
{
gtk_editable_copy_clipboard(GetEditable());