Re: [gtk-list] Re: Iconns and DnD?



On Mon, Jun 01, 1998 at 02:46:20AM +0000, Marsel Osipov wrote:
> I do use GtkPixmap to display the icons, and i tried to use eventbox to track
> the events, but i don't know how to add the eventbox to the file browser?  I
> use GtkFixed widget to display the icons.  Should I add an hbox and a vbox to
> the GtkFixed widget and then just add the eventbox on to them?  Is this
> correct or there is a better way to do that?

Hmm...  You know, I have been trying to write a small program that should be
using pixmaps.  Moreover, I wanted those pixmaps to respond on certain events.
For creating every pixmap I used the following code.  I cannot be sure if this
code is correct, but the program I've been writing behaves as I expect it to
behave.

GtkWidget *create_item (GtkWidget *parent, GtkStyle *style, GtkTooltips *tips, ProgramItem *item)
{
    GtkWidget *result, *pixmap;
    GdkPixmap *gdk_pixmap;
    GdkBitmap *gdk_pixmap_mask;

    gdk_pixmap = gdk_pixmap_create_from_xpm (parent->window, &gdk_pixmap_mask,
        &style->bg[GTK_STATE_NORMAL], item->icon_name);

    result = gtk_event_box_new ();

    pixmap = gtk_pixmap_new (gdk_pixmap, gdk_pixmap_mask);
    gtk_container_add (GTK_CONTAINER (result), pixmap);
    gtk_widget_show (pixmap);

    gtk_tooltips_set_tip (tips, result, item->tip, NULL);

    gtk_widget_show (result);

    return result;
}

The created items I inserted into a hbox...

Hope this helps,

--
Mike



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