Packages
 In this topic

*Constructors

*Methods

 

Packages   PreviousThis PackageNext
Package com.ms.ui   Previous This
Package
Next

 


Class UIGridLayout

public class UIGridLayout extends UILayoutManager
{
  // Constructors
  public UIGridLayout(int rows, int cols);
  public UIGridLayout(int rows, int cols, int hgap, int vgap);

  // Methods
  public boolean continueInvalidate(IUIContainer parent,
        IUIComponent check);
  public Dimension getMinimumSize(IUIContainer parent);
  public Dimension getPreferredSize(IUIContainer parent);
  public boolean isOverlapping();
  public void layout(IUIContainer parent, Rectangle bounds);
  public IUIComponent navigate(IUIContainer parent,
        IUIComponent comp, int dir, boolean keyable);
}

This class implements an extended grid layout manager. UIGridLayout lays out components in a two-dimensional grid, similar to the AWT GridLayout class. The container is divided into rows and columns, where each component has the same width and height.

UILayoutManager
  |
  +--UIGridLayout

Constructors

UIGridLayout

public UIGridLayout(int rows, int cols);

Creates a grid layout manager using the specified number of rows and columns.

ParameterDescription
rows The number of rows in the grid. If zero, the grid consists of one column, and the number of rows is determined from the number of components.
cols The number of columns in the grid. If zero, the grid consists of one row, and the number of columns is determined from the number of components.

Remarks:

By default, the horizontal and vertical gaps (used for spacing between components) are 0 pixels each.

UIGridLayout

public UIGridLayout(int rows, int cols, int hgap, int vgap);

Creates a grid layout manager using the specified number of rows and columns, and the specified horizontal and vertical gaps.

ParameterDescription
rows The number of rows in the grid. If zero, the grid consists of one column, and the number of rows is determined from the number of components.
cols The number of columns in the grid. If zero, the grid consists of one row, and the number of columns is determined from the number of components.
hgap The number of pixels used for horizontal spacing between components.
vgap The number of pixels used for vertical spacing between components.

Methods

continueInvalidate

public boolean continueInvalidate(IUIContainer parent, IUIComponent check);

Determines whether the container should be invalidated when the specified child component is invalidated.

Return Value:

Returns false, indicating the container should not be invalidated.

ParameterDescription
parent The container of the component.
check The component being invalidated.

Overrides:

continueInvalidate(IUIContainer,IUIComponent) in UILayoutManager.

getMinimumSize

public Dimension getMinimumSize(IUIContainer parent);

Determines the minimum dimensions (in pixels) needed to lay out the child components in the specified container.

Return Value:

Returns a Dimension object containing the minimum layout size.

ParameterDescription
parent The container of the components.

Remarks:

This method is called by the container's getMinimumSize method. The width of the returned Dimension object is the largest of the widths of each row. The width of each row is the sum of the minimum widths of the components in the row, plus the horizontal gaps around components.

Similarly, the returned Dimension object's height is the largest of the heights of each column. The height of each column is the sum of the minimum heights of the components in the column, plus the vertical gaps around components.

Overrides:

getMinimumSize(IUIContainer) in UILayoutManager.

See Also: getPreferredSize

getPreferredSize

public Dimension getPreferredSize(IUIContainer parent);

Determines the preferred dimensions (in pixels) for laying out the child components in the specified container.

Return Value:

Returns a Dimension object containing the preferred layout size.

ParameterDescription
parent The container of the components.

Remarks:

This method is called by the container's getPreferredSize method. The width of the returned Dimension object is the largest of the widths of each row. The width of each row is the sum of the preferred widths of the components in the row, plus the horizontal gaps around components.

Similarly, the returned Dimension object's height is the largest of the heights of each column. The height of each column is the sum of the preferred heights of the components in the column, plus the vertical gaps around components.

Overrides:

getPreferredSize(IUIContainer) in UILayoutManager.

See Also: getMinimumSize

isOverlapping

public boolean isOverlapping();

Determines if the layout manager lays out its children so that they overlap either completely or partially; otherwise, false. Returning false also means that only the sibling floater window, if one exists, needs to be clipped by the manager.

Return Value:

Returns true if the children overlap; otherwise, returns false. (The default is true.)

Overrides:

isOverlapping() in UILayoutManager.

layout

public void layout(IUIContainer parent, Rectangle bounds);

Lays out the components in the specified container.

Return Value:

No return value.

ParameterDescription
parent The container being laid out.
bounds The bounding rectangle in which to lay out the components.

Remarks:

This method is called by the container's layout method. layout divides the space in the bounding rectangle equally into rows and columns. This grid is then filled by row. Each component has the same width and height, and is separated by the horizontal and vertical gaps.

Overrides:

layout(IUIContainer,Rectangle) in UILayoutManager.

navigate

public IUIComponent navigate(IUIContainer parent, IUIComponent comp,
        int dir, boolean keyable);

Navigates from the specified component to another component in the specified direction.

Return Value:

Returns the component navigated to (if a component in the specified direction exists); otherwise, returns null.

ParameterDescription
parent The container where the navigation is occurring.
comp The component to navigate from.
dir The navigation direction. Specify one of the NAVDIR values defined in the IUIAccessible interface.
keyable If true, only components that are able to receive keyboard input can be navigated to; otherwise, all components can be navigated to.

Remarks:

This method handles keyboard navigation in the container. When a component in the container has focus and a key is pressed, navigate is called to move focus to another item in the container.

The following table shows the keys that have corresponding IUIAccessible directions.

Key IUIAccessible direction
UP ARROW, DOWN ARROW, LEFT ARROW, and RIGHT ARROW NAVDIR_UP, NAVDIR_DOWN, NAVDIR_LEFT, and NAVDIR_RIGHT, respectively.
HOME and END NAVDIR_FIRST and NAVDIR_LAST, respectively.

Overrides:

navigate(IUIContainer,IUIComponent,int,boolean) in UILayoutManager.

upnrm.gif © 1998 Microsoft Corporation. All rights reserved. Terms of use.