SkView Class Reference

#include <SkView.h>

Inherits SkEventSink.

Inherited by SkAnimatorView, SkBitmapView, SkHasLabelView, SkImageView, SkProgressView, SkStaticTextView, SkStaticTextView, SkTextView, SkWidget, SkWidgetView, SkWidgetView, and SkWindow.

Collaboration diagram for SkView:
[legend]

List of all members.

Classes

class  Artist
class  B2FIter
class  Click
class  F2BIter
class  Layout

Public Types

enum  Flag_Shift {
  kVisible_Shift, kEnabled_Shift, kFocusable_Shift, kFlexH_Shift,
  kFlexV_Shift, kFlagShiftCount
}
enum  Flag_Mask {
  kVisible_Mask = 1 << kVisible_Shift, kEnabled_Mask = 1 << kEnabled_Shift, kFocusable_Mask = 1 << kFocusable_Shift, kFlexH_Mask = 1 << kFlexH_Shift,
  kFlexV_Mask = 1 << kFlexV_Shift, kAllFlagMasks = (uint32_t)(0 - 1) >> (32 - kFlagShiftCount)
}
enum  FocusDirection { kNext_FocusDirection, kPrev_FocusDirection, kFocusDirectionCount }

Public Member Functions

 SkView (uint32_t flags=0)
virtual ~SkView ()
uint32_t getFlags () const
void setFlags (uint32_t flags)
int isVisible () const
int isEnabled () const
int isFocusable () const
void setVisibleP (bool)
void setEnabledP (bool)
void setFocusableP (bool)
SkScalar width () const
SkScalar height () const
void setSize (SkScalar width, SkScalar height)
void setSize (const SkPoint &size)
void setWidth (SkScalar width)
void setHeight (SkScalar height)
void getLocalBounds (SkRect *bounds) const
SkScalar locX () const
SkScalar locY () const
void setLoc (SkScalar x, SkScalar y)
void setLoc (const SkPoint &loc)
void setLocX (SkScalar x)
void setLocY (SkScalar y)
void offset (SkScalar dx, SkScalar dy)
void draw (SkCanvas *canvas)
void inval (SkRect *rectOrNull)
SkViewgetFocusView () const
bool hasFocus () const
bool acceptFocus ()
SkViewmoveFocus (FocusDirection)
ClickfindClickHandler (SkScalar x, SkScalar y)
SkViewsendEventToParents (const SkEvent &)
bool postEvent (SkEvent *evt, SkEventSinkID sinkID, SkMSec delay)
SkViewgetParent () const
SkViewattachChildToFront (SkView *child)
SkViewattachChildToBack (SkView *child)
void detachFromParent ()
void detachAllChildren ()
void globalToLocal (SkPoint *pt) const
void globalToLocal (SkScalar globalX, SkScalar globalY, SkPoint *local) const
ArtistgetArtist () const
ArtistsetArtist (Artist *artist)
LayoutgetLayout () const
LayoutsetLayout (Layout *, bool invokeLayoutNow=true)
void invokeLayout ()
void inflate (const SkDOM &dom, const SkDOM::Node *node)
void postInflate (const SkTDict< SkView * > &ids)
virtual bool handleInval (const SkRect &)
virtual SkCanvasbeforeChildren (SkCanvas *c)
 called once before all of the children are drawn (or clipped/translated)
virtual void afterChildren (SkCanvas *orig)
 called once after all of the children are drawn (or clipped/translated)
virtual void beforeChild (SkView *child, SkCanvas *canvas)
 called right before this child's onDraw is called
virtual void afterChild (SkView *child, SkCanvas *canvas)
 called right after this child's onDraw is called
virtual ClickonFindClickHandler (SkScalar x, SkScalar y)
virtual bool onClick (Click *)
virtual void onInflate (const SkDOM &dom, const SkDOM::Node *node)
virtual void onPostInflate (const SkTDict< SkView * > &)
virtual void onFocusChange (bool gainFocusP)

Static Public Member Functions

static void DoClickDown (Click *, int x, int y)
static void DoClickMoved (Click *, int x, int y)
static void DoClickUp (Click *, int x, int y)

Protected Member Functions

virtual bool onGetFocusView (SkView **) const
virtual bool onSetFocusView (SkView *)

Friends

class B2FIter
class F2BIter
class SkLayerView

Detailed Description

SkView is the base class for screen management. All widgets and controls inherit from SkView.

Definition at line 33 of file SkView.h.


Member Enumeration Documentation

Enumerator:
kVisible_Mask 

set if the view is visible

kEnabled_Mask 

set if the view is enabled

kFocusable_Mask 

set if the view can receive focus

kFlexH_Mask 

