Class View
All Packages Class Hierarchy This Package Previous Next Index
Class View
public class netscape.application.View
extends java.lang.Object
implements netscape.util.Codable
{
/* Fields
*/
public final static int ARROW_CURSOR;
public final static int BOTTOM_MARGIN_CAN_CHANGE;
public final static int CROSSHAIR_CURSOR;
public final static int E_RESIZE_CURSOR;
public final static int HAND_CURSOR;
public final static int HEIGHT_CAN_CHANGE;
public final static int LEFT_MARGIN_CAN_CHANGE;
public final static int MOVE_CURSOR;
public final static int NE_RESIZE_CURSOR;
public final static int NW_RESIZE_CURSOR;
public final static int N_RESIZE_CURSOR;
public final static int RIGHT_MARGIN_CAN_CHANGE;
public final static int SE_RESIZE_CURSOR;
public final static int SW_RESIZE_CURSOR;
public final static int S_RESIZE_CURSOR;
public final static int TEXT_CURSOR;
public final static int TOP_MARGIN_CAN_CHANGE;
public final static int WAIT_CURSOR;
public final static int WIDTH_CAN_CHANGE;
public final static int W_RESIZE_CURSOR;
public netscape.application.Rect bounds;
/* Constructors
*/
public View();
public View(Rect);
public View(int, int, int, int);
/* Methods
*/
public DragDestination acceptsDrag(DragSession, int, int);
public void addDirtyRect(Rect);
public void addSubview(View);
protected void ancestorWasAddedToViewHierarchy(View);
protected void ancestorWillRemoveFromViewHierarchy(View);
public Rect bounds();
public boolean canDraw();
public void computeVisibleRect(Rect);
public boolean containsPoint(int, int);
public boolean containsPointInVisibleRect(int, int);
public MouseEvent convertEventToView(View, MouseEvent);
public void convertPointToView(View, Point, Point);
public Point convertPointToView(View, Point);
public void convertRectToView(View, Rect, Rect);
public Rect convertRectToView(View, Rect);
public void convertToView(View, int, int, Point);
public Point convertToView(View, int, int);
protected Bitmap createBuffer();
public Graphics createGraphics();
public int cursorForPoint(int, int);
public void decode(Decoder);
public boolean descendsFrom(View);
public void describeClassInfo(ClassInfo);
public void didMoveBy(int, int);
public void didSizeBy(int, int);
public void disableDrawing();
public boolean doesAutoResizeSubviews();
public void draw(Graphics, Rect);
public void draw(Rect);
public void draw();
public void drawSubviews(Graphics);
public void drawView(Graphics);
public Bitmap drawingBuffer();
public void encode(Encoder);
public void finishDecoding();
public int graphicsDebugOptions();
public int height();
public int horizResizeInstruction();
public boolean isBuffered();
public boolean isDirty();
public boolean isDrawingEnabled();
public boolean isInViewHierarchy();
public boolean isTransparent();
public void keyDown(KeyEvent);
public void keyUp(KeyEvent);
public LayoutManager layoutManager();
public void layoutView(int, int);
public Rect localBounds();
public Size minSize();
public boolean mouseDown(MouseEvent);
public void mouseDragged(MouseEvent);
public void mouseEntered(MouseEvent);
public void mouseExited(MouseEvent);
public void mouseMoved(MouseEvent);
public void mouseUp(MouseEvent);
public void moveBy(int, int);
public void moveTo(int, int);
public void pauseFocus();
public void reenableDrawing();
public void removeFromSuperview();
protected void removeSubview(View);
public void resumeFocus();
public RootView rootView();
public void scrollRectToVisible(Rect);
public void setAutoResizeSubviews(boolean);
public void setBounds(Rect);
public void setBounds(int, int, int, int);
public void setBuffered(boolean);
public void setDirty(boolean);
public void setFocusedView();
public void setGraphicsDebugOptions(int);
public void setHorizResizeInstruction(int);
public void setLayoutManager(LayoutManager);
public void setMinSize(int, int);
public void setVertResizeInstruction(int);
public void sizeBy(int, int);
public void sizeTo(int, int);
public void sizeToMinSize();
public void startFocus();
public void stopFocus();
public void subviewDidMove(View);
public void subviewDidResize(View);
public Vector subviews();
public View superview();
public String toString();
public int vertResizeInstruction();
public View viewForMouse(int, int);
public boolean wantsAutoscrollEvents();
public boolean wantsMouseEventCoalescing();
public int width();
public InternalWindow window();
public int x();
public int y();
}
A View is a rectangular entity capable of drawing on the screen and
receiving Events. All objects that need to perform one or both of these
functions (Buttons, Sliders, Windows) are View subclasses. Views are
arranged in a tree-like hierarchy, with each View having zero or more
subviews, called descendants. Before a View can draw or receive Events,
it must be placed within this hierarchy, through some form of the
addSubview() method. A RootView instance sits at the top
of the hierarchy, and all other Views descend from it.
Each View has an origin and size, defined by the View's bounds
instance variable. A View's origin is defined in its superview's
coordinates. A RootView has an origin of (0, 0) and a size as
defined by the HTML document that invoked the Application, or
ExternalWindow containing the RootView. The
coordinate system's positive Y-axis points down. For example, a subview
of the RootView with its origin 50 pixels below and 100 pixels
to the right of the RootView's origin has an origin of (100, 50).
A View subclass that wants to draw must override the drawView()
method. The Graphics object passed into this method has its clip rect set
such that the View cannot accidentally draw outside of its bounds. The
Graphics object's coordinate system has been altered, allowing the View to
draw using its own relative coordinate system. Using the subview in the
above example, the following code draws a red square at the View's origin:
g.setColor(Color.red);
g.fillRect(0, 0, 20, 20);
While Views encompass rectangular regions within the View hierarchy, they
can simulate non-rectangular entities through the notion of transparency.
Overriding the method isTransparent() to return true tells
the IFC's drawing machinery that at
least some portion of the View's drawing area is not redrawn by its
drawView() method. Whenever the View needs to be redrawn, the
drawing machinery assures that the transparent View's superview, or
some other opaque ancestor, redraws the region behind the transparent
View before calling the transparent View's drawView() method.
In general, you do not need to know the exact mechanism - just
have your View's isTransparent() method return true and
everything else happens as it
should. By default, isTransparent() returns true, so if
your View is not transparent, you should override this method to return
false.
You can also make a View "buffered," meaning that
all drawing performed by the View goes first to an offscreen buffer
and then onscreen. With a buffered View, you get flicker-free drawing,
but at the cost of slightly reduced performance.
To force a View to draw itself,
you call the View's draw() method. All drawing is synchronous,
meaning that a draw() request is peformed
immediately (draw() does not return until all drawing has
completed).
Views interested in processing mouse events must override one of the mouse
event methods and take appropriate action. Event locations are presented
in terms of the View's coordinate system.
- See Also:
- addSubview, removeFromSuperview, draw, drawView, isTransparent, setBuffered
Fields
bounds
public Rect bounds
- The View's bounding rectangle, in its superview's coordinate
system. The bounds field should only be used for reading.
You should never modify this field directly. To move or resize a
View call setBounds().
- See Also:
- setBounds, bounds, localBounds
RIGHT_MARGIN_CAN_CHANGE
public final static int RIGHT_MARGIN_CAN_CHANGE
- Horizontal resize instruction.
LEFT_MARGIN_CAN_CHANGE
public final static int LEFT_MARGIN_CAN_CHANGE
- Horizontal resize instruction.
WIDTH_CAN_CHANGE
public final static int WIDTH_CAN_CHANGE
- Horizontal resize instruction.
BOTTOM_MARGIN_CAN_CHANGE
public final static int BOTTOM_MARGIN_CAN_CHANGE
- Vertical resize instruction.
TOP_MARGIN_CAN_CHANGE
public final static int TOP_MARGIN_CAN_CHANGE
- Vertical resize instruction.
HEIGHT_CAN_CHANGE
public final static int HEIGHT_CAN_CHANGE
- Vertical resize instruction.
ARROW_CURSOR
public final static int ARROW_CURSOR
- Arrow cursor.
CROSSHAIR_CURSOR
public final static int CROSSHAIR_CURSOR
- Crosshair cursor.
TEXT_CURSOR
public final static int TEXT_CURSOR
- Text cursor.
WAIT_CURSOR
public final static int WAIT_CURSOR
- Wait cursor.
SW_RESIZE_CURSOR
public final static int SW_RESIZE_CURSOR
- Southwest resize cursor.
SE_RESIZE_CURSOR
public final static int SE_RESIZE_CURSOR
- Southeast resize cursor.
NW_RESIZE_CURSOR
public final static int NW_RESIZE_CURSOR
- Northwest resize cursor.
NE_RESIZE_CURSOR
public final static int NE_RESIZE_CURSOR
- Northeast resize cursor.
N_RESIZE_CURSOR
public final static int N_RESIZE_CURSOR
- North resize cursor.
S_RESIZE_CURSOR
public final static int S_RESIZE_CURSOR
- South resize cursor.
W_RESIZE_CURSOR
public final static int W_RESIZE_CURSOR
- West resize cursor.
E_RESIZE_CURSOR
public final static int E_RESIZE_CURSOR
- East resize cursor.
HAND_CURSOR
public final static int HAND_CURSOR
- Hand cursor.
MOVE_CURSOR
public final static int MOVE_CURSOR
- Move cursor.
Constructors
View
public View()
- Constructs a View with origin (0, 0) and zero width
and height.
View
public View(Rect rect)
- Constructs a View with bounds rect.
View
public View(int x,
int y,
int width,
int height)
- Constructs a View with bounds
(x, y, width, height).
Methods
subviews
public Vector subviews()
- Returns the View's subviews. Do not modify the Vector's contents.
descendsFrom
public boolean descendsFrom(View aView)
- Returns true if the View is a descendant of or equals
aView.
window
public InternalWindow window()
- Returns the View's InternalWindow, or null if a subview of
the RootView.
bounds
public Rect bounds()
- Returns a newly-allocated copy of the View's bounding rectangle, which
defines the View's size and position within its superview's coordinate
system.
- See Also:
- setBounds, moveBy, sizeBy, moveTo, sizeTo, localBounds
x
public int x()
- Returns the View's x location.
- See Also:
- bounds
y
public int y()
- Returns the View's y location.
- See Also:
- bounds
width
public int width()
- Returns the View's width.
- See Also:
- bounds
height
public int height()
- Returns the View's height.
- See Also:
- bounds
superview
public View superview()
- Returns the View's superview.
- See Also:
- addSubview, removeFromSuperview
setHorizResizeInstruction
public void setHorizResizeInstruction(int instruction)
- Sets the View's horizontal resize instruction, an integer value that
represents the various ways in which a View can change its size in
response to its superview's resizing. The default horizontal
resize instruction is RIGHT_MARGIN_CAN_CHANGE, which keeps
the View's left margin and width a fixed number of pixels.
horizResizeInstruction
public int horizResizeInstruction()
- Returns the View's horizontal resize instruction.
- See Also:
- setHorizResizeInstruction
setVertResizeInstruction
public void setVertResizeInstruction(int instruction)
- Sets the View's vertical resize instruction, an integer value
respresenting the various ways in which a View can change its size
in response to its superview's resizing. The default vertical
resize instruction is BOTTOM_MARGIN_CAN_CHANGE, which keeps
the View's top margin and height a fixed number of pixels.
vertResizeInstruction
public int vertResizeInstruction()
- Returns the View's vertical resize instruction.
- See Also:
- setVertResizeInstruction
wantsAutoscrollEvents
public boolean wantsAutoscrollEvents()
- Returns true if the View wants to automatically receive
mouse dragged events when the user clicks and drags outside of its
bounds. Default implementation returns false. Views
that want to allow autoscrolling should override to return true.
acceptsDrag
public DragDestination acceptsDrag(DragSession session,
int x,
int y)
- Returns the object which should act as the destination of a
DragSession. Returns null.
- See Also:
- DragSession, DragDestination
setAutoResizeSubviews
public void setAutoResizeSubviews(boolean flag)
- Tells the IFC that this View should automatically resize
and reposition its subviews when resized.
doesAutoResizeSubviews
public boolean doesAutoResizeSubviews()
- Returns true if the View automatically resizes and repositions
its subviews when it is resized.
- See Also:
- setAutoResizeSubviews
didMoveBy
public void didMoveBy(int deltaX,
int deltaY)
- Called by View's implementation of setBounds(). Subviews
override this method to learn when they change position.
didSizeBy
public void didSizeBy(int deltaWidth,
int deltaHeight)
- Called by setBounds() to resize a View's subviews. View
subclasses requiring specialized resizing behavior should override
this method.
setBounds
public void setBounds(Rect rect)
- Convenience method for setting the bounds with a Rect. Equivalent
to the code:
setBounds(rect.x, rect.y, rect.width, rect.height);
- See Also:
- setBounds
setBounds
public void setBounds(int x,
int y,
int width,
int height)
- Primitive method for changing a View's bounds Rect. Sets the
View's bounding rectangle and then calls didMoveBy()
with the old origin, and didSizeBy() with the old size. It also
adjusts the size of its drawingBuffer, if any, and notifies its
superview if this View's size has changed.
- See Also:
- bounds, localBounds
moveBy
public void moveBy(int deltaX,
int deltaY)
- Convenience method to translate the View's origin by deltaX
and deltaY. Calls setBounds().
moveTo
public void moveTo(int x,
int y)
- Convenience method to translate the View's origin. Calls
setBounds().
sizeBy
public void sizeBy(int deltaWidth,
int deltaHeight)
- Convenience method for changing the View's size. Calls
setBounds().
sizeTo
public void sizeTo(int width,
int height)
- Convenience method for setting the View's size. Call
setBounds().
setMinSize
public void setMinSize(int width,
int height)
- Convenience method for setting the View's minimum size to
(width, height). This is the size that will be
returned from the minSize() method. Normally, minSize()
computes a View subclass' minimum based on current conditions. Setting
a minimum size of (-1, -1) erases the previous minimum size set.
- See Also:
- minSize
minSize
public Size minSize()
- Returns the View's minimum size. If the minimum size has not been
set, returns a Size instance with zero width and height.
- See Also:
- setMinSize
sizeToMinSize
public void sizeToMinSize()
- Resizes the View to the minimum size needed to display its contents.
Calls the minSize() method to get the View's minimum size
information.
- See Also:
- minSize
subviewDidResize
public void subviewDidResize(View aSubview)
- Notifies a View that one of its subviews has changed size. This
information is important to ScrollViews and other View subclasses
that need to know if a descendant has changed size. The default
implementation simply passes the notification up to the View's
superview.
subviewDidMove
public void subviewDidMove(View aSubview)
- Notifies a View that one of its subviews has moved. This
information is important to ScrollViews and other View subclasses
that need to know if a descendant has moved. The default
implementation simply passes the notification up to the View's
superview.
addSubview
public void addSubview(View aView)
- Adds aView to the Application's View hierarchy, as a subview
of this View.
- See Also:
- removeFromSuperview, ancestorWasAddedToViewHierarchy
ancestorWasAddedToViewHierarchy
protected void ancestorWasAddedToViewHierarchy(View addedView)
- Called when the View or one of its ancestors has been added to the
Application's View hierarchy.
- See Also:
- addSubview, ancestorWillRemoveFromViewHierarchy
removeSubview
protected void removeSubview(View aView)
removeFromSuperview
public void removeFromSuperview()
- Removes the View from the Application's View hierarchy, setting its
superview to becomes null.
- See Also:
- addSubview, ancestorWillRemoveFromViewHierarchy
ancestorWillRemoveFromViewHierarchy
protected void ancestorWillRemoveFromViewHierarchy(View removedView)
- Called when the View or one of its ancestors has been removed from
the Application's View hierarchy.
You should call
super.ancestorWillRemoveFromViewHierarchy(removedView);
before returning.
- See Also:
- removeFromSuperview, ancestorWasAddedToViewHierarchy
containsPoint
public boolean containsPoint(int x,
int y)
- Returns true if the View's bounds contains the point
(x, y).
containsPointInVisibleRect
public boolean containsPointInVisibleRect(int x,
int y)
- Returns true if the View contains the point (x,
y) within its visible rect.
- See Also:
- computeVisibleRect
viewForMouse
public View viewForMouse(int x,
int y)
- Returns the View containing the point (x, y). The
View first checks its subviews to see if they contain the point,
and if not, checks itself.
cursorForPoint
public int cursorForPoint(int x,
int y)
- Returns the cursor that should appear when the mouse is over
the point (x, y) in the View's coordinate system. By
default, this method returns ARROW_CURSOR. Subclassers
should override this method to implement custom cursor behavior.
mouseDown
public boolean mouseDown(MouseEvent event)
- Called when the user clicks the mouse in the View. You should override
this method to return true if you want to receive subsequent
mouseDragged() and mouseUp() messages. By default, this
method returns false.
- See Also:
- mouseDragged, mouseUp
mouseDragged
public void mouseDragged(MouseEvent event)
- Called when the user drags the mouse (moves it with the mouse button
depressed) after having initially clicked in the View. The mouse
down View will receive mouseDragged() messages until the
user releases the mouse button, even if the user drags the mouse
outside the mouse down View's bounds.
- See Also:
- mouseDown, mouseUp
mouseUp
public void mouseUp(MouseEvent event)
- Called when the user releases the mouse button.
- See Also:
- mouseDown
mouseEntered
public void mouseEntered(MouseEvent event)
- Called when the mouse enters the View's bounds.
- See Also:
- mouseMoved, mouseExited
mouseMoved
public void mouseMoved(MouseEvent event)
- Called when the mouse moves within the View's bounds, after an initial
mouseEntered() message.
- See Also:
- mouseEntered, mouseMoved
mouseExited
public void mouseExited(MouseEvent event)
- Called when the mouse exits the View's bounds, after an initial
mouseEntered() message.
- See Also:
- mouseEntered, mouseMoved
keyDown
public void keyDown(KeyEvent event)
- Called when the user presses a key. The View must register itself with
the Application by calling its setFocusedView() method before it
can receive key down and key up events.
- See Also:
- setFocusedView, keyUp
keyUp
public void keyUp(KeyEvent event)
- Called when the user releases a key, after an initial key down message.
- See Also:
- keyDown
scrollRectToVisible
public void scrollRectToVisible(Rect aRect)
- Forwards the scrollRectToVisible() message to the View's
superview. Views that can service the request, such as a ScrollView,
override this method and perform the scrolling.
- See Also:
- ScrollView
disableDrawing
public void disableDrawing()
- Disables drawing within the View and its subviews. Call
reenableDrawing() to enable drawing.
disableDrawing()/reenableDrawing() pairs can be nested,
and must be balanced.
- See Also:
- reenableDrawing
reenableDrawing
public void reenableDrawing()
- Reenables drawing within the View and its subviews.
- See Also:
- disableDrawing
isDrawingEnabled
public boolean isDrawingEnabled()
- Returns true if drawing is enabled within the View.
- See Also:
- disableDrawing
isInViewHierarchy
public boolean isInViewHierarchy()
- Returns true if the View is a member of the Application's View
hierarchy.
rootView
public RootView rootView()
- Returns the View's RootView, or null if the View isn't
currently in the View hierarchy.
canDraw
public boolean canDraw()
- Returns true if the View is a member of the Application's View
hierarchy and drawing for the View is enabled.
- See Also:
- isDrawingEnabled
computeVisibleRect
public void computeVisibleRect(Rect visibleRect)
- Computes the View's "visible rect," the intersection
of the View's and all of its ancestors' bounding rectangles, placing
it in visibleRect.
- See Also:
- Rect
isTransparent
public boolean isTransparent()
- Returns true if the View is transparent. A View that's
transparent has a drawView() method that doesn't paint all of
the bits within the View's bounds. By default, this method returns
true. Views which are totally opaque should override this method
to return false to improve drawing performance. It is always
safe to return true, but the View's superviews may be drawn
unnecessarily.
wantsMouseEventCoalescing
public boolean wantsMouseEventCoalescing()
- Returns true if the View wants the IFC to
coalesce mouse move or drag events, instead of sending each
individual event to the View. Returns true unless overridden.
- See Also:
- Window
addDirtyRect
public void addDirtyRect(Rect rect)
- Adds a rectangle to be drawn after the current Event is processed.
Calling addDirtyRect(null) dirties the entire View and is
equivalent to setDirty(true).
- See Also:
- setDirty, drawDirtyViews
setDirty
public void setDirty(boolean flag)
- Registers the View to be drawn after processing the current Event.
If flag() is true, the entire View is
marked as needing to be redrawn. If flag() is
false, then the View is marked as not needing to be drawn.
RootView's drawDirtyViews() method calls
setDirty(false) on each dirty View after it has been drawn.
- See Also:
- drawDirtyViews
isDirty
public boolean isDirty()
- Returns true if the View will be redrawn after the current
Event has been processed.
- See Also:
- addDirtyRect, setDirty
drawView
public void drawView(Graphics g)
- Draws the View's contents. You rarely call this method directly,
but you will override it to implement any View subclass drawing.
The IFC sets the Graphics' clipping rectangle to the region requiring
a redraw, and the Graphics object's origin to correspond to the View's
coordinate system origin. This method draws only the View's contents,
not its subviews. The default implementation does nothing.
- See Also:
- draw
drawSubviews
public void drawSubviews(Graphics g)
- Calls the drawView() method of each of the View's subviews.
You never call this method directly, but you can override it to
implement special drawing. For example, the following code draws a
blue rectangle around the View's perimeter, on top of any drawing its
subviews may have performed.
super.drawSubviews(g);
g.setColor(Color.blue);
g.drawRect(0, 0, width(),height());
Placing the drawRect() within the View's drawView()
gives its subviews a chance to draw over the rect. The IFC sets the
passed-in Graphics' clipping rectangle to the region that requires a
redraw.
draw
public void draw(Graphics g,
Rect clipRect)
- Primitive method, instructing the View to draw the clipRect
portion of itself and its subviews to the Graphics g. If
clipRect is null, draws the entire View. If g
is null, uses the RootView's graphics().
draw() sets the Graphics' clipping rectangle and ultimately
calls the View's and its subviews' drawView() methods. All
drawing occurs synchronously (that is, this method does not return
until the requested drawing has been performed).
You should
only call this form of draw() if you have to draw to a specific
Graphics. If not, use one of the more generic versions.
draw
public void draw(Rect clipRect)
- Convenience method for drawing the clipRect portion of the
View. Equivalent to the code:
draw(createGraphics(), clipRect);
draw
public void draw()
- Convenience method for drawing the entire View. Equivalent to
the code:
draw(createGraphics(), null);
setBuffered
public void setBuffered(boolean flag)
- Calling setBuffered(true) causes the View to allocate
an offscreen drawing buffer. The results of all drawing operations
performed within the View's drawView() method, and those of
its subviews, go first to the buffer and then to the screen, reducing
drawing flicker at the cost of speed and memory. In general,
reasonably flicker-free drawing can be achieved without drawing
buffers by careful attention to redrawing the minimum amount
necessary.
isBuffered
public boolean isBuffered()
- Returns true if the View has an offscreen drawing buffer.
- See Also:
- setBuffered
drawingBuffer
public Bitmap drawingBuffer()
- Returns the View's offscreen drawing buffer, if any.
- See Also:
- setBuffered
startFocus
public void startFocus()
- Tells the View that it has become the focus of KeyEvents.
- See Also:
- stopFocus
stopFocus
public void stopFocus()
- Tells the View that it has ceased being the focus of KeyEvents.
- See Also:
- startFocus
pauseFocus
public void pauseFocus()
- Tells the View that it has temporarily ceased being the focus of
KeyEvents, such as when the user begins working with another
application. The View will receive a resumeFocus() message when
it again regains focus.
- See Also:
- resumeFocus
resumeFocus
public void resumeFocus()
- Tells the View that it has regained the KeyEvent focus.
- See Also:
- pauseFocus
setFocusedView
public void setFocusedView()
- Tells a View that it should become the focus of KeyEvents. The
View must be part of the View hierarchy in order to receive
KeyEvents.
describeClassInfo
public void describeClassInfo(ClassInfo info)
- Describes the View class' information.
- See Also:
- describeClassInfo
encode
public void encode(Encoder encoder) throws CodingException
- Encodes the View instance.
- See Also:
- decode
decode
public void decode(Decoder decoder) throws CodingException
- Decodes the View instance.
- See Also:
- decode
finishDecoding
public void finishDecoding() throws CodingException
- Finishes the View instance decoding.
- See Also:
- finishDecoding
convertToView
public void convertToView(View otherView,
int x,
int y,
Point destPoint)
- Converts the x and y to otherView's
coordinate system, and stores the result in destPoint. If
otherView is null, destPoint will be in the
absolute coordinate system.
convertToView
public Point convertToView(View otherView,
int x,
int y)
- Converts the x and y to otherView's
coordinate system, and returns the result. If
otherView is null, destPoint will be in the
absolute coordinate system.
convertRectToView
public void convertRectToView(View otherView,
Rect sourceRect,
Rect destRect)
- Converts the sourceRect to otherView's coordinate
system, and stores the result in destRect. If otherView
is null, destRect will be in the absolute coordinate
system.
convertPointToView
public void convertPointToView(View otherView,
Point sourcePoint,
Point destPoint)
- Converts the sourcePoint to otherView's coordinate
system, and stores the result in destPoint. If otherView
is null, destPoint will be in the absolute coordinate
system.
convertRectToView
public Rect convertRectToView(View otherView,
Rect sourceRect)
- Returns the rectangle containing sourceRect converted
to otherView's coordinate system. If otherView is
null, the returned Rect is in the absolute coordinate system.
convertPointToView
public Point convertPointToView(View otherView,
Point sourcePoint)
- Returns a rectangle containing srcPoint converted
to otherView's coordinate system. If otherView is
null, the returned Rect is in the absolute coordinate system.
convertEventToView
public MouseEvent convertEventToView(View otherView,
MouseEvent sourceEvent)
- Returns a MouseEvent similar to sourceEvent except that its x
and y members have been converted to otherView's coordinate
system. If otherView is null, the
returned MouseEvent is in the absolute coordinate system.
setGraphicsDebugOptions
public void setGraphicsDebugOptions(int debugOptions)
- Enables or disables diagnostic information about every graphics
operation performed within the View or one of its subviews. The
value of debug determines how the View should display this
information:
- DebugGraphics.LOG_OPTION - causes a text message to be printed.
- DebugGraphics.FLASH_OPTION - causes the drawing to flash several
times.
- DebugGraphics.BUFFERED_OPTION - creates an ExternalWindow that
displays the operations performed on the View's offscreen buffer.
debug is bitwise OR'd into the current value.
DebugGraphics.NONE_OPTION disables debugging.
A value of 0 causes no changes to the debugging options.
graphicsDebugOptions
public int graphicsDebugOptions()
- Returns the state of graphics debugging.
- See Also:
- setGraphicsDebugOptions
setLayoutManager
public void setLayoutManager(LayoutManager value)
- Sets the View's LayoutManager, the object responsible for sizing
and positioning the View's subviews.
layoutManager
public LayoutManager layoutManager()
- Returns the View's LayoutManager.
- See Also:
- setLayoutManager
layoutView
public void layoutView(int deltaWidth,
int deltaHeight)
- Sizes and positions the View's subviews. By default, a View acts as
its own LayoutManager.
localBounds
public Rect localBounds()
- Returns the rectangle (0, 0, width(), height()).
- See Also:
- bounds
createGraphics
public Graphics createGraphics()
- Creates a Graphics object for the View. The caller must call
dispose() on this Graphics to free its resources. Subclasses
of View can override this method to return custom subclasses of
Graphics.
This method throws an exception if the View is not in the View
hierarchy.
- See Also:
- dispose
createBuffer
protected Bitmap createBuffer()
- Creates a Bitmap for the View to use as a drawing buffer. View
subclasses can override this method to return custom subclasses of
Bitmap.
toString
public String toString()
- Returns the View's string representation.
- Overrides:
- toString in class Object
All Packages Class Hierarchy This Package Previous Next Index