Class InternalWindow
All Packages  Class Hierarchy  This Package  Previous  Next  Index

Class InternalWindow

public class netscape.application.InternalWindow
    extends netscape.application.View
    implements netscape.application.Window,
{
    /* Fields
     */
    public final static int DEFAULT_LAYER;
    public final static int DRAG_LAYER;
    public final static int MODAL_LAYER;
    public final static int PALETTE_LAYER;
    public final static int POPUP_LAYER;

    /* Constructors
     */
    public InternalWindow();
    public InternalWindow(Rect);
    public InternalWindow(int, int, int, int);
    public InternalWindow(int, int, int, int, int);

    /* Methods
     */
    public void addSubview(View);
    public void addSubviewToWindow(View);
    public Border border();
    public boolean canBecomeMain();
    public void center();
    public Size contentSize();
    public WindowContentView contentView();
    protected Button createCloseButton();
    public void decode(Decoder);
    public void describeClassInfo(ClassInfo);
    public void didBecomeMain();
    public void didResignMain();
    public void draw(Graphics, Rect);
    public void drawBottomBorder();
    public void drawTitleBar();
    public void drawView(Graphics);
    public void encode(Encoder);
    public View focusedView();
    public void hide();
    public boolean isCloseable();
    public boolean isMain();
    public boolean isPointInBorder(int, int);
    public boolean isResizable();
    public boolean isTransparent();
    public boolean isVisible();
    public int layer();
    public void layoutParts();
    public Size minSize();
    public boolean mouseDown(MouseEvent);
    public void mouseDragged(MouseEvent);
    public void mouseUp(MouseEvent);
    public WindowOwner owner();
    public void performCommand(String, Object);
    public void setBorder(Border);
    public void setBounds(int, int, int, int);
    public void setCanBecomeMain(boolean);
    public void setCloseable(boolean);
    public void setFocusedView(View);
    public void setLayer(int);
    public void setOwner(WindowOwner);
    public void setResizable(boolean);
    public void setRootView(RootView);
    public void setTitle(String);
    public void setTransparent(boolean);
    public void setType(int);
    public void show();
    public void showBehind(InternalWindow);
    public void showInFrontOf(InternalWindow);
    public void showModally();
    public void subviewDidResize();
    public String title();
    public String toString();
    public int type();
    public View viewForMouse(int, int);
    public InternalWindow window();
    public Size windowSizeForContentSize(int, int);
}
View subclass implementing "window-like" behavior found in traditional windowing systems. An InternalWindow can have a title bar (displaying a text string) by which a user can drag the InternalWindow around the screen; a close button that the user can click to make a InternalWindow invisible (remove it from the View hierarchy); and a resize bar, allowing a user to resize the InternalWindow and its contents.

An InternalWindow has a "contentView," which is the ancestor of all Views added to InternalWindow programmatically. Calling InternalWindow's addSubvew() adds the View to the InternalWindow's contentView rather than directly to the InternalWindow.

You make an InternalWindow visible (add it to the View hierarchy) by calling the show() method, and remove it by calling hide(). Each RootView can contain zero or more InternalWindows, but only one visible InternalWindow can be the Application's "main InternalWindow." The main InternalWindow displays its title bar differently than all other InternalWindows, and represents the InternalWindow in which the user is currently working. The IFC passes key events to the focused View in the current main InternalWindow. InternalWindows containing tool palettes or other sets of controls might never become the main Window because they do not need to receive key events. Sending the message setCanBecomeMain(false) will prevent this.

In general, InternalWindows overlap each other. To ensure that certain InternalWindows never obscure certain others, you can assign InternalWindows to "layers." For example, if you want a tool palette to never be obscured by a document InternalWindow, you can set the tool palette InternalWindow's layer to PALETTE_LAYER, a layer higher than the default InternalWindow layer. Other InternalWindows in the tool palette's layer can obscure each other, but they can never be obscured by InternalWindows in lower layers. The InternalWindow class defines several layers; if needed, you can define your own, but the predefined layers should be enough.

InternalWindow are rectangular regions. If you need to use a View with InternalWindow-like properties (clipping, primarily) but also have it appear non-rectangular, you can make the InternalWindow transparent. A transparent InternalWindow allocates an offscreen buffer to perform its drawing. Unless the InternalWindow's contentView contains Views that draw, the InternalWindow remains completely transparent or invisible (except for the InternalWindow's Border, if set). Clicking and dragging anywhere within the InternalWindow's bounds moves the InternalWindow. You can regulate this movement by overriding the InternalWindow's isPointInBorder() method.

Objects interested in events such as the InternalWindow closing, resizing, and so on, can implement the WindowOwner or InternalWindowOwner interfaces and set themselves as an InternalWindow's owner.


Fields

DEFAULT_LAYER

  public final static int DEFAULT_LAYER
Default window layer.

PALETTE_LAYER

  public final static int PALETTE_LAYER