set if the view's width is stretchable

kFlexV_Mask 

set if the view's height is stretchable

kAllFlagMasks 

Definition at line 44 of file SkView.h.

Enumerator:
kVisible_Shift 
kEnabled_Shift 
kFocusable_Shift 
kFlexH_Shift 
kFlexV_Shift 
kFlagShiftCount 

Definition at line 35 of file SkView.h.

Enumerator:
kNext_FocusDirection 
kPrev_FocusDirection 
kFocusDirectionCount 

Definition at line 111 of file SkView.h.


Constructor & Destructor Documentation

SkView::SkView ( uint32_t  flags = 0  ) 
virtual SkView::~SkView (  )  [virtual]

Member Function Documentation

bool SkView::acceptFocus (  ) 
virtual void SkView::afterChild ( SkView child,
SkCanvas canvas 
) [inline, virtual]

called right after this child's onDraw is called

Definition at line 307 of file SkView.h.

virtual void SkView::afterChildren ( SkCanvas orig  )  [inline, virtual]

called once after all of the children are drawn (or clipped/translated)

Definition at line 302 of file SkView.h.

SkView* SkView::attachChildToBack ( SkView child  ) 

Attach the child view to this view, and increment the child's reference count. The child view is added such that it will be drawn before all other child views. The child view parameter is returned.

SkView* SkView::attachChildToFront ( SkView child  ) 
virtual void SkView::beforeChild ( SkView child,
SkCanvas canvas 
) [inline, virtual]

called right before this child's onDraw is called

Definition at line 305 of file SkView.h.

virtual SkCanvas* SkView::beforeChildren ( SkCanvas c  )  [inline, virtual]

called once before all of the children are drawn (or clipped/translated)

Definition at line 300 of file SkView.h.

void SkView::detachAllChildren (  ) 

Attach the child view to this view, and increment the child's reference count. The child view is added such that it will be drawn after all other child views. The child view parameter is returned. Detach all child views from this view.

void SkView::detachFromParent (  ) 

If the view has a parent, detach the view from its parent and decrement the view's reference count. If the parent was the only owner of the view, this will cause the view to be deleted.

static void SkView::DoClickDown ( Click ,
int  x,
int  y 
) [static]
static void SkView::DoClickMoved ( Click ,
int  x,
int  y 
) [static]
static void SkView::DoClickUp ( Click ,
int  x,
int  y 
) [static]
void SkView::draw ( SkCanvas canvas  ) 

Call this to have the view draw into the specified canvas.

Click* SkView::findClickHandler ( SkScalar  x,
SkScalar  y 
)
Artist* SkView::getArtist (  )  const

Return the artist attached to this view (or null). The artist's reference count is not affected.

uint32_t SkView::getFlags (  )  const [inline]

Return the flags associated with the view

Definition at line 59 of file SkView.h.

SkView* SkView::getFocusView (  )  const
Layout* SkView::getLayout (  )  const

Return the layout attached to this view (or null). The layout's reference count is not affected.

void SkView::getLocalBounds ( SkRect bounds  )  const

Return a rectangle set to [0, 0, width, height]

SkView* SkView::getParent (  )  const [inline]

Return the view's parent, or null if it has none. This does not affect the parent's reference count.

Definition at line 167 of file SkView.h.

void SkView::globalToLocal ( SkScalar  globalX,
SkScalar  globalY,
SkPoint local 
) const

Convert the specified x,y from global coordinates into view-local coordinates, returning the answer in the local parameter.

void SkView::globalToLocal ( SkPoint pt  )  const [inline]

Convert the specified point from global coordinates into view-local coordinates

Definition at line 187 of file SkView.h.

virtual bool SkView::handleInval ( const SkRect  )  [virtual]

Override this if you want to handle an inval request from this view or one of its children. Tyically this is only overridden by the by the "window". If your subclass does handle the request, return true so the request will not continue to propogate to the parent.

Reimplemented in SkWindow.

bool SkView::hasFocus (  )  const
SkScalar SkView::height (  )  const [inline]

Return the view's height

Definition at line 77 of file SkView.h.

void SkView::inflate ( const SkDOM dom,
const SkDOM::Node node 
)

Call this to initialize this view based on the specified XML node

void SkView::inval ( SkRect rectOrNull  ) 

Call this to invalidate part of all of a view, requesting that the view's draw method be called. The rectangle parameter specifies the part of the view that should be redrawn. If it is null, it specifies the entire view bounds.

void SkView::invokeLayout (  ) 

If a layout is attached to this view, call its layoutChildren() method

int SkView::isEnabled (  )  const [inline]

Definition at line 67 of file SkView.h.

int SkView::isFocusable (  )  const [inline]

