Public Member Functions | Protected Member Functions | List of all members
BListView Class Reference

Displays a list of items that the user can select and invoke. More...

Inherits BView, and BInvoker.

Inherited by BOutlineListView.

Public Member Functions

 BListView (BRect frame, const char *name, list_view_type type=B_SINGLE_SELECTION_LIST, uint32 resizeMask=B_FOLLOW_LEFT_TOP, uint32 flags=B_WILL_DRAW|B_FRAME_EVENTS|B_NAVIGABLE)
 Creates a new list view. This is the non-layout constructor. More...
 
 BListView (const char *name, list_view_type type=B_SINGLE_SELECTION_LIST, uint32 flags=B_WILL_DRAW|B_FRAME_EVENTS|B_NAVIGABLE)
 Creates a new list view suitable as part of a layout with the specified name, type, and flags. More...
 
 BListView (list_view_type type=B_SINGLE_SELECTION_LIST)
 Creates a new list view suitable as part of a layout. More...
 
 BListView (BMessage *data)
 Creates a BListView object from the archive message. More...
 
virtual ~BListView ()
 Delete the BListView object and free the memory used by it. More...
 
virtual status_t GetSupportedSuites (BMessage *data)
 Reports the suites of messages and specifiers that derived classes understand. More...
 
void InvalidateItem (int32 index)
 Draws the list item at the specified index. More...
 
virtual status_t Invoke (BMessage *message=NULL)
 Invoke the list view, either with the current invocation message or message if it is specified. More...
 
BRect ItemFrame (int32 index)
 Return the frame of the item at the specified index. More...
 
virtual void MakeFocus (bool state=true)
 Highlight or unhighlight the selection when the list view acquires or loses its focus state. More...
 
bool MoveItem (int32 from, int32 to)
 Move the item at index from to the position in the list at index to. More...
 
virtual status_t Perform (perform_code code, void *arg)
 Performs an action give a perform_code and data. (Internal Method) More...
 
bool ReplaceItem (int32 index, BListItem *item)
 Replace the item at index index with item. More...
 
virtual BHandlerResolveSpecifier (BMessage *message, int32 index, BMessage *specifier, int32 what, const char *property)
 Determines the proper handler for the passed in scripting message. More...
 
virtual void ScrollTo (BPoint where)
 Scroll the view to the specified point. More...
 
virtual void SetFont (const BFont *font, uint32 mask=B_FONT_ALL)
 Sets the font of the list view to font with the font parameters set by mask. More...
 
void SortItems (int(*cmp)(const void *, const void *))
 Sort the items according the the passed in cmp function. More...
 
bool SwapItems (int32 a, int32 b)
 Swap item a with item b. More...
 
Hook Methods
virtual void Draw (BRect updateRect)
 Hook method called to draw the contents of the text view. More...
 
virtual void AttachedToWindow ()
 Hook method called when the list view is added to the view hierarchy. More...
 
virtual void DetachedFromWindow ()
 Hook method that is called when the list view is removed from the view hierarchy. More...
 
virtual void AllAttached ()
 Hook method called once all views are attached to the view. More...
 
virtual void AllDetached ()
 Hook method called once all views are detached from the view. More...
 
virtual void FrameResized (float newWidth, float newHeight)
 Hook method called when the list view is resized. More...
 
virtual void FrameMoved (BPoint newPosition)
 Hook method called when the list view is moved. More...
 
virtual void TargetedByScrollView (BScrollView *view)
 Hook method called when the list view is attached to a BScrollView. More...
 
virtual void WindowActivated (bool active)
 Hook method that is called when the window becomes the active window or gives up that status. More...
 
virtual void MessageReceived (BMessage *message)
 Hook method called when a message is received by the list view. More...
 
virtual void KeyDown (const char *bytes, int32 numBytes)
 Hook method that is called when a key is pressed while the view is the focus view of the active window. More...
 
virtual void MouseDown (BPoint where)
 Hook method that is called when a mouse button is pushed down while the cursor is contained in the view. More...
 
virtual void MouseUp (BPoint where)
 Hook method that is called when a mouse button is released while the cursor is contained in the view. More...
 
