Public Member Functions | List of all members
BView Class Reference

View base class. More...

Inherits BHandler.

Inherited by BBox, BCardView, BColumnListView, BControl, BDragger, BGridView, BGroupView, BListView, BMenu, BMenuField, BPrivate::BViewPort, BScrollBar, BScrollView, BSeparatorView, BSplitView, BStatusBar, BStringView, BTabView, and BTextView.

Public Member Functions

 BView (const char *name, uint32 flags, BLayout *layout=NULL)
 Layout constructor. More...
 
 BView (BRect frame, const char *name, uint32 resizingMode, uint32 flags)
 Standard constructor. More...
 
 BView (BMessage *archive)
 Archive constructor. More...
 
virtual ~BView ()
 Destructor method. More...
 
BRect Bounds () const
 Returns the view's frame rectangle in the view's coordinate system. More...
 
uint32 Flags () const
 Return the view flags set in the constructor or by SetFlags(). More...
 
void Flush () const
 Flushes the attached window's connection to App Server. More...
 
BRect Frame () const
 Returns the view's frame rectangle in the parent's coordinate system. More...
 
virtual void GetPreferredSize (float *_width, float *_height)
 Fill out the preferred width and height of the view into the _width and _height parameters. More...
 
virtual status_t GetSupportedSuites (BMessage *data)
 Reports the suites of messages and specifiers that derived classes understand. More...
 
virtual void Hide ()
 Hides the view without removing it from the view hierarchy. More...
 
bool IsFocus () const
 Returns whether or not the view is the window's current focus view. More...
 
bool IsHidden () const
 Returns whether or not the view is hidden. More...
 
bool IsHidden (const BView *looking_from) const
 Returns whether or not the view is hidden from the perspective of lookingFrom. More...
 
bool IsPrinting () const
 Returns whether or not the view is drawing to a printer. More...
 
BPoint LeftTop () const
 Returns the left top corner point. More...
 
virtual status_t Perform (perform_code code, void *data)
 Perform some action. (Internal Method) More...
 
virtual void ResizeToPreferred ()
 Resizes the view to its preferred size keeping the position of the left top corner constant. More...
 
uint32 ResizingMode () const
 Returns the resizing mode flags mask set in the constructor or by SetResizingMode(). More...
 
virtual BHandlerResolveSpecifier (BMessage *message, int32 index, BMessage *specifier, int32 form, const char *property)
 Determine the proper handler for a scripting message. More...
 
virtual void SetFlags (uint32 flags)
 Sets the view flags to the flags mask. More...
 
virtual void SetResizingMode (uint32 mode)
 Sets the resizing mode of the view according to the mode mask. More...
 
void SetViewCursor (const BCursor *cursor, bool sync=true)
 Assigns cursor to the view. More...
 
virtual void Show ()
 Shows the view making it visible. More...
 
void Sync () const
 Synchronizes the attached window's connection to App Server. More...
 
BWindowWindow () const
 Returns the window the view is attached to. More...
 
View Hierarchy
void AddChild (BView *child, BView *before=NULL)
 Adds child to the view hierarchy immediately before before. More...
 
bool AddChild (BLayoutItem *child)
 Add the child layout item to the view hierarchy. More...
 
bool RemoveChild (BView *child)
 Removes child from the view hierarchy. More...
 
int32 CountChildren () const
 Returns the number of child views that this view has. More...
 
BViewChildAt (int32 index) const
 Returns a pointer to the child view found at index. More...
 
BViewNextSibling () const
 Returns a pointer to the next sibling view. More...
 
BViewPreviousSibling () const
 Returns a pointer to the previous sibling view. More...
 
bool RemoveSelf ()
 Removes the view and all child views from the view hierarchy. More...
 
BViewFindView (const char *name) const
 Returns the view in the view hierarchy with the specified name. More...
 
BViewParent () const
 Returns a pointer to the view's parent. More...
 
Coordinate Conversions
void ConvertToScreen (BPoint *point) const
 Convert point to the screen's coordinate system in place. More...
 
BPoint ConvertToScreen (BPoint point) const
 Returns point converted to the screen's coordinate system. More...
 
void ConvertFromScreen (BPoint *point) const
 Convert point from the screen's coordinate system to the view's coordinate system in place. More...
 
BPoint ConvertFromScreen (BPoint point) const
 Returns point converted from the screen's coordinate system to the view's coordinate system. More...
 
void ConvertToScreen (BRect *rect) const
 Convert rect to the screen's coordinate system in place. More...
 
BRect ConvertToScreen (BRect rect) const
 Returns rect converted to the screen's coordinate system. More...
 
void ConvertFromScreen (BRect *rect) const
 Convert rect from the screen's coordinate system to the view's coordinate system in place. More...
 
BRect ConvertFromScreen (BRect rect) const
 Returns rect converted from the screen's coordinate system to the view's coordinate system. More...
 
void ConvertToParent (BPoint *point) const
 Convert point to the parent's coordinate system in place. More...
 
BPoint ConvertToParent (BPoint point) const
 Returns point converted to the parent's coordinate system. More...
 
void ConvertFromParent (BPoint *point) const
 Convert point from the parent's coordinate system to the view's coordinate system in place. More...
 
BPoint ConvertFromParent (BPoint point) const
 Returns point converted from the parent's coordinate system to the view's coordinate system. More...
 
void ConvertToParent (BRect *rect) const
 Convert rect to the parent's coordinate system in place. More...
 
BRect ConvertToParent (BRect rect) const
 Returns rect converted to the parent's coordinate system. More...
 
void ConvertFromParent (BRect *rect) const
 Convert rect from the parent's coordinate system to the view's coordinate system in place. More...
 
BRect ConvertFromParent (BRect rect) const
 Returns rect converted from the parent's coordinate system to the view's coordinate system. More...
 
Graphics State
void GetClippingRegion (BRegion *region) const
 Fill out region with the view's clipping region. More...
 
virtual void ConstrainClippingRegion (BRegion *region)
 Set the clipping region the region restricting the area that the view can draw in. More...
 
void ClipToPicture (BPicture *picture, BPoint where=B_ORIGIN, bool sync=true)
 Intersects the current clipping region of the view with the pixels of picture. More...
 
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. More...
 
virtual void SetDrawingMode (drawing_mode mode)
 Sets the drawing mode of the view. More...
 
drawing_mode DrawingMode () const
 Return the current drawing_mode. More...
 
void SetBlendingMode (source_alpha srcAlpha, alpha_function alphaFunc)
 Set the blending mode which controls how transparency is used. More...
 
void GetBlendingMode (source_alpha *srcAlpha, alpha_function *alphaFunc) const
 Fill out srcAlpha and alphaFunc with the alpha mode and alpha function of the view. More...
 
virtual void SetPenSize (float size)
 Set the pen size to size. More...
 
float PenSize () const
 Return the current pen size. More...
 
bool HasDefaultColors () const
 Tests if the view has any colors set. More...
 
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() More...
 
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(). More...
 
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() More...
 
void AdoptViewColors (BView *view)
 Attempts to use the colors of a given view. Will adopt view, low, and high colors. More...
 
virtual void SetViewColor (rgb_color color)
 Set the view color of the view. More...
 
void SetViewColor (uchar red, uchar green, uchar blue, uchar alpha=255)
 Set the view color of the view. More...
 
rgb_color ViewColor () const
 Return the current view color. More...
 
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. More...
 
color_which ViewUIColor (float *tint=NULL) const
 Return the current view color constant being used. More...
 
virtual void SetHighColor (rgb_color color)
 Set the high color of the view. More...
 
void SetHighColor (uchar red, uchar green, uchar blue, uchar alpha=255)
 Set the high color of the view. More...
 
rgb_color HighColor () const
 Return the current high color. More...
 
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. More...
 
color_which HighUIColor (float *tint=NULL) const
 Return the current high color constant being used. More...
 
virtual void SetLowColor (rgb_color color)
 Set the low color of the view. More...
 
void SetLowColor (uchar red, uchar green, uchar blue, uchar alpha=255)
 Set the low color of the view. More...
 
rgb_color LowColor () const
 Return the current low color. More...
 
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. More...
 
color_which LowUIColor (float *tint=NULL) const
 Return the current low color constant being used. More...
 
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. More...
 
join_mode LineJoinMode () const
 Returns the current line join mode. More...
 
cap_mode LineCapMode () const
 Returns the current line cap mode. More...
 
float LineMiterLimit () const
 Returns the miter limit used for B_MITER_JOIN join mode. More...
 
void SetOrigin (BPoint where)
 Sets the origin in the view's coordinate system. More...
 
void SetOrigin (float x, float y)
 Sets the origin in the view's coordinate system. More...
 
BPoint Origin () const
 Returns the origin point in the view's coordinate system. More...
 
void PushState ()
 Saves the drawing state to the stack. More...
 
void PopState ()
 Restores the drawing state from the stack. More...
 
void MovePenTo (BPoint pt)
 Move the pen to point in the view's coordinate system. More...
 
void MovePenTo (float x, float y)
 Move the pen to the point specified by x and y in the view's coordinate system. More...
 
void MovePenBy (float x, float y)
 Move the pen by x pixels horizontally and y pixels vertically. More...
 
BPoint PenLocation () const
 Return the current pen location as a BPoint object. More...
 
virtual void SetFont (const BFont *font, uint32 mask=B_FONT_ALL)
 Set the font of the view. More...
 
void GetFont (BFont *font) const
 Fill out font with the font set to the view. More...
 
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. More...
 
float StringWidth (const char *string) const
 Return the width of string set in the font of the view. More...
 
float StringWidth (const char *string, int32 length) const
 Return the width of string set in the font of the view up to length characters. More...
 
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. More...
 
void SetFontSize (float size)
 Set the size of the view's font to size. More...
 
void ForceFontAliasing (bool enable)
 Turn anti-aliasing on and off when printing. More...
 
void GetFontHeight (font_height *height) const
 Fill out the font_height struct with the view font. More...
 
void SetScale (float scale) const
 Sets the scale of the coordinate system the view uses for drawing. More...
 
float Scale () const
 Return the current drawing scale. More...
 
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()

If the the image is bigger than the destination rectangle, it is scaled to fit.

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.

DrawPicture()

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.

DrawString()

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 B_OP_COPY mode and anti-aliasing can produce undesirable effects when a string is draw in other modes, especially if the string is drawn in the same location repeatedly.

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. More...
 
void SetViewBitmap (const BBitmap *bitmap, uint32 followFlags=B_FOLLOW_LEFT_TOP, uint32 options=B_TILE_BITMAP)
 Sets the background bitmap of the view. More...
 
void ClearViewBitmap ()
 Clears the background bitmap of the view if it has one. More...
 
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. More...
 
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. More...
 
void ClearViewOverlay ()
 Clears the overlay bitmap of the view if it has one. More...
 
void StrokeLine (BPoint toPoint, ::pattern pattern=B_SOLID_HIGH)
 Stroke a line from the current pen location to the point toPoint. More...
 
void StrokeLine (BPoint start, BPoint end, ::pattern pattern=B_SOLID_HIGH)
 Stroke a line from point start to point end. More...
 
void BeginLineArray (int32 count)
 Begin a line array of up to count lines. More...
 
void AddLine (BPoint start, BPoint end, rgb_color color)
 Add a line to the line array drawn from start to end. More...
 
void EndLineArray ()
 End the line array drawing the lines. More...
 
void StrokePolygon (const BPolygon *polygon, bool closed=true, ::pattern pattern=B_SOLID_HIGH)
 Stroke a polygon shape. More...
 
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. More...
 
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. More...
 
void FillPolygon (const BPolygon *polygon, ::pattern pattern=B_SOLID_HIGH)
 Fill a polygon shape. More...
 
void FillPolygon (const BPoint *pointArray, int32 numPoints, ::pattern pattern=B_SOLID_HIGH)
 Fill a polygon shape made up of points specified by pointArray. More...
 
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. More...
 
void FillPolygon (const BPolygon *polygon, const BGradient &gradient)
 Fill a polygon shape with the specified gradient pattern. More...
 
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. More...
 
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. More...
 
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. More...
 
void StrokeTriangle (BPoint point1, BPoint point2, BPoint point3, ::pattern pattern=B_SOLID_HIGH)
 Stroke the triangle specified by points point1, point2, and point3. More...
 
void FillTriangle (BPoint point1, BPoint point2, BPoint point3, ::pattern pattern=B_SOLID_HIGH)
 Fill the triangle specified by points point1, point2, and point3. More...
 
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. More...
 
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. More...
 
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. More...
 
void StrokeRect (BRect rect, ::pattern pattern=B_SOLID_HIGH)
 Stroke the rectangle specified by rect. More...
 
void FillRect (BRect rect, ::pattern pattern=B_SOLID_HIGH)
 Fill the rectangle specified by rect. More...
 
void FillRect (BRect rect, const BGradient &gradient)
 Fill the rectangle specified by rect with the specified gradient pattern. More...
 
void FillRegion (BRegion *rectegion, ::pattern pattern=B_SOLID_HIGH)
 Fill region. More...
 
void FillRegion (BRegion *rectegion, const BGradient &gradient)
 Fill region with the specified gradient pattern. More...
 
void InvertRect (BRect rect)
 Inverts the colors within rect. More...
 
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. More...
 
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. More...
 
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. More...
 
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. More...
 
void StrokeEllipse (BRect rect, ::pattern pattern=B_SOLID_HIGH)
 Stroke the outline of an ellipse inscribed within rect. More...
 
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. More...
 
void FillEllipse (BRect rect, ::pattern pattern=B_SOLID_HIGH)
 Fill an ellipse inscribed within rect. More...
 
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. More...
 
