* 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 "config.h"
#include "gtktoggleaction.h"
#include "gtkactivatable.h"
#include "gtkprivate.h"
-#include "gtkalias.h"
+
+
+/**
+ * SECTION:gtktoggletoolbutton
+ * @Short_description: A GtkToolItem containing a toggle button
+ * @Title: GtkToggleToolButton
+ * @See_also: #GtkToolbar, #GtkToolButton, #GtkSeparatorToolItem
+ *
+ * A #GtkToggleToolButton is a #GtkToolItem that contains a toggle
+ * button.
+ *
+ * Use gtk_toggle_tool_button_new() to create a new
+ * #GtkToggleToolButton. Use gtk_toggle_tool_button_new_from_stock() to
+ * create a new #GtkToggleToolButton containing a stock item.
+ */
+
#define MENU_ID "gtk-toggle-tool-button-menu-id"
};
-#define GTK_TOGGLE_TOOL_BUTTON_GET_PRIVATE(obj) (G_TYPE_INSTANCE_GET_PRIVATE ((obj), GTK_TYPE_TOGGLE_TOOL_BUTTON, GtkToggleToolButtonPrivate))
-
struct _GtkToggleToolButtonPrivate
{
guint active : 1;
static void gtk_toggle_tool_button_activatable_interface_init (GtkActivatableIface *iface);
-static void gtk_toggle_tool_button_activatable_update (GtkActivatable *activatable,
+static void gtk_toggle_tool_button_update (GtkActivatable *activatable,
GtkAction *action,
const gchar *property_name);
-static void gtk_toggle_tool_button_activatable_reset (GtkActivatable *activatable,
+static void gtk_toggle_tool_button_sync_action_properties (GtkActivatable *activatable,
GtkAction *action);
static GtkActivatableIface *parent_activatable_iface;
/**
* GtkToggleToolButton:active:
*
- * If the toggle tool button should be pressed in or not.
+ * If the toggle tool button should be pressed in.
*
* Since: 2.8
*/
PROP_ACTIVE,
g_param_spec_boolean ("active",
P_("Active"),
- P_("If the toggle button should be pressed in or not"),
+ P_("If the toggle button should be pressed in"),
FALSE,
GTK_PARAM_READWRITE));
GtkToolButton *tool_button = GTK_TOOL_BUTTON (button);
GtkToggleButton *toggle_button = GTK_TOGGLE_BUTTON (_gtk_tool_button_get_button (tool_button));
- button->priv = GTK_TOGGLE_TOOL_BUTTON_GET_PRIVATE (button);
+ button->priv = G_TYPE_INSTANCE_GET_PRIVATE (button,
+ GTK_TYPE_TOGGLE_TOOL_BUTTON,
+ GtkToggleToolButtonPrivate);
/* If the real button is a radio button, it may have been
* active at the time it was created.
GtkStockItem stock_item;
gboolean use_mnemonic = TRUE;
const char *label;
+ GtkWidget *label_widget;
+ const gchar *label_text;
+ const gchar *stock_id;
+
+ if (_gtk_tool_item_create_menu_proxy (item))
+ return TRUE;
- GtkWidget *label_widget = gtk_tool_button_get_label_widget (tool_button);
- const gchar *label_text = gtk_tool_button_get_label (tool_button);
- const gchar *stock_id = gtk_tool_button_get_stock_id (tool_button);
+ label_widget = gtk_tool_button_get_label_widget (tool_button);
+ label_text = gtk_tool_button_get_label (tool_button);
+ stock_id = gtk_tool_button_get_stock_id (tool_button);
if (GTK_IS_LABEL (label_widget))
{
button_toggled (GtkWidget *widget,
GtkToggleToolButton *toggle_tool_button)
{
- gboolean toggle_active = GTK_TOGGLE_BUTTON (widget)->active;
+ gboolean toggle_active;
+
+ toggle_active = gtk_toggle_button_get_active (GTK_TOGGLE_BUTTON (widget));
if (toggle_tool_button->priv->active != toggle_active)
{
}
}
-static void
-gtk_toggle_tool_button_activatable_interface_init (GtkActivatableIface *iface)
+static void
+gtk_toggle_tool_button_activatable_interface_init (GtkActivatableIface *iface)
{
parent_activatable_iface = g_type_interface_peek_parent (iface);
- iface->update = gtk_toggle_tool_button_activatable_update;
- iface->reset = gtk_toggle_tool_button_activatable_reset;
+ iface->update = gtk_toggle_tool_button_update;
+ iface->sync_action_properties = gtk_toggle_tool_button_sync_action_properties;
}
static void
-gtk_toggle_tool_button_activatable_update (GtkActivatable *activatable,
- GtkAction *action,
- const gchar *property_name)
+gtk_toggle_tool_button_update (GtkActivatable *activatable,
+ GtkAction *action,
+ const gchar *property_name)
{
GtkToggleToolButton *button;
}
static void
-gtk_toggle_tool_button_activatable_reset (GtkActivatable *activatable,
- GtkAction *action)
+gtk_toggle_tool_button_sync_action_properties (GtkActivatable *activatable,
+ GtkAction *action)
{
GtkToggleToolButton *button;
- parent_activatable_iface->reset (activatable, action);
+ parent_activatable_iface->sync_action_properties (activatable, action);
- if (!action)
+ if (!GTK_IS_TOGGLE_ACTION (action))
return;
button = GTK_TOGGLE_TOOL_BUTTON (activatable);
return button->priv->active;
}
-
-#define __GTK_TOGGLE_TOOL_BUTTON_C__
-#include "gtkaliasdef.c"