private Foldout CreateTablesFoldout() { var tablesFoldout = Factory.Foldout("TableFoldout", "Tables", nameof(tablesFoldoutClosed), this, tablesFoldoutClosed, "themeTable"); var createTableButton = Factory.Create <Button>("CreateTable", "large").Do(self => { self.text = "Create New Table"; self.clicked += () => CreateTableWindow.Display(Event.current.mousePosition + position.position + Vector2.up * 20, activeSettings.ActiveSettings); }); var searchField = Factory .Create <ToolbarSearchField>("TablesSearchField", "searchField", "themeTable") .Q <TextField>() .Do(self => { self.value = localeSearchQuery; var placeholder = self[0].AddGet <Label>("TablesSearchPlaceholder", "placeholderLabel"); placeholder.text = "Search tables"; if (!string.IsNullOrEmpty(tableSearchQuery)) { placeholder.AddToClassList("hidden"); } self.BindProperty(new SerializedObject(this).FindProperty(nameof(tableSearchQuery))); self.RegisterValueChangedCallback(evt => { if (string.IsNullOrEmpty(evt.newValue)) { placeholder.RemoveFromClassList("hidden"); } else { placeholder.AddToClassList("hidden"); } tableQueryChanged = true; }); }).NthParent <ToolbarSearchField>(1); tablesFoldout.Add(createTableButton); tablesFoldout.Add(searchField); tablesFoldout.Add(new IMGUIContainer(OnTablesGUI) { name = "TableEditor" }); return(tablesFoldout); }
private void CreateTable() { CreateTableWindow.Display(Event.current.mousePosition + position.position + Vector2.up * 20, settings, () => { TabClicked(tabs[tabs.Count - 1]); }); }