示例#1
0
文件: toolpalette.c 项目: 3v1n0/gtk
static CanvasItem*
canvas_item_new (GtkWidget     *widget,
                 GtkToolButton *button,
                 gdouble        x,
                 gdouble        y)
{
  CanvasItem *item = NULL;
  const gchar *icon_name;
  GdkPixbuf *pixbuf;
  GtkIconTheme *icon_theme;
  int width;

  icon_name = gtk_tool_button_get_icon_name (button);
  icon_theme = gtk_icon_theme_get_for_screen (gtk_widget_get_screen (widget));
  gtk_icon_size_lookup (GTK_ICON_SIZE_DIALOG, &width, NULL);
  pixbuf = gtk_icon_theme_load_icon (icon_theme,
                                     icon_name,
                                     width,
                                     GTK_ICON_LOOKUP_GENERIC_FALLBACK,
                                     NULL);

  if (pixbuf)
    {
      item = g_slice_new0 (CanvasItem);
      item->pixbuf = pixbuf;
      item->x = x;
      item->y = y;
    }

  return item;
}
示例#2
0
/*#
    @method get_icon_name GtkToolButton
    @brief Returns the name of the themed icon for the tool button.
    @return the icon name or NULL if the tool button has no themed icon
 */
FALCON_FUNC ToolButton::get_icon_name( VMARG )
{
    NO_ARGS
    MYSELF;
    GET_OBJ( self );
    const gchar* ico = gtk_tool_button_get_icon_name( (GtkToolButton*)_obj );
    if ( ico )
        vm->retval( UTF8String( ico ) );
    else
        vm->retnil();
}