diff --git a/widget/src/gtk/nsButton.cpp b/widget/src/gtk/nsButton.cpp index d7e4f1b3bf2..75b98e0c691 100644 --- a/widget/src/gtk/nsButton.cpp +++ b/widget/src/gtk/nsButton.cpp @@ -64,6 +64,7 @@ NS_METHOD nsButton::Create(nsIWidget *aParent, gtk_layout_put(GTK_LAYOUT(parentWidget), mWidget, aRect.x, aRect.y); gtk_widget_set_usize(mWidget, aRect.width, aRect.height); + gtk_object_set_user_data(GTK_OBJECT(mWidget), this); gtk_widget_show(mWidget); // save the event callback function diff --git a/widget/src/gtk/nsCheckButton.cpp b/widget/src/gtk/nsCheckButton.cpp index 05d00f7575e..bfe3bcb268c 100644 --- a/widget/src/gtk/nsCheckButton.cpp +++ b/widget/src/gtk/nsCheckButton.cpp @@ -75,6 +75,7 @@ NS_METHOD nsCheckButton::Create(nsIWidget *aParent, gtk_layout_put(GTK_LAYOUT(parentWidget), mWidget, aRect.x, aRect.y); gtk_widget_set_usize(mWidget, aRect.width, aRect.height); + gtk_object_set_user_data(GTK_OBJECT(mWidget), this); gtk_widget_show(mWidget); /* diff --git a/widget/src/gtk/nsGtkEventHandler.cpp b/widget/src/gtk/nsGtkEventHandler.cpp index 6ea833fb235..b49db6f9124 100644 --- a/widget/src/gtk/nsGtkEventHandler.cpp +++ b/widget/src/gtk/nsGtkEventHandler.cpp @@ -314,8 +314,9 @@ void nsGtkWidget_LeaveMask_EventHandler(GtkWidget *w, GdkEvent * event, gpointer } //============================================================== -void nsGtkWidget_Focus_Callback(GtkWidget *w, gpointer p, gpointer call_data) +void nsGtkWidget_Focus_Callback(GtkWidget *w, gpointer p) { + nsWindow *widgetWindow = (nsWindow*)gtk_object_get_user_data(GTK_OBJECT(w)); #if 0 nsWindow * widgetWindow = (nsWindow *) p ; @@ -328,8 +329,9 @@ void nsGtkWidget_Focus_Callback(GtkWidget *w, gpointer p, gpointer call_data) } //============================================================== -void nsGtkWidget_Toggle_Callback(GtkWidget *w, gpointer p, gpointer call_data) +void nsGtkWidget_Toggle_Callback(GtkWidget *w, gpointer p) { + nsWindow *widgetWindow = (nsWindow*)gtk_object_get_user_data(GTK_OBJECT(w)); #if 0 nsWindow * widgetWindow = (nsWindow *) p ; if (DBG) fprintf(stderr, "***************** nsGtkWidget_Scrollbar_Callback\n"); @@ -340,32 +342,19 @@ void nsGtkWidget_Toggle_Callback(GtkWidget *w, gpointer p, gpointer call_data) } //============================================================== -void nsGtkWidget_Toggle_ArmCallback(GtkWidget *w, gpointer p, gpointer call_data) +void CheckButton_Toggle_Callback(GtkWidget *w, gpointer p) { -#if 0 - nsCheckButton * checkBtn = (nsCheckButton *) p ; - - XmToggleButtonCallbackStruct * cbs = (XmToggleButtonCallbackStruct*)call_data; - - if (DBG) fprintf(stderr, "Callback struct 0x%x\n", cbs);fflush(stderr); - checkBtn->Armed(); -#endif + nsCheckButton *checkBtn = (nsCheckButton*)gtk_object_get_user_data(GTK_OBJECT(w)); + if (GTK_TOGGLE_BUTTON(w)->active) + checkBtn->Armed(); + else + checkBtn->DisArmed(); } //============================================================== -void nsGtkWidget_Toggle_DisArmCallback(GtkWidget *w, gpointer p, gpointer call_data) -{ -#if 0 - nsCheckButton * checkBtn = (nsCheckButton *) p ; - nsScrollbarEvent sevent; - XmToggleButtonCallbackStruct * cbs = (XmToggleButtonCallbackStruct*)call_data; - checkBtn->DisArmed(); -#endif -} - -//============================================================== -void nsGtkWidget_RadioButton_ArmCallback(GtkWidget *w, gpointer p, gpointer call_data) +void nsGtkWidget_RadioButton_ArmCallback(GtkWidget *w, gpointer p) { + nsWindow *widgetWindow = (nsWindow*)gtk_object_get_user_data(GTK_OBJECT(w)); #if 0 nsRadioButton * radioBtn = (nsRadioButton *) p ; XmToggleButtonCallbackStruct * cbs = (XmToggleButtonCallbackStruct*)call_data; @@ -377,8 +366,9 @@ void nsGtkWidget_RadioButton_ArmCallback(GtkWidget *w, gpointer p, gpointer call } //============================================================== -void nsGtkWidget_RadioButton_DisArmCallback(GtkWidget *w, gpointer p, gpointer call_data) +void nsGtkWidget_RadioButton_DisArmCallback(GtkWidget *w, gpointer p) { + nsWindow *widgetWindow = (nsWindow*)gtk_object_get_user_data(GTK_OBJECT(w)); #if 0 nsRadioButton * radioBtn = (nsRadioButton *) p ; nsScrollbarEvent sevent; @@ -392,8 +382,9 @@ void nsGtkWidget_RadioButton_DisArmCallback(GtkWidget *w, gpointer p, gpointer c //============================================================== -void nsGtkWidget_Scrollbar_Callback(GtkWidget *w, gpointer p, gpointer call_data) +void nsGtkWidget_Scrollbar_Callback(GtkWidget *w, gpointer p) { + nsWindow *widgetWindow = (nsWindow*)gtk_object_get_user_data(GTK_OBJECT(w)); #if 0 nsWindow * widgetWindow = (nsWindow *) p ; nsScrollbarEvent sevent; @@ -444,8 +435,9 @@ void nsGtkWidget_Scrollbar_Callback(GtkWidget *w, gpointer p, gpointer call_data //============================================================== -void nsGtkWidget_Expose_Callback(GtkWidget *w, gpointer p, gpointer call_data) +void nsGtkWidget_Expose_Callback(GtkWidget *w, gpointer p) { + nsWindow *widgetWindow = (nsWindow*)gtk_object_get_user_data(GTK_OBJECT(w)); #if 0 nsWindow * widgetWindow = (nsWindow *) p ; if (widgetWindow == nsnull) { @@ -463,13 +455,14 @@ void nsGtkWidget_Expose_Callback(GtkWidget *w, gpointer p, gpointer call_data) } //============================================================== -void nsGtkWidget_Resize_Callback(GtkWidget *w, gpointer p, gpointer call_data) +void nsGtkWidget_Resize_Callback(GtkWidget *w, gpointer p) { } //============================================================== -void nsGtkWidget_Text_Callback(GtkWidget *w, gpointer p, gpointer call_data) +void nsGtkWidget_Text_Callback(GtkWidget *w, gpointer p) { + nsWindow *widgetWindow = (nsWindow*)gtk_object_get_user_data(GTK_OBJECT(w)); #if 0 nsWindow * widgetWindow = (nsWindow *) p ; int len; @@ -509,6 +502,7 @@ void nsGtkWidget_Text_Callback(GtkWidget *w, gpointer p, gpointer call_data) //============================================================== void nsGtkWidget_FSBCancel_Callback(GtkWidget *w, gpointer p) { + nsWindow *widgetWindow = (nsWindow*)gtk_object_get_user_data(GTK_OBJECT(w)); #if 0 nsFileWidget * widgetWindow = (nsFileWidget *) p ; if (p != nsnull) { @@ -520,6 +514,7 @@ void nsGtkWidget_FSBCancel_Callback(GtkWidget *w, gpointer p) //============================================================== void nsGtkWidget_FSBOk_Callback(GtkWidget *w, gpointer p) { + nsWindow *widgetWindow = (nsWindow*)gtk_object_get_user_data(GTK_OBJECT(w)); #if 0 nsFileWidget * widgetWindow = (nsFileWidget *) p; if (p != nsnull) { @@ -584,7 +579,7 @@ void nsGtkWidget_ResetResize_Callback(gpointer call_data) } //============================================================== -void nsGtkWidget_Menu_Callback(GtkWidget *w, gpointer p, gpointer call_data) +void nsGtkWidget_Menu_Callback(GtkWidget *w, gpointer p) { #if 0 nsIMenuItem * menuItem = (nsIMenuItem *)p; diff --git a/widget/src/gtk/nsGtkEventHandler.h b/widget/src/gtk/nsGtkEventHandler.h index 465f47be74f..3ec53daf52c 100644 --- a/widget/src/gtk/nsGtkEventHandler.h +++ b/widget/src/gtk/nsGtkEventHandler.h @@ -36,27 +36,27 @@ void nsGtkWidget_EnterMask_EventHandler(GtkWidget *w, GdkEvent * event, gpointer void nsGtkWidget_LeaveMask_EventHandler(GtkWidget *w, GdkEvent * event, gpointer p); //---------------------------------------------------- -void nsGtkWidget_FSBCancel_Callback(GtkWidget *w, gpointer p, gpointer call_data); -void nsGtkWidget_FSBOk_Callback(GtkWidget *w, gpointer p, gpointer call_data); +void nsGtkWidget_FSBCancel_Callback(GtkWidget *w, gpointer p); +void nsGtkWidget_FSBOk_Callback(GtkWidget *w, gpointer p); //---------------------------------------------------- -void nsGtkWidget_Focus_Callback(GtkWidget *w, gpointer p, gpointer call_data); -void nsGtkWidget_Scrollbar_Callback(GtkWidget *w, gpointer p, gpointer call_data); -void nsGtkWidget_Toggle_Callback(GtkWidget *w, gpointer p, gpointer call_data); -void nsGtkWidget_Toggle_ArmCallback(GtkWidget *w, gpointer p, gpointer call_data); -void nsGtkWidget_Toggle_DisArmCallback(GtkWidget *w, gpointer p, gpointer call_data); -void nsGtkWidget_RadioButton_ArmCallback(GtkWidget *w, gpointer p, gpointer call_data); -void nsGtkWidget_RadioButton_DisArmCallback(GtkWidget *w, gpointer p, gpointer call_data); +void nsGtkWidget_Focus_Callback(GtkWidget *w, gpointer p); +void nsGtkWidget_Scrollbar_Callback(GtkWidget *w, gpointer p); -void nsGtkWidget_Text_Callback(GtkWidget *w, gpointer p, gpointer call_data); -void nsGtkWidget_Resize_Callback(GtkWidget *w, gpointer p, gpointer call_data); -void nsGtkWidget_Expose_Callback(GtkWidget *w, gpointer p, gpointer call_data); +void CheckButton_Toggle_Callback(GtkWidget *w, gpointer p); + +void nsGtkWidget_RadioButton_ArmCallback(GtkWidget *w, gpointer p); +void nsGtkWidget_RadioButton_DisArmCallback(GtkWidget *w, gpointer p); + +void nsGtkWidget_Text_Callback(GtkWidget *w, gpointer p); +void nsGtkWidget_Resize_Callback(GtkWidget *w, gpointer p); +void nsGtkWidget_Expose_Callback(GtkWidget *w, gpointer p); void nsGtkWidget_Refresh_Callback(gpointer call_data); void nsGtkWidget_ResetResize_Callback(gpointer call_data); -void nsGtkWidget_Menu_Callback(GtkWidget *w, gpointer p, gpointer call_data); +void nsGtkWidget_Menu_Callback(GtkWidget *w, gpointer p); #endif // __nsXtEventHandler.h diff --git a/widget/src/gtk/nsLabel.cpp b/widget/src/gtk/nsLabel.cpp index 6d7b07d0443..a3936482864 100644 --- a/widget/src/gtk/nsLabel.cpp +++ b/widget/src/gtk/nsLabel.cpp @@ -66,11 +66,15 @@ NS_METHOD nsLabel::Create(nsIWidget *aParent, unsigned char alignment = GetNativeAlignment(); mWidget = gtk_label_new(""); - gtk_widget_show(mWidget); + // gtk_misc_set_alignment(GTK_MISC(mWidget), alignment); + gtk_widget_set_usize(GTK_WIDGET(mWidget), aRect.width, aRect.height); gtk_layout_put(GTK_LAYOUT(aParent), mWidget, aRect.x, aRect.y); + gtk_object_set_user_data(GTK_OBJECT(mWidget), this); + gtk_widget_show(mWidget); + /* we need add this to the parent, and set its width, etc */ /* diff --git a/widget/src/gtk/nsListBox.cpp b/widget/src/gtk/nsListBox.cpp index 6e454cf9cdd..41cd7844b54 100644 --- a/widget/src/gtk/nsListBox.cpp +++ b/widget/src/gtk/nsListBox.cpp @@ -369,6 +369,7 @@ NS_METHOD nsListBox::Create(nsIWidget *aParent, gtk_layout_put(GTK_LAYOUT(parentWidget), scrolled_win, aRect.x, aRect.y); gtk_widget_set_usize(scrolled_win, aRect.width, aRect.height); + gtk_object_set_user_data(GTK_OBJECT(mWidget), this); gtk_widget_show_all(scrolled_win); /* mWidget = ::XtVaCreateManagedWidget("", diff --git a/widget/src/gtk/nsRadioButton.cpp b/widget/src/gtk/nsRadioButton.cpp index 83f6594b8e9..6e5ad085094 100644 --- a/widget/src/gtk/nsRadioButton.cpp +++ b/widget/src/gtk/nsRadioButton.cpp @@ -102,6 +102,7 @@ NS_METHOD nsRadioButton::Create(nsIWidget *aParent, gtk_layout_put(GTK_LAYOUT(parentWidget), mWidget, aRect.x, aRect.y); gtk_widget_set_usize(mWidget, aRect.width, aRect.height); + gtk_object_set_user_data(GTK_OBJECT(mWidget), this); gtk_widget_show(mWidget); /* diff --git a/widget/src/gtk/nsTextAreaWidget.cpp b/widget/src/gtk/nsTextAreaWidget.cpp index a4f319d7f1f..cea3df0cd5d 100644 --- a/widget/src/gtk/nsTextAreaWidget.cpp +++ b/widget/src/gtk/nsTextAreaWidget.cpp @@ -80,6 +80,7 @@ NS_METHOD nsTextAreaWidget::Create(nsIWidget *aParent, gtk_layout_put(GTK_LAYOUT(parentWidget), mWidget, aRect.x, aRect.y); gtk_widget_set_usize(mWidget, aRect.width, aRect.height); + gtk_object_set_user_data(GTK_OBJECT(mWidget), this); gtk_widget_show(mWidget); /* diff --git a/widget/src/gtk/nsTextWidget.cpp b/widget/src/gtk/nsTextWidget.cpp index 4d84e2bcb1f..5640ad6a411 100644 --- a/widget/src/gtk/nsTextWidget.cpp +++ b/widget/src/gtk/nsTextWidget.cpp @@ -82,6 +82,7 @@ NS_METHOD nsTextWidget::Create(nsIWidget *aParent, gtk_layout_put(GTK_LAYOUT(parentWidget), mWidget, aRect.x, aRect.y); gtk_widget_set_usize(mWidget, aRect.width, aRect.height); + gtk_object_set_user_data(GTK_OBJECT(mWidget), this); gtk_widget_show(mWidget); /* mWidget = ::XtVaCreateManagedWidget("button",