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 boolean canBecomeSelectedView();
public void center();
public boolean containsDocument();
public Size contentSize();
public WindowContentView contentView();
protected Button createCloseButton();
public void decode(Decoder);
public View defaultSelectedView();
public void describeClassInfo(ClassInfo);
public void didBecomeCurrentDocument();
public void didBecomeMain();
public void didResignCurrentDocument();
public void didResignMain();
public void draw(Graphics, Rect);
public void drawBottomBorder();
public void drawTitleBar();
public void drawView(Graphics);
public void encode(Encoder);
public void finishDecoding();
public View focusedView();
public void hide();
public boolean hidesSubviewsFromKeyboard();
public boolean isCloseable();
public boolean isCurrentDocument();
public boolean isMain();
public boolean isPointInBorder(int, int);
public boolean isResizable();
public boolean isTransparent();
public boolean isVisible();
public int layer();
public void layoutParts();
public MenuView menuView();
public Size minSize();
public boolean mouseDown(MouseEvent);
public void mouseDragged(MouseEvent);
public void mouseUp(MouseEvent);
public void moveToBack();
public void moveToFront();
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 setContainsDocument(boolean);
public void setDefaultSelectedView(View);
public void setFocusedView(View);
public void setLayer(int);
public void setMenuView(MenuView);
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);
protected void willMoveTo(Point);
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
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
public WindowContentView contentView()
- Returns the InternalWindow's contentView, the View in which all
programmatically-added Views live.
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.
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.
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
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
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.
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.
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.
public void showInFrontOf(InternalWindow aWindow)
- Makes the InternalWindow visible, positioned in front of
aWindow.
- See Also:
- show
public void showBehind(InternalWindow aWindow)
- Makes the InternalWindow visible, positioned behind aWindow.
- See Also:
- show
public void moveToFront()
- Move the window to the front of all other windows with the same layer
public void moveToBack()
- Move the window behind all other windows with the same layer.
public void hide()
- Hides the InternalWindow (removes it from its RootView's View
hierarchy).
Call this method instead of removeFromSuperview().
public void setCanBecomeMain(boolean flag)
- Tells the IFC that this InternalWindow can become the
main InternalWindow.
public boolean canBecomeMain()
- Returns true if the InternalWindow can become the main
InternalWindow.
public boolean isVisible()
- Returns true if the InternalWindow is visible.
public boolean isMain()
- Returns true if the InternalWindow is the Application's main
InternalWindow.
protected Button createCloseButton()
- Called by the InternalWindow to create its close button.
Override this method to return your own special close button.
public void setCloseable(boolean flag)
- If the InternalWindow is not BLANK_TYPE, adds or removes a
"close" button to (from) the InternalWindow.
public boolean isCloseable()
- Returns true if the InternalWindow has a close button.
- See Also:
- setCloseable
public void setResizable(boolean flag)
- If the InternalWindow is not BLANK_TYPE or TITLE_TYPE,
makes the InternalWindow resizable.
public boolean isResizable()
- Returns true if the InternalWindow can be resized by the
user.
- See Also:
- setResizable
public Size windowSizeForContentSize(int width,
int height)
- Returns the Size the InternalWindow must be to support a content
size of (width, height).
public void setTitle(String aString)
- Sets the InternalWindow's title, the string displayed in its title
bar.
public String title()
- Returns the InternalWindow's title.
- See Also:
- setTitle
public void setBorder(Border border)
- Sets the InternalWindow's Border.
- See Also:
- Border
public Border border()
- Returns the InternalWindow's Border.
- See Also:
- setBorder
public void setLayer(int windowLayer)
- Sets the InternalWindow's layer. InternalWindows in a higher layer
cannot be obscured by InternalWindows in a lower layer.
public int layer()
- Returns the InternalWindow's layer.
- See Also:
- setLayer
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
public void setOwner(WindowOwner anObject)
- Sets the InternalWindow's owner, an object interested in special
events, such as the user closing the InternalWindow.
public WindowOwner owner()
- Returns the InternalWindow's owner.
- See Also:
- setOwner
public void setMenuView(MenuView aMenuView)
- Sets the MenuView that will appear along the top edge of the Window.
This will be an IFC View-based Menu.
- See Also:
- MenuView
public MenuView menuView()
- Returns the MenuView that appears along the top edge of this
InternalWindow, null if one is not set.
- See Also:
- setMenuView
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.
public View viewForMouse(int x,
int y)
- Overridden to handle special condition of
BLANK_TYPE InternalWindows.
- Overrides:
- viewForMouse in class View
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
public boolean isTransparent()
- Overridden to return true if the InternalWindow is transparent.
- Overrides:
- isTransparent in class View
- See Also:
- setTransparent
public void setType(int windowType)
- Sets the InternalWindow's type. See the InternalWindow type constants
for an enumeration of the various types.
public int type()
- Returns the InternalWindow's type.
- See Also:
- setType
public boolean mouseDown(MouseEvent event)
- Handles a mouse click in the title or resize bar.
- Overrides:
- mouseDown in class View
public void setBounds(int x,
int y,
int width,
int height)
- Overridden to provide special InternalWindow resizing behavior.
- Overrides:
- setBounds in class View
protected void willMoveTo(Point newPoint)
- Called by the InternalWindow before every move, whether through
explicit setBounds() calls or with mouse dragging. Subclasses can
override this method to modify newPoint to
constrain movement. The Point newPoint is in the coordinate
system of this Window's superview.
public void subviewDidResize()
- Overridden to do nothing.
public void center()
- Centers the InternalWindow's within its RootView.
public void mouseDragged(MouseEvent event)
- Handles a mouse drag in the title or resize bar.
- Overrides:
- mouseDragged in class View
public void mouseUp(MouseEvent event)
- Handles a mouse up in the title or resize bar.
- Overrides:
- mouseUp in class View
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
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().
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().
public void draw(Graphics g,
Rect clipRect)
- Overridden to handle special needs of transparent InternalWindows.
- Overrides:
- draw in class View
public void didBecomeMain()
- Informs the InternalWindow that it has become the main InternalWindow,
and notifies its owner.
- See Also:
- setOwner
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
public void setContainsDocument(boolean containsDocument)
- Sets whether the window contains a document. Windows containing document
are treated in a different manner by the target chain.
public boolean containsDocument()
- Return whether the window contains a document.
public void didBecomeCurrentDocument()
- If the window contains a document, this method is called
when the window just became the current document.
public void didResignCurrentDocument()
- If the window contains a document, this method is called
when the window is no longer the current document.
public boolean isCurrentDocument()
- Return whether this window is the current document
public void setFocusedView(View view)
- Sets the InternalWindow's "focused" View, the View that will receive
key events.
- Overrides:
- setFocusedView in class View
public View focusedView()
- Returns the InternalWindow's "focused" View.
- See Also:
- setFocusedView
public void describeClassInfo(ClassInfo info)
- Describes the InternalWindow class' information.
- Overrides:
- describeClassInfo in class View
- See Also:
- describeClassInfo
public void encode(Encoder encoder) throws CodingException
- Encodes the InternalWindow instance.
- Overrides:
- encode in class View
- See Also:
- encode
public void decode(Decoder decoder) throws CodingException
- Decodes the InternalWindow instance.
- Overrides:
- decode in class View
- See Also:
- decode
public void finishDecoding() throws CodingException
- Finishes the InternalWindow instance decoding. Initializes the Slider's value.
- Overrides:
- finishDecoding in class View
- See Also:
- finishDecoding
public String toString()
- Returns the InternalWindow's string representation.
- Overrides:
- toString in class View
public InternalWindow window()
- Overridden to return the InternalWindow.
- Overrides:
- window in class View
- See Also:
- window
public void performCommand(String command,
Object data)
- Implements InternalWindow's commands:
- SHOW - calls the InternalWindow's show() method.
- HIDE - calls the InternalWindow's hide() method.
Subclasses of InternalWindow should call super.performCommand() to
allow the default close Button to send its "hide" command.
- See Also:
- show, hide
public boolean hidesSubviewsFromKeyboard()
- Overriden to return true. Internal windows are root for keyboard UI.
- Overrides:
- hidesSubviewsFromKeyboard in class View
public void setDefaultSelectedView(View aView)
- Set the default selected view, when the window becomes main.
public View defaultSelectedView()
- Returns the default selected view when the window become main
public boolean canBecomeSelectedView()
- Overriden to return true if the window is currently main
- Overrides:
- canBecomeSelectedView in class View
All Packages Class Hierarchy This Package Previous Next Index
Copyright © 1997 Netscape Communications Corporation. All rights reserved
Please send any comments or corrections to ifcfeedback@netscape.com
HTML generated on 21 Oct 1997