View base class. More...
Inherits BHandler.
Inherited by BBox, BCardView, BControl, BDragger, BGridView, BGroupView, BListView, BMenu, BMenuField, BScrollBar, BScrollView, BSeparatorView, BSplitView, BStatusBar, BStringView, BTabView, and BTextView.
Public Member Functions | |
BView (BMessage *archive) | |
Archive constructor. | |
BView (BRect frame, const char *name, uint32 resizingMode, uint32 flags) | |
Standard constructor. | |
BView (const char *name, uint32 flags, BLayout *layout=NULL) | |
Layout constructor. | |
virtual | ~BView () |
Destructor method. | |
BRect | Bounds () const |
Returns the view's frame rectangle in the view's coordinate system. | |
void | Flush () const |
Flushes the attached window's connection to App Server. | |
BRect | Frame () const |
Returns the view's frame rectangle in the parent's coordinate system. | |
virtual void | GetPreferredSize (float *_width, float *_height) |
Fill out the preferred width and height of the view into the _width and _height parameters. | |
virtual status_t | GetSupportedSuites (BMessage *data) |
virtual void | Hide () |
Hides the view without removing it from the view hierarchy. | |
bool | IsFocus () const |
Returns whether or not the view is the window's current focus view. | |
bool | IsHidden () const |
Returns whether or not the view is hidden. | |
bool | IsHidden (const BView *looking_from) const |
Returns whether or not the view is hidden from the perspective of lookingFrom. | |
bool | IsPrinting () const |
Returns whether or not the view is drawing to a printer. | |
BPoint | LeftTop () const |
Returns the left top corner point. | |
virtual status_t | Perform (perform_code code, void *data) |
Perform some action. (Internal Method) | |
virtual void | ResizeToPreferred () |
Resizes the view to its preferred size keeping the position of the left top corner constant. | |
uint32 | ResizingMode () const |
Returns the resizing mode flags mask set in the constructor or by SetResizingMode(). | |
virtual BHandler * | ResolveSpecifier (BMessage *message, int32 index, BMessage *specifier, int32 form, const char *property) |
virtual void | SetResizingMode (uint32 mode) |
Sets the resizing mode of the view according to the mode mask. | |
void | SetViewCursor (const BCursor *cursor, bool sync=true) |
Assigns cursor to the view. | |
virtual void | Show () |
Shows the view making it visible. | |
void | Sync () const |
Synchronizes the attached window's connection to App Server. | |
BWindow * | Window () const |
Returns the window the view is attached to. | |
View Hierarchy | |
void | AddChild (BView *child, BView *before=NULL) |
Adds child to the view hierarchy immediately before before. | |
bool | AddChild (BLayoutItem *child) |
Add the child layout item to the view hierarchy. | |
bool | RemoveChild (BView *child) |
Removes child from the view hierarchy. | |
int32 | CountChildren () const |
Returns the number of child views that this view has. | |
BView * | ChildAt (int32 index) const |
Returns a pointer to the child view found at index. | |
BView * | NextSibling () const |
Returns a pointer to the next sibling view. | |
BView * | PreviousSibling () const |
Returns a pointer to the previous sibling view. | |
bool | RemoveSelf () |
Removes the view and all child views from the view hierarchy. | |
BView * | FindView (const char *name) const |
Returns the view in the view hierarchy with the specified name. | |
BView * | Parent () const |
Returns a pointer to the view's parent. | |
Coordinate Conversions | |
void | ConvertToScreen (BPoint *point) const |
Convert point to the screen's coordinate system in place. | |
BPoint | ConvertToScreen (BPoint point) const |
Returns point converted to the screen's coordinate system. | |
void | ConvertFromScreen (BPoint *point) const |
Convert point from the screen's coordinate system to the view's coordinate system in place. | |
BPoint | ConvertFromScreen (BPoint point) const |
Returns point converted from the screen's coordinate system to the view's coordinate system. | |
void | ConvertToScreen (BRect *rect) const |
Convert rect to the screen's coordinate system in place. | |
BRect | ConvertToScreen (BRect rect) const |
Returns rect converted to the screen's coordinate system. | |
void | ConvertFromScreen (BRect *rect) const |
Convert rect from the screen's coordinate system to the view's coordinate system in place. | |
BRect | ConvertFromScreen (BRect rect) const |
Returns rect converted from the screen's coordinate system to the view's coordinate system. | |
void | ConvertToParent (BPoint *point) const |
Convert point to the parent's coordinate system in place. | |
BPoint | ConvertToParent (BPoint point) const |
Returns point converted to the parent's coordinate system. | |
void | ConvertFromParent (BPoint *point) const |
Convert point from the parent's coordinate system to the view's coordinate system in place. | |
BPoint | ConvertFromParent (BPoint point) const |
Returns point converted from the parent's coordinate system to the view's coordinate system. | |
void | ConvertToParent (BRect *rect) const |
Convert rect to the parent's coordinate system in place. | |
BRect | ConvertToParent (BRect rect) const |
Returns rect converted to the parent's coordinate system. | |
void | ConvertFromParent (BRect *rect) const |
Convert rect from the parent's coordinate system to the view's coordinate system in place. | |
BRect | ConvertFromParent (BRect rect) const |
Returns rect converted from the parent's coordinate system to the view's coordinate system. | |
virtual void | SetFlags (uint32 flags) |
Sets the view flags to the flags mask. | |
uint32 | Flags () const |
Return the view flags set in the constructor or by SetFlags(). | |
Graphics State | |
void | GetClippingRegion (BRegion *region) const |
Fill out region with the view's clipping region. | |
virtual void | ConstrainClippingRegion (BRegion *region) |
Set the clipping region the region restricting the area that the view can draw in. | |
void | ClipToPicture (BPicture *picture, BPoint where=B_ORIGIN, bool sync=true) |
Intersects the current clipping region of the view with the pixels of picture. | |
void | ClipToInversePicture (BPicture *picture, BPoint where=B_ORIGIN, bool sync=true) |
Intersects the current clipping region of the view with the pixels outside of picture. | |
void | ClipToRect (BRect rect) |
Intersects the current clipping region of the view with the pixels of rect. | |
void | ClipToInverseRect (BRect rect) |
Intersects the current clipping region of the view with the pixels outside of rect. | |
void | ClipToShape (BShape *shape) |
Intersects the current clipping region of the view with the pixels of shape. | |
void | ClipToInverseShape (BShape *shape) |
Intersects the current clipping region of the view with the pixels outside of shape. | |
virtual void | SetDrawingMode (drawing_mode mode) |
Sets the drawing mode of the view. | |
drawing_mode | DrawingMode () const |
Return the current drawing_mode. | |
void | SetBlendingMode (source_alpha srcAlpha, alpha_function alphaFunc) |
Set the blending mode which controls how transparency is used. | |
void | GetBlendingMode (source_alpha *srcAlpha, alpha_function *alphaFunc) const |
Fill out srcAlpha and alphaFunc with the alpha mode and alpha function of the view. | |
virtual void | SetPenSize (float size) |
Set the pen size to size. | |
float | PenSize () const |
Return the current pen size. | |
bool | HasDefaultColors () const |
Tests if the view has any colors set. | |
bool | HasSystemColors () const |
Tests if the view is using system "panel" colors. B_PANEL_BACKGROUND_COLOR for ViewUIColor() B_PANEL_BACKGROUND_COLOR for LowUIColor() B_PANEL_TEXT_COLOR for HighUIColor() | |
void | AdoptParentColors () |
Attempts to use the colors of any parent view. Will adopt view, low, and high colors. Should be called in AttachedToWindow() or AllAttached(). | |
void | AdoptSystemColors () |
Instructs view to use standard system "panel" colors. B_PANEL_BACKGROUND_COLOR for ViewUIColor() B_PANEL_BACKGROUND_COLOR for LowUIColor() B_PANEL_TEXT_COLOR for HighUIColor() | |
void | AdoptViewColors (BView *view) |
Attempts to use the colors of a given view. Will adopt view, low, and high colors. | |
virtual void | SetViewColor (rgb_color color) |
Set the view color of the view. | |
void | SetViewColor (uchar red, uchar green, uchar blue, uchar alpha=255) |
Set the view color of the view. | |
rgb_color | ViewColor () const |
Return the current view color. | |
void | SetViewUIColor (color_which which, float tint=B_NO_TINT) |
Set the view color of the view to a system constant. The color will update live with user changes. | |
color_which | ViewUIColor (float *tint=NULL) const |
Return the current view color constant being used. | |
virtual void | SetHighColor (rgb_color color) |
Set the high color of the view. | |
void | SetHighColor (uchar red, uchar green, uchar blue, uchar alpha=255) |
Set the high color of the view. | |
rgb_color | HighColor () const |
Return the current high color. | |
void | SetHighUIColor (color_which which, float tint=B_NO_TINT) |
Set the high color of the view to a system constant. The color will update live with user changes. | |
color_which | HighUIColor (float *tint=NULL) const |
Return the current high color constant being used. | |
virtual void | SetLowColor (rgb_color color) |
Set the low color of the view. | |
void | SetLowColor (uchar red, uchar green, uchar blue, uchar alpha=255) |
Set the low color of the view. | |
rgb_color | LowColor () const |
Return the current low color. | |
void | SetLowUIColor (color_which which, float tint=B_NO_TINT) |
Set the low color of the view to a system constant. The color will update live with user changes. | |
color_which | LowUIColor (float *tint=NULL) const |
Return the current low color constant being used. | |
void | SetLineMode (cap_mode lineCap, join_mode lineJoin, float miterLimit=B_DEFAULT_MITER_LIMIT) |
Set line mode to use PostScript-style line cap and join modes. | |
join_mode | LineJoinMode () const |
Returns the current line join mode. | |
cap_mode | LineCapMode () const |
Returns the current line cap mode. | |
float | LineMiterLimit () const |
Returns the miter limit used for B_MITER_JOIN join mode. | |
void | SetFillRule (int32 rule) |
Sets the fill rule for the view. | |
int32 | FillRule () const |
Return the current fill mode. | |
void | SetOrigin (BPoint where) |
Sets the origin in the view's coordinate system. | |
void | SetOrigin (float x, float y) |
Sets the origin in the view's coordinate system. | |
BPoint | Origin () const |
Returns the origin point in the view's coordinate system. | |
void | SetTransform (BAffineTransform transform) |
Sets a BAffineTransform to transform the coordinate system. | |
BAffineTransform | Transform () const |
Returns the current BAffineTransform that is applied to the coordinate system. | |
void | TranslateBy (double x, double y) |
Translate the current view by coordinates. | |
void | ScaleBy (double x, double y) |
Scale the current view by factors x and y. | |
void | RotateBy (double angleRadians) |
Rotate the current view by angleRadians. | |
BAffineTransform | TransformTo (coordinate_space basis) const |
Return the BAffineTransform to convert from the current drawing space to basis. | |
void | PushState () |
Saves the drawing state to the stack. | |
void | PopState () |
Restores the drawing state from the stack. | |
void | MovePenTo (BPoint pt) |
Move the pen to point in the view's coordinate system. | |
void | MovePenTo (float x, float y) |
Move the pen to the point specified by x and y in the view's coordinate system. | |
void | MovePenBy (float x, float y) |
Move the pen by x pixels horizontally and y pixels vertically. | |
BPoint | PenLocation () const |
Return the current pen location as a BPoint object. | |
virtual void | SetFont (const BFont *font, uint32 mask=B_FONT_ALL) |
Set the font of the view. | |
void | GetFont (BFont *font) const |
Fill out font with the font set to the view. | |
void | TruncateString (BString *in_out, uint32 mode, float width) const |
Truncate string with truncation mode mode so that it is no wider than width set in the view's font. | |
float | StringWidth (const char *string) const |
Return the width of string set in the font of the view. | |
float | StringWidth (const char *string, int32 length) const |
Return the width of string set in the font of the view up to length characters. | |
void | GetStringWidths (char *stringArray[], int32 lengthArray[], int32 numStrings, float widthArray[]) const |
Fill out widths of the strings in stringArray set in the font of the view into widthArray. | |
void | SetFontSize (float size) |
Set the size of the view's font to size. | |
void | ForceFontAliasing (bool enable) |
Turn anti-aliasing on and off when printing. | |
void | GetFontHeight (font_height *height) const |
Fill out the font_height struct with the view font. | |
void | SetScale (float scale) const |
Sets the scale of the coordinate system the view uses for drawing. | |
float | Scale () const |
Return the current drawing scale. | |
Drawing Related | |
The view must be attached to the window for these methods to work unless otherwise stated. Notes on specific methods are provided below: DrawBitmap() DrawTiledBitmap() DrawBitmap() scales the image to fit if the image has different size than the destination rectangle. DrawTiledBitmap() fills the destination rectangle with copies of the source image, without changing its size. The asynchronous versions pass the image to Application Server and return immediately. This can be more efficient in some cases for example to draw several bitmaps at once and then call Sync() to tell Application Server to wait for them all to finish drawing rather than waiting for each one to draw. The asynchronous versions pass the picture to Application Server and return immediately. This can be more efficient in some cases for example to draw several pictures at once and then call Sync() to tell Application Server to wait for them all to finish drawing rather than waiting for each one to draw. DrawPicture() doesn't alter the graphics state of the view nor do changes to the graphics state of the view alter the BPicture object. What the picture will look like depends on the graphics parameters that were in effect when the picture was recorded. The string is drawn in the view's current font and is modified by the other parameters of the font such as its direction (left-to-right or right-to-left), rotation, spacing, shear, etc. The string is always drawn left to right even if its text direction is set to right-to-left mode. Drawing a string is fastest in DrawString() doesn't erase before drawing. | |
void | SetViewBitmap (const BBitmap *bitmap, BRect srcRect, BRect dstRect, uint32 followFlags=B_FOLLOW_LEFT_TOP, uint32 options=B_TILE_BITMAP) |
Sets the background bitmap of the view. | |
void | SetViewBitmap (const BBitmap *bitmap, uint32 followFlags=B_FOLLOW_LEFT_TOP, uint32 options=B_TILE_BITMAP) |
Sets the background bitmap of the view. | |
void | ClearViewBitmap () |
Clears the background bitmap of the view if it has one. | |
status_t | SetViewOverlay (const BBitmap *overlay, BRect srcRect, BRect dstRect, rgb_color *colorKey, uint32 followFlags=B_FOLLOW_LEFT_TOP, uint32 options=0) |
Sets the overlay bitmap of the view. | |
status_t | SetViewOverlay (const BBitmap *overlay, rgb_color *colorKey, uint32 followFlags=B_FOLLOW_LEFT_TOP, uint32 options=0) |
Sets the overlay bitmap of the view. | |
void | ClearViewOverlay () |
Clears the overlay bitmap of the view if it has one. | |
void | StrokeLine (BPoint toPoint, ::pattern pattern=B_SOLID_HIGH) |
Stroke a line from the current pen location to the point toPoint. | |
void | StrokeLine (BPoint start, BPoint end, ::pattern pattern=B_SOLID_HIGH) |
Stroke a line from point start to point end. | |
void | BeginLineArray (int32 count) |
Begin a line array of up to count lines. | |
void | AddLine (BPoint start, BPoint end, rgb_color color) |
Add a line to the line array drawn from start to end. | |
void | EndLineArray () |
End the line array drawing the lines. | |
void | StrokePolygon (const BPolygon *polygon, bool closed=true, ::pattern pattern=B_SOLID_HIGH) |
Stroke a polygon shape. | |
void | StrokePolygon (const BPoint *pointArray, int32 numPoints, bool closed=true, ::pattern pattern=B_SOLID_HIGH) |
Stroke a polygon shape made up of points specified by pointArray. | |
void | StrokePolygon (const BPoint *pointArray, int32 numPoints, BRect bounds, bool closed=true, ::pattern pattern=B_SOLID_HIGH) |
Stroke a polygon shape made up of points specified by pointArray inscribed by bounds. | |
void | FillPolygon (const BPolygon *polygon, ::pattern pattern=B_SOLID_HIGH) |
Fill a polygon shape. | |
void | FillPolygon (const BPoint *pointArray, int32 numPoints, ::pattern pattern=B_SOLID_HIGH) |
Fill a polygon shape made up of points specified by pointArray. | |
void | FillPolygon (const BPoint *pointArray, int32 numPoints, BRect bounds, ::pattern pattern=B_SOLID_HIGH) |
Fill a polygon shape made up of points specified by pointArray inscribed by bounds. | |
void | FillPolygon (const BPolygon *polygon, const BGradient &gradient) |
Fill a polygon shape with the specified gradient pattern. | |
void | FillPolygon (const BPoint *pointArray, int32 numPoints, const BGradient &gradient) |
Fill a polygon shape made up of points specified by pointArray with the specified gradient pattern. | |
void | FillPolygon (const BPoint *pointArray, int32 numPoints, BRect bounds, const BGradient &gradient) |
Fill a polygon shape made up of points specified by pointArray inscribed by bounds with the specified gradient pattern. | |
void | StrokeTriangle (BPoint point1, BPoint point2, BPoint point3, BRect bounds, ::pattern pattern=B_SOLID_HIGH) |
Stroke the triangle specified by points point1, point2, and point3 and enclosed by bounds. | |
void | StrokeTriangle (BPoint point1, BPoint point2, BPoint point3, ::pattern pattern=B_SOLID_HIGH) |
Stroke the triangle specified by points point1, point2, and point3. | |
void | FillTriangle (BPoint point1, BPoint point2, BPoint point3, ::pattern pattern=B_SOLID_HIGH) |
Fill the triangle specified by points point1, point2, and point3. | |
void | FillTriangle (BPoint point1, BPoint point2, BPoint point3, BRect bounds, ::pattern pattern=B_SOLID_HIGH) |
Fill the triangle specified by points point1, point2, and point3 and enclosed by bounds. | |
void | FillTriangle (BPoint point1, BPoint point2, BPoint point3, const BGradient &gradient) |
Fill the triangle specified by points point1, point2, and point3 with the specified gradient pattern. | |
void | FillTriangle (BPoint point1, BPoint point2, BPoint point3, BRect bounds, const BGradient &gradient) |
Fill the triangle specified by points point1, point2, and point3 and enclosed by bounds with the specified gradient pattern. | |
void | StrokeRect (BRect rect, ::pattern pattern=B_SOLID_HIGH) |
Stroke the rectangle specified by rect. | |
void | FillRect (BRect rect, ::pattern pattern=B_SOLID_HIGH) |
Fill the rectangle specified by rect. | |
void | FillRect (BRect rect, const BGradient &gradient) |
Fill the rectangle specified by rect with the specified gradient pattern. | |
void | FillRegion (BRegion *rectegion, ::pattern pattern=B_SOLID_HIGH) |
Fill region. | |
void | FillRegion (BRegion *rectegion, const BGradient &gradient) |
Fill region with the specified gradient pattern. | |
void | InvertRect (BRect rect) |
Inverts the colors within rect. | |
void | StrokeRoundRect (BRect rect, float xRadius, float yRadius, ::pattern pattern=B_SOLID_HIGH) |
Stroke the rounded rectangle with horizontal radius xRadius and vertical radius yRadius. | |
void | FillRoundRect (BRect rect, float xRadius, float yRadius, ::pattern pattern=B_SOLID_HIGH) |
Fill the rounded rectangle with horizontal radius xRadius and vertical radius yRadius. | |
void | FillRoundRect (BRect rect, float xRadius, float yRadius, const BGradient &gradient) |
Fill the rounded rectangle with horizontal radius xRadius and vertical radius yRadius with the specified gradient pattern. | |
void | StrokeEllipse (BPoint center, float xRadius, float yRadius, ::pattern pattern=B_SOLID_HIGH) |
Stroke the outline of an ellipse starting at center with a horizontal radius of xRadius and a vertical radius of yRadius. | |
void | StrokeEllipse (BRect rect, ::pattern pattern=B_SOLID_HIGH) |
Stroke the outline of an ellipse inscribed within rect. | |
void | FillEllipse (BPoint center, float xRadius, float yRadius, ::pattern pattern=B_SOLID_HIGH) |
Fill an ellipse starting at center with a horizontal radius of xRadius and a vertical radius of yRadius. | |
void | FillEllipse (BRect rect, ::pattern pattern=B_SOLID_HIGH) |
Fill an ellipse inscribed within rect. | |
void | FillEllipse (BPoint center, float xRadius, float yRadius, const BGradient &gradient) |
Fill an ellipse with the specified gradient pattern starting at center with a horizontal radius of xRadius and a vertical radius of yRadius. | |
void | FillEllipse (BRect rect, const BGradient &gradient) |
Fill an ellipse with the specified gradient pattern inscribed within rect. | |
void | StrokeArc (BPoint center, float xRadius, float yRadius, float startAngle, float arcAngle, ::pattern pattern=B_SOLID_HIGH) |
Stroke the outline of an arc starting at center with a horizontal radius of xRadius and a vertical radius of yRadius starting at startAngle and drawing arcAngle degrees. | |
void | StrokeArc (BRect rect, float startAngle, float arcAngle, ::pattern pattern=B_SOLID_HIGH) |
Stroke the outline of an arc inscribed within rect starting at startAngle and drawing arcAngle degrees. | |
void | FillArc (BPoint center, float xRadius, float yRadius, float startAngle, float arcAngle, ::pattern pattern=B_SOLID_HIGH) |
Fill an arc starting at center with a horizontal radius of xRadius and a vertical radius of yRadius starting at startAngle and drawing arcAngle degrees. | |
void | FillArc (BRect rect, float startAngle, float arcAngle, ::pattern pattern=B_SOLID_HIGH) |
Fill an arc inscribed within rect starting at startAngle and drawing arcAngle degrees. | |
void | FillArc (BPoint center, float xRadius, float yRadius, float startAngle, float arcAngle, const BGradient &gradient) |
Fill an arc with the specified gradient pattern starting at center with a horizontal radius of xRadius and a vertical radius of yRadius starting at startAngle and drawing arcAngle degrees. | |
void | FillArc (BRect rect, float startAngle, float arcAngle, const BGradient &gradient) |
Fill an arc with the specified gradient pattern inscribed within rect starting at startAngle and drawing arcAngle degrees. | |
void | StrokeBezier (BPoint *controlPoints, ::pattern pattern=B_SOLID_HIGH) |
Stroke a bezier curve. | |
void | FillBezier (BPoint *controlPoints, ::pattern pattern=B_SOLID_HIGH) |
Fill a bezier curve. | |
void | FillBezier (BPoint *controlPoints, const BGradient &gradient) |
Fill a bezier curve. | |
void | StrokeShape (BShape *shape, ::pattern pattern=B_SOLID_HIGH) |
Stroke shape. | |
void | FillShape (BShape *shape, ::pattern pattern=B_SOLID_HIGH) |
Fill shape. | |
void | FillShape (BShape *shape, const BGradient &gradient) |
Fill shape with the specified gradient pattern. | |
void | CopyBits (BRect src, BRect dst) |
Copy the bits from the src rectangle to the dst rectangle in the view's coordinate system. | |
void | DrawBitmapAsync (const BBitmap *aBitmap, BRect bitmapRect, BRect viewRect, uint32 options) |
Draws bitmap on the view within viewRect asynchronously. bitmap portion is scaled to fit viewRect. | |
void | DrawBitmapAsync (const BBitmap *aBitmap, BRect bitmapRect, BRect viewRect) |
Draws bitmap on the view within viewRect asynchronously. bitmap portion is scaled to fit viewRect. | |
void | DrawBitmapAsync (const BBitmap *aBitmap, BRect viewRect) |
Draws bitmap on the view within viewRect asynchronously. bitmap is scaled to fit viewRect. | |
void | DrawBitmapAsync (const BBitmap *aBitmap, BPoint where) |
Draws bitmap on the view offset by where asynchronously. | |
void | DrawBitmapAsync (const BBitmap *aBitmap) |
Draws bitmap on the view asynchronously. | |
void | DrawBitmap (const BBitmap *aBitmap, BRect bitmapRect, BRect viewRect, uint32 options) |
Draws bitmap on the view within viewRect. bitmap portion is scaled to fit viewRect. | |
void | DrawBitmap (const BBitmap *aBitmap, BRect bitmapRect, BRect viewRect) |
Draws bitmap on the view within viewRect. bitmap portion is scaled to fit viewRect. | |
void | DrawBitmap (const BBitmap *aBitmap, BRect viewRect) |
Draws bitmap on the view within viewRect. bitmap is scaled to fit viewRect. | |
void | DrawBitmap (const BBitmap *aBitmap, BPoint where) |
Draws bitmap on the view offset by where. | |
void | DrawBitmap (const BBitmap *aBitmap) |
Draws bitmap on the view. | |
void | DrawTiledBitmapAsync (const BBitmap *aBitmap, BRect viewRect, BPoint phase=B_ORIGIN) |
Draws bitmap on the view within viewRect asynchronously. If bitmap is smaller, it is cloned to fill remaining space in viewRect. | |
void | DrawTiledBitmap (const BBitmap *aBitmap, BRect viewRect, BPoint phase=B_ORIGIN) |
Draws bitmap on the view within viewRect. If bitmap is smaller, it is cloned to fill remaining space in viewRect. | |
void | DrawChar (char aChar) |
Draws character c onto to the view at the current pen position. | |
void | DrawChar (char aChar, BPoint location) |
Draws character c at the specified location in the view. | |
void | DrawString (const char *string, escapement_delta *delta=NULL) |
Draw string onto the view at the current pen position. | |
void | DrawString (const char *string, BPoint location, escapement_delta *delta=NULL) |
Draw string onto the view at the specified location in the view. | |
void | DrawString (const char *string, int32 length, escapement_delta *delta=NULL) |
Draw string up to length characters onto the view at the current pen position. | |
void | DrawString (const char *string, int32 length, BPoint location, escapement_delta *delta=0L) |
Draw string up to length characters onto the view at the specified location in the view. | |
void | DrawString (const char *string, const BPoint *locations, int32 locationCount) |
Draw string locationCount times at the specified locations. | |
void | DrawString (const char *string, int32 length, const BPoint *locations, int32 locationCount) |
Draw string up to length characters locationCount times at the specified locations. | |
void | Invalidate (BRect invalRect) |
Sends a message to App Server to redraw the portion of the view specified by invalRect. | |
void | Invalidate (const BRegion *invalRegion) |
Sends a message to App Server to redraw the portion of the view specified by region. | |
void | Invalidate () |
Sends a message to App Server to redraw the view. | |
void | DelayedInvalidate (bigtime_t delay) |
Sends a message to App Server to redraw the entire view after a certain, minimum, delay. Repeated calls to this method may be merged, but the view is guaranteed to be redrawn after the delay given in the first call of this method. | |
void | DelayedInvalidate (bigtime_t delay, BRect invalRect) |
Sends a message to App Server to redraw the portion of the view specified by invalRect after a certain, minimum, delay. Repeated calls to this method may be merged, but the invalidated rect is guaranteed to be redrawn after the minimum delay given by the first call of this method. | |
void | SetDiskMode (char *filename, long offset) |
Unimplemented. | |
void | BeginPicture (BPicture *a_picture) |
Begins sending drawing instructions to picture. | |
void | AppendToPicture (BPicture *a_picture) |
Appends drawing instructions to picture without clearing it first. | |
BPicture * | EndPicture () |
Ends the drawing instruction recording session and returns the BPicture object passed to BeginPicture() or AppendToPicture(). | |
void | DrawPicture (const BPicture *a_picture) |
Draws the picture at the view's current pen position. | |
void | DrawPicture (const BPicture *a_picture, BPoint where) |
Draws the picture at the location in the view specified by where. | |
void | DrawPicture (const char *filename, long offset, BPoint where) |
Draws the picture from the file specified by filename offset by offset bytes at the location in the view specified by where. | |
void | DrawPictureAsync (const BPicture *a_picture) |
Draws the picture at the view's current pen position. | |
void | DrawPictureAsync (const BPicture *a_picture, BPoint where) |
Draws the picture at the location in the view specified by where. | |
void | DrawPictureAsync (const char *filename, long offset, BPoint where) |
Draws the picture from the file specified by filename offset by offset bytes at the location in the view specified by where. | |
void | BeginLayer (uint8 opacity) |
Begins a drawing layer. | |
void | EndLayer () |
Finish a layer and blend it in with the view. | |
View Frame Alteration | |
As a view's frame rectangle must be aligned to pixel values all parameters are rounded to the nearest integer. If the view isn't attached these methods alter the frame rectangle without triggering FrameMoved(), FrameResized() or Invalidate(). | |
void | MoveBy (float dh, float dv) |
Moves the view deltaX pixels horizontally and deltaY pixels vertically in the parent view's coordinate system. | |
void | MoveTo (BPoint where) |
Move the view to the location specified by where in the parent view's coordinate system. | |
void | MoveTo (float x, float y) |
Move the view to the coordinates specified by x in the horizontal dimension and y in the vertical dimension in the parent view's coordinate system. | |
void | ResizeBy (float dh, float dv) |
Resize the view by deltaWidth horizontally and deltaHeight vertically without moving the top left corner of the view. | |
void | ResizeTo (float width, float height) |
Resize the view to the specified width and height. | |
void | ResizeTo (BSize size) |
Resize the view to the dimension specified by size. | |
Public Member Functions inherited from BHandler | |
BHandler (const char *name=NULL) | |
Construct a new handler with a name. | |
virtual | ~BHandler () |
Free the filters of this handler, as well as the list of observers. | |
virtual status_t | Perform (perform_code d, void *arg) |
Perform some action (Internal method defined for binary compatibility purposes). | |
BHandler (BMessage *data) | |
Construct a handler from an archived message. | |
BLooper * | Looper () const |
Return a pointer to the looper that this handler is associated with. | |
void | SetName (const char *name) |
Set or change the name of this handler. | |
const char * | Name () const |
Return the name of this handler. | |
virtual void | SetNextHandler (BHandler *handler) |
Set the next handler in the chain that the message is passed on to if this handler cannot process it. | |
BHandler * | NextHandler () const |
Return the next hander in the chain to which the message is passed on. | |
virtual void | AddFilter (BMessageFilter *filter) |
Add filter as a prerequisite to this handler. | |
virtual bool | RemoveFilter (BMessageFilter *filter) |
Remove filter from the filter list. | |
virtual void | SetFilterList (BList *filters) |
Set the internal list of filters to filters. | |
BList * | FilterList () |
Return a pointer to the list of filters. | |
bool | LockLooper () |
Lock the looper associated with this handler. | |
status_t | LockLooperWithTimeout (bigtime_t timeout) |
Lock the looper associated with this handler, with a time out value. | |
void | UnlockLooper () |
Unlock the looper. | |
status_t | StartWatching (BMessenger target, uint32 what) |
Subscribe this handler to watch a specific state change of a target. | |
status_t | StartWatchingAll (BMessenger target) |
Subscribe this handler to watch a target for all events. | |
status_t | StopWatching (BMessenger target, uint32 what) |
Unsubscribe this handler from watching a specific state. | |
status_t | StopWatchingAll (BMessenger target) |
Unsubscribe this handler from watching all states. | |
status_t | StartWatching (BHandler *observer, uint32 what) |
Subscribe an observer for a specific state change of this handler. | |
status_t | StartWatchingAll (BHandler *observer) |
Subscribe an observer for a all state changes. | |
status_t | StopWatching (BHandler *observer, uint32 what) |
Unsubscribe an observer from watching a specific state. | |
status_t | StopWatchingAll (BHandler *observer) |
Unsubscribe an observer from watching all states. | |
virtual void | SendNotices (uint32 what, const BMessage *notice=NULL) |
Emit a state change to the observers. | |
bool | IsWatched () const |
Check if there are any observers watching this handler. | |
Public Member Functions inherited from BArchivable | |
BArchivable () | |
Constructor. Does nothing. | |
BArchivable (BMessage *from) | |
Constructor. Does important behind-the-scenes work in the unarchiving process. | |
virtual | ~BArchivable () |
Destructor. Does nothing. | |
virtual status_t | AllArchived (BMessage *archive) const |
Method relating to the use of BArchiver . | |
virtual status_t | AllUnarchived (const BMessage *archive) |
Method relating to the use of BUnarchiver . | |
virtual status_t | Archive (BMessage *into, bool deep=true) const |
Archive the object into a BMessage. | |
virtual status_t | Perform (perform_code d, void *arg) |
Perform some action (Internal method defined for binary compatibility purposes). | |
Archiving | |
virtual status_t | Archive (BMessage *archive, bool deep=true) const |
Archives the object into the data message. | |
static BArchivable * | Instantiate (BMessage *archive) |
Creates a new BView object from the data message. | |
Hook Methods | |
virtual status_t | AllUnarchived (const BMessage *archive) |
Hook method called when all views have been unarchived. | |
virtual status_t | AllArchived (BMessage *archive) const |
Hook method called when all views have been archived. | |
virtual void | AttachedToWindow () |
Hook method called when the object is attached to a window. | |
virtual void | AllAttached () |
Similar to AttachedToWindow() but this method is triggered after all child views have already been attached to a window. | |
virtual void | DetachedFromWindow () |
Hook method called when the object is detached from a window. | |
virtual void | AllDetached () |
Similar to AttachedToWindow() but this method is triggered after all child views have already been detached from a window. | |
virtual void | MessageReceived (BMessage *message) |
Handle message received by the associated looper. | |
virtual void | Draw (BRect updateRect) |
Draws the area of the view that intersects updateRect. | |
virtual void | MouseDown (BPoint where) |
Hook method called when a mouse button is pressed. | |
virtual void | MouseUp (BPoint where) |
Hook method called when a mouse button is released. | |
virtual void | MouseMoved (BPoint where, uint32 code, const BMessage *dragMessage) |
Hook method called when the mouse is moved. | |
virtual void | WindowActivated (bool active) |
Hook method called when the attached window is activated or deactivated. | |
virtual void | KeyDown (const char *bytes, int32 numBytes) |
Hook method called when a keyboard key is pressed. | |
virtual void | KeyUp (const char *bytes, int32 numBytes) |
Hook method called when a keyboard key is released. | |
virtual void | Pulse () |
Hook method called when the view receives a B_PULSE message. | |
virtual void | FrameMoved (BPoint newPosition) |
Hook method called when the view is moved. | |
virtual void | FrameResized (float newWidth, float newHeight) |
Hook method called when the view is resized. | |
virtual void | TargetedByScrollView (BScrollView *scrollView) |
Hook method called when the view becomes the target of scrollView. | |
virtual void | DrawAfterChildren (BRect updateRect) |
Perform any drawing that needs to be done after child view have already been drawn. | |
virtual void | LayoutInvalidated (bool descendants=false) |
Hook method called when the layout is invalidated. | |
virtual void | LayoutChanged () |
Hook function that is called when the layout if this view, or one of its children, has changed. | |
Input Related | |
void | BeginRectTracking (BRect startRect, uint32 style=B_TRACK_WHOLE_RECT) |
Displays an outline rectangle on the view and initiates tracking. | |
void | EndRectTracking () |
Ends tracking removing the outline rectangle from the view. | |
void | GetMouse (BPoint *location, uint32 *buttons, bool checkMessageQueue=true) |
Fills out the cursor location and the current state of the mouse buttons. | |
void | DragMessage (BMessage *message, BRect dragRect, BHandler *replyTo=NULL) |
Initiates a drag-and-drop session. | |
void | DragMessage (BMessage *message, BBitmap *bitmap, BPoint offset, BHandler *replyTo=NULL) |
Initiates a drag-and-drop session of an image. | |
void | DragMessage (BMessage *message, BBitmap *bitmap, drawing_mode dragMode, BPoint offset, BHandler *replyTo=NULL) |
Initiates a drag-and-drop session of an image with drawing_mode set by dragMode. | |
status_t | SetEventMask (uint32 mask, uint32 options=0) |
Sets whether or not the view can accept mouse and keyboard events when not in focus. | |
uint32 | EventMask () |
Returns the current event mask. | |
status_t | SetMouseEventMask (uint32 mask, uint32 options=0) |
Sets whether or not the view can accept mouse and keyboard events when not in focus from within MouseDown() until the following MouseUp() event. | |
void | ScrollBy (float dh, float dv) |
Scroll the view by deltaX horizontally and deltaY vertically. | |
void | ScrollTo (float x, float y) |
Scroll the view to the point specified by coordinates. | |
virtual void | ScrollTo (BPoint where) |
Scroll the view to the point specified by where. | |
virtual void | MakeFocus (bool focus=true) |
Makes the view the current focus view of the window or gives up being the window's focus view. | |
BScrollBar * | ScrollBar (orientation direction) const |
Returns the BScrollBar object that has the BView set as its target. | |
status_t | ScrollWithMouseWheelDelta (BScrollBar *, float) |
Handle the scroll wheel changing over scrollbars. | |
Layouting | |
| |
virtual BSize | MinSize () |
Return the minimum size of the view. | |
virtual BSize | MaxSize () |
Return the maximum size of the view. | |
virtual BSize | PreferredSize () |
Return the preferred size of the view. | |
virtual BAlignment | LayoutAlignment () |
Return the current BAlignemnt of the view. | |
void | SetExplicitMinSize (BSize size) |
Set this view's min size, to be used by MinSize(). | |
void | SetExplicitMaxSize (BSize size) |
Set this view's max size, to be used by MaxSize(). | |
void | SetExplicitPreferredSize (BSize size) |
Set this view's preferred size, to be used by PreferredSize(). | |
void | SetExplicitSize (BSize size) |
Set this view's size. | |
void | SetExplicitAlignment (BAlignment alignment) |
Set this view's alignment, to be used by Alignment(). | |
BSize | ExplicitMinSize () const |
Returns the explicit minimum size. | |
BSize | ExplicitMaxSize () const |
Returns the explicit maximum size. | |
BSize | ExplicitPreferredSize () const |
Returns the explicit preferred size. | |
BAlignment | ExplicitAlignment () const |
Returns the explicit alignment size. | |
virtual bool | HasHeightForWidth () |
Returns whether the layout of the view can calculate a height for a given width. | |
virtual void | GetHeightForWidth (float width, float *min, float *max, float *preferred) |
Returns the min, max and preferred height for a given width. | |
void | InvalidateLayout (bool descendants=false) |
Invalidate layout. | |
virtual void | SetLayout (BLayout *layout) |
Sets the layout of the view. | |
BLayout * | GetLayout () const |
Get the layout of the view. | |
void | EnableLayoutInvalidation () |
Enable layout invalidation. | |
void | DisableLayoutInvalidation () |
Disable layout invalidation. | |
bool | IsLayoutInvalidationDisabled () |
Returns whether or not layout invalidation is disabled. | |
bool | IsLayoutValid () const |
Returns whether or not the layout is valid. | |
void | ResetLayoutInvalidation () |
Service call for BView derived classes re-enabling InvalidateLayout() notifications. | |
BLayoutContext * | LayoutContext () const |
Returns the BLayoutContext for this View. | |
void | Layout (bool force) |
Layout the view. | |
void | Relayout () |
Relayout the view. | |
virtual void | DoLayout () |
Layout view within the layout context. | |
Tool Tips | |
| |
void | SetToolTip (const char *text) |
Set the tool tip of the view to text. | |
void | SetToolTip (BToolTip *tip) |
Set the tool tip of the view to the tip object. | |
BToolTip * | ToolTip () const |
Return the tool tip set to the view or NULL if not set. | |
void | ShowToolTip (BToolTip *tip=NULL) |
Show the tool tip at the current mouse position. | |
void | HideToolTip () |
Hide the view's tool tip. | |
virtual bool | GetToolTipAt (BPoint point, BToolTip **_tip) |
Point _tip with the view's tool tip. | |
Additional Inherited Members | |
Static Public Member Functions inherited from BHandler | |
static BArchivable * | Instantiate (BMessage *data) |
Static method to instantiate a handler from an archived message. | |
Static Public Member Functions inherited from BArchivable | |
static BArchivable * | Instantiate (BMessage *archive) |
Static member to restore objects from messages. | |
View base class.
A BView is a rectangular area within a window that responds to mouse clicks and key presses, and acts as a surface for you to draw on.
Most Interface Kit classes, with the notable exception of BWindow inherit from BView. Some of the time you might use a BView object as is, but most of the time you subclass BView to do something unique.
To create a subclass of BView you generally override one or more of BView's hook methods to respond to user events such as MouseDown() or FrameMoved(). By default a BView does nothing in its hook methods unless otherwise stated, it's up to you to define what happens. To override the look of a BView you should override the Draw() or DrawAfterChildren() methods. See the section on Hook Methods below for more details.
When a BView object is first created it has no parent or child views. How you add a view to the view hierarchy depends on if you want to use a standard view with a defined frame rectangle or to use the Layout APIs to position and size your view instead.
If you create a standard view you need to add it to a window or another view using the AddChild() method, if you create a layout view you need to add your view to a layout using BLayout::AddView() or by adding it to a layout builder.
Views are not very interesting until they, or one of their parents, are attached to a window as many of BView's methods depend on a connection to the App Server to do their work. In order to prevent multiple views from altering the window simultaneously though locking is required. To perform an action while the window is locked you issue the following code:
Whenever App Server calls a hook method it automatically locks the BWindow for you.
Only one view attached to a window is able to receive keyboard events at a time. The view that is able to receive keyboard events such as KeyDown() is called the "focus view". MakeFocus() gives or removes focus from a view. Call IsFocus() to determine whether or not the view is the window's current focus view.
When a view has focus an indicator should be drawn to inform the user. Typically the view is surrounded by a blue rectangle to indicate that it is the window's focus view. The color can be queried using the keyboard_navigation_color() function in InterfaceDefs.h
Each view has its own coordinate system with the origin point (0.0, 0.0) located at the top left corner. You can convert a BPoint or BRect to or from the view's coordinate system to the coordinate system of its parent, or of the screen's coordinate system. See the section on Coordinate Conversion Methods for more details.
The Application Server clips a BView to the region where it's permitted to draw which is never larger than the view's bound rectangle. A view can never draw outside its bounds nor can it draw outside of the bounds rectangle of any parent view.
You may limit the clipping region further by passing a BRegion object to ConstrainClippingRegion(). You can obtain the current clipping region by calling GetClippingRegion().
Each view has a ViewColor() that fills the frame rectangle before the view does any drawing of its own. The default view color is white, you may change the view color by calling SetViewColor() or, as of Haiku R1, SetViewUIColor(). A commonly used view color is B_PANEL_BACKGROUND_COLOR
which is a user-defined color used as the view color of most applications. If you set the view color to B_TRANSPARENT_COLOR
then the Application Server won't erase the clipping region of the view before updating, this should only be used if the view erases itself by drawing on every pixel in the clipping region.
If you want to set the view color of a view to be the same as its parent you need to set it within the AttachedToWindow() method of the view like so:
Layout constructor.
To be used as part of a BLayout. You may use the Layout Methods found below to set the size and alignment constraints of the view.
B_SUPPORTS_LAYOUT
is automatically set to the view. The view flags can be set after the view has been constructed by calling the SetFlags() methods.
name | The name of the view, can be NULL . |
flags | The view flags, a mask of one or more of the following:
|
layout | A layout to set the view to. |
Standard constructor.
A newly constructed BView object has no parent, you must assign it one by passing it into the AddChild() method of another view or window. Once the view or a parent view has been attached to a window the view becomes part of that window's view hierarchy.
When the BView object is added as a child the frame values are interpreted in the parent's coordinate system. The frame rectangle should be specified in integral values to align on pixel boundaries, decimal values will be rounded.
The resizing mode flags and view flags can be set after the view has been constructed by calling the SetResizingMode() and SetFlags() methods.
frame | The frame rectangle of the view. |
name | The name of the view, can be NULL . |
resizingMode | Defines the view's behavior when its parent is resized. It combines one of the following horizontal resizing constants:
|
flags | The view flags, a mask of one or more of the following:
|
|
virtual |
Destructor method.
Deletes the view and all children freeing any memory used.
BView::BView | ( | BMessage * | archive | ) |
Archive constructor.
archive | The message data to construct the view from. |
bool BView::AddChild | ( | BLayoutItem * | child | ) |
Add the child layout item to the view hierarchy.
child | The child layout item to add. |
Adds child to the view hierarchy immediately before before.
A view may only have one parent at a time so child must not have already been added to the view hierarchy. If before is NULL
then child is added to the end of the tree. If the view is attached to a window child and all of its descendent views also become attached to the window invoking an AttachedToWindow() method on each view.
child | The child view to add. |
before | The sibling view to add child before. |
Add a line to the line array drawn from start to end.
start | The start point of the line. |
end | The end point of the line. |
color | The color to draw the line. |
void BView::AdoptParentColors | ( | ) |
Attempts to use the colors of any parent view. Will adopt view, low, and high colors. Should be called in AttachedToWindow() or AllAttached().
void BView::AdoptSystemColors | ( | ) |
Instructs view to use standard system "panel" colors. B_PANEL_BACKGROUND_COLOR for ViewUIColor() B_PANEL_BACKGROUND_COLOR for LowUIColor() B_PANEL_TEXT_COLOR for HighUIColor()
Referenced by BLayoutBuilder::Grid< ParentBuilder >::Grid(), and BLayoutBuilder::Group< ParentBuilder >::Group().
void BView::AdoptViewColors | ( | BView * | view | ) |
Attempts to use the colors of a given view. Will adopt view, low, and high colors.
Hook method called when all views have been archived.
Reimplemented from BArchivable.
Reimplemented in BMenuField, BSplitView, and BTextControl.
|
virtual |
Similar to AttachedToWindow() but this method is triggered after all child views have already been attached to a window.
Reimplemented in BBox, BButton, BChannelSlider, BCheckBox, BColorControl, BControl, BDragger, BListView, BMenu, BMenuBar, BMenuField, BOptionPopUp, BOutlineListView, BPictureButton, BPopUpMenu, BRadioButton, BScrollBar, BScrollView, BStatusBar, BStringView, BTabView, BTextControl, and BTextView.
|
virtual |
Similar to AttachedToWindow() but this method is triggered after all child views have already been detached from a window.
Reimplemented in BBox, BButton, BChannelSlider, BCheckBox, BColorControl, BControl, BDragger, BListView, BMenu, BMenuBar, BMenuField, BOutlineListView, BPictureButton, BPopUpMenu, BRadioButton, BScrollBar, BScrollView, BStatusBar, BStringView, BTabView, BTextControl, and BTextView.
Hook method called when all views have been unarchived.
Reimplemented from BArchivable.
Reimplemented in BScrollView, BMenuField, BSplitView, BTabView, and BTextControl.
void BView::AppendToPicture | ( | BPicture * | picture | ) |
Appends drawing instructions to picture without clearing it first.
picture | The BPicture object to record drawing instructions to. |
Archives the object into the data message.
data | A pointer to the BMessage object to archive the object into. |
deep | Whether or not to archive child views as well. |
B_OK
if everything went well or an error code otherwise. B_OK | The object was archived successfully. |
B_NO_MEMORY | Ran out of memory while archiving the object. |
Reimplemented from BHandler.
Reimplemented in BBox, BMenu, BMenuBar, BMenuField, BOutlineListView, BPictureButton, BPopUpMenu, BScrollBar, BScrollView, BStatusBar, BStringView, BTextControl, BTextView, BButton, BChannelControl, BCheckBox, BColorControl, BControl, BDragger, BListView, BRadioButton, BChannelSlider, BSeparatorView, BSplitView, and BTabView.
|
virtual |
Hook method called when the object is attached to a window.
Reimplemented in BBox, BButton, BChannelControl, BChannelSlider, BCheckBox, BColorControl, BControl, BDragger, BListView, BMenu, BMenuBar, BMenuField, BOptionPopUp, BPictureButton, BPopUpMenu, BRadioButton, BScrollBar, BScrollView, BSplitView, BStatusBar, BStringView, BTabView, BTextControl, and BTextView.
void BView::BeginLayer | ( | uint8 | opacity | ) |
Begins a drawing layer.
This feature of BView allows you to create a separate layer, draw on it, and blend it in with the rest of the view with a given opacity. Internally, the method creates a new drawing buffer, that you can draw on using the methods of BView. After finishing your layer, you call EndLayer() to apply the opacity to the layer, and blend it in with the existing drawing.
You can nest layers, meaning you can call this method while drawing a layer, to create a sublayer. The layers are mixed and blended in order.
This work was done to support drawing for WebKit.
void BView::BeginLineArray | ( | int32 | count | ) |
Begin a line array of up to count lines.
This is a more efficient way of drawing a large number of lines than calling StrokeLine() repeatedly. First call BeginLineArray() to begin drawing lines, then call AddLine() for each line you wish to draw, and finally call EndLineArray() to finish the line array and draw the lines.
These methods don't move the current pen location or change the high or low colors of the view. count should be close to the number of lines you wish to draw and should be below 256 to draw efficiently.
count | The maximum number of lines in the line array to draw. |
void BView::BeginPicture | ( | BPicture * | picture | ) |
Begins sending drawing instructions to picture.
The BPicture object is cleared and any successive drawing instructions sent to the view are redirected to picture until EndPicture() is called. To append drawing instructions to a BPicture object without clearing it first call AppendToPicture() instead.
The view doesn't display anything to the screen while it's recording to picture. Use the DrawPicture() method to render the picture.
Only drawing instructions performed directly on the view, not its child views are send to the BPicture object and BPicture captures only primitive graphics operations. The view must be attached to a window for the drawing instruction to be recorded. Drawing instructions are recorded even if the view is hidden or resides outside the clipping region or the window is off-screen.
picture | The BPicture object to record drawing instructions to. |
void BView::BeginRectTracking | ( | BRect | startRect, |
uint32 | style = B_TRACK_WHOLE_RECT |
||
) |
Displays an outline rectangle on the view and initiates tracking.
This method is typically called from the MouseDown() while EndRectTracking() is typically called from the MouseUp method().
startRect | The initial frame in the view's coordinate system. |
style | This parameter is set to one of the following:
|
BRect BView::Bounds | ( | ) | const |
Returns the view's frame rectangle in the view's coordinate system.
Returns a pointer to the child view found at index.
index | The index of the child view to return a pointer of. |
NULL
if not found.void BView::ClearViewBitmap | ( | ) |
Clears the background bitmap of the view if it has one.
void BView::ClearViewOverlay | ( | ) |
Clears the overlay bitmap of the view if it has one.
Intersects the current clipping region of the view with the pixels outside of picture.
picture | The BPicture object to intersect with. |
where | Offset in the view's coordinate system. |
sync | If false , this method will execute asynchronously. |
void BView::ClipToInverseRect | ( | BRect | rect | ) |
Intersects the current clipping region of the view with the pixels outside of rect.
rect | The BRect that describes the rectangle to intersect with. |
void BView::ClipToInverseShape | ( | BShape * | shape | ) |
Intersects the current clipping region of the view with the pixels outside of shape.
shape | The BShape that describes the area to intersect with. |
Intersects the current clipping region of the view with the pixels of picture.
BPicture instances are resolution independent, picture is effectively drawn at the view's resolution and the bitmap produced is used to modify the clipping region.
The pixels that are at least partially opaque are the ones drawn by picture.
picture | The BPicture object to intersect with. |
where | Offset in the view's coordinate system. |
sync | If false , this method will execute asynchronously. |
void BView::ClipToRect | ( | BRect | rect | ) |
Intersects the current clipping region of the view with the pixels of rect.
rect | The BRect that describes the rectangle to intersect with. |
void BView::ClipToShape | ( | BShape * | shape | ) |
Intersects the current clipping region of the view with the pixels of shape.
shape | The BShape that describes the area to intersect with. |
|
virtual |
Set the clipping region the region restricting the area that the view can draw in.
The Application Server keeps track of the clipping region for each view attached to a window so that the view can't draw outside of it, consequently this method works only for views that are attached to a window.
The default clipping region contains the visible area of the view. By passing a region to this method the clipping area is further restricted. Passing in NULL
resets the clipping region back to the default.
Calls to ConstrainClippingRegion() are not cumulative, each time this method is called it replaces the old clipping region. However, clipping regions from previous states are intersected to compute the effective clipping.
Region-based clipping is not affected by the view transform. If you need to constrain drawing to a transformed region, use ClipToPicture() and FillRegion() instead.
region | The region to set the clipping region to or NULL to reset to default. |
void BView::ConvertFromParent | ( | BPoint * | point | ) | const |
Convert point from the parent's coordinate system to the view's coordinate system in place.
point | A pointer to a BPoint object to convert. |
void BView::ConvertFromParent | ( | BRect * | rect | ) | const |
Convert rect from the parent's coordinate system to the view's coordinate system in place.
rect | A pointer to a BRect object to convert. |
void BView::ConvertFromScreen | ( | BPoint * | point | ) | const |
Convert point from the screen's coordinate system to the view's coordinate system in place.
point | A pointer to a BPoint object to convert. |
void BView::ConvertFromScreen | ( | BRect * | rect | ) | const |
Convert rect from the screen's coordinate system to the view's coordinate system in place.
rect | A pointer to a BRect object to convert. |
void BView::ConvertToParent | ( | BPoint * | point | ) | const |
Convert point to the parent's coordinate system in place.
point | A pointer to a BPoint object to convert. |
void BView::ConvertToParent | ( | BRect * | rect | ) | const |
Convert rect to the parent's coordinate system in place.
rect | A pointer to a BRect object to convert. |
void BView::ConvertToScreen | ( | BPoint * | point | ) | const |
Convert point to the screen's coordinate system in place.
point | A pointer to a BPoint object to convert. |
void BView::ConvertToScreen | ( | BRect * | rect | ) | const |
Convert rect to the screen's coordinate system in place.
rect | A pointer to a BRect object to convert. |
Copy the bits from the src rectangle to the dst rectangle in the view's coordinate system.
If the rectangles are of different sizes than src is scaled to fit. src is clipped if a part of dst lies outside of the visible region of the view. Only the visible portions of src are copied.
The view must be attached to a window for this method to work.
src | The source rectangle to copy bits from. |
dst | The destination rectangle to copy bits to. |
int32 BView::CountChildren | ( | ) | const |
Returns the number of child views that this view has.
void BView::DelayedInvalidate | ( | bigtime_t | delay | ) |
Sends a message to App Server to redraw the entire view after a certain, minimum, delay. Repeated calls to this method may be merged, but the view is guaranteed to be redrawn after the delay given in the first call of this method.
delay | The time, in microseconds, to wait until redrawing the view. |
Sends a message to App Server to redraw the portion of the view specified by invalRect after a certain, minimum, delay. Repeated calls to this method may be merged, but the invalidated rect is guaranteed to be redrawn after the minimum delay given by the first call of this method.
delay | The time, in microseconds, to wait until redrawing the view. |
invalRect | The rectangular area of the view to redraw. |
|
virtual |
Hook method called when the object is detached from a window.
Reimplemented in BBox, BButton, BChannelControl, BChannelSlider, BCheckBox, BColorControl, BControl, BDragger, BListView, BMenu, BMenuBar, BMenuField, BOutlineListView, BPictureButton, BPopUpMenu, BRadioButton, BScrollBar, BScrollView, BStatusBar, BStringView, BTabView, BTextControl, and BTextView.
void BView::DisableLayoutInvalidation | ( | ) |
Disable layout invalidation.
|
protectedvirtual |
Layout view within the layout context.
Reimplemented in BBox, BMenu, BMenuField, BScrollView, BSeparatorView, BTextControl, and BTextView.
void BView::DragMessage | ( | BMessage * | message, |
BBitmap * | image, | ||
BPoint | offset, | ||
BHandler * | replyTo = NULL |
||
) |
Initiates a drag-and-drop session of an image.
message | Contains data to be dragged and dropped on the destination view. The caller retains responsibility for this object. |
image | Bitmap image dragged by the user. The memory used by the bitmap is freed automatically when the message is dropped. |
offset | The offset to the hotspot within the image in the bitmap's coordinate system. |
replyTo | The target set to handle the message sent in reply to the dragged message. If NULL the reply is instead directed to the BView object that initiated the drag-and-drop session. |
void BView::DragMessage | ( | BMessage * | message, |
BBitmap * | image, | ||
drawing_mode | dragMode, | ||
BPoint | offset, | ||
BHandler * | replyTo = NULL |
||
) |
Initiates a drag-and-drop session of an image with drawing_mode set by dragMode.
message | Contains data to be dragged and dropped on the destination view. The caller retains responsibility for this object. |
image | Bitmap image dragged by the user. The memory used by the bitmap is freed automatically when the message is dropped. |
dragMode | Sets the drawing_mode used to draw the dragged image. Set to B_OP_ALPHA to drag-and-drop partially transparent images. |
offset | The offset to the hotspot within the image in the bitmap's coordinate system. |
replyTo | The target set to handle the message sent in reply to the dragged message. If NULL the reply is instead directed to the BView object that initiated the drag-and-drop session. |
Initiates a drag-and-drop session.
message | Contains data to be dragged and dropped on the destination view. The caller retains responsibility for this object. |
dragRect | An outline rectangle used in place of a bitmap image set in the view's coordinate system. |
replyTo | The target set to handle the message sent in reply to the dragged message. If NULL the reply is instead directed to the BView object that initiated the drag-and-drop session. |
|
virtual |
Draws the area of the view that intersects updateRect.
Derived classes should override this method to draw their view.
updateRect | The rectangular area to be drawn. |
Reimplemented in BStringView, BBox, BButton, BChannelSlider, BCheckBox, BColorControl, BDragger, BListView, BMenu, BMenuBar, BMenuField, BPictureButton, BRadioButton, BScrollBar, BScrollView, BSeparatorView, BSplitView, BStatusBar, BTabView, BTextControl, BTextView, and BChannelControl.
|
virtual |
Perform any drawing that needs to be done after child view have already been drawn.
updateRect | The rectangular area to drawn in. |
Reimplemented in BSplitView.
void BView::DrawBitmap | ( | const BBitmap * | bitmap | ) |
Draws bitmap on the view.
bitmap | The bitmap to draw onto the view. |
Draws bitmap on the view offset by where.
bitmap | The bitmap to draw onto the view. |
where | The location to draw the bitmap in the view's coordinate system. |
Draws bitmap on the view within viewRect. bitmap portion is scaled to fit viewRect.
bitmap | The bitmap to draw onto the view. |
bitmapRect | The portion of the bitmap to draw in the bitmap's coordinate system. |
viewRect | The area in the view's coordinate system to draw the bitmap in. |
Draws bitmap on the view within viewRect. bitmap portion is scaled to fit viewRect.
bitmap | The bitmap to draw onto the view. |
bitmapRect | The portion of the bitmap to draw in the bitmap's coordinate system. |
viewRect | The area in the view's coordinate system to draw the bitmap in. |
options | ?? |
Draws bitmap on the view within viewRect. bitmap is scaled to fit viewRect.
bitmap | The bitmap to draw onto the view. |
viewRect | The area in the view's coordinate system to draw the bitmap in. |
void BView::DrawBitmapAsync | ( | const BBitmap * | bitmap | ) |
Draws bitmap on the view asynchronously.
bitmap | The bitmap to draw onto the view. |
Draws bitmap on the view offset by where asynchronously.
bitmap | The bitmap to draw onto the view. |
where | The location to draw the bitmap in the view's coordinate system. |
Draws bitmap on the view within viewRect asynchronously. bitmap portion is scaled to fit viewRect.
bitmap | The bitmap to draw onto the view. |
bitmapRect | The portion of the bitmap to draw in the bitmap's coordinate system. |
viewRect | The area in the view's coordinate system to draw the bitmap in. |
void BView::DrawBitmapAsync | ( | const BBitmap * | bitmap, |
BRect | bitmapRect, | ||
BRect | viewRect, | ||
uint32 | options | ||
) |
Draws bitmap on the view within viewRect asynchronously. bitmap portion is scaled to fit viewRect.
bitmap | The bitmap to draw onto the view. |
bitmapRect | The portion of the bitmap to draw in the bitmap's coordinate system. |
viewRect | The area in the view's coordinate system to draw the bitmap in. |
options | combination of bitmap_drawing_options flags |
Draws bitmap on the view within viewRect asynchronously. bitmap is scaled to fit viewRect.
bitmap | The bitmap to draw onto the view. |
viewRect | The area in the view's coordinate system to draw the bitmap in. |
void BView::DrawChar | ( | char | c | ) |
Draws character c onto to the view at the current pen position.
The character is drawn in the view's current font.
c | The character to draw. |
void BView::DrawChar | ( | char | c, |
BPoint | location | ||
) |
Draws character c at the specified location in the view.
The character is drawn in the view's current font.
c | The character to draw. |
location | The location in the view to draw the character. |
drawing_mode BView::DrawingMode | ( | ) | const |
Return the current drawing_mode.
void BView::DrawPicture | ( | const BPicture * | picture | ) |
Draws the picture at the view's current pen position.
picture | The BPicture object to draw. |
Draws the picture at the location in the view specified by where.
picture | The BPicture object to draw. |
where | The point on the view to draw picture. |
void BView::DrawPicture | ( | const char * | filename, |
long | offset, | ||
BPoint | where | ||
) |
Draws the picture from the file specified by filename offset by offset bytes at the location in the view specified by where.
filename | The filename of the file containing the picture to draw. |
where | The point on the view to draw the picture. |
offset | The number of bytes to offset in the file to find the picture. |
void BView::DrawPictureAsync | ( | const BPicture * | picture | ) |
Draws the picture at the view's current pen position.
picture | The BPicture object to draw. |
Draws the picture at the location in the view specified by where.
picture | The BPicture object to draw. |
where | The point on the view to draw picture. |
void BView::DrawPictureAsync | ( | const char * | filename, |
long | offset, | ||
BPoint | where | ||
) |
Draws the picture from the file specified by filename offset by offset bytes at the location in the view specified by where.
filename | The filename of the file containing the picture to draw. |
where | The point on the view to draw the picture. |
offset | The number of bytes to offset in the file to find the picture. |
void BView::DrawString | ( | const char * | string, |
BPoint | location, | ||
escapement_delta * | delta = NULL |
||
) |
Draw string onto the view at the specified location in the view.
string | The string to draw. |
location | The location in the view to draw the string. |
delta | Adds additional width to each character according to the following fields:
|
Draw string locationCount times at the specified locations.
string | The string to draw. |
locations | A pointer to an array of BPoint objects to draw the string. |
locationCount | The number of elements in locations. |
void BView::DrawString | ( | const char * | string, |
escapement_delta * | delta = NULL |
||
) |
Draw string onto the view at the current pen position.
string | The string to draw. |
delta | Adds additional width to each character according to the following fields:
|
void BView::DrawString | ( | const char * | string, |
int32 | length, | ||
BPoint | location, | ||
escapement_delta * | delta = 0L |
||
) |
Draw string up to length characters onto the view at the specified location in the view.
string | The string to draw. |
length | The maximum number of characters in string to draw. |
location | The location in the view to draw the string. |
delta | Adds additional width to each character according to the following fields:
|
void BView::DrawString | ( | const char * | string, |
int32 | length, | ||
const BPoint * | locations, | ||
int32 | locationCount | ||
) |
Draw string up to length characters locationCount times at the specified locations.
string | The string to draw. |
length | The maximum number of characters in string to draw. |
locations | A pointer to an array of BPoint objects to draw the string. |
locationCount | The number of elements in locations. |
void BView::DrawString | ( | const char * | string, |
int32 | length, | ||
escapement_delta * | delta = NULL |
||
) |
Draw string up to length characters onto the view at the current pen position.
string | The string to draw. |
length | The maximum number of characters in string to draw. |
delta | Adds additional width to each character according to the following fields:
|
Draws bitmap on the view within viewRect. If bitmap is smaller, it is cloned to fill remaining space in viewRect.
bitmap | The bitmap to draw onto the view. |
viewRect | The area in the view's coordinate system to draw the bitmap in. |
phase | Source bitmap offset used as starting point for drawing. |
void BView::DrawTiledBitmapAsync | ( | const BBitmap * | bitmap, |
BRect | viewRect, | ||
BPoint | phase = B_ORIGIN |
||
) |
Draws bitmap on the view within viewRect asynchronously. If bitmap is smaller, it is cloned to fill remaining space in viewRect.
bitmap | The bitmap to draw onto the view. |
viewRect | The area in the view's coordinate system to draw the bitmap in. |
phase | Source bitmap offset used as starting point for drawing. |
void BView::EnableLayoutInvalidation | ( | ) |
Enable layout invalidation.
void BView::EndLayer | ( | ) |
Finish a layer and blend it in with the view.
This is the counterpart to BeginLayer(). You can nest multiple layer. If this method is called and the current layer is nested in another layer, the current layer is applied to the layer above. If this is the only layer, it will directly blend in to the main view.
void BView::EndLineArray | ( | ) |
End the line array drawing the lines.
BPicture * BView::EndPicture | ( | ) |
Ends the drawing instruction recording session and returns the BPicture object passed to BeginPicture() or AppendToPicture().
void BView::EndRectTracking | ( | ) |
Ends tracking removing the outline rectangle from the view.
BeginRectTracking() is typically called from the MouseDown() while this method is typically called from the MouseUp() method.
uint32 BView::EventMask | ( | ) |
Returns the current event mask.
BSize BView::ExplicitAlignment | ( | ) | const |
Returns the explicit alignment size.
This returns the value that was set by SetExplicitAlignment().
BSize BView::ExplicitMaxSize | ( | ) | const |
Returns the explicit maximum size.
This returns the value that was set by SetExplicitMaxSize().
BSize BView::ExplicitMinSize | ( | ) | const |
Returns the explicit minimum size.
This returns the value that was set by SetExplicitMinSize().
BSize BView::ExplicitPreferredSize | ( | ) | const |
Returns the explicit preferred size.
This returns the value that was set by SetExplicitPreferredSize().
void BView::FillArc | ( | BPoint | center, |
float | xRadius, | ||
float | yRadius, | ||
float | startAngle, | ||
float | arcAngle, | ||
::pattern | pattern = B_SOLID_HIGH |
||
) |
Fill an arc starting at center with a horizontal radius of xRadius and a vertical radius of yRadius starting at startAngle and drawing arcAngle degrees.
center | The center point. |
xRadius | The horizontal radius. |
yRadius | The vertical radius. |
startAngle | The angle to begin drawing at. |
arcAngle | The number of degrees of the arc to draw. |
pattern | One of the following:
|
void BView::FillArc | ( | BPoint | center, |
float | xRadius, | ||
float | yRadius, | ||
float | startAngle, | ||
float | arcAngle, | ||
const BGradient & | gradient | ||
) |
Fill an arc with the specified gradient pattern starting at center with a horizontal radius of xRadius and a vertical radius of yRadius starting at startAngle and drawing arcAngle degrees.
center | The center point. |
xRadius | The horizontal radius. |
yRadius | The vertical radius. |
startAngle | The angle to begin drawing at. |
arcAngle | The number of degrees of the arc to draw. |
gradient | The gradient pattern to fill the arc with. |
void BView::FillArc | ( | BRect | rect, |
float | startAngle, | ||
float | arcAngle, | ||
::pattern | pattern = B_SOLID_HIGH |
||
) |
Fill an arc inscribed within rect starting at startAngle and drawing arcAngle degrees.
rect | The area within which to inscribe the shape. |
startAngle | The angle to begin drawing at. |
arcAngle | The number of degrees of the arc to draw. |
pattern | One of the following:
|
void BView::FillArc | ( | BRect | rect, |
float | startAngle, | ||
float | arcAngle, | ||
const BGradient & | gradient | ||
) |
Fill an arc with the specified gradient pattern inscribed within rect starting at startAngle and drawing arcAngle degrees.
rect | The area within which to inscribe the shape. |
startAngle | The angle to begin drawing at. |
arcAngle | The number of degrees of the arc to draw. |
gradient | The gradient pattern to fill the arc with. |
void BView::FillBezier | ( | BPoint * | controlPoints, |
::pattern | pattern = B_SOLID_HIGH |
||
) |
Fill a bezier curve.
controlPoints | The list of points that form the bezier curve. |
pattern | One of the following:
|
void BView::FillBezier | ( | BPoint * | controlPoints, |
const BGradient & | gradient | ||
) |
Fill a bezier curve.
controlPoints | The list of points that form the bezier curve. |
gradient | The gradient pattern to fill the bezier curve with. |
void BView::FillEllipse | ( | BPoint | center, |
float | xRadius, | ||
float | yRadius, | ||
::pattern | pattern = B_SOLID_HIGH |
||
) |
Fill an ellipse starting at center with a horizontal radius of xRadius and a vertical radius of yRadius.
center | The center point. |
xRadius | The horizontal radius. |
yRadius | The vertical radius. |
pattern | One of the following:
|
void BView::FillEllipse | ( | BPoint | center, |
float | xRadius, | ||
float | yRadius, | ||
const BGradient & | gradient | ||
) |
Fill an ellipse with the specified gradient pattern starting at center with a horizontal radius of xRadius and a vertical radius of yRadius.
center | The center point. |
xRadius | The horizontal radius. |
yRadius | The vertical radius. |
gradient | The gradient pattern to fill the ellipse with. |
void BView::FillEllipse | ( | BRect | rect, |
::pattern | pattern = B_SOLID_HIGH |
||
) |
Fill an ellipse inscribed within rect.
rect | The area within which to inscribe the shape. |
pattern | One of the following:
|
void BView::FillEllipse | ( | BRect | rect, |
const BGradient & | gradient | ||
) |
Fill an ellipse with the specified gradient pattern inscribed within rect.
rect | The area within which to inscribe the shape. |
gradient | The gradient pattern to fill the ellipse with. |
void BView::FillPolygon | ( | const BPoint * | pointArray, |
int32 | numPoints, | ||
::pattern | pattern = B_SOLID_HIGH |
||
) |
Fill a polygon shape made up of points specified by pointArray.
pointArray | An array of points that specify the vertices of the polygon. |
numPoints | The number of points in pointArray. |
pattern | One of the following:
|
void BView::FillPolygon | ( | const BPoint * | pointArray, |
int32 | numPoints, | ||
BRect | bounds, | ||
::pattern | pattern = B_SOLID_HIGH |
||
) |
Fill a polygon shape made up of points specified by pointArray inscribed by bounds.
pointArray | An array of points that specify the vertices of the polygon. |
numPoints | The number of points in pointArray. |
bounds | The smallest rectangle that encloses the points in pointArray. |
pattern | One of the following:
|
void BView::FillPolygon | ( | const BPoint * | pointArray, |
int32 | numPoints, | ||
BRect | bounds, | ||
const BGradient & | gradient | ||
) |
Fill a polygon shape made up of points specified by pointArray inscribed by bounds with the specified gradient pattern.
pointArray | An array of points that specify the vertices of the polygon. |
numPoints | The number of points in pointArray. |
bounds | The smallest rectangle that encloses the points in pointArray. |
gradient | The gradient pattern to fill the polygon with. |
Fill a polygon shape made up of points specified by pointArray with the specified gradient pattern.
pointArray | An array of points that specify the vertices of the polygon. |
numPoints | The number of points in pointArray. |
gradient | The gradient pattern to fill the polygon with. |
void BView::FillPolygon | ( | const BPolygon * | polygon, |
::pattern | pattern = B_SOLID_HIGH |
||
) |
Fill a polygon shape.
polygon | The polygon shape to fill. |
pattern | One of the following:
|
void BView::FillPolygon | ( | const BPolygon * | polygon, |
const BGradient & | gradient | ||
) |
Fill a polygon shape with the specified gradient pattern.
polygon | The polygon shape to fill. |
gradient | The gradient pattern to fill the polygon with. |
void BView::FillRect | ( | BRect | rect, |
::pattern | pattern = B_SOLID_HIGH |
||
) |
Fill the rectangle specified by rect.
rect | The rectangular area to fill. |
pattern | One of the following:
|
void BView::FillRect | ( | BRect | rect, |
const BGradient & | gradient | ||
) |
Fill the rectangle specified by rect with the specified gradient pattern.
rect | The rectangular area to fill. |
gradient | The gradient pattern to fill the rectangle with. |
void BView::FillRegion | ( | BRegion * | region, |
::pattern | pattern = B_SOLID_HIGH |
||
) |
Fill region.
region | The region to fill. |
pattern | One of the following:
|
void BView::FillRegion | ( | BRegion * | region, |
const BGradient & | gradient | ||
) |
Fill region with the specified gradient pattern.
region | The region to fill. |
gradient | The gradient pattern to fill the region with. |
void BView::FillRoundRect | ( | BRect | rect, |
float | xRadius, | ||
float | yRadius, | ||
::pattern | pattern = B_SOLID_HIGH |
||
) |
Fill the rounded rectangle with horizontal radius xRadius and vertical radius yRadius.
rect | The rectangular area to fill the round rect within. |
xRadius | The horizontal radius. |
yRadius | The vertical radius. |
pattern | One of the following:
|
void BView::FillRoundRect | ( | BRect | rect, |
float | xRadius, | ||
float | yRadius, | ||
const BGradient & | gradient | ||
) |
Fill the rounded rectangle with horizontal radius xRadius and vertical radius yRadius with the specified gradient pattern.
rect | The rectangular area to fill the round rect within. |
xRadius | The horizontal radius. |
yRadius | The vertical radius. |
gradient | The gradient pattern to fill the round rect with. |
int32 BView::FillRule | ( | ) | const |
Return the current fill mode.
See BView::SetFillRule() for more information.
0
if no fill rule is applied, B_EVEN_ODD
when the even-odd algorithm is applied, and B_NONZERO
if the nonzero algorithm is applied.void BView::FillShape | ( | BShape * | shape, |
::pattern | pattern = B_SOLID_HIGH |
||
) |
Fill shape.
shape | The shape to fill. |
pattern | One of the following:
|
void BView::FillShape | ( | BShape * | shape, |
const BGradient & | gradient | ||
) |
Fill shape with the specified gradient pattern.
shape | The shape to fill. |
gradient | The gradient pattern to fill the shape with. |
void BView::FillTriangle | ( | BPoint | point1, |
BPoint | point2, | ||
BPoint | point3, | ||
::pattern | pattern = B_SOLID_HIGH |
||
) |
Fill the triangle specified by points point1, point2, and point3.
point1 | The first point of the triangle. |
point2 | The second point of the triangle. |
point3 | The third point of the triangle. |
pattern | One of the following:
|
void BView::FillTriangle | ( | BPoint | point1, |
BPoint | point2, | ||
BPoint | point3, | ||
BRect | bounds, | ||
::pattern | pattern = B_SOLID_HIGH |
||
) |
Fill the triangle specified by points point1, point2, and point3 and enclosed by bounds.
point1 | The first point of the triangle. |
point2 | The second point of the triangle. |
point3 | The third point of the triangle. |
bounds | The rectangular area that encloses the triangle. |
pattern | One of the following:
|
void BView::FillTriangle | ( | BPoint | point1, |
BPoint | point2, | ||
BPoint | point3, | ||
BRect | bounds, | ||
const BGradient & | gradient | ||
) |
Fill the triangle specified by points point1, point2, and point3 and enclosed by bounds with the specified gradient pattern.
point1 | The first point of the triangle. |
point2 | The second point of the triangle. |
point3 | The third point of the triangle. |
bounds | The rectangular area that encloses the triangle. |
gradient | The gradient pattern to fill the triangle with. |
void BView::FillTriangle | ( | BPoint | point1, |
BPoint | point2, | ||
BPoint | point3, | ||
const BGradient & | gradient | ||
) |
Fill the triangle specified by points point1, point2, and point3 with the specified gradient pattern.
point1 | The first point of the triangle. |
point2 | The second point of the triangle. |
point3 | The third point of the triangle. |
gradient | The gradient pattern to fill the triangle with. |
BView * BView::FindView | ( | const char * | name | ) | const |
Returns the view in the view hierarchy with the specified name.
NULL
if not found.uint32 BView::Flags | ( | ) | const |
Return the view flags set in the constructor or by SetFlags().
void BView::Flush | ( | ) | const |
Flushes the attached window's connection to App Server.
void BView::ForceFontAliasing | ( | bool | enable | ) |
Turn anti-aliasing on and off when printing.
Typically want to turn font anti-aliasing off when printing by passing true
to this method and then turn it on again by passing in false
.
This method does not affect characters drawn to the screen.
enable | If true turn off anti-aliasing, if false turn on anti-aliasing. |
BRect BView::Frame | ( | ) | const |
Returns the view's frame rectangle in the parent's coordinate system.
|
virtual |
Hook method called when the view is moved.
newPosition | The point of the top left corner of the frame that the view has been moved to. |
Reimplemented in BScrollBar, BBox, BButton, BCheckBox, BColorControl, BDragger, BListView, BMenuBar, BOutlineListView, BPictureButton, BPopUpMenu, BRadioButton, BScrollView, BStatusBar, BStringView, BTabView, BTextControl, BMenu, and BMenuField.
|
virtual |
Hook method called when the view is resized.
newWidth | The new width of the view. |
newHeight | The new height of the view. |
Reimplemented in BButton, BChannelControl, BCheckBox, BColorControl, BDragger, BListView, BMenuBar, BOutlineListView, BPictureButton, BPopUpMenu, BRadioButton, BScrollBar, BScrollView, BStatusBar, BStringView, BTabView, BTextControl, BTextView, BBox, BChannelSlider, BMenu, and BMenuField.
void BView::GetBlendingMode | ( | source_alpha * | srcAlpha, |
alpha_function * | alphaFunc | ||
) | const |
Fill out srcAlpha and alphaFunc with the alpha mode and alpha function of the view.
[out] | srcAlpha | The alpha mode to fill out. |
[out] | alphaFunc | The alpha function to fill out. |
void BView::GetClippingRegion | ( | BRegion * | region | ) | const |
Fill out region with the view's clipping region.
[out] | region | The BRegion object to fill out. |
Get the current clipping region, which is an intersection of the view visible region on screen (which depends on the view bounds, any child view hiding parts of it, and overlapping windows) and the constrained clipping regions set by calls to ConstrainClippingRegion() in the current stack of drawing states.
void BView::GetFont | ( | BFont * | font | ) | const |
Fill out font with the font set to the view.
[out] | font | The BFont object to fill out. |
void BView::GetFontHeight | ( | font_height * | height | ) | const |
Fill out the font_height struct with the view font.
[out] | height | The font_height struct to fill out. |
|
virtual |
Returns the min, max and preferred height for a given width.
[in] | width | The width you want the height to be calculated for. |
[out] | min | The minimum height that the layout will request. |
[out] | max | The maximum height that the layout will request. |
[out] | preferred | The preferred height for this width. |
Reimplemented in BTextView.
BLayout * BView::GetLayout | ( | ) | const |
Get the layout of the view.
Fills out the cursor location and the current state of the mouse buttons.
The cursor doesn't have to be located within the view for this method to work, however, the view must be attached to a window. Don't use this method to track the mouse in your derived view, implement MouseMoved() instead.
[out] | _location | Filled out with the cursor location in the view's coordinate system. |
[out] | _buttons | Filled out with a mask of the following values:
|
checkMessageQueue | If true pull from any pending MouseMoved() or MouseUp() events in the message queue top down before filling out the current mouse cursor state. |
|
virtual |
Fill out the preferred width and height of the view into the _width and _height parameters.
Derived classes should override this method to set the preferred size of object.
NULL
if you only want to get the other one.[out] | _width | Pointer to a float to store the width of the view. |
[out] | _height | Pointer to a float to store the height of the view. |
Reimplemented in BBox, BButton, BChannelSlider, BCheckBox, BColorControl, BControl, BDragger, BListView, BMenu, BMenuBar, BOptionPopUp, BOutlineListView, BPictureButton, BPopUpMenu, BRadioButton, BScrollBar, BScrollView, BStatusBar, BStringView, BTabView, BTextControl, BTextView, BMenuField, BSeparatorView, and BChannelControl.
void BView::GetStringWidths | ( | char * | stringArray[], |
int32 | lengthArray[], | ||
int32 | numStrings, | ||
float | widthArray[] | ||
) | const |
Fill out widths of the strings in stringArray set in the font of the view into widthArray.
stringArray | The array of strings to get the lengths of. |
lengthArray | The number of characters of the strings in stringArray to consider. |
numStrings | The number of strings in stringArray. |
widthArray | The array to store the widths of the strings in stringArray. |
Reports the suites of messages and specifiers that derived classes understand.
Reimplemented from BHandler.
Reimplemented in BChannelControl, BChannelSlider, BColorControl, BDragger, BListView, BMenu, BMenuBar, BMenuField, BOutlineListView, BPictureButton, BPopUpMenu, BStatusBar, BStringView, BTextControl, BTextView, BBox, BButton, BCheckBox, BControl, BRadioButton, BScrollBar, BScrollView, and BTabView.
|
protectedvirtual |
Point _tip with the view's tool tip.
point | Currently unused. |
_tip | A pointer to a pointer to a BToolTip object to set. |
bool BView::HasDefaultColors | ( | ) | const |
Tests if the view has any colors set.
Referenced by BLayoutBuilder::Grid< ParentBuilder >::Grid(), and BLayoutBuilder::Group< ParentBuilder >::Group().
|
virtual |
Returns whether the layout of the view can calculate a height for a given width.
Use GetHeightForWidth() to actually get the preferred size.
true
if the height values can be calculated, false
if they cannot.Reimplemented in BTextView.
bool BView::HasSystemColors | ( | ) | const |
Tests if the view is using system "panel" colors. B_PANEL_BACKGROUND_COLOR for ViewUIColor() B_PANEL_BACKGROUND_COLOR for LowUIColor() B_PANEL_TEXT_COLOR for HighUIColor()
|
virtual |
Hides the view without removing it from the view hierarchy.
Calls to Hide() and Show() are cumulative. A visible view becomes hidden once the number of Hide() calls exceeds the number of Show() calls.
void BView::HideToolTip | ( | ) |
Hide the view's tool tip.
rgb_color BView::HighColor | ( | ) | const |
color_which BView::HighUIColor | ( | float * | tint = NULL | ) | const |
Return the current high color constant being used.
tint | Optional float pointer in which to store the tint value used to modify the system color constant. |
|
static |
void BView::Invalidate | ( | ) |
Sends a message to App Server to redraw the view.
void BView::Invalidate | ( | BRect | invalRect | ) |
Sends a message to App Server to redraw the portion of the view specified by invalRect.
invalRect | The rectangular area of the view to redraw. |
void BView::Invalidate | ( | const BRegion * | region | ) |
Sends a message to App Server to redraw the portion of the view specified by region.
region | The region of the view to redraw. |
void BView::InvalidateLayout | ( | bool | descendants = false | ) |
Invalidate layout.
descendants | Also invalidate its children views. |
void BView::InvertRect | ( | BRect | rect | ) |
Inverts the colors within rect.
This method is often used to draw a highlighted selection in a view.
rect | The rectangular area in the view to invert the colors of. |
bool BView::IsFocus | ( | ) | const |
Returns whether or not the view is the window's current focus view.
The focus view changes as the user moves from one view to another either by pushing the tab key or by clicking a new view with the mouse. The change can be made programmatically via the MakeFocus() method.
true
if the view is the current focus view, false
otherwise.bool BView::IsHidden | ( | ) | const |
Returns whether or not the view is hidden.
A view can be hidden either by calling Hide() on the view, calling Hide() on a parent view or calling Hide() on the window that the view is attached to. When a BWindow or BView is hidden, all its descendants are also hidden.
This method only returns whether the view or an ancestor view has had the Hide() method called on it, it doesn't consider if the view is obscured by another view or is off-screen. A BView is not hidden by default.
true
if the view was hidden via the Hide() method, false
otherwise.bool BView::IsHidden | ( | const BView * | lookingFrom | ) | const |
Returns whether or not the view is hidden from the perspective of lookingFrom.
A view is considered hidden if it, any of its parent views, or the window it's attached to has had the Hide() method called on it. This method allows you to determine the hidden status of a view from a different point on the view hierarchy.
lookingFrom | The view used as a base when determining the hidden status of the BView object. |
true
if the view was hidden via the Hide() method, false
otherwise.bool BView::IsLayoutInvalidationDisabled | ( | ) |
Returns whether or not layout invalidation is disabled.
true
of layout invalidation is disabled, false
otherwise.bool BView::IsLayoutValid | ( | ) | const |
Returns whether or not the layout is valid.
true
if the layout is valid, false
otherwise.bool BView::IsPrinting | ( | ) | const |
Returns whether or not the view is drawing to a printer.
This method should only be called from the Draw() or DrawAfterChildren() methods. If called from any other method this method returns false
.
The view may choose different fonts, images, or colors when drawing to a printer vs. when drawing to the screen.
true
if drawing to a printer, false
otherwise.
|
virtual |
Hook method called when a keyboard key is pressed.
bytes | The bytes of the key combination pressed. |
numBytes | The number of bytes in bytes. |
Reimplemented in BButton, BChannelSlider, BCheckBox, BColorControl, BControl, BListView, BMenu, BMenuField, BOutlineListView, BPictureButton, BRadioButton, BTabView, BTextView, and BChannelControl.
|
virtual |
Hook method called when a keyboard key is released.
bytes | The bytes of the key combination pressed. |
numBytes | The number of bytes in bytes. |
Reimplemented in BChannelSlider.
void BView::Layout | ( | bool | force | ) |
Layout the view.
force | If true layout even if valid. |
|
virtual |
Return the current BAlignemnt of the view.
Reimplemented in BBox, BCheckBox, BRadioButton, BStringView, and BTextControl.
|
protectedvirtual |
Hook function that is called when the layout if this view, or one of its children, has changed.
BLayoutContext * BView::LayoutContext | ( | ) | const |
Returns the BLayoutContext for this View.
|
protectedvirtual |
Hook method called when the layout is invalidated.
descendants | Whether or not child views have also been invalidated. |
Reimplemented in BMenu, BMenuField, BTextControl, BTextView, BBox, BButton, BCheckBox, BScrollView, and BStringView.
BPoint BView::LeftTop | ( | ) | const |
Returns the left top corner point.
cap_mode BView::LineCapMode | ( | ) | const |
Returns the current line cap mode.
join_mode BView::LineJoinMode | ( | ) | const |
Returns the current line join mode.
float BView::LineMiterLimit | ( | ) | const |
Returns the miter limit used for B_MITER_JOIN
join mode.
rgb_color BView::LowColor | ( | ) | const |
color_which BView::LowUIColor | ( | float * | tint = NULL | ) | const |
Return the current low color constant being used.
tint | Optional float pointer in which to store the tint value used to modify the system color constant. |
|
virtual |
Makes the view the current focus view of the window or gives up being the window's focus view.
The focus view handles selections and KeyDown events when the the attached window is active. There can be only one focus view at a time per window.
When called with focus set to true
this method first calls MakeFocus() on the previously focused view with focus set to false
.
The focus doesn't automatically change when MouseDown() is called so calling MakeFocus() is the only way to make a view the focus view of a window. Classes derived from BView that can display the current selection, or that can accept pasted data should call MakeFocus() in their MouseDown() method to update the focus view of the window on click.
If the view isn't attached to a window this method has no effect.
focus | true to set focus, false to remove it. |
Reimplemented in BButton, BControl, BDragger, BMenu, BOutlineListView, BPictureButton, BRadioButton, BScrollBar, BScrollView, BStatusBar, BStringView, BTextControl, BTextView, BMenuField, BBox, BCheckBox, BColorControl, BTabView, BChannelSlider, BListView, BMenuBar, and BPopUpMenu.
|
virtual |
Return the maximum size of the view.
Reimplemented in BBox, BButton, BCheckBox, BListView, BMenu, BMenuBar, BMenuField, BRadioButton, BScrollBar, BScrollView, BSeparatorView, BStatusBar, BStringView, BTabView, BTextControl, and BTextView.
|
virtual |
Handle message received by the associated looper.
message | The message received by the associated looper. |
Reimplemented from BHandler.
Reimplemented in BBox, BButton, BChannelControl, BChannelSlider, BCheckBox, BColorControl, BControl, BDragger, BListView, BMenu, BMenuBar, BMenuField, BOptionControl, BOptionPopUp, BOutlineListView, BPictureButton, BPopUpMenu, BRadioButton, BScrollBar, BScrollView, BSplitView, BStatusBar, BStringView, BTabView, BTextControl, and BTextView.
|
virtual |
Return the minimum size of the view.
Reimplemented in BBox, BButton, BCheckBox, BListView, BMenu, BMenuBar, BMenuField, BScrollBar, BScrollView, BSeparatorView, BStatusBar, BStringView, BTabView, BTextControl, and BTextView.
|
virtual |
Hook method called when a mouse button is pressed.
where | The point on the screen where the mouse pointer is when the mouse button is pressed. |
Reimplemented in BBox, BStringView, BButton, BChannelSlider, BCheckBox, BColorControl, BControl, BDragger, BListView, BMenuBar, BMenuField, BOutlineListView, BPictureButton, BPopUpMenu, BRadioButton, BScrollBar, BScrollView, BSplitView, BStatusBar, BTabView, BTextControl, BTextView, and BChannelControl.
Hook method called when the mouse is moved.
where | The new location of the mouse in the view's coordinate system. |
code | One of the following:
|
dragMessage | If a drag-and-drop operation is taking place this is a pointer to a BMessage that holds the drag information, otherwise the pointer is NULL . |
Reimplemented in BColorControl, BBox, BStringView, BButton, BCheckBox, BControl, BListView, BPictureButton, BRadioButton, BScrollBar, BScrollView, BTextView, BChannelSlider, BDragger, BMenuField, BPopUpMenu, BStatusBar, BTabView, BTextControl, and BSplitView.
|
virtual |
Hook method called when a mouse button is released.
where | The point on the screen where the mouse pointer is when the mouse button is released. |
Reimplemented in BBox, BColorControl, BStringView, BButton, BChannelSlider, BCheckBox, BControl, BDragger, BListView, BMenuBar, BMenuField, BOutlineListView, BPictureButton, BPopUpMenu, BRadioButton, BScrollBar, BScrollView, BSplitView, BStatusBar, BTabView, BTextControl, and BTextView.
void BView::MoveBy | ( | float | deltaX, |
float | deltaY | ||
) |
Moves the view deltaX pixels horizontally and deltaY pixels vertically in the parent view's coordinate system.
deltaX | The number of pixels to move the view horizontally. |
deltaY | The number of pixels to move the view vertically. |
void BView::MovePenBy | ( | float | x, |
float | y | ||
) |
Move the pen by x pixels horizontally and y pixels vertically.
x | The number of pixels to move the pen horizontally. |
y | The number of pixels to move the pen vertically. |
void BView::MovePenTo | ( | BPoint | point | ) |
Move the pen to point in the view's coordinate system.
point | the location to move the pen to. |
void BView::MovePenTo | ( | float | x, |
float | y | ||
) |
Move the pen to the point specified by x and y in the view's coordinate system.
x | The horizontal coordinate to move the pen to. |
y | The vertical coordinate to move the pen to. |
void BView::MoveTo | ( | BPoint | where | ) |
Move the view to the location specified by where in the parent view's coordinate system.
where | The location to move the view to. |
void BView::MoveTo | ( | float | x, |
float | y | ||
) |
Move the view to the coordinates specified by x in the horizontal dimension and y in the vertical dimension in the parent view's coordinate system.
x | The horizontal coordinate to move the view to. |
y | The vertical coordinate to move the view to. |
BView * BView::NextSibling | ( | ) | const |
Returns a pointer to the next sibling view.
BPoint BView::Origin | ( | ) | const |
Returns the origin point in the view's coordinate system.
BView * BView::Parent | ( | ) | const |
Returns a pointer to the view's parent.
NULL
if not attached.BPoint BView::PenLocation | ( | ) | const |
Return the current pen location as a BPoint object.
float BView::PenSize | ( | ) | const |
Return the current pen size.
|
virtual |
Perform some action. (Internal Method)
This method is available to allow classes to be extended while maintaining binary compatibility.
The following perform codes are recognized:
PERFORM_CODE_MIN_SIZE:
PERFORM_CODE_MAX_SIZE:
PERFORM_CODE_PREFERRED_SIZE:
PERFORM_CODE_LAYOUT_ALIGNMENT:
PERFORM_CODE_HAS_HEIGHT_FOR_WIDTH:
PERFORM_CODE_GET_HEIGHT_FOR_WIDTH:
PERFORM_CODE_SET_LAYOUT:
PERFORM_CODE_INVALIDATE_LAYOUT:
PERFORM_CODE_DO_LAYOUT:
PERFORM_CODE_GET_TOOL_TIP_AT:
PERFORM_CODE_ALL_UNARCHIVED:
PERFORM_CODE_ALL_ARCHIVED:
code | The perform code. |
_data | A pointer to store some data. |
Reimplemented from BHandler.
Reimplemented in BPopUpMenu, BListView, BCheckBox, BDragger, BMenuBar, BOutlineListView, BPictureButton, BSeparatorView, BTextView, BBox, BButton, BCardView, BControl, BGridView, BGroupView, BMenu, BMenuField, BScrollBar, BScrollView, BSplitView, BStatusBar, BTabView, and BRadioButton.
void BView::PopState | ( | ) |
Restores the drawing state from the stack.
|
virtual |
Return the preferred size of the view.
Reimplemented in BBox, BButton, BCheckBox, BListView, BMenu, BMenuBar, BMenuField, BScrollBar, BScrollView, BSeparatorView, BStatusBar, BStringView, BTabView, BTextControl, and BTextView.
BView * BView::PreviousSibling | ( | ) | const |
Returns a pointer to the previous sibling view.
|
virtual |
Hook method called when the view receives a B_PULSE
message.
An action is performed each time the App Server calls the Pulse() method. The pulse rate is set by SetPulseRate(). You can implement Pulse() to do anything you want. The default version does nothing. The pulse granularity is no better than once per 100,000 microseconds.
void BView::PushState | ( | ) |
Saves the drawing state to the stack.
The drawing state contains the following elements:
A new state context is created after PushState() is called with a local scale at 0, a local origin at (0, 0), and no clipping region.
void BView::Relayout | ( | ) |
bool BView::RemoveChild | ( | BView * | child | ) |
Removes child from the view hierarchy.
child | The child view to remove. |
bool BView::RemoveSelf | ( | ) |
Removes the view and all child views from the view hierarchy.
void BView::ResetLayoutInvalidation | ( | ) |
Service call for BView derived classes re-enabling InvalidateLayout() notifications.
BLayout and BView will avoid calling InvalidateLayout on views that have already been invalidated, but if the view caches internal layout information which it updates in methods other than DoLayout(), it has to invoke this method, when it has done so, since otherwise the information might become obsolete without the layout noticing.
This is only meaningful if the view is part of a BLayout.
void BView::ResizeBy | ( | float | deltaWidth, |
float | deltaHeight | ||
) |
Resize the view by deltaWidth horizontally and deltaHeight vertically without moving the top left corner of the view.
deltaWidth | The number of pixels to resize the view by horizontally. |
deltaHeight | The number of pixels to resize the view by vertically. |
void BView::ResizeTo | ( | BSize | size | ) |
Resize the view to the dimension specified by size.
size | The size to resize the view to. |
void BView::ResizeTo | ( | float | width, |
float | height | ||
) |
Resize the view to the specified width and height.
width | The width to resize the view to. |
height | The height to resize the view to. |
|
virtual |
Resizes the view to its preferred size keeping the position of the left top corner constant.
Reimplemented in BBox, BButton, BChannelControl, BCheckBox, BColorControl, BControl, BDragger, BListView, BMenu, BMenuBar, BMenuField, BOptionPopUp, BOutlineListView, BPictureButton, BPopUpMenu, BRadioButton, BScrollBar, BScrollView, BStatusBar, BStringView, BTabView, BTextControl, and BTextView.
uint32 BView::ResizingMode | ( | ) | const |
Returns the resizing mode flags mask set in the constructor or by SetResizingMode().
|
virtual |
Determine the proper handler for a scripting message.
message | The scripting message to determine the handler. |
index | The index of the specifier. |
specifier | The message which contains the specifier. |
what | The 'what' field of the specifier message. |
property | The name of the target property. |
Reimplemented from BHandler.
Reimplemented in BChannelSlider, BDragger, BMenu, BMenuBar, BMenuField, BPopUpMenu, BStringView, BTextView, BBox, BButton, BChannelControl, BCheckBox, BColorControl, BControl, BListView, BOutlineListView, BPictureButton, BRadioButton, BScrollBar, BScrollView, BStatusBar, BTabView, and BTextControl.
void BView::RotateBy | ( | double | angleRadians | ) |
Rotate the current view by angleRadians.
The rotation is applied to the current transformation, not instead of, so it is an additive action.
float BView::Scale | ( | ) | const |
Return the current drawing scale.
void BView::ScaleBy | ( | double | x, |
double | y | ||
) |
Scale the current view by factors x and y.
The scaling with factors x and y are applied to the current transformation, not instead of, so it is an additive action.
BScrollBar * BView::ScrollBar | ( | orientation | posture | ) | const |
Returns the BScrollBar object that has the BView set as its target.
posture | Either B_VERTICAL to get the vertical scroll bar or B_HORIZONTAL to get the horizontal scroll bar. |
NULL
if none found.void BView::ScrollBy | ( | float | deltaX, |
float | deltaY | ||
) |
Scroll the view by deltaX horizontally and deltaY vertically.
deltaX | The amount to scroll horizontally. |
deltaY | The amount to scroll vertically. |
|
virtual |
Scroll the view to the point specified by where.
where | The location to scroll the view to. |
Reimplemented in BListView.
|
inline |
Scroll the view to the point specified by coordinates.
x | The x-coordinate to scroll the view to. |
y | The y-coordinate to scroll the view to. |
References ScrollTo().
Referenced by ScrollTo().
|
protected |
Handle the scroll wheel changing over scrollbars.
With this change it is now a bit easier to scroll horizontally around the system by putting the mouse cursor over a horizontal scrollbar and using the wheel.
void BView::SetBlendingMode | ( | source_alpha | srcAlpha, |
alpha_function | alphaFunc | ||
) |
Set the blending mode which controls how transparency is used.
srcAlpha | Set to one of the following:
|
alphaFunc | Set to one of the following:
|
B_ALPHA_OVERLAY
and B_ALPHA_COMPOSITE
work only with B_PIXEL_ALPHA
.void BView::SetDiskMode | ( | char * | filename, |
long | offset | ||
) |
Unimplemented.
|
virtual |
Sets the drawing mode of the view.
The default drawing mode is B_OP_COPY
.
mode | Set to one of the following:
|
Sets whether or not the view can accept mouse and keyboard events when not in focus.
If mask includes B_POINTER_EVENTS
then the view will receive mouse events even when the mouse isn't over the view and if it includes B_KEYBOARD_EVENTS
the view will receive keyboard events even if it isn't in focus.
The options mask options are as follows:
B_NO_POINTER_HISTORY
Tells App Server to only send the most recent MouseMoved() event to the view sacrificing some granularity.B_FULL_POINTER_HISTORY
Tells App Server to send all MouseMoved() events to the view.mask | The mask of B_POINTER_EVENTS and B_KEYBOARD_EVENTS to set. |
options | Sets other event-handling options. |
B_OK
if everything went fine or an error code, usually B_ERROR
if something went wrong.void BView::SetExplicitAlignment | ( | BAlignment | alignment | ) |
Set this view's alignment, to be used by Alignment().
void BView::SetExplicitMaxSize | ( | BSize | size | ) |
void BView::SetExplicitMinSize | ( | BSize | size | ) |
void BView::SetExplicitPreferredSize | ( | BSize | size | ) |
Set this view's preferred size, to be used by PreferredSize().
void BView::SetExplicitSize | ( | BSize | size | ) |
Set this view's size.
This is a convenience function that calls both SetExplicitMinSize() and SetExplicitMaxSize() with the size parameter.
void BView::SetFillRule | ( | int32 | rule | ) |
Sets the fill rule for the view.
A fill rule is a rule that describes an algorithm that is used to find out what the inside of a shape is. The concept comes from the SVG format.
See the Mozilla documentation on the fill property of SVG for more information.
rule | There are two algorithms: the B_NONZERO and the B_EVEN_ODD algorithm. |
|
virtual |
Sets the view flags to the flags mask.
flags | The view flags to set as a uint32 mask. |
Reimplemented in BTabView, and BTextControl.
|
virtual |
Set the font of the view.
By passing B_FONT_ALL
to the mask parameter as is the default all font properties from font are set on the view.
font | A pointer to a const BFont object to set on the view. |
mask | A mask to determine what font properties to set, either pass in B_FONT_ALL to set all font properties or create a mask containing one or more of the following values to set:
|
Reimplemented in BChannelControl, BChannelSlider, BListView, and BStringView.
void BView::SetFontSize | ( | float | size | ) |
Set the size of the view's font to size.
size | The font size to set to the view in points. |
|
virtual |
Set the high color of the view.
color | The color to set. |
Referenced by SetHighColor().
Set the high color of the view.
red | The red component of the high color. |
green | The green component of the high color. |
blue | The blue component of the high color. |
alpha | The alpha component of the high color. |
References rgb_color::alpha, rgb_color::blue, rgb_color::green, rgb_color::red, and SetHighColor().
void BView::SetHighUIColor | ( | color_which | which, |
float | tint = B_NO_TINT |
||
) |
Set the high color of the view to a system constant. The color will update live with user changes.
which | The color_which constant to set. |
tint | Optional tint value to use. |
|
virtual |
Sets the layout of the view.
layout | The layout to set. |
Reimplemented in BCardView, BColorControl, BGridView, BGroupView, and BSplitView.
Referenced by BLayoutBuilder::Cards< ParentBuilder >::Cards(), BLayoutBuilder::Grid< ParentBuilder >::Grid(), and BLayoutBuilder::Group< ParentBuilder >::Group().
void BView::SetLineMode | ( | cap_mode | lineCap, |
join_mode | lineJoin, | ||
float | miterLimit = B_DEFAULT_MITER_LIMIT |
||
) |
Set line mode to use PostScript-style line cap and join modes.
lineCap determines the shape of the endpoints of stroked paths while lineJoin determines the shape of the corners where two lines meet.
The default miter limit is 10.0 which gives an angle of 11.478341°.
lineCap | One of the following:
|
lineJoin | One of the following:
|
miterLimit | Sets the cut off angle before a miter join becomes a bevel join calculated by 2*arcsin(1/miterLimit). |
|
virtual |
Set the low color of the view.
color | The color to set. |
Referenced by SetLowColor().
Set the low color of the view.
red | The red component of the low color. |
green | The green component of the low color. |
blue | The blue component of the low color. |
alpha | The alpha component of the low color. |
References rgb_color::alpha, rgb_color::blue, rgb_color::green, rgb_color::red, and SetLowColor().
void BView::SetLowUIColor | ( | color_which | which, |
float | tint = B_NO_TINT |
||
) |
Set the low color of the view to a system constant. The color will update live with user changes.
which | The color_which constant to set. |
tint | Optional tint value to use. |
Sets whether or not the view can accept mouse and keyboard events when not in focus from within MouseDown() until the following MouseUp() event.
The options mask options are as follows:
B_NO_POINTER_HISTORY
Tells App Server to send only the most recent MouseMoved() event to the view sacrificing mouse movement granularity.B_FULL_POINTER_HISTORY
Tells App Server to send all MouseMoved() events to the view.B_SUSPEND_VIEW_FOCUS
Events normally sent to the focus view are suppressed. While the mouse is held down, the keyboard is ignored. The view receiving the MouseDown() messages doesn't have to be the focus view to suppress focused messages.B_LOCK_WINDOW_FOCUS
Prevents the attached window from losing its focused state while the mouse is held down, even if the mouse leaves the bounds of the window.mask | The mask of B_POINTER_EVENTS and B_KEYBOARD_EVENTS to set. |
options | Sets other event-handling options. |
B_OK
if everything went fine or an error code, usually B_ERROR
if something went wrong.void BView::SetOrigin | ( | BPoint | where | ) |
Sets the origin in the view's coordinate system.
where | The point to set the origin to. |
void BView::SetOrigin | ( | float | x, |
float | y | ||
) |
Sets the origin in the view's coordinate system.
x | The x-coordinate to set the origin to. |
y | The y-coordinate to set the origin to. |
|
virtual |
Set the pen size to size.
size | The pen size to set. |
|
virtual |
Sets the resizing mode of the view according to the mode mask.
The resizing mode is first set in the BView constructor.
Reimplemented in BTabView.
void BView::SetScale | ( | float | scale | ) | const |
Sets the scale of the coordinate system the view uses for drawing.
The default scale is 1.0. A scale value lower than 1.0 reduces the size of the drawing coordinate system, a scale value greater than 1.0 magnifies the coordinate system; for example, a scale value of 0.5 cuts the drawing drawing area in half moving the drawing closer to the origin while a scale value of 2.0 doubles the drawing area and moving it away from the origin.
Updating the scale of view won't update previously drawn elements.
SetScale() calls are not commutative unless you call them across different drawing states as the following:
scale | The scale factor to set. |
void BView::SetToolTip | ( | BToolTip * | tip | ) |
Set the tool tip of the view to the tip object.
tip | The tool tip object to set the view to or NULL to unset. |
void BView::SetToolTip | ( | const char * | text | ) |
Set the tool tip of the view to text.
text | The text to set the view to or NULL or blank to unset. |
void BView::SetTransform | ( | BAffineTransform | transform | ) |
Sets a BAffineTransform to transform the coordinate system.
void BView::SetViewBitmap | ( | const BBitmap * | bitmap, |
BRect | srcRect, | ||
BRect | dstRect, | ||
uint32 | followFlags = B_FOLLOW_LEFT_TOP , |
||
uint32 | options = B_TILE_BITMAP |
||
) |
Sets the background bitmap of the view.
All drawing to the view occurs over bitmap. Any visible regions not covered by bitmap are filled with the current background color.
Once bitmap has been passed in and this method returns the caller may safely delete the object.
bitmap | The background bitmap to set to the view. |
srcRect | Specifies the area of bitmap to use. |
dstRect | Specifies the area of the view to set bitmap to. |
followFlags | Specifies the as the view is resized. See the BView constructor for more details. |
options | Specifies additional view options. The only option currently available is B_TILE_BITMAP which tiles the bitmap across the view. |
void BView::SetViewBitmap | ( | const BBitmap * | bitmap, |
uint32 | followFlags = B_FOLLOW_LEFT_TOP , |
||
uint32 | options = B_TILE_BITMAP |
||
) |
Sets the background bitmap of the view.
All drawing to the view occurs over bitmap. Any visible regions not covered by bitmap are filled with the current background color.
Once bitmap has been passed in and this method returns the caller may safely delete the object.
bitmap | The background bitmap to set to the view. |
followFlags | Specifies the as the view is resized. See the BView constructor for more details. |
options | Specifies additional view options. The only option currently available is B_TILE_BITMAP which tiles the bitmap across the view. |
|
virtual |
Set the view color of the view.
color | The color to set. |
Referenced by BLayoutBuilder::Cards< ParentBuilder >::Cards(), and SetViewColor().
Set the view color of the view.
red | The red component of the view color. |
green | The green component of the view color. |
blue | The blue component of the view color. |
alpha | The alpha component of the view color. |
References rgb_color::alpha, rgb_color::blue, rgb_color::green, rgb_color::red, and SetViewColor().
void BView::SetViewCursor | ( | const BCursor * | cursor, |
bool | sync = true |
||
) |
Assigns cursor to the view.
This cursor will be displayed when the mouse is positioned inside the view.
cursor | The BCursor object to assign to the view. |
sync | If true App Server is synchronized immediately forcing the change to occur. If false , the change will be put in the queue and will take effect when the pending requests are processed. |
status_t BView::SetViewOverlay | ( | const BBitmap * | overlay, |
BRect | srcRect, | ||
BRect | dstRect, | ||
rgb_color * | colorKey, | ||
uint32 | followFlags = B_FOLLOW_LEFT_TOP , |
||
uint32 | options = 0 |
||
) |
Sets the overlay bitmap of the view.
colorKey specifies which color pixels in overlay are treated as transparent allowing the pixels of the view to show through.
Once overlay has been passed in and this method returns the caller may safely delete the object.
overlay | The overlay bitmap to set to the view. |
srcRect | Specifies the area of overlay to use. |
dstRect | Specifies the area of the view to set overlay to. |
colorKey | The color in overlay to treat as transparent. |
followFlags | Specifies the as the view is resized. See the BView constructor for more details. |
options | Specifies additional view options. The only option currently available is B_TILE_BITMAP which tiles the bitmap across the view. |
status_t BView::SetViewOverlay | ( | const BBitmap * | overlay, |
rgb_color * | colorKey, | ||
uint32 | followFlags = B_FOLLOW_LEFT_TOP , |
||
uint32 | options = 0 |
||
) |
Sets the overlay bitmap of the view.
colorKey specifies which color pixels in overlay are treated as transparent allowing the pixels of the view to show through.
Once overlay has been passed in and this method returns the caller may safely delete the object.
overlay | The overlay bitmap to set to the view. |
colorKey | The color in overlay to treat as transparent. |
followFlags | Specifies the as the view is resized. See the BView constructor for more details. |
options | Specifies additional view options. The only option currently available is B_TILE_BITMAP which tiles the bitmap across the view. |
void BView::SetViewUIColor | ( | color_which | which, |
float | tint = B_NO_TINT |
||
) |
Set the view color of the view to a system constant. The color will update live with user changes.
which | The color_which constant to set. |
tint | Optional tint value to use. |
|
virtual |
Shows the view making it visible.
Calls to Hide() and Show() are cumulative. A hidden view becomes visible again once the number of Show() calls matches the number of Hide() calls.
void BView::ShowToolTip | ( | BToolTip * | tip = NULL | ) |
Show the tool tip at the current mouse position.
tip | The BToolTip object to show. |
float BView::StringWidth | ( | const char * | string | ) | const |
Return the width of string set in the font of the view.
string | The string to get the width of. |
float BView::StringWidth | ( | const char * | string, |
int32 | length | ||
) | const |
Return the width of string set in the font of the view up to length characters.
string | The string to get the width of. |
length | The maximum number of characters in string to consider. |
void BView::StrokeArc | ( | BPoint | center, |
float | xRadius, | ||
float | yRadius, | ||
float | startAngle, | ||
float | arcAngle, | ||
::pattern | pattern = B_SOLID_HIGH |
||
) |
Stroke the outline of an arc starting at center with a horizontal radius of xRadius and a vertical radius of yRadius starting at startAngle and drawing arcAngle degrees.
center | The center point. |
xRadius | The horizontal radius. |
yRadius | The vertical radius. |
startAngle | The angle to begin drawing at. |
arcAngle | The number of degrees of the arc to draw. |
pattern | One of the following:
|
void BView::StrokeArc | ( | BRect | rect, |
float | startAngle, | ||
float | arcAngle, | ||
::pattern | pattern = B_SOLID_HIGH |
||
) |
Stroke the outline of an arc inscribed within rect starting at startAngle and drawing arcAngle degrees.
rect | The area within which to inscribe the shape. |
startAngle | The angle to begin drawing at. |
arcAngle | The number of degrees of the arc to draw. |
pattern | One of the following:
|
void BView::StrokeBezier | ( | BPoint * | controlPoints, |
::pattern | pattern = B_SOLID_HIGH |
||
) |
Stroke a bezier curve.
controlPoints | The list of points that form the bezier curve. |
pattern | One of the following:
|
void BView::StrokeEllipse | ( | BPoint | center, |
float | xRadius, | ||
float | yRadius, | ||
::pattern | pattern = B_SOLID_HIGH |
||
) |
Stroke the outline of an ellipse starting at center with a horizontal radius of xRadius and a vertical radius of yRadius.
center | The center point. |
xRadius | The horizontal radius. |
yRadius | The vertical radius. |
pattern | One of the following:
|
void BView::StrokeEllipse | ( | BRect | rect, |
::pattern | pattern = B_SOLID_HIGH |
||
) |
Stroke the outline of an ellipse inscribed within rect.
rect | The area within which to inscribe the shape. |
pattern | One of the following:
|
void BView::StrokeLine | ( | BPoint | start, |
BPoint | end, | ||
::pattern | pattern = B_SOLID_HIGH |
||
) |
Stroke a line from point start to point end.
start | The start point of the line. |
end | The end point of the line. |
pattern | One of the following:
|
void BView::StrokeLine | ( | BPoint | toPoint, |
::pattern | pattern = B_SOLID_HIGH |
||
) |
Stroke a line from the current pen location to the point toPoint.
toPoint | The end point of the line. |
pattern | One of the following:
|
void BView::StrokePolygon | ( | const BPoint * | pointArray, |
int32 | numPoints, | ||
bool | closed = true , |
||
::pattern | pattern = B_SOLID_HIGH |
||
) |
Stroke a polygon shape made up of points specified by pointArray.
pointArray | An array of points that specify the vertices of the polygon. |
numPoints | The number of points in pointArray. |
closed | Whether or not the last line of the polygon should intersect with the initial point. |
pattern | One of the following:
|
void BView::StrokePolygon | ( | const BPoint * | pointArray, |
int32 | numPoints, | ||
BRect | bounds, | ||
bool | closed = true , |
||
::pattern | pattern = B_SOLID_HIGH |
||
) |
Stroke a polygon shape made up of points specified by pointArray inscribed by bounds.
pointArray | An array of points that specify the vertices of the polygon. |
numPoints | The number of points in pointArray. |
bounds | The smallest rectangle that encloses the points in pointArray. |
closed | Whether or not the last line of the polygon should intersect with the initial point. |
pattern | One of the following:
|
void BView::StrokePolygon | ( | const BPolygon * | polygon, |
bool | closed = true , |
||
::pattern | pattern = B_SOLID_HIGH |
||
) |
Stroke a polygon shape.
polygon | The polygon shape to stroke. |
closed | Whether or not the last line of the polygon should intersect with the initial point. |
pattern | One of the following:
|
void BView::StrokeRect | ( | BRect | rect, |
::pattern | pattern = B_SOLID_HIGH |
||
) |
Stroke the rectangle specified by rect.
rect | The rectangular area to stroke. |
pattern | One of the following:
|
void BView::StrokeRoundRect | ( | BRect | rect, |
float | xRadius, | ||
float | yRadius, | ||
::pattern | pattern = B_SOLID_HIGH |
||
) |
Stroke the rounded rectangle with horizontal radius xRadius and vertical radius yRadius.
rect | The rectangular area to stroke the round rect within. |
xRadius | The horizontal radius. |
yRadius | The vertical radius. |
pattern | One of the following:
|
void BView::StrokeShape | ( | BShape * | shape, |
::pattern | pattern = B_SOLID_HIGH |
||
) |
Stroke shape.
shape | The shape to stroke. |
pattern | One of the following:
|
void BView::StrokeTriangle | ( | BPoint | point1, |
BPoint | point2, | ||
BPoint | point3, | ||
::pattern | pattern = B_SOLID_HIGH |
||
) |
Stroke the triangle specified by points point1, point2, and point3.
point1 | The first point of the triangle. |
point2 | The second point of the triangle. |
point3 | The third point of the triangle. |
pattern | One of the following:
|
void BView::StrokeTriangle | ( | BPoint | point1, |
BPoint | point2, | ||
BPoint | point3, | ||
BRect | bounds, | ||
::pattern | pattern = B_SOLID_HIGH |
||
) |
Stroke the triangle specified by points point1, point2, and point3 and enclosed by bounds.
point1 | The first point of the triangle. |
point2 | The second point of the triangle. |
point3 | The third point of the triangle. |
bounds | The rectangular area that encloses the triangle. |
pattern | One of the following:
|
void BView::Sync | ( | ) | const |
Synchronizes the attached window's connection to App Server.
|
virtual |
Hook method called when the view becomes the target of scrollView.
scrollView | The BScrollView object that has targeted the view. |
Reimplemented in BListView.
BToolTip * BView::ToolTip | ( | ) | const |
Return the tool tip set to the view or NULL
if not set.
BAffineTransform BView::Transform | ( | ) | const |
Returns the current BAffineTransform that is applied to the coordinate system.
BAffineTransform BView::TransformTo | ( | coordinate_space | basis | ) | const |
Return the BAffineTransform to convert from the current drawing space to basis.
B_PREVIOUS_STATE_COORDINATES
is equivalent to B_CURRENT_STATE_COORDINATES
when there is no parent state.
B_PARENT_VIEW_DRAW_COORDINATES
and B_PARENT_VIEW_COORDINATES
are equivalent to B_WINDOW_COORDINATES
when used on a root view.
B_WINDOW_COORDINATES
works as B_SCREEN_COORDINATES
for unattached views.
void BView::TranslateBy | ( | double | x, |
double | y | ||
) |
Translate the current view by coordinates.
The translation of x and y are applied to the current transformation, not instead of, so it is an additive action.
Truncate string with truncation mode mode so that it is no wider than width set in the view's font.
When the string is truncated the missing characters are replaced by a horizontal ellipses.
string | The string to truncate in place. |
mode | The truncation mode to use, one of the following:
|
width | The maximum width to truncate the string to. |
rgb_color BView::ViewColor | ( | ) | const |
color_which BView::ViewUIColor | ( | float * | tint = NULL | ) | const |
Return the current view color constant being used.
tint | Optional float pointer in which to store the tint value used to modify the system color constant. |
BWindow * BView::Window | ( | ) | const |
Returns the window the view is attached to.
NULL
if the view isn't attached to a window.
|
virtual |
Hook method called when the attached window is activated or deactivated.
active | true when the window becomes activated, false when the window becomes deactivated. |
Reimplemented in BBox, BButton, BCheckBox, BControl, BListView, BMenuField, BPictureButton, BRadioButton, BScrollBar, BScrollView, BTabView, BTextControl, BTextView, BChannelSlider, BColorControl, BMenuBar, and BStatusBar.