BMenu: Add SortItems(), SwapItems() and MoveItem()
... methods which call the respective methods in BList. These convinience methods allow you to sort a menu of menu items via a compare function, swap two menu items, or move a menu item to a new index. Update items layout if menu is open. Previously there was no easy way to rearrange menu items in a menu. Change-Id: Ice3d6e5404e895196d8bd32d696dce7c55bd72d4 Reviewed-on: https://review.haiku-os.org/c/haiku/+/4296 Reviewed-by: John Scipione <[email protected]> Reviewed-by: waddlesplash <[email protected]> Tested-by: Commit checker robot <[email protected]>
This commit is contained in:
committed by
Adrien Destugues
parent
51d591cdfe
commit
0a53cbb3b9
@@ -170,6 +170,12 @@ public:
|
||||
void SetTrackingHook(menu_tracking_hook hook,
|
||||
void* state);
|
||||
|
||||
// Reorder items
|
||||
void SortItems(int (*compare)(const BMenuItem*,
|
||||
const BMenuItem*));
|
||||
bool SwapItems(int32 indexA, int32 indexB);
|
||||
bool MoveItem(int32 indexFrom, int32 indexTo);
|
||||
|
||||
private:
|
||||
friend class BMenuBar;
|
||||
friend class BSeparatorItem;
|
||||
|
||||
Reference in New Issue
Block a user