/// <summary>
        /// Initializes a new instance of the <see cref="ErrorToolbar"/> class.
        /// </summary>
        /// <param name="commandDispatcher">The command dispatcher.</param>
        /// <param name="graphView">The graph view to which to attach the toolbar.</param>
        public ErrorToolbar(CommandDispatcher commandDispatcher, GraphView graphView) : base(commandDispatcher, graphView)
        {
            name = "errorToolbar";
            this.AddStylesheet("ErrorToolbar.uss");
            // TODO VladN: fix for light skin, remove when GTF supports light skin
            if (!EditorGUIUtility.isProSkin)
            {
                this.AddStylesheet("ErrorToolbar_lightFix.uss");
            }

            var tpl = GraphElementHelper.LoadUXML("ErrorToolbar.uxml");

            tpl.CloneTree(this);

            m_ErrorIconLabel = this.MandatoryQ("errorIconLabel");

            m_PreviousErrorButton         = this.MandatoryQ <ToolbarButton>("previousErrorButton");
            m_PreviousErrorButton.tooltip = "Go To Previous Error";
            m_PreviousErrorButton.ChangeClickEvent(OnPreviousErrorButton);

            m_NextErrorButton         = this.MandatoryQ <ToolbarButton>("nextErrorButton");
            m_NextErrorButton.tooltip = "Go To Next Error";
            m_NextErrorButton.ChangeClickEvent(OnNextErrorButton);

            m_ErrorCounterLabel = this.MandatoryQ <Label>("errorCounterLabel");

            m_CurrentErrorIndex = 0;
        }
Esempio n. 2
0
        /// <summary>
        /// Initializes a new instance of the <see cref="ResizableElement"/> class.
        /// </summary>
        public ResizableElement()
        {
            GraphElementHelper.LoadTemplateAndStylesheet(this, "Resizable", ussClassName);

            foreach (ResizerDirection value in Enum.GetValues(typeof(ResizerDirection)))
            {
                var resizer = this.SafeQ(value.ToString().ToLower() + "-resize");
                if (resizer != null)
                {
                    resizer.AddManipulator(new ElementResizer(this, value));
                }
            }

            foreach (ResizerDirection vertical in new[] { ResizerDirection.Top, ResizerDirection.Bottom })
            {
                foreach (ResizerDirection horizontal in new[] { ResizerDirection.Left, ResizerDirection.Right })
                {
                    var resizer = this.SafeQ(vertical.ToString().ToLower() + "-" + horizontal.ToString().ToLower() + "-resize");
                    if (resizer != null)
                    {
                        resizer.AddManipulator(new ElementResizer(this, vertical | horizontal));
                    }
                }
            }

            pickingMode = PickingMode.Ignore;
            AddToClassList(ussClassName);
        }
        /// <inheritdoc />
        protected override void BuildElementUI()
        {
            base.BuildElementUI();

            if (s_ValueTemplate == null)
            {
                s_ValueTemplate = GraphElementHelper.LoadUXML("ValueBadge.uxml");
            }

            s_ValueTemplate.CloneTree(this);
            m_TextElement = this.SafeQ <Label>("desc");
            m_Image       = this.SafeQ <Image>();
        }
Esempio n. 4
0
        /// <summary>
        /// Initializes a new instance of the <see cref="MainToolbar"/> class.
        /// </summary>
        /// <param name="commandDispatcher">The command dispatcher.</param>
        /// <param name="graphView">The graph view to which to attach the toolbar.</param>
        public MainToolbar(CommandDispatcher commandDispatcher, GraphView graphView) : base(commandDispatcher, graphView)
        {
            AddToClassList(ussClassName);

            this.AddStylesheet("MainToolbar.uss");
            this.AddStylesheet(EditorGUIUtility.isProSkin ? "MainToolbar_dark.uss" : "MainToolbar_light.uss");

            var tpl = GraphElementHelper.LoadUXML("MainToolbar.uxml");

            tpl.CloneTree(this);

            m_NewGraphButton         = this.MandatoryQ <ToolbarButton>(NewGraphButton);
            m_NewGraphButton.tooltip = "New Graph";
            m_NewGraphButton.ChangeClickEvent(OnNewGraphButton);

            m_SaveAllButton         = this.MandatoryQ <ToolbarButton>(SaveAllButton);
            m_SaveAllButton.tooltip = "Save All";
            m_SaveAllButton.ChangeClickEvent(OnSaveAllButton);

            m_BuildAllButton         = this.MandatoryQ <ToolbarButton>(BuildAllButton);
            m_BuildAllButton.tooltip = "Build All";
            m_BuildAllButton.ChangeClickEvent(OnBuildAllButton);

            m_ShowMiniMapButton         = this.MandatoryQ <ToolbarButton>(ShowMiniMapButton);
            m_ShowMiniMapButton.tooltip = "Show MiniMap";
            m_ShowMiniMapButton.ChangeClickEvent(ShowGraphViewToolWindow <GraphViewMinimapWindow>);

            m_ShowBlackboardButton         = this.MandatoryQ <ToolbarButton>(ShowBlackboardButton);
            m_ShowBlackboardButton.tooltip = "Show Blackboard";
            m_ShowBlackboardButton.ChangeClickEvent(ShowGraphViewToolWindow <GraphViewBlackboardWindow>);

            m_Breadcrumb = this.MandatoryQ <ToolbarBreadcrumbs>("breadcrumb");

            m_EnableTracingButton         = this.MandatoryQ <ToolbarToggle>(EnableTracingButton);
            m_EnableTracingButton.tooltip = "Toggle Tracing For Current Instance";
            m_EnableTracingButton.RegisterValueChangedCallback(e => m_CommandDispatcher.Dispatch(new ActivateTracingCommand(e.newValue)));

            m_OptionsButton         = this.MandatoryQ <ToolbarButton>(OptionsButton);
            m_OptionsButton.tooltip = "Options";
            m_OptionsButton.ChangeClickEvent(OnOptionsButton);

            RegisterCallback <AttachToPanelEvent>(OnEnterPanel);
            RegisterCallback <DetachFromPanelEvent>(OnLeavePanel);
        }