virtual void MouseMoved (BPoint where, uint32 code, const BMessage *dragMessage)
 Hook method that is called whenever the mouse cursor enters, exits or moves inside the list view. More...
 
virtual void SelectionChanged ()
 Hook method that is called when the selection changes. More...
 
virtual bool InitiateDrag (BPoint where, int32 index, bool wasSelected)
 Hook method called when a drag and drop operation is initiated. More...
 
Resizing
virtual void ResizeToPreferred ()
 Resize the view to its preferred size. More...
 
virtual void GetPreferredSize (float *_width, float *_height)
 Fill out the _width and _height parameters with the preferred width and height of the list view. More...
 
virtual BSize MinSize ()
 Returns the minimum size of the list view. More...
 
virtual BSize MaxSize ()
 Returns the maximum size of the list view. More...
 
virtual BSize PreferredSize ()
 Returns the preferred size of the list view. More...
 
Adding/Removing Items
virtual bool AddItem (BListItem *item, int32 atIndex)
 Add an item to the list view at the specified index. More...
 
virtual bool AddList (BList *newItems)
 Add a list of list items to the end of the list view. More...
 
virtual bool AddList (BList *newItems, int32 atIndex)
 Add a list of list items to the list view at the specified index. More...
 
virtual bool RemoveItem (BListItem *item)
 Remove the specified list item. More...
 
virtual BListItemRemoveItem (int32 index)
 Remove the item at index from the list. More...
 
virtual bool RemoveItems (int32 index, int32 count)
 Removes the items from index and the next count items. More...
 
Selection and Invocation Message Methods
virtual void SetSelectionMessage (BMessage *message)
 Sets the message that the list view sends when a new item is selected. More...
 
virtual void SetInvocationMessage (BMessage *message)
 
BMessageSelectionMessage () const
 Returns the message that is send when an item is selected. More...
 
uint32 SelectionCommand () const
 Returns the what parameter of the message that is send when an item is selected. More...
 
BMessageInvocationMessage () const
 Returns the message that is send when an item is invoked. More...
 
uint32 InvocationCommand () const
 Returns the what parameter of the current invocation method. More...
 
List Type Methods
virtual void SetListType (list_view_type type)
 Sets the list view type. More...
 
list_view_type ListType () const
 Returns the current list view type. More...
 
List Methods
BListItemItemAt (int32 index) const
 Returns the list item at the specified index. More...
 
int32 IndexOf (BPoint point) const
 Returns the index of the item at the specified point. More...
 
int32 IndexOf (BListItem *item) const
 Returns the index of the specified item. More...
 
BListItemFirstItem () const
 Returns a pointer to the first list item. More...
 
BListItemLastItem () const
 Returns a pointer to the last list item. More...
 
bool HasItem (BListItem *item) const
 Returns whether or not the list contains the specified item. More...
 
int32 CountItems () const
 Returns the number of items contained in the list view. More...
 
virtual void MakeEmpty ()
 Empties the list view of all items. More...
 
bool IsEmpty () const
 Returns whether or not the list view is empty. More...
 
void DoForEach (bool(*func)(BListItem *item))
 Calls the specified function on each item in the list. More...
 
void DoForEach (bool(*func)(BListItem *item, void *arg), void *arg)
 Calls the specified function on each item in the list. More...
 
const BListItem ** Items () const
 Returns a pointer to the list of list items. More...
 
Selection
void ScrollToSelection ()
 Scrolls to selected list item. More...
 
void Select (int32 index, bool extend=false)
 Selects the list item at the specified index. More...
 
void Select (int32 from, int32 to, bool extend=false)
 Select items from start to finish. More...
 
bool IsItemSelected (int32 index) const
 Returns whether or not the item at index is selected. More...
 
int32 CurrentSelection (int32 index=0) const
 Returns the index of a currently selected item relative to the passed in index. More...
 
Deselection
void DeselectAll ()
 Deselect all items. More...
 
void DeselectExcept (int32 exceptFrom, int32 exceptTo)
 Deselect all items except the items with index in the range of exceptFrom to exceptTo. More...
 
void Deselect (int32 index)
 Deselect the item at index. More...
 
