зеркало из https://github.com/mozilla/gecko-dev.git
Fix radio and check buttons some more. There are still some issues with
the default values for radio buttons being off by one.
This commit is contained in:
Родитель
aeede0b983
Коммит
b73617d5d1
|
@ -114,8 +114,12 @@ nsresult nsCheckButton::QueryInterface(const nsIID& aIID, void** aInstancePtr)
|
|||
//-------------------------------------------------------------------------
|
||||
NS_METHOD nsCheckButton::SetState(const PRBool aState)
|
||||
{
|
||||
// printf("nsCheckButton::SetState(%p,%d)\n",this,aState);
|
||||
gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(mCheckButton), aState);
|
||||
GtkToggleButton * item = GTK_TOGGLE_BUTTON(mCheckButton);
|
||||
|
||||
item->active = (gboolean) aState;
|
||||
|
||||
gtk_widget_queue_draw(GTK_WIDGET(item));
|
||||
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
|
@ -126,8 +130,12 @@ NS_METHOD nsCheckButton::SetState(const PRBool aState)
|
|||
//-------------------------------------------------------------------------
|
||||
NS_METHOD nsCheckButton::GetState(PRBool& aState)
|
||||
{
|
||||
gint state = GTK_TOGGLE_BUTTON(mCheckButton)->active;
|
||||
aState = state;
|
||||
aState = (PRBool) GTK_TOGGLE_BUTTON(mCheckButton)->active;
|
||||
|
||||
// The check button will have been toggled twice (cough) -
|
||||
// once by GTK and once by gecko. This is obviously messed up.
|
||||
aState = !aState;
|
||||
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
|
|
|
@ -88,10 +88,10 @@ NS_METHOD nsRadioButton::CreateNative(GtkWidget *parentWindow)
|
|||
|
||||
gtk_widget_show(mRadioButton);
|
||||
|
||||
SetState(PR_FALSE);
|
||||
|
||||
gtk_widget_set_name(mRadioButton, "nsRadioButton");
|
||||
|
||||
gtk_radio_button_set_group(GTK_RADIO_BUTTON(mRadioButton), NULL);
|
||||
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
|
@ -113,7 +113,6 @@ void nsRadioButton::InitCallbacks(char * aName)
|
|||
GDK_POINTER_MOTION_MASK);
|
||||
}
|
||||
|
||||
|
||||
//-------------------------------------------------------------------------
|
||||
//
|
||||
// Set this button label
|
||||
|
@ -121,8 +120,12 @@ void nsRadioButton::InitCallbacks(char * aName)
|
|||
//-------------------------------------------------------------------------
|
||||
NS_METHOD nsRadioButton::SetState(const PRBool aState)
|
||||
{
|
||||
// printf("nsRadioButton::SetState(%p,%d)\n",this,aState);
|
||||
gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(mRadioButton), aState);
|
||||
GtkToggleButton * item = GTK_TOGGLE_BUTTON(mRadioButton);
|
||||
|
||||
item->active = (gboolean) aState;
|
||||
|
||||
gtk_widget_queue_draw(GTK_WIDGET(item));
|
||||
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
|
@ -132,8 +135,9 @@ NS_METHOD nsRadioButton::SetState(const PRBool aState)
|
|||
//-------------------------------------------------------------------------
|
||||
NS_METHOD nsRadioButton::GetState(PRBool& aState)
|
||||
{
|
||||
int state = GTK_TOGGLE_BUTTON(mRadioButton)->active;
|
||||
return state;
|
||||
aState = (PRBool) GTK_TOGGLE_BUTTON(mRadioButton)->active;
|
||||
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
//-------------------------------------------------------------------------
|
||||
|
|
Загрузка…
Ссылка в новой задаче