* Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public
- * License along with this library; if not, write to the
- * Free Software Foundation, Inc., 59 Temple Place - Suite 330,
- * Boston, MA 02111-1307, USA.
+ * License along with this library. If not, see <http://www.gnu.org/licenses/>.
*/
/*
#include "gtkactivatable.h"
#include "gtkprivate.h"
#include "gtkintl.h"
+#include "a11y/gtktogglebuttonaccessible.h"
/**
*
* A toggle button is created by calling either gtk_toggle_button_new() or
* gtk_toggle_button_new_with_label(). If using the former, it is advisable to
- * pack a widget, (such as a #GtkLabel and/or a #GtkPixmap), into the toggle
+ * pack a widget, (such as a #GtkLabel and/or a #GtkImage), into the toggle
* button's container. (See #GtkButton for more information).
*
* The state of a #GtkToggleButton can be set specifically using
};
-static gint gtk_toggle_button_draw (GtkWidget *widget,
- cairo_t *cr);
static gboolean gtk_toggle_button_mnemonic_activate (GtkWidget *widget,
gboolean group_cycling);
static void gtk_toggle_button_pressed (GtkButton *button);
gobject_class->set_property = gtk_toggle_button_set_property;
gobject_class->get_property = gtk_toggle_button_get_property;
- widget_class->draw = gtk_toggle_button_draw;
widget_class->mnemonic_activate = gtk_toggle_button_mnemonic_activate;
button_class->pressed = gtk_toggle_button_pressed;
G_TYPE_NONE, 0);
g_type_class_add_private (class, sizeof (GtkToggleButtonPrivate));
+
+ gtk_widget_class_set_accessible_type (widget_class, GTK_TYPE_TOGGLE_BUTTON_ACCESSIBLE);
}
static void
* gtk_toggle_button_new_with_mnemonic:
* @label: the text of the button, with an underscore in front of the
* mnemonic character
- * @returns: a new #GtkToggleButton
*
* Creates a new #GtkToggleButton containing a label. The label
* will be created using gtk_label_new_with_mnemonic(), so underscores
* in @label indicate the mnemonic for the button.
- **/
+ *
+ * Returns: a new #GtkToggleButton
+ */
GtkWidget*
gtk_toggle_button_new_with_mnemonic (const gchar *label)
{
*
* Sets the status of the toggle button. Set to %TRUE if you want the
* GtkToggleButton to be 'pressed in', and %FALSE to raise it.
- * This action causes the toggled signal to be emitted.
+ * This action causes the #GtkToggleButton::toggled signal and the
+ * #GtkButton::clicked signal to be emitted.
*/
void
gtk_toggle_button_set_active (GtkToggleButton *toggle_button,
return toggle_button->priv->inconsistent;
}
-static gint
-gtk_toggle_button_draw (GtkWidget *widget,
- cairo_t *cr)
-{
- GtkToggleButton *toggle_button = GTK_TOGGLE_BUTTON (widget);
- GtkToggleButtonPrivate *priv = toggle_button->priv;
- GtkWidget *child = gtk_bin_get_child (GTK_BIN (widget));
- GtkButton *button = GTK_BUTTON (widget);
- GtkStateType state;
-
- state = gtk_widget_get_state_flags (widget);
-
- if (priv->inconsistent)
- state |= GTK_STATE_FLAG_INCONSISTENT;
- else if (button->priv->depressed)
- state |= GTK_STATE_FLAG_ACTIVE;
-
- _gtk_button_paint (button, cr,
- gtk_widget_get_allocated_width (widget),
- gtk_widget_get_allocated_height (widget),
- state);
-
- if (child)
- gtk_container_propagate_draw (GTK_CONTAINER (widget), child, cr);
-
- return FALSE;
-}
-
static gboolean
gtk_toggle_button_mnemonic_activate (GtkWidget *widget,
gboolean group_cycling)
{
GtkToggleButton *toggle_button = GTK_TOGGLE_BUTTON (button);
GtkToggleButtonPrivate *priv = toggle_button->priv;
- gboolean depressed, touchscreen;
+ gboolean depressed;
GtkStateFlags new_state = 0;
- g_object_get (gtk_widget_get_settings (GTK_WIDGET (button)),
- "gtk-touchscreen-mode", &touchscreen,
- NULL);
-
new_state = gtk_widget_get_state_flags (GTK_WIDGET (button)) &
~(GTK_STATE_FLAG_INCONSISTENT |
GTK_STATE_FLAG_PRELIGHT |
else
depressed = priv->active;
- if (!touchscreen && button->priv->in_button && (!button->priv->button_down || priv->draw_indicator))
+ if (button->priv->in_button)
new_state |= GTK_STATE_FLAG_PRELIGHT;
if (depressed)