- Public Member Functions inherited from BView
 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 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...
 
uint32 ResizingMode () const
 Returns the resizing mode flags mask set in the constructor or by SetResizingMode(). 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...
 
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...
 
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...
 
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...
 
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...
 
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...
 
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...
 
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 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 DrawAfterChildren (BRect updateRect)
 Perform any drawing that needs to be done after child view have already been drawn. More...
 
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...
 
BScrollBarScrollBar (orientation direction) const
 Returns the BScrollBar object that has the BView set as its target. 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...
 
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...
 
- 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...
 
- Public Member Functions inherited from BInvoker
 BInvoker ()
 Initializes a BInvoker without a message or target. More...
 
 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. More...
 
 BInvoker (BMessage *message, BMessenger target)
 Initializes the BInvoker with message and sets the target messenger where the message is sent when Invoke() is called. More...
 
virtual ~BInvoker ()
 Destructor method, deletes the BMessage object if set. More...
 
uint32 Command () const
 Returns the message's what data member. More...
 
BHandlerHandlerForReply () const
 Returns the previously set reply handler or NULL if not set. More...
 
status_t InvokeNotify (BMessage *message, uint32 kind=B_CONTROL_INVOKED)
 Sends the message to its target, using the notification code specified by kind. More...
 
bool IsTargetLocal () const
 Returns whether or not the invoker and its target belong to the same team. More...
 
BMessageMessage () const
 Returns a pointer to the invoker's message object. More...
 
BMessenger Messenger () const
 Returns the BMessenger object that the invoker uses to send its messages. More...
 
virtual status_t SetHandlerForReply (BHandler *handler)
 Sets the BHandler object responsible for handling reply messages. More...
 
virtual status_t SetMessage (BMessage *message)
 Assigns message to the invoker, deleting any previously assigned message. More...
 
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. More...
 
virtual status_t SetTarget (BMessenger messenger)
 Sets the invoker's target to messenger. More...
 
status_t SetTimeout (bigtime_t timeout)
 Sets the timeout to use when sending the message to the target. More...
 
bigtime_t Timeout () const
 Returns the current timeout value. More...
 

Protected Member Functions

virtual bool DoMiscellaneous (MiscCode code, MiscData *data)
 Do a miscellaneous action. More...
 
- Protected Member Functions inherited from BView
virtual void LayoutInvalidated (bool descendants=false)
 Hook method called when the layout is invalidated. More...
 
status_t ScrollWithMouseWheelDelta (BScrollBar *, float)
 Handle the scroll wheel changing over scrollbars. More...
 
virtual void DoLayout ()
 Layout view within the layout context. More...
 
virtual bool GetToolTipAt (BPoint point, BToolTip **_tip)
 Point _tip with the view's tool tip. More...
 
- Protected Member Functions inherited from BInvoker
void BeginInvokeNotify (uint32 kind=B_CONTROL_INVOKED)
 Implement this method to set up an InvokeNotify() context. More...
 
void EndInvokeNotify ()
 Implement this method to tear down an InvokeNotify() context. More...
 
uint32 InvokeKind (bool *_notify=NULL)
 Returns the kind set by InvokeNotify(). More...
 

Archiving

virtual status_t Archive (BMessage *data, bool deep=true) const
 Archive the BListView object to a message. More...
 
static BArchivableInstantiate (BMessage *data)
 Create a new BListView object from the message archive. More...
 

Additional Inherited Members

- Static Public Member Functions inherited from BView
static BArchivableInstantiate (BMessage *archive)
 Creates a new BView object from the data message. More...
 
- 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

Displays a list of items that the user can select and invoke.

BListView's can be one of two types set by the type parameter of the constructor:

An example of a BListView looks like this:

BListView_example.png

Click on an item to select it and double-click an item to invoke it. The BListView doesn't define what it means to "invoke" an item. See BListView::SetSelectionMessage() and BListView::SetInvocationMessage() to set a message to be set when these actions occur. You can also select and invoke items with keyboard keys such as the up and down arrow keys, Page Up and Page Down and the Enter key or Space key to invoke the item.

This class is based on the BList class from the Support Kit and many of the methods it uses behave similarly.

