-
Notifications
You must be signed in to change notification settings - Fork 15
Bar Panel Widget
The DUXBetaBarPanelWidget
belongs to the cluster of panel widgets. A Bar Panel Widget is a collection of simple widgets that can be grouped together in two orientations:
DUXBetaPanelVariant.horizontal
DUXBetaPanelVariant.vertical
This type of DUXBetaPanelWidget
is primarily used for the application's top bar or other similarly sized widgets.
The Bar Panel Widget is split into two lists: left and right (in vertical orientation left is equivalent to top and right to bottom.) Once a Bar Panel Widget has been created, widgets can be added to the left or right side. Bar Panel Widgets don't have a titlebar.
An example of a Bar Panel Widget is the TopBarPanelWidget
When creating a DUXBetaBarPanelWidget
, the configuration object specifies the widget type (DUXBetaPanelType
) and variant (DUXBetaPanelVariant
). Note, a Bar Panel Widget does not have a titlebar.
let barConfigObject = DUXBetaPanelWidgetConfiguration(type: .bar, variant: .horizontal)
let myBarPanel = DUXBetaBarPanel().configure(barConfigObject)
DUXBetaPanelWidgetConfiguration *barConfigObject = [DUXBetaPanelWidgetConfiguration alloc] initWithType:DUXBetaPanelTypeBar variant::DUXBetaPanelVariantHorizontal];
DUXBetaBarPanel *myBarPanel = [[[DUXBetaBarPanel alloc] init] configure:barConfigObject];
It may be appropriate for a bar panel to have margins around it for visual clarity of its widgets. To add margins, simple call the setBarMargins
method or set the margins individually.
barPanel.setBarMargins(marginInsets: UIEdgeInsets(top: 10.0, left: 5.0, bottom: 10.0, right: 5.0)
barPanel.topMargin = 10.0
barPanel.leftMargin = 5.0
barPanel.bottomMargin = 10.0
barPanel.rightMargin = 5.0
[barPanel setBarMarginsWithMarginInsets: UIEdgeInsetsMake(10.0, 5.0, 10.0, 5.0)];
barPanel.topMargin = 10.0
barPanel.leftMargin = 5.0
barPanel.bottomMargin = 10.0
barPanel.rightMargin = 5.0
Bar Panel Widgets are manipulated by adding and removing widgets. You can retrieve the widget count, append widgets, insert widgets at a specific index, or remove widgets dynamically to either the left or right side. To initialize the Bar Panel Widget with widgets, pass an array of widgets when calling addRightWidgetArray
, addLeftWidgetArray
, or addWidgetArray
. All list indexes are 0 based and index from leading to trailing (normally left to right.)
The method widgetCount
returns the number of widgets on the right hand side of a bar panel. For explicit access to either side, use rightWidgetCount
or leftWidgetCount
.
func widgetCount() -> Int
func rightWidgetCount() -> Int
func leftWidgetCount() -> Int
- (NSInteger)widgetCount;
- (NSInteger)rightWidgetCount;
- (NSInteger)leftWidgetCount;
The add methods are used to append an array of widgets to the end of the current widget list in the bar panel. To add a single widget, pass the widget wrapped in an array.
Inserting widgets into the middle of a bar is done one at a time. The bar index is 0 based, and you pass the index at which you want the new widget to, moving all the other widgets over in the bar. Pass an index of 0 to insert into the leading end of the bar panel section.
func addWidgetArray(displayWidgets: [ DUXBetaBaseWidget ])
func addRightWidgetArray(_ displayWidgets: [DUXBetaBaseWidget])
func addLeftWidgetArray(_ displayWidgets: [DUXBetaBaseWidget])
func insert(widget: DUXBetaBaseWidget, atIndex: Int)
func insertRightWidget(_ widget: DUXBetaBaseWidget, atIndex: Int)
func insertLeftWidget(_ widget: DUXBetaBaseWidget, atIndex: Int)
- (void)addWidgetArray:(NSArray<DUXBetaBaseWidget*>)displayWidgets;
- (void)addRightWidgetArray:(NSArray<DUXBetaBaseWidget *> * _Nonnull)displayWidgets;
- (void)addLeftWidgetArray:(NSArray<DUXBetaBaseWidget *> * _Nonnull)displayWidgets;
- (void)insertWithWidget:(DUXBetaBaseWidget)widget atIndex:(NSInteger)index;
- (void)insertRightWidget:(DUXBetaBaseWidget * _Nonnull)widget atIndex:(NSInteger)atIndex;
- (void)insertLeftWidget:(DUXBetaBaseWidget * _Nonnull)widget atIndex:(NSInteger)atIndex;
The removeWidget
calls are fairly self-explanatory. Use the AtIndex
version to remove a widget at a given index and the remove All
, Right
, or Left
methods to remove the appropriate widgets. As usual, the methods which don't specify a side apply to the right side.
func removeWidget(atIndex: Int)
func removeRightWidget(atIndex: Int)
func removeLeftWidget(atIndex: Int)
func removeAllWidgets()
func removeRightWidgets()
func removeLeftWidgets()
- (void)removeWidgetAtIndex:(NSInteger)index;
- (void)removeRightWidgetAtIndex:(NSInteger)atIndex;
- (void)removeLeftWidgetAtIndex:(NSInteger)atIndex;
- (void)removeAllWidgets;
- (void)removeRightWidgets;
- (void)removeLeftWidgets;
DJI UX SDK Version 5 Beta 4.1