Re: How can I make a apps, whose shape is not a rectangle or square?



On 2002.02.10 20:03 Zenith wrote:

What can I do if I want to make a small apllication, such that the such
of the root window is not in rectangle or square in shape? For example,
can I make a clock (circle shape), and there is no background color for
the clock, or when I just start this program, ONLY, just a circle is
appeared.

Create a toplevel window:

        toplevel = w = gtk_window_new(GTK_WINDOW_POPUP);
        gtk_widget_realize(w);
        gdk_window_set_decorations(w->window, 0);
        gdk_window_set_functions(w->window, 0);
        gtk_widget_show(w);

That creates a window with no WM decorations.

Next create a GtkDrawingArea widget and put it into the toplevel
window:

        da = w = gtk_drawing_area_new();
        gtk_drawing_area_size(GTK_DRAWING_AREA(w), 48, 48);
        gtk_widget_add_events(
            w,
            GDK_EXPOSURE_MASK
        );
        gtk_signal_connect(
            GTK_OBJECT(w), "expose_event",
            GTK_SIGNAL_FUNC(MyDrawFunction), NULL
        );
        gtk_container_add(GTK_CONTAINER(toplevel), w);
        gtk_widget_show(w);


Your MyDrawFunction() function should draw whatever you want
it to look like.

To make it a special shape (not rectangular) use:

        gtk_widget_shape_combine_mask()

On both the toplevel window and the GtkDrawingArea.


--
Sincerely,                  ,"-_                         \|/
-Capt. Taura M.             ,   O=__                    --X--
..__                         ,_JNMNNEO=_                 /|\
OMNOUMmnne.                  {OMMNNNEEEEOO=_
UOOOBIOOOEOMMn.               'LONMMMMNNEEEOOO=.__..,,..
UUOOEUUOOOOOOOObe              '"=OMMMMWNEEEOOOOO,"=OEEEOO=,._
OOUUUIEEIOONNOIUbe.                "7OMMMMNNNNNWWEEEEOOOOOO"   "'.
EEBNNMMMNWNWWEEIMMNe.             __  7EMMMNNNNNWWWEEEEEEEOO.     " .
NNMMMMWWWMMMWEINMMMNn            "=BBEEEEMMMMMMMMNNNWWWEEOOOOO=._     .
                  http://furry.ao.net/~learfox/



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