Although a BListView is scrollable, it doesn't provide scroll bars by itself. You should add the BListView as a child of a BScrollView to make it scrollable.

The code to add a BListView to a BScrollView looks something like this:

BListView* list = new BListView(frame, "List", B_SINGLE_SELECTION_LIST);
list->AddItem(new BStringItem("Item 1"));
list->AddItem(new BStringItem("Item 2"));
...
view->AddChild(new BScrollView("scroll_view", list,
B_FOLLOW_LEFT | B_FOLLOW_TOP, 0, false, true));
See also
BScrollView for more information on scrolling views.
BList in the Support Kit.
BOutlineListView
BListItem
Since
BeOS R3

Constructor & Destructor Documentation

◆ BListView() [1/4]

BListView::BListView ( BRect  frame,
const char *  name,
list_view_type  type = B_SINGLE_SELECTION_LIST,
uint32  resizingMode = B_FOLLOW_LEFT_TOP,
uint32  flags = B_WILL_DRAW | B_FRAME_EVENTS | B_NAVIGABLE 
)

Creates a new list view. This is the non-layout constructor.

Parameters
frameThe frame rectangle of the view.
nameThe name of the view.
typeWhether the list view supports a single selection or multiple selections.
resizingModeThe resizing mode flags. See BView for details.
flagsThe view flags. See BView for details.
Since
BeOS R3

◆ BListView() [2/4]

BListView::BListView ( const char *  name,
list_view_type  type = B_SINGLE_SELECTION_LIST,
uint32  flags = B_WILL_DRAW | B_FRAME_EVENTS | B_NAVIGABLE 
)

Creates a new list view suitable as part of a layout with the specified name, type, and flags.

Parameters
nameThe name of the view.
typeWhether the list view supports a single selection or multiple selections.
flagsThe view flags. See BView for details.
Since
Haiku R1

◆ BListView() [3/4]

BListView::BListView ( list_view_type  type = B_SINGLE_SELECTION_LIST)

Creates a new list view suitable as part of a layout.

Parameters
typeWhether the list view supports a single selection or multiple selections.
Since
Haiku R1

◆ BListView() [4/4]

BListView::BListView ( BMessage archive)

Creates a BListView object from the archive message.

Parameters
archiveThe message to create the object from.
Since
BeOS R3

◆ ~BListView()

BListView::~BListView ( )
virtual

Delete the BListView object and free the memory used by it.

This method does not free the attached list items.

Since
BeOS R3

Member Function Documentation

◆ AddItem()

bool BListView::AddItem ( BListItem item,
int32  index 
)
virtual

Add an item to the list view at the specified index.

Parameters
itemThe list item to add.
indexThe index of where to add the list item, if not specified the item is added to the end.
Returns
true if the list item was added, false otherwise.
Since
BeOS R3

Reimplemented in BOutlineListView.

◆ AddList() [1/2]

bool BListView::AddList ( BList list)
virtual

Add a list of list items to the end of the list view.

Parameters
listThe list of list items to add.
Returns
true if the list was added, false otherwise.
Since
BeOS R3

Reimplemented in BOutlineListView.

◆ AddList() [2/2]

bool BListView::AddList ( BList list,
int32  index 
)
virtual

Add a list of list items to the list view at the specified index.

Parameters
listThe list of list items to add.
indexThe index of where to add the list, if not specified the list is added to the end.
Returns
true if the list was added, false otherwise.
Since
BeOS R3

Reimplemented in BOutlineListView.

◆ AllAttached()

void BListView::AllAttached ( )
virtual

Hook method called once all views are attached to the view.

Since
BeOS R3

Reimplemented from BView.

Reimplemented in BOutlineListView.

◆ AllDetached()

void BListView::AllDetached ( )
virtual

Hook method called once all views are detached from the view.

Since
BeOS R3

Reimplemented from BView.

Reimplemented in BOutlineListView.

◆ Archive()

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

Archive the BListView object to a 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 BView.

Reimplemented in BOutlineListView.

◆ AttachedToWindow()

void BListView::AttachedToWindow ( )
virtual

Hook method called when the list view is added to the view hierarchy.

Since
BeOS R3