void FillEllipse (BRect rect, const BGradient &gradient)
 Fill an ellipse with the specified gradient pattern inscribed within rect. More...
 
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. More...
 
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. More...
 
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. More...
 
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. More...
 
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. More...
 
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. More...
 
void StrokeBezier (BPoint *controlPoints, ::pattern pattern=B_SOLID_HIGH)
 Stroke a bezier curve. More...
 
void FillBezier (BPoint *controlPoints, ::pattern pattern=B_SOLID_HIGH)
 Fill a bezier curve. More...
 
void FillBezier (BPoint *controlPoints, const BGradient &gradient)
 Fill a bezier curve. More...
 
void StrokeShape (BShape *shape, ::pattern pattern=B_SOLID_HIGH)
 Stroke shape. More...
 
void FillShape (BShape *shape, ::pattern pattern=B_SOLID_HIGH)
 Fill shape. More...
 
void FillShape (BShape *shape, const BGradient &gradient)
 Fill shape with the specified gradient pattern. More...
 
void CopyBits (BRect src, BRect dst)
 Copy the bits from the src rectangle to the dst rectangle in the view's coordinate system. More...
 
void DrawBitmapAsync (const BBitmap *aBitmap, BRect bitmapRect, BRect viewRect, uint32 options)
 Draws bitmap on the view within viewRect asynchronously. More...
 
void DrawBitmapAsync (const BBitmap *aBitmap, BRect bitmapRect, BRect viewRect)
 Draws bitmap on the view within viewRect asynchronously. More...
 
void DrawBitmapAsync (const BBitmap *aBitmap, BRect viewRect)
 Draws bitmap on the view within viewRect asynchronously. More...
 
void DrawBitmapAsync (const BBitmap *aBitmap, BPoint where)
 Draws bitmap on the view offset by where asynchronously. More...
 
void DrawBitmapAsync (const BBitmap *aBitmap)
 Draws bitmap on the view asynchronously. More...
 
void DrawBitmap (const BBitmap *aBitmap, BRect bitmapRect, BRect viewRect, uint32 options)
 brief Draws bitmap on the view within viewRect. More...
 
void DrawBitmap (const BBitmap *aBitmap, BRect bitmapRect, BRect viewRect)
 Draws bitmap on the view within viewRect. More...
 
void DrawBitmap (const BBitmap *aBitmap, BRect viewRect)
 Draws bitmap on the view within viewRect. More...
 
void DrawBitmap (const BBitmap *aBitmap, BPoint where)
 Draws bitmap on the view offset by where. More...
 
void DrawBitmap (const BBitmap *aBitmap)
 Draws bitmap on the view. More...
 
void DrawChar (char aChar)
 Draws character c onto to the view at the current pen position. More...
 
void DrawChar (char aChar, BPoint location)
 Draws character c at the specified location in the view. More...
 
void DrawString (const char *string, escapement_delta *delta=NULL)
 Draw string onto the view at the current pen position. More...
 
void DrawString (const char *string, BPoint location, escapement_delta *delta=NULL)
 Draw string onto the view at the specified location in the view. More...
 
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. More...
 
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. More...
 
void DrawString (const char *string, const BPoint *locations, int32 locationCount)
 Draw string locationCount times at the specified locations. More...
 
void DrawString (const char *string, int32 length, const BPoint *locations, int32 locationCount)
 Draw string up to length characters locationCount times at the specified locations. More...
 
void Invalidate (BRect invalRect)
 Sends a message to App Server to redraw the portion of the view specified by invalRect. More...
 
void Invalidate (const BRegion *invalRegion)
 Sends a message to App Server to redraw the portion of the view specified by region. More...
 
void Invalidate ()
 Sends a message to App Server to redraw the view. More...
 
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. More...
 
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. More...
 
void SetDiskMode (char *filename, long offset)
 Unimplemented. More...
 
void BeginPicture (BPicture *a_picture)
 Begins sending drawing instructions to picture. More...
 
void AppendToPicture (BPicture *a_picture)
 Appends drawing instructions to picture without clearing it first. More...
 
BPictureEndPicture ()
 Ends the drawing instruction recording session and returns the BPicture object passed to BeginPicture() or AppendToPicture(). More...
 
void DrawPicture (const BPicture *a_picture)
 Draws the picture at the view's current pen position. More...
 
void DrawPicture (const BPicture *a_picture, BPoint where)
 Draws the picture at the location in the view specified by where. More...
 
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. More...
 
void DrawPictureAsync (const BPicture *a_picture)
 Draws the picture at the view's current pen position. More...
 
void DrawPictureAsync (const BPicture *a_picture, BPoint where)
 Draws the picture at the location in the view specified by where. More...
 
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. More...
 
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. More...
 
void MoveTo (BPoint where)
 Move the view to the location specified by where in the parent view's coordinate system. More...
 
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. More...
 
void ResizeBy (float dh, float dv)
 Resize the view by deltaWidth horizontally and deltaHeight vertically without moving the top left corner of the view. More...
 
void ResizeTo (float width, float height)
 Resize the view to the specified width and height. More...
 
void ResizeTo (BSize size)
 Resize the view to the dimension specified by size. More...
 
- Public Member Functions inherited from BHandler
 BHandler (const char *name=NULL)
 Construct a new handler with a name. More...
 
virtual ~BHandler ()
 Free the filters of this handler, as well as the list of observers. More...
 
 BHandler (BMessage *data)
 Construct a handler from an archived message. More...
 
BLooperLooper () const
 Return a pointer to the looper that this handler is associated with. More...
 
void SetName (const char *name)
 Set or change the name of this handler. More...
 
const char * Name () const
 Return the name of this handler. More...
 
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. More...
 
BHandlerNextHandler () const
 Return the next hander in the chain to which the message is passed on. More...
 
virtual void AddFilter (BMessageFilter *filter)
 Add filter as a prerequisite to this handler. More...
 
virtual bool RemoveFilter (BMessageFilter *filter)
 Remove filter from the filter list. More...
 
virtual void SetFilterList (BList *filters)
 Set the internal list of filters to filters. More...
 
BListFilterList ()
 Return a pointer to the list of filters. More...
 
bool LockLooper ()
 Lock the looper associated with this handler. More...
 
status_t LockLooperWithTimeout (bigtime_t timeout)
 Lock the looper associated with this handler, with a time out value. More...
 
void UnlockLooper ()
 Unlock the looper. More...
 
status_t StartWatching (BMessenger target, uint32 what)
 Subscribe this handler to watch a specific state change of a target. More...
 
status_t StartWatchingAll (BMessenger target)
 Subscribe this handler to watch a target for all events. More...
 
status_t StopWatching (BMessenger target, uint32 what)
 Unsubscribe this handler from watching a specific state. More...
 
status_t StopWatchingAll (BMessenger target)
 Unsubscribe this handler from watching all states. More...
 
status_t StartWatching (BHandler *observer, uint32 what)
 Subscribe an observer for a specific state change of this handler. More...
 
status_t StartWatchingAll (BHandler *observer)
 Subscribe an observer for a all state changes. More...
 
status_t StopWatching (BHandler *observer, uint32 what)
 Unsubscribe an observer from watching a specific state. More...
 
status_t StopWatchingAll (BHandler *observer)
 Unsubscribe an observer from watching all states. More...
 
virtual void SendNotices (uint32 what, const BMessage *notice=NULL)
 Emit a state change to the observers. More...
 
bool IsWatched () const
 Check if there are any observers watching this handler. More...
 
- Public Member Functions inherited from BArchivable
 BArchivable (BMessage *from)
 Constructor. Does important behind-the-scenes work in the unarchiving process. More...
 
 BArchivable ()
 Constructor. Does nothing. More...
 
virtual ~BArchivable ()
 Destructor. Does nothing. More...
 

Archiving

virtual status_t Archive (BMessage *archive, bool deep=true) const
 Archives the object into the data message. More...
 
static BArchivableInstantiate (BMessage *archive)
 Creates a new BView object from the data message. More...
 

Hook Methods

virtual status_t AllUnarchived (const BMessage *archive)
 Hook method called when all views have been unarchived. More...
 
virtual status_t AllArchived (BMessage *archive) const
 Hook method called when all views have been archived. More...
 
virtual void AttachedToWindow ()
 Hook method called when the object is attached to a window. More...
 
virtual void AllAttached ()
 Similar to AttachedToWindow() but this method is triggered after all child views have already been attached to a window. More...
 
virtual void DetachedFromWindow ()
 Hook method called when the object is detached from a window. More...
 
virtual void AllDetached ()
 Similar to AttachedToWindow() but this method is triggered after all child views have already been detached from a window. More...
 
virtual void MessageReceived (BMessage *message)
 Handle message received by the associated looper. More...
 
virtual void Draw (BRect updateRect)
 Draws the area of the view that intersects updateRect. More...
 
virtual void MouseDown (BPoint where)
 Hook method called when a mouse button is pressed. More...
 
virtual void MouseUp (BPoint where)
 Hook method called when a mouse button is released. More...
 
virtual void MouseMoved (BPoint where, uint32 code, const BMessage *dragMessage)
 Hook method called when the mouse is moved. More...
 
virtual void WindowActivated (bool active)
 Hook method called when the attached window is activated or deactivated. More...
 
virtual void KeyDown (const char *bytes, int32 numBytes)
 Hook method called when a keyboard key is pressed. More...
 
virtual void KeyUp (const char *bytes, int32 numBytes)
 Hook method called when a keyboard key is released. More...
 
virtual void Pulse ()
 Hook method called when the view receives a B_PULSE message. More...
 
virtual void FrameMoved (BPoint newPosition)
 Hook method called when the view is moved. More...
 
virtual void FrameResized (float newWidth, float newHeight)
 Hook method called when the view is resized. More...
 
virtual void TargetedByScrollView (BScrollView *scrollView)
 Hook method called when the view becomes the target of scrollView. More...
 
virtual void DrawAfterChildren (BRect updateRect)
 Perform any drawing that needs to be done after child view have already been drawn. More...
 
virtual void LayoutInvalidated (bool descendants=false)
 Hook method called when the layout is invalidated. More...
 

Input Related

void BeginRectTracking (BRect startRect, uint32 style=B_TRACK_WHOLE_RECT)
 Displays an outline rectangle on the view and initiates tracking. More...
 
void EndRectTracking ()
 Ends tracking removing the outline rectangle from the view. More...
 
void GetMouse (BPoint *location, uint32 *buttons, bool checkMessageQueue=true)
 Fills out the cursor location and the current state of the mouse buttons. More...
 
void DragMessage (BMessage *message, BRect dragRect, BHandler *replyTo=NULL)
 Initiates a drag-and-drop session. More...
 
void DragMessage (BMessage *message, BBitmap *bitmap, BPoint offset, BHandler *replyTo=NULL)
 Initiates a drag-and-drop session of an image. More...
 
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. More...
 
status_t SetEventMask (uint32 mask, uint32 options=0)
 Sets whether or not the view can accept mouse and keyboard events when not in focus. More...
 
uint32 EventMask ()
 Returns the current event mask. More...
 
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. More...
 
void ScrollBy (float dh, float dv)
 Scroll the view by deltaX horizontally and deltaY vertically. More...
 
virtual void ScrollTo (BPoint where)
 Scroll the view to the point specified by where. More...
 
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. More...
 
BScrollBarScrollBar (orientation direction) const
 Returns the BScrollBar object that has the BView set as its target. More...
 
status_t ScrollWithMouseWheelDelta (BScrollBar *, float)
 Handle the scroll wheel changing over scrollbars. More...
 

Layouting

Note
These methods were not available in BeOS R5.
virtual BSize MinSize ()
 Return the minimum size of the view. More...
 
virtual BSize MaxSize ()
 Return the maximum size of the view. More...
 
virtual BSize PreferredSize ()
 Return the preferred size of the view. More...
 
void SetExplicitMinSize (BSize size)
 Set this view's min size, to be used by MinSize(). More...
 
void SetExplicitMaxSize (BSize size)
 Set this view's max size, to be used by MaxSize(). More...
 
void SetExplicitPreferredSize (BSize size)
 Set this view's preferred size, to be used by PreferredSize(). More...
 
void SetExplicitAlignment (BAlignment alignment)
 Set this view's alignment, to be used by Alignment(). More...
 
void InvalidateLayout (bool descendants=false)
 Invalidate layout. More...
 
virtual void SetLayout (BLayout *layout)
 Sets the layout of the view. More...
 
BLayoutGetLayout () const
 Get the layout of the view. More...
 
void EnableLayoutInvalidation ()
 Enable layout invalidation. More...
 
void DisableLayoutInvalidation ()
 Disable layout invalidation. More...
 
bool IsLayoutInvalidationDisabled ()
 Returns whether or not layout invalidation is disabled. More...
 
bool IsLayoutValid () const
 Returns whether or not the layout is valid. More...
 
void ResetLayoutInvalidation ()
 Service call for BView derived classes re-enabling InvalidateLayout() notifications. More...
 
void Layout (bool force)
 Layout the view. More...
 
void Relayout ()
 Relayout the view. More...
 
virtual void DoLayout ()
 Layout view within the layout context. More...
 

Tool Tips

Note
These methods were not available in BeOS R5.
void SetToolTip (const char *text)
 Set the tool tip of the view to text. More...
 
void SetToolTip (BToolTip *tip)
 Set the tool tip of the view to the tip object. More...
 
BToolTipToolTip () const
 Return the tool tip set to the view or NULL if not set. More...
 
void ShowToolTip (BToolTip *tip=NULL)
 Show the tool tip at the current mouse position. More...
 
