public TreeViewItem(EditorEditorWindow editor, VisualElement element) { var visualTree = AssetDatabase.LoadAssetAtPath <VisualTreeAsset>(string.Format(EditorEditorWindow.BasePath, "Styles/Editor/TreeViewItem.uxml")); root = visualTree.CloneTree(); this.editor = editor; targetElement = element; itemHandler = root.Q <Button>("dragHandler"); expandToggle = root.Q <Foldout>("expandChildren"); nameLabel = root.Q <Label>("elementName"); childContainer = root.Q <VisualElement>("container"); dropDisplayLine = childContainer.Q <VisualElement>("dropLine"); var type = targetElement.GetType(); root.Q <Label>("elementType").text = type.Name; UpdateDisplay(); expandToggle.value = false; SetVisible(childContainer, false); RegisterEvents(); }
public ToolbarButton(EditorEditorWindow editor, string sprite, string label, VisualElement root, Action <T> setup = null) { setupElement = setup; this.label = label; this.editor = editor; m_button = new Button(OnClick); m_button.AddToClassList("eeditor-toolbarButton"); var elements = new VisualElement(); //This will solve the button focusing issues when clicking to the right or left from var icon = new VisualElement(); icon.AddToClassList("eeditor-icon"); icon.style.backgroundImage = AssetDatabase.LoadAssetAtPath <Texture2D>( string.Format(EditorEditorWindow.BasePath, string.Format(spriteRoot, sprite)) ); elements.Add(icon); var lbl = new Label(label); elements.Add(lbl); m_button.Add(elements); m_button.AddManipulator(new DragStarterManipulator(this, editor)); root.Add(m_button); }
public DropTargetManipulator(EditorEditorWindow editor, DropTargetInfo dropInfo) { activators.Add(new ManipulatorActivationFilter { button = MouseButton.LeftMouse }); m_isHover = false; m_editor = editor; m_dropInfo = dropInfo; }
public DragStarterManipulator(IDraggableItem draggable, EditorEditorWindow editor) { activators.Add(new ManipulatorActivationFilter { button = MouseButton.LeftMouse }); m_active = false; m_draggable = draggable; m_editor = editor; }
public static void ShowExample() { EditorEditorWindow wnd = GetWindow <EditorEditorWindow>(); wnd.titleContent = new GUIContent("Editor Editor Window"); }