Reimplemented from BView.

◆ CountItems()

int32 BListView::CountItems ( ) const

Returns the number of items contained in the list view.

Returns
The number of items.
Since
BeOS R3

◆ CurrentSelection()

int32 BListView::CurrentSelection ( int32  index = 0) const

Returns the index of a currently selected item relative to the passed in index.

If the index of the selected item is lower than index the value returned is negative, if the index of the selected item is greater than index the value returned is positive. If the index of the selected item is equal to index then 0 is returned.

Parameters
indexThe index of the item to get relative to the selected item's index.
Since
BeOS R3

◆ Deselect()

void BListView::Deselect ( int32  index)

Deselect the item at index.

Parameters
indexThe index of the item to deselect.
Since
BeOS R3

◆ DeselectAll()

void BListView::DeselectAll ( )

Deselect all items.

Since
BeOS R3

◆ DeselectExcept()

void BListView::DeselectExcept ( int32  exceptFrom,
int32  exceptTo 
)

Deselect all items except the items with index in the range of exceptFrom to exceptTo.

Parameters
exceptFromThe index of the start of the exception list.
exceptToThe index of the end of the exception list.
Since
BeOS R3

◆ DetachedFromWindow()

void BListView::DetachedFromWindow ( )
virtual

Hook method that is called when the list view is removed from the view hierarchy.

Since
BeOS R3

Reimplemented from BView.

Reimplemented in BOutlineListView.

◆ DoForEach() [1/2]

void BListView::DoForEach ( bool(*)(BListItem *item)  func)

Calls the specified function on each item in the list.

The func is called on the items in order starting with the item at index 0 and ending at the last item in the list. This method stops calling the func once it returns true or the end of the list is reached.

The first argument of func is a pointer to the list item.

Parameters
funcThe function to call on each item.
Since
BeOS R3

◆ DoForEach() [2/2]

void BListView::DoForEach ( bool(*)(BListItem *item, void *arg)  func,
void *  arg 
)

Calls the specified function on each item in the list.

The func is called on the items in order starting with the item at index 0 and ending at the last item in the list. This method stops calling the func once it returns true or the end of the list is reached.

The first argument of func is a pointer to the list item, arg is passed in as the second argument.

Parameters
funcThe function to call on each item.
argThe second argument of the function.
Since
BeOS R3

◆ DoMiscellaneous()

bool BListView::DoMiscellaneous ( MiscCode  code,
MiscData *  data 
)
protectedvirtual

Do a miscellaneous action.

Parameters
codeThe action code to use.
  • B_NO_OP: Do nothing
  • B_REPLACE_OP: Replace the item in data
  • B_MOVE_OP: Move the item in data.
  • B_SWAP_OP: Swap the items in data.
dataThe data to act on.
Since
Haiku R1

Reimplemented in BOutlineListView.

◆ Draw()

void BListView::Draw ( BRect  updateRect)
virtual

Hook method called to draw the contents of the text view.

You should not have to call this method directly, use Invalidate() instead.

Parameters
updateRectThe rectangular area to draw.
See also
BView::Draw()
Since
BeOS R3

Reimplemented from BView.

◆ FirstItem()

BListItem * BListView::FirstItem ( ) const

Returns a pointer to the first list item.

Returns
A pointer to the first item in the list or NULL there are no items.
Since
BeOS R3

◆ FrameMoved()

void BListView::FrameMoved ( BPoint  newPosition)
virtual

Hook method called when the list 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 from BView.

Reimplemented in BOutlineListView.

◆ FrameResized()

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

Hook method called when the list view is resized.

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

Reimplemented from BView.

Reimplemented in BOutlineListView.

◆ GetPreferredSize()

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

Fill out the _width and _height parameters with the preferred width and height of the list view.

Parameters
_widthThe list view's preferred width is written to _width.
_heightThe list view's preferred height is written to _height.
See also
BView::GetPreferredSize()
Since
BeOS R3

Reimplemented from BView.

Reimplemented in BOutlineListView.

◆ GetSupportedSuites()

status_t BListView::GetSupportedSuites ( BMessage data)
virtual

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

Since
BeOS R3

Reimplemented from BView.