Definition at line 68 of file SkView.h.

int SkView::isVisible (  )  const [inline]

Helper that returns non-zero if the kVisible_Mask bit is set in the view's flags

Definition at line 66 of file SkView.h.

SkScalar SkView::locX (  )  const [inline]

Return the view's left edge

Definition at line 87 of file SkView.h.

SkScalar SkView::locY (  )  const [inline]

Return the view's top edge

Definition at line 89 of file SkView.h.

SkView* SkView::moveFocus ( FocusDirection   ) 
void SkView::offset ( SkScalar  dx,
SkScalar  dy 
)

Offset (move) the view by the specified dx and dy. This does not affect the view's size

virtual bool SkView::onClick ( Click  )  [virtual]

Override this to track clicks, returning true as long as you want to track the pen/mouse.

Reimplemented in SkPushButtonWidget, and SkSliderView.

virtual Click* SkView::onFindClickHandler ( SkScalar  x,
SkScalar  y 
) [virtual]

Override this if you might handle the click

Reimplemented in SkPushButtonWidget, and SkSliderView.

virtual void SkView::onFocusChange ( bool  gainFocusP  )  [virtual]
virtual bool SkView::onGetFocusView ( SkView **   )  const [inline, protected, virtual]

Definition at line 329 of file SkView.h.

virtual void SkView::onInflate ( const SkDOM dom,
const SkDOM::Node node 
) [virtual]
virtual void SkView::onPostInflate ( const SkTDict< SkView * > &   )  [virtual]

Override this if you want to perform post initialization work based on the ID dictionary built during XML parsing. Be sure to call the inherited version too.

virtual bool SkView::onSetFocusView ( SkView  )  [inline, protected, virtual]

Definition at line 330 of file SkView.h.

bool SkView::postEvent ( SkEvent evt,
SkEventSinkID  sinkID,
SkMSec  delay 
) [inline]

Depricated helper function. Just call event->post(sinkID, delay);

Definition at line 162 of file SkView.h.

void SkView::postInflate ( const SkTDict< SkView * > &  ids  ) 

After a view hierarchy is inflated, this may be called with a dictionary containing pairs of <name, view*>, where the name string was the view's "id" attribute when it was inflated.

This will call the virtual onPostInflate for this view, and the recursively call postInflate on all of the view's children.

SkView* SkView::sendEventToParents ( const SkEvent  ) 

Send the event to the view's parent, and its parent etc. until one of them returns true from its onEvent call. This view is returned. If no parent handles the event, null is returned.

Artist* SkView::setArtist ( Artist artist  ) 

Attach the specified artist (or null) to the view, replacing any existing artist. If the new artist is not null, its reference count is incremented. The artist parameter is returned.

void SkView::setEnabledP ( bool   ) 
void SkView::setFlags ( uint32_t  flags  ) 

Set the flags associated with the view

void SkView::setFocusableP ( bool   ) 
void SkView::setHeight ( SkScalar  height  )  [inline]

Definition at line 82 of file SkView.h.

Layout* SkView::setLayout ( Layout ,
bool  invokeLayoutNow = true 
)

Attach the specified layout (or null) to the view, replacing any existing layout. If the new layout is not null, its reference count is incremented. The layout parameter is returned.

void SkView::setLoc ( const SkPoint loc  )  [inline]

Definition at line 92 of file SkView.h.

void SkView::setLoc ( SkScalar  x,
SkScalar  y 
)

Set the view's left and top edge. This does not affect the view's size

void SkView::setLocX ( SkScalar  x  )  [inline]

Definition at line 93 of file SkView.h.

void SkView::setLocY ( SkScalar  y  )  [inline]

Definition at line 94 of file SkView.h.

void SkView::setSize ( const SkPoint size  )  [inline]

Definition at line 80 of file SkView.h.

void SkView::setSize ( SkScalar  width,
SkScalar  height 
)

Set the view's width and height. These must both be >= 0. This does not affect the view's loc

void SkView::setVisibleP ( bool   ) 

Helper to set/clear the view's kVisible_Mask flag

void SkView::setWidth ( SkScalar  width  )  [inline]

Definition at line 81 of file SkView.h.

SkScalar SkView::width (  )  const [inline]

Return the view's width

Definition at line 75 of file SkView.h.


Friends And Related Function Documentation

friend class B2FIter [friend]

Definition at line 342 of file SkView.h.

friend class F2BIter [friend]

Definition at line 343 of file SkView.h.

friend class SkLayerView [friend]

Definition at line 345 of file SkView.h.


The documentation for this class was generated from the following file:

Generated on Tue Oct 20 10:33:06 2009 for Skia by  doxygen 1.6.1