public PaginatedListView(string label, Func <TElement> makeElement, Action <int, TData, TElement> bindElement, int elementsPerPage = 5) { this.bindElement = bindElement; this.elementsPerPage = elementsPerPage; var template = AssetDatabase.LoadAssetAtPath <VisualTreeAsset>(UxmlPath); template.CloneTree(this); this.Q <Label>(name: "list-name").text = label; container = this.Q <VisualElement>(className: "user-defined-type-container-data"); controlsContainer = this.Q <VisualElement>(className: "paginated-list-controls"); pageCounter = this.Q <Label>(name: "page-counter"); backButton = this.Q <Button>(name: "back-button"); backButton.clickable.clicked += () => ChangePageCount(-1); forwardButton = this.Q <Button>(name: "forward-button"); forwardButton.clickable.clicked += () => ChangePageCount(1); elementPool = new ElementPool <TElement>(makeElement); concealer = new VisualElementConcealer(this); }
public PaginatedMapView(string label, Func <TKeyElement> makeKey, Action <TKeyData, TKeyElement> bindKey, Func <TValueElement> makeValue, Action <TValueData, TValueElement> bindValue) { list = new PaginatedListView <KeyValuePairElement, KeyValuePair <TKeyData, TValueData> >(label, () => new KeyValuePairElement(makeKey(), makeValue(), bindKey, bindValue), (index, kvp, element) => element.Update(kvp)); Add(list); concealer = new VisualElementConcealer(this); }
protected OptionalVisualElementBase(string label, TElement innerElement, Action <TElement, TData> applyData) { AddToClassList("user-defined-type-container"); Add(new Label(label)); container = new VisualElement(); container.AddToClassList("user-defined-type-container-data"); Add(container); isEmptyLabel = new Label("Option is empty."); isEmptyLabel.AddToClassList("label-empty-option"); this.innerElement = innerElement; this.applyData = applyData; concealer = new VisualElementConcealer(this); }