Reimplemented in BOutlineListView.

◆ HasItem()

bool BListView::HasItem ( BListItem item) const

Returns whether or not the list contains the specified item.

Parameters
itemThe list item to check.
Returns
true if item is in the list, false otherwise.
Since
BeOS R3

◆ IndexOf() [1/2]

int32 BListView::IndexOf ( BPoint  point) const

Returns the index of the item at the specified point.

Parameters
pointThe location of the list item to get the index of.
Returns
The index of the list item at the specified point.
Since
BeOS R3

◆ IndexOf() [2/2]

int32 BListView::IndexOf ( BListItem item) const

Returns the index of the specified item.

Parameters
itemThe list item to get the index of.
Returns
The index of the specified item.
Since
BeOS R3

◆ InitiateDrag()

bool BListView::InitiateDrag ( BPoint  point,
int32  index,
bool  wasSelected 
)
virtual

Hook method called when a drag and drop operation is initiated.

This method is used by derived classes to implement drag and drop. This method is called by the MouseDown() method. If the derived class initiates the drag & drop operation you should return true, otherwise return false. By default this method returns false.

Parameters
pointWhere the drag & drop operation started.
index
wasSelectedIndicates whether or not the item was selected.
Returns
true if a drag & drop operation was initiated, false otherwise.
Since
BeOS R3

◆ Instantiate()

BArchivable * BListView::Instantiate ( BMessage archive)
static

Create a new BListView object from the message archive.

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

◆ InvalidateItem()

void BListView::InvalidateItem ( int32  index)

Draws the list item at the specified index.

Parameters
indexThe index of the list item to draw.
Since
Haiku R1

◆ InvocationCommand()

uint32 BListView::InvocationCommand ( ) const

Returns the what parameter of the current invocation method.

Returns
The what parameter of the currently set invocation method.
See also
BInvoker::Command()
Since
BeOS R3

◆ InvocationMessage()

BMessage * BListView::InvocationMessage ( ) const

Returns the message that is send when an item is invoked.

Returns
The current invocation method as a BMessage.
See also
BInvoker::Message()
Since
BeOS R3

◆ Invoke()

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

Invoke the list view, either with the current invocation message or message if it is specified.

Parameters
messageThe message to send or NULL to send the current invocation message.
See also
BControl::Invoke()
Since
BeOS R3

Reimplemented from BInvoker.

◆ IsEmpty()

bool BListView::IsEmpty ( ) const

Returns whether or not the list view is empty.

Returns
true if the list view is empty, false otherwise.
Since
BeOS R3

◆ IsItemSelected()

bool BListView::IsItemSelected ( int32  index) const

Returns whether or not the item at index is selected.

Returns
true if the item was selected, false otherwise.
Since
BeOS R3

◆ ItemAt()

BListItem * BListView::ItemAt ( int32  index) const

Returns the list item at the specified index.

Parameters
index
Returns
The list item at the specified index.
Since
BeOS R3

◆ ItemFrame()

BRect BListView::ItemFrame ( int32  index)

Return the frame of the item at the specified index.

Parameters
indexThe index of the item to get the frame of.
Returns
The frame of the item at index.
Since
BeOS R3

◆ Items()

const BListItem ** BListView::Items ( ) const

Returns a pointer to the list of list items.

Returns
a pointer to the list of list items.
Since
BeOS R3

◆ KeyDown()

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

Hook method that is called when a key is pressed while the view is the focus view of the active window.

The following keys are used by the list view by default:

  • Up Arrow Selects the previous item.
  • Down Arrow Selects the next item.
  • Page Up Selects the item one view height above the current item.
  • Page Down Selects the item one view height below the current item.
  • Home Selects the first item in the list.
  • End Select the last item in the list.
  • Enter and Spacebar Invokes the currently selected item.
Parameters
bytesThe bytes representing the keys pushed down.
numBytesThe size of bytes.
See also
BView::KeyDown()
Since
BeOS R3

Reimplemented from BView.

Reimplemented in BOutlineListView.

◆ LastItem()

BListItem * BListView::LastItem ( ) const

Returns a pointer to the last list item.

Returns
A pointer to the last item in the list or NULL there are no items.
Since
BeOS R3