void HideToolTip ()
 Hide the view's tool tip. More...
 
virtual bool GetToolTipAt (BPoint point, BToolTip **_tip)
 Point _tip with the view's tool tip. More...
 

Additional Inherited Members

- Static Public Member Functions inherited from BHandler
static BArchivableInstantiate (BMessage *data)
 Static method to instantiate a handler from an archived message. More...
 
- Static Public Member Functions inherited from BArchivable
static BArchivableInstantiate (BMessage *archive)
 Static member to restore objects from messages. More...
 

Detailed Description

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:

if (Window()->LockLooper()) {
...
}

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:

Since
BeOS R3

Constructor & Destructor Documentation

◆ BView() [1/3]

BView::BView ( const char *  name,
uint32  flags,
BLayout layout = NULL 
)

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.

Parameters
nameThe name of the view, can be NULL.
flagsThe view flags, a mask of one or more of the following:
  • B_FULL_UPDATE_ON_RESIZE Redraw the entire view on resize.
  • B_WILL_DRAW Indicates that the view will do its own drawing.
  • B_PULSE_NEEDED The view accepts Pulse() messages.
  • B_NAVIGABLE_JUMP Default for keyboard navigation.
  • B_FRAME_EVENTS Responds to move and resize events.
  • B_NAVIGABLE Able to receive keyboard navigation focus.
  • B_SUBPIXEL_PRECISE Draws with sub-pixel precision.
  • B_DRAW_ON_CHILDREN Responds to DrawAfterChildren().
  • B_INPUT_METHOD_AWARE Allows access input method add-ons.
  • B_SUPPORTS_LAYOUT Supports the layout APIs, i.e. it doesn't use a frame rectangle.
  • B_INVALIDATE_AFTER_LAYOUT Is redraw after added to a layout.
layoutA layout to set the view to.
Since
Haiku R1

◆ BView() [2/3]

BView::BView ( BRect  frame,
const char *  name,
uint32  resizingMode,
uint32  flags 
)

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.

Parameters
frameThe frame rectangle of the view.
nameThe name of the view, can be NULL.
resizingModeDefines the view's behavior when its parent is resized.

It combines one of the following horizontal resizing constants:
  • B_FOLLOW_TOP The margin between the top of the view and the top of its parent remains constant.
  • B_FOLLOW_BOTTOM The margin between the bottom of the view and the bottom of its parent remains constant.
  • B_FOLLOW_TOP_BOTTOM The margin between the top and bottom sides of the view and the top and bottom sides of the parent both remain constant.
  • B_FOLLOW_V_CENTER Maintains a constant relationship to the vertical center of the parent view.
with one of the following vertical resizing constants:
  • B_FOLLOW_LEFT The margin between the left side of the view and the left side of its parent remains constant.
  • B_FOLLOW_RIGHT The margin between the right side of the view and the right side of the parent remains constant.
  • B_FOLLOW_LEFT_RIGHT The margin between the left and right sides of the view and the left and right sides of its parent both remain constant.
  • B_FOLLOW_H_CENTER The view maintains a constant relationship to the horizontal center of the parent view.
or use one of the following combined horizontal/vertical constants:
  • B_FOLLOW_NONE Equivalent to B_FOLLOW_LEFT | B_FOLLOW_TOP.
  • B_FOLLOW_ALL_SIDES Equivalent to B_FOLLOW_LEFT_RIGHT | B_FOLLOW_TOP_BOTTOM.
flagsThe view flags, a mask of one or more of the following:
  • B_FULL_UPDATE_ON_RESIZE Redraw the entire view on resize.
  • B_WILL_DRAW Indicates that the view will do its own drawing.
  • B_PULSE_NEEDED The view accepts Pulse() messages.
  • B_NAVIGABLE_JUMP Default for keyboard navigation.
  • B_FRAME_EVENTS Responds to move and resize events.
  • B_NAVIGABLE Able to receive keyboard navigation focus.
  • B_SUBPIXEL_PRECISE Draws with sub-pixel precision.
  • B_DRAW_ON_CHILDREN Responds to DrawAfterChildren().
  • B_INPUT_METHOD_AWARE Allows access input method add-ons.
  • B_SUPPORTS_LAYOUT Supports the layout APIs, i.e. it doesn't use a frame rectangle.
  • B_INVALIDATE_AFTER_LAYOUT Is redraw after added to a layout.
Since
BeOS R3

◆ ~BView()

BView::~BView ( )
virtual

Destructor method.

Deletes the view and all children freeing any memory used.

Since
BeOS R3

◆ BView() [3/3]

BView::BView ( BMessage archive)

Archive constructor.

Parameters
archiveThe message data to construct the view from.
Since
BeOS R3

Member Function Documentation

◆ AddChild() [1/2]

void BView::AddChild ( BView child,
BView before = NULL 
)

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.

Parameters
childThe child view to add.
beforeThe sibling view to add child before.
Since
BeOS R3

◆ AddChild() [2/2]

bool BView::AddChild ( BLayoutItem child)

Add the child layout item to the view hierarchy.

Parameters
childThe child layout item to add.
Returns
Whether or not child was added to the view layout hierarchy.
Since
Haiku R1

◆ AddLine()

void BView::AddLine ( BPoint  start,
BPoint  end,
rgb_color  color 
)

Add a line to the line array drawn from start to end.

Parameters
startThe start point of the line.
endThe end point of the line.
colorThe color to draw the line.
Since
BeOS R3

◆ AdoptParentColors()

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().

Since
Haiku R1

◆ AdoptSystemColors()

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()

Since
Haiku R1

Referenced by BLayoutBuilder::Grid< ParentBuilder >::Grid(), and BLayoutBuilder::Group< ParentBuilder >::Group().

◆ AdoptViewColors()

void BView::AdoptViewColors ( BView view)

Attempts to use the colors of a given view. Will adopt view, low, and high colors.

Since
Haiku R1

◆ AllArchived()

status_t BView::AllArchived ( BMessage into) const
virtual

Hook method called when all views have been archived.

Since
BeOS R3

Reimplemented from BArchivable.

Reimplemented in BAbstractSpinner, BTextControl, and BMenuField.

◆ AllAttached()

void BView::AllAttached ( )
virtual

Similar to AttachedToWindow() but this method is triggered after all child views have already been attached to a window.

Since
BeOS R3

Reimplemented in BTextView, BTabView, BOutlineListView, BTextControl, BColorControl, BButton, BDragger, BMenu, BRadioButton, BPopUpMenu, BListView, BBox, BMenuBar, BControl, BMenuField, BOptionPopUp, BPictureButton, BScrollBar, BStringView, BCheckBox, and BScrollView.

◆ AllDetached()

void BView::AllDetached ( )
virtual

Similar to AttachedToWindow() but this method is triggered after all child views have already been detached from a window.

Since
BeOS R3

Reimplemented in BTextView, BTabView, BOutlineListView, BTextControl, BColorControl, BButton, BDragger, BMenu, BRadioButton, BPopUpMenu, BListView, BMenuField, BBox, BMenuBar, BControl, BPictureButton, BScrollBar, BStringView, BCheckBox, and BScrollView.

◆ AllUnarchived()

status_t BView::AllUnarchived ( const BMessage from)
virtual

Hook method called when all views have been unarchived.

Since
BeOS R3

Reimplemented from BArchivable.

Reimplemented in BAbstractSpinner, BTabView, BTextControl, BMenuField, and BScrollView.

◆ AppendToPicture()

void BView::AppendToPicture ( BPicture picture)

Appends drawing instructions to picture without clearing it first.

Parameters
pictureThe BPicture object to record drawing instructions to.
Since
BeOS R3

◆ Archive()

status_t BView::Archive ( BMessage data,
bool  deep = true 
) const
virtual

Archives the object into the data message.

Parameters
dataA pointer to the BMessage object to archive the object into.
deepWhether or not to archive child views as well.
Returns
A status code, B_OK if everything went well or an error code otherwise.
Return values
B_OKThe object was archived successfully.
B_NO_MEMORYRan out of memory while archiving the object.
Since
BeOS R3

Reimplemented from BHandler.

Reimplemented in BTabView, BTextView, BMenu, BAbstractSpinner, BListView, BMenuBar, BControl, BButton, BTextControl, BColorControl, BMenuField, BDragger, BScrollBar, BPictureButton, BBox, BChannelControl, BScrollView, BOutlineListView, BRadioButton, BCheckBox, BStringView, and BPopUpMenu.

◆ AttachedToWindow()

void BView::AttachedToWindow ( )
virtual

◆ BeginLineArray()

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.

Parameters
countThe maximum number of lines in the line array to draw.
See also
StrokeLine()
Since
BeOS R3

◆ BeginPicture()

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.

Parameters
pictureThe BPicture object to record drawing instructions to.
Since
BeOS R3

◆ BeginRectTracking()

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().

Parameters
startRectThe initial frame in the view's coordinate system.
styleThis parameter is set to one of the following:
  • B_TRACK_WHOLE_RECT The position of the rect changes with the cursor while its size remains the same.
  • B_TRACK_RECT_CORNER The left top corner is fixed while the right and bottom edges move with the cursor.
Since
BeOS R3

◆ Bounds()

BRect BView::Bounds ( ) const

Returns the view's frame rectangle in the view's coordinate system.

Returns
The view's bounding rectangle in the view's coordinate system.
Since
BeOS R3

◆ ChildAt()

BView * BView::ChildAt ( int32  index) const

Returns a pointer to the child view found at index.

Parameters
indexThe index of the child view to return a pointer of.
Returns
A pointer to the child view at index or NULL if not found.
Since
BeOS R3

◆ ClearViewBitmap()

void BView::ClearViewBitmap ( )

Clears the background bitmap of the view if it has one.

Since
BeOS R4

◆ ClearViewOverlay()

void BView::ClearViewOverlay ( )

Clears the overlay bitmap of the view if it has one.

Since
BeOS R5

◆ ClipToInversePicture()

void BView::ClipToInversePicture ( BPicture picture,
BPoint  where = B_ORIGIN,
bool  sync = true 
)

Intersects the current clipping region of the view with the pixels outside of picture.

Parameters
pictureThe BPicture object to intersect with.
whereOffset in the view's coordinate system.
syncIf false, this method will execute asynchronously.
See also
ClipToPicture()
Since
BeOS R5

◆ ClipToPicture()

void BView::ClipToPicture ( BPicture picture,
BPoint  where = B_ORIGIN,
bool  sync = true 
)

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.

Parameters
pictureThe BPicture object to intersect with.
whereOffset in the view's coordinate system.
syncIf false, this method will execute asynchronously.
Since
BeOS R5

◆ ConstrainClippingRegion()

void BView::ConstrainClippingRegion ( BRegion region)
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.

Parameters
regionThe region to set the clipping region to or NULL to reset to default.
Since
BeOS R3

◆ ConvertFromParent() [1/4]

void BView::ConvertFromParent ( BPoint point) const

Convert point from the parent's coordinate system to the view's coordinate system in place.

Parameters
pointA pointer to a BPoint object to convert.
Since
BeOS R3

◆ ConvertFromParent() [2/4]

BPoint BView::ConvertFromParent ( BPoint  point) const

Returns point converted from the parent's coordinate system to the view's coordinate system.

Parameters
pointA BPoint object to convert.
Returns
A new BPoint object in the view's coordinate system.
Since
BeOS R3

◆ ConvertFromParent() [3/4]

void BView::ConvertFromParent ( BRect rect) const

Convert rect from the parent's coordinate system to the view's coordinate system in place.

Parameters
rectA pointer to a BRect object to convert.
Since
BeOS R3

◆ ConvertFromParent() [4/4]

BRect BView::ConvertFromParent ( BRect  rect) const

Returns rect converted from the parent's coordinate system to the view's coordinate system.

Parameters
rectA BRect object to convert.
Returns
A new BRect object in the view's coordinate system.
Since
BeOS R3

◆ ConvertFromScreen() [1/4]

void BView::ConvertFromScreen ( BPoint point) const

Convert point from the screen's coordinate system to the view's coordinate system in place.

Parameters
pointA pointer to a BPoint object to convert.
Since
BeOS R3

◆ ConvertFromScreen() [2/4]

BPoint BView::ConvertFromScreen ( BPoint  point) const

Returns point converted from the screen's coordinate system to the view's coordinate system.

Parameters
pointA BPoint object to convert.
Returns
A new BPoint object in the view's coordinate system.
Since
BeOS R3

◆ ConvertFromScreen() [3/4]

void BView::ConvertFromScreen ( BRect rect) const

Convert rect from the screen's coordinate system to the view's coordinate system in place.

Parameters
rectA pointer to a BRect object to convert.
Since
BeOS R3

◆ ConvertFromScreen() [4/4]

BRect BView::ConvertFromScreen ( BRect  rect) const

Returns rect converted from the screen's coordinate system to the view's coordinate system.

Parameters
rectA BRect object to convert.
Returns
A new BRect object in the view's coordinate system.
Since
BeOS R3

◆ ConvertToParent() [1/4]

void BView::ConvertToParent ( BPoint point) const

Convert point to the parent's coordinate system in place.

Parameters
pointA pointer to a BPoint object to convert.
Since
BeOS R3

◆ ConvertToParent() [2/4]

BPoint BView::ConvertToParent ( BPoint  point) const

Returns point converted to the parent's coordinate system.

Parameters
pointA BPoint object to convert.
Returns
A new BPoint object in the parent's coordinate system.
Since
BeOS R3

◆ ConvertToParent() [3/4]

void BView::ConvertToParent ( BRect rect) const

Convert rect to the parent's coordinate system in place.

