From 865bb3251ecf83ddac350b734f4fed1d258e250b Mon Sep 17 00:00:00 2001 From: Vadim Zeitlin Date: Mon, 21 Mar 2005 23:42:26 +0000 Subject: [PATCH] GTK+ callbacks must have C linkage (patch 1157384) git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@32974 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775 --- include/wx/gtk/control.h | 13 ++++++-- include/wx/gtk1/control.h | 13 ++++++-- src/gtk/bmpbuttn.cpp | 10 ++++++ src/gtk/button.cpp | 2 ++ src/gtk/checkbox.cpp | 2 ++ src/gtk/choice.cpp | 2 ++ src/gtk/clipbrd.cpp | 8 +++++ src/gtk/combobox.cpp | 10 ++++++ src/gtk/control.cpp | 6 ++-- src/gtk/dnd.cpp | 18 ++++++++++ src/gtk/filedlg.cpp | 9 ++++- src/gtk/fontdlg.cpp | 6 ++++ src/gtk/frame.cpp | 8 +++++ src/gtk/glcanvas.cpp | 10 ++++++ src/gtk/gsockgtk.cpp | 3 ++ src/gtk/listbox.cpp | 42 +++++++++++++++-------- src/gtk/mdi.cpp | 4 +++ src/gtk/menu.cpp | 24 +++++++++++--- src/gtk/minifram.cpp | 12 +++++++ src/gtk/notebook.cpp | 8 +++++ src/gtk/popupwin.cpp | 10 ++++++ src/gtk/radiobox.cpp | 8 +++++ src/gtk/radiobut.cpp | 2 ++ src/gtk/scrolbar.cpp | 6 ++++ src/gtk/scrolwin.cpp | 8 +++++ src/gtk/slider.cpp | 2 ++ src/gtk/spinbutt.cpp | 2 ++ src/gtk/spinctrl.cpp | 4 +++ src/gtk/tbargtk.cpp | 4 +++ src/gtk/textctrl.cpp | 31 +++++++++++++++-- src/gtk/tglbtn.cpp | 2 ++ src/gtk/timer.cpp | 4 ++- src/gtk/toplevel.cpp | 22 ++++++++++++ src/gtk/utilsgtk.cpp | 4 ++- src/gtk/window.cpp | 70 ++++++++++++++++++++++++++++++++++----- src/gtk1/bmpbuttn.cpp | 10 ++++++ src/gtk1/button.cpp | 2 ++ src/gtk1/checkbox.cpp | 2 ++ src/gtk1/choice.cpp | 2 ++ src/gtk1/clipbrd.cpp | 8 +++++ src/gtk1/combobox.cpp | 10 ++++++ src/gtk1/control.cpp | 6 ++-- src/gtk1/dnd.cpp | 18 ++++++++++ src/gtk1/filedlg.cpp | 9 ++++- src/gtk1/fontdlg.cpp | 6 ++++ src/gtk1/frame.cpp | 8 +++++ src/gtk1/glcanvas.cpp | 10 ++++++ src/gtk1/gsockgtk.cpp | 3 ++ src/gtk1/listbox.cpp | 42 +++++++++++++++-------- src/gtk1/mdi.cpp | 4 +++ src/gtk1/menu.cpp | 24 +++++++++++--- src/gtk1/minifram.cpp | 12 +++++++ src/gtk1/notebook.cpp | 8 +++++ src/gtk1/popupwin.cpp | 10 ++++++ src/gtk1/radiobox.cpp | 8 +++++ src/gtk1/radiobut.cpp | 2 ++ src/gtk1/scrolbar.cpp | 6 ++++ src/gtk1/scrolwin.cpp | 8 +++++ src/gtk1/slider.cpp | 2 ++ src/gtk1/spinbutt.cpp | 2 ++ src/gtk1/spinctrl.cpp | 4 +++ src/gtk1/tbargtk.cpp | 4 +++ src/gtk1/textctrl.cpp | 31 +++++++++++++++-- src/gtk1/tglbtn.cpp | 2 ++ src/gtk1/timer.cpp | 4 ++- src/gtk1/toplevel.cpp | 22 ++++++++++++ src/gtk1/utilsgtk.cpp | 4 ++- src/gtk1/window.cpp | 70 ++++++++++++++++++++++++++++++++++----- src/unix/utilsx11.cpp | 6 ++-- src/xml/xml.cpp | 12 +++++++ 70 files changed, 692 insertions(+), 78 deletions(-) diff --git a/include/wx/gtk/control.h b/include/wx/gtk/control.h index 0dd1153df7..bcac0a83d8 100644 --- a/include/wx/gtk/control.h +++ b/include/wx/gtk/control.h @@ -29,6 +29,13 @@ class wxControl; // wxControl //----------------------------------------------------------------------------- +// C-linkage function pointer types for GetDefaultAttributesFromGTKWidget +extern "C" { + typedef GtkWidget* (*wxGtkWidgetNew_t)(void); + typedef GtkWidget* (*wxGtkWidgetNewFromStr_t)(const gchar*); + typedef GtkWidget* (*wxGtkWidgetNewFromAdj_t)(GtkAdjustment*); +} + class wxControl : public wxControlBase { public: @@ -69,16 +76,16 @@ protected: bool useBase = false, int state = -1); static wxVisualAttributes - GetDefaultAttributesFromGTKWidget(GtkWidget* (*widget_new)(void), + GetDefaultAttributesFromGTKWidget(wxGtkWidgetNew_t, bool useBase = false, int state = -1); static wxVisualAttributes - GetDefaultAttributesFromGTKWidget(GtkWidget* (*widget_new)(const gchar*), + GetDefaultAttributesFromGTKWidget(wxGtkWidgetNewFromStr_t, bool useBase = false, int state = -1); static wxVisualAttributes - GetDefaultAttributesFromGTKWidget(GtkWidget* (*widget_new)(GtkAdjustment*), + GetDefaultAttributesFromGTKWidget(wxGtkWidgetNewFromAdj_t, bool useBase = false, int state = -1); diff --git a/include/wx/gtk1/control.h b/include/wx/gtk1/control.h index 0dd1153df7..bcac0a83d8 100644 --- a/include/wx/gtk1/control.h +++ b/include/wx/gtk1/control.h @@ -29,6 +29,13 @@ class wxControl; // wxControl //----------------------------------------------------------------------------- +// C-linkage function pointer types for GetDefaultAttributesFromGTKWidget +extern "C" { + typedef GtkWidget* (*wxGtkWidgetNew_t)(void); + typedef GtkWidget* (*wxGtkWidgetNewFromStr_t)(const gchar*); + typedef GtkWidget* (*wxGtkWidgetNewFromAdj_t)(GtkAdjustment*); +} + class wxControl : public wxControlBase { public: @@ -69,16 +76,16 @@ protected: bool useBase = false, int state = -1); static wxVisualAttributes - GetDefaultAttributesFromGTKWidget(GtkWidget* (*widget_new)(void), + GetDefaultAttributesFromGTKWidget(wxGtkWidgetNew_t, bool useBase = false, int state = -1); static wxVisualAttributes - GetDefaultAttributesFromGTKWidget(GtkWidget* (*widget_new)(const gchar*), + GetDefaultAttributesFromGTKWidget(wxGtkWidgetNewFromStr_t, bool useBase = false, int state = -1); static wxVisualAttributes - GetDefaultAttributesFromGTKWidget(GtkWidget* (*widget_new)(GtkAdjustment*), + GetDefaultAttributesFromGTKWidget(wxGtkWidgetNewFromAdj_t, bool useBase = false, int state = -1); diff --git a/src/gtk/bmpbuttn.cpp b/src/gtk/bmpbuttn.cpp index ed67afffaf..bbf2044476 100644 --- a/src/gtk/bmpbuttn.cpp +++ b/src/gtk/bmpbuttn.cpp @@ -45,6 +45,7 @@ extern bool g_blockEventsOnDrag; // "clicked" //----------------------------------------------------------------------------- +extern "C" { static void gtk_bmpbutton_clicked_callback( GtkWidget *WXUNUSED(widget), wxBitmapButton *button ) { if (g_isIdle) @@ -57,11 +58,13 @@ static void gtk_bmpbutton_clicked_callback( GtkWidget *WXUNUSED(widget), wxBitma event.SetEventObject(button); button->GetEventHandler()->ProcessEvent(event); } +} //----------------------------------------------------------------------------- // "enter" //----------------------------------------------------------------------------- +extern "C" { static void gtk_bmpbutton_enter_callback( GtkWidget *WXUNUSED(widget), wxBitmapButton *button ) { if (!button->m_hasVMT) return; @@ -69,11 +72,13 @@ static void gtk_bmpbutton_enter_callback( GtkWidget *WXUNUSED(widget), wxBitmapB button->HasFocus(); } +} //----------------------------------------------------------------------------- // "leave" //----------------------------------------------------------------------------- +extern "C" { static void gtk_bmpbutton_leave_callback( GtkWidget *WXUNUSED(widget), wxBitmapButton *button ) { if (!button->m_hasVMT) return; @@ -81,11 +86,13 @@ static void gtk_bmpbutton_leave_callback( GtkWidget *WXUNUSED(widget), wxBitmapB button->NotFocus(); } +} //----------------------------------------------------------------------------- // "pressed" //----------------------------------------------------------------------------- +extern "C" { static void gtk_bmpbutton_press_callback( GtkWidget *WXUNUSED(widget), wxBitmapButton *button ) { if (!button->m_hasVMT) return; @@ -93,11 +100,13 @@ static void gtk_bmpbutton_press_callback( GtkWidget *WXUNUSED(widget), wxBitmapB button->StartSelect(); } +} //----------------------------------------------------------------------------- // "released" //----------------------------------------------------------------------------- +extern "C" { static void gtk_bmpbutton_release_callback( GtkWidget *WXUNUSED(widget), wxBitmapButton *button ) { if (!button->m_hasVMT) return; @@ -105,6 +114,7 @@ static void gtk_bmpbutton_release_callback( GtkWidget *WXUNUSED(widget), wxBitma button->EndSelect(); } +} //----------------------------------------------------------------------------- // wxBitmapButton diff --git a/src/gtk/button.cpp b/src/gtk/button.cpp index aec633f450..acaf646e22 100644 --- a/src/gtk/button.cpp +++ b/src/gtk/button.cpp @@ -47,6 +47,7 @@ extern bool g_blockEventsOnDrag; // "clicked" //----------------------------------------------------------------------------- +extern "C" { static void gtk_button_clicked_callback( GtkWidget *WXUNUSED(widget), wxButton *button ) { if (g_isIdle) @@ -59,6 +60,7 @@ static void gtk_button_clicked_callback( GtkWidget *WXUNUSED(widget), wxButton * event.SetEventObject(button); button->GetEventHandler()->ProcessEvent(event); } +} //----------------------------------------------------------------------------- // "style_set" from m_widget diff --git a/src/gtk/checkbox.cpp b/src/gtk/checkbox.cpp index 37131bc9b8..a0655d0912 100644 --- a/src/gtk/checkbox.cpp +++ b/src/gtk/checkbox.cpp @@ -42,6 +42,7 @@ extern wxWindowGTK *g_delayedFocus; // "clicked" //----------------------------------------------------------------------------- +extern "C" { static void gtk_checkbox_toggled_callback(GtkWidget *widget, wxCheckBox *cb) { if (g_isIdle) wxapp_install_idle_handler(); @@ -109,6 +110,7 @@ static void gtk_checkbox_toggled_callback(GtkWidget *widget, wxCheckBox *cb) event.SetEventObject(cb); cb->GetEventHandler()->ProcessEvent(event); } +} //----------------------------------------------------------------------------- // wxCheckBox diff --git a/src/gtk/choice.cpp b/src/gtk/choice.cpp index 59d5402c12..7b8633ef1b 100644 --- a/src/gtk/choice.cpp +++ b/src/gtk/choice.cpp @@ -38,6 +38,7 @@ extern bool g_blockEventsOnDrag; // "activate" //----------------------------------------------------------------------------- +extern "C" { static void gtk_choice_clicked_callback( GtkWidget *WXUNUSED(widget), wxChoice *choice ) { if (g_isIdle) @@ -84,6 +85,7 @@ static void gtk_choice_clicked_callback( GtkWidget *WXUNUSED(widget), wxChoice * choice->GetEventHandler()->ProcessEvent(event); } +} //----------------------------------------------------------------------------- // wxChoice diff --git a/src/gtk/clipbrd.cpp b/src/gtk/clipbrd.cpp index c5f0f8d6fa..a8fc2c7ee0 100644 --- a/src/gtk/clipbrd.cpp +++ b/src/gtk/clipbrd.cpp @@ -78,6 +78,7 @@ struct _GtkSelectionData // "selection_received" for targets //----------------------------------------------------------------------------- +extern "C" { static void targets_selection_received( GtkWidget *WXUNUSED(widget), GtkSelectionData *selection_data, @@ -133,11 +134,13 @@ targets_selection_received( GtkWidget *WXUNUSED(widget), clipboard->m_waiting = FALSE; } +} //----------------------------------------------------------------------------- // "selection_received" for the actual data //----------------------------------------------------------------------------- +extern "C" { static void selection_received( GtkWidget *WXUNUSED(widget), GtkSelectionData *selection_data, @@ -189,11 +192,13 @@ selection_received( GtkWidget *WXUNUSED(widget), wxTheClipboard->m_formatSupported = TRUE; clipboard->m_waiting = FALSE; } +} //----------------------------------------------------------------------------- // "selection_clear" //----------------------------------------------------------------------------- +extern "C" { static gint selection_clear_clip( GtkWidget *WXUNUSED(widget), GdkEventSelection *event ) { @@ -230,11 +235,13 @@ selection_clear_clip( GtkWidget *WXUNUSED(widget), GdkEventSelection *event ) wxTheClipboard->m_waiting = FALSE; return TRUE; } +} //----------------------------------------------------------------------------- // selection handler for supplying data //----------------------------------------------------------------------------- +extern "C" { static void selection_handler( GtkWidget *WXUNUSED(widget), GtkSelectionData *selection_data, @@ -295,6 +302,7 @@ selection_handler( GtkWidget *WXUNUSED(widget), free(d); } +} //----------------------------------------------------------------------------- // wxClipboard diff --git a/src/gtk/combobox.cpp b/src/gtk/combobox.cpp index 5ec1549e86..c1e77b07d7 100644 --- a/src/gtk/combobox.cpp +++ b/src/gtk/combobox.cpp @@ -44,6 +44,7 @@ static int g_SelectionBeforePopup = -2; // -2 <=> the popup is hidden // if it doesn't match an item then just get a single changed //----------------------------------------------------------------------------- +extern "C" { static void gtk_text_changed_callback( GtkWidget *WXUNUSED(widget), wxComboBox *combo ) { @@ -62,12 +63,16 @@ gtk_text_changed_callback( GtkWidget *WXUNUSED(widget), wxComboBox *combo ) event.SetEventObject( combo ); combo->GetEventHandler()->ProcessEvent( event ); } +} +extern "C" { static void gtk_dummy_callback(GtkEntry *WXUNUSED(entry), GtkCombo *WXUNUSED(combo)) { } +} +extern "C" { static void gtk_popup_hide_callback(GtkCombo *WXUNUSED(gtk_combo), wxComboBox *combo) { @@ -86,7 +91,9 @@ gtk_popup_hide_callback(GtkCombo *WXUNUSED(gtk_combo), wxComboBox *combo) // reset the selection flag to an identifiable value (-2 = hidden) g_SelectionBeforePopup = -2; } +} +extern "C" { static void gtk_popup_show_callback(GtkCombo *WXUNUSED(gtk_combo), wxComboBox *combo) { @@ -94,11 +101,13 @@ gtk_popup_show_callback(GtkCombo *WXUNUSED(gtk_combo), wxComboBox *combo) // if there is no selection, combo->GetSelection() returns -1 g_SelectionBeforePopup = combo->GetSelection(); } +} //----------------------------------------------------------------------------- // "select-child" - click/cursor get select-child, changed, select-child //----------------------------------------------------------------------------- +extern "C" { static void gtk_combo_select_child_callback( GtkList *WXUNUSED(list), GtkWidget *WXUNUSED(widget), wxComboBox *combo ) { @@ -146,6 +155,7 @@ gtk_combo_select_child_callback( GtkList *WXUNUSED(list), GtkWidget *WXUNUSED(wi event2.SetEventObject( combo ); combo->GetEventHandler()->ProcessEvent( event2 ); } +} //----------------------------------------------------------------------------- // wxComboBox diff --git a/src/gtk/control.cpp b/src/gtk/control.cpp index 06eaec261b..5f2f191171 100644 --- a/src/gtk/control.cpp +++ b/src/gtk/control.cpp @@ -231,7 +231,7 @@ wxControl::GetDefaultAttributesFromGTKWidget(GtkWidget* widget, //static wxVisualAttributes -wxControl::GetDefaultAttributesFromGTKWidget(GtkWidget* (*widget_new)(void), +wxControl::GetDefaultAttributesFromGTKWidget(wxGtkWidgetNew_t widget_new, bool useBase, int state) { @@ -247,7 +247,7 @@ wxControl::GetDefaultAttributesFromGTKWidget(GtkWidget* (*widget_new)(void), //static wxVisualAttributes -wxControl::GetDefaultAttributesFromGTKWidget(GtkWidget* (*widget_new)(const gchar*), +wxControl::GetDefaultAttributesFromGTKWidget(wxGtkWidgetNewFromStr_t widget_new, bool useBase, int state) { @@ -264,7 +264,7 @@ wxControl::GetDefaultAttributesFromGTKWidget(GtkWidget* (*widget_new)(const gcha //static wxVisualAttributes -wxControl::GetDefaultAttributesFromGTKWidget(GtkWidget* (*widget_new)(GtkAdjustment*), +wxControl::GetDefaultAttributesFromGTKWidget(wxGtkWidgetNewFromAdj_t widget_new, bool useBase, int state) { diff --git a/src/gtk/dnd.cpp b/src/gtk/dnd.cpp index b8b6ecfb7f..8fdfda9c2a 100644 --- a/src/gtk/dnd.cpp +++ b/src/gtk/dnd.cpp @@ -139,6 +139,7 @@ static wxDragResult ConvertFromGTK(long action) // "drag_leave" // ---------------------------------------------------------------------------- +extern "C" { static void target_drag_leave( GtkWidget *WXUNUSED(widget), GdkDragContext *context, guint WXUNUSED(time), @@ -160,11 +161,13 @@ static void target_drag_leave( GtkWidget *WXUNUSED(widget), /* after this, invalidate the drop_target's GdkDragContext */ drop_target->SetDragContext( (GdkDragContext*) NULL ); } +} // ---------------------------------------------------------------------------- // "drag_motion" // ---------------------------------------------------------------------------- +extern "C" { static gboolean target_drag_motion( GtkWidget *WXUNUSED(widget), GdkDragContext *context, gint x, @@ -256,11 +259,13 @@ static gboolean target_drag_motion( GtkWidget *WXUNUSED(widget), return ret; } +} // ---------------------------------------------------------------------------- // "drag_drop" // ---------------------------------------------------------------------------- +extern "C" { static gboolean target_drag_drop( GtkWidget *widget, GdkDragContext *context, gint x, @@ -355,11 +360,13 @@ static gboolean target_drag_drop( GtkWidget *widget, return ret; } +} // ---------------------------------------------------------------------------- // "drag_data_received" // ---------------------------------------------------------------------------- +extern "C" { static void target_drag_data_received( GtkWidget *WXUNUSED(widget), GdkDragContext *context, gint x, @@ -409,6 +416,7 @@ static void target_drag_data_received( GtkWidget *WXUNUSED(widget), /* after this, invalidate the drop_target's drag data */ drop_target->SetDragData( (GtkSelectionData*) NULL ); } +} //---------------------------------------------------------------------------- // wxDropTarget @@ -561,6 +569,7 @@ void wxDropTarget::RegisterWidget( GtkWidget *widget ) // "drag_data_get" //---------------------------------------------------------------------------- +extern "C" { static void source_drag_data_get (GtkWidget *WXUNUSED(widget), GdkDragContext *WXUNUSED(context), @@ -626,11 +635,13 @@ source_drag_data_get (GtkWidget *WXUNUSED(widget), delete[] d; } +} //---------------------------------------------------------------------------- // "drag_data_delete" //---------------------------------------------------------------------------- +extern "C" { static void source_drag_data_delete( GtkWidget *WXUNUSED(widget), GdkDragContext *context, wxDropSource *WXUNUSED(drop_source) ) @@ -640,11 +651,13 @@ static void source_drag_data_delete( GtkWidget *WXUNUSED(widget), // printf( "Drag source: drag_data_delete\n" ); } +} //---------------------------------------------------------------------------- // "drag_begin" //---------------------------------------------------------------------------- +extern "C" { static void source_drag_begin( GtkWidget *WXUNUSED(widget), GdkDragContext *WXUNUSED(context), wxDropSource *WXUNUSED(drop_source) ) @@ -654,11 +667,13 @@ static void source_drag_begin( GtkWidget *WXUNUSED(widget), // printf( "Drag source: drag_begin.\n" ); } +} //---------------------------------------------------------------------------- // "drag_end" //---------------------------------------------------------------------------- +extern "C" { static void source_drag_end( GtkWidget *WXUNUSED(widget), GdkDragContext *WXUNUSED(context), wxDropSource *drop_source ) @@ -669,11 +684,13 @@ static void source_drag_end( GtkWidget *WXUNUSED(widget), drop_source->m_waiting = FALSE; } +} //----------------------------------------------------------------------------- // "configure_event" from m_iconWindow //----------------------------------------------------------------------------- +extern "C" { static gint gtk_dnd_window_configure_callback( GtkWidget *WXUNUSED(widget), GdkEventConfigure *WXUNUSED(event), wxDropSource *source ) { @@ -684,6 +701,7 @@ gtk_dnd_window_configure_callback( GtkWidget *WXUNUSED(widget), GdkEventConfigur return 0; } +} //--------------------------------------------------------------------------- // wxDropSource diff --git a/src/gtk/filedlg.cpp b/src/gtk/filedlg.cpp index 78e2ebcadd..e1082ea83e 100644 --- a/src/gtk/filedlg.cpp +++ b/src/gtk/filedlg.cpp @@ -38,6 +38,7 @@ extern bool g_isIdle; // "clicked" for OK-button //----------------------------------------------------------------------------- +extern "C" { static void gtk_filedialog_ok_callback(GtkWidget *widget, wxFileDialog *dialog) { int style = dialog->GetStyle(); @@ -91,11 +92,13 @@ static void gtk_filedialog_ok_callback(GtkWidget *widget, wxFileDialog *dialog) event.SetEventObject(dialog); dialog->GetEventHandler()->ProcessEvent(event); } +} //----------------------------------------------------------------------------- // "clicked" for Cancel-button //----------------------------------------------------------------------------- +extern "C" { static void gtk_filedialog_cancel_callback(GtkWidget *WXUNUSED(w), wxFileDialog *dialog) { @@ -103,7 +106,9 @@ static void gtk_filedialog_cancel_callback(GtkWidget *WXUNUSED(w), event.SetEventObject(dialog); dialog->GetEventHandler()->ProcessEvent(event); } +} +extern "C" { static void gtk_filedialog_response_callback(GtkWidget *w, int response, wxFileDialog *dialog) @@ -120,7 +125,9 @@ static void gtk_filedialog_response_callback(GtkWidget *w, dialog->m_destroyed_by_delete = true; } } -#endif +} + +#endif // __WXGTK24__ //----------------------------------------------------------------------------- // wxFileDialog diff --git a/src/gtk/fontdlg.cpp b/src/gtk/fontdlg.cpp index 76811ec307..b2c47ed213 100644 --- a/src/gtk/fontdlg.cpp +++ b/src/gtk/fontdlg.cpp @@ -40,6 +40,7 @@ extern bool g_isIdle; // "delete_event" //----------------------------------------------------------------------------- +extern "C" { static bool gtk_fontdialog_delete_callback( GtkWidget *WXUNUSED(widget), GdkEvent *WXUNUSED(event), wxDialog *win ) { @@ -57,11 +58,13 @@ bool gtk_fontdialog_delete_callback( GtkWidget *WXUNUSED(widget), GdkEvent *WXUN return TRUE; } +} //----------------------------------------------------------------------------- // "clicked" for OK-button //----------------------------------------------------------------------------- +extern "C" { static void gtk_fontdialog_ok_callback( GtkWidget *WXUNUSED(widget), wxFontDialog *dialog ) { @@ -90,11 +93,13 @@ void gtk_fontdialog_ok_callback( GtkWidget *WXUNUSED(widget), wxFontDialog *dial event.SetEventObject( dialog ); dialog->GetEventHandler()->ProcessEvent( event ); } +} //----------------------------------------------------------------------------- // "clicked" for Cancel-button //----------------------------------------------------------------------------- +extern "C" { static void gtk_fontdialog_cancel_callback( GtkWidget *WXUNUSED(w), wxFontDialog *dialog ) { @@ -105,6 +110,7 @@ void gtk_fontdialog_cancel_callback( GtkWidget *WXUNUSED(w), wxFontDialog *dialo event.SetEventObject( dialog ); dialog->GetEventHandler()->ProcessEvent( event ); } +} //----------------------------------------------------------------------------- // wxFontDialog diff --git a/src/gtk/frame.cpp b/src/gtk/frame.cpp index c6043a88c6..1bf86a39a5 100644 --- a/src/gtk/frame.cpp +++ b/src/gtk/frame.cpp @@ -80,6 +80,7 @@ IMPLEMENT_DYNAMIC_CLASS(wxFrame, wxTopLevelWindow) // "child_attached" of menu bar //----------------------------------------------------------------------------- +extern "C" { static void gtk_menu_attached_callback( GtkWidget *WXUNUSED(widget), GtkWidget *WXUNUSED(child), wxFrame *win ) { if (!win->m_hasVMT) return; @@ -87,11 +88,13 @@ static void gtk_menu_attached_callback( GtkWidget *WXUNUSED(widget), GtkWidget * win->m_menuBarDetached = FALSE; win->GtkUpdateSize(); } +} //----------------------------------------------------------------------------- // "child_detached" of menu bar //----------------------------------------------------------------------------- +extern "C" { static void gtk_menu_detached_callback( GtkWidget *WXUNUSED(widget), GtkWidget *WXUNUSED(child), wxFrame *win ) { if (g_isIdle) @@ -105,6 +108,7 @@ static void gtk_menu_detached_callback( GtkWidget *WXUNUSED(widget), GtkWidget * win->m_menuBarDetached = TRUE; win->GtkUpdateSize(); } +} #endif // wxUSE_MENUS_NATIVE @@ -113,6 +117,7 @@ static void gtk_menu_detached_callback( GtkWidget *WXUNUSED(widget), GtkWidget * // "child_attached" of tool bar //----------------------------------------------------------------------------- +extern "C" { static void gtk_toolbar_attached_callback( GtkWidget *WXUNUSED(widget), GtkWidget *WXUNUSED(child), wxFrame *win ) { if (!win->m_hasVMT) return; @@ -120,11 +125,13 @@ static void gtk_toolbar_attached_callback( GtkWidget *WXUNUSED(widget), GtkWidge win->m_toolBarDetached = FALSE; win->GtkUpdateSize(); } +} //----------------------------------------------------------------------------- // "child_detached" of tool bar //----------------------------------------------------------------------------- +extern "C" { static void gtk_toolbar_detached_callback( GtkWidget *WXUNUSED(widget), GtkWidget *WXUNUSED(child), wxFrame *win ) { if (g_isIdle) @@ -138,6 +145,7 @@ static void gtk_toolbar_detached_callback( GtkWidget *WXUNUSED(widget), GtkWidge win->m_toolBarDetached = TRUE; win->GtkUpdateSize(); } +} #endif // wxUSE_TOOLBAR diff --git a/src/gtk/glcanvas.cpp b/src/gtk/glcanvas.cpp index 30def50299..1dce4e0df5 100644 --- a/src/gtk/glcanvas.cpp +++ b/src/gtk/glcanvas.cpp @@ -157,6 +157,7 @@ wxPalette wxGLContext::CreateDefaultPalette() // "realize" from m_wxwindow //----------------------------------------------------------------------------- +extern "C" { static gint gtk_glwindow_realized_callback( GtkWidget * WXUNUSED(widget), wxGLCanvas *win ) { @@ -171,11 +172,13 @@ gtk_glwindow_realized_callback( GtkWidget * WXUNUSED(widget), wxGLCanvas *win ) return FALSE; } +} //----------------------------------------------------------------------------- // "map" from m_wxwindow //----------------------------------------------------------------------------- +extern "C" { static gint gtk_glwindow_map_callback( GtkWidget * WXUNUSED(widget), wxGLCanvas *win ) { @@ -191,11 +194,13 @@ gtk_glwindow_map_callback( GtkWidget * WXUNUSED(widget), wxGLCanvas *win ) return FALSE; } +} //----------------------------------------------------------------------------- // "expose_event" of m_wxwindow //----------------------------------------------------------------------------- +extern "C" { static void gtk_glwindow_expose_callback( GtkWidget *WXUNUSED(widget), GdkEventExpose *gdk_event, wxGLCanvas *win ) { @@ -209,12 +214,14 @@ gtk_glwindow_expose_callback( GtkWidget *WXUNUSED(widget), GdkEventExpose *gdk_e gdk_event->area.width, gdk_event->area.height ); } +} //----------------------------------------------------------------------------- // "draw" of m_wxwindow //----------------------------------------------------------------------------- #ifndef __WXGTK20__ +extern "C" { static void gtk_glwindow_draw_callback( GtkWidget *WXUNUSED(widget), GdkRectangle *rect, wxGLCanvas *win ) { @@ -226,12 +233,14 @@ gtk_glwindow_draw_callback( GtkWidget *WXUNUSED(widget), GdkRectangle *rect, wxG win->GetUpdateRegion().Union( rect->x, rect->y, rect->width, rect->height ); } +} #endif //----------------------------------------------------------------------------- // "size_allocate" of m_wxwindow //----------------------------------------------------------------------------- +extern "C" { static void gtk_glcanvas_size_callback( GtkWidget *WXUNUSED(widget), GtkAllocation* alloc, wxGLCanvas *win ) { @@ -245,6 +254,7 @@ gtk_glcanvas_size_callback( GtkWidget *WXUNUSED(widget), GtkAllocation* alloc, w event.SetEventObject( win ); win->GetEventHandler()->ProcessEvent( event ); } +} //--------------------------------------------------------------------------- // wxGlCanvas diff --git a/src/gtk/gsockgtk.cpp b/src/gtk/gsockgtk.cpp index ffcd57563c..ae8e1a9da5 100644 --- a/src/gtk/gsockgtk.cpp +++ b/src/gtk/gsockgtk.cpp @@ -21,6 +21,8 @@ #include "wx/unix/gsockunx.h" +extern "C" { +static void _GSocket_GDK_Input(gpointer data, gint source, GdkInputCondition condition) @@ -32,6 +34,7 @@ void _GSocket_GDK_Input(gpointer data, if (condition & GDK_INPUT_WRITE) socket->Detected_Write(); } +} bool GSocketGUIFunctionsTableConcrete::CanUseEventLoop() { return true; } diff --git a/src/gtk/listbox.cpp b/src/gtk/listbox.cpp index b522fd7a88..31bbf3815a 100644 --- a/src/gtk/listbox.cpp +++ b/src/gtk/listbox.cpp @@ -67,7 +67,8 @@ struct wxlistbox_idle_struct gint m_tag; }; -extern "C" gint wxlistbox_idle_callback( gpointer gdata ) +extern "C" { +static gint wxlistbox_idle_callback( gpointer gdata ) { wxlistbox_idle_struct* data = (wxlistbox_idle_struct*) gdata; gdk_threads_enter(); @@ -88,11 +89,13 @@ extern "C" gint wxlistbox_idle_callback( gpointer gdata ) return TRUE; } +} //----------------------------------------------------------------------------- // "focus_in_event" //----------------------------------------------------------------------------- +extern "C" { static gint gtk_listitem_focus_in_callback( GtkWidget *widget, GdkEvent *WXUNUSED(event), wxWindow *win ) @@ -120,11 +123,13 @@ static gint gtk_listitem_focus_in_callback( GtkWidget *widget, return FALSE; } +} //----------------------------------------------------------------------------- // "focus_out_event" //----------------------------------------------------------------------------- +extern "C" { static gint gtk_listitem_focus_out_callback( GtkWidget *widget, GdkEventFocus *gdk_event, wxWindowGTK *win ) { if (g_isIdle) @@ -150,6 +155,7 @@ static gint gtk_listitem_focus_out_callback( GtkWidget *widget, GdkEventFocus *g return FALSE; } +} //----------------------------------------------------------------------------- // "button_release_event" @@ -161,6 +167,7 @@ static gint gtk_listitem_focus_out_callback( GtkWidget *widget, GdkEventFocus *g this can lead to race conditions so that we emit the dclick event after the GDK_BUTTON_RELEASE event after the GDK_2BUTTON_PRESS event */ +extern "C" { static gint gtk_listbox_button_release_callback( GtkWidget * WXUNUSED(widget), GdkEventButton * WXUNUSED(gdk_event), @@ -200,11 +207,13 @@ gtk_listbox_button_release_callback( GtkWidget * WXUNUSED(widget), return FALSE; } +} //----------------------------------------------------------------------------- // "button_press_event" //----------------------------------------------------------------------------- +extern "C" { static gint gtk_listbox_button_press_callback( GtkWidget *widget, GdkEventButton *gdk_event, @@ -254,11 +263,13 @@ gtk_listbox_button_press_callback( GtkWidget *widget, return FALSE; } +} //----------------------------------------------------------------------------- // "key_press_event" //----------------------------------------------------------------------------- +extern "C" { static gint gtk_listbox_key_press_callback( GtkWidget *widget, GdkEventKey *gdk_event, wxListBox *listbox ) { @@ -349,23 +360,12 @@ gtk_listbox_key_press_callback( GtkWidget *widget, GdkEventKey *gdk_event, wxLis return FALSE; } +} //----------------------------------------------------------------------------- // "select" and "deselect" //----------------------------------------------------------------------------- -static void gtk_listitem_select_cb( GtkWidget *widget, wxListBox *listbox, bool is_selection ); - -static void gtk_listitem_select_callback( GtkWidget *widget, wxListBox *listbox ) -{ - gtk_listitem_select_cb( widget, listbox, TRUE ); -} - -static void gtk_listitem_deselect_callback( GtkWidget *widget, wxListBox *listbox ) -{ - gtk_listitem_select_cb( widget, listbox, FALSE ); -} - static void gtk_listitem_select_cb( GtkWidget *widget, wxListBox *listbox, bool is_selection ) @@ -416,10 +416,25 @@ static void gtk_listitem_select_cb( GtkWidget *widget, listbox->GetEventHandler()->ProcessEvent( event ); } +extern "C" { +static void gtk_listitem_select_callback( GtkWidget *widget, wxListBox *listbox ) +{ + gtk_listitem_select_cb( widget, listbox, TRUE ); +} +} + +extern "C" { +static void gtk_listitem_deselect_callback( GtkWidget *widget, wxListBox *listbox ) +{ + gtk_listitem_select_cb( widget, listbox, FALSE ); +} +} + //----------------------------------------------------------------------------- // wxListBox //----------------------------------------------------------------------------- +extern "C" { static gint gtk_listbox_realized_callback( GtkWidget *m_widget, wxListBox *win ) { @@ -432,6 +447,7 @@ gtk_listbox_realized_callback( GtkWidget *m_widget, wxListBox *win ) return false; } +} //----------------------------------------------------------------------------- // wxListBox diff --git a/src/gtk/mdi.cpp b/src/gtk/mdi.cpp index 36b2f789f0..ddd65e82be 100644 --- a/src/gtk/mdi.cpp +++ b/src/gtk/mdi.cpp @@ -52,6 +52,7 @@ extern wxList wxPendingDelete; // "switch_page" //----------------------------------------------------------------------------- +extern "C" { static void gtk_mdi_page_change_callback( GtkNotebook *WXUNUSED(widget), GtkNotebookPage *page, @@ -104,6 +105,7 @@ gtk_mdi_page_change_callback( GtkNotebook *WXUNUSED(widget), event2.SetEventObject( child); child->GetEventHandler()->ProcessEvent( event2 ); } +} //----------------------------------------------------------------------------- // wxMDIParentFrame @@ -435,6 +437,7 @@ void wxMDIChildFrame::SetTitle( const wxString &title ) // "size_allocate" //----------------------------------------------------------------------------- +extern "C" { static void gtk_page_size_callback( GtkWidget *WXUNUSED(widget), GtkAllocation* alloc, wxWindow *win ) { if (g_isIdle) wxapp_install_idle_handler(); @@ -450,6 +453,7 @@ static void gtk_page_size_callback( GtkWidget *WXUNUSED(widget), GtkAllocation* win->SetSize( alloc->x, alloc->y, alloc->width, alloc->height ); } +} //----------------------------------------------------------------------------- // InsertChild callback for wxMDIClientWindow diff --git a/src/gtk/menu.cpp b/src/gtk/menu.cpp index 7922dd438b..00919081b2 100644 --- a/src/gtk/menu.cpp +++ b/src/gtk/menu.cpp @@ -96,12 +96,14 @@ struct _GtkPixmapMenuItemClass guint have_pixmap_count; }; - +extern "C" { GtkType gtk_pixmap_menu_item_get_type (void); GtkWidget* gtk_pixmap_menu_item_new (void); void gtk_pixmap_menu_item_set_pixmap (GtkPixmapMenuItem *menu_item, - GtkWidget *pixmap); -#endif // GTK 2.0 + GtkWidget *pixmap); +} + +#endif // !__WXGTK20__ //----------------------------------------------------------------------------- // idle system @@ -149,6 +151,7 @@ static wxString wxReplaceUnderscore( const wxString& title ) // activate message from GTK //----------------------------------------------------------------------------- +extern "C" { static void gtk_menu_open_callback( GtkWidget *widget, wxMenu *menu ) { if (g_isIdle) wxapp_install_idle_handler(); @@ -163,6 +166,7 @@ static void gtk_menu_open_callback( GtkWidget *widget, wxMenu *menu ) wxWindow *win = menu->GetInvokingWindow(); if (win) win->GetEventHandler()->ProcessEvent( event ); } +} //----------------------------------------------------------------------------- // wxMenuBar @@ -581,6 +585,7 @@ void wxMenuBar::SetLabelTop( size_t pos, const wxString& label ) // "activate" //----------------------------------------------------------------------------- +extern "C" { static void gtk_menu_clicked_callback( GtkWidget *widget, wxMenu *menu ) { if (g_isIdle) @@ -651,11 +656,13 @@ static void gtk_menu_clicked_callback( GtkWidget *widget, wxMenu *menu ) menu->SendEvent(id, item->IsCheckable() ? item->IsChecked() : -1); } } +} //----------------------------------------------------------------------------- // "select" //----------------------------------------------------------------------------- +extern "C" { static void gtk_menu_hilight_callback( GtkWidget *widget, wxMenu *menu ) { if (g_isIdle) wxapp_install_idle_handler(); @@ -677,11 +684,13 @@ static void gtk_menu_hilight_callback( GtkWidget *widget, wxMenu *menu ) wxWindow *win = menu->GetInvokingWindow(); if (win) win->GetEventHandler()->ProcessEvent( event ); } +} //----------------------------------------------------------------------------- // "deselect" //----------------------------------------------------------------------------- +extern "C" { static void gtk_menu_nolight_callback( GtkWidget *widget, wxMenu *menu ) { if (g_isIdle) wxapp_install_idle_handler(); @@ -704,6 +713,7 @@ static void gtk_menu_nolight_callback( GtkWidget *widget, wxMenu *menu ) if (win) win->GetEventHandler()->ProcessEvent( event ); } +} //----------------------------------------------------------------------------- // wxMenuItem @@ -1525,7 +1535,7 @@ static void changed_have_pixmap_status (GtkPixmapMenuItem *menu_item); static GtkMenuItemClass *parent_class = NULL; -} +} // extern "C" #define BORDER_SPACING 3 #define PMAP_WIDTH 20 @@ -1556,6 +1566,8 @@ gtk_pixmap_menu_item_get_type (void) return pixmap_menu_item_type; } +extern "C" { + /** * gtk_pixmap_menu_item_new * @@ -1834,5 +1846,7 @@ changed_have_pixmap_status (GtkPixmapMenuItem *menu_item) gtk_widget_queue_resize(GTK_WIDGET(menu_item)); } -#endif +} // extern "C" + +#endif // !__WXGTK20__ diff --git a/src/gtk/minifram.cpp b/src/gtk/minifram.cpp index 738123f286..139f1433c1 100644 --- a/src/gtk/minifram.cpp +++ b/src/gtk/minifram.cpp @@ -69,6 +69,7 @@ static void DrawFrame( GtkWidget *widget, int x, int y, int w, int h ) // "expose_event" of m_mainWidget //----------------------------------------------------------------------------- +extern "C" { static void gtk_window_own_expose_callback( GtkWidget *widget, GdkEventExpose *gdk_event, wxFrame *win ) { if (g_isIdle) wxapp_install_idle_handler(); @@ -109,12 +110,14 @@ static void gtk_window_own_expose_callback( GtkWidget *widget, GdkEventExpose *g dc.DrawText( win->GetTitle(), 6, 3 ); } } +} //----------------------------------------------------------------------------- // "draw" of m_mainWidget //----------------------------------------------------------------------------- #ifndef __WXGTK20__ +extern "C" { static void gtk_window_own_draw_callback( GtkWidget *widget, GdkRectangle *WXUNUSED(rect), wxFrame *win ) { if (g_isIdle) wxapp_install_idle_handler(); @@ -154,12 +157,14 @@ static void gtk_window_own_draw_callback( GtkWidget *widget, GdkRectangle *WXUNU dc.DrawText( win->GetTitle(), 6, 3 ); } } +} #endif //----------------------------------------------------------------------------- // "button_press_event" of m_mainWidget //----------------------------------------------------------------------------- +extern "C" { static gint gtk_window_button_press_callback( GtkWidget *widget, GdkEventButton *gdk_event, wxMiniFrame *win ) { if (g_isIdle) wxapp_install_idle_handler(); @@ -203,11 +208,13 @@ static gint gtk_window_button_press_callback( GtkWidget *widget, GdkEventButton return TRUE; } +} //----------------------------------------------------------------------------- // "button_release_event" of m_mainWidget //----------------------------------------------------------------------------- +extern "C" { static gint gtk_window_button_release_callback( GtkWidget *widget, GdkEventButton *gdk_event, wxMiniFrame *win ) { if (g_isIdle) wxapp_install_idle_handler(); @@ -236,11 +243,13 @@ static gint gtk_window_button_release_callback( GtkWidget *widget, GdkEventButto return TRUE; } +} //----------------------------------------------------------------------------- // "motion_notify_event" of m_mainWidget //----------------------------------------------------------------------------- +extern "C" { static gint gtk_window_motion_notify_callback( GtkWidget *widget, GdkEventMotion *gdk_event, wxMiniFrame *win ) { if (g_isIdle) wxapp_install_idle_handler(); @@ -269,17 +278,20 @@ static gint gtk_window_motion_notify_callback( GtkWidget *widget, GdkEventMotion return TRUE; } +} //----------------------------------------------------------------------------- // "clicked" of X system button //----------------------------------------------------------------------------- +extern "C" { static void gtk_button_clicked_callback( GtkWidget *WXUNUSED(widget), wxMiniFrame *mf ) { if (g_isIdle) wxapp_install_idle_handler(); mf->Close(); } +} //----------------------------------------------------------------------------- // wxMiniFrame diff --git a/src/gtk/notebook.cpp b/src/gtk/notebook.cpp index d58e2fe172..80d7b18caf 100644 --- a/src/gtk/notebook.cpp +++ b/src/gtk/notebook.cpp @@ -90,6 +90,7 @@ WX_DEFINE_LIST(wxGtkNotebookPagesList); // "switch_page" //----------------------------------------------------------------------------- +extern "C" { static void gtk_notebook_page_change_callback(GtkNotebook *WXUNUSED(widget), GtkNotebookPage *WXUNUSED(page), gint page, @@ -132,11 +133,13 @@ static void gtk_notebook_page_change_callback(GtkNotebook *WXUNUSED(widget), notebook->m_inSwitchPage = FALSE; } +} //----------------------------------------------------------------------------- // "size_allocate" //----------------------------------------------------------------------------- +extern "C" { static void gtk_page_size_callback( GtkWidget *WXUNUSED(widget), GtkAllocation* alloc, wxWindow *win ) { if (g_isIdle) @@ -163,11 +166,13 @@ static void gtk_page_size_callback( GtkWidget *WXUNUSED(widget), GtkAllocation* gtk_widget_size_allocate( win->m_wxwindow, alloc ); } } +} //----------------------------------------------------------------------------- // "realize" from m_widget //----------------------------------------------------------------------------- +extern "C" { static gint gtk_notebook_realized_callback( GtkWidget * WXUNUSED(widget), wxWindow *win ) { @@ -180,11 +185,13 @@ gtk_notebook_realized_callback( GtkWidget * WXUNUSED(widget), wxWindow *win ) return FALSE; } +} //----------------------------------------------------------------------------- // "key_press_event" //----------------------------------------------------------------------------- +extern "C" { static gint gtk_notebook_key_press_callback( GtkWidget *widget, GdkEventKey *gdk_event, wxNotebook *notebook ) { if (g_isIdle) @@ -250,6 +257,7 @@ static gint gtk_notebook_key_press_callback( GtkWidget *widget, GdkEventKey *gdk return FALSE; } +} //----------------------------------------------------------------------------- // InsertChild callback for wxNotebook diff --git a/src/gtk/popupwin.cpp b/src/gtk/popupwin.cpp index 9593f43a57..599d775636 100644 --- a/src/gtk/popupwin.cpp +++ b/src/gtk/popupwin.cpp @@ -38,6 +38,7 @@ extern bool g_isIdle; // "button_press" //----------------------------------------------------------------------------- +extern "C" { static gint gtk_popup_button_press (GtkWidget *widget, GdkEvent *gdk_event, wxPopupWindow* win ) { GtkWidget *child = gtk_get_event_widget (gdk_event); @@ -66,11 +67,13 @@ static gint gtk_popup_button_press (GtkWidget *widget, GdkEvent *gdk_event, wxPo return TRUE; } +} //----------------------------------------------------------------------------- // "focus" from m_window //----------------------------------------------------------------------------- +extern "C" { static gint gtk_dialog_focus_callback( GtkWidget *widget, GtkDirectionType WXUNUSED(d), wxWindow *WXUNUSED(win) ) { if (g_isIdle) @@ -80,11 +83,13 @@ static gint gtk_dialog_focus_callback( GtkWidget *widget, GtkDirectionType WXUNU gtk_signal_emit_stop_by_name( GTK_OBJECT(widget), "focus" ); return TRUE; } +} //----------------------------------------------------------------------------- // "delete_event" //----------------------------------------------------------------------------- +extern "C" { bool gtk_dialog_delete_callback( GtkWidget *WXUNUSED(widget), GdkEvent *WXUNUSED(event), wxPopupWindow *win ) { if (g_isIdle) @@ -95,11 +100,13 @@ bool gtk_dialog_delete_callback( GtkWidget *WXUNUSED(widget), GdkEvent *WXUNUSED return TRUE; } +} //----------------------------------------------------------------------------- // "size_allocate" //----------------------------------------------------------------------------- +extern "C" { static void gtk_dialog_size_callback( GtkWidget *WXUNUSED(widget), GtkAllocation* alloc, wxPopupWindow *win ) { if (g_isIdle) @@ -114,6 +121,7 @@ static void gtk_dialog_size_callback( GtkWidget *WXUNUSED(widget), GtkAllocation win->GtkUpdateSize(); } } +} //----------------------------------------------------------------------------- // "realize" from m_widget @@ -122,6 +130,7 @@ static void gtk_dialog_size_callback( GtkWidget *WXUNUSED(widget), GtkAllocation /* we cannot MWM hints and icons before the widget has been realized, so we do this directly after realization */ +extern "C" { static gint gtk_dialog_realized_callback( GtkWidget * WXUNUSED(widget), wxPopupWindow *win ) { @@ -140,6 +149,7 @@ gtk_dialog_realized_callback( GtkWidget * WXUNUSED(widget), wxPopupWindow *win ) return FALSE; } +} //----------------------------------------------------------------------------- // InsertChild for wxPopupWindow diff --git a/src/gtk/radiobox.cpp b/src/gtk/radiobox.cpp index 016283c37f..d10997621e 100644 --- a/src/gtk/radiobox.cpp +++ b/src/gtk/radiobox.cpp @@ -45,6 +45,7 @@ extern wxWindowGTK *g_delayedFocus; // "clicked" //----------------------------------------------------------------------------- +extern "C" { static void gtk_radiobutton_clicked_callback( GtkToggleButton *button, wxRadioBox *rb ) { if (g_isIdle) wxapp_install_idle_handler(); @@ -60,11 +61,13 @@ static void gtk_radiobutton_clicked_callback( GtkToggleButton *button, wxRadioBo event.SetEventObject( rb ); rb->GetEventHandler()->ProcessEvent(event); } +} //----------------------------------------------------------------------------- // "key_press_event" //----------------------------------------------------------------------------- +extern "C" { static gint gtk_radiobox_keypress_callback( GtkWidget *widget, GdkEventKey *gdk_event, wxRadioBox *rb ) { if (g_isIdle) @@ -111,7 +114,9 @@ static gint gtk_radiobox_keypress_callback( GtkWidget *widget, GdkEventKey *gdk_ return TRUE; } +} +extern "C" { static gint gtk_radiobutton_focus_in( GtkWidget *widget, GdkEvent *WXUNUSED(event), wxRadioBox *win ) @@ -135,7 +140,9 @@ static gint gtk_radiobutton_focus_in( GtkWidget *widget, return FALSE; } +} +extern "C" { static gint gtk_radiobutton_focus_out( GtkWidget *widget, GdkEvent *WXUNUSED(event), wxRadioBox *win ) @@ -152,6 +159,7 @@ static gint gtk_radiobutton_focus_out( GtkWidget *widget, return FALSE; } +} //----------------------------------------------------------------------------- // wxRadioBox diff --git a/src/gtk/radiobut.cpp b/src/gtk/radiobut.cpp index df0ad406d2..9900eb7c89 100644 --- a/src/gtk/radiobut.cpp +++ b/src/gtk/radiobut.cpp @@ -40,6 +40,7 @@ extern wxWindowGTK *g_delayedFocus; // "clicked" //----------------------------------------------------------------------------- +extern "C" { static void gtk_radiobutton_clicked_callback( GtkToggleButton *button, wxRadioButton *rb ) { @@ -58,6 +59,7 @@ void gtk_radiobutton_clicked_callback( GtkToggleButton *button, wxRadioButton *r event.SetEventObject( rb ); rb->GetEventHandler()->ProcessEvent( event ); } +} //----------------------------------------------------------------------------- // wxRadioButton diff --git a/src/gtk/scrolbar.cpp b/src/gtk/scrolbar.cpp index d9846c1067..7c8b236b7f 100644 --- a/src/gtk/scrolbar.cpp +++ b/src/gtk/scrolbar.cpp @@ -46,6 +46,7 @@ static const float sensitivity = 0.02; // FIXME: is GtkScrollType really passed to us as 2nd argument? +extern "C" { static void gtk_scrollbar_callback( GtkAdjustment *adjust, SCROLLBAR_CBACK_ARG wxScrollBar *win ) @@ -86,10 +87,12 @@ static void gtk_scrollbar_callback( GtkAdjustment *adjust, win->ProcessEvent( cevent ); */ } +} //----------------------------------------------------------------------------- // "button_press_event" from slider //----------------------------------------------------------------------------- +extern "C" { static gint gtk_scrollbar_button_press_callback( GtkRange *widget, GdkEventButton *gdk_event, wxScrollBar *win ) @@ -128,11 +131,13 @@ static gint gtk_scrollbar_button_press_callback( GtkRange *widget, return FALSE; } +} //----------------------------------------------------------------------------- // "button_release_event" from slider //----------------------------------------------------------------------------- +extern "C" { static gint gtk_scrollbar_button_release_callback( GtkRange *WXUNUSED(widget), GdkEventButton *WXUNUSED(gdk_event), @@ -159,6 +164,7 @@ gtk_scrollbar_button_release_callback( GtkRange *WXUNUSED(widget), return FALSE; } +} //----------------------------------------------------------------------------- // wxScrollBar diff --git a/src/gtk/scrolwin.cpp b/src/gtk/scrolwin.cpp index 5a31109d61..79cfe5d3a3 100644 --- a/src/gtk/scrolwin.cpp +++ b/src/gtk/scrolwin.cpp @@ -72,6 +72,7 @@ extern bool g_isIdle; // "value_changed" from m_vAdjust //----------------------------------------------------------------------------- +extern "C" { static void gtk_scrolled_window_vscroll_callback( GtkAdjustment *adjust, SCROLLBAR_CBACK_ARG wxScrolledWindow *win ) @@ -86,11 +87,13 @@ static void gtk_scrolled_window_vscroll_callback( GtkAdjustment *adjust, win->GtkVScroll( adjust->value, GET_SCROLL_TYPE(GTK_SCROLLED_WINDOW(win->m_widget)->vscrollbar) ); } +} //----------------------------------------------------------------------------- // "value_changed" from m_hAdjust //----------------------------------------------------------------------------- +extern "C" { static void gtk_scrolled_window_hscroll_callback( GtkAdjustment *adjust, SCROLLBAR_CBACK_ARG wxScrolledWindow *win ) @@ -104,11 +107,13 @@ static void gtk_scrolled_window_hscroll_callback( GtkAdjustment *adjust, win->GtkHScroll( adjust->value, GET_SCROLL_TYPE(GTK_SCROLLED_WINDOW(win->m_widget)->hscrollbar) ); } +} //----------------------------------------------------------------------------- // "button_press_event" from scrollbar //----------------------------------------------------------------------------- +extern "C" { static gint gtk_scrollbar_button_press_callback( GtkRange *widget, GdkEventButton *gdk_event, wxWindowGTK *win) @@ -125,11 +130,13 @@ static gint gtk_scrollbar_button_press_callback( GtkRange *widget, return FALSE; } +} //----------------------------------------------------------------------------- // "button_release_event" from scrollbar //----------------------------------------------------------------------------- +extern "C" { static gint gtk_scrollbar_button_release_callback( GtkRange *widget, GdkEventButton *WXUNUSED(gdk_event), wxWindowGTK *win) @@ -168,6 +175,7 @@ static gint gtk_scrollbar_button_release_callback( GtkRange *widget, return FALSE; } +} //----------------------------------------------------------------------------- // InsertChild for wxScrolledWindow diff --git a/src/gtk/slider.cpp b/src/gtk/slider.cpp index 93ec5c8fff..c5d5be31fe 100644 --- a/src/gtk/slider.cpp +++ b/src/gtk/slider.cpp @@ -41,6 +41,7 @@ static const float sensitivity = 0.02; // "value_changed" //----------------------------------------------------------------------------- +extern "C" { static void gtk_slider_callback( GtkAdjustment *adjust, SCROLLBAR_CBACK_ARG wxSlider *win ) @@ -72,6 +73,7 @@ static void gtk_slider_callback( GtkAdjustment *adjust, cevent.SetInt( value ); win->GetEventHandler()->ProcessEvent( cevent ); } +} //----------------------------------------------------------------------------- // wxSlider diff --git a/src/gtk/spinbutt.cpp b/src/gtk/spinbutt.cpp index c11142163f..77416c0a63 100644 --- a/src/gtk/spinbutt.cpp +++ b/src/gtk/spinbutt.cpp @@ -43,6 +43,7 @@ static const float sensitivity = 0.02; // "value_changed" //----------------------------------------------------------------------------- +extern "C" { static void gtk_spinbutt_callback( GtkWidget *WXUNUSED(widget), wxSpinButton *win ) { if (g_isIdle) wxapp_install_idle_handler(); @@ -98,6 +99,7 @@ static void gtk_spinbutt_callback( GtkWidget *WXUNUSED(widget), wxSpinButton *wi win->GetEventHandler()->ProcessEvent( event2 ); } } +} //----------------------------------------------------------------------------- // wxSpinButton diff --git a/src/gtk/spinctrl.cpp b/src/gtk/spinctrl.cpp index 10aa930138..f4c9e8d27c 100644 --- a/src/gtk/spinctrl.cpp +++ b/src/gtk/spinctrl.cpp @@ -44,6 +44,7 @@ extern bool g_blockEventsOnDrag; // "value_changed" //----------------------------------------------------------------------------- +extern "C" { static void gtk_spinctrl_callback( GtkWidget *WXUNUSED(widget), wxSpinCtrl *win ) { if (g_isIdle) wxapp_install_idle_handler(); @@ -63,11 +64,13 @@ static void gtk_spinctrl_callback( GtkWidget *WXUNUSED(widget), wxSpinCtrl *win event.SetInt( (int)ceil(win->m_adjust->value) ); win->GetEventHandler()->ProcessEvent( event ); } +} //----------------------------------------------------------------------------- // "changed" //----------------------------------------------------------------------------- +extern "C" { static void gtk_spinctrl_text_changed_callback( GtkWidget *WXUNUSED(widget), wxSpinCtrl *win ) { @@ -83,6 +86,7 @@ gtk_spinctrl_text_changed_callback( GtkWidget *WXUNUSED(widget), wxSpinCtrl *win event.SetInt( (int)ceil(win->m_adjust->value) ); win->GetEventHandler()->ProcessEvent( event ); } +} //----------------------------------------------------------------------------- // wxSpinCtrl diff --git a/src/gtk/tbargtk.cpp b/src/gtk/tbargtk.cpp index f7f791c65e..5d5dd740c6 100644 --- a/src/gtk/tbargtk.cpp +++ b/src/gtk/tbargtk.cpp @@ -164,6 +164,7 @@ IMPLEMENT_DYNAMIC_CLASS(wxToolBar, wxControl) // "clicked" (internal from gtk_toolbar) //----------------------------------------------------------------------------- +extern "C" { static void gtk_toolbar_callback( GtkWidget *WXUNUSED(widget), wxToolBarTool *tool ) { @@ -198,11 +199,13 @@ static void gtk_toolbar_callback( GtkWidget *WXUNUSED(widget), tool->SetPixmap(tool->GetBitmap()); } } +} //----------------------------------------------------------------------------- // "enter_notify_event" / "leave_notify_event" //----------------------------------------------------------------------------- +extern "C" { static gint gtk_toolbar_tool_callback( GtkWidget *WXUNUSED(widget), GdkEventCrossing *gdk_event, wxToolBarTool *tool ) @@ -221,6 +224,7 @@ static gint gtk_toolbar_tool_callback( GtkWidget *WXUNUSED(widget), return FALSE; } +} //----------------------------------------------------------------------------- // InsertChild callback for wxToolBar diff --git a/src/gtk/textctrl.cpp b/src/gtk/textctrl.cpp index f0dad16cff..d896b04035 100644 --- a/src/gtk/textctrl.cpp +++ b/src/gtk/textctrl.cpp @@ -144,6 +144,7 @@ static void wxGtkTextInsert(GtkWidget *text, // "insert_text" for GtkEntry // ---------------------------------------------------------------------------- +extern "C" { static void gtk_insert_text_callback(GtkEditable *editable, const gchar *new_text, @@ -179,10 +180,12 @@ gtk_insert_text_callback(GtkEditable *editable, win->GetEventHandler()->ProcessEvent( event ); } } +} #ifdef __WXGTK20__ // Implementation of wxTE_AUTO_URL for wxGTK2 by Mart Raudsepp, +extern "C" { static void au_apply_tag_callback(GtkTextBuffer *buffer, GtkTextTag *tag, @@ -193,34 +196,43 @@ au_apply_tag_callback(GtkTextBuffer *buffer, if(tag == gtk_text_tag_table_lookup(gtk_text_buffer_get_tag_table(buffer), "wxUrl")) g_signal_stop_emission_by_name(buffer, "apply_tag"); } +} //----------------------------------------------------------------------------- // GtkTextCharPredicates for gtk_text_iter_*_find_char //----------------------------------------------------------------------------- +extern "C" { static gboolean pred_whitespace (gunichar ch, gpointer user_data) { return g_unichar_isspace(ch); } +} +extern "C" { static gboolean pred_non_whitespace (gunichar ch, gpointer user_data) { return !g_unichar_isspace(ch); } +} +extern "C" { static gboolean pred_nonpunct (gunichar ch, gpointer user_data) { return !g_unichar_ispunct(ch); } +} +extern "C" { static gboolean pred_nonpunct_or_slash (gunichar ch, gpointer user_data) { return !g_unichar_ispunct(ch) || ch == '/'; } +} //----------------------------------------------------------------------------- // Check for links between s and e and correct tags as necessary @@ -228,6 +240,7 @@ pred_nonpunct_or_slash (gunichar ch, gpointer user_data) // This function should be made match better while being efficient at one point. // Most probably with a row of regular expressions. +extern "C" { static void au_check_word( GtkTextIter *s, GtkTextIter *e ) { @@ -287,7 +300,9 @@ au_check_word( GtkTextIter *s, GtkTextIter *e ) g_signal_handler_unblock(buffer, signal_id); } } +} +extern "C" { static void au_check_range(GtkTextIter *s, GtkTextIter *range_end) @@ -314,11 +329,13 @@ au_check_range(GtkTextIter *s, gtk_text_iter_forward_find_char(&range_start, pred_non_whitespace, NULL, range_end); } } +} //----------------------------------------------------------------------------- // "insert-text" for GtkTextBuffer //----------------------------------------------------------------------------- +extern "C" { static void au_insert_text_callback(GtkTextBuffer *buffer, GtkTextIter *end, @@ -344,11 +361,13 @@ au_insert_text_callback(GtkTextBuffer *buffer, au_check_range(&words_start, &words_end); } +} //----------------------------------------------------------------------------- // "delete-range" for GtkTextBuffer //----------------------------------------------------------------------------- +extern "C" { static void au_delete_range_callback(GtkTextBuffer *buffer, GtkTextIter *start, @@ -367,6 +386,7 @@ au_delete_range_callback(GtkTextBuffer *buffer, au_check_range(start, end); } +} #endif @@ -375,6 +395,7 @@ au_delete_range_callback(GtkTextBuffer *buffer, // "changed" //----------------------------------------------------------------------------- +extern "C" { static void gtk_text_changed_callback( GtkWidget *widget, wxTextCtrl *win ) { @@ -395,17 +416,20 @@ gtk_text_changed_callback( GtkWidget *widget, wxTextCtrl *win ) event.SetEventObject( win ); win->GetEventHandler()->ProcessEvent( event ); } +} //----------------------------------------------------------------------------- // "expose_event" from scrolled window and textview //----------------------------------------------------------------------------- #ifdef __WXGTK20__ +extern "C" { static gboolean gtk_text_exposed_callback( GtkWidget *widget, GdkEventExpose *event, wxTextCtrl *win ) { return TRUE; } +} #endif //----------------------------------------------------------------------------- @@ -413,6 +437,7 @@ gtk_text_exposed_callback( GtkWidget *widget, GdkEventExpose *event, wxTextCtrl //----------------------------------------------------------------------------- #ifndef __WXGTK20__ +extern "C" { static void gtk_scrollbar_changed_callback( GtkWidget *WXUNUSED(widget), wxTextCtrl *win ) { @@ -423,6 +448,7 @@ gtk_scrollbar_changed_callback( GtkWidget *WXUNUSED(widget), wxTextCtrl *win ) win->CalculateScrollbar(); } +} #endif // ---------------------------------------------------------------------------- @@ -444,8 +470,8 @@ extern "C" { static GtkDrawCallback gs_gtk_text_draw = NULL; -extern "C" -void wxgtk_text_draw( GtkWidget *widget, GdkRectangle *rect) +extern "C" { +static void wxgtk_text_draw( GtkWidget *widget, GdkRectangle *rect) { if ( !wxIsInsideYield ) { @@ -455,6 +481,7 @@ void wxgtk_text_draw( GtkWidget *widget, GdkRectangle *rect) gs_gtk_text_draw(widget, rect); } } +} #endif // __WXGTK20__ diff --git a/src/gtk/tglbtn.cpp b/src/gtk/tglbtn.cpp index 973299339a..1bf01efef7 100644 --- a/src/gtk/tglbtn.cpp +++ b/src/gtk/tglbtn.cpp @@ -26,6 +26,7 @@ extern bool g_blockEventsOnDrag; extern wxCursor g_globalCursor; extern wxWindowGTK *g_delayedFocus; +extern "C" { static void gtk_togglebutton_clicked_callback(GtkWidget *WXUNUSED(widget), wxToggleButton *cb) { if (g_isIdle) @@ -42,6 +43,7 @@ static void gtk_togglebutton_clicked_callback(GtkWidget *WXUNUSED(widget), wxTog event.SetEventObject(cb); cb->GetEventHandler()->ProcessEvent(event); } +} DEFINE_EVENT_TYPE(wxEVT_COMMAND_TOGGLEBUTTON_CLICKED) diff --git a/src/gtk/timer.cpp b/src/gtk/timer.cpp index 3b28f1d1c2..e004d2d4be 100644 --- a/src/gtk/timer.cpp +++ b/src/gtk/timer.cpp @@ -27,7 +27,8 @@ IMPLEMENT_ABSTRACT_CLASS(wxTimer, wxEvtHandler) -extern "C" gint timeout_callback( gpointer data ) +extern "C" { +static gint timeout_callback( gpointer data ) { wxTimer *timer = (wxTimer*)data; @@ -54,6 +55,7 @@ extern "C" gint timeout_callback( gpointer data ) return TRUE; } +} void wxTimer::Init() { diff --git a/src/gtk/toplevel.cpp b/src/gtk/toplevel.cpp index fb7300af9d..63395a5370 100644 --- a/src/gtk/toplevel.cpp +++ b/src/gtk/toplevel.cpp @@ -82,6 +82,7 @@ static int g_sendActivateEvent = -1; // "focus_in_event" //----------------------------------------------------------------------------- +extern "C" { static gint gtk_frame_focus_in_callback( GtkWidget *widget, GdkEvent *WXUNUSED(event), wxTopLevelWindowGTK *win ) @@ -115,11 +116,13 @@ static gint gtk_frame_focus_in_callback( GtkWidget *widget, return FALSE; } +} //----------------------------------------------------------------------------- // "focus_out_event" //----------------------------------------------------------------------------- +extern "C" { static gint gtk_frame_focus_out_callback( GtkWidget *widget, GdkEventFocus *WXUNUSED(gdk_event), wxTopLevelWindowGTK *win ) @@ -148,11 +151,13 @@ static gint gtk_frame_focus_out_callback( GtkWidget *widget, return FALSE; } +} //----------------------------------------------------------------------------- // "focus" from m_window //----------------------------------------------------------------------------- +extern "C" { static gint gtk_frame_focus_callback( GtkWidget *widget, GtkDirectionType WXUNUSED(d), wxWindow *WXUNUSED(win) ) { if (g_isIdle) @@ -162,11 +167,13 @@ static gint gtk_frame_focus_callback( GtkWidget *widget, GtkDirectionType WXUNUS gtk_signal_emit_stop_by_name( GTK_OBJECT(widget), "focus" ); return TRUE; } +} //----------------------------------------------------------------------------- // "size_allocate" //----------------------------------------------------------------------------- +extern "C" { static void gtk_frame_size_callback( GtkWidget *WXUNUSED(widget), GtkAllocation* alloc, wxTopLevelWindowGTK *win ) { if (g_isIdle) @@ -192,11 +199,13 @@ static void gtk_frame_size_callback( GtkWidget *WXUNUSED(widget), GtkAllocation* win->GtkUpdateSize(); } } +} //----------------------------------------------------------------------------- // "delete_event" //----------------------------------------------------------------------------- +extern "C" { static gint gtk_frame_delete_callback( GtkWidget *WXUNUSED(widget), GdkEvent *WXUNUSED(event), wxTopLevelWindowGTK *win ) { if (g_isIdle) @@ -209,12 +218,14 @@ static gint gtk_frame_delete_callback( GtkWidget *WXUNUSED(widget), GdkEvent *WX return TRUE; } +} //----------------------------------------------------------------------------- // "configure_event" //----------------------------------------------------------------------------- +extern "C" { static gint gtk_frame_configure_callback( GtkWidget *WXUNUSED(widget), GdkEventConfigure *WXUNUSED(event), wxTopLevelWindowGTK *win ) { @@ -237,6 +248,7 @@ gtk_frame_configure_callback( GtkWidget *WXUNUSED(widget), GdkEventConfigure *WX return FALSE; } +} //----------------------------------------------------------------------------- // "realize" from m_widget @@ -245,6 +257,7 @@ gtk_frame_configure_callback( GtkWidget *WXUNUSED(widget), GdkEventConfigure *WX // we cannot MWM hints and icons before the widget has been realized, // so we do this directly after realization +extern "C" { static void gtk_frame_realized_callback( GtkWidget * WXUNUSED(widget), wxTopLevelWindowGTK *win ) @@ -273,11 +286,13 @@ gtk_frame_realized_callback( GtkWidget * WXUNUSED(widget), win->SetIcons( iconsOld ); } } +} //----------------------------------------------------------------------------- // "map_event" from m_widget //----------------------------------------------------------------------------- +extern "C" { static void gtk_frame_map_callback( GtkWidget * WXUNUSED(widget), GdkEvent * WXUNUSED(event), @@ -285,11 +300,13 @@ gtk_frame_map_callback( GtkWidget * WXUNUSED(widget), { win->SetIconizeState(FALSE); } +} //----------------------------------------------------------------------------- // "unmap_event" from m_widget //----------------------------------------------------------------------------- +extern "C" { static void gtk_frame_unmap_callback( GtkWidget * WXUNUSED(widget), GdkEvent * WXUNUSED(event), @@ -297,11 +314,13 @@ gtk_frame_unmap_callback( GtkWidget * WXUNUSED(widget), { win->SetIconizeState(TRUE); } +} //----------------------------------------------------------------------------- // "expose_event" of m_client //----------------------------------------------------------------------------- +extern "C" { static int gtk_window_expose_callback( GtkWidget *widget, GdkEventExpose *gdk_event, wxWindow *win ) { GtkPizza *pizza = GTK_PIZZA(widget); @@ -316,6 +335,7 @@ static int gtk_window_expose_callback( GtkWidget *widget, GdkEventExpose *gdk_ev return FALSE; } +} //----------------------------------------------------------------------------- // "draw" of m_client @@ -323,6 +343,7 @@ static int gtk_window_expose_callback( GtkWidget *widget, GdkEventExpose *gdk_ev #ifndef __WXGTK20__ +extern "C" { static void gtk_window_draw_callback( GtkWidget *widget, GdkRectangle *rect, wxWindow *win ) { GtkPizza *pizza = GTK_PIZZA(widget); @@ -335,6 +356,7 @@ static void gtk_window_draw_callback( GtkWidget *widget, GdkRectangle *rect, wxW (char *)"base", 0, 0, -1, -1); } +} #endif // GTK+ 1.x diff --git a/src/gtk/utilsgtk.cpp b/src/gtk/utilsgtk.cpp index e76e3187f3..4d780162b6 100644 --- a/src/gtk/utilsgtk.cpp +++ b/src/gtk/utilsgtk.cpp @@ -194,7 +194,8 @@ wxWindow* wxFindWindowAtPoint(const wxPoint& pt) // subprocess routines // ---------------------------------------------------------------------------- -extern "C" +extern "C" { +static void GTK_EndProcessDetector(gpointer data, gint source, GdkInputCondition WXUNUSED(condition) ) { @@ -225,6 +226,7 @@ void GTK_EndProcessDetector(gpointer data, gint source, wxHandleProcessTermination(proc_data); } +} int wxAddProcessCallback(wxEndProcessData *proc_data, int fd) { diff --git a/src/gtk/window.cpp b/src/gtk/window.cpp index b4f55985b8..8ebb7b5e4b 100644 --- a/src/gtk/window.cpp +++ b/src/gtk/window.cpp @@ -379,7 +379,7 @@ static void draw_frame( GtkWidget *widget, wxWindowGTK *win ) dh += hscroll_req.height; dh += scroll_class->scrollbar_spacing; } -} + } int dx = 0; int dy = 0; @@ -429,7 +429,8 @@ static void draw_frame( GtkWidget *widget, wxWindowGTK *win ) // "expose_event" of m_widget //----------------------------------------------------------------------------- -gint gtk_window_own_expose_callback( GtkWidget *widget, GdkEventExpose *gdk_event, wxWindowGTK *win ) +extern "C" { +static gint gtk_window_own_expose_callback( GtkWidget *widget, GdkEventExpose *gdk_event, wxWindowGTK *win ) { if (gdk_event->count > 0) return FALSE; @@ -442,6 +443,7 @@ gint gtk_window_own_expose_callback( GtkWidget *widget, GdkEventExpose *gdk_even #endif return TRUE; } +} //----------------------------------------------------------------------------- // "draw" of m_widget @@ -449,10 +451,12 @@ gint gtk_window_own_expose_callback( GtkWidget *widget, GdkEventExpose *gdk_even #ifndef __WXGTK20__ +extern "C" { static void gtk_window_own_draw_callback( GtkWidget *widget, GdkRectangle *WXUNUSED(rect), wxWindowGTK *win ) { draw_frame( widget, win ); } +} #endif // GTK+ < 2.0 @@ -460,8 +464,8 @@ static void gtk_window_own_draw_callback( GtkWidget *widget, GdkRectangle *WXUNU // "size_request" of m_widget //----------------------------------------------------------------------------- -// make it extern because wxStatitText needs to disconnect this one -extern "C" +// make it extern because wxStaticText needs to disconnect this one +extern "C" { void wxgtk_window_size_request_callback(GtkWidget *widget, GtkRequisition *requisition, wxWindow *win) @@ -476,9 +480,10 @@ void wxgtk_window_size_request_callback(GtkWidget *widget, requisition->height = h; requisition->width = w; } +} - -extern "C" +extern "C" { +static void wxgtk_combo_size_request_callback(GtkWidget *widget, GtkRequisition *requisition, wxComboBox *win) @@ -504,11 +509,13 @@ void wxgtk_combo_size_request_callback(GtkWidget *widget, requisition->width = w - entry_req.width; requisition->height = entry_req.height+4; // TODO: why +4? } +} //----------------------------------------------------------------------------- // "expose_event" of m_wxwindow //----------------------------------------------------------------------------- +extern "C" { static int gtk_window_expose_callback( GtkWidget *widget, GdkEventExpose *gdk_event, wxWindow *win ) @@ -578,6 +585,7 @@ static int gtk_window_expose_callback( GtkWidget *widget, return FALSE; } +} //----------------------------------------------------------------------------- // "event" of m_wxwindow @@ -589,6 +597,8 @@ static int gtk_window_expose_callback( GtkWidget *widget, // There, we look for expose events ourselves whereas all other events are // handled normally. +extern "C" { +static gint gtk_window_event_event_callback( GtkWidget *widget, GdkEventExpose *event, wxWindow *win ) @@ -601,6 +611,7 @@ gint gtk_window_event_event_callback( GtkWidget *widget, return FALSE; } +} //----------------------------------------------------------------------------- // "draw" of m_wxwindow @@ -611,6 +622,7 @@ gint gtk_window_event_event_callback( GtkWidget *widget, // This callback is a complete replacement of the gtk_pizza_draw() function, // which is disabled. +extern "C" { static void gtk_window_draw_callback( GtkWidget *widget, GdkRectangle *rect, wxWindow *win ) @@ -686,6 +698,7 @@ static void gtk_window_draw_callback( GtkWidget *widget, } #endif } +} #endif @@ -1129,6 +1142,7 @@ struct wxGtkIMData }; #endif +extern "C" { static gint gtk_window_key_press_callback( GtkWidget *widget, GdkEventKey *gdk_event, wxWindow *win ) @@ -1389,8 +1403,10 @@ static gint gtk_window_key_press_callback( GtkWidget *widget, return FALSE; } +} #ifdef __WXGTK20__ +extern "C" { static void gtk_wxwindow_commit_cb (GtkIMContext *context, const gchar *str, wxWindow *window) @@ -1444,6 +1460,7 @@ static void gtk_wxwindow_commit_cb (GtkIMContext *context, } } } +} #endif @@ -1451,6 +1468,7 @@ static void gtk_wxwindow_commit_cb (GtkIMContext *context, // "key_release_event" from any window //----------------------------------------------------------------------------- +extern "C" { static gint gtk_window_key_release_callback( GtkWidget *widget, GdkEventKey *gdk_event, wxWindowGTK *win ) @@ -1479,6 +1497,7 @@ static gint gtk_window_key_release_callback( GtkWidget *widget, gtk_signal_emit_stop_by_name( GTK_OBJECT(widget), "key_release_event" ); return TRUE; } +} // ============================================================================ // the mouse events @@ -1622,6 +1641,7 @@ wxWindowGTK *FindWindowForMouseEvent(wxWindowGTK *win, wxCoord& x, wxCoord& y) // "button_press_event" //----------------------------------------------------------------------------- +extern "C" { static gint gtk_window_button_press_callback( GtkWidget *widget, GdkEventButton *gdk_event, wxWindowGTK *win ) @@ -1820,11 +1840,13 @@ static gint gtk_window_button_press_callback( GtkWidget *widget, return FALSE; } +} //----------------------------------------------------------------------------- // "button_release_event" //----------------------------------------------------------------------------- +extern "C" { static gint gtk_window_button_release_callback( GtkWidget *widget, GdkEventButton *gdk_event, wxWindowGTK *win ) @@ -1880,11 +1902,13 @@ static gint gtk_window_button_release_callback( GtkWidget *widget, return FALSE; } +} //----------------------------------------------------------------------------- // "motion_notify_event" //----------------------------------------------------------------------------- +extern "C" { static gint gtk_window_motion_notify_callback( GtkWidget *widget, GdkEventMotion *gdk_event, wxWindowGTK *win ) @@ -1954,15 +1978,17 @@ static gint gtk_window_motion_notify_callback( GtkWidget *widget, return FALSE; } +} #ifdef __WXGTK20__ //----------------------------------------------------------------------------- // "mouse_wheel_event" //----------------------------------------------------------------------------- +extern "C" { static gint gtk_window_wheel_callback (GtkWidget * widget, - GdkEventScroll * gdk_event, - wxWindowGTK * win) + GdkEventScroll * gdk_event, + wxWindowGTK * win) { DEBUG_MAIN_THREAD @@ -2010,10 +2036,12 @@ static gint gtk_window_wheel_callback (GtkWidget * widget, return FALSE; } +} //----------------------------------------------------------------------------- // "popup-menu" //----------------------------------------------------------------------------- +extern "C" { static gboolean wxgtk_window_popup_menu_callback(GtkWidget*, wxWindowGTK* win) { wxContextMenuEvent event( @@ -2023,6 +2051,7 @@ static gboolean wxgtk_window_popup_menu_callback(GtkWidget*, wxWindowGTK* win) event.SetEventObject(win); return win->GetEventHandler()->ProcessEvent(event); } +} #endif // __WXGTK20__ //----------------------------------------------------------------------------- @@ -2044,6 +2073,7 @@ static bool DoSendFocusEvents(wxWindow *win) return win->GetEventHandler()->ProcessEvent(eventFocus); } +extern "C" { static gint gtk_window_focus_in_callback( GtkWidget *widget, GdkEvent *WXUNUSED(event), wxWindow *win ) @@ -2093,11 +2123,13 @@ static gint gtk_window_focus_in_callback( GtkWidget *widget, return FALSE; } +} //----------------------------------------------------------------------------- // "focus_out_event" //----------------------------------------------------------------------------- +extern "C" { static gint gtk_window_focus_out_callback( GtkWidget *widget, GdkEventFocus *gdk_event, wxWindowGTK *win ) { DEBUG_MAIN_THREAD @@ -2152,11 +2184,13 @@ static gint gtk_window_focus_out_callback( GtkWidget *widget, GdkEventFocus *gdk return FALSE; } +} //----------------------------------------------------------------------------- // "enter_notify_event" //----------------------------------------------------------------------------- +extern "C" { static gint gtk_window_enter_callback( GtkWidget *widget, GdkEventCrossing *gdk_event, @@ -2195,11 +2229,13 @@ gint gtk_window_enter_callback( GtkWidget *widget, return FALSE; } +} //----------------------------------------------------------------------------- // "leave_notify_event" //----------------------------------------------------------------------------- +extern "C" { static gint gtk_window_leave_callback( GtkWidget *widget, GdkEventCrossing *gdk_event, wxWindowGTK *win ) { DEBUG_MAIN_THREAD @@ -2245,11 +2281,13 @@ static gint gtk_window_leave_callback( GtkWidget *widget, GdkEventCrossing *gdk_ return FALSE; } +} //----------------------------------------------------------------------------- // "value_changed" from m_vAdjust //----------------------------------------------------------------------------- +extern "C" { static void gtk_window_vscroll_callback( GtkAdjustment *adjust, SCROLLBAR_CBACK_ARG wxWindowGTK *win ) @@ -2279,11 +2317,13 @@ static void gtk_window_vscroll_callback( GtkAdjustment *adjust, event.SetEventObject( win ); win->GetEventHandler()->ProcessEvent( event ); } +} //----------------------------------------------------------------------------- // "value_changed" from m_hAdjust //----------------------------------------------------------------------------- +extern "C" { static void gtk_window_hscroll_callback( GtkAdjustment *adjust, SCROLLBAR_CBACK_ARG wxWindowGTK *win ) @@ -2312,11 +2352,13 @@ static void gtk_window_hscroll_callback( GtkAdjustment *adjust, event.SetEventObject( win ); win->GetEventHandler()->ProcessEvent( event ); } +} //----------------------------------------------------------------------------- // "button_press_event" from scrollbar //----------------------------------------------------------------------------- +extern "C" { static gint gtk_scrollbar_button_press_callback( GtkRange *widget, GdkEventButton *gdk_event, wxWindowGTK *win) @@ -2336,11 +2378,13 @@ static gint gtk_scrollbar_button_press_callback( GtkRange *widget, return FALSE; } +} //----------------------------------------------------------------------------- // "button_release_event" from scrollbar //----------------------------------------------------------------------------- +extern "C" { static gint gtk_scrollbar_button_release_callback( GtkRange *widget, GdkEventButton *WXUNUSED(gdk_event), wxWindowGTK *win) @@ -2381,6 +2425,7 @@ static gint gtk_scrollbar_button_release_callback( GtkRange *widget, return FALSE; } +} // ---------------------------------------------------------------------------- // this wxWindowBase function is implemented here (in platform-specific file) @@ -2393,7 +2438,6 @@ wxWindow *wxWindowBase::DoFindFocus() return (wxWindow *)g_focusWindow; } - //----------------------------------------------------------------------------- // "realize" from m_widget //----------------------------------------------------------------------------- @@ -2401,6 +2445,7 @@ wxWindow *wxWindowBase::DoFindFocus() /* We cannot set colours and fonts before the widget has been realized, so we do this directly after realization. */ +extern "C" { static gint gtk_window_realized_callback( GtkWidget *m_widget, wxWindow *win ) { @@ -2424,11 +2469,13 @@ gtk_window_realized_callback( GtkWidget *m_widget, wxWindow *win ) return FALSE; } +} //----------------------------------------------------------------------------- // "size_allocate" //----------------------------------------------------------------------------- +extern "C" { static void gtk_window_size_callback( GtkWidget *WXUNUSED(widget), GtkAllocation *WXUNUSED(alloc), @@ -2455,6 +2502,7 @@ void gtk_window_size_callback( GtkWidget *WXUNUSED(widget), win->GetEventHandler()->ProcessEvent( event ); } } +} #ifdef HAVE_XIM @@ -2465,6 +2513,7 @@ void gtk_window_size_callback( GtkWidget *WXUNUSED(widget), /* Resize XIM window */ +extern "C" { static void gtk_wxwindow_size_callback( GtkWidget* WXUNUSED_UNLESS_XIM(widget), GtkAllocation* WXUNUSED_UNLESS_XIM(alloc), @@ -2488,6 +2537,7 @@ void gtk_wxwindow_size_callback( GtkWidget* WXUNUSED_UNLESS_XIM(widget), } #endif // HAVE_XIM } +} //----------------------------------------------------------------------------- // "realize" from m_wxwindow @@ -2495,6 +2545,7 @@ void gtk_wxwindow_size_callback( GtkWidget* WXUNUSED_UNLESS_XIM(widget), /* Initialize XIM support */ +extern "C" { static gint gtk_wxwindow_realized_callback( GtkWidget * WXUNUSED_UNLESS_XIM(widget), wxWindowGTK * WXUNUSED_UNLESS_XIM(win) ) @@ -2581,6 +2632,7 @@ gtk_wxwindow_realized_callback( GtkWidget * WXUNUSED_UNLESS_XIM(widget), return FALSE; } +} //----------------------------------------------------------------------------- // InsertChild for wxWindowGTK. diff --git a/src/gtk1/bmpbuttn.cpp b/src/gtk1/bmpbuttn.cpp index ed67afffaf..bbf2044476 100644 --- a/src/gtk1/bmpbuttn.cpp +++ b/src/gtk1/bmpbuttn.cpp @@ -45,6 +45,7 @@ extern bool g_blockEventsOnDrag; // "clicked" //----------------------------------------------------------------------------- +extern "C" { static void gtk_bmpbutton_clicked_callback( GtkWidget *WXUNUSED(widget), wxBitmapButton *button ) { if (g_isIdle) @@ -57,11 +58,13 @@ static void gtk_bmpbutton_clicked_callback( GtkWidget *WXUNUSED(widget), wxBitma event.SetEventObject(button); button->GetEventHandler()->ProcessEvent(event); } +} //----------------------------------------------------------------------------- // "enter" //----------------------------------------------------------------------------- +extern "C" { static void gtk_bmpbutton_enter_callback( GtkWidget *WXUNUSED(widget), wxBitmapButton *button ) { if (!button->m_hasVMT) return; @@ -69,11 +72,13 @@ static void gtk_bmpbutton_enter_callback( GtkWidget *WXUNUSED(widget), wxBitmapB button->HasFocus(); } +} //----------------------------------------------------------------------------- // "leave" //----------------------------------------------------------------------------- +extern "C" { static void gtk_bmpbutton_leave_callback( GtkWidget *WXUNUSED(widget), wxBitmapButton *button ) { if (!button->m_hasVMT) return; @@ -81,11 +86,13 @@ static void gtk_bmpbutton_leave_callback( GtkWidget *WXUNUSED(widget), wxBitmapB button->NotFocus(); } +} //----------------------------------------------------------------------------- // "pressed" //----------------------------------------------------------------------------- +extern "C" { static void gtk_bmpbutton_press_callback( GtkWidget *WXUNUSED(widget), wxBitmapButton *button ) { if (!button->m_hasVMT) return; @@ -93,11 +100,13 @@ static void gtk_bmpbutton_press_callback( GtkWidget *WXUNUSED(widget), wxBitmapB button->StartSelect(); } +} //----------------------------------------------------------------------------- // "released" //----------------------------------------------------------------------------- +extern "C" { static void gtk_bmpbutton_release_callback( GtkWidget *WXUNUSED(widget), wxBitmapButton *button ) { if (!button->m_hasVMT) return; @@ -105,6 +114,7 @@ static void gtk_bmpbutton_release_callback( GtkWidget *WXUNUSED(widget), wxBitma button->EndSelect(); } +} //----------------------------------------------------------------------------- // wxBitmapButton diff --git a/src/gtk1/button.cpp b/src/gtk1/button.cpp index aec633f450..acaf646e22 100644 --- a/src/gtk1/button.cpp +++ b/src/gtk1/button.cpp @@ -47,6 +47,7 @@ extern bool g_blockEventsOnDrag; // "clicked" //----------------------------------------------------------------------------- +extern "C" { static void gtk_button_clicked_callback( GtkWidget *WXUNUSED(widget), wxButton *button ) { if (g_isIdle) @@ -59,6 +60,7 @@ static void gtk_button_clicked_callback( GtkWidget *WXUNUSED(widget), wxButton * event.SetEventObject(button); button->GetEventHandler()->ProcessEvent(event); } +} //----------------------------------------------------------------------------- // "style_set" from m_widget diff --git a/src/gtk1/checkbox.cpp b/src/gtk1/checkbox.cpp index 37131bc9b8..a0655d0912 100644 --- a/src/gtk1/checkbox.cpp +++ b/src/gtk1/checkbox.cpp @@ -42,6 +42,7 @@ extern wxWindowGTK *g_delayedFocus; // "clicked" //----------------------------------------------------------------------------- +extern "C" { static void gtk_checkbox_toggled_callback(GtkWidget *widget, wxCheckBox *cb) { if (g_isIdle) wxapp_install_idle_handler(); @@ -109,6 +110,7 @@ static void gtk_checkbox_toggled_callback(GtkWidget *widget, wxCheckBox *cb) event.SetEventObject(cb); cb->GetEventHandler()->ProcessEvent(event); } +} //----------------------------------------------------------------------------- // wxCheckBox diff --git a/src/gtk1/choice.cpp b/src/gtk1/choice.cpp index 59d5402c12..7b8633ef1b 100644 --- a/src/gtk1/choice.cpp +++ b/src/gtk1/choice.cpp @@ -38,6 +38,7 @@ extern bool g_blockEventsOnDrag; // "activate" //----------------------------------------------------------------------------- +extern "C" { static void gtk_choice_clicked_callback( GtkWidget *WXUNUSED(widget), wxChoice *choice ) { if (g_isIdle) @@ -84,6 +85,7 @@ static void gtk_choice_clicked_callback( GtkWidget *WXUNUSED(widget), wxChoice * choice->GetEventHandler()->ProcessEvent(event); } +} //----------------------------------------------------------------------------- // wxChoice diff --git a/src/gtk1/clipbrd.cpp b/src/gtk1/clipbrd.cpp index c5f0f8d6fa..a8fc2c7ee0 100644 --- a/src/gtk1/clipbrd.cpp +++ b/src/gtk1/clipbrd.cpp @@ -78,6 +78,7 @@ struct _GtkSelectionData // "selection_received" for targets //----------------------------------------------------------------------------- +extern "C" { static void targets_selection_received( GtkWidget *WXUNUSED(widget), GtkSelectionData *selection_data, @@ -133,11 +134,13 @@ targets_selection_received( GtkWidget *WXUNUSED(widget), clipboard->m_waiting = FALSE; } +} //----------------------------------------------------------------------------- // "selection_received" for the actual data //----------------------------------------------------------------------------- +extern "C" { static void selection_received( GtkWidget *WXUNUSED(widget), GtkSelectionData *selection_data, @@ -189,11 +192,13 @@ selection_received( GtkWidget *WXUNUSED(widget), wxTheClipboard->m_formatSupported = TRUE; clipboard->m_waiting = FALSE; } +} //----------------------------------------------------------------------------- // "selection_clear" //----------------------------------------------------------------------------- +extern "C" { static gint selection_clear_clip( GtkWidget *WXUNUSED(widget), GdkEventSelection *event ) { @@ -230,11 +235,13 @@ selection_clear_clip( GtkWidget *WXUNUSED(widget), GdkEventSelection *event ) wxTheClipboard->m_waiting = FALSE; return TRUE; } +} //----------------------------------------------------------------------------- // selection handler for supplying data //----------------------------------------------------------------------------- +extern "C" { static void selection_handler( GtkWidget *WXUNUSED(widget), GtkSelectionData *selection_data, @@ -295,6 +302,7 @@ selection_handler( GtkWidget *WXUNUSED(widget), free(d); } +} //----------------------------------------------------------------------------- // wxClipboard diff --git a/src/gtk1/combobox.cpp b/src/gtk1/combobox.cpp index 5ec1549e86..c1e77b07d7 100644 --- a/src/gtk1/combobox.cpp +++ b/src/gtk1/combobox.cpp @@ -44,6 +44,7 @@ static int g_SelectionBeforePopup = -2; // -2 <=> the popup is hidden // if it doesn't match an item then just get a single changed //----------------------------------------------------------------------------- +extern "C" { static void gtk_text_changed_callback( GtkWidget *WXUNUSED(widget), wxComboBox *combo ) { @@ -62,12 +63,16 @@ gtk_text_changed_callback( GtkWidget *WXUNUSED(widget), wxComboBox *combo ) event.SetEventObject( combo ); combo->GetEventHandler()->ProcessEvent( event ); } +} +extern "C" { static void gtk_dummy_callback(GtkEntry *WXUNUSED(entry), GtkCombo *WXUNUSED(combo)) { } +} +extern "C" { static void gtk_popup_hide_callback(GtkCombo *WXUNUSED(gtk_combo), wxComboBox *combo) { @@ -86,7 +91,9 @@ gtk_popup_hide_callback(GtkCombo *WXUNUSED(gtk_combo), wxComboBox *combo) // reset the selection flag to an identifiable value (-2 = hidden) g_SelectionBeforePopup = -2; } +} +extern "C" { static void gtk_popup_show_callback(GtkCombo *WXUNUSED(gtk_combo), wxComboBox *combo) { @@ -94,11 +101,13 @@ gtk_popup_show_callback(GtkCombo *WXUNUSED(gtk_combo), wxComboBox *combo) // if there is no selection, combo->GetSelection() returns -1 g_SelectionBeforePopup = combo->GetSelection(); } +} //----------------------------------------------------------------------------- // "select-child" - click/cursor get select-child, changed, select-child //----------------------------------------------------------------------------- +extern "C" { static void gtk_combo_select_child_callback( GtkList *WXUNUSED(list), GtkWidget *WXUNUSED(widget), wxComboBox *combo ) { @@ -146,6 +155,7 @@ gtk_combo_select_child_callback( GtkList *WXUNUSED(list), GtkWidget *WXUNUSED(wi event2.SetEventObject( combo ); combo->GetEventHandler()->ProcessEvent( event2 ); } +} //----------------------------------------------------------------------------- // wxComboBox diff --git a/src/gtk1/control.cpp b/src/gtk1/control.cpp index 06eaec261b..5f2f191171 100644 --- a/src/gtk1/control.cpp +++ b/src/gtk1/control.cpp @@ -231,7 +231,7 @@ wxControl::GetDefaultAttributesFromGTKWidget(GtkWidget* widget, //static wxVisualAttributes -wxControl::GetDefaultAttributesFromGTKWidget(GtkWidget* (*widget_new)(void), +wxControl::GetDefaultAttributesFromGTKWidget(wxGtkWidgetNew_t widget_new, bool useBase, int state) { @@ -247,7 +247,7 @@ wxControl::GetDefaultAttributesFromGTKWidget(GtkWidget* (*widget_new)(void), //static wxVisualAttributes -wxControl::GetDefaultAttributesFromGTKWidget(GtkWidget* (*widget_new)(const gchar*), +wxControl::GetDefaultAttributesFromGTKWidget(wxGtkWidgetNewFromStr_t widget_new, bool useBase, int state) { @@ -264,7 +264,7 @@ wxControl::GetDefaultAttributesFromGTKWidget(GtkWidget* (*widget_new)(const gcha //static wxVisualAttributes -wxControl::GetDefaultAttributesFromGTKWidget(GtkWidget* (*widget_new)(GtkAdjustment*), +wxControl::GetDefaultAttributesFromGTKWidget(wxGtkWidgetNewFromAdj_t widget_new, bool useBase, int state) { diff --git a/src/gtk1/dnd.cpp b/src/gtk1/dnd.cpp index b8b6ecfb7f..8fdfda9c2a 100644 --- a/src/gtk1/dnd.cpp +++ b/src/gtk1/dnd.cpp @@ -139,6 +139,7 @@ static wxDragResult ConvertFromGTK(long action) // "drag_leave" // ---------------------------------------------------------------------------- +extern "C" { static void target_drag_leave( GtkWidget *WXUNUSED(widget), GdkDragContext *context, guint WXUNUSED(time), @@ -160,11 +161,13 @@ static void target_drag_leave( GtkWidget *WXUNUSED(widget), /* after this, invalidate the drop_target's GdkDragContext */ drop_target->SetDragContext( (GdkDragContext*) NULL ); } +} // ---------------------------------------------------------------------------- // "drag_motion" // ---------------------------------------------------------------------------- +extern "C" { static gboolean target_drag_motion( GtkWidget *WXUNUSED(widget), GdkDragContext *context, gint x, @@ -256,11 +259,13 @@ static gboolean target_drag_motion( GtkWidget *WXUNUSED(widget), return ret; } +} // ---------------------------------------------------------------------------- // "drag_drop" // ---------------------------------------------------------------------------- +extern "C" { static gboolean target_drag_drop( GtkWidget *widget, GdkDragContext *context, gint x, @@ -355,11 +360,13 @@ static gboolean target_drag_drop( GtkWidget *widget, return ret; } +} // ---------------------------------------------------------------------------- // "drag_data_received" // ---------------------------------------------------------------------------- +extern "C" { static void target_drag_data_received( GtkWidget *WXUNUSED(widget), GdkDragContext *context, gint x, @@ -409,6 +416,7 @@ static void target_drag_data_received( GtkWidget *WXUNUSED(widget), /* after this, invalidate the drop_target's drag data */ drop_target->SetDragData( (GtkSelectionData*) NULL ); } +} //---------------------------------------------------------------------------- // wxDropTarget @@ -561,6 +569,7 @@ void wxDropTarget::RegisterWidget( GtkWidget *widget ) // "drag_data_get" //---------------------------------------------------------------------------- +extern "C" { static void source_drag_data_get (GtkWidget *WXUNUSED(widget), GdkDragContext *WXUNUSED(context), @@ -626,11 +635,13 @@ source_drag_data_get (GtkWidget *WXUNUSED(widget), delete[] d; } +} //---------------------------------------------------------------------------- // "drag_data_delete" //---------------------------------------------------------------------------- +extern "C" { static void source_drag_data_delete( GtkWidget *WXUNUSED(widget), GdkDragContext *context, wxDropSource *WXUNUSED(drop_source) ) @@ -640,11 +651,13 @@ static void source_drag_data_delete( GtkWidget *WXUNUSED(widget), // printf( "Drag source: drag_data_delete\n" ); } +} //---------------------------------------------------------------------------- // "drag_begin" //---------------------------------------------------------------------------- +extern "C" { static void source_drag_begin( GtkWidget *WXUNUSED(widget), GdkDragContext *WXUNUSED(context), wxDropSource *WXUNUSED(drop_source) ) @@ -654,11 +667,13 @@ static void source_drag_begin( GtkWidget *WXUNUSED(widget), // printf( "Drag source: drag_begin.\n" ); } +} //---------------------------------------------------------------------------- // "drag_end" //---------------------------------------------------------------------------- +extern "C" { static void source_drag_end( GtkWidget *WXUNUSED(widget), GdkDragContext *WXUNUSED(context), wxDropSource *drop_source ) @@ -669,11 +684,13 @@ static void source_drag_end( GtkWidget *WXUNUSED(widget), drop_source->m_waiting = FALSE; } +} //----------------------------------------------------------------------------- // "configure_event" from m_iconWindow //----------------------------------------------------------------------------- +extern "C" { static gint gtk_dnd_window_configure_callback( GtkWidget *WXUNUSED(widget), GdkEventConfigure *WXUNUSED(event), wxDropSource *source ) { @@ -684,6 +701,7 @@ gtk_dnd_window_configure_callback( GtkWidget *WXUNUSED(widget), GdkEventConfigur return 0; } +} //--------------------------------------------------------------------------- // wxDropSource diff --git a/src/gtk1/filedlg.cpp b/src/gtk1/filedlg.cpp index 78e2ebcadd..e1082ea83e 100644 --- a/src/gtk1/filedlg.cpp +++ b/src/gtk1/filedlg.cpp @@ -38,6 +38,7 @@ extern bool g_isIdle; // "clicked" for OK-button //----------------------------------------------------------------------------- +extern "C" { static void gtk_filedialog_ok_callback(GtkWidget *widget, wxFileDialog *dialog) { int style = dialog->GetStyle(); @@ -91,11 +92,13 @@ static void gtk_filedialog_ok_callback(GtkWidget *widget, wxFileDialog *dialog) event.SetEventObject(dialog); dialog->GetEventHandler()->ProcessEvent(event); } +} //----------------------------------------------------------------------------- // "clicked" for Cancel-button //----------------------------------------------------------------------------- +extern "C" { static void gtk_filedialog_cancel_callback(GtkWidget *WXUNUSED(w), wxFileDialog *dialog) { @@ -103,7 +106,9 @@ static void gtk_filedialog_cancel_callback(GtkWidget *WXUNUSED(w), event.SetEventObject(dialog); dialog->GetEventHandler()->ProcessEvent(event); } +} +extern "C" { static void gtk_filedialog_response_callback(GtkWidget *w, int response, wxFileDialog *dialog) @@ -120,7 +125,9 @@ static void gtk_filedialog_response_callback(GtkWidget *w, dialog->m_destroyed_by_delete = true; } } -#endif +} + +#endif // __WXGTK24__ //----------------------------------------------------------------------------- // wxFileDialog diff --git a/src/gtk1/fontdlg.cpp b/src/gtk1/fontdlg.cpp index 76811ec307..b2c47ed213 100644 --- a/src/gtk1/fontdlg.cpp +++ b/src/gtk1/fontdlg.cpp @@ -40,6 +40,7 @@ extern bool g_isIdle; // "delete_event" //----------------------------------------------------------------------------- +extern "C" { static bool gtk_fontdialog_delete_callback( GtkWidget *WXUNUSED(widget), GdkEvent *WXUNUSED(event), wxDialog *win ) { @@ -57,11 +58,13 @@ bool gtk_fontdialog_delete_callback( GtkWidget *WXUNUSED(widget), GdkEvent *WXUN return TRUE; } +} //----------------------------------------------------------------------------- // "clicked" for OK-button //----------------------------------------------------------------------------- +extern "C" { static void gtk_fontdialog_ok_callback( GtkWidget *WXUNUSED(widget), wxFontDialog *dialog ) { @@ -90,11 +93,13 @@ void gtk_fontdialog_ok_callback( GtkWidget *WXUNUSED(widget), wxFontDialog *dial event.SetEventObject( dialog ); dialog->GetEventHandler()->ProcessEvent( event ); } +} //----------------------------------------------------------------------------- // "clicked" for Cancel-button //----------------------------------------------------------------------------- +extern "C" { static void gtk_fontdialog_cancel_callback( GtkWidget *WXUNUSED(w), wxFontDialog *dialog ) { @@ -105,6 +110,7 @@ void gtk_fontdialog_cancel_callback( GtkWidget *WXUNUSED(w), wxFontDialog *dialo event.SetEventObject( dialog ); dialog->GetEventHandler()->ProcessEvent( event ); } +} //----------------------------------------------------------------------------- // wxFontDialog diff --git a/src/gtk1/frame.cpp b/src/gtk1/frame.cpp index c6043a88c6..1bf86a39a5 100644 --- a/src/gtk1/frame.cpp +++ b/src/gtk1/frame.cpp @@ -80,6 +80,7 @@ IMPLEMENT_DYNAMIC_CLASS(wxFrame, wxTopLevelWindow) // "child_attached" of menu bar //----------------------------------------------------------------------------- +extern "C" { static void gtk_menu_attached_callback( GtkWidget *WXUNUSED(widget), GtkWidget *WXUNUSED(child), wxFrame *win ) { if (!win->m_hasVMT) return; @@ -87,11 +88,13 @@ static void gtk_menu_attached_callback( GtkWidget *WXUNUSED(widget), GtkWidget * win->m_menuBarDetached = FALSE; win->GtkUpdateSize(); } +} //----------------------------------------------------------------------------- // "child_detached" of menu bar //----------------------------------------------------------------------------- +extern "C" { static void gtk_menu_detached_callback( GtkWidget *WXUNUSED(widget), GtkWidget *WXUNUSED(child), wxFrame *win ) { if (g_isIdle) @@ -105,6 +108,7 @@ static void gtk_menu_detached_callback( GtkWidget *WXUNUSED(widget), GtkWidget * win->m_menuBarDetached = TRUE; win->GtkUpdateSize(); } +} #endif // wxUSE_MENUS_NATIVE @@ -113,6 +117,7 @@ static void gtk_menu_detached_callback( GtkWidget *WXUNUSED(widget), GtkWidget * // "child_attached" of tool bar //----------------------------------------------------------------------------- +extern "C" { static void gtk_toolbar_attached_callback( GtkWidget *WXUNUSED(widget), GtkWidget *WXUNUSED(child), wxFrame *win ) { if (!win->m_hasVMT) return; @@ -120,11 +125,13 @@ static void gtk_toolbar_attached_callback( GtkWidget *WXUNUSED(widget), GtkWidge win->m_toolBarDetached = FALSE; win->GtkUpdateSize(); } +} //----------------------------------------------------------------------------- // "child_detached" of tool bar //----------------------------------------------------------------------------- +extern "C" { static void gtk_toolbar_detached_callback( GtkWidget *WXUNUSED(widget), GtkWidget *WXUNUSED(child), wxFrame *win ) { if (g_isIdle) @@ -138,6 +145,7 @@ static void gtk_toolbar_detached_callback( GtkWidget *WXUNUSED(widget), GtkWidge win->m_toolBarDetached = TRUE; win->GtkUpdateSize(); } +} #endif // wxUSE_TOOLBAR diff --git a/src/gtk1/glcanvas.cpp b/src/gtk1/glcanvas.cpp index 30def50299..1dce4e0df5 100644 --- a/src/gtk1/glcanvas.cpp +++ b/src/gtk1/glcanvas.cpp @@ -157,6 +157,7 @@ wxPalette wxGLContext::CreateDefaultPalette() // "realize" from m_wxwindow //----------------------------------------------------------------------------- +extern "C" { static gint gtk_glwindow_realized_callback( GtkWidget * WXUNUSED(widget), wxGLCanvas *win ) { @@ -171,11 +172,13 @@ gtk_glwindow_realized_callback( GtkWidget * WXUNUSED(widget), wxGLCanvas *win ) return FALSE; } +} //----------------------------------------------------------------------------- // "map" from m_wxwindow //----------------------------------------------------------------------------- +extern "C" { static gint gtk_glwindow_map_callback( GtkWidget * WXUNUSED(widget), wxGLCanvas *win ) { @@ -191,11 +194,13 @@ gtk_glwindow_map_callback( GtkWidget * WXUNUSED(widget), wxGLCanvas *win ) return FALSE; } +} //----------------------------------------------------------------------------- // "expose_event" of m_wxwindow //----------------------------------------------------------------------------- +extern "C" { static void gtk_glwindow_expose_callback( GtkWidget *WXUNUSED(widget), GdkEventExpose *gdk_event, wxGLCanvas *win ) { @@ -209,12 +214,14 @@ gtk_glwindow_expose_callback( GtkWidget *WXUNUSED(widget), GdkEventExpose *gdk_e gdk_event->area.width, gdk_event->area.height ); } +} //----------------------------------------------------------------------------- // "draw" of m_wxwindow //----------------------------------------------------------------------------- #ifndef __WXGTK20__ +extern "C" { static void gtk_glwindow_draw_callback( GtkWidget *WXUNUSED(widget), GdkRectangle *rect, wxGLCanvas *win ) { @@ -226,12 +233,14 @@ gtk_glwindow_draw_callback( GtkWidget *WXUNUSED(widget), GdkRectangle *rect, wxG win->GetUpdateRegion().Union( rect->x, rect->y, rect->width, rect->height ); } +} #endif //----------------------------------------------------------------------------- // "size_allocate" of m_wxwindow //----------------------------------------------------------------------------- +extern "C" { static void gtk_glcanvas_size_callback( GtkWidget *WXUNUSED(widget), GtkAllocation* alloc, wxGLCanvas *win ) { @@ -245,6 +254,7 @@ gtk_glcanvas_size_callback( GtkWidget *WXUNUSED(widget), GtkAllocation* alloc, w event.SetEventObject( win ); win->GetEventHandler()->ProcessEvent( event ); } +} //--------------------------------------------------------------------------- // wxGlCanvas diff --git a/src/gtk1/gsockgtk.cpp b/src/gtk1/gsockgtk.cpp index ffcd57563c..ae8e1a9da5 100644 --- a/src/gtk1/gsockgtk.cpp +++ b/src/gtk1/gsockgtk.cpp @@ -21,6 +21,8 @@ #include "wx/unix/gsockunx.h" +extern "C" { +static void _GSocket_GDK_Input(gpointer data, gint source, GdkInputCondition condition) @@ -32,6 +34,7 @@ void _GSocket_GDK_Input(gpointer data, if (condition & GDK_INPUT_WRITE) socket->Detected_Write(); } +} bool GSocketGUIFunctionsTableConcrete::CanUseEventLoop() { return true; } diff --git a/src/gtk1/listbox.cpp b/src/gtk1/listbox.cpp index b522fd7a88..31bbf3815a 100644 --- a/src/gtk1/listbox.cpp +++ b/src/gtk1/listbox.cpp @@ -67,7 +67,8 @@ struct wxlistbox_idle_struct gint m_tag; }; -extern "C" gint wxlistbox_idle_callback( gpointer gdata ) +extern "C" { +static gint wxlistbox_idle_callback( gpointer gdata ) { wxlistbox_idle_struct* data = (wxlistbox_idle_struct*) gdata; gdk_threads_enter(); @@ -88,11 +89,13 @@ extern "C" gint wxlistbox_idle_callback( gpointer gdata ) return TRUE; } +} //----------------------------------------------------------------------------- // "focus_in_event" //----------------------------------------------------------------------------- +extern "C" { static gint gtk_listitem_focus_in_callback( GtkWidget *widget, GdkEvent *WXUNUSED(event), wxWindow *win ) @@ -120,11 +123,13 @@ static gint gtk_listitem_focus_in_callback( GtkWidget *widget, return FALSE; } +} //----------------------------------------------------------------------------- // "focus_out_event" //----------------------------------------------------------------------------- +extern "C" { static gint gtk_listitem_focus_out_callback( GtkWidget *widget, GdkEventFocus *gdk_event, wxWindowGTK *win ) { if (g_isIdle) @@ -150,6 +155,7 @@ static gint gtk_listitem_focus_out_callback( GtkWidget *widget, GdkEventFocus *g return FALSE; } +} //----------------------------------------------------------------------------- // "button_release_event" @@ -161,6 +167,7 @@ static gint gtk_listitem_focus_out_callback( GtkWidget *widget, GdkEventFocus *g this can lead to race conditions so that we emit the dclick event after the GDK_BUTTON_RELEASE event after the GDK_2BUTTON_PRESS event */ +extern "C" { static gint gtk_listbox_button_release_callback( GtkWidget * WXUNUSED(widget), GdkEventButton * WXUNUSED(gdk_event), @@ -200,11 +207,13 @@ gtk_listbox_button_release_callback( GtkWidget * WXUNUSED(widget), return FALSE; } +} //----------------------------------------------------------------------------- // "button_press_event" //----------------------------------------------------------------------------- +extern "C" { static gint gtk_listbox_button_press_callback( GtkWidget *widget, GdkEventButton *gdk_event, @@ -254,11 +263,13 @@ gtk_listbox_button_press_callback( GtkWidget *widget, return FALSE; } +} //----------------------------------------------------------------------------- // "key_press_event" //----------------------------------------------------------------------------- +extern "C" { static gint gtk_listbox_key_press_callback( GtkWidget *widget, GdkEventKey *gdk_event, wxListBox *listbox ) { @@ -349,23 +360,12 @@ gtk_listbox_key_press_callback( GtkWidget *widget, GdkEventKey *gdk_event, wxLis return FALSE; } +} //----------------------------------------------------------------------------- // "select" and "deselect" //----------------------------------------------------------------------------- -static void gtk_listitem_select_cb( GtkWidget *widget, wxListBox *listbox, bool is_selection ); - -static void gtk_listitem_select_callback( GtkWidget *widget, wxListBox *listbox ) -{ - gtk_listitem_select_cb( widget, listbox, TRUE ); -} - -static void gtk_listitem_deselect_callback( GtkWidget *widget, wxListBox *listbox ) -{ - gtk_listitem_select_cb( widget, listbox, FALSE ); -} - static void gtk_listitem_select_cb( GtkWidget *widget, wxListBox *listbox, bool is_selection ) @@ -416,10 +416,25 @@ static void gtk_listitem_select_cb( GtkWidget *widget, listbox->GetEventHandler()->ProcessEvent( event ); } +extern "C" { +static void gtk_listitem_select_callback( GtkWidget *widget, wxListBox *listbox ) +{ + gtk_listitem_select_cb( widget, listbox, TRUE ); +} +} + +extern "C" { +static void gtk_listitem_deselect_callback( GtkWidget *widget, wxListBox *listbox ) +{ + gtk_listitem_select_cb( widget, listbox, FALSE ); +} +} + //----------------------------------------------------------------------------- // wxListBox //----------------------------------------------------------------------------- +extern "C" { static gint gtk_listbox_realized_callback( GtkWidget *m_widget, wxListBox *win ) { @@ -432,6 +447,7 @@ gtk_listbox_realized_callback( GtkWidget *m_widget, wxListBox *win ) return false; } +} //----------------------------------------------------------------------------- // wxListBox diff --git a/src/gtk1/mdi.cpp b/src/gtk1/mdi.cpp index 36b2f789f0..ddd65e82be 100644 --- a/src/gtk1/mdi.cpp +++ b/src/gtk1/mdi.cpp @@ -52,6 +52,7 @@ extern wxList wxPendingDelete; // "switch_page" //----------------------------------------------------------------------------- +extern "C" { static void gtk_mdi_page_change_callback( GtkNotebook *WXUNUSED(widget), GtkNotebookPage *page, @@ -104,6 +105,7 @@ gtk_mdi_page_change_callback( GtkNotebook *WXUNUSED(widget), event2.SetEventObject( child); child->GetEventHandler()->ProcessEvent( event2 ); } +} //----------------------------------------------------------------------------- // wxMDIParentFrame @@ -435,6 +437,7 @@ void wxMDIChildFrame::SetTitle( const wxString &title ) // "size_allocate" //----------------------------------------------------------------------------- +extern "C" { static void gtk_page_size_callback( GtkWidget *WXUNUSED(widget), GtkAllocation* alloc, wxWindow *win ) { if (g_isIdle) wxapp_install_idle_handler(); @@ -450,6 +453,7 @@ static void gtk_page_size_callback( GtkWidget *WXUNUSED(widget), GtkAllocation* win->SetSize( alloc->x, alloc->y, alloc->width, alloc->height ); } +} //----------------------------------------------------------------------------- // InsertChild callback for wxMDIClientWindow diff --git a/src/gtk1/menu.cpp b/src/gtk1/menu.cpp index 7922dd438b..00919081b2 100644 --- a/src/gtk1/menu.cpp +++ b/src/gtk1/menu.cpp @@ -96,12 +96,14 @@ struct _GtkPixmapMenuItemClass guint have_pixmap_count; }; - +extern "C" { GtkType gtk_pixmap_menu_item_get_type (void); GtkWidget* gtk_pixmap_menu_item_new (void); void gtk_pixmap_menu_item_set_pixmap (GtkPixmapMenuItem *menu_item, - GtkWidget *pixmap); -#endif // GTK 2.0 + GtkWidget *pixmap); +} + +#endif // !__WXGTK20__ //----------------------------------------------------------------------------- // idle system @@ -149,6 +151,7 @@ static wxString wxReplaceUnderscore( const wxString& title ) // activate message from GTK //----------------------------------------------------------------------------- +extern "C" { static void gtk_menu_open_callback( GtkWidget *widget, wxMenu *menu ) { if (g_isIdle) wxapp_install_idle_handler(); @@ -163,6 +166,7 @@ static void gtk_menu_open_callback( GtkWidget *widget, wxMenu *menu ) wxWindow *win = menu->GetInvokingWindow(); if (win) win->GetEventHandler()->ProcessEvent( event ); } +} //----------------------------------------------------------------------------- // wxMenuBar @@ -581,6 +585,7 @@ void wxMenuBar::SetLabelTop( size_t pos, const wxString& label ) // "activate" //----------------------------------------------------------------------------- +extern "C" { static void gtk_menu_clicked_callback( GtkWidget *widget, wxMenu *menu ) { if (g_isIdle) @@ -651,11 +656,13 @@ static void gtk_menu_clicked_callback( GtkWidget *widget, wxMenu *menu ) menu->SendEvent(id, item->IsCheckable() ? item->IsChecked() : -1); } } +} //----------------------------------------------------------------------------- // "select" //----------------------------------------------------------------------------- +extern "C" { static void gtk_menu_hilight_callback( GtkWidget *widget, wxMenu *menu ) { if (g_isIdle) wxapp_install_idle_handler(); @@ -677,11 +684,13 @@ static void gtk_menu_hilight_callback( GtkWidget *widget, wxMenu *menu ) wxWindow *win = menu->GetInvokingWindow(); if (win) win->GetEventHandler()->ProcessEvent( event ); } +} //----------------------------------------------------------------------------- // "deselect" //----------------------------------------------------------------------------- +extern "C" { static void gtk_menu_nolight_callback( GtkWidget *widget, wxMenu *menu ) { if (g_isIdle) wxapp_install_idle_handler(); @@ -704,6 +713,7 @@ static void gtk_menu_nolight_callback( GtkWidget *widget, wxMenu *menu ) if (win) win->GetEventHandler()->ProcessEvent( event ); } +} //----------------------------------------------------------------------------- // wxMenuItem @@ -1525,7 +1535,7 @@ static void changed_have_pixmap_status (GtkPixmapMenuItem *menu_item); static GtkMenuItemClass *parent_class = NULL; -} +} // extern "C" #define BORDER_SPACING 3 #define PMAP_WIDTH 20 @@ -1556,6 +1566,8 @@ gtk_pixmap_menu_item_get_type (void) return pixmap_menu_item_type; } +extern "C" { + /** * gtk_pixmap_menu_item_new * @@ -1834,5 +1846,7 @@ changed_have_pixmap_status (GtkPixmapMenuItem *menu_item) gtk_widget_queue_resize(GTK_WIDGET(menu_item)); } -#endif +} // extern "C" + +#endif // !__WXGTK20__ diff --git a/src/gtk1/minifram.cpp b/src/gtk1/minifram.cpp index 738123f286..139f1433c1 100644 --- a/src/gtk1/minifram.cpp +++ b/src/gtk1/minifram.cpp @@ -69,6 +69,7 @@ static void DrawFrame( GtkWidget *widget, int x, int y, int w, int h ) // "expose_event" of m_mainWidget //----------------------------------------------------------------------------- +extern "C" { static void gtk_window_own_expose_callback( GtkWidget *widget, GdkEventExpose *gdk_event, wxFrame *win ) { if (g_isIdle) wxapp_install_idle_handler(); @@ -109,12 +110,14 @@ static void gtk_window_own_expose_callback( GtkWidget *widget, GdkEventExpose *g dc.DrawText( win->GetTitle(), 6, 3 ); } } +} //----------------------------------------------------------------------------- // "draw" of m_mainWidget //----------------------------------------------------------------------------- #ifndef __WXGTK20__ +extern "C" { static void gtk_window_own_draw_callback( GtkWidget *widget, GdkRectangle *WXUNUSED(rect), wxFrame *win ) { if (g_isIdle) wxapp_install_idle_handler(); @@ -154,12 +157,14 @@ static void gtk_window_own_draw_callback( GtkWidget *widget, GdkRectangle *WXUNU dc.DrawText( win->GetTitle(), 6, 3 ); } } +} #endif //----------------------------------------------------------------------------- // "button_press_event" of m_mainWidget //----------------------------------------------------------------------------- +extern "C" { static gint gtk_window_button_press_callback( GtkWidget *widget, GdkEventButton *gdk_event, wxMiniFrame *win ) { if (g_isIdle) wxapp_install_idle_handler(); @@ -203,11 +208,13 @@ static gint gtk_window_button_press_callback( GtkWidget *widget, GdkEventButton return TRUE; } +} //----------------------------------------------------------------------------- // "button_release_event" of m_mainWidget //----------------------------------------------------------------------------- +extern "C" { static gint gtk_window_button_release_callback( GtkWidget *widget, GdkEventButton *gdk_event, wxMiniFrame *win ) { if (g_isIdle) wxapp_install_idle_handler(); @@ -236,11 +243,13 @@ static gint gtk_window_button_release_callback( GtkWidget *widget, GdkEventButto return TRUE; } +} //----------------------------------------------------------------------------- // "motion_notify_event" of m_mainWidget //----------------------------------------------------------------------------- +extern "C" { static gint gtk_window_motion_notify_callback( GtkWidget *widget, GdkEventMotion *gdk_event, wxMiniFrame *win ) { if (g_isIdle) wxapp_install_idle_handler(); @@ -269,17 +278,20 @@ static gint gtk_window_motion_notify_callback( GtkWidget *widget, GdkEventMotion return TRUE; } +} //----------------------------------------------------------------------------- // "clicked" of X system button //----------------------------------------------------------------------------- +extern "C" { static void gtk_button_clicked_callback( GtkWidget *WXUNUSED(widget), wxMiniFrame *mf ) { if (g_isIdle) wxapp_install_idle_handler(); mf->Close(); } +} //----------------------------------------------------------------------------- // wxMiniFrame diff --git a/src/gtk1/notebook.cpp b/src/gtk1/notebook.cpp index d58e2fe172..80d7b18caf 100644 --- a/src/gtk1/notebook.cpp +++ b/src/gtk1/notebook.cpp @@ -90,6 +90,7 @@ WX_DEFINE_LIST(wxGtkNotebookPagesList); // "switch_page" //----------------------------------------------------------------------------- +extern "C" { static void gtk_notebook_page_change_callback(GtkNotebook *WXUNUSED(widget), GtkNotebookPage *WXUNUSED(page), gint page, @@ -132,11 +133,13 @@ static void gtk_notebook_page_change_callback(GtkNotebook *WXUNUSED(widget), notebook->m_inSwitchPage = FALSE; } +} //----------------------------------------------------------------------------- // "size_allocate" //----------------------------------------------------------------------------- +extern "C" { static void gtk_page_size_callback( GtkWidget *WXUNUSED(widget), GtkAllocation* alloc, wxWindow *win ) { if (g_isIdle) @@ -163,11 +166,13 @@ static void gtk_page_size_callback( GtkWidget *WXUNUSED(widget), GtkAllocation* gtk_widget_size_allocate( win->m_wxwindow, alloc ); } } +} //----------------------------------------------------------------------------- // "realize" from m_widget //----------------------------------------------------------------------------- +extern "C" { static gint gtk_notebook_realized_callback( GtkWidget * WXUNUSED(widget), wxWindow *win ) { @@ -180,11 +185,13 @@ gtk_notebook_realized_callback( GtkWidget * WXUNUSED(widget), wxWindow *win ) return FALSE; } +} //----------------------------------------------------------------------------- // "key_press_event" //----------------------------------------------------------------------------- +extern "C" { static gint gtk_notebook_key_press_callback( GtkWidget *widget, GdkEventKey *gdk_event, wxNotebook *notebook ) { if (g_isIdle) @@ -250,6 +257,7 @@ static gint gtk_notebook_key_press_callback( GtkWidget *widget, GdkEventKey *gdk return FALSE; } +} //----------------------------------------------------------------------------- // InsertChild callback for wxNotebook diff --git a/src/gtk1/popupwin.cpp b/src/gtk1/popupwin.cpp index 9593f43a57..599d775636 100644 --- a/src/gtk1/popupwin.cpp +++ b/src/gtk1/popupwin.cpp @@ -38,6 +38,7 @@ extern bool g_isIdle; // "button_press" //----------------------------------------------------------------------------- +extern "C" { static gint gtk_popup_button_press (GtkWidget *widget, GdkEvent *gdk_event, wxPopupWindow* win ) { GtkWidget *child = gtk_get_event_widget (gdk_event); @@ -66,11 +67,13 @@ static gint gtk_popup_button_press (GtkWidget *widget, GdkEvent *gdk_event, wxPo return TRUE; } +} //----------------------------------------------------------------------------- // "focus" from m_window //----------------------------------------------------------------------------- +extern "C" { static gint gtk_dialog_focus_callback( GtkWidget *widget, GtkDirectionType WXUNUSED(d), wxWindow *WXUNUSED(win) ) { if (g_isIdle) @@ -80,11 +83,13 @@ static gint gtk_dialog_focus_callback( GtkWidget *widget, GtkDirectionType WXUNU gtk_signal_emit_stop_by_name( GTK_OBJECT(widget), "focus" ); return TRUE; } +} //----------------------------------------------------------------------------- // "delete_event" //----------------------------------------------------------------------------- +extern "C" { bool gtk_dialog_delete_callback( GtkWidget *WXUNUSED(widget), GdkEvent *WXUNUSED(event), wxPopupWindow *win ) { if (g_isIdle) @@ -95,11 +100,13 @@ bool gtk_dialog_delete_callback( GtkWidget *WXUNUSED(widget), GdkEvent *WXUNUSED return TRUE; } +} //----------------------------------------------------------------------------- // "size_allocate" //----------------------------------------------------------------------------- +extern "C" { static void gtk_dialog_size_callback( GtkWidget *WXUNUSED(widget), GtkAllocation* alloc, wxPopupWindow *win ) { if (g_isIdle) @@ -114,6 +121,7 @@ static void gtk_dialog_size_callback( GtkWidget *WXUNUSED(widget), GtkAllocation win->GtkUpdateSize(); } } +} //----------------------------------------------------------------------------- // "realize" from m_widget @@ -122,6 +130,7 @@ static void gtk_dialog_size_callback( GtkWidget *WXUNUSED(widget), GtkAllocation /* we cannot MWM hints and icons before the widget has been realized, so we do this directly after realization */ +extern "C" { static gint gtk_dialog_realized_callback( GtkWidget * WXUNUSED(widget), wxPopupWindow *win ) { @@ -140,6 +149,7 @@ gtk_dialog_realized_callback( GtkWidget * WXUNUSED(widget), wxPopupWindow *win ) return FALSE; } +} //----------------------------------------------------------------------------- // InsertChild for wxPopupWindow diff --git a/src/gtk1/radiobox.cpp b/src/gtk1/radiobox.cpp index 016283c37f..d10997621e 100644 --- a/src/gtk1/radiobox.cpp +++ b/src/gtk1/radiobox.cpp @@ -45,6 +45,7 @@ extern wxWindowGTK *g_delayedFocus; // "clicked" //----------------------------------------------------------------------------- +extern "C" { static void gtk_radiobutton_clicked_callback( GtkToggleButton *button, wxRadioBox *rb ) { if (g_isIdle) wxapp_install_idle_handler(); @@ -60,11 +61,13 @@ static void gtk_radiobutton_clicked_callback( GtkToggleButton *button, wxRadioBo event.SetEventObject( rb ); rb->GetEventHandler()->ProcessEvent(event); } +} //----------------------------------------------------------------------------- // "key_press_event" //----------------------------------------------------------------------------- +extern "C" { static gint gtk_radiobox_keypress_callback( GtkWidget *widget, GdkEventKey *gdk_event, wxRadioBox *rb ) { if (g_isIdle) @@ -111,7 +114,9 @@ static gint gtk_radiobox_keypress_callback( GtkWidget *widget, GdkEventKey *gdk_ return TRUE; } +} +extern "C" { static gint gtk_radiobutton_focus_in( GtkWidget *widget, GdkEvent *WXUNUSED(event), wxRadioBox *win ) @@ -135,7 +140,9 @@ static gint gtk_radiobutton_focus_in( GtkWidget *widget, return FALSE; } +} +extern "C" { static gint gtk_radiobutton_focus_out( GtkWidget *widget, GdkEvent *WXUNUSED(event), wxRadioBox *win ) @@ -152,6 +159,7 @@ static gint gtk_radiobutton_focus_out( GtkWidget *widget, return FALSE; } +} //----------------------------------------------------------------------------- // wxRadioBox diff --git a/src/gtk1/radiobut.cpp b/src/gtk1/radiobut.cpp index df0ad406d2..9900eb7c89 100644 --- a/src/gtk1/radiobut.cpp +++ b/src/gtk1/radiobut.cpp @@ -40,6 +40,7 @@ extern wxWindowGTK *g_delayedFocus; // "clicked" //----------------------------------------------------------------------------- +extern "C" { static void gtk_radiobutton_clicked_callback( GtkToggleButton *button, wxRadioButton *rb ) { @@ -58,6 +59,7 @@ void gtk_radiobutton_clicked_callback( GtkToggleButton *button, wxRadioButton *r event.SetEventObject( rb ); rb->GetEventHandler()->ProcessEvent( event ); } +} //----------------------------------------------------------------------------- // wxRadioButton diff --git a/src/gtk1/scrolbar.cpp b/src/gtk1/scrolbar.cpp index d9846c1067..7c8b236b7f 100644 --- a/src/gtk1/scrolbar.cpp +++ b/src/gtk1/scrolbar.cpp @@ -46,6 +46,7 @@ static const float sensitivity = 0.02; // FIXME: is GtkScrollType really passed to us as 2nd argument? +extern "C" { static void gtk_scrollbar_callback( GtkAdjustment *adjust, SCROLLBAR_CBACK_ARG wxScrollBar *win ) @@ -86,10 +87,12 @@ static void gtk_scrollbar_callback( GtkAdjustment *adjust, win->ProcessEvent( cevent ); */ } +} //----------------------------------------------------------------------------- // "button_press_event" from slider //----------------------------------------------------------------------------- +extern "C" { static gint gtk_scrollbar_button_press_callback( GtkRange *widget, GdkEventButton *gdk_event, wxScrollBar *win ) @@ -128,11 +131,13 @@ static gint gtk_scrollbar_button_press_callback( GtkRange *widget, return FALSE; } +} //----------------------------------------------------------------------------- // "button_release_event" from slider //----------------------------------------------------------------------------- +extern "C" { static gint gtk_scrollbar_button_release_callback( GtkRange *WXUNUSED(widget), GdkEventButton *WXUNUSED(gdk_event), @@ -159,6 +164,7 @@ gtk_scrollbar_button_release_callback( GtkRange *WXUNUSED(widget), return FALSE; } +} //----------------------------------------------------------------------------- // wxScrollBar diff --git a/src/gtk1/scrolwin.cpp b/src/gtk1/scrolwin.cpp index 5a31109d61..79cfe5d3a3 100644 --- a/src/gtk1/scrolwin.cpp +++ b/src/gtk1/scrolwin.cpp @@ -72,6 +72,7 @@ extern bool g_isIdle; // "value_changed" from m_vAdjust //----------------------------------------------------------------------------- +extern "C" { static void gtk_scrolled_window_vscroll_callback( GtkAdjustment *adjust, SCROLLBAR_CBACK_ARG wxScrolledWindow *win ) @@ -86,11 +87,13 @@ static void gtk_scrolled_window_vscroll_callback( GtkAdjustment *adjust, win->GtkVScroll( adjust->value, GET_SCROLL_TYPE(GTK_SCROLLED_WINDOW(win->m_widget)->vscrollbar) ); } +} //----------------------------------------------------------------------------- // "value_changed" from m_hAdjust //----------------------------------------------------------------------------- +extern "C" { static void gtk_scrolled_window_hscroll_callback( GtkAdjustment *adjust, SCROLLBAR_CBACK_ARG wxScrolledWindow *win ) @@ -104,11 +107,13 @@ static void gtk_scrolled_window_hscroll_callback( GtkAdjustment *adjust, win->GtkHScroll( adjust->value, GET_SCROLL_TYPE(GTK_SCROLLED_WINDOW(win->m_widget)->hscrollbar) ); } +} //----------------------------------------------------------------------------- // "button_press_event" from scrollbar //----------------------------------------------------------------------------- +extern "C" { static gint gtk_scrollbar_button_press_callback( GtkRange *widget, GdkEventButton *gdk_event, wxWindowGTK *win) @@ -125,11 +130,13 @@ static gint gtk_scrollbar_button_press_callback( GtkRange *widget, return FALSE; } +} //----------------------------------------------------------------------------- // "button_release_event" from scrollbar //----------------------------------------------------------------------------- +extern "C" { static gint gtk_scrollbar_button_release_callback( GtkRange *widget, GdkEventButton *WXUNUSED(gdk_event), wxWindowGTK *win) @@ -168,6 +175,7 @@ static gint gtk_scrollbar_button_release_callback( GtkRange *widget, return FALSE; } +} //----------------------------------------------------------------------------- // InsertChild for wxScrolledWindow diff --git a/src/gtk1/slider.cpp b/src/gtk1/slider.cpp index 93ec5c8fff..c5d5be31fe 100644 --- a/src/gtk1/slider.cpp +++ b/src/gtk1/slider.cpp @@ -41,6 +41,7 @@ static const float sensitivity = 0.02; // "value_changed" //----------------------------------------------------------------------------- +extern "C" { static void gtk_slider_callback( GtkAdjustment *adjust, SCROLLBAR_CBACK_ARG wxSlider *win ) @@ -72,6 +73,7 @@ static void gtk_slider_callback( GtkAdjustment *adjust, cevent.SetInt( value ); win->GetEventHandler()->ProcessEvent( cevent ); } +} //----------------------------------------------------------------------------- // wxSlider diff --git a/src/gtk1/spinbutt.cpp b/src/gtk1/spinbutt.cpp index c11142163f..77416c0a63 100644 --- a/src/gtk1/spinbutt.cpp +++ b/src/gtk1/spinbutt.cpp @@ -43,6 +43,7 @@ static const float sensitivity = 0.02; // "value_changed" //----------------------------------------------------------------------------- +extern "C" { static void gtk_spinbutt_callback( GtkWidget *WXUNUSED(widget), wxSpinButton *win ) { if (g_isIdle) wxapp_install_idle_handler(); @@ -98,6 +99,7 @@ static void gtk_spinbutt_callback( GtkWidget *WXUNUSED(widget), wxSpinButton *wi win->GetEventHandler()->ProcessEvent( event2 ); } } +} //----------------------------------------------------------------------------- // wxSpinButton diff --git a/src/gtk1/spinctrl.cpp b/src/gtk1/spinctrl.cpp index 10aa930138..f4c9e8d27c 100644 --- a/src/gtk1/spinctrl.cpp +++ b/src/gtk1/spinctrl.cpp @@ -44,6 +44,7 @@ extern bool g_blockEventsOnDrag; // "value_changed" //----------------------------------------------------------------------------- +extern "C" { static void gtk_spinctrl_callback( GtkWidget *WXUNUSED(widget), wxSpinCtrl *win ) { if (g_isIdle) wxapp_install_idle_handler(); @@ -63,11 +64,13 @@ static void gtk_spinctrl_callback( GtkWidget *WXUNUSED(widget), wxSpinCtrl *win event.SetInt( (int)ceil(win->m_adjust->value) ); win->GetEventHandler()->ProcessEvent( event ); } +} //----------------------------------------------------------------------------- // "changed" //----------------------------------------------------------------------------- +extern "C" { static void gtk_spinctrl_text_changed_callback( GtkWidget *WXUNUSED(widget), wxSpinCtrl *win ) { @@ -83,6 +86,7 @@ gtk_spinctrl_text_changed_callback( GtkWidget *WXUNUSED(widget), wxSpinCtrl *win event.SetInt( (int)ceil(win->m_adjust->value) ); win->GetEventHandler()->ProcessEvent( event ); } +} //----------------------------------------------------------------------------- // wxSpinCtrl diff --git a/src/gtk1/tbargtk.cpp b/src/gtk1/tbargtk.cpp index f7f791c65e..5d5dd740c6 100644 --- a/src/gtk1/tbargtk.cpp +++ b/src/gtk1/tbargtk.cpp @@ -164,6 +164,7 @@ IMPLEMENT_DYNAMIC_CLASS(wxToolBar, wxControl) // "clicked" (internal from gtk_toolbar) //----------------------------------------------------------------------------- +extern "C" { static void gtk_toolbar_callback( GtkWidget *WXUNUSED(widget), wxToolBarTool *tool ) { @@ -198,11 +199,13 @@ static void gtk_toolbar_callback( GtkWidget *WXUNUSED(widget), tool->SetPixmap(tool->GetBitmap()); } } +} //----------------------------------------------------------------------------- // "enter_notify_event" / "leave_notify_event" //----------------------------------------------------------------------------- +extern "C" { static gint gtk_toolbar_tool_callback( GtkWidget *WXUNUSED(widget), GdkEventCrossing *gdk_event, wxToolBarTool *tool ) @@ -221,6 +224,7 @@ static gint gtk_toolbar_tool_callback( GtkWidget *WXUNUSED(widget), return FALSE; } +} //----------------------------------------------------------------------------- // InsertChild callback for wxToolBar diff --git a/src/gtk1/textctrl.cpp b/src/gtk1/textctrl.cpp index f0dad16cff..d896b04035 100644 --- a/src/gtk1/textctrl.cpp +++ b/src/gtk1/textctrl.cpp @@ -144,6 +144,7 @@ static void wxGtkTextInsert(GtkWidget *text, // "insert_text" for GtkEntry // ---------------------------------------------------------------------------- +extern "C" { static void gtk_insert_text_callback(GtkEditable *editable, const gchar *new_text, @@ -179,10 +180,12 @@ gtk_insert_text_callback(GtkEditable *editable, win->GetEventHandler()->ProcessEvent( event ); } } +} #ifdef __WXGTK20__ // Implementation of wxTE_AUTO_URL for wxGTK2 by Mart Raudsepp, +extern "C" { static void au_apply_tag_callback(GtkTextBuffer *buffer, GtkTextTag *tag, @@ -193,34 +196,43 @@ au_apply_tag_callback(GtkTextBuffer *buffer, if(tag == gtk_text_tag_table_lookup(gtk_text_buffer_get_tag_table(buffer), "wxUrl")) g_signal_stop_emission_by_name(buffer, "apply_tag"); } +} //----------------------------------------------------------------------------- // GtkTextCharPredicates for gtk_text_iter_*_find_char //----------------------------------------------------------------------------- +extern "C" { static gboolean pred_whitespace (gunichar ch, gpointer user_data) { return g_unichar_isspace(ch); } +} +extern "C" { static gboolean pred_non_whitespace (gunichar ch, gpointer user_data) { return !g_unichar_isspace(ch); } +} +extern "C" { static gboolean pred_nonpunct (gunichar ch, gpointer user_data) { return !g_unichar_ispunct(ch); } +} +extern "C" { static gboolean pred_nonpunct_or_slash (gunichar ch, gpointer user_data) { return !g_unichar_ispunct(ch) || ch == '/'; } +} //----------------------------------------------------------------------------- // Check for links between s and e and correct tags as necessary @@ -228,6 +240,7 @@ pred_nonpunct_or_slash (gunichar ch, gpointer user_data) // This function should be made match better while being efficient at one point. // Most probably with a row of regular expressions. +extern "C" { static void au_check_word( GtkTextIter *s, GtkTextIter *e ) { @@ -287,7 +300,9 @@ au_check_word( GtkTextIter *s, GtkTextIter *e ) g_signal_handler_unblock(buffer, signal_id); } } +} +extern "C" { static void au_check_range(GtkTextIter *s, GtkTextIter *range_end) @@ -314,11 +329,13 @@ au_check_range(GtkTextIter *s, gtk_text_iter_forward_find_char(&range_start, pred_non_whitespace, NULL, range_end); } } +} //----------------------------------------------------------------------------- // "insert-text" for GtkTextBuffer //----------------------------------------------------------------------------- +extern "C" { static void au_insert_text_callback(GtkTextBuffer *buffer, GtkTextIter *end, @@ -344,11 +361,13 @@ au_insert_text_callback(GtkTextBuffer *buffer, au_check_range(&words_start, &words_end); } +} //----------------------------------------------------------------------------- // "delete-range" for GtkTextBuffer //----------------------------------------------------------------------------- +extern "C" { static void au_delete_range_callback(GtkTextBuffer *buffer, GtkTextIter *start, @@ -367,6 +386,7 @@ au_delete_range_callback(GtkTextBuffer *buffer, au_check_range(start, end); } +} #endif @@ -375,6 +395,7 @@ au_delete_range_callback(GtkTextBuffer *buffer, // "changed" //----------------------------------------------------------------------------- +extern "C" { static void gtk_text_changed_callback( GtkWidget *widget, wxTextCtrl *win ) { @@ -395,17 +416,20 @@ gtk_text_changed_callback( GtkWidget *widget, wxTextCtrl *win ) event.SetEventObject( win ); win->GetEventHandler()->ProcessEvent( event ); } +} //----------------------------------------------------------------------------- // "expose_event" from scrolled window and textview //----------------------------------------------------------------------------- #ifdef __WXGTK20__ +extern "C" { static gboolean gtk_text_exposed_callback( GtkWidget *widget, GdkEventExpose *event, wxTextCtrl *win ) { return TRUE; } +} #endif //----------------------------------------------------------------------------- @@ -413,6 +437,7 @@ gtk_text_exposed_callback( GtkWidget *widget, GdkEventExpose *event, wxTextCtrl //----------------------------------------------------------------------------- #ifndef __WXGTK20__ +extern "C" { static void gtk_scrollbar_changed_callback( GtkWidget *WXUNUSED(widget), wxTextCtrl *win ) { @@ -423,6 +448,7 @@ gtk_scrollbar_changed_callback( GtkWidget *WXUNUSED(widget), wxTextCtrl *win ) win->CalculateScrollbar(); } +} #endif // ---------------------------------------------------------------------------- @@ -444,8 +470,8 @@ extern "C" { static GtkDrawCallback gs_gtk_text_draw = NULL; -extern "C" -void wxgtk_text_draw( GtkWidget *widget, GdkRectangle *rect) +extern "C" { +static void wxgtk_text_draw( GtkWidget *widget, GdkRectangle *rect) { if ( !wxIsInsideYield ) { @@ -455,6 +481,7 @@ void wxgtk_text_draw( GtkWidget *widget, GdkRectangle *rect) gs_gtk_text_draw(widget, rect); } } +} #endif // __WXGTK20__ diff --git a/src/gtk1/tglbtn.cpp b/src/gtk1/tglbtn.cpp index 973299339a..1bf01efef7 100644 --- a/src/gtk1/tglbtn.cpp +++ b/src/gtk1/tglbtn.cpp @@ -26,6 +26,7 @@ extern bool g_blockEventsOnDrag; extern wxCursor g_globalCursor; extern wxWindowGTK *g_delayedFocus; +extern "C" { static void gtk_togglebutton_clicked_callback(GtkWidget *WXUNUSED(widget), wxToggleButton *cb) { if (g_isIdle) @@ -42,6 +43,7 @@ static void gtk_togglebutton_clicked_callback(GtkWidget *WXUNUSED(widget), wxTog event.SetEventObject(cb); cb->GetEventHandler()->ProcessEvent(event); } +} DEFINE_EVENT_TYPE(wxEVT_COMMAND_TOGGLEBUTTON_CLICKED) diff --git a/src/gtk1/timer.cpp b/src/gtk1/timer.cpp index 3b28f1d1c2..e004d2d4be 100644 --- a/src/gtk1/timer.cpp +++ b/src/gtk1/timer.cpp @@ -27,7 +27,8 @@ IMPLEMENT_ABSTRACT_CLASS(wxTimer, wxEvtHandler) -extern "C" gint timeout_callback( gpointer data ) +extern "C" { +static gint timeout_callback( gpointer data ) { wxTimer *timer = (wxTimer*)data; @@ -54,6 +55,7 @@ extern "C" gint timeout_callback( gpointer data ) return TRUE; } +} void wxTimer::Init() { diff --git a/src/gtk1/toplevel.cpp b/src/gtk1/toplevel.cpp index fb7300af9d..63395a5370 100644 --- a/src/gtk1/toplevel.cpp +++ b/src/gtk1/toplevel.cpp @@ -82,6 +82,7 @@ static int g_sendActivateEvent = -1; // "focus_in_event" //----------------------------------------------------------------------------- +extern "C" { static gint gtk_frame_focus_in_callback( GtkWidget *widget, GdkEvent *WXUNUSED(event), wxTopLevelWindowGTK *win ) @@ -115,11 +116,13 @@ static gint gtk_frame_focus_in_callback( GtkWidget *widget, return FALSE; } +} //----------------------------------------------------------------------------- // "focus_out_event" //----------------------------------------------------------------------------- +extern "C" { static gint gtk_frame_focus_out_callback( GtkWidget *widget, GdkEventFocus *WXUNUSED(gdk_event), wxTopLevelWindowGTK *win ) @@ -148,11 +151,13 @@ static gint gtk_frame_focus_out_callback( GtkWidget *widget, return FALSE; } +} //----------------------------------------------------------------------------- // "focus" from m_window //----------------------------------------------------------------------------- +extern "C" { static gint gtk_frame_focus_callback( GtkWidget *widget, GtkDirectionType WXUNUSED(d), wxWindow *WXUNUSED(win) ) { if (g_isIdle) @@ -162,11 +167,13 @@ static gint gtk_frame_focus_callback( GtkWidget *widget, GtkDirectionType WXUNUS gtk_signal_emit_stop_by_name( GTK_OBJECT(widget), "focus" ); return TRUE; } +} //----------------------------------------------------------------------------- // "size_allocate" //----------------------------------------------------------------------------- +extern "C" { static void gtk_frame_size_callback( GtkWidget *WXUNUSED(widget), GtkAllocation* alloc, wxTopLevelWindowGTK *win ) { if (g_isIdle) @@ -192,11 +199,13 @@ static void gtk_frame_size_callback( GtkWidget *WXUNUSED(widget), GtkAllocation* win->GtkUpdateSize(); } } +} //----------------------------------------------------------------------------- // "delete_event" //----------------------------------------------------------------------------- +extern "C" { static gint gtk_frame_delete_callback( GtkWidget *WXUNUSED(widget), GdkEvent *WXUNUSED(event), wxTopLevelWindowGTK *win ) { if (g_isIdle) @@ -209,12 +218,14 @@ static gint gtk_frame_delete_callback( GtkWidget *WXUNUSED(widget), GdkEvent *WX return TRUE; } +} //----------------------------------------------------------------------------- // "configure_event" //----------------------------------------------------------------------------- +extern "C" { static gint gtk_frame_configure_callback( GtkWidget *WXUNUSED(widget), GdkEventConfigure *WXUNUSED(event), wxTopLevelWindowGTK *win ) { @@ -237,6 +248,7 @@ gtk_frame_configure_callback( GtkWidget *WXUNUSED(widget), GdkEventConfigure *WX return FALSE; } +} //----------------------------------------------------------------------------- // "realize" from m_widget @@ -245,6 +257,7 @@ gtk_frame_configure_callback( GtkWidget *WXUNUSED(widget), GdkEventConfigure *WX // we cannot MWM hints and icons before the widget has been realized, // so we do this directly after realization +extern "C" { static void gtk_frame_realized_callback( GtkWidget * WXUNUSED(widget), wxTopLevelWindowGTK *win ) @@ -273,11 +286,13 @@ gtk_frame_realized_callback( GtkWidget * WXUNUSED(widget), win->SetIcons( iconsOld ); } } +} //----------------------------------------------------------------------------- // "map_event" from m_widget //----------------------------------------------------------------------------- +extern "C" { static void gtk_frame_map_callback( GtkWidget * WXUNUSED(widget), GdkEvent * WXUNUSED(event), @@ -285,11 +300,13 @@ gtk_frame_map_callback( GtkWidget * WXUNUSED(widget), { win->SetIconizeState(FALSE); } +} //----------------------------------------------------------------------------- // "unmap_event" from m_widget //----------------------------------------------------------------------------- +extern "C" { static void gtk_frame_unmap_callback( GtkWidget * WXUNUSED(widget), GdkEvent * WXUNUSED(event), @@ -297,11 +314,13 @@ gtk_frame_unmap_callback( GtkWidget * WXUNUSED(widget), { win->SetIconizeState(TRUE); } +} //----------------------------------------------------------------------------- // "expose_event" of m_client //----------------------------------------------------------------------------- +extern "C" { static int gtk_window_expose_callback( GtkWidget *widget, GdkEventExpose *gdk_event, wxWindow *win ) { GtkPizza *pizza = GTK_PIZZA(widget); @@ -316,6 +335,7 @@ static int gtk_window_expose_callback( GtkWidget *widget, GdkEventExpose *gdk_ev return FALSE; } +} //----------------------------------------------------------------------------- // "draw" of m_client @@ -323,6 +343,7 @@ static int gtk_window_expose_callback( GtkWidget *widget, GdkEventExpose *gdk_ev #ifndef __WXGTK20__ +extern "C" { static void gtk_window_draw_callback( GtkWidget *widget, GdkRectangle *rect, wxWindow *win ) { GtkPizza *pizza = GTK_PIZZA(widget); @@ -335,6 +356,7 @@ static void gtk_window_draw_callback( GtkWidget *widget, GdkRectangle *rect, wxW (char *)"base", 0, 0, -1, -1); } +} #endif // GTK+ 1.x diff --git a/src/gtk1/utilsgtk.cpp b/src/gtk1/utilsgtk.cpp index e76e3187f3..4d780162b6 100644 --- a/src/gtk1/utilsgtk.cpp +++ b/src/gtk1/utilsgtk.cpp @@ -194,7 +194,8 @@ wxWindow* wxFindWindowAtPoint(const wxPoint& pt) // subprocess routines // ---------------------------------------------------------------------------- -extern "C" +extern "C" { +static void GTK_EndProcessDetector(gpointer data, gint source, GdkInputCondition WXUNUSED(condition) ) { @@ -225,6 +226,7 @@ void GTK_EndProcessDetector(gpointer data, gint source, wxHandleProcessTermination(proc_data); } +} int wxAddProcessCallback(wxEndProcessData *proc_data, int fd) { diff --git a/src/gtk1/window.cpp b/src/gtk1/window.cpp index b4f55985b8..8ebb7b5e4b 100644 --- a/src/gtk1/window.cpp +++ b/src/gtk1/window.cpp @@ -379,7 +379,7 @@ static void draw_frame( GtkWidget *widget, wxWindowGTK *win ) dh += hscroll_req.height; dh += scroll_class->scrollbar_spacing; } -} + } int dx = 0; int dy = 0; @@ -429,7 +429,8 @@ static void draw_frame( GtkWidget *widget, wxWindowGTK *win ) // "expose_event" of m_widget //----------------------------------------------------------------------------- -gint gtk_window_own_expose_callback( GtkWidget *widget, GdkEventExpose *gdk_event, wxWindowGTK *win ) +extern "C" { +static gint gtk_window_own_expose_callback( GtkWidget *widget, GdkEventExpose *gdk_event, wxWindowGTK *win ) { if (gdk_event->count > 0) return FALSE; @@ -442,6 +443,7 @@ gint gtk_window_own_expose_callback( GtkWidget *widget, GdkEventExpose *gdk_even #endif return TRUE; } +} //----------------------------------------------------------------------------- // "draw" of m_widget @@ -449,10 +451,12 @@ gint gtk_window_own_expose_callback( GtkWidget *widget, GdkEventExpose *gdk_even #ifndef __WXGTK20__ +extern "C" { static void gtk_window_own_draw_callback( GtkWidget *widget, GdkRectangle *WXUNUSED(rect), wxWindowGTK *win ) { draw_frame( widget, win ); } +} #endif // GTK+ < 2.0 @@ -460,8 +464,8 @@ static void gtk_window_own_draw_callback( GtkWidget *widget, GdkRectangle *WXUNU // "size_request" of m_widget //----------------------------------------------------------------------------- -// make it extern because wxStatitText needs to disconnect this one -extern "C" +// make it extern because wxStaticText needs to disconnect this one +extern "C" { void wxgtk_window_size_request_callback(GtkWidget *widget, GtkRequisition *requisition, wxWindow *win) @@ -476,9 +480,10 @@ void wxgtk_window_size_request_callback(GtkWidget *widget, requisition->height = h; requisition->width = w; } +} - -extern "C" +extern "C" { +static void wxgtk_combo_size_request_callback(GtkWidget *widget, GtkRequisition *requisition, wxComboBox *win) @@ -504,11 +509,13 @@ void wxgtk_combo_size_request_callback(GtkWidget *widget, requisition->width = w - entry_req.width; requisition->height = entry_req.height+4; // TODO: why +4? } +} //----------------------------------------------------------------------------- // "expose_event" of m_wxwindow //----------------------------------------------------------------------------- +extern "C" { static int gtk_window_expose_callback( GtkWidget *widget, GdkEventExpose *gdk_event, wxWindow *win ) @@ -578,6 +585,7 @@ static int gtk_window_expose_callback( GtkWidget *widget, return FALSE; } +} //----------------------------------------------------------------------------- // "event" of m_wxwindow @@ -589,6 +597,8 @@ static int gtk_window_expose_callback( GtkWidget *widget, // There, we look for expose events ourselves whereas all other events are // handled normally. +extern "C" { +static gint gtk_window_event_event_callback( GtkWidget *widget, GdkEventExpose *event, wxWindow *win ) @@ -601,6 +611,7 @@ gint gtk_window_event_event_callback( GtkWidget *widget, return FALSE; } +} //----------------------------------------------------------------------------- // "draw" of m_wxwindow @@ -611,6 +622,7 @@ gint gtk_window_event_event_callback( GtkWidget *widget, // This callback is a complete replacement of the gtk_pizza_draw() function, // which is disabled. +extern "C" { static void gtk_window_draw_callback( GtkWidget *widget, GdkRectangle *rect, wxWindow *win ) @@ -686,6 +698,7 @@ static void gtk_window_draw_callback( GtkWidget *widget, } #endif } +} #endif @@ -1129,6 +1142,7 @@ struct wxGtkIMData }; #endif +extern "C" { static gint gtk_window_key_press_callback( GtkWidget *widget, GdkEventKey *gdk_event, wxWindow *win ) @@ -1389,8 +1403,10 @@ static gint gtk_window_key_press_callback( GtkWidget *widget, return FALSE; } +} #ifdef __WXGTK20__ +extern "C" { static void gtk_wxwindow_commit_cb (GtkIMContext *context, const gchar *str, wxWindow *window) @@ -1444,6 +1460,7 @@ static void gtk_wxwindow_commit_cb (GtkIMContext *context, } } } +} #endif @@ -1451,6 +1468,7 @@ static void gtk_wxwindow_commit_cb (GtkIMContext *context, // "key_release_event" from any window //----------------------------------------------------------------------------- +extern "C" { static gint gtk_window_key_release_callback( GtkWidget *widget, GdkEventKey *gdk_event, wxWindowGTK *win ) @@ -1479,6 +1497,7 @@ static gint gtk_window_key_release_callback( GtkWidget *widget, gtk_signal_emit_stop_by_name( GTK_OBJECT(widget), "key_release_event" ); return TRUE; } +} // ============================================================================ // the mouse events @@ -1622,6 +1641,7 @@ wxWindowGTK *FindWindowForMouseEvent(wxWindowGTK *win, wxCoord& x, wxCoord& y) // "button_press_event" //----------------------------------------------------------------------------- +extern "C" { static gint gtk_window_button_press_callback( GtkWidget *widget, GdkEventButton *gdk_event, wxWindowGTK *win ) @@ -1820,11 +1840,13 @@ static gint gtk_window_button_press_callback( GtkWidget *widget, return FALSE; } +} //----------------------------------------------------------------------------- // "button_release_event" //----------------------------------------------------------------------------- +extern "C" { static gint gtk_window_button_release_callback( GtkWidget *widget, GdkEventButton *gdk_event, wxWindowGTK *win ) @@ -1880,11 +1902,13 @@ static gint gtk_window_button_release_callback( GtkWidget *widget, return FALSE; } +} //----------------------------------------------------------------------------- // "motion_notify_event" //----------------------------------------------------------------------------- +extern "C" { static gint gtk_window_motion_notify_callback( GtkWidget *widget, GdkEventMotion *gdk_event, wxWindowGTK *win ) @@ -1954,15 +1978,17 @@ static gint gtk_window_motion_notify_callback( GtkWidget *widget, return FALSE; } +} #ifdef __WXGTK20__ //----------------------------------------------------------------------------- // "mouse_wheel_event" //----------------------------------------------------------------------------- +extern "C" { static gint gtk_window_wheel_callback (GtkWidget * widget, - GdkEventScroll * gdk_event, - wxWindowGTK * win) + GdkEventScroll * gdk_event, + wxWindowGTK * win) { DEBUG_MAIN_THREAD @@ -2010,10 +2036,12 @@ static gint gtk_window_wheel_callback (GtkWidget * widget, return FALSE; } +} //----------------------------------------------------------------------------- // "popup-menu" //----------------------------------------------------------------------------- +extern "C" { static gboolean wxgtk_window_popup_menu_callback(GtkWidget*, wxWindowGTK* win) { wxContextMenuEvent event( @@ -2023,6 +2051,7 @@ static gboolean wxgtk_window_popup_menu_callback(GtkWidget*, wxWindowGTK* win) event.SetEventObject(win); return win->GetEventHandler()->ProcessEvent(event); } +} #endif // __WXGTK20__ //----------------------------------------------------------------------------- @@ -2044,6 +2073,7 @@ static bool DoSendFocusEvents(wxWindow *win) return win->GetEventHandler()->ProcessEvent(eventFocus); } +extern "C" { static gint gtk_window_focus_in_callback( GtkWidget *widget, GdkEvent *WXUNUSED(event), wxWindow *win ) @@ -2093,11 +2123,13 @@ static gint gtk_window_focus_in_callback( GtkWidget *widget, return FALSE; } +} //----------------------------------------------------------------------------- // "focus_out_event" //----------------------------------------------------------------------------- +extern "C" { static gint gtk_window_focus_out_callback( GtkWidget *widget, GdkEventFocus *gdk_event, wxWindowGTK *win ) { DEBUG_MAIN_THREAD @@ -2152,11 +2184,13 @@ static gint gtk_window_focus_out_callback( GtkWidget *widget, GdkEventFocus *gdk return FALSE; } +} //----------------------------------------------------------------------------- // "enter_notify_event" //----------------------------------------------------------------------------- +extern "C" { static gint gtk_window_enter_callback( GtkWidget *widget, GdkEventCrossing *gdk_event, @@ -2195,11 +2229,13 @@ gint gtk_window_enter_callback( GtkWidget *widget, return FALSE; } +} //----------------------------------------------------------------------------- // "leave_notify_event" //----------------------------------------------------------------------------- +extern "C" { static gint gtk_window_leave_callback( GtkWidget *widget, GdkEventCrossing *gdk_event, wxWindowGTK *win ) { DEBUG_MAIN_THREAD @@ -2245,11 +2281,13 @@ static gint gtk_window_leave_callback( GtkWidget *widget, GdkEventCrossing *gdk_ return FALSE; } +} //----------------------------------------------------------------------------- // "value_changed" from m_vAdjust //----------------------------------------------------------------------------- +extern "C" { static void gtk_window_vscroll_callback( GtkAdjustment *adjust, SCROLLBAR_CBACK_ARG wxWindowGTK *win ) @@ -2279,11 +2317,13 @@ static void gtk_window_vscroll_callback( GtkAdjustment *adjust, event.SetEventObject( win ); win->GetEventHandler()->ProcessEvent( event ); } +} //----------------------------------------------------------------------------- // "value_changed" from m_hAdjust //----------------------------------------------------------------------------- +extern "C" { static void gtk_window_hscroll_callback( GtkAdjustment *adjust, SCROLLBAR_CBACK_ARG wxWindowGTK *win ) @@ -2312,11 +2352,13 @@ static void gtk_window_hscroll_callback( GtkAdjustment *adjust, event.SetEventObject( win ); win->GetEventHandler()->ProcessEvent( event ); } +} //----------------------------------------------------------------------------- // "button_press_event" from scrollbar //----------------------------------------------------------------------------- +extern "C" { static gint gtk_scrollbar_button_press_callback( GtkRange *widget, GdkEventButton *gdk_event, wxWindowGTK *win) @@ -2336,11 +2378,13 @@ static gint gtk_scrollbar_button_press_callback( GtkRange *widget, return FALSE; } +} //----------------------------------------------------------------------------- // "button_release_event" from scrollbar //----------------------------------------------------------------------------- +extern "C" { static gint gtk_scrollbar_button_release_callback( GtkRange *widget, GdkEventButton *WXUNUSED(gdk_event), wxWindowGTK *win) @@ -2381,6 +2425,7 @@ static gint gtk_scrollbar_button_release_callback( GtkRange *widget, return FALSE; } +} // ---------------------------------------------------------------------------- // this wxWindowBase function is implemented here (in platform-specific file) @@ -2393,7 +2438,6 @@ wxWindow *wxWindowBase::DoFindFocus() return (wxWindow *)g_focusWindow; } - //----------------------------------------------------------------------------- // "realize" from m_widget //----------------------------------------------------------------------------- @@ -2401,6 +2445,7 @@ wxWindow *wxWindowBase::DoFindFocus() /* We cannot set colours and fonts before the widget has been realized, so we do this directly after realization. */ +extern "C" { static gint gtk_window_realized_callback( GtkWidget *m_widget, wxWindow *win ) { @@ -2424,11 +2469,13 @@ gtk_window_realized_callback( GtkWidget *m_widget, wxWindow *win ) return FALSE; } +} //----------------------------------------------------------------------------- // "size_allocate" //----------------------------------------------------------------------------- +extern "C" { static void gtk_window_size_callback( GtkWidget *WXUNUSED(widget), GtkAllocation *WXUNUSED(alloc), @@ -2455,6 +2502,7 @@ void gtk_window_size_callback( GtkWidget *WXUNUSED(widget), win->GetEventHandler()->ProcessEvent( event ); } } +} #ifdef HAVE_XIM @@ -2465,6 +2513,7 @@ void gtk_window_size_callback( GtkWidget *WXUNUSED(widget), /* Resize XIM window */ +extern "C" { static void gtk_wxwindow_size_callback( GtkWidget* WXUNUSED_UNLESS_XIM(widget), GtkAllocation* WXUNUSED_UNLESS_XIM(alloc), @@ -2488,6 +2537,7 @@ void gtk_wxwindow_size_callback( GtkWidget* WXUNUSED_UNLESS_XIM(widget), } #endif // HAVE_XIM } +} //----------------------------------------------------------------------------- // "realize" from m_wxwindow @@ -2495,6 +2545,7 @@ void gtk_wxwindow_size_callback( GtkWidget* WXUNUSED_UNLESS_XIM(widget), /* Initialize XIM support */ +extern "C" { static gint gtk_wxwindow_realized_callback( GtkWidget * WXUNUSED_UNLESS_XIM(widget), wxWindowGTK * WXUNUSED_UNLESS_XIM(win) ) @@ -2581,6 +2632,7 @@ gtk_wxwindow_realized_callback( GtkWidget * WXUNUSED_UNLESS_XIM(widget), return FALSE; } +} //----------------------------------------------------------------------------- // InsertChild for wxWindowGTK. diff --git a/src/unix/utilsx11.cpp b/src/unix/utilsx11.cpp index 012b53114e..ec9e3cb1f6 100644 --- a/src/unix/utilsx11.cpp +++ b/src/unix/utilsx11.cpp @@ -65,12 +65,15 @@ static bool IsMapped(Display *display, Window window) // Suspends X11 errors. Used when we expect errors but they are not fatal // for us. +extern "C" { + static int wxX11ErrorsSuspender_handler(Display*, XErrorEvent*) { return 0; } +} class wxX11ErrorsSuspender { public: wxX11ErrorsSuspender(Display *d) : m_display(d) { - m_old = XSetErrorHandler(handler); + m_old = XSetErrorHandler(wxX11ErrorsSuspender_handler); } ~wxX11ErrorsSuspender() { @@ -81,7 +84,6 @@ public: private: Display *m_display; int (*m_old)(Display*, XErrorEvent *); - static int handler(Display *, XErrorEvent *) { return 0; } }; diff --git a/src/xml/xml.cpp b/src/xml/xml.cpp index 079b6b46fb..6d7f33c7ff 100644 --- a/src/xml/xml.cpp +++ b/src/xml/xml.cpp @@ -385,6 +385,7 @@ struct wxXmlParsingContext wxString version; }; +extern "C" { static void StartElementHnd(void *userData, const char *name, const char **atts) { wxXmlParsingContext *ctx = (wxXmlParsingContext*)userData; @@ -402,7 +403,9 @@ static void StartElementHnd(void *userData, const char *name, const char **atts) ctx->node = node; ctx->lastAsText = NULL; } +} +extern "C" { static void EndElementHnd(void *userData, const char* WXUNUSED(name)) { wxXmlParsingContext *ctx = (wxXmlParsingContext*)userData; @@ -410,7 +413,9 @@ static void EndElementHnd(void *userData, const char* WXUNUSED(name)) ctx->node = ctx->node->GetParent(); ctx->lastAsText = NULL; } +} +extern "C" { static void TextHnd(void *userData, const char *s, int len) { wxXmlParsingContext *ctx = (wxXmlParsingContext*)userData; @@ -443,7 +448,9 @@ static void TextHnd(void *userData, const char *s, int len) delete[] buf; } +} +extern "C" { static void CommentHnd(void *userData, const char *data) { wxXmlParsingContext *ctx = (wxXmlParsingContext*)userData; @@ -458,7 +465,9 @@ static void CommentHnd(void *userData, const char *data) } ctx->lastAsText = NULL; } +} +extern "C" { static void DefaultHnd(void *userData, const char *s, int len) { // XML header: @@ -476,7 +485,9 @@ static void DefaultHnd(void *userData, const char *s, int len) ctx->version = buf.Mid(pos + 9).BeforeFirst(buf[(size_t)pos+8]); } } +} +extern "C" { static int UnknownEncodingHnd(void * WXUNUSED(encodingHandlerData), const XML_Char *name, XML_Encoding *info) { @@ -508,6 +519,7 @@ static int UnknownEncodingHnd(void * WXUNUSED(encodingHandlerData), return 1; } +} bool wxXmlDocument::Load(wxInputStream& stream, const wxString& encoding) { -- 2.45.2