org.gnu.gtk
Class Window

java.lang.Object
  |
  +--org.gnu.glib.GObject
        |
        +--org.gnu.gtk.GtkObject
              |
              +--org.gnu.gtk.Widget
                    |
                    +--org.gnu.gtk.Container
                          |
                          +--org.gnu.gtk.Bin
                                |
                                +--org.gnu.gtk.Window
Direct Known Subclasses:
Dialog, Plug

public class Window
extends Bin

A Window is a window that can be displayed on the screen. It also is a container that can hold a single child widget. It is common to have the window in Window supply the margin around the window of the contained widget.


Constructor Summary
Window(int handle)
          Create a new Window with a handle to a native resource returned from a call to the native libraries.
Window(WindowType windowType)
          Construct a new Window object.
 
Method Summary
 void addAccelGroup(AccelGroup accelGroup)
          Associate accesGroup with the window.
 void deiconify()
          Asks to deiconify the specified Window.
 Widget getFocusWidget()
          Retrieves the current focused Widget within the window.
 Gravity getGravity()
          Gets the value set by setGravity().
 Point getPosition()
          Retuns the current position of the window.
 Requisition getSize()
          Returns the current size of a Window.
 java.lang.String getTitle()
          Returns the title for the Window object
static Type getType()
          Retrieve the runtime type used by the GLib library.
 void iconify()
          Asks to iconify the Window.
 void maximize()
          Asks to maximize the Window so it becomes full-screen.
 void move(int x, int y)
          Ask the window manager to move the Window to a given location.
 void present()
          Presents a window to the user.
 void removeAccelGroup(AccelGroup accelGroup)
          Reverses the effect of addAccelGroup.
 void resize(int width, int height)
          Resizes the Window as if the user had done so, obeying the geometry constraints.
 void setDecorated(boolean setting)
          By default Windows are decorated by a titlebar, resize controls, etc.
 void setDefaultSize(int width, int height)
          Sets the default size for a Window.
 void setDefaultWidget(Widget defaultWidget)
          The default widget is the widget that is activated when the user presses the Enter key.
 void setFocusWidget(Widget focus)
          If focus is not the current focus widget and is focusable, set it as the focus widget for the window.
 void setGeometryHints(Widget geometryWidget, Geometry geometry, WindowHints geomMask)
          This method sets up hints about how a Window can be resized by the user.
 void setGravity(Gravity gravity)
          Window gravity defines the meaning of coordinates passed to move().
 void setIcon(Pixbuf icon)
          Sets up the icon representing a Window.
 void setModal(boolean modal)
          Sets a window modal or non-modal.
 void setPosition(WindowPosition position)
          Sets a position constraint for this window.
 void setResizable(boolean resizable)
          Sets whether the user can resize the window.
 void setTitle(java.lang.String title)
          Set the title for this Window object
 void stick()
          Asks to stick the window.
 void unmaximize()
          Asks to unmaximize the Window so it becomes it normal size.
 void unstick()
          Asks to unstick the window.
 
Methods inherited from class org.gnu.gtk.Bin
getChild
 
Methods inherited from class org.gnu.gtk.Container
add, addListener, getBorderWidth, getEventListenerClass, getEventType, getResizeMode, remove, removeListener, resizeChildren, setBorderWidth, setResizeMode
 
Methods inherited from class org.gnu.gtk.Widget
activate, addListener, addListener, addListener, addListener, addListener, addListener, createContext, createLayout, destroy, draw, drawArea, drawArea, getAccessible, getColormap, getContext, getModifierStyle, getName, getParent, getParentWindow, getPointer, getSensitive, getStyle, getToplevel, grabDefault, grabFocus, hasFocus, hide, hideAll, intersect, isAncestor, makeWidget, modifyStyle, popColormap, pushColormap, realize, removeListener, removeListener, removeListener, removeListener, removeListener, removeListener, reparent, setBackgroundColor, setBaseColor, setColormap, setDoubleBuffered, setDragDestination, setDragSource, setFont, setForegroundColor, setMinimumSize, setName, setNoDragDestination, setNoDragSource, setSensitive, setTextColor, shapeCombineMask, show, showAll
 
Methods inherited from class org.gnu.glib.GObject
addEventHandler, addEventHandler, addEventHandler, addEventHandler, addEventHandler, addEventHandler, equals, getData, getHandle, removeEventHandler, setData
 
Methods inherited from class java.lang.Object
getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

Window

public Window(WindowType windowType)
Construct a new Window object.


Window

public Window(int handle)
Create a new Window with a handle to a native resource returned from a call to the native libraries.

Parameters:
handle - The handle that represents a pointer to a native resource.
Method Detail

setTitle

public void setTitle(java.lang.String title)
Set the title for this Window object

Parameters:
title - A string containing the title for this Window

getTitle

public java.lang.String getTitle()
Returns the title for the Window object

