public class Fixed extends Container
You should not use Fixed for any non-trivial purpose. While you might think at first that it would simplify your application, the reality is that Fixed is almost always the wrong Container choice. Because GTK is the widget toolkit used to power the user interfaces of GNOME applications, the appearance of Widgets is very dynamic. Different window managers and theme engines can radically change the size and appearance of Widgets to suit varying accessibility and usability requirements; different fonts available to your users will cause Labels to be sized differently than you'd expect, and of course translation completely throws predictability right out the window. Since the Fixed Container does not adapt to the size requests of the Widgets with in it, the frequent result is truncated text, overlapping Widgets, and other visual bugs.
The Fixed widget can't be properly mirrored in right-to-left languages such as Hebrew and Arabic. A Fixed widget with a right-to-left font will render your application unusable.
Adding or removing any GUI elements from this Fixed requires you to reposition all the other Widgets within it. As you can imagine, this will end up a long-term maintenance headache for your application.
If any of those are a concern for your application, then you should be
using a different Container, either combinations of VBox
and
HBox
, or perhaps Table
. You have been warned!
Layout
,
DrawingArea
Widget.ButtonPressEvent, Widget.ButtonReleaseEvent, Widget.Destroy, Widget.Draw, Widget.EnterNotifyEvent, Widget.FocusInEvent, Widget.FocusOutEvent, Widget.Hide, Widget.KeyPressEvent, Widget.KeyReleaseEvent, Widget.LeaveNotifyEvent, Widget.MapEvent, Widget.MotionNotifyEvent, Widget.PopupMenu, Widget.QueryTooltip, Widget.ScrollEvent, Widget.SizeAllocate, Widget.UnmapEvent, Widget.VisibilityNotifyEvent
Constructor and Description |
---|
Fixed()
Create a new Fixed Widget.
|
Modifier and Type | Method and Description |
---|---|
void |
move(Widget widget,
int x,
int y)
Move a Widget that has already been added to this Fixed to a new
location.
|
void |
put(Widget widget,
int x,
int y)
Place a Widget into the Fixed Container at a specified location.
|
add, getChildren, remove, setBorderWidth
activate, addEvents, connect, connect, connect, connect, connect, connect, connect, connect, connect, connect, connect, connect, connect, connect, connect, connect, connect, connect, connect, destroy, getAllocatedHeight, getAllocatedWidth, getAllocation, getCanDefault, getCanFocus, getHasFocus, getName, getParent, getPreferredHeightForWidthMinimum, getPreferredHeightForWidthNatural, getPreferredHeightMinimum, getPreferredHeightNatural, getPreferredWidthForHeightMinimum, getPreferredWidthForHeightNatural, getPreferredWidthMinimum, getPreferredWidthNatural, getRequestMode, getRequisition, getSensitive, getStyleContext, getToplevel, getWindow, grabAdd, grabDefault, grabFocus, grabRemove, hide, isSensitive, overrideBackground, overrideColor, overrideFont, queueDraw, queueDrawArea, realize, setAlignHorizontal, setAlignVertical, setCanDefault, setCanFocus, setEvents, setExpandHorizontal, setExpandVertical, setName, setSensitive, setSizeRequest, setTooltipMarkup, setTooltipText, show, showAll
public void move(Widget widget, int x, int y)
Calling move()
will cause GTK to inherently redraw the
entire Fixed surface. If you have many Widgets in a Fixed, this can
lead to flickering. Consider using Layout
or
DrawingArea
instead.
The x and y co-ordinates are measured in pixels from the top left corner of the Fixed.
widget
- the Widget that will be moved.x
- the horizontal position to move widget
to.y
- the vertical position to move widget
to.public void put(Widget widget, int x, int y)
It is up to you to ensure that the placing of the new Widget will not overlap any existing Widgets. If this is starting to be a burden, it's a good sign you're using the wrong Container!
The x and y co-ordinates are measured in pixels from the top left corner of the Fixed.
widget
- the Widget to be placed in the Fixed.x
- horizontal position for the Widget being addedy
- vertical position for the Widget being added