"Palette" window layer.

MODAL_LAYER

  public final static int MODAL_LAYER
Modal InternalWindow layer.

POPUP_LAYER

  public final static int POPUP_LAYER
Popup window layer.

DRAG_LAYER

  public final static int DRAG_LAYER
Drag layer.

Constructors

InternalWindow

  public InternalWindow()
Constructs an InternalWindow with origin (0, 0), zero width and height, and no title.

InternalWindow

  public InternalWindow(Rect rect)
Constructs an InternalWindow with bounds rect.

InternalWindow

  public InternalWindow(int x,
                        int y,
                        int width,
                        int height)
Constructs an InternalWindow with bounds (x, y, width, height).

InternalWindow

  public InternalWindow(int type,
                        int x,
                        int y,
                        int width,
                        int height)
Constructs an InternalWindow of type type and bounds (x, y, width, height).

Methods

contentView

  public WindowContentView contentView()
Returns the InternalWindow's contentView, the View in which all programmatically-added Views live.

contentSize

  public Size contentSize()
Returns the Size defining the InternalWindow's content area. Use this Size to properly position and size any View that you plan to add to the InternalWindow.

layoutParts

  public void layoutParts()
Resizes and repositions the InternalWindow's contentView to its correct size and location within the InternalWindow based on the InternalWindow's Border. Positions the close button, if present.

addSubview

  public void addSubview(View aView)
Adds aView to the InternalWindow's contentView. To add a View directly to the InternalWindow, call addSubviewToWindow().
Overrides:
addSubview in class View
See Also:
addSubviewToWindow

addSubviewToWindow

  public void addSubviewToWindow(View aView)
Adds aView directly to the InternalWindow. Unless you're adding special Views or controls to the InternalWindow's border, you should call addSubview() instead of this method to add the View to the InternalWindow's contentView.
See Also:
addSubview

setRootView

  public void setRootView(RootView rView)
Sets the InternalWindow's RootView, the RootView on which it should appear. This method does not place the InternalWindow in the View hierarchy, or make it visible in any way. You need to call this method only if you intend for the InternalWindow to appear on any RootView other than the Application's main RootView.

show

  public void show()