Parameters
rectA pointer to a BRect object to convert.
Since
BeOS R3

◆ ConvertToParent() [4/4]

BRect BView::ConvertToParent ( BRect  rect) const

Returns rect converted to the parent's coordinate system.

Parameters
rectA BRect object to convert.
Returns
A new BRect object in the parent's coordinate system.
Since
BeOS R3

◆ ConvertToScreen() [1/4]

void BView::ConvertToScreen ( BPoint point) const

Convert point to the screen's coordinate system in place.

Parameters
pointA pointer to a BPoint object to convert.
Since
BeOS R3

◆ ConvertToScreen() [2/4]

BPoint BView::ConvertToScreen ( BPoint  point) const

Returns point converted to the screen's coordinate system.

Parameters
pointA BPoint object to convert.
Returns
A new BPoint object in the screen's coordinate system.
Since
BeOS R3

◆ ConvertToScreen() [3/4]

void BView::ConvertToScreen ( BRect rect) const

Convert rect to the screen's coordinate system in place.

Parameters
rectA pointer to a BRect object to convert.
Since
BeOS R3

◆ ConvertToScreen() [4/4]

BRect BView::ConvertToScreen ( BRect  rect) const

Returns rect converted to the screen's coordinate system.

Parameters
rectA BRect object to convert.
Returns
A new BRect object in the screen's coordinate system.
Since
BeOS R3

◆ CopyBits()

void BView::CopyBits ( BRect  src,
BRect  dst 
)

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.

Parameters
srcThe source rectangle to copy bits from.
dstThe destination rectangle to copy bits to.
Since
BeOS R3

◆ CountChildren()

int32 BView::CountChildren ( ) const

Returns the number of child views that this view has.

Returns
The number of child views.
Since
BeOS R3

◆ DelayedInvalidate() [1/2]

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.

Parameters
delayThe time, in microseconds, to wait until redrawing the view.
Since
Haiku R1

◆ DelayedInvalidate() [2/2]

void BView::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.

Parameters
delayThe time, in microseconds, to wait until redrawing the view.
invalRectThe rectangular area of the view to redraw.
Since
Haiku R1

◆ DetachedFromWindow()

void BView::DetachedFromWindow ( )
virtual

◆ DisableLayoutInvalidation()

void BView::DisableLayoutInvalidation ( )

Disable layout invalidation.

Remarks
This is only meaningful if the view is part of a BLayout.
Since
Haiku R1

◆ DoLayout()

void BView::DoLayout ( )
protectedvirtual

Layout view within the layout context.

Remarks
This is only meaningful if the view is part of a BLayout.
Since
Haiku R1

Reimplemented in BTextView, BAbstractSpinner, BTextControl, BMenuField, BScrollView, BMenu, and BBox.

◆ DragMessage() [1/3]

void BView::DragMessage ( BMessage message,
BRect  dragRect,
BHandler replyTo = NULL 
)

Initiates a drag-and-drop session.

Warning
This method only works if the BView objects are attached to a window.
Parameters
messageContains data to be dragged and dropped on the destination view. The caller retains responsibility for this object.
dragRectAn outline rectangle used in place of a bitmap image set in the view's coordinate system.
replyToThe 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.
Since
BeOS R3

◆ DragMessage() [2/3]

void BView::DragMessage ( BMessage message,
BBitmap image,
BPoint  offset,
BHandler replyTo = NULL 
)

Initiates a drag-and-drop session of an image.

Warning
This method only works if the BView objects are attached to a window.
Parameters
messageContains data to be dragged and dropped on the destination view. The caller retains responsibility for this object.
imageBitmap image dragged by the user. The memory used by the bitmap is freed automatically when the message is dropped.
offsetThe offset to the hotspot within the image in the bitmap's coordinate system.
replyToThe 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.
Since
BeOS R3

◆ DragMessage() [3/3]

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.

Warning
This method only works if the BView objects are attached to a window.
Parameters
messageContains data to be dragged and dropped on the destination view. The caller retains responsibility for this object.
imageBitmap image dragged by the user. The memory used by the bitmap is freed automatically when the message is dropped.
dragModeSets the drawing_mode used to draw the dragged image. Set to B_OP_ALPHA to drag-and-drop partially transparent images.
offsetThe offset to the hotspot within the image in the bitmap's coordinate system.
replyToThe 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.
Since
BeOS R5

◆ Draw()

void BView::Draw ( BRect  updateRect)
virtual

Draws the area of the view that intersects updateRect.

Derived classes should override this method to draw their view.

Remarks
This is an hook method called by the Interface Kit, you don't have to call it yourself. If you need to forcefully redraw the view consider calling Invalidate() instead.
Parameters
updateRectThe rectangular area to be drawn.
Since
BeOS R3

Reimplemented in BTabView, BTextView, BMenu, BMenuBar, BTextControl, BAbstractSpinner, BStringView, BColorControl, BPictureButton, BListView, BBox, BScrollBar, BDragger, BScrollView, BButton, BMenuField, BChannelControl, BRadioButton, and BCheckBox.

◆ DrawAfterChildren()

void BView::DrawAfterChildren ( BRect  updateRect)
virtual

Perform any drawing that needs to be done after child view have already been drawn.

Parameters
updateRectThe rectangular area to drawn in.
Since
BeOS R5

◆ DrawBitmap() [1/5]

void BView::DrawBitmap ( const BBitmap bitmap,
BRect  bitmapRect,
BRect  viewRect,
uint32  options 
)

brief Draws bitmap on the view within viewRect.

Parameters
bitmapThe bitmap to draw onto the view.
bitmapRectThe portion of the bitmap to draw in the bitmap's coordinate system.
viewRectThe area in the view's coordinate system to draw the bitmap in.
options??
Since
Haiku R1

◆ DrawBitmap() [2/5]

void BView::DrawBitmap ( const BBitmap bitmap,
BRect  bitmapRect,
BRect  viewRect 
)

Draws bitmap on the view within viewRect.

Parameters
bitmapThe bitmap to draw onto the view.
bitmapRectThe portion of the bitmap to draw in the bitmap's coordinate system.
viewRectThe area in the view's coordinate system to draw the bitmap in.
Since
BeOS R3

◆ DrawBitmap() [3/5]

void BView::DrawBitmap ( const BBitmap bitmap,
BRect  viewRect 
)

Draws bitmap on the view within viewRect.

Parameters
bitmapThe bitmap to draw onto the view.
viewRectThe area in the view's coordinate system to draw the bitmap in.
Since
BeOS R3

◆ DrawBitmap() [4/5]

void BView::DrawBitmap ( const BBitmap bitmap,
BPoint  where 
)

Draws bitmap on the view offset by where.

Parameters
bitmapThe bitmap to draw onto the view.
whereThe location to draw the bitmap in the view's coordinate system.
Since
BeOS R3

◆ DrawBitmap() [5/5]

void BView::DrawBitmap ( const BBitmap bitmap)

Draws bitmap on the view.

Parameters
bitmapThe bitmap to draw onto the view.
Since
BeOS R3

◆ DrawBitmapAsync() [1/5]

void BView::DrawBitmapAsync ( const BBitmap bitmap,
BRect  bitmapRect,
BRect  viewRect,
uint32  options 
)

Draws bitmap on the view within viewRect asynchronously.

Parameters
bitmapThe bitmap to draw onto the view.
bitmapRectThe portion of the bitmap to draw in the bitmap's coordinate system.
viewRectThe area in the view's coordinate system to draw the bitmap in.
options??
Since
Haiku R1

◆ DrawBitmapAsync() [2/5]

void BView::DrawBitmapAsync ( const BBitmap bitmap,
BRect  bitmapRect,
BRect  viewRect 
)

Draws bitmap on the view within viewRect asynchronously.

Parameters
bitmapThe bitmap to draw onto the view.
bitmapRectThe portion of the bitmap to draw in the bitmap's coordinate system.
viewRectThe area in the view's coordinate system to draw the bitmap in.
Since
BeOS R3

◆ DrawBitmapAsync() [3/5]

void BView::DrawBitmapAsync ( const BBitmap bitmap,
BRect  viewRect 
)

Draws bitmap on the view within viewRect asynchronously.

Parameters
bitmapThe bitmap to draw onto the view.
viewRectThe area in the view's coordinate system to draw the bitmap in.
Since
BeOS R3

◆ DrawBitmapAsync() [4/5]

void BView::DrawBitmapAsync ( const BBitmap bitmap,
BPoint  where 
)

Draws bitmap on the view offset by where asynchronously.

Parameters
bitmapThe bitmap to draw onto the view.
whereThe location to draw the bitmap in the view's coordinate system.
Since
BeOS R3

◆ DrawBitmapAsync() [5/5]

void BView::DrawBitmapAsync ( const BBitmap bitmap)

Draws bitmap on the view asynchronously.

Parameters
bitmapThe bitmap to draw onto the view.
Since
BeOS R3

◆ DrawChar() [1/2]

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.

Parameters
cThe character to draw.
Since
BeOS R3

◆ DrawChar() [2/2]

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.

Parameters
cThe character to draw.
locationThe location in the view to draw the character.
Since
BeOS R3

◆ DrawingMode()

drawing_mode BView::DrawingMode ( ) const

Return the current drawing_mode.

Returns
The current drawing_mode.
Since
BeOS R3

◆ DrawPicture() [1/3]

void BView::DrawPicture ( const BPicture picture)

Draws the picture at the view's current pen position.

Parameters
pictureThe BPicture object to draw.
Since
BeOS R3

◆ DrawPicture() [2/3]

void BView::DrawPicture ( const BPicture picture,
BPoint  where 
)

Draws the picture at the location in the view specified by where.

Parameters
pictureThe BPicture object to draw.
whereThe point on the view to draw picture.
Since
BeOS R3

◆ DrawPicture() [3/3]

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.

Parameters
filenameThe filename of the file containing the picture to draw.
whereThe point on the view to draw the picture.
offsetThe number of bytes to offset in the file to find the picture.
Since
BeOS R4

◆ DrawPictureAsync() [1/3]

void BView::DrawPictureAsync ( const BPicture picture)

Draws the picture at the view's current pen position.

Parameters
pictureThe BPicture object to draw.
Since
BeOS R5

◆ DrawPictureAsync() [2/3]

void BView::DrawPictureAsync ( const BPicture picture,
BPoint  where 
)

Draws the picture at the location in the view specified by where.

Parameters
pictureThe BPicture object to draw.
whereThe point on the view to draw picture.
Since
BeOS R5

◆ DrawPictureAsync() [3/3]

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.

Parameters
filenameThe filename of the file containing the picture to draw.
whereThe point on the view to draw the picture.
offsetThe number of bytes to offset in the file to find the picture.
Since
BeOS R5

◆ DrawString() [1/6]

void BView::DrawString ( const char *  string,
escapement_delta delta = NULL 
)

Draw string onto the view at the current pen position.

Parameters
stringThe string to draw.
deltaAdds additional width to each character according to the following fields:
  • nonspace(float) The amount of width to add to characters with visible glyphs.
  • space(float) The amount of width to add to characters with escapements but don't have visible glyphs.
Since
BeOS R3

◆ DrawString() [2/6]

void BView::DrawString ( const char *  string,
BPoint  location,
escapement_delta delta = NULL 
)

Draw string onto the view at the specified location in the view.

Parameters
stringThe string to draw.
locationThe location in the view to draw the string.
deltaAdds additional width to each character according to the following fields:
  • nonspace(float) The amount of width to add to characters with visible glyphs.
  • space(float) The amount of width to add to characters with escapements but don't have visible glyphs.
Since
BeOS R3

◆ DrawString() [3/6]

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.

Parameters
stringThe string to draw.
lengthThe maximum number of characters in string to draw.
deltaAdds additional width to each character according to the following fields:
  • nonspace(float) The amount of width to add to characters with visible glyphs.
  • space(float) The amount of width to add to characters with escapements but don't have visible glyphs.
Since
BeOS R3

◆ DrawString() [4/6]

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.

Parameters
stringThe string to draw.
lengthThe maximum number of characters in string to draw.
locationThe location in the view to draw the string.
deltaAdds additional width to each character according to the following fields:
  • nonspace(float) The amount of width to add to characters with visible glyphs.
  • space(float) The amount of width to add to characters with escapements but don't have visible glyphs.
Since
BeOS R3

◆ DrawString() [5/6]

void BView::DrawString ( const char *  string,
const BPoint locations,
int32  locationCount 
)

Draw string locationCount times at the specified locations.

Parameters
stringThe string to draw.
locationsA pointer to an array of BPoint objects to draw the string.
locationCountThe number of elements in locations.
Since
Haiku R1

◆ DrawString() [6/6]

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.

Parameters
stringThe string to draw.
lengthThe maximum number of characters in string to draw.
locationsA pointer to an array of BPoint objects to draw the string.
locationCountThe number of elements in locations.
Since
Haiku R1

◆ EnableLayoutInvalidation()

void BView::EnableLayoutInvalidation ( )

Enable layout invalidation.

Remarks
This is only meaningful if the view is part of a BLayout.
Since
Haiku R1

◆ EndLineArray()

void BView::EndLineArray ( )

End the line array drawing the lines.

Since
BeOS R3

◆ EndPicture()

BPicture * BView::EndPicture ( )

Ends the drawing instruction recording session and returns the BPicture object passed to BeginPicture() or AppendToPicture().

Returns
The BPicture object passed to BeginPicture() or AppendToPicture().
Since
BeOS R3

◆ EndRectTracking()

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.

Since
BeOS R3

◆ EventMask()

uint32 BView::EventMask ( )

Returns the current event mask.