Returns:
A string containing the title.

setResizable

public void setResizable(boolean resizable)
Sets whether the user can resize the window. Windows are user resizable by default.

Parameters:
resizable - Determines if the window can be resized.

addAccelGroup

public void addAccelGroup(AccelGroup accelGroup)
Associate accesGroup with the window.

Parameters:
accelGroup - The AccelGroup to associate with this window.

removeAccelGroup

public void removeAccelGroup(AccelGroup accelGroup)
Reverses the effect of addAccelGroup.

Parameters:
accelGroup - The AccelGroup to disassociate with this window.

setModal

public void setModal(boolean modal)
Sets a window modal or non-modal.

Parameters:
modal - Indicates whether the window should be modal or not.

setDefaultSize

public void setDefaultSize(int width,
                           int height)
Sets the default size for a Window. If a Window's natural size is larger than the default, the default will be ignored.

Parameters:
width - The width to set for the default size.
height - the height to set for the default size.

setGeometryHints

public void setGeometryHints(Widget geometryWidget,
                             Geometry geometry,
                             WindowHints geomMask)
This method sets up hints about how a Window can be resized by the user. You can set a minimum and maximum size, allowable resize increments, aspect ratios and more.

Parameters:
geometryWidget - The Widget the geometry hints will be applied to.
geometry - The geometry information.
geomMask - Mask indicating which fields should be paid attention to.

setGravity

public void setGravity(Gravity gravity)
Window gravity defines the meaning of coordinates passed to move().

Parameters:
gravity - The window gravity.

getGravity

public Gravity getGravity()
Gets the value set by setGravity().

Returns:
The Gravity for the Window.

setPosition

public void setPosition(WindowPosition position)
Sets a position constraint for this window. If the old or new constraint is WindowPosition.CENTER_ALWAYS, this will also cause the window to be repositioned to satisfy the new constraint.

Parameters:
position - A position constraint.

getFocusWidget

public Widget getFocusWidget()
Retrieves the current focused Widget within the window.

Returns:
The Widget that has focus.

setFocusWidget

public void setFocusWidget(Widget focus)
If focus is not the current focus widget and is focusable, set it as the focus widget for the window.

Parameters:
focus - The widget to receive focus for the Window.

setDefaultWidget

public void setDefaultWidget(Widget defaultWidget)
The default widget is the widget that is activated when the user presses the Enter key. This method will set defaultWidget to the default widget for the Window.

Parameters:
defaultWidget - The widget that should become the default widget.

present

public void present()
Presents a window to the user. This may mean raising the window in the stack order, deiconifying it, moving it to the current desktop, and/or giving it the keyboard focus, possibly dependent on the user's platform, window manager, and preferences. If the Window is hidden it will also call show as well.


iconify

public void iconify()
Asks to iconify the Window. Note that you shouldn't assume the Window is iconified afterward because other entities could deiconify it again or there may not be a window manager in which case iconification is not possible.


deiconify

public void deiconify()
Asks to deiconify the specified Window.


stick

public void stick()
Asks to stick the window. This means that the window appear on all user desktops. Note that you shouldn't assume that the Window is definately stuck after calling this method. Other entities could unstick the Window or the window manager may not support this feature.


unstick

public void unstick()
Asks to unstick the window.


maximize

public void maximize()
Asks to maximize the Window so it becomes full-screen.


unmaximize

public void unmaximize()
Asks to unmaximize the Window so it becomes it normal size.


setDecorated

public void setDecorated(boolean setting)
By default Windows are decorated by a titlebar, resize controls, etc. Some window managers allow you to disable these decorations, creating a borderless Window. This method allows you to change teh decorated setting for the Window.

Parameters:
setting - Determines if the Window should be decorated.

getSize

public Requisition getSize()
Returns the current size of a Window. If the window is not onscreen, it returns the size that will be suggested to the window manager for the initial window size.

Returns:
The size of the Window.

getPosition

public Point getPosition()
Retuns the current position of the window.

Returns:
The position of the window.

move

public void move(int x,
                 int y)
Ask the window manager to move the Window to a given location. Window managers are free to ignore this request. Most window managers ignore the request for the initial window position but honor the request after the window has been shown.

Parameters:
x - The x coordinate for the move.
y - The y coordinate for the move.

resize

public void resize(int width,
                   int height)
Resizes the Window as if the user had done so, obeying the geometry constraints.

Parameters:
width - The width for the resized Window.
height - The height for the resized Window.

setIcon

public void setIcon(Pixbuf icon)
Sets up the icon representing a Window. The icon is used when the Window is minimized.

Parameters:
icon - The Icon to use for this Window.

getType

public static Type getType()
Retrieve the runtime type used by the GLib library.


Please send any bug reports, comments, or suggestions for the API or documentation to java-gnome-developer@lists.sf.net