Makes the InternalWindow visible (adds it to its RootView's View hierarchy). Call this method instead of adding the InternalWindow as a subview of the RootView.

showModally

  public void showModally()
Makes the InternalWindow visible. This method does not return until the user closes the InternalWindow. While the InternalWindow is visible, Views that are not subviews of the InternalWindow will not receive Events. If the InternalWindow's layer is < MODAL_LAYER, sets it to MODAL_LAYER for the modal session.

showInFrontOf

  public void showInFrontOf(InternalWindow aWindow)
Makes the InternalWindow visible, positioned in front of aWindow.
See Also:
show

showBehind

  public void showBehind(InternalWindow aWindow)
Makes the InternalWindow visible, positioned behind aWindow.
See Also:
show

hide

  public void hide()
Hides the InternalWindow (removes it from its RootView's View hierarchy). Call this method instead of removeFromSuperview().

setCanBecomeMain

  public void setCanBecomeMain(boolean flag)
Tells the IFC that this InternalWindow can become the main InternalWindow.

canBecomeMain

  public boolean canBecomeMain()
Returns true if the InternalWindow can become the main InternalWindow.

isVisible

  public boolean isVisible()
Returns true if the InternalWindow is visible.

isMain

  public boolean isMain()
Returns true if the InternalWindow is the Application's main InternalWindow.

createCloseButton

  protected Button createCloseButton()
Called by the InternalWindow to create its close button. Override this method to return your own special close button.

setCloseable

  public void setCloseable(boolean flag)
If the InternalWindow is not BLANK_TYPE, adds or removes a "close" button to (from) the InternalWindow.

isCloseable

  public boolean isCloseable()
Returns true if the InternalWindow has a close button.
See Also:
setCloseable

setResizable

  public void setResizable(boolean flag)
If the InternalWindow is not BLANK_TYPE or TITLE_TYPE, makes the InternalWindow resizable.

isResizable

  public boolean isResizable()
Returns true if the InternalWindow can be resized by the user.
See Also:
setResizable

windowSizeForContentSize

  public Size windowSizeForContentSize(int width,
                                       int height)
Resizes the InternalWindow to display a content View of size (width, height).

setTitle

  public void setTitle(String aString)
Sets the InternalWindow's title, the string displayed in its title bar.

title

  public String title()
Returns the InternalWindow's title.
See Also:
setTitle

setBorder

  public void setBorder(Border border)
Sets the InternalWindow's Border.
See Also:
Border

border

  public Border border()
Returns the InternalWindow's Border.
See Also:
setBorder

setLayer

  public void setLayer(int windowLayer)
Sets the InternalWindow's layer. InternalWindows in a higher layer cannot be obscured by InternalWindows in a lower layer.

layer

  public int layer()
Returns the InternalWindow's layer.
See Also:
setLayer

minSize

  public Size minSize()
Returns the InternalWindow's minimum size, based in part on the presence of its Border. BLANK_TYPE InternalWindows return a Size instance with zero width and height.
Overrides:
minSize in class View

setOwner

  public void setOwner(WindowOwner anObject)
Sets the InternalWindow's owner, an object interested in special events, such as the user closing the InternalWindow.

owner

  public WindowOwner owner()
Returns the InternalWindow's owner.
See Also:
setOwner

isPointInBorder

  public boolean isPointInBorder(int x,
                                 int y)
Returns true if the InternalWindow's title or resize bar contains the point (x, y). In the case of BLANK_TYPE InternalWindows, this method returns true if the point is anywhere within the InternalWindow's bounds. Override this method to implement any special InternalWindow dragging hotspots your InternalWindow subclass needs.

viewForMouse

  public View viewForMouse(int x,
                           int y)
Overridden to handle special condition of BLANK_TYPE InternalWindows.
Overrides:
viewForMouse in class View

setTransparent

  public void setTransparent(boolean flag)
Sets the InternalWindow to be transparent. A transparent InternalWindow allocates an Image to buffer its drawing, and the IFC's drawing machinery ensures that any portions of the InternalWindow's bounds that it does not draw contain the images bnehind the InternalWindow.
See Also:
isPointInBorder

isTransparent

  public boolean isTransparent()
Overridden to return true if the InternalWindow is transparent.
Overrides:
isTransparent in class View
See Also:
setTransparent

setType

  public void setType(int windowType)
Sets the InternalWindow's type. See the InternalWindow type constants for an enumeration of the various types.

type

  public int type()
Returns the InternalWindow's type.
See Also:
setType

mouseDown

  public boolean mouseDown(MouseEvent event)
Handles a mouse click in the title or resize bar.
Overrides:
mouseDown in class View

setBounds

  public void setBounds(int x,
                        int y,
                        int width,
                        int height)
Overridden to provide special InternalWindow resizing behavior.
Overrides:
setBounds in class View

subviewDidResize

  public void subviewDidResize()
Overridden to do nothing.

center

  public void center()
Centers the InternalWindow's within its RootView.

mouseDragged

  public void mouseDragged(MouseEvent event)
Handles a mouse drag in the title or resize bar.
Overrides:
mouseDragged in class View

mouseUp

  public void mouseUp(MouseEvent event)
Handles a mouse up in the title or resize bar.
Overrides:
mouseUp in class View

drawView

  public void drawView(Graphics g)
Draws the InternalWindow's Border. If the InternalWindow is of type BLANK_TYPE, this method does nothing. You never call this method directly - use the draw() method to draw the InternalWindow.
Overrides:
drawView in class View
See Also:
draw

drawTitleBar

  public void drawTitleBar()
Convenience method for drawing the InternalWindow's title bar portion, only if the InternalWindow is not of type BLANK_TYPE. Calls draw().

drawBottomBorder

  public void drawBottomBorder()
Convenience method for drawing the InternalWindow's bottom Border portion , only if the InternalWindow is not of type BLANK_TYPE. Calls draw().

draw

  public void draw(Graphics g,
                   Rect clipRect)
Overridden to handle special needs of transparent InternalWindows.
Overrides:
draw in class View

didBecomeMain

  public void didBecomeMain()
Informs the InternalWindow that it has become the main InternalWindow, and notifies its owner.
See Also:
setOwner

didResignMain

  public void didResignMain()
Informs the InternalWindow that another InternalWindow has replaced it as the Application's main InternalWindow, and notifies its owner.
See Also:
setOwner

setFocusedView

  public void setFocusedView(View view)
Sets the InternalWindow's "focused" View, the View that will receive key events.
Overrides:
setFocusedView in class View

focusedView

  public View focusedView()
Returns the InternalWindow's "focused" View.
See Also:
setFocusedView

describeClassInfo

  public void describeClassInfo(ClassInfo info)
Describes the InternalWindow class' information.
Overrides:
describeClassInfo in class View
See Also:
describeClassInfo

encode

  public void encode(Encoder encoder) throws CodingException
Encodes the InternalWindow instance.
Overrides:
encode in class View
See Also:
encode

decode

  public void decode(Decoder decoder) throws CodingException
Decodes the InternalWindow instance.
Overrides:
decode in class View
See Also:
decode

toString

  public String toString()
Returns the InternalWindow's string representation.
Overrides:
toString in class View

window

  public InternalWindow window()
Overridden to return the InternalWindow.
Overrides:
window in class View
See Also:
window

performCommand

  public void performCommand(String command,
                             Object data)
Implements InternalWindow's commands:
See Also:
show, hide

All Packages  Class Hierarchy  This Package  Previous  Next  Index