Packages
 In this topic

*Constructors

*Methods

 

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

 


Class UIExpandButton

public class UIExpandButton extends UIPushButton
{
  // Constructors
  public UIExpandButton(IUITree tree);

  // Methods
  public boolean action(Event e, Object o);
  public Dimension getMinimumSize();
  public Dimension getPreferredSize();
  public IUITree getTree();
  public boolean isKeyable();
  public boolean mouseEnter(Event e, int x, int y);
  public void paint(FxGraphics g);
  public void update(FxGraphics g);
}

This class implements the expand button of a tree control. A UIExpandButton object indicates whether the tree node is expanded or collapsed. UITree uses UIExpandButton to create its tree expander, and every UIExpandButton object is associated with a tree control. By default, UIExpandButton uses the system-defined expand box image.

For more information about buttons, see the UIButton overview.

Note The hot-track color is the same color as the button text color. As a result, hot-tracking does not appear to be functional.

UIComponent
  |
  +--UIContainer
    |
    +--UIStateContainer
      |
      +--UISingleContainer
        |
        +--UIButton
          |
          +--UIPushButton
            |
            +--UIExpandButton

Constructors

UIExpandButton

public UIExpandButton(IUITree tree);

Creates an expand button associated with the specified tree node.

ParameterDescription
tree The tree node associated with the expand button.

Remarks:

By default, the button's style is set to TOGGLE.

Methods

action

public boolean action(Event e, Object o);

Toggles the expanded state of the associated tree node.

Return Value:

Returns true if the event was handled; otherwise, returns false.

ParameterDescription
e The event posted to the button.
o The object that posted the event.

Remarks:

If the tree node is collapsed when the expand button is clicked, this method expands the node. Conversely, if the node is expanded when the button is clicked, this method collapses the node.

getMinimumSize

public Dimension getMinimumSize();

Retrieves the minimum size (in pixels) of the button control.

Return Value:

Returns a Dimension object containing the minimum size.

Remarks:

The button's minimum size is based on the height of the associated tree's bounding rectangle, as determined by the getAttachRect method.

See Also: getPreferredSize

getPreferredSize

public Dimension getPreferredSize();

Retrieves the preferred size of the button control. The preferred size specifies the dimensions (in pixels) you want for the button.

Return Value:

Returns a Dimension object containing the preferred size.

Remarks:

By default, this method returns the minimum size, as determined by getMinimumSize.

getTree

public IUITree getTree();

Retrieves the tree node associated with the expand button.

Return Value:

Returns the associated tree.

isKeyable

public boolean isKeyable();

Determines whether the expand button can receive keyboard input.

Return Value:

Returns false, indicating the button cannot receive keyboard input.

mouseEnter

public boolean mouseEnter(Event e, int x, int y);

Sets the expand button's hot-tracked state.

Return Value:

Returns true if the event was handled; otherwise, returns false.

ParameterDescription
e The event posted to the button.
x The x coordinate of the event.
y The y coordinate of the event.

Remarks:

By setting the hot-tracked state, this method causes the expand box image to change colors when the mouse enters the button area. The image's original color is restored when the mouse exits the button area.

Note Button controls typically inherit the mouseEnter method, which automatically sets the hot-tracked state for buttons that can receive keyboard input. However, UIExpandButton objects cannot receive keyboard input; therefore, UIExpandButton must override mouseEnter to explicitly set the hot-tracked state.

For more information about hot-tracking, see the UIButton overview.

See Also: isKeyable

paint

public void paint(FxGraphics g);

Draws the button's expand box image, according to the associated tree node's expanded state.

Return Value:

No return value.

ParameterDescription
g The graphics context.

Remarks:

By default, this method uses the system-defined expand box image. If the associated tree node is expanded, the button displays a plus sign. If the node is collapsed, the button displays a minus sign.

Overrides:

paint(FxGraphics) in UIPushButton.

update

public void update(FxGraphics g);

Updates the expand button.

Return Value:

No return value.

ParameterDescription
g The graphics context.

Remarks:

This method simply calls paint to redraw the expand box image.

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