зеркало из https://github.com/mozilla/pjs.git
set the userdata for all of the widgets to 'this'. Use the userdata in the
callbacks in nsGtkEventHandler
This commit is contained in:
Родитель
96065666b9
Коммит
6f24004fe0
|
@ -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
|
||||
|
|
|
@ -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);
|
||||
|
||||
/*
|
||||
|
|
|
@ -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);
|
||||
nsCheckButton *checkBtn = (nsCheckButton*)gtk_object_get_user_data(GTK_OBJECT(w));
|
||||
if (GTK_TOGGLE_BUTTON(w)->active)
|
||||
checkBtn->Armed();
|
||||
#endif
|
||||
}
|
||||
|
||||
//==============================================================
|
||||
void nsGtkWidget_Toggle_DisArmCallback(GtkWidget *w, gpointer p, gpointer call_data)
|
||||
{
|
||||
#if 0
|
||||
nsCheckButton * checkBtn = (nsCheckButton *) p ;
|
||||
nsScrollbarEvent sevent;
|
||||
XmToggleButtonCallbackStruct * cbs = (XmToggleButtonCallbackStruct*)call_data;
|
||||
else
|
||||
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;
|
||||
|
|
|
@ -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
|
||||
|
||||
|
|
|
@ -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 */
|
||||
|
||||
/*
|
||||
|
|
|
@ -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("",
|
||||
|
|
|
@ -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);
|
||||
|
||||
/*
|
||||
|
|
|
@ -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);
|
||||
|
||||
/*
|
||||
|
|
|
@ -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",
|
||||
|
|
Загрузка…
Ссылка в новой задаче