Loading...
Searching...
No Matches
Public Member Functions | Protected Member Functions | List of all members
BControl Class Reference

BControl is the base class for user-event handling objects. More...

Inherits BView, and BInvoker.

Inherited by BButton, BChannelControl, BCheckBox, BColorControl, BOptionControl, BPictureButton, BRadioButton, BSlider, and BTextControl.

Public Member Functions

 BControl (BRect frame, const char *name, const char *label, BMessage *message, uint32 resizingMode, uint32 flags)
 Construct a control in the frame with a name, label, model message, resizingMode, and creation flags.
 
 BControl (const char *name, const char *label, BMessage *message, uint32 flags)
 Construct a control with a name, label, model message, and creation flags suitable for use with the Layout API.
 
virtual ~BControl ()
 Frees all memory used by the BControl object including the memory used by the model message.
 
virtual void AllAttached ()
 Similar to AttachedToWindow() but this method is triggered after all child views have already been detached from a window.
 
virtual void AllDetached ()
 Similar to AttachedToWindow() but this method is triggered after all child views have already been detached from a window.
 
virtual void AttachedToWindow ()
 Hook method called when the control is attached to a window.
 
virtual void DetachedFromWindow ()
 Hook method called when the control is detached from a window.
 
virtual void GetPreferredSize (float *_width, float *_height)
 Fill out the preferred width and height of the control into the _width and _height parameters.
 
virtual status_t GetSupportedSuites (BMessage *message)
 Report the suites of messages this control understands.
 
const BBitmapIconBitmap (uint32 which) const
 Get the currently set bitmap for a specific state.
 
virtual status_t Invoke (BMessage *message=NULL)
 Sends a copy of the model message to the designated target.
 
bool IsEnabled () const
 Gets whether or not the control is currently enabled.
 
virtual void KeyDown (const char *bytes, int32 numBytes)
 Hook method called when a keyboard key is pressed.
 
const char * Label () const
 Gets the label of the control.
 
virtual void MakeFocus (bool focus=true)
 Gives or removes focus from the control.
 
virtual void MessageReceived (BMessage *message)
 Handle message received by the associated looper.
 
virtual void MouseDown (BPoint where)
 Hook method called when a mouse button is pressed.
 
virtual void MouseMoved (BPoint where, uint32 code, const BMessage *dragMessage)
 Hook method called when the mouse is moved.
 
virtual void MouseUp (BPoint where)
 Hook method called when a mouse button is released.
 
virtual status_t Perform (perform_code d, void *arg)
 
virtual void ResizeToPreferred ()
 Resize the control to its preferred size.
 
virtual BHandlerResolveSpecifier (BMessage *message, int32 index, BMessage *specifier, int32 what, const char *property)
 
virtual void SetEnabled (bool enabled)
 Enables or disables the control.
 
virtual status_t SetIcon (const BBitmap *bitmap, uint32 flags=0)
 This convenience method is used to set the bitmaps for the standard states from a single bitmap.
 
status_t SetIconBitmap (const BBitmap *bitmap, uint32 which, uint32 flags=0)
 Icon bitmaps for various states of the control (off, on, partially on, each enabled or disabled, plus up to 125 custom states) can be set individually.
 
virtual void SetLabel (const char *string)
 Sets the label of the control.
 
virtual void SetValue (int32 value)
 Sets the value of the control.
 
int32 Value () const
 Gets the value of the control.
 
virtual void WindowActivated (bool active)
 Hook method called when the attached window is activated or deactivated.
 
- Public Member Functions inherited from BView
 BView (BMessage *archive)
 Archive constructor.
 
 BView (BRect frame, const char *name, uint32 resizingMode, uint32 flags)
 Standard constructor.
 
 BView (const char *name, uint32 flags, BLayout *layout=NULL)
 Layout constructor.
 
virtual ~BView ()
 Destructor method.
 
BRect Bounds () const
 Returns the view's frame rectangle in the view's coordinate system.
 
void Flush () const
 Flushes the attached window's connection to App Server.
 
BRect Frame () const
 Returns the view's frame rectangle in the parent's coordinate system.
 
virtual void GetPreferredSize (float *_width, float *_height)
 Fill out the preferred width and height of the view into the _width and _height parameters.
 
virtual status_t GetSupportedSuites (BMessage *data)
 
virtual void Hide ()
 Hides the view without removing it from the view hierarchy.
 
bool IsFocus () const
 Returns whether or not the view is the window's current focus view.
 
bool IsHidden () const
 Returns whether or not the view is hidden.
 
bool IsHidden (const BView *looking_from) const
 Returns whether or not the view is hidden from the perspective of lookingFrom.
 
bool IsPrinting () const
 Returns whether or not the view is drawing to a printer.
 
BPoint LeftTop () const
 Returns the left top corner point.
 
virtual status_t Perform (perform_code code, void *data)
 Perform some action. (Internal Method)
 
virtual void ResizeToPreferred ()
 Resizes the view to its preferred size keeping the position of the left top corner constant.
 
uint32 ResizingMode () const
 Returns the resizing mode flags mask set in the constructor or by SetResizingMode().
 
virtual BHandlerResolveSpecifier (BMessage *message, int32 index, BMessage *specifier, int32 form, const char *property)
 
virtual void SetResizingMode (uint32 mode)
 Sets the resizing mode of the view according to the mode mask.
 
void SetViewCursor (const BCursor *cursor, bool sync=true)
 Assigns cursor to the view.
 
virtual void Show ()
 Shows the view making it visible.
 
void Sync () const
 Synchronizes the attached window's connection to App Server.
 
BWindowWindow () const
 Returns the window the view is attached to.
 
void AddChild (BView *child, BView *before=NULL)
 Adds child to the view hierarchy immediately before before.
 
bool AddChild (BLayoutItem *child)
 Add the child layout item to the view hierarchy.
 
bool RemoveChild (BView *child)
 Removes child from the view hierarchy.
 
int32 CountChildren () const
 Returns the number of child views that this view has.
 
BViewChildAt (int32 index) const
 Returns a pointer to the child view found at index.
 
BViewNextSibling () const
 Returns a pointer to the next sibling view.
 
BViewPreviousSibling () const
 Returns a pointer to the previous sibling view.
 
bool RemoveSelf ()
 Removes the view and all child views from the view hierarchy.
 
BViewFindView (const char *name) const
 Returns the view in the view hierarchy with the specified name.
 
BViewParent () const
 Returns a pointer to the view's parent.
 
void ConvertToScreen (BPoint *point) const
 Convert point to the screen's coordinate system in place.
 
BPoint ConvertToScreen (BPoint point) const
 Returns point converted to the screen's coordinate system.
 
void ConvertFromScreen (BPoint *point) const
 Convert point from the screen's coordinate system to the view's coordinate system in place.
 
BPoint ConvertFromScreen (BPoint point) const
 Returns point converted from the screen's coordinate system to the view's coordinate system.
 
void ConvertToScreen (BRect *rect) const
 Convert rect to the screen's coordinate system in place.
 
BRect ConvertToScreen (BRect rect) const
 Returns rect converted to the screen's coordinate system.
 
void ConvertFromScreen (BRect *rect) const
 Convert rect from the screen's coordinate system to the view's coordinate system in place.
 
BRect ConvertFromScreen (BRect rect) const
 Returns rect converted from the screen's coordinate system to the view's coordinate system.
 
void ConvertToParent (BPoint *point) const
 Convert point to the parent's coordinate system in place.
 
BPoint ConvertToParent (BPoint point) const
 Returns point converted to the parent's coordinate system.
 
void ConvertFromParent (BPoint *point) const
 Convert point from the parent's coordinate system to the view's coordinate system in place.
 
BPoint ConvertFromParent (BPoint point) const
 Returns point converted from the parent's coordinate system to the view's coordinate system.
 
void ConvertToParent (BRect *rect) const
 Convert rect to the parent's coordinate system in place.
 
BRect ConvertToParent (BRect rect) const
 Returns rect converted to the parent's coordinate system.
 
void ConvertFromParent (BRect *rect) const
 Convert rect from the parent's coordinate system to the view's coordinate system in place.
 
BRect ConvertFromParent (BRect rect) const
 Returns rect converted from the parent's coordinate system to the view's coordinate system.
 
virtual void SetFlags (uint32 flags)
 Sets the view flags to the flags mask.
 
uint32 Flags () const
 Return the view flags set in the constructor or by SetFlags().
 
void GetClippingRegion (BRegion *region) const
 Fill out region with the view's clipping region.
 
virtual void ConstrainClippingRegion (BRegion *region)
 Set the clipping region the region restricting the area that the view can draw in.
 
void ClipToPicture (BPicture *picture, BPoint where=B_ORIGIN, bool sync=true)
 Intersects the current clipping region of the view with the pixels of picture.
 
void ClipToInversePicture (BPicture *picture, BPoint where=B_ORIGIN, bool sync=true)
 Intersects the current clipping region of the view with the pixels outside of picture.
 
void ClipToRect (BRect rect)
 Intersects the current clipping region of the view with the pixels of rect.
 
void ClipToInverseRect (BRect rect)
 Intersects the current clipping region of the view with the pixels outside of rect.
 
void ClipToShape (BShape *shape)
 Intersects the current clipping region of the view with the pixels of shape.
 
void ClipToInverseShape (BShape *shape)
 Intersects the current clipping region of the view with the pixels outside of shape.
 
virtual void SetDrawingMode (drawing_mode mode)
 Sets the drawing mode of the view.
 
drawing_mode DrawingMode () const
 Return the current drawing_mode.
 
void SetBlendingMode (source_alpha srcAlpha, alpha_function alphaFunc)
 Set the blending mode which controls how transparency is used.
 
void GetBlendingMode (source_alpha *srcAlpha, alpha_function *alphaFunc) const
 Fill out srcAlpha and alphaFunc with the alpha mode and alpha function of the view.
 
virtual void SetPenSize (float size)
 Set the pen size to size.
 
float PenSize () const
 Return the current pen size.
 
bool HasDefaultColors () const
 Tests if the view has any colors set.
 
bool HasSystemColors () const
 Tests if the view is using system "panel" colors. B_PANEL_BACKGROUND_COLOR for ViewUIColor() B_PANEL_BACKGROUND_COLOR for LowUIColor() B_PANEL_TEXT_COLOR for HighUIColor()
 
void AdoptParentColors ()
 Attempts to use the colors of any parent view. Will adopt view, low, and high colors. Should be called in AttachedToWindow() or AllAttached().
 
void AdoptSystemColors ()
 Instructs view to use standard system "panel" colors. B_PANEL_BACKGROUND_COLOR for ViewUIColor() B_PANEL_BACKGROUND_COLOR for LowUIColor() B_PANEL_TEXT_COLOR for HighUIColor()
 
void AdoptViewColors (BView *view)
 Attempts to use the colors of a given view. Will adopt view, low, and high colors.
 
virtual void SetViewColor (rgb_color color)
 Set the view color of the view.
 
void SetViewColor (uchar red, uchar green, uchar blue, uchar alpha=255)
 Set the view color of the view.
 
rgb_color ViewColor () const
 Return the current view color.
 
void SetViewUIColor (color_which which, float tint=B_NO_TINT)
 Set the view color of the view to a system constant. The color will update live with user changes.
 
color_which ViewUIColor (float *tint=NULL) const
 Return the current view color constant being used.
 
virtual void SetHighColor (rgb_color color)
 Set the high color of the view.
 
void SetHighColor (uchar red, uchar green, uchar blue, uchar alpha=255)
 Set the high color of the view.
 
rgb_color HighColor () const
 Return the current high color.
 
void SetHighUIColor (color_which which, float tint=B_NO_TINT)
 Set the high color of the view to a system constant. The color will update live with user changes.
 
color_which HighUIColor (float *tint=NULL) const
 Return the current high color constant being used.
 
virtual void SetLowColor (rgb_color color)
 Set the low color of the view.
 
void SetLowColor (uchar red, uchar green, uchar blue, uchar alpha=255)
 Set the low color of the view.
 
rgb_color LowColor () const
 Return the current low color.
 
void SetLowUIColor (color_which which, float tint=B_NO_TINT)
 Set the low color of the view to a system constant. The color will update live with user changes.
 
color_which LowUIColor (float *tint=NULL) const
 Return the current low color constant being used.
 
void SetLineMode (cap_mode lineCap, join_mode lineJoin, float miterLimit=B_DEFAULT_MITER_LIMIT)
 Set line mode to use PostScript-style line cap and join modes.
 
join_mode LineJoinMode () const
 Returns the current line join mode.
 
cap_mode LineCapMode () const
 Returns the current line cap mode.
 
float LineMiterLimit () const
 Returns the miter limit used for B_MITER_JOIN join mode.
 
void SetFillRule (int32 rule)
 Sets the fill rule for the view.
 
int32 FillRule () const
 Return the current fill mode.
 
void SetOrigin (BPoint where)
 Sets the origin in the view's coordinate system.
 
void SetOrigin (float x, float y)
 Sets the origin in the view's coordinate system.
 
BPoint Origin () const
 Returns the origin point in the view's coordinate system.
 
void SetTransform (BAffineTransform transform)
 Sets a BAffineTransform to transform the coordinate system.
 
BAffineTransform Transform () const
 Returns the current BAffineTransform that is applied to the coordinate system.
 
void TranslateBy (double x, double y)
 Translate the current view by coordinates.
 
void ScaleBy (double x, double y)
 Scale the current view by factors x and y.
 
void RotateBy (double angleRadians)
 Rotate the current view by angleRadians.
 
BAffineTransform TransformTo (coordinate_space basis) const
 Return the BAffineTransform to convert from the current drawing space to basis.
 
void PushState ()
 Saves the drawing state to the stack.
 
void PopState ()
 Restores the drawing state from the stack.
 
void MovePenTo (BPoint pt)
 Move the pen to point in the view's coordinate system.
 
void MovePenTo (float x, float y)
 Move the pen to the point specified by x and y in the view's coordinate system.
 
void MovePenBy (float x, float y)
 Move the pen by x pixels horizontally and y pixels vertically.
 
BPoint PenLocation () const
 Return the current pen location as a BPoint object.
 
virtual void SetFont (const BFont *font, uint32 mask=B_FONT_ALL)
 Set the font of the view.
 
void GetFont (BFont *font) const
 Fill out font with the font set to the view.
 
void TruncateString (BString *in_out, uint32 mode, float width) const
 Truncate string with truncation mode mode so that it is no wider than width set in the view's font.
 
float StringWidth (const char *string) const
 Return the width of string set in the font of the view.
 
float StringWidth (const char *string, int32 length) const
 Return the width of string set in the font of the view up to length characters.
 
void GetStringWidths (char *stringArray[], int32 lengthArray[], int32 numStrings, float widthArray[]) const
 Fill out widths of the strings in stringArray set in the font of the view into widthArray.
 
void SetFontSize (float size)
 Set the size of the view's font to size.
 
void ForceFontAliasing (bool enable)
 Turn anti-aliasing on and off when printing.
 
void GetFontHeight (font_height *height) const
 Fill out the font_height struct with the view font.
 
void SetScale (float scale) const
 Sets the scale of the coordinate system the view uses for drawing.
 
float Scale () const
 Return the current drawing scale.
 
void SetViewBitmap (const BBitmap *bitmap, BRect srcRect, BRect dstRect, uint32 followFlags=B_FOLLOW_LEFT_TOP, uint32 options=B_TILE_BITMAP)
 Sets the background bitmap of the view.
 
void SetViewBitmap (const BBitmap *bitmap, uint32 followFlags=B_FOLLOW_LEFT_TOP, uint32 options=B_TILE_BITMAP)
 Sets the background bitmap of the view.
 
void ClearViewBitmap ()
 Clears the background bitmap of the view if it has one.
 
status_t SetViewOverlay (const BBitmap *overlay, BRect srcRect, BRect dstRect, rgb_color *colorKey, uint32 followFlags=B_FOLLOW_LEFT_TOP, uint32 options=0)
 Sets the overlay bitmap of the view.
 
status_t SetViewOverlay (const BBitmap *overlay, rgb_color *colorKey, uint32 followFlags=B_FOLLOW_LEFT_TOP, uint32 options=0)
 Sets the overlay bitmap of the view.
 
void ClearViewOverlay ()
 Clears the overlay bitmap of the view if it has one.
 
void StrokeLine (BPoint toPoint, ::pattern pattern=B_SOLID_HIGH)
 Stroke a line from the current pen location to the point toPoint.
 
void StrokeLine (BPoint start, BPoint end, ::pattern pattern=B_SOLID_HIGH)
 Stroke a line from point start to point end.
 
void BeginLineArray (int32 count)
 Begin a line array of up to count lines.
 
void AddLine (BPoint start, BPoint end, rgb_color color)
 Add a line to the line array drawn from start to end.
 
void EndLineArray ()
 End the line array drawing the lines.
 
void StrokePolygon (const BPolygon *polygon, bool closed=true, ::pattern pattern=B_SOLID_HIGH)
 Stroke a polygon shape.
 
void StrokePolygon (const BPoint *pointArray, int32 numPoints, bool closed=true, ::pattern pattern=B_SOLID_HIGH)
 Stroke a polygon shape made up of points specified by pointArray.
 
void StrokePolygon (const BPoint *pointArray, int32 numPoints, BRect bounds, bool closed=true, ::pattern pattern=B_SOLID_HIGH)
 Stroke a polygon shape made up of points specified by pointArray inscribed by bounds.
 
void FillPolygon (const BPolygon *polygon, ::pattern pattern=B_SOLID_HIGH)
 Fill a polygon shape.
 
void FillPolygon (const BPoint *pointArray, int32 numPoints, ::pattern pattern=B_SOLID_HIGH)
 Fill a polygon shape made up of points specified by pointArray.
 
void FillPolygon (const BPoint *pointArray, int32 numPoints, BRect bounds, ::pattern pattern=B_SOLID_HIGH)
 Fill a polygon shape made up of points specified by pointArray inscribed by bounds.
 
void FillPolygon (const BPolygon *polygon, const BGradient &gradient)
 Fill a polygon shape with the specified gradient pattern.
 
void FillPolygon (const BPoint *pointArray, int32 numPoints, const BGradient &gradient)
 Fill a polygon shape made up of points specified by pointArray with the specified gradient pattern.
 
void FillPolygon (const BPoint *pointArray, int32 numPoints, BRect bounds, const BGradient &gradient)
 Fill a polygon shape made up of points specified by pointArray inscribed by bounds with the specified gradient pattern.
 
void StrokeTriangle (BPoint point1, BPoint point2, BPoint point3, BRect bounds, ::pattern pattern=B_SOLID_HIGH)
 Stroke the triangle specified by points point1, point2, and point3 and enclosed by bounds.
 
void StrokeTriangle (BPoint point1, BPoint point2, BPoint point3, ::pattern pattern=B_SOLID_HIGH)
 Stroke the triangle specified by points point1, point2, and point3.
 
void FillTriangle (BPoint point1, BPoint point2, BPoint point3, ::pattern pattern=B_SOLID_HIGH)
 Fill the triangle specified by points point1, point2, and point3.
 
void FillTriangle (BPoint point1, BPoint point2, BPoint point3, BRect bounds, ::pattern pattern=B_SOLID_HIGH)
 Fill the triangle specified by points point1, point2, and point3 and enclosed by bounds.
 
void FillTriangle (BPoint point1, BPoint point2, BPoint point3, const BGradient &gradient)
 Fill the triangle specified by points point1, point2, and point3 with the specified gradient pattern.
 
void FillTriangle (BPoint point1, BPoint point2, BPoint point3, BRect bounds, const BGradient &gradient)
 Fill the triangle specified by points point1, point2, and point3 and enclosed by bounds with the specified gradient pattern.
 
void StrokeRect (BRect rect, ::pattern pattern=B_SOLID_HIGH)
 Stroke the rectangle specified by rect.
 
void FillRect (BRect rect, ::pattern pattern=B_SOLID_HIGH)
 Fill the rectangle specified by rect.
 
void FillRect (BRect rect, const BGradient &gradient)
 Fill the rectangle specified by rect with the specified gradient pattern.
 
void FillRegion (BRegion *rectegion, ::pattern pattern=B_SOLID_HIGH)
 Fill region.
 
void FillRegion (BRegion *rectegion, const BGradient &gradient)
 Fill region with the specified gradient pattern.
 
void InvertRect (BRect rect)
 Inverts the colors within rect.
 
void StrokeRoundRect (BRect rect, float xRadius, float yRadius, ::pattern pattern=B_SOLID_HIGH)
 Stroke the rounded rectangle with horizontal radius xRadius and vertical radius yRadius.
 
void FillRoundRect (BRect rect, float xRadius, float yRadius, ::pattern pattern=B_SOLID_HIGH)
 Fill the rounded rectangle with horizontal radius xRadius and vertical radius yRadius.
 
void FillRoundRect (BRect rect, float xRadius, float yRadius, const BGradient &gradient)
 Fill the rounded rectangle with horizontal radius xRadius and vertical radius yRadius with the specified gradient pattern.
 
void StrokeEllipse (BPoint center, float xRadius, float yRadius, ::pattern pattern=B_SOLID_HIGH)
 Stroke the outline of an ellipse starting at center with a horizontal radius of xRadius and a vertical radius of yRadius.
 
void StrokeEllipse (BRect rect, ::pattern pattern=B_SOLID_HIGH)
 Stroke the outline of an ellipse inscribed within rect.
 
void FillEllipse (BPoint center, float xRadius, float yRadius, ::pattern pattern=B_SOLID_HIGH)
 Fill an ellipse starting at center with a horizontal radius of xRadius and a vertical radius of yRadius.
 
void FillEllipse (BRect rect, ::pattern pattern=B_SOLID_HIGH)
 Fill an ellipse inscribed within rect.
 
void FillEllipse (BPoint center, float xRadius, float yRadius, const BGradient &gradient)
 Fill an ellipse with the specified gradient pattern starting at center with a horizontal radius of xRadius and a vertical radius of yRadius.
 
void FillEllipse (BRect rect, const BGradient &gradient)
 Fill an ellipse with the specified gradient pattern inscribed within rect.
 
void StrokeArc (BPoint center, float xRadius, float yRadius, float startAngle, float arcAngle, ::pattern pattern=B_SOLID_HIGH)
 Stroke the outline of an arc starting at center with a horizontal radius of xRadius and a vertical radius of yRadius starting at startAngle and drawing arcAngle degrees.
 
void StrokeArc (BRect rect, float startAngle, float arcAngle, ::pattern pattern=B_SOLID_HIGH)
 Stroke the outline of an arc inscribed within rect starting at startAngle and drawing arcAngle degrees.
 
void FillArc (BPoint center, float xRadius, float yRadius, float startAngle, float arcAngle, ::pattern pattern=B_SOLID_HIGH)
 Fill an arc starting at center with a horizontal radius of xRadius and a vertical radius of yRadius starting at startAngle and drawing arcAngle degrees.
 
void FillArc (BRect rect, float startAngle, float arcAngle, ::pattern pattern=B_SOLID_HIGH)
 Fill an arc inscribed within rect starting at startAngle and drawing arcAngle degrees.
 
void FillArc (BPoint center, float xRadius, float yRadius, float startAngle, float arcAngle, const BGradient &gradient)
 Fill an arc with the specified gradient pattern starting at center with a horizontal radius of xRadius and a vertical radius of yRadius starting at startAngle and drawing arcAngle degrees.
 
void FillArc (BRect rect, float startAngle, float arcAngle, const BGradient &gradient)
 Fill an arc with the specified gradient pattern inscribed within rect starting at startAngle and drawing arcAngle degrees.
 
void StrokeBezier (BPoint *controlPoints, ::pattern pattern=B_SOLID_HIGH)
 Stroke a bezier curve.
 
void FillBezier (BPoint *controlPoints, ::pattern pattern=B_SOLID_HIGH)
 Fill a bezier curve.
 
void FillBezier (BPoint *controlPoints, const BGradient &gradient)
 Fill a bezier curve.
 
void StrokeShape (BShape *shape, ::pattern pattern=B_SOLID_HIGH)
 Stroke shape.
 
void FillShape (BShape *shape, ::pattern pattern=B_SOLID_HIGH)
 Fill shape.
 
void FillShape (BShape *shape, const BGradient &gradient)
 Fill shape with the specified gradient pattern.
 
void CopyBits (BRect src, BRect dst)
 Copy the bits from the src rectangle to the dst rectangle in the view's coordinate system.
 
void DrawBitmapAsync (const BBitmap *aBitmap, BRect bitmapRect, BRect viewRect, uint32 options)
 Draws bitmap on the view within viewRect asynchronously. bitmap portion is scaled to fit viewRect.
 
void DrawBitmapAsync (const BBitmap *aBitmap, BRect bitmapRect, BRect viewRect)
 Draws bitmap on the view within viewRect asynchronously. bitmap portion is scaled to fit viewRect.
 
void DrawBitmapAsync (const BBitmap *aBitmap, BRect viewRect)
 Draws bitmap on the view within viewRect asynchronously. bitmap is scaled to fit viewRect.
 
void DrawBitmapAsync (const BBitmap *aBitmap, BPoint where)
 Draws bitmap on the view offset by where asynchronously.
 
void DrawBitmapAsync (const BBitmap *aBitmap)
 Draws bitmap on the view asynchronously.
 
void DrawBitmap (const BBitmap *aBitmap, BRect bitmapRect, BRect viewRect, uint32 options)
 Draws bitmap on the view within viewRect. bitmap portion is scaled to fit viewRect.
 
void DrawBitmap (const BBitmap *aBitmap, BRect bitmapRect, BRect viewRect)
 Draws bitmap on the view within viewRect. bitmap portion is scaled to fit viewRect.
 
void DrawBitmap (const BBitmap *aBitmap, BRect viewRect)
 Draws bitmap on the view within viewRect. bitmap is scaled to fit viewRect.
 
void DrawBitmap (const BBitmap *aBitmap, BPoint where)
 Draws bitmap on the view offset by where.
 
void DrawBitmap (const BBitmap *aBitmap)
 Draws bitmap on the view.
 
void DrawTiledBitmapAsync (const BBitmap *aBitmap, BRect viewRect, BPoint phase=B_ORIGIN)
 Draws bitmap on the view within viewRect asynchronously. If bitmap is smaller, it is cloned to fill remaining space in viewRect.
 
void DrawTiledBitmap (const BBitmap *aBitmap, BRect viewRect, BPoint phase=B_ORIGIN)
 Draws bitmap on the view within viewRect. If bitmap is smaller, it is cloned to fill remaining space in viewRect.
 
void DrawChar (char aChar)
 Draws character c onto to the view at the current pen position.
 
void DrawChar (char aChar, BPoint location)
 Draws character c at the specified location in the view.
 
void DrawString (const char *string, escapement_delta *delta=NULL)
 Draw string onto the view at the current pen position.
 
void DrawString (const char *string, BPoint location, escapement_delta *delta=NULL)
 Draw string onto the view at the specified location in the view.
 
void DrawString (const char *string, int32 length, escapement_delta *delta=NULL)
 Draw string up to length characters onto the view at the current pen position.
 
void DrawString (const char *string, int32 length, BPoint location, escapement_delta *delta=0L)
 Draw string up to length characters onto the view at the specified location in the view.
 
void DrawString (const char *string, const BPoint *locations, int32 locationCount)
 Draw string locationCount times at the specified locations.
 
void DrawString (const char *string, int32 length, const BPoint *locations, int32 locationCount)
 Draw string up to length characters locationCount times at the specified locations.
 
void Invalidate (BRect invalRect)
 Sends a message to App Server to redraw the portion of the view specified by invalRect.
 
void Invalidate (const BRegion *invalRegion)
 Sends a message to App Server to redraw the portion of the view specified by region.
 
void Invalidate ()
 Sends a message to App Server to redraw the view.
 
void DelayedInvalidate (bigtime_t delay)
 Sends a message to App Server to redraw the entire view after a certain, minimum, delay. Repeated calls to this method may be merged, but the view is guaranteed to be redrawn after the delay given in the first call of this method.
 
void DelayedInvalidate (bigtime_t delay, BRect invalRect)
 Sends a message to App Server to redraw the portion of the view specified by invalRect after a certain, minimum, delay. Repeated calls to this method may be merged, but the invalidated rect is guaranteed to be redrawn after the minimum delay given by the first call of this method.
 
void SetDiskMode (char *filename, long offset)
 Unimplemented.
 
void BeginPicture (BPicture *a_picture)
 Begins sending drawing instructions to picture.
 
void AppendToPicture (BPicture *a_picture)
 Appends drawing instructions to picture without clearing it first.
 
BPictureEndPicture ()
 Ends the drawing instruction recording session and returns the BPicture object passed to BeginPicture() or AppendToPicture().
 
void DrawPicture (const BPicture *a_picture)
 Draws the picture at the view's current pen position.
 
void DrawPicture (const BPicture *a_picture, BPoint where)
 Draws the picture at the location in the view specified by where.
 
void DrawPicture (const char *filename, long offset, BPoint where)
 Draws the picture from the file specified by filename offset by offset bytes at the location in the view specified by where.
 
void DrawPictureAsync (const BPicture *a_picture)
 Draws the picture at the view's current pen position.
 
void DrawPictureAsync (const BPicture *a_picture, BPoint where)
 Draws the picture at the location in the view specified by where.
 
void DrawPictureAsync (const char *filename, long offset, BPoint where)
 Draws the picture from the file specified by filename offset by offset bytes at the location in the view specified by where.
 
void BeginLayer (uint8 opacity)
 Begins a drawing layer.
 
void EndLayer ()
 Finish a layer and blend it in with the view.
 
void MoveBy (float dh, float dv)
 Moves the view deltaX pixels horizontally and deltaY pixels vertically in the parent view's coordinate system.
 
void MoveTo (BPoint where)
 Move the view to the location specified by where in the parent view's coordinate system.
 
void MoveTo (float x, float y)
 Move the view to the coordinates specified by x in the horizontal dimension and y in the vertical dimension in the parent view's coordinate system.
 
void ResizeBy (float dh, float dv)
 Resize the view by deltaWidth horizontally and deltaHeight vertically without moving the top left corner of the view.
 
void ResizeTo (float width, float height)
 Resize the view to the specified width and height.
 
void ResizeTo (BSize size)
 Resize the view to the dimension specified by size.
 
virtual status_t AllUnarchived (const BMessage *archive)
 Hook method called when all views have been unarchived.
 
virtual status_t AllArchived (BMessage *archive) const
 Hook method called when all views have been archived.
 
virtual void Draw (BRect updateRect)
 Draws the area of the view that intersects updateRect.
 
virtual void KeyUp (const char *bytes, int32 numBytes)
 Hook method called when a keyboard key is released.
 
virtual void Pulse ()
 Hook method called when the view receives a B_PULSE message.
 
virtual void FrameMoved (BPoint newPosition)
 Hook method called when the view is moved.
 
virtual void FrameResized (float newWidth, float newHeight)
 Hook method called when the view is resized.
 
virtual void TargetedByScrollView (BScrollView *scrollView)
 Hook method called when the view becomes the target of scrollView.
 
virtual void DrawAfterChildren (BRect updateRect)
 Perform any drawing that needs to be done after child view have already been drawn.
 
void BeginRectTracking (BRect startRect, uint32 style=B_TRACK_WHOLE_RECT)
 Displays an outline rectangle on the view and initiates tracking.
 
void EndRectTracking ()
 Ends tracking removing the outline rectangle from the view.
 
void GetMouse (BPoint *location, uint32 *buttons, bool checkMessageQueue=true)
 Fills out the cursor location and the current state of the mouse buttons.
 
void DragMessage (BMessage *message, BRect dragRect, BHandler *replyTo=NULL)
 Initiates a drag-and-drop session.
 
void DragMessage (BMessage *message, BBitmap *bitmap, BPoint offset, BHandler *replyTo=NULL)
 Initiates a drag-and-drop session of an image.
 
void DragMessage (BMessage *message, BBitmap *bitmap, drawing_mode dragMode, BPoint offset, BHandler *replyTo=NULL)
 Initiates a drag-and-drop session of an image with drawing_mode set by dragMode.
 
status_t SetEventMask (uint32 mask, uint32 options=0)
 Sets whether or not the view can accept mouse and keyboard events when not in focus.
 
uint32 EventMask ()
 Returns the current event mask.
 
status_t SetMouseEventMask (uint32 mask, uint32 options=0)
 Sets whether or not the view can accept mouse and keyboard events when not in focus from within MouseDown() until the following MouseUp() event.
 
void ScrollBy (float dh, float dv)
 Scroll the view by deltaX horizontally and deltaY vertically.
 
void ScrollTo (float x, float y)
 Scroll the view to the point specified by coordinates.
 
virtual void ScrollTo (BPoint where)
 Scroll the view to the point specified by where.
 
BScrollBarScrollBar (orientation direction) const
 Returns the BScrollBar object that has the BView set as its target.
 
virtual BSize MinSize ()
 Return the minimum size of the view.
 
virtual BSize MaxSize ()
 Return the maximum size of the view.
 
virtual BSize PreferredSize ()
 Return the preferred size of the view.
 
virtual BAlignment LayoutAlignment ()
 Return the current BAlignemnt of the view.
 
void SetExplicitMinSize (BSize size)
 Set this view's min size, to be used by MinSize().
 
void SetExplicitMaxSize (BSize size)
 Set this view's max size, to be used by MaxSize().
 
void SetExplicitPreferredSize (BSize size)
 Set this view's preferred size, to be used by PreferredSize().
 
void SetExplicitSize (BSize size)
 Set this view's size.
 
void SetExplicitAlignment (BAlignment alignment)
 Set this view's alignment, to be used by Alignment().
 
BSize ExplicitMinSize () const
 Returns the explicit minimum size.
 
BSize ExplicitMaxSize () const
 Returns the explicit maximum size.
 
BSize ExplicitPreferredSize () const
 Returns the explicit preferred size.
 
BAlignment ExplicitAlignment () const
 Returns the explicit alignment size.
 
virtual bool HasHeightForWidth ()
 Returns whether the layout of the view can calculate a height for a given width.
 
virtual void GetHeightForWidth (float width, float *min, float *max, float *preferred)
 Returns the min, max and preferred height for a given width.
 
void InvalidateLayout (bool descendants=false)
 Invalidate layout.
 
virtual void SetLayout (BLayout *layout)
 Sets the layout of the view.
 
BLayoutGetLayout () const
 Get the layout of the view.
 
void EnableLayoutInvalidation ()
 Enable layout invalidation.
 
void DisableLayoutInvalidation ()
 Disable layout invalidation.
 
bool IsLayoutInvalidationDisabled ()
 Returns whether or not layout invalidation is disabled.
 
bool IsLayoutValid () const
 Returns whether or not the layout is valid.
 
void ResetLayoutInvalidation ()
 Service call for BView derived classes re-enabling InvalidateLayout() notifications.
 
BLayoutContext * LayoutContext () const
 Returns the BLayoutContext for this View.
 
void Layout (bool force)
 Layout the view.
 
void Relayout ()
 Relayout the view.
 
void SetToolTip (const char *text)
 Set the tool tip of the view to text.
 
void SetToolTip (BToolTip *tip)
 Set the tool tip of the view to the tip object.
 
BToolTip * ToolTip () const
 Return the tool tip set to the view or NULL if not set.
 
void ShowToolTip (BToolTip *tip=NULL)
 Show the tool tip at the current mouse position.
 
void HideToolTip ()
 Hide the view's tool tip.
 
- Public Member Functions inherited from BHandler
 BHandler (const char *name=NULL)
 Construct a new handler with a name.
 
virtual ~BHandler ()
 Free the filters of this handler, as well as the list of observers.
 
virtual status_t Perform (perform_code d, void *arg)
 Perform some action (Internal method defined for binary compatibility purposes).
 
 BHandler (BMessage *data)
 Construct a handler from an archived message.
 
BLooperLooper () const
 Return a pointer to the looper that this handler is associated with.
 
void SetName (const char *name)
 Set or change the name of this handler.
 
const char * Name () const
 Return the name of this handler.
 
virtual void SetNextHandler (BHandler *handler)
 Set the next handler in the chain that the message is passed on to if this handler cannot process it.
 
BHandlerNextHandler () const
 Return the next hander in the chain to which the message is passed on.
 
virtual void AddFilter (BMessageFilter *filter)
 Add filter as a prerequisite to this handler.
 
virtual bool RemoveFilter (BMessageFilter *filter)
 Remove filter from the filter list.
 
virtual void SetFilterList (BList *filters)
 Set the internal list of filters to filters.
 
BListFilterList ()
 Return a pointer to the list of filters.
 
bool LockLooper ()
 Lock the looper associated with this handler.
 
status_t LockLooperWithTimeout (bigtime_t timeout)
 Lock the looper associated with this handler, with a time out value.
 
void UnlockLooper ()
 Unlock the looper.
 
status_t StartWatching (BMessenger target, uint32 what)
 Subscribe this handler to watch a specific state change of a target.
 
status_t StartWatchingAll (BMessenger target)
 Subscribe this handler to watch a target for all events.
 
status_t StopWatching (BMessenger target, uint32 what)
 Unsubscribe this handler from watching a specific state.
 
status_t StopWatchingAll (BMessenger target)
 Unsubscribe this handler from watching all states.
 
status_t StartWatching (BHandler *observer, uint32 what)
 Subscribe an observer for a specific state change of this handler.
 
status_t StartWatchingAll (BHandler *observer)
 Subscribe an observer for a all state changes.
 
status_t StopWatching (BHandler *observer, uint32 what)
 Unsubscribe an observer from watching a specific state.
 
status_t StopWatchingAll (BHandler *observer)
 Unsubscribe an observer from watching all states.
 
virtual void SendNotices (uint32 what, const BMessage *notice=NULL)
 Emit a state change to the observers.
 
bool IsWatched () const
 Check if there are any observers watching this handler.
 
- Public Member Functions inherited from BArchivable
 BArchivable ()
 Constructor. Does nothing.
 
 BArchivable (BMessage *from)
 Constructor. Does important behind-the-scenes work in the unarchiving process.
 
virtual ~BArchivable ()
 Destructor. Does nothing.
 
virtual status_t AllArchived (BMessage *archive) const
 Method relating to the use of BArchiver.
 
virtual status_t AllUnarchived (const BMessage *archive)
 Method relating to the use of BUnarchiver.
 
virtual status_t Archive (BMessage *into, bool deep=true) const
 Archive the object into a BMessage.
 
virtual status_t Perform (perform_code d, void *arg)
 Perform some action (Internal method defined for binary compatibility purposes).
 
- Public Member Functions inherited from BInvoker
 BInvoker ()
 Initializes a BInvoker without a message or target.
 
 BInvoker (BMessage *message, BMessenger target)
 Initializes the BInvoker with message and sets the target messenger where the message is sent when Invoke() is called.
 
 BInvoker (BMessage *message, const BHandler *handler, const BLooper *looper=NULL)
 Initializes the BInvoker with message and sets the target to either a local handler or as the preferred handler of a local looper where the message is sent when Invoke() is called.
 
virtual ~BInvoker ()
 Destructor method, deletes the BMessage object if set.
 
uint32 Command () const
 Returns the message's what data member.
 
BHandlerHandlerForReply () const
 Returns the previously set reply handler or NULL if not set.
 
virtual status_t Invoke (BMessage *message=NULL)
 Sends the message to the invoker's target.
 
status_t InvokeNotify (BMessage *message, uint32 kind=B_CONTROL_INVOKED)
 Sends the message to its target, using the notification code specified by kind.
 
bool IsTargetLocal () const
 Returns whether or not the invoker and its target belong to the same team.
 
BMessageMessage () const
 Returns a pointer to the invoker's message object.
 
BMessenger Messenger () const
 Returns the BMessenger object that the invoker uses to send its messages.
 
virtual status_t SetHandlerForReply (BHandler *handler)
 Sets the BHandler object responsible for handling reply messages.
 
virtual status_t SetMessage (BMessage *message)
 Assigns message to the invoker, deleting any previously assigned message.
 
virtual status_t SetTarget (BMessenger messenger)
 Sets the invoker's target to messenger.
 
virtual status_t SetTarget (const BHandler *handler, const BLooper *looper=NULL)
 Sets the target to either a local handler or as the preferred handler of a local looper.
 
status_t SetTimeout (bigtime_t timeout)
 Sets the timeout to use when sending the message to the target.
 
BHandlerTarget (BLooper **_looper=NULL) const
 Invoke BMessenger::Target() on the internal messenger.
 
bigtime_t Timeout () const
 Returns the current timeout value.
 

Protected Member Functions

bool IsFocusChanging () const
 Check if the control is changing focus.
 
bool IsTracking () const
 Check whether this control is set to tracking.
 
void SetTracking (bool state)
 Modify the control's tracking state.
 
void SetValueNoUpdate (int32 value)
 Sets the value of the control without redrawing.
 
- Protected Member Functions inherited from BView
virtual void LayoutInvalidated (bool descendants=false)
 Hook method called when the layout is invalidated.
 
virtual void LayoutChanged ()
 Hook function that is called when the layout if this view, or one of its children, has changed.
 
status_t ScrollWithMouseWheelDelta (BScrollBar *, float)
 Handle the scroll wheel changing over scrollbars.
 
virtual void DoLayout ()
 Layout view within the layout context.
 
virtual bool GetToolTipAt (BPoint point, BToolTip **_tip)
 Point _tip with the view's tool tip.
 
- Protected Member Functions inherited from BInvoker
void BeginInvokeNotify (uint32 kind=B_CONTROL_INVOKED)
 Implement this method to set up an InvokeNotify() context.
 
void EndInvokeNotify ()
 Implement this method to tear down an InvokeNotify() context.
 
uint32 InvokeKind (bool *_notify=NULL)
 Returns the kind set by InvokeNotify().
 

Archiving

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

Additional Inherited Members

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

Detailed Description

BControl is the base class for user-event handling objects.

Simple controls such as BCheckBox and BButton deviate only a bit from BControl, whereas more complicated controls such as BColorControl and BSlider re-implement much more functionality. Whether you are building a simple control or something more complicated you should inherit from BControl as it provides a common set of methods for intercepting received messages from mouse and keyboard events.

Controls have state which they keep in their value. The value of a control, stored as an int32, is read and set by the virtual Value() and SetValue() methods. BControl defines B_CONTROL_ON and B_CONTROL_OFF values that you can use as a convenience if your control has a simple on/off state. If your BControl derived class stores a larger set of states then you should define your own integer values instead.

Since
BeOS R3

Constructor & Destructor Documentation

◆ BControl() [1/3]

BControl::BControl ( BRect  frame,
const char *  name,
const char *  label,
BMessage message,
uint32  resizingMode,
uint32  flags 
)

Construct a control in the frame with a name, label, model message, resizingMode, and creation flags.

The initial value of the control is set to 0 (B_CONTROL_OFF). The label and the message parameters can be set to NULL.

Parameters
frameThe frame to draw the control in.
nameThe name of the control.
labelThe label displayed along with the control.
messageThe message to send when the control is activated.
resizingModeDefines the behavior of the control as the parent view resizes, see BView for more details.
flagsBehavior flags for the control, see BView for details.
Since
BeOS R3

◆ BControl() [2/3]

BControl::BControl ( const char *  name,
const char *  label,
BMessage message,
uint32  flags 
)

Construct a control with a name, label, model message, and creation flags suitable for use with the Layout API.

The initial value of the control is set to 0 (B_CONTROL_OFF). The label and the message parameters can be set to NULL.

Parameters
nameThe name of the control.
labelThe label displayed along with the control.
messageThe message to send when the control is activated.
flagsBehavior flags for the control, see BView for details.
Since
Haiku R1

◆ ~BControl()

BControl::~BControl ( )
virtual

Frees all memory used by the BControl object including the memory used by the model message.

Since
BeOS R3

◆ BControl() [3/3]

BControl::BControl ( BMessage data)

Creates a new BControl object from an data message.

This method is usually not called directly. If you want to build a control from a message you should call Instantiate() which can handle errors properly.

If the data deep, the BControl object will also undata each of its child views recursively.

Parameters
dataThe data message to restore from.
Since
BeOS R3

Member Function Documentation

◆ AllAttached()

void BControl::AllAttached ( )
virtual

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

Since
BeOS R3

Reimplemented from BView.

Reimplemented in BButton, BChannelSlider, BCheckBox, BColorControl, BOptionPopUp, BPictureButton, BRadioButton, and BTextControl.

◆ AllDetached()

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

Reimplemented in BButton, BChannelSlider, BCheckBox, BColorControl, BPictureButton, BRadioButton, and BTextControl.

◆ Archive()

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

Archives the control into data.

Parameters
dataThe target data that the data will go into.
deepWhether or not to recursively data child views.
Return values
B_OKThe data operation was successful.
B_BAD_VALUENULL data message.
B_ERRORThe archive operation failed.
See also
BArchivable::Archive()
Since
BeOS R3

Reimplemented from BView.

Reimplemented in BPictureButton, BTextControl, BButton, BChannelControl, BCheckBox, BColorControl, BRadioButton, and BChannelSlider.

◆ AttachedToWindow()

void BControl::AttachedToWindow ( )
virtual

Hook method called when the control is attached to a window.

This method overrides BView::AttachedToWindow() setting the low color and view color of the BControl so that it matches the view color of the control's parent view. It also makes the attached window the default target for Invoke() as long as another target has not already been set.

See also
BView::AttachedToWindow()
Invoke()
BInvoker::SetTarget()
Since
BeOS R3

Reimplemented from BView.

Reimplemented in BButton, BChannelControl, BChannelSlider, BCheckBox, BColorControl, BOptionPopUp, BPictureButton, BRadioButton, and BTextControl.

◆ DetachedFromWindow()

void BControl::DetachedFromWindow ( )
virtual

Hook method called when the control is detached from a window.

Since
BeOS R3

Reimplemented from BView.

Reimplemented in BButton, BChannelControl, BChannelSlider, BCheckBox, BColorControl, BPictureButton, BRadioButton, and BTextControl.

◆ GetPreferredSize()

void BControl::GetPreferredSize ( float *  _width,
float *  _height 
)
virtual

Fill out the preferred width and height of the control into the _width and _height parameters.

Derived classes can override this method to set the preferred width and height of the control.

Parameters
[out]_widthPointer to a float to hold the width of the control.
[out]_heightPointer to a float to hold the height of the control.
See also
BView::GetPreferredSize()
Since
BeOS R3

Reimplemented from BView.

Reimplemented in BButton, BChannelSlider, BCheckBox, BColorControl, BOptionPopUp, BPictureButton, BRadioButton, BTextControl, and BChannelControl.

◆ GetSupportedSuites()

status_t BControl::GetSupportedSuites ( BMessage message)
virtual

Report the suites of messages this control understands.

Adds the string "suite/vnd.Be-control" to the message.

Since
BeOS R3

Reimplemented from BView.

Reimplemented in BChannelControl, BChannelSlider, BColorControl, BPictureButton, BTextControl, BButton, BCheckBox, and BRadioButton.

◆ IconBitmap()

const BBitmap * BControl::IconBitmap ( uint32  which) const

Get the currently set bitmap for a specific state.

Parameters
whichThe state to retrieve the icon for.
Returns
A pointer to the icon set for the state, or NULL in case there is no icon set for that state.
Since
Haiku R1

◆ Instantiate()

BArchivable * BControl::Instantiate ( BMessage data)
static

Creates a new object from an data.

If the message is a valid object then the instance created from the passed in data will be returned. Otherwise this method will return NULL.

Parameters
dataThe data message.
Returns
An instance of the object if data is valid or NULL.
See also
BArchivable::Instantiate()
Since
BeOS R3

◆ Invoke()

status_t BControl::Invoke ( BMessage message = NULL)
virtual

Sends a copy of the model message to the designated target.

BControl::Invoke() overrides BInvoker::Invoke(). Derived classes should use this method in their MouseDown() and KeyDown() methods and should call IsEnabled() to check if the control is enabled before calling Invoke().

The following fields added to the BMessage:

  • "when" B_INT64_TYPE system_time()
  • "source" B_POINTER_TYPE A pointer to the BControl object.
Parameters
messageThe message to send.
Returns
B_OK if the control was invoked, otherwise an error code is returned.
See also
BInvoker::Invoke()
IsEnabled()
Since
BeOS R3

Reimplemented from BInvoker.

Reimplemented in BButton, BChannelControl, BCheckBox, BColorControl, BPictureButton, BRadioButton, and BTextControl.

◆ IsEnabled()

bool BControl::IsEnabled ( ) const

Gets whether or not the control is currently enabled.

Returns
true if the control is enabled, false if it is disabled.
Since
BeOS R3

◆ IsFocusChanging()

bool BControl::IsFocusChanging ( ) const
protected

Check if the control is changing focus.

Many controls have different looks depending on whether they have focus or not. You can use this method within your Draw() call to determine whether you are asked to redraw because the focus is changing, meaning your control is getting in or out of focus, so that you can conditionally run the drawing code.

Return values
trueThe Draw() method was called because of a focus change for this control.
falseThe Draw() method was not called because of a focus change for this control.
Since
BeOS R5

◆ IsTracking()

bool BControl::IsTracking ( ) const
protected

Check whether this control is set to tracking.

See SetTracking() for the usage pattern. By default, the control wil return false.

Since
Haiku R1

◆ KeyDown()

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

Hook method called when a keyboard key is pressed.

Overrides BView::KeyDown() to toggle the control value and then calls Invoke() for B_SPACE or B_ENTER. If this is not desired you should override this method in derived classes.

The KeyDown() method is only called if the BControl is the focus view in the active window. If the window has a default button, B_ENTER will be passed to that object instead of the focus view.

Parameters
bytesThe bytes of the key combination pressed.
numBytesThe number of bytes in bytes.
See also
BView::KeyDown()
MakeFocus()
Since
BeOS R3

Reimplemented from BView.

Reimplemented in BButton, BChannelSlider, BCheckBox, BColorControl, BPictureButton, BRadioButton, and BChannelControl.

◆ Label()

const char * BControl::Label ( ) const

Gets the label of the control.

Returns
The control's label.
Since
BeOS R3

◆ MakeFocus()

void BControl::MakeFocus ( bool  focus = true)
virtual

Gives or removes focus from the control.

BControl::MakeFocus() overrides BView::MakeFocus() to call Draw() when the focus changes. Derived classes generally don't have to re-implement MakeFocus().

IsFocusChanging() returns true when Draw() is called from this method.

Parameters
focustrue to set focus, false to remove it.
See also
BView::MakeFocus()
IsFocusChanging()
Since
BeOS R3

Reimplemented from BView.

Reimplemented in BButton, BPictureButton, BRadioButton, BTextControl, BCheckBox, BColorControl, and BChannelSlider.

◆ MessageReceived()

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

Reimplemented in BButton, BChannelControl, BChannelSlider, BCheckBox, BColorControl, BOptionControl, BOptionPopUp, BPictureButton, BRadioButton, and BTextControl.

◆ MouseDown()

void BControl::MouseDown ( BPoint  where)
virtual

Hook method called when a mouse button is pressed.

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

Reimplemented from BView.

Reimplemented in BButton, BChannelSlider, BCheckBox, BColorControl, BPictureButton, BRadioButton, BTextControl, and BChannelControl.

◆ MouseMoved()

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

Reimplemented in BColorControl, BButton, BCheckBox, BPictureButton, BRadioButton, BChannelSlider, and BTextControl.

◆ MouseUp()

void BControl::MouseUp ( BPoint  where)
virtual

Hook method called when a mouse button is released.

Parameters
whereThe point on the screen where the mouse pointer is when the mouse button is released.
Note
Calling GetMouse() in MouseUp() will return the new state of the mouse buttons (after the mouse button was released). If you want to know which button was released, you have to compare that with the previous state of the buttons, that you can memorize for example by calling GetMouse() in MouseDown().
Since
BeOS R3

Reimplemented from BView.

Reimplemented in BColorControl, BButton, BChannelSlider, BCheckBox, BPictureButton, BRadioButton, and BTextControl.

◆ Perform()

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

Perform some action. (Internal Method)

This method is available to allow classes to be extended while maintaining binary compatibility.

The following perform codes are recognized:

  • PERFORM_CODE_MIN_SIZE:
  • PERFORM_CODE_MAX_SIZE:
  • PERFORM_CODE_PREFERRED_SIZE:
  • PERFORM_CODE_LAYOUT_ALIGNMENT:
  • PERFORM_CODE_HAS_HEIGHT_FOR_WIDTH:
  • PERFORM_CODE_GET_HEIGHT_FOR_WIDTH:
  • PERFORM_CODE_SET_LAYOUT:
  • PERFORM_CODE_INVALIDATE_LAYOUT:
  • PERFORM_CODE_DO_LAYOUT:
  • PERFORM_CODE_GET_TOOL_TIP_AT:
  • PERFORM_CODE_ALL_UNARCHIVED:
  • PERFORM_CODE_ALL_ARCHIVED:
Parameters
codeThe perform code.
_dataA pointer to store some data.
Returns
A status code.
Since
Haiku R1

Reimplemented from BView.

Reimplemented in BCheckBox, BPictureButton, BButton, and BRadioButton.

◆ ResizeToPreferred()

void BControl::ResizeToPreferred ( )
virtual

Resize the control to its preferred size.

See also
BView::ResizeToPreferred()
Since
BeOS R3

Reimplemented from BView.

Reimplemented in BButton, BChannelControl, BCheckBox, BColorControl, BOptionPopUp, BPictureButton, BRadioButton, and BTextControl.

◆ ResolveSpecifier()

BHandler * BControl::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 BView.

Reimplemented in BChannelSlider, BButton, BChannelControl, BCheckBox, BColorControl, BPictureButton, BRadioButton, and BTextControl.

◆ SetEnabled()

void BControl::SetEnabled ( bool  enabled)
virtual

Enables or disables the control.

BControl objects are enabled by default. If the control changes enabled state then it is redrawn.

Disabled controls generally won't allow the user to focus on them (The B_NAVIGABLE flag is turned off), and don't post any messages.

Disabled controls in derived classes should be drawn in subdued colors to visually indicate that they are disabled and should not respond to keyboard or mouse events.

Parameters
enabledIf true enables the control, if false, disables it.
Since
BeOS R3

Reimplemented in BTextControl, BOptionPopUp, BChannelSlider, and BColorControl.

◆ SetIcon()

status_t BControl::SetIcon ( const BBitmap icon,
uint32  flags = 0 
)
virtual

This convenience method is used to set the bitmaps for the standard states from a single bitmap.

It also supports cropping the icon to its non-transparent area. The icon is meant as an addition to or replacement of the label.

Parameters
iconThe icon to set.
flagsModify how the icon is set.
  • B_TRIM_ICON_BITMAP Crop the bitmap to the not fully transparent area, may change the icon size.
  • B_TRIM_ICON_BITMAP_KEEP_ASPECT Like B_TRIM_BITMAP, but keeps the aspect ratio.
  • B_CREATE_ACTIVE_ICON_BITMAP
  • B_CREATE_PARTIALLY_ACTIVE_ICON_BITMAP
  • B_CREATE_DISABLED_ICON_BITMAPS
Returns
B_OK if the icon was set or an error code otherwise.
Since
Haiku R1

Reimplemented in BButton, BCheckBox, BColorControl, BPictureButton, BRadioButton, and BTextControl.

◆ SetIconBitmap()

status_t BControl::SetIconBitmap ( const BBitmap bitmap,
uint32  which,
uint32  flags = 0 
)

Icon bitmaps for various states of the control (off, on, partially on, each enabled or disabled, plus up to 125 custom states) can be set individually.

Parameters
bitmapThe bitmap icon to set.
whichThe state to set the icon for.
flagsModify how the icon is set.
  • B_KEEP_ICON_BITMAP Transfer ownership of the bitmap to the control.
Returns
B_OK if the icon was set or an error code otherwise.
Since
Haiku R1

◆ SetLabel()

void BControl::SetLabel ( const char *  label)
virtual

Sets the label of the control.

If the label changes the control is redrawn.

Parameters
labelThe label to set, can be NULL.
Since
BeOS R3

Reimplemented in BButton, and BOptionPopUp.

◆ SetTracking()

void BControl::SetTracking ( bool  state)
protected

Modify the control's tracking state.

The tracking state is a feature of this BControl class, that allows you to set a flag when you are watching the behavior of users when they interact with your control.

For example, a button may have a draw state when it is not pressed, and when it is pressed. When the user presses their mouse down, within the control, the control will be drawn in the pressed state. The code can set the tracking flag, so that in the case of the mouse up event, the control knows it has to redraw.

This flag does not affect anything within this class, other than the return value of the IsTracking() method, so it can be used at will by custom implementations of this class.

Parameters
statePass true if the control is in a tracking state, or false if it is not.
Since
Haiku R1

◆ SetValue()

void BControl::SetValue ( int32  value)
virtual

Sets the value of the control.

If the value changes the control is redrawn.

Parameters
valueThe value to set.
See also
SetValueNoUpdate()
Since
BeOS R3

Reimplemented in BColorControl, BButton, BChannelControl, BCheckBox, BOptionPopUp, BPictureButton, BRadioButton, and BTextControl.

◆ SetValueNoUpdate()

void BControl::SetValueNoUpdate ( int32  value)
protected

Sets the value of the control without redrawing.

Parameters
valueThe value to set.
See also
SetValue()
Since
Haiku R1

◆ Value()

int32 BControl::Value ( ) const

Gets the value of the control.

Returns
The control's value.
Since
BeOS R3

◆ WindowActivated()

void BControl::WindowActivated ( bool  active)
virtual

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

Redraws the focus ring around the control when the window is activated or deactivated if it is the window's current focus view.

Parameters
activetrue if the window becomes activated, false if the window becomes deactivated.
See also
BView::WindowActivated()
Since
BeOS R3

Reimplemented from BView.

Reimplemented in BButton, BCheckBox, BPictureButton, BRadioButton, BTextControl, BChannelSlider, and BColorControl.