static GtkWidget* ink_radio_action_create_tool_item( GtkAction* action ) { InkRadioAction* act = INK_RADIO_ACTION( action ); GtkWidget* item = GTK_RADIO_ACTION_CLASS(ink_radio_action_parent_class)->parent_class.parent_class.create_tool_item(action); if ( act->private_data->iconId ) { if ( GTK_IS_TOOL_BUTTON(item) ) { GtkToolButton* button = GTK_TOOL_BUTTON(item); GtkWidget* child = sp_icon_new( act->private_data->iconSize, act->private_data->iconId ); GtkWidget* align = gtk_alignment_new( 0.5, 0.5, 0.0, 0.0 ); gtk_container_add( GTK_CONTAINER(align), child ); gtk_tool_button_set_icon_widget( button, align ); } else { // For now trigger a warning but don't do anything else GtkToolButton* button = GTK_TOOL_BUTTON(item); (void)button; } } // TODO investigate if needed gtk_widget_show_all( item ); return item; }
static void ink_radio_action_class_init( InkRadioActionClass* klass ) { if ( klass ) { gInkRadioActionParentClass = GTK_RADIO_ACTION_CLASS( g_type_class_peek_parent( klass ) ); GObjectClass * objClass = G_OBJECT_CLASS( klass ); objClass->finalize = ink_radio_action_finalize; objClass->get_property = ink_radio_action_get_property; objClass->set_property = ink_radio_action_set_property; klass->parent_class.parent_class.parent_class.create_menu_item = ink_radio_action_create_menu_item; klass->parent_class.parent_class.parent_class.create_tool_item = ink_radio_action_create_tool_item; /*klass->parent_class.connect_proxy = connect_proxy;*/ /*klass->parent_class.disconnect_proxy = disconnect_proxy;*/ g_object_class_install_property( objClass, PROP_INK_ID, g_param_spec_string( "iconId", "Icon ID", "The id for the icon", "", (GParamFlags)(G_PARAM_READABLE | G_PARAM_WRITABLE | G_PARAM_CONSTRUCT) ) ); g_object_class_install_property( objClass, PROP_INK_SIZE, g_param_spec_int( "iconSize", "Icon Size", "The size the icon", (int)Inkscape::ICON_SIZE_MENU, (int)Inkscape::ICON_SIZE_DECORATION, (int)Inkscape::ICON_SIZE_SMALL_TOOLBAR, (GParamFlags)(G_PARAM_READABLE | G_PARAM_WRITABLE | G_PARAM_CONSTRUCT) ) ); g_type_class_add_private( klass, sizeof(InkRadioActionClass) ); } }
static GtkWidget* ink_radio_action_create_menu_item( GtkAction* action ) { GtkWidget* item = GTK_RADIO_ACTION_CLASS(ink_radio_action_parent_class)->parent_class.parent_class.create_menu_item(action); return item; }