Returns
The current event mask as a uint32.
See also
SetEventMask()
Since
BeOS R5

◆ FillArc() [1/4]

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.

Parameters
centerThe center point.
xRadiusThe horizontal radius.
yRadiusThe vertical radius.
startAngleThe angle to begin drawing at.
arcAngleThe number of degrees of the arc to draw.
patternOne of the following:
  • B_SOLID_HIGH
  • B_SOLID_LOW
  • B_MIXED_COLORS
Since
BeOS R3

◆ FillArc() [2/4]

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.

Parameters
rectThe area within which to inscribe the shape.
startAngleThe angle to begin drawing at.
arcAngleThe number of degrees of the arc to draw.
patternOne of the following:
  • B_SOLID_HIGH
  • B_SOLID_LOW
  • B_MIXED_COLORS
Since
BeOS R3

◆ FillArc() [3/4]

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.

Parameters
centerThe center point.
xRadiusThe horizontal radius.
yRadiusThe vertical radius.
startAngleThe angle to begin drawing at.
arcAngleThe number of degrees of the arc to draw.
gradientThe gradient pattern to fill the arc with.
Since
Haiku R1

◆ FillArc() [4/4]

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.

Parameters
rectThe area within which to inscribe the shape.
startAngleThe angle to begin drawing at.
arcAngleThe number of degrees of the arc to draw.
gradientThe gradient pattern to fill the arc with.
Since
Haiku R1

◆ FillBezier() [1/2]

void BView::FillBezier ( BPoint controlPoints,
::pattern  pattern = B_SOLID_HIGH 
)

Fill a bezier curve.

Parameters
controlPointsThe list of points that form the bezier curve.
patternOne of the following:
  • B_SOLID_HIGH
  • B_SOLID_LOW
  • B_MIXED_COLORS
Since
BeOS R3

◆ FillBezier() [2/2]

void BView::FillBezier ( BPoint controlPoints,
const BGradient &  gradient 
)

Fill a bezier curve.

Parameters
controlPointsThe list of points that form the bezier curve.
gradientThe gradient pattern to fill the bezier curve with.
Since
Haiku R1

◆ FillEllipse() [1/4]

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.

Parameters
centerThe center point.
xRadiusThe horizontal radius.
yRadiusThe vertical radius.
patternOne of the following:
  • B_SOLID_HIGH
  • B_SOLID_LOW
  • B_MIXED_COLORS
Since
BeOS R3

◆ FillEllipse() [2/4]

void BView::FillEllipse ( BRect  rect,
::pattern  pattern = B_SOLID_HIGH 
)

Fill an ellipse inscribed within rect.

Parameters
rectThe area within which to inscribe the shape.
patternOne of the following:
  • B_SOLID_HIGH
  • B_SOLID_LOW
  • B_MIXED_COLORS
Since
BeOS R3

◆ FillEllipse() [3/4]

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.

Parameters
centerThe center point.
xRadiusThe horizontal radius.
yRadiusThe vertical radius.
gradientThe gradient pattern to fill the ellipse with.
Since
Haiku R1

◆ FillEllipse() [4/4]

void BView::FillEllipse ( BRect  rect,
const BGradient &  gradient 
)

Fill an ellipse with the specified gradient pattern inscribed within rect.

Parameters
rectThe area within which to inscribe the shape.
gradientThe gradient pattern to fill the ellipse with.
Since
Haiku R1

◆ FillPolygon() [1/6]

void BView::FillPolygon ( const BPolygon polygon,
::pattern  pattern = B_SOLID_HIGH 
)

Fill a polygon shape.

Parameters
polygonThe polygon shape to fill.
patternOne of the following:
  • B_SOLID_HIGH
  • B_SOLID_LOW
  • B_MIXED_COLORS
Since
BeOS R3

◆ FillPolygon() [2/6]

void BView::FillPolygon ( const BPoint pointArray,
int32  numPoints,
::pattern  pattern = B_SOLID_HIGH 
)

Fill a polygon shape made up of points specified by pointArray.

Parameters
pointArrayAn array of points that specify the vertices of the polygon.
numPointsThe number of points in pointArray.
patternOne of the following:
  • B_SOLID_HIGH
  • B_SOLID_LOW
  • B_MIXED_COLORS
Since
BeOS R3

◆ FillPolygon() [3/6]

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.

Parameters
pointArrayAn array of points that specify the vertices of the polygon.
numPointsThe number of points in pointArray.
boundsThe smallest rectangle that encloses the points in pointArray.
patternOne of the following:
  • B_SOLID_HIGH
  • B_SOLID_LOW
  • B_MIXED_COLORS
Since
BeOS R3

◆ FillPolygon() [4/6]

void BView::FillPolygon ( const BPolygon polygon,
const BGradient &  gradient 
)

Fill a polygon shape with the specified gradient pattern.

Parameters
polygonThe polygon shape to fill.
gradientThe gradient pattern to fill the polygon with.
Since
Haiku R1

◆ FillPolygon() [5/6]

void BView::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.

Parameters
pointArrayAn array of points that specify the vertices of the polygon.
numPointsThe number of points in pointArray.
gradientThe gradient pattern to fill the polygon with.
Since
Haiku R1

◆ FillPolygon() [6/6]

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.

Parameters
pointArrayAn array of points that specify the vertices of the polygon.
numPointsThe number of points in pointArray.
boundsThe smallest rectangle that encloses the points in pointArray.
gradientThe gradient pattern to fill the polygon with.
Since
Haiku R1

◆ FillRect() [1/2]

void BView::FillRect ( BRect  rect,
::pattern  pattern = B_SOLID_HIGH 
)

Fill the rectangle specified by rect.

Parameters
rectThe rectangular area to fill.
patternOne of the following:
  • B_SOLID_HIGH
  • B_SOLID_LOW
  • B_MIXED_COLORS
Since
BeOS R3

◆ FillRect() [2/2]

void BView::FillRect ( BRect  rect,
const BGradient &  gradient 
)

Fill the rectangle specified by rect with the specified gradient pattern.

Parameters
rectThe rectangular area to fill.
gradientThe gradient pattern to fill the rectangle with.
Since
Haiku R1

◆ FillRegion() [1/2]

void BView::FillRegion ( BRegion region,
::pattern  pattern = B_SOLID_HIGH 
)

Fill region.

Parameters
regionThe region to fill.
patternOne of the following:
  • B_SOLID_HIGH
  • B_SOLID_LOW
  • B_MIXED_COLORS
Since
BeOS R3

◆ FillRegion() [2/2]

void BView::FillRegion ( BRegion region,
const BGradient &  gradient 
)

Fill region with the specified gradient pattern.

Parameters
regionThe region to fill.
gradientThe gradient pattern to fill the region with.
Since
Haiku R1

◆ FillRoundRect() [1/2]

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.

Parameters
rectThe rectangular area to fill the round rect within.
xRadiusThe horizontal radius.
yRadiusThe vertical radius.
patternOne of the following:
  • B_SOLID_HIGH
  • B_SOLID_LOW
  • B_MIXED_COLORS
Since
BeOS R3

◆ FillRoundRect() [2/2]

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.

Parameters
rectThe rectangular area to fill the round rect within.
xRadiusThe horizontal radius.
yRadiusThe vertical radius.
gradientThe gradient pattern to fill the round rect with.
Since
Haiku R1

◆ FillShape() [1/2]

void BView::FillShape ( BShape shape,
::pattern  pattern = B_SOLID_HIGH 
)

Fill shape.

Parameters
shapeThe shape to fill.
patternOne of the following:
  • B_SOLID_HIGH
  • B_SOLID_LOW
  • B_MIXED_COLORS
Since
BeOS R5

◆ FillShape() [2/2]

void BView::FillShape ( BShape shape,
const BGradient &  gradient 
)

Fill shape with the specified gradient pattern.

Parameters
shapeThe shape to fill.
gradientThe gradient pattern to fill the shape with.
Since
Haiku R1

◆ FillTriangle() [1/4]

void BView::FillTriangle ( BPoint  point1,
BPoint  point2,
BPoint  point3,
::pattern  pattern = B_SOLID_HIGH 
)

Fill the triangle specified by points point1, point2, and point3.

Parameters
point1The first point of the triangle.
point2The second point of the triangle.
point3The third point of the triangle.
patternOne of the following:
  • B_SOLID_HIGH
  • B_SOLID_LOW
  • B_MIXED_COLORS
Since
BeOS R3

◆ FillTriangle() [2/4]

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.

Parameters
point1The first point of the triangle.
point2The second point of the triangle.
point3The third point of the triangle.
boundsThe rectangular area that encloses the triangle.
patternOne of the following:
  • B_SOLID_HIGH
  • B_SOLID_LOW
  • B_MIXED_COLORS
Since
BeOS R3

◆ FillTriangle() [3/4]

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.

Parameters
point1The first point of the triangle.
point2The second point of the triangle.
point3The third point of the triangle.
gradientThe gradient pattern to fill the triangle with.
Since
Haiku R1

◆ FillTriangle() [4/4]

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.

Parameters
point1The first point of the triangle.
point2The second point of the triangle.
point3The third point of the triangle.
boundsThe rectangular area that encloses the triangle.
gradientThe gradient pattern to fill the triangle with.
Since
Haiku R1

◆ FindView()

BView * BView::FindView ( const char *  name) const

Returns the view in the view hierarchy with the specified name.

Returns
The view in the view hierarchy with the specified name or NULL if not found.
Since
BeOS R3

◆ Flags()

uint32 BView::Flags ( ) const

Return the view flags set in the constructor or by SetFlags().

Returns
The view flags as a uint32 mask.
See also
SetFlags()
Since
BeOS R3

◆ Flush()

void BView::Flush ( ) const

Flushes the attached window's connection to App Server.

Note
If the view isn't attached to a window, Flush() does nothing.
Since
BeOS R3

◆ ForceFontAliasing()

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.

Parameters
enableIf true turn off anti-aliasing, if false turn on anti-aliasing.
Since
BeOS R5

◆ Frame()

BRect BView::Frame ( ) const

Returns the view's frame rectangle in the parent's coordinate system.

Returns
The view's frame rectangle in the parent's coordinate system.
Since
BeOS R3

◆ FrameMoved()

void BView::FrameMoved ( BPoint  newPosition)
virtual

Hook method called when the view is moved.

Parameters
newPositionThe point of the top left corner of the frame that the view has been moved to.
Since
BeOS R3

Reimplemented in BTabView, BMenu, BButton, BColorControl, BTextControl, BMenuBar, BBox, BListView, BMenuField, BStringView, BDragger, BRadioButton, BPictureButton, BScrollBar, BScrollView, BPopUpMenu, BCheckBox, and BOutlineListView.

◆ FrameResized()

void BView::FrameResized ( float  newWidth,
float  newHeight 
)
virtual

Hook method called when the view is resized.

Parameters
newWidthThe new width of the view.
newHeightThe new height of the view.
Since
BeOS R3

Reimplemented in BTabView, BTextView, BMenu, BButton, BColorControl, BTextControl, BAbstractSpinner, BMenuBar, BListView, BMenuField, BBox, BStringView, BDragger, BRadioButton, BPictureButton, BScrollBar, BScrollView, BPopUpMenu, BCheckBox, BChannelControl, and BOutlineListView.

◆ GetBlendingMode()

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.

Parameters
[out]srcAlphaThe alpha mode to fill out.
[out]alphaFuncThe alpha function to fill out.
Since
BeOS R5

◆ GetClippingRegion()

void BView::GetClippingRegion ( BRegion region) const

Fill out region with the view's clipping region.

Parameters
[out]regionThe 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.

Since
BeOS R3

◆ GetFont()

void BView::GetFont ( BFont font) const

Fill out font with the font set to the view.

Parameters
[out]fontThe BFont object to fill out.
Since
BeOS R3

◆ GetFontHeight()

void BView::GetFontHeight ( font_height height) const

Fill out the font_height struct with the view font.

Parameters
[out]heightThe font_height struct to fill out.
Since
BeOS R3

◆ GetLayout()

BLayout * BView::GetLayout ( ) const

Get the layout of the view.

Remarks
This is only meaningful if the view is part of a BLayout.
Returns
The layout of the view.
Since
Haiku R1

◆ GetMouse()

void BView::GetMouse ( BPoint _location,
uint32 *  _buttons,
bool  checkMessageQueue = true 
)

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.

Parameters
[out]_locationFilled out with the cursor location in the view's coordinate system.
[out]_buttonsFilled out with a mask of the following values:
  • B_PRIMARY_MOUSE_BUTTON
  • B_SECONDARY_MOUSE_BUTTON
  • B_TERTIARY_MOUSE_BUTTON
checkMessageQueueIf true pull from any pending MouseMoved() or MouseUp() events in the message queue top down before filling out the current mouse cursor state.
Since
BeOS R3

◆ GetPreferredSize()

void BView::GetPreferredSize ( float *  _width,
float *  _height 
)
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.

Remarks
Either the _width or _height parameter may be set to NULL if you only want to get the other one.
Parameters
[out]_widthPointer to a float to store the width of the view.
[out]_heightPointer to a float to store the height of the view.
Since
BeOS R3

Reimplemented in BTextView, BTabView, BScrollBar, BMenuField, BOutlineListView, BMenu, BTextControl, BListView, BControl, BBox, BButton, BColorControl, BDragger, BScrollView, BMenuBar, BCheckBox, BPopUpMenu, BOptionPopUp, BChannelControl, BPictureButton, BStringView, and BRadioButton.

◆ GetStringWidths()

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.

Parameters
stringArrayThe array of strings to get the lengths of.
lengthArrayThe number of characters of the strings in stringArray to consider.
numStringsThe number of strings in stringArray.
widthArrayThe array to store the widths of the strings in stringArray.
Since
BeOS R3

◆ GetSupportedSuites()

status_t BView::GetSupportedSuites ( BMessage data)
virtual

Reports the suites of messages and specifiers that derived classes understand.

Since
BeOS R3

Reimplemented from BHandler.

Reimplemented in BTabView, BListView, BMenu, BScrollBar, BTextView, BTextControl, BScrollView, BButton, BPictureButton, BMenuField, BOutlineListView, BColorControl, BControl, BMenuBar, BCheckBox, BBox, BStringView, BDragger, BRadioButton, BAbstractSpinner, BChannelControl, and BPopUpMenu.

◆ GetToolTipAt()

bool BView::GetToolTipAt ( BPoint  point,
BToolTip **  _tip 
)
protectedvirtual

Point _tip with the view's tool tip.

Parameters
pointCurrently unused.
_tipA pointer to a pointer to a BToolTip object to set.
Since
Haiku R1

◆ HasDefaultColors()

bool BView::HasDefaultColors ( ) const

Tests if the view has any colors set.

Returns
Boolean value, true if colors are not set.
Since
Haiku R1

Referenced by BLayoutBuilder::Grid< ParentBuilder >::Grid(), and BLayoutBuilder::Group< ParentBuilder >::Group().

◆ HasSystemColors()

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()

Returns
Boolean value, true if colors are as described.
Since
Haiku R1

◆ Hide()

void BView::Hide ( )
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.

See also
Show()
BWindow::Hide()
IsHidden()
Since
BeOS R3

Reimplemented in BMenu, and BMenuBar.

◆ HideToolTip()

void BView::HideToolTip ( )

Hide the view's tool tip.

Since
Haiku R1

◆ HighColor()

rgb_color BView::HighColor ( ) const

Return the current high color.

Returns
The current high color as an rgb_color struct.
See also
SetHighColor(rgb_color)
SetHighColor(uchar, uchar, uchar, uchar)
Since
BeOS R3

◆ HighUIColor()

color_which BView::HighUIColor ( float *  tint = NULL) const

Return the current high color constant being used.

Parameters
tintOptional float pointer in which to store the tint value used to modify the system color constant.
Returns
The current high color constant.
See also
SetHighUIColor(color_which, float)
Since
Haiku R1

◆ Instantiate()

BArchivable * BView::Instantiate ( BMessage data)
static

Creates a new BView object from the data message.

Returns
A newly created BView object or NULL if the message doesn't contain an archived BView.
Since
BeOS R3

◆ Invalidate() [1/3]

void BView::Invalidate ( BRect  invalRect)

Sends a message to App Server to redraw the portion of the view specified by invalRect.

Parameters
invalRectThe rectangular area of the view to redraw.
Since
BeOS R3

◆ Invalidate() [2/3]

void BView::Invalidate ( const BRegion region)

Sends a message to App Server to redraw the portion of the view specified by region.

Parameters
regionThe region of the view to redraw.
Since
Haiku R1

◆ Invalidate() [3/3]

void BView::Invalidate ( )

Sends a message to App Server to redraw the view.

Since
BeOS R3

◆ InvalidateLayout()

void BView::InvalidateLayout ( bool  descendants = false)

Invalidate layout.

Remarks
This is only meaningful if the view is part of a BLayout.
Parameters
descendantsAlso invalidate its children views.
Since
Haiku R1

◆ InvertRect()

void BView::InvertRect ( BRect  rect)

Inverts the colors within rect.

This method is often used to draw a highlighted selection in a view.

Parameters
rectThe rectangular area in the view to invert the colors of.
Since
BeOS R3

◆ IsFocus()

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.

Returns
true if the view is the current focus view, false otherwise.
See also
MakeFocus()
BWindow::CurrentFocus()
Since
BeOS R3

◆ IsHidden() [1/2]

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.

Returns
true if the view was hidden via the Hide() method, false otherwise.
Since
BeOS R3

◆ IsHidden() [2/2]

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.

Parameters
lookingFromThe view used as a base when determining the hidden status of the BView object.
Returns
true if the view was hidden via the Hide() method, false otherwise.
Since
Haiku R1

◆ IsLayoutInvalidationDisabled()

bool BView::IsLayoutInvalidationDisabled ( )

Returns whether or not layout invalidation is disabled.

Remarks
This is only meaningful if the view is part of a BLayout.
Returns
true of layout invalidation is disabled, false otherwise.
Since
Haiku R1

◆ IsLayoutValid()

bool BView::IsLayoutValid ( ) const

Returns whether or not the layout is valid.

Remarks
This is only meaningful if the view is part of a BLayout.

Returns true if the layout is valid, false otherwise.

Since
Haiku R1

◆ IsPrinting()

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.

Returns
Returns true if drawing to a printer, false otherwise.
Since
BeOS R3

◆ KeyDown()

void BView::KeyDown ( const char *  bytes,
int32  numBytes 
)
virtual

Hook method called when a keyboard key is pressed.

Parameters
bytesThe bytes of the key combination pressed.
numBytesThe number of bytes in bytes.
Since
BeOS R3

Reimplemented in BTabView, BTextView, BMenu, BListView, BPictureButton, BColorControl, BControl, BCheckBox, BMenuField, BButton, BChannelControl, BRadioButton, and BOutlineListView.

◆ KeyUp()

void BView::KeyUp ( const char *  bytes,
int32  numBytes 
)
virtual

Hook method called when a keyboard key is released.

Parameters
bytesThe bytes of the key combination pressed.
numBytesThe number of bytes in bytes.
Since
BeOS R3

◆ Layout()

void BView::Layout ( bool  force)

Layout the view.

Remarks
This is only meaningful if the view is part of a BLayout.
Parameters
forceIf true layout even if valid.
Since
Haiku R1

◆ LayoutInvalidated()

void BView::LayoutInvalidated ( bool  descendants = false)
protectedvirtual

Hook method called when the layout is invalidated.

Parameters
descendantsWhether or not child views have also been invalidated.
Since
Haiku R1

Reimplemented in BTextView, BMenu, BAbstractSpinner, BTextControl, BMenuField, BButton, BScrollView, BCheckBox, BBox, and BStringView.

◆ LeftTop()

BPoint BView::LeftTop ( ) const

Returns the left top corner point.

Returns
The left top corner of the view as a BPoint object.
Since
BeOS R3

◆ LineCapMode()

cap_mode BView::LineCapMode ( ) const

Returns the current line cap mode.

Returns
The current line cap mode set to the view.
Since
BeOS R3

◆ LineJoinMode()

join_mode BView::LineJoinMode ( ) const

Returns the current line join mode.

Returns
The current line join mode set to the view.
Since
BeOS R3

◆ LineMiterLimit()

float BView::LineMiterLimit ( ) const

Returns the miter limit used for B_MITER_JOIN join mode.

Returns
The current miter limit set to the view.
Since
BeOS R3

◆ LowColor()

rgb_color BView::LowColor ( ) const

Return the current low color.

Returns
The current low color as an rgb_color struct.
See also
SetLowColor(rgb_color)
SetLowColor(uchar, uchar, uchar, uchar)
Since
BeOS R3

◆ LowUIColor()

color_which BView::LowUIColor ( float *  tint = NULL) const

Return the current low color constant being used.

Parameters
tintOptional float pointer in which to store the tint value used to modify the system color constant.
Returns
The current low color constant.
See also
SetLowUIColor(color_which, float)
Since
Haiku R1

◆ MakeFocus()

void BView::MakeFocus ( bool  focus = true)
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.

Parameters
focustrue to set focus, false to remove it.
Since
BeOS R3

Reimplemented in BTabView, BScrollBar, BMenu, BTextView, BOutlineListView, BColorControl, BListView, BButton, BAbstractSpinner, BBox, BDragger, BTextControl, BCheckBox, BScrollView, BRadioButton, BPopUpMenu, BMenuBar, BControl, BPictureButton, BMenuField, and BStringView.

◆ MaxSize()

BSize BView::MaxSize ( )
virtual

Return the maximum size of the view.

Remarks
This is only meaningful if the view is part of a BLayout.
Returns
The maximum size of the view as a BSize.
See also
BAbstractLayout::MaxSize()
Since
Haiku R1

Reimplemented in BTextView, BTabView, BAbstractSpinner, BScrollBar, BTextControl, BMenuField, BButton, BMenu, BBox, BListView, BRadioButton, BScrollView, BMenuBar, BCheckBox, and BStringView.

◆ MessageReceived()

void BView::MessageReceived ( BMessage message)
virtual

Handle message received by the associated looper.

Parameters
messageThe message received by the associated looper.
See also
BHandler::MessageReceived()
Since
BeOS R3

Reimplemented from BHandler.

Reimplemented in BTabView, BOutlineListView, BTextView, BTextControl, BMenu, BMenuBar, BAbstractSpinner, BListView, BButton, BStringView, BPictureButton, BBox, BColorControl, BControl, BChannelControl, BDragger, BScrollBar, BMenuField, BScrollView, BOptionPopUp, BCheckBox, BRadioButton, and BPopUpMenu.

◆ MinSize()

BSize BView::MinSize ( )
virtual

Return the minimum size of the view.

Remarks
This is only meaningful if the view is part of a BLayout.
Returns
The minimum size of the view as a BSize.
See also
BAbstractLayout::MinSize()
Since
Haiku R1

Reimplemented in BTextView, BTabView, BAbstractSpinner, BScrollBar, BTextControl, BMenuField, BButton, BMenu, BBox, BListView, BScrollView, BMenuBar, BCheckBox, and BStringView.

◆ MouseDown()

void BView::MouseDown ( BPoint  where)
virtual

Hook method called when a mouse button is pressed.

Parameters
whereThe point on the screen where to mouse pointer is when the mouse button is pressed.
Since
BeOS R3

Reimplemented in BTabView, BTextView, BMenuBar, BListView, BTextControl, BStringView, BPictureButton, BBox, BControl, BColorControl, BScrollBar, BScrollView, BCheckBox, BDragger, BMenuField, BButton, BChannelControl, BOutlineListView, BPopUpMenu, and BRadioButton.

◆ MouseMoved()

void BView::MouseMoved ( BPoint  where,
uint32  code,
const BMessage dragMessage 
)
virtual

Hook method called when the mouse is moved.

Parameters
whereThe new location of the mouse in the view's coordinate system.
codeOne of the following:
  • B_ENTERED_VIEW The cursor has just entered the view.
  • B_INSIDE_VIEW The cursor is inside the view.
  • B_EXITED_VIEW The cursor has left the view's bounds. This only gets sent if the scope of the mouse events that the view can receive has been expanded by SetEventMask() or SetMouseEventMask().
  • B_OUTSIDE_VIEW The cursor is outside the view. This only gets sent if the scope of the mouse events that the view can receive has been expanded by SetEventMask() or SetMouseEventMask().
dragMessageIf 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.
See also
SetEventMask(), SetMouseEventMask()
DragMessage()
Since
BeOS R3

Reimplemented in BTabView, BTextControl, BTextView, BListView, BColorControl, BButton, BStringView, BPictureButton, BBox, BControl, BScrollBar, BMenuField, BCheckBox, BScrollView, BDragger, BRadioButton, and BPopUpMenu.

◆ MouseUp()

void BView::MouseUp ( BPoint  where)
virtual

Hook method called when a mouse button is released.

Parameters
whereThe point on the screen where to mouse pointer is when the mouse button is released.
Since
BeOS R3

Reimplemented in BTabView, BTextControl, BTextView, BMenuBar, BListView, BButton, BColorControl, BStringView, BPictureButton, BBox, BControl, BScrollBar, BScrollView, BMenuField, BCheckBox, BDragger, BRadioButton, BOutlineListView, and BPopUpMenu.

◆ MoveBy()

void BView::MoveBy ( float  deltaX,
float  deltaY 
)

Moves the view deltaX pixels horizontally and deltaY pixels vertically in the parent view's coordinate system.

Parameters
deltaXThe number of pixels to move the view horizontally.
deltaYThe number of pixels to move the view vertically.
Since
BeOS R3

◆ MovePenBy()

void BView::MovePenBy ( float  x,
float  y 
)

Move the pen by x pixels horizontally and y pixels vertically.

Parameters
xThe number of pixels to move the pen horizontally.
yThe number of pixels to move the pen vertically.
Since
BeOS R3

◆ MovePenTo() [1/2]

void BView::MovePenTo ( BPoint  point)

Move the pen to point in the view's coordinate system.

Parameters
pointthe location to move the pen to.
Since
BeOS R3

◆ MovePenTo() [2/2]

void BView::MovePenTo ( float  x,
float  y 
)

Move the pen to the point specified by x and y in the view's coordinate system.

Parameters
xThe horizontal coordinate to move the pen to.
yThe vertical coordinate to move the pen to.
Since
BeOS R3

◆ MoveTo() [1/2]

void BView::MoveTo ( BPoint  where)

Move the view to the location specified by where in the parent view's coordinate system.

Parameters
whereThe location to move the view to.
Since
BeOS R3

◆ MoveTo() [2/2]

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.

Parameters
xThe horizontal coordinate to move the view to.
yThe vertical coordinate to move the view to.
Since
BeOS R3

◆ NextSibling()

BView * BView::NextSibling ( ) const

Returns a pointer to the next sibling view.

Returns
A pointer to the next sibling view or NULL if not found.
Since
BeOS R3

◆ Origin()

BPoint BView::Origin ( ) const

Returns the origin point in the view's coordinate system.

Returns
The local origin point in the view's coordinate system.
See also
SetOrigin()
Since
BeOS R3

◆ Parent()

BView * BView::Parent ( ) const

Returns a pointer to the view's parent.

Returns
A pointer to the parent view or NULL if not attached.
Since
BeOS R3

◆ PenLocation()

BPoint BView::PenLocation ( ) const

Return the current pen location as a BPoint object.

Returns
The current pen location in the view's coordinate system.
See also
MovePenTo(BPoint)
MovePenTo(float, float)
MovePenBy(float, float)
Since
BeOS R3

◆ PenSize()

float BView::PenSize ( ) const

Return the current pen size.

Returns
The current pen size as a float.
See also
SetPenSize()
Since
BeOS R3

◆ Perform()

status_t BView::Perform ( perform_code  code,
void *  _data 
)
virtual

Perform some action. (Internal Method)

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:
Parameters
codeThe perform code.
_dataA pointer to store some data.
Returns
A status code.
Since
Haiku R1

Reimplemented from BHandler.

Reimplemented in BListView, BMenu, BTabView, BScrollBar, BTextView, BMenuField, BScrollView, BMenuBar, BPictureButton, BButton, BOutlineListView, BControl, BCheckBox, BBox, BRadioButton, BDragger, and BPopUpMenu.

◆ PopState()

void BView::PopState ( )

Restores the drawing state from the stack.

Since
BeOS R3

◆ PreferredSize()

BSize BView::PreferredSize ( )
virtual

Return the preferred size of the view.

Remarks
This is only meaningful if the view is part of a BLayout.
Returns
The preferred size of the view as a BSize.
See also
BAbstractLayout::PreferredSize()
Since
Haiku R1

Reimplemented in BTextView, BTabView, BAbstractSpinner, BScrollBar, BTextControl, BMenuField, BButton, BMenu, BBox, BListView, BScrollView, BMenuBar, BCheckBox, and BStringView.

◆ PreviousSibling()

BView * BView::PreviousSibling ( ) const

Returns a pointer to the previous sibling view.

Returns
A pointer to the previous sibling view or NULL if not found.
Since
BeOS R3

◆ Pulse()

void BView::Pulse ( )
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.

See also
SetPulseRate()
Since
BeOS R3

Reimplemented in BTabView, and BTextView.

◆ PushState()

void BView::PushState ( )

Saves the drawing state to the stack.

The drawing state contains the following elements:

  • local and global origins
  • local and global scales
  • local and global clipping regions
  • the current drawing mode
  • pen size and location
  • the font context
  • foreground and background color
  • line cap and join modes
  • miter limit
  • stipple pattern

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.

Since
BeOS R3

◆ Relayout()

void BView::Relayout ( )

Relayout the view.

Remarks
This is only meaningful if the view is part of a BLayout.
Since
Haiku R1

◆ RemoveChild()

bool BView::RemoveChild ( BView child)

Removes child from the view hierarchy.

Parameters
childThe child view to remove.
Returns
Whether or not child was removed from the view hierarchy.
Since
BeOS R3

◆ RemoveSelf()

bool BView::RemoveSelf ( )

Removes the view and all child views from the view hierarchy.

Returns
Whether or not the view was removed from the view hierarchy.
Since
BeOS R3

◆ ResetLayoutInvalidation()

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.

Since
Haiku R1

◆ ResizeBy()

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.

Parameters
deltaWidthThe number of pixels to resize the view by horizontally.
deltaHeightThe number of pixels to resize the view by vertically.
Since
BeOS R3

◆ ResizeTo() [1/2]

void BView::ResizeTo ( float  width,
float  height 
)

Resize the view to the specified width and height.

Parameters
widthThe width to resize the view to.
heightThe height to resize the view to.
Since
BeOS R3

◆ ResizeTo() [2/2]

void BView::ResizeTo ( BSize  size)

Resize the view to the dimension specified by size.

Parameters
sizeThe size to resize the view to.
Since
Haiku R1

◆ ResizeToPreferred()

void BView::ResizeToPreferred ( )
virtual

Resizes the view to its preferred size keeping the position of the left top corner constant.

Warning
It is not recommended to use this method for views that are part of a BLayout.
Since
BeOS R3

Reimplemented in BTextView, BTabView, BScrollBar, BMenuField, BOutlineListView, BMenu, BTextControl, BControl, BAbstractSpinner, BButton, BColorControl, BListView, BBox, BDragger, BScrollView, BCheckBox, BMenuBar, BOptionPopUp, BPopUpMenu, BStringView, BChannelControl, BPictureButton, and BRadioButton.

◆ ResizingMode()

uint32 BView::ResizingMode ( ) const

Returns the resizing mode flags mask set in the constructor or by SetResizingMode().

Returns
the current resizing mode flags as a uint32 mask.
See also
SetResizingMode()
Since
BeOS R3

◆ ResolveSpecifier()

BHandler * BView::ResolveSpecifier ( BMessage message,
int32  index,
BMessage specifier,
int32  what,
const char *  property 
)
virtual

Determine the proper handler for a scripting message.

Parameters
messageThe scripting message to determine the handler.
indexThe index of the specifier.
specifierThe message which contains the specifier.
whatThe 'what' field of the specifier message.
propertyThe name of the target property.
Returns
A pointer to the proper BHandler for the given scripting message.
Since
BeOS R3

Reimplemented from BHandler.

Reimplemented in BTabView, BListView, BMenu, BScrollBar, BTextView, BScrollView, BButton, BPictureButton, BMenuField, BTextControl, BOutlineListView, BColorControl, BControl, BMenuBar, BCheckBox, BStringView, BBox, BDragger, BAbstractSpinner, BRadioButton, BChannelControl, and BPopUpMenu.

◆ Scale()

float BView::Scale ( ) const

Return the current drawing scale.

Returns
The current drawing scale.
Since
BeOS R3

◆ ScrollBar()

BScrollBar * BView::ScrollBar ( orientation  posture) const

Returns the BScrollBar object that has the BView set as its target.

Parameters
postureEither B_VERTICAL to get the vertical scroll bar or B_HORIZONTAL to get the horizontal scroll bar.
Returns
the Scrollbar object requested or NULL if none found.
See also
BScrollBar::SetTarget()
Since
BeOS R3

◆ ScrollBy()

void BView::ScrollBy ( float  deltaX,
float  deltaY 
)

Scroll the view by deltaX horizontally and deltaY vertically.

Parameters
deltaXThe amount to scroll horizontally.
deltaYThe amount to scroll vertically.
Since
BeOS R3

◆ ScrollTo()

void BView::ScrollTo ( BPoint  where)
virtual

Scroll the view to the point specified by where.

Parameters
whereThe location to scroll the view to.
Since
BeOS R3

Reimplemented in BListView.

◆ ScrollWithMouseWheelDelta()

void BView::ScrollWithMouseWheelDelta ( BScrollBar scrollBar,
float  delta 
)
protected

Handle the scroll wheel changing over scrollbars.

  • Extract the scrollbar change based on the mouse wheel delta into a protected method of BView.
  • The method is called from the MessageReceived() method of BScrollBar.

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.

Since
Haiku R1

◆ SetBlendingMode()

void BView::SetBlendingMode ( source_alpha  srcAlpha,
alpha_function  alphaFunc 
)

Set the blending mode which controls how transparency is used.

Parameters
srcAlphaSet to one of the following:
  • B_CONSTANT_ALPHA Use the high color's alpha channel.
  • B_PIXEL_ALPHA Use the alpha value of each pixel when drawing a bitmap.
alphaFuncSet to one of the following:
  • B_ALPHA_OVERLAY Used for drawing a image with transparency over an opaque background.
  • B_ALPHA_COMPOSITE Used to composite two or more transparent images together offscreen to produce a new image drawn using B_ALPHA_OVERLAY mode.
Since
BeOS R5

◆ SetDiskMode()

void BView::SetDiskMode ( char *  filename,
long  offset 
)

Unimplemented.

Since
Haiku R1

◆ SetDrawingMode()

void BView::SetDrawingMode ( drawing_mode  mode)
virtual

Sets the drawing mode of the view.

The default drawing mode is B_OP_COPY.

Parameters
modeSet to one of the following:
  • B_OP_COPY
  • B_OP_OVER
  • B_OP_ERASE
  • B_OP_INVERT
  • B_OP_SELECT
  • B_OP_ALPHA
  • B_OP_MIN
  • B_OP_MAX
  • B_OP_ADD
  • B_OP_SUBTRACT
  • B_OP_BLEND
Since
BeOS R3

◆ SetEventMask()

status_t BView::SetEventMask ( uint32  mask,
uint32  options = 0 
)

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.
Parameters
maskThe mask of B_POINTER_EVENTS and B_KEYBOARD_EVENTS to set.
optionsSets other event-handling options.
Returns
B_OK if everything went fine or an error code, usually B_ERROR if something went wrong.
See also
EventMask()
Since
BeOS R5

◆ SetExplicitAlignment()

void BView::SetExplicitAlignment ( BAlignment  alignment)

Set this view's alignment, to be used by Alignment().

Remarks
This is only meaningful if the view is part of a BLayout.
See also
BAbstractLayout::SetExplicitAlignment()
Since
Haiku R1

◆ SetExplicitMaxSize()

void BView::SetExplicitMaxSize ( BSize  size)

Set this view's max size, to be used by MaxSize().

Remarks
This is only meaningful if the view is part of a BLayout.
See also
BAbstractLayout::SetExplicitMaxSize()
Since
Haiku R1

◆ SetExplicitMinSize()

void BView::SetExplicitMinSize ( BSize  size)

Set this view's min size, to be used by MinSize().

Remarks
This is only meaningful if the view is part of a BLayout.
See also
BAbstractLayout::SetExplicitMinSize()
Since
Haiku R1

◆ SetExplicitPreferredSize()

void BView::SetExplicitPreferredSize ( BSize  size)

Set this view's preferred size, to be used by PreferredSize().

Remarks
This is only meaningful if the view is part of a BLayout.
See also
BAbstractLayout::SetExplicitPreferredSize()
Since
Haiku R1

◆ SetFlags()

void BView::SetFlags ( uint32  flags)
virtual

Sets the view flags to the flags mask.

Parameters
flagsThe view flags to set as a uint32 mask.
See also
Flags()
Since
BeOS R3

Reimplemented in BTabView, BTextControl, and BAbstractSpinner.

◆ SetFont()

void BView::SetFont ( const BFont font,
uint32  mask = B_FONT_ALL 
)
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.

Parameters
fontA pointer to a const BFont object to set on the view.
maskA 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:
  • B_FONT_FAMILY_AND_STYLE
  • B_FONT_SPACING
  • B_FONT_SIZE
  • B_FONT_ENCODING
  • B_FONT_SHEAR
  • B_FONT_FACE
  • B_FONT_ROTATION
  • B_FONT_FLAGS
See also
BFont for more details.
Since
BeOS R3

Reimplemented in BListView, BStringView, and BChannelControl.

◆ SetFontSize()

void BView::SetFontSize ( float  size)

Set the size of the view's font to size.

Parameters
sizeThe font size to set to the view in points.
Since
BeOS R3

◆ SetHighColor() [1/2]

void BView::SetHighColor ( rgb_color  color)
virtual

Set the high color of the view.

Parameters
colorThe color to set.
Since
BeOS R3

◆ SetHighColor() [2/2]

void BView::SetHighColor ( uchar  red,
uchar  green,
uchar  blue,
uchar  alpha = 255 
)
inline

Set the high color of the view.

Parameters
redThe red component of the high color.
greenThe green component of the high color.
blueThe blue component of the high color.
alphaThe alpha component of the high color.
Since
BeOS R3

◆ SetHighUIColor()

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.

Parameters
whichThe color_which constant to set.
tintOptional tint value to use.
Since
Haiku R1

◆ SetLayout()

void BView::SetLayout ( BLayout layout)
virtual

Sets the layout of the view.

Parameters
layoutThe layout to set.
Since
Haiku R1

Reimplemented in BColorControl.

Referenced by BLayoutBuilder::Grid< ParentBuilder >::Grid(), and BLayoutBuilder::Group< ParentBuilder >::Group().

◆ SetLineMode()

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°.

Parameters
lineCapOne of the following:
  • B_ROUND_CAP A semicircle with diameter of line width is drawn at the endpoint.
  • B_BUTT_CAP A straight edge is drawn without extending beyond the endpoint.
  • B_SQUARE_CAP A straight edge is drawn extending past the endpoint by half the line width.
lineJoinOne of the following:
  • B_ROUND_JOIN Same as B_ROUND_CAP but for a join.
  • B_MITER_JOIN The lines are extended until they meet. If angle that they meet at is greater than the 2*arcsin(1/miterLimit) than a bevel join is used instead.
  • B_BEVEL_JOIN The area between the caps is filled with a triangle.
  • B_BUTT_JOIN Same as B_BUTT_CAP but for a join.
  • B_SQUARE_JOIN Same as B_SQUARE_CAP but for a join.
miterLimitSets the cut off angle before a miter join becomes a bevel join calculated by 2*arcsin(1/miterLimit).
Since
BeOS R3

◆ SetLowColor() [1/2]

void BView::SetLowColor ( rgb_color  color)
virtual

Set the low color of the view.

Parameters
colorThe color to set.
Since
BeOS R3

◆ SetLowColor() [2/2]

void BView::SetLowColor ( uchar  red,
uchar  green,
uchar  blue,
uchar  alpha = 255 
)
inline

Set the low color of the view.

Parameters
redThe red component of the low color.
greenThe green component of the low color.
blueThe blue component of the low color.
alphaThe alpha component of the low color.
Since
BeOS R3

◆ SetLowUIColor()

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.

Parameters
whichThe color_which constant to set.
tintOptional tint value to use.
Since
Haiku R1

◆ SetMouseEventMask()

status_t BView::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.

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.
Parameters
maskThe mask of B_POINTER_EVENTS and B_KEYBOARD_EVENTS to set.
optionsSets other event-handling options.
Returns
B_OK if everything went fine or an error code, usually B_ERROR if something went wrong.
Since
BeOS R5

◆ SetOrigin() [1/2]

void BView::SetOrigin ( BPoint  where)

Sets the origin in the view's coordinate system.

Parameters
whereThe point to set the origin to.
See also
Origin()
Since
BeOS R3

◆ SetOrigin() [2/2]

void BView::SetOrigin ( float  x,
float  y 
)

Sets the origin in the view's coordinate system.

Parameters
xThe x-coordinate to set the origin to.
yThe y-coordinate to set the origin to.
See also
Origin()
Since
BeOS R3

◆ SetPenSize()

void BView::SetPenSize ( float  size)
virtual

Set the pen size to size.

Parameters
sizeThe pen size to set.
Since
BeOS R3

◆ SetResizingMode()

void BView::SetResizingMode ( uint32  mode)
virtual

Sets the resizing mode of the view according to the mode mask.

The resizing mode is first set in the BView constructor.

See also
ResizingMode()
Since
BeOS R3

Reimplemented in BTabView.

◆ SetScale()

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:

view->SetScale(2);
view->SetScale(2);
// view's scale is 2
view2->SetScale(2);
view2->PushState();
view2->SetScale(2);
// view2's scale is 4
Parameters
scaleThe scale factor to set.
Since
BeOS R3

◆ SetToolTip() [1/2]

void BView::SetToolTip ( const char *  text)

Set the tool tip of the view to text.

Parameters
textThe text to set the view to or NULL or blank to unset.
Since
Haiku R1

◆ SetToolTip() [2/2]

void BView::SetToolTip ( BToolTip tip)

Set the tool tip of the view to the tip object.

Parameters
tipThe tool tip object to set the view to or NULL to unset.
Since
Haiku R1

◆ SetViewBitmap() [1/2]

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.

Parameters
bitmapThe background bitmap to set to the view.
srcRectSpecifies the area of bitmap to use.
dstRectSpecifies the area of the view to set bitmap to.
followFlagsSpecifies the as the view is resized. See the BView constructor for more details.
optionsSpecifies additional view options. The only option currently available is B_TILE_BITMAP which tiles the bitmap across the view.
Since
BeOS R4

◆ SetViewBitmap() [2/2]

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.

Parameters
bitmapThe background bitmap to set to the view.
followFlagsSpecifies the as the view is resized. See the BView constructor for more details.
optionsSpecifies additional view options. The only option currently available is B_TILE_BITMAP which tiles the bitmap across the view.
Since
BeOS R4

◆ SetViewColor() [1/2]

void BView::SetViewColor ( rgb_color  color)
virtual

Set the view color of the view.

Parameters
colorThe color to set.
Since
BeOS R3

◆ SetViewColor() [2/2]

void BView::SetViewColor ( uchar  red,
uchar  green,
uchar  blue,
uchar  alpha = 255 
)
inline

Set the view color of the view.

Parameters
redThe red component of the view color.
greenThe green component of the view color.
blueThe blue component of the view color.
alphaThe alpha component of the view color.
Since
BeOS R3

◆ SetViewCursor()

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.

Parameters
cursorThe BCursor object to assign to the view.
syncIf 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.
Since
BeOS R5

◆ SetViewOverlay() [1/2]

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.

Parameters
overlayThe overlay bitmap to set to the view.
srcRectSpecifies the area of overlay to use.
dstRectSpecifies the area of the view to set overlay to.
colorKeyThe color in overlay to treat as transparent.
followFlagsSpecifies the as the view is resized. See the BView constructor for more details.
optionsSpecifies additional view options. The only option currently available is B_TILE_BITMAP which tiles the bitmap across the view.
Since
BeOS R5

◆ SetViewOverlay() [2/2]

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.

Parameters
overlayThe overlay bitmap to set to the view.
colorKeyThe color in overlay to treat as transparent.
followFlagsSpecifies the as the view is resized. See the BView constructor for more details.
optionsSpecifies additional view options. The only option currently available is B_TILE_BITMAP which tiles the bitmap across the view.
Since
BeOS R5

◆ SetViewUIColor()

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.

Parameters
whichThe color_which constant to set.
tintOptional tint value to use.
Since
Haiku R1

◆ Show()

void BView::Show ( )
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.

See also
Hide()
BWindow::Show()
IsHidden()
Since
BeOS R3

Reimplemented in BMenu, and BMenuBar.

◆ ShowToolTip()

void BView::ShowToolTip ( BToolTip tip = NULL)

Show the tool tip at the current mouse position.

Parameters
tipThe BToolTip object to show.
Since
Haiku R1

◆ StringWidth() [1/2]

float BView::StringWidth ( const char *  string) const

Return the width of string set in the font of the view.

Parameters
stringThe string to get the width of.
Returns
The width of the string in the view's font as a float.
Since
BeOS R3

◆ StringWidth() [2/2]

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.

Parameters
stringThe string to get the width of.
lengthThe maximum number of characters in string to consider.
Returns
The width of the string in the view's font as a float.
Since
BeOS R3

◆ StrokeArc() [1/2]

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.

Parameters
centerThe center point.
xRadiusThe horizontal radius.
yRadiusThe vertical radius.
startAngleThe angle to begin drawing at.
arcAngleThe number of degrees of the arc to draw.
patternOne of the following:
  • B_SOLID_HIGH
  • B_SOLID_LOW
  • B_MIXED_COLORS
Since
BeOS R3

◆ StrokeArc() [2/2]

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.

Parameters
rectThe area within which to inscribe the shape.
startAngleThe angle to begin drawing at.
arcAngleThe number of degrees of the arc to draw.
patternOne of the following:
  • B_SOLID_HIGH
  • B_SOLID_LOW
  • B_MIXED_COLORS
Since
BeOS R3

◆ StrokeBezier()

void BView::StrokeBezier ( BPoint controlPoints,
::pattern  pattern = B_SOLID_HIGH 
)

Stroke a bezier curve.

Parameters
controlPointsThe list of points that form the bezier curve.
patternOne of the following:
  • B_SOLID_HIGH
  • B_SOLID_LOW
  • B_MIXED_COLORS
Since
BeOS R3

◆ StrokeEllipse() [1/2]

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.

Parameters
centerThe center point.
xRadiusThe horizontal radius.
yRadiusThe vertical radius.
patternOne of the following:
  • B_SOLID_HIGH
  • B_SOLID_LOW
  • B_MIXED_COLORS
Since
BeOS R3

◆ StrokeEllipse() [2/2]

void BView::StrokeEllipse ( BRect  rect,
::pattern  pattern = B_SOLID_HIGH 
)

Stroke the outline of an ellipse inscribed within rect.

Parameters
rectThe area within which to inscribe the shape.
patternOne of the following:
  • B_SOLID_HIGH
  • B_SOLID_LOW
  • B_MIXED_COLORS
Since
BeOS R3

◆ StrokeLine() [1/2]

void BView::StrokeLine ( BPoint  toPoint,
::pattern  pattern = B_SOLID_HIGH 
)

Stroke a line from the current pen location to the point toPoint.

Parameters
toPointThe end point of the line.
patternOne of the following:
  • B_SOLID_HIGH
  • B_SOLID_LOW
  • B_MIXED_COLORS
Since
BeOS R3

◆ StrokeLine() [2/2]

void BView::StrokeLine ( BPoint  start,
BPoint  end,
::pattern  pattern = B_SOLID_HIGH 
)

Stroke a line from point start to point end.

Parameters
startThe start point of the line.
endThe end point of the line.
patternOne of the following:
  • B_SOLID_HIGH
  • B_SOLID_LOW
  • B_MIXED_COLORS
Since
BeOS R3

◆ StrokePolygon() [1/3]

void BView::StrokePolygon ( const BPolygon polygon,
bool  closed = true,
::pattern  pattern = B_SOLID_HIGH 
)

Stroke a polygon shape.

Parameters
polygonThe polygon shape to stroke.
closedWhether or not the last line of the polygon should intersect with the initial point.
patternOne of the following:
  • B_SOLID_HIGH
  • B_SOLID_LOW
  • B_MIXED_COLORS
Since
BeOS R3

◆ StrokePolygon() [2/3]

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.

Parameters
pointArrayAn array of points that specify the vertices of the polygon.
numPointsThe number of points in pointArray.
closedWhether or not the last line of the polygon should intersect with the initial point.
patternOne of the following:
  • B_SOLID_HIGH
  • B_SOLID_LOW
  • B_MIXED_COLORS
Since
BeOS R3

◆ StrokePolygon() [3/3]

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.

Parameters
pointArrayAn array of points that specify the vertices of the polygon.
numPointsThe number of points in pointArray.
boundsThe smallest rectangle that encloses the points in pointArray.
closedWhether or not the last line of the polygon should intersect with the initial point.
patternOne of the following:
  • B_SOLID_HIGH
  • B_SOLID_LOW
  • B_MIXED_COLORS
Since
BeOS R3

◆ StrokeRect()

void BView::StrokeRect ( BRect  rect,
::pattern  pattern = B_SOLID_HIGH 
)

Stroke the rectangle specified by rect.

Parameters
rectThe rectangular area to stroke.
patternOne of the following:
  • B_SOLID_HIGH
  • B_SOLID_LOW
  • B_MIXED_COLORS
Since
BeOS R3

◆ StrokeRoundRect()

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.

Parameters
rectThe rectangular area to stroke the round rect within.
xRadiusThe horizontal radius.
yRadiusThe vertical radius.
patternOne of the following:
  • B_SOLID_HIGH
  • B_SOLID_LOW
  • B_MIXED_COLORS
Since
BeOS R3

◆ StrokeShape()

void BView::StrokeShape ( BShape shape,
::pattern  pattern = B_SOLID_HIGH 
)

Stroke shape.

Parameters
shapeThe shape to stroke.
patternOne of the following:
  • B_SOLID_HIGH
  • B_SOLID_LOW
  • B_MIXED_COLORS
Since
BeOS R5

◆ StrokeTriangle() [1/2]

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.

Parameters
point1The first point of the triangle.
point2The second point of the triangle.
point3The third point of the triangle.
boundsThe rectangular area that encloses the triangle.
patternOne of the following:
  • B_SOLID_HIGH
  • B_SOLID_LOW
  • B_MIXED_COLORS
Since
BeOS R3

◆ StrokeTriangle() [2/2]

void BView::StrokeTriangle ( BPoint  point1,
BPoint  point2,
BPoint  point3,
::pattern  pattern = B_SOLID_HIGH 
)

Stroke the triangle specified by points point1, point2, and point3.

Parameters
point1The first point of the triangle.
point2The second point of the triangle.
point3The third point of the triangle.
patternOne of the following:
  • B_SOLID_HIGH
  • B_SOLID_LOW
  • B_MIXED_COLORS
Since
BeOS R3

◆ Sync()

void BView::Sync ( ) const

Synchronizes the attached window's connection to App Server.

Warning
If the view isn't attached to a window, Sync() might crash the application.
Since
BeOS R3

◆ TargetedByScrollView()

void BView::TargetedByScrollView ( BScrollView scrollView)
virtual

Hook method called when the view becomes the target of scrollView.

Parameters
scrollViewThe BScrollView object that has targeted the view.
Since
Haiku R1

Reimplemented in BListView.

◆ ToolTip()

BToolTip * BView::ToolTip ( ) const

Return the tool tip set to the view or NULL if not set.

Returns
The BToolTip object set to the view.
Since
Haiku R1

◆ TruncateString()

void BView::TruncateString ( BString string,
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.

When the string is truncated the missing characters are replaced by a horizontal ellipses.

Parameters
stringThe string to truncate in place.
modeThe truncation mode to use, one of the following:
  • B_TRUNCATE_BEGINNING Truncate from the beginning of the string.
  • B_TRUNCATE_MIDDLE Truncate from the middle of the string.
  • B_TRUNCATE_END Truncate from the end of the string.
  • B_TRUNCATE_SMART Truncate from anywhere based on the string content. Not currently implemented.
widthThe maximum width to truncate the string to.
Since
BeOS R5

◆ ViewColor()

rgb_color BView::ViewColor ( ) const

Return the current view color.

Returns
The current view color as an rgb_color struct.
See also
SetViewColor(rgb_color)
SetViewColor(uchar, uchar, uchar, uchar)
Since
BeOS R3

◆ ViewUIColor()

color_which BView::ViewUIColor ( float *  tint = NULL) const

Return the current view color constant being used.

Parameters
tintOptional float pointer in which to store the tint value used to modify the system color constant.
Returns
The current view color constant.
See also
SetViewUIColor(color_which, float)
Since
Haiku R1

◆ Window()

BWindow * BView::Window ( ) const

Returns the window the view is attached to.

Returns
The window the view is attached to or NULL if the view isn't attached to a window.
Since
BeOS R3

◆ WindowActivated()

void BView::WindowActivated ( bool  active)
virtual

Hook method called when the attached window is activated or deactivated.

Parameters
activetrue when the window becomes activated, false when the window becomes deactivated.
Since
BeOS R3

Reimplemented in BTabView, BTextView, BAbstractSpinner, BTextControl, BColorControl, BButton, BListView, BScrollBar, BBox, BScrollView, BMenuBar, BMenuField, BPictureButton, BRadioButton, BControl, and BCheckBox.