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

non-rectangular pixmaps in menubars



Thus spoke Erik Mouw
> Just realize the main window before you add pixmaps to the toolbar. In
> plain GTK, you would do:
> 
>   gtk_widget_realize(mainwindow);
> 
> I think you can figure out the correct method to call for Gtk--.

I have a related question to this:  I have a pixmap that is not rectangular
(a file folder) that I just can't seem to get to be transparent in all the
places its supposed to be.  Any line in the pixmap that has non-transparent
pixels uses the default parent color for any transparent pixels instead of 
being transparent.

I've tried using gdk_window_shape_combine_mask() with the mask returned
from gdk_pixmap_create_from_xpm(), but that didn't seem to help.  Maybe I'm
not doing something right.  Note that this pixmap is in a menubar.  Pixmaps
that *are not* in menubars seem to work fine.  Is this a bug with the
menubar widget?

The basic code looks like this (note:  although I just mentioned the file
folder as problem, the problem exists for all the pixmaps in the menubar,
it's just most obvious in the file folder):

<create pixmaps>
<create button widgets to hold the pixmaps>

   /* The menu bar */
   menubar = gtk_menu_bar_new();
   gtk_widget_set_name (menubar, "menu_bar");
   gtk_box_pack_start(GTK_BOX(hbox), menubar, TRUE, TRUE, 0);
   gtk_widget_show(menubar);
   gtk_widget_realize(menubar);

   /* Add the menus to the menu bar */
   gtk_menu_bar_append(GTK_MENU_BAR (menubar), alarm_button);
   gtk_menu_bar_append(GTK_MENU_BAR (menubar), anchor_button);
   gtk_menu_bar_append(GTK_MENU_BAR (menubar), file_button);
   gtk_menu_bar_append(GTK_MENU_BAR (menubar), notes_button);

Anything else I should try?  Does anyone want to see the code used to
create the pixmaps or buttons?  Here is the file folder xpm:

/* XPM */
static char * file_xpm[] = {
/* width height num_colors chars_per_pixel */
"16 14 4 1",
/* colors */
"  s None   c none",
". c black",
"X c yellow",
"O c #342c00",
/* pixels */
"                ",
"  .......       ",
" .XXXXXXX.      ",
".XXXXXXXXX..... ",
"..OOOOOOO..XXXX.",
".XXXXXXXXXXXXXX.",
".XXXXXXXXXXXXXX.",
".XXXXXXXXXXXXXX.",
".XXXXXXXXXXXXXX.",
".XXXXXXXXXXXXXX.",
".XXXXXXXXXXXXXX.",
".XXXXXXXXXXXXXX.",
".XXXXXXXXXXXXXX.",
".XXXXXXXXXXXXXX.",
"................",
"                "};

-- 
Michael J. Hammel           |
The Graphics Muse           | Tell me what you need, and I'll tell you how to
mjhammel@graphics-muse.org  | get along without it. -- Dilbert
http://www.graphics-muse.org



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