RE: [gtk-list] pixmap engine question



I did something like what you say (if i understood you correctly)
you must (ok it's not like you must, but I didn't find a simpler way)
use GdkImlibImage *object...
you do something like this :


GtkWidget *gtk_button_scaled(gchar *file)
{
    GdkImlibImage *image;
    GtkWidget *button;

    g_return_val_if_fail(file, NULL);
    g_return_val_if_fail(strlen(file), NULL);

    image=gdk_imlib_load_image(file);
    g_return_val_if_fail(image, NULL);

    button=gtk_button_new();
    /* here is the trick.. you scale the image like you want */
    gdk_imlib_render(image, 32, 32);
    /* something better would be obviously to get to know
    the needed size according to, for instance the button container,
    or anything.. but this gets too much for the present purpose, so
    I'll be lazy and use fixed values :-) */
    gtk_container_add(GTK_CONTAINER(button),
        gttk_pixmap_new(
            gdk_imlib_move_image(image),
            gdk_imlib_move_mask(image)));

    return(button);
}

Ok.. this is not a "by the allmighty power of copy-paste..." feature,
so the code probably won't even compile, but it should be enough for you
to get to what you want (I hope) :)

hope this helps..
cheers

Olivier.


-----Mensaje original-----
De: Paul Barton-Davis <pbd@Op.Net>
Para: gtk-list@redhat.com <gtk-list@redhat.com>
Fecha: Miércoles, 02 de Febrero de 2000 10:59 p.m.
Asunto: [gtk-list] pixmap engine question


>how can i get the pixmap engine to use a whole image file for a
>button, rather than what it appears to be doing, which is to grab just
>that part of it needed to draw a non-pixmapped button ?
>
>my buttons are X by Y pixels, and they should always be that big. can
>i do this ?
>
>--p
>
>
>--
>To unsubscribe: mail -s unsubscribe gtk-list-request@redhat.com < /dev/null



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]