[Gtk-sharp-list] gtk_widget_set_uposition

Rafael Teixeira monoman at gmail.com
Sun May 21 16:55:16 EDT 2006


On 5/16/06, 安小東 <anton.tw at gmail.com> wrote:
> uh....
>
> I have to apologize first.
>
> I didnt decribe my question clearly:
>
> I want to make a panel such as gnome toolbar,
>
> which can autohide or move to the left/right.

The fancy effects are hard work, I think you should look in the gnome
toolbar sources to feel what is needed.

I would rather go the simple route:

AutoHide could just mean to set invisible status for all children
widgets so the container goes automatically to a few pixels of height
(given that the preferred [minimum] size is not set higher).

Move Left/Right is very similar, except the expanding button widget is
not made invisible, and the container just wraps it (some position
correcting may be needed when moving right, and expanding back)

> I planed to use a gtk_window, which can be set position using the function
> "gtk_widget_set_uposition".

As the documentation states, it can only use positive coordinates,
because visible things can only be drawn/interact, when in the screen
space. If something is to be hidden it should be set invisible no
fancy effects required, that's the norm on GTK/Gnome.

> But when I plan to move this toolbar to the left,
> the x value must set to be minus value.
>
> However, this is not allowed.
>
> Thus, I need some advises.
>
> And thx for Rafael's reply, I'm sorry that I didnt make it clear.
>
> Rgds,
> anton
>
>
>
>
>
> 2006/5/17, Rafael Teixeira <monoman at gmail.com>:
> > Hi,
> >
> > From GTK+ documentation:
> > -----------------------------------
> > gtk_widget_set_uposition ()
> >
> > Warning
> >
> > gtk_widget_set_uposition is deprecated and should not be used in
> > newly-written code.
> >
> > Sets the position of a widget. The funny "u" in the name comes from
> > the "user position" hint specified by the X Window System, and exists
> > for legacy reasons. This function doesn't work if a widget is inside a
> > container; it's only really useful on GtkWindow.
> > -----------------------------------
> > See that absolute sizing/positioning is really not a welcome thing in
> > GTK, that is all self-adjustable to either contents and containers.
> >
> > If you really need to adjust the widget position at an odd negative
> > offset, you probably you'll have to adjust position in the container
> > side, not in the widget itself.
> >
> > If you really need to adjust it in the widget the solution is to lie
> > about the size and draw the widget displaced. So you won't be able to
> > do that with the plain stock widgets, but only with custom ones, or
> > hopefully with subclassed ones.
> >
> > Both alternatives may yield wrong results, as containers may 'crop'
> > the widget drawing to the container boundaries.
> >
> > Hope it helps,
> >
> > On 5/15/06, 安小東 <anton.tw at gmail.com> wrote:
> > > Dear All:
> > >
> > > I am wondering that
> > > how could I set a widget position to be a minus value ?
> > >
> > > thx for help.
> > >
> > > Rgds,
> > > anton
> > > --
> > > gtk_widget_set_uposition ()
> > >
> > > void        gtk_widget_set_uposition        (GtkWidget
> *widget,
> > >                                              gint x,
> > >                                              gint y);
> > >
> > > widget :    a GtkWidget
> > > x :     x position; -1 to unset x; -2 to leave x unchanged
> > >  y :     y position; -1 to unset y; -2 to leave y unchanged


-- 
Rafael "Monoman" Teixeira
---------------------------------------
As I'm currently working a lot with Java and even fixing Java VMs
(JamVM/Kaffe) and GNU Classpath code, I think I may partly borrow the
title (Javaman) from my friend Bruno Souza and become the
MonoNJavaMan. Yeah, I may currently be crazier than usual...


More information about the Gtk-sharp-list mailing list