◆ ListType()

list_view_type BListView::ListType ( ) const

Returns the current list view type.

Returns
The list view type.
Since
BeOS R3

◆ MakeEmpty()

void BListView::MakeEmpty ( )
virtual

Empties the list view of all items.

Since
BeOS R3

Reimplemented in BOutlineListView.

◆ MakeFocus()

void BListView::MakeFocus ( bool  focused = true)
virtual

Highlight or unhighlight the selection when the list view acquires or loses its focus state.

Parameters
focusedtrue to receive focus or false to lose it.
See also
BView::MakeFocus()
Since
BeOS R3

Reimplemented from BView.

Reimplemented in BOutlineListView.

◆ MaxSize()

BSize BListView::MaxSize ( )
virtual

Returns the maximum size of the list view.

Returns
The maximum size of the list view as a BSize.
See also
BView::MaxSize()
Since
Haiku R1

Reimplemented from BView.

◆ MessageReceived()

void BListView::MessageReceived ( BMessage message)
virtual

Hook method called when a message is received by the list view.

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

Reimplemented from BView.

Reimplemented in BOutlineListView.

◆ MinSize()

BSize BListView::MinSize ( )
virtual

Returns the minimum size of the list view.

Returns
The minimum size of the list view as a BSize.
See also
BView::MinSize()
Since
Haiku R1

Reimplemented from BView.

◆ MouseDown()

void BListView::MouseDown ( BPoint  point)
virtual

Hook method that is called when a mouse button is pushed down while the cursor is contained in the view.

By default this method selects items on a single click, and invokes them on a double click. This method calls InitiateDrag() to allow derived classes the opportunity to drag and drop items from the list.

Parameters
pointThe point where the mouse button was pushed down.
See also
BView::MouseDown()
Since
BeOS R3

Reimplemented from BView.

Reimplemented in BOutlineListView.

◆ MouseMoved()

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

Hook method that is called whenever the mouse cursor enters, exits or moves inside the list view.

Parameters
whereThe point where the mouse cursor has moved to.
codeA code which indicating if the mouse entered or exited the view.
dragMessageA message containing drag and drop information.
See also
BView::MouseMoved()
Since
BeOS R3

Reimplemented from BView.

◆ MouseUp()

void BListView::MouseUp ( BPoint  where)
virtual

Hook method that is called when a mouse button is released while the cursor is contained in the view.

Parameters
whereThe location that the mouse button was released.
See also
BView::MouseUp()
Since
BeOS R3

Reimplemented from BView.

Reimplemented in BOutlineListView.

◆ MoveItem()

bool BListView::MoveItem ( int32  from,
int32  to 
)

Move the item at index from to the position in the list at index to.

Parameters
fromThe index of the item to move.
toThe index to move the item to.
Returns
true if the item was moved, false otherwise.
Since
BeOS R3

◆ Perform()

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

Performs an action give a perform_code and data. (Internal Method)

Reimplemented from BView.

Reimplemented in BOutlineListView.

◆ PreferredSize()

BSize BListView::PreferredSize ( )
virtual

Returns the preferred size of the list view.

Returns
The preferred size of the list view as a BSize.
See also
BView::PreferredSize()
Since
Haiku R1

Reimplemented from BView.

◆ RemoveItem() [1/2]

bool BListView::RemoveItem ( BListItem item)
virtual

Remove the specified list item.

Parameters
itemThe list item to remove.
Returns
true if the item was removed, false otherwise.
Since
BeOS R3

Reimplemented in BOutlineListView.

◆ RemoveItem() [2/2]

BListItem * BListView::RemoveItem ( int32  index)
virtual

Remove the item at index from the list.

Parameters
indexThe index of the item to remove.
Returns
true if the item was removed, false otherwise.
Since
BeOS R3

Reimplemented in BOutlineListView.

◆ RemoveItems()

bool BListView::RemoveItems ( int32  index,
int32  count 
)
virtual

Removes the items from index and the next count items.

Parameters
indexThe location to start removing items from.
countThe number of items past index to remove.

return true if the items were removed, false otherwise.

Since
BeOS R3

Reimplemented in BOutlineListView.

◆ ReplaceItem()

bool BListView::ReplaceItem ( int32  index,
BListItem item 
)

Replace the item at index index with item.

Parameters
indexThe index of the item to replace.
itemThe item to replace the item at index with.
Returns
true if the item was replaced, false otherwise.
Since
BeOS R3

◆ ResizeToPreferred()

void BListView::ResizeToPreferred ( )
virtual

Resize the view to its preferred size.

See also
BView::ResizeToPreferred()
Since
BeOS R3

Reimplemented from BView.

Reimplemented in BOutlineListView.

◆ ResolveSpecifier()

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

Determines the proper handler for the passed in 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 BOutlineListView.

◆ ScrollTo()

void BListView::ScrollTo ( BPoint  point)
virtual

Scroll the view to the specified point.

Parameters
pointThe location to scroll the list view to.
See also
BView::ScrollTo()
Since
BeOS R3

Reimplemented from BView.

◆ ScrollToSelection()

void BListView::ScrollToSelection ( )

Scrolls to selected list item.

Since
BeOS R3

◆ Select() [1/2]

void BListView::Select ( int32  index,
bool  extend = false 
)

Selects the list item at the specified index.

Parameters
indexThe index of the item to select.
extendWhether or not to also select child items.
Since
BeOS R3

◆ Select() [2/2]

void BListView::Select ( int32  start,
int32  finish,
bool  extend = false 
)

Select items from start to finish.

Parameters
startThe index of the item to start the selection.
finishThe index of the item to end the selection.
extendWhether or not to also select child items.
Since
BeOS R3

◆ SelectionChanged()

void BListView::SelectionChanged ( )
virtual

Hook method that is called when the selection changes.

This method should be implemented by derived classes, the default implementation does nothing.

Since
BeOS R3

◆ SelectionCommand()

uint32 BListView::SelectionCommand ( ) const

Returns the what parameter of the message that is send when an item is selected.

Returns
The what parameter of the current selection message.
Since
BeOS R3

◆ SelectionMessage()

BMessage * BListView::SelectionMessage ( ) const

Returns the message that is send when an item is selected.

Returns
The current selection message as a BMessage.
Since
BeOS R3

◆ SetFont()

void BListView::SetFont ( const BFont font,
uint32  mask = B_FONT_ALL 
)
virtual

Sets the font of the list view to font with the font parameters set by mask.

Parameters
fontThe font to set the list view to.
maskA mask indicating which properties of font to set.
See also
BView::SetFont()
Since
BeOS R3

Reimplemented from BView.

◆ SetInvocationMessage()

void BListView::SetInvocationMessage ( BMessage message)
virtual

Sets the message that the list view sends when an item is invoked.

Parameters
messageThe invocation message to set.
See also
BInvoker::SetMessage()
Since
BeOS R3

◆ SetListType()

void BListView::SetListType ( list_view_type  type)
virtual

Sets the list view type.

Since
BeOS R3
Parameters
typeThe list view type to set.

◆ SetSelectionMessage()

void BListView::SetSelectionMessage ( BMessage message)
virtual

Sets the message that the list view sends when a new item is selected.

Parameters
messageThe selection message to set.
Since
BeOS R3

◆ SortItems()

void BListView::SortItems ( int(*)(const void *, const void *)  cmp)

Sort the items according the the passed in cmp function.

Parameters
cmpThe compare function to use to sort the items.
Since
BeOS R3

◆ SwapItems()

bool BListView::SwapItems ( int32  a,
int32  b 
)

Swap item a with item b.

Parameters
aThe index of the first item to swap.
bThe index of the second item to swap.
Returns
true if the items were swapped, false otherwise.
Since
BeOS R3

◆ TargetedByScrollView()

void BListView::TargetedByScrollView ( BScrollView view)
virtual

Hook method called when the list view is attached to a BScrollView.

Parameters
viewThe BScrollView the list view is attached to.
Since
BeOS R3

Reimplemented from BView.

◆ WindowActivated()

void BListView::WindowActivated ( bool  active)
virtual

Hook method that is called when the window becomes the active window or gives up that status.

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

Reimplemented from BView.