Ejemplo n.º 1
0
        public void OpenContextMenu(DragList dropList)
        {
            var itemGetter = _contextMenuHandlers.TryGetValue(dropList.ListType);

            if (itemGetter != null)
            {
                ImguiUtil.OpenContextMenu(itemGetter());
            }
        }
Ejemplo n.º 2
0
        void DrawSearchPane(Rect rect)
        {
            Assert.That(ShowSortPane);

            var startX = rect.xMin;
            var endX   = rect.xMax;
            var startY = rect.yMin;
            var endY   = rect.yMax;

            var skin = _pmSettings.ReleasesPane;

            ImguiUtil.DrawColoredQuad(rect, skin.IconRowBackgroundColor);

            endX = rect.xMax - 2 * skin.ButtonWidth;

            var searchBarRect = Rect.MinMaxRect(startX, startY, endX, endY);

            if (GUI.enabled && searchBarRect.Contains(Event.current.mousePosition))
            {
                ImguiUtil.DrawColoredQuad(searchBarRect, skin.MouseOverBackgroundColor);
            }

            GUI.Label(new Rect(startX + skin.SearchIconOffset.x, startY + skin.SearchIconOffset.y, skin.SearchIconSize.x, skin.SearchIconSize.y), skin.SearchIcon);

            this.SearchFilter = GUI.TextField(
                searchBarRect, this.SearchFilter, skin.SearchTextStyle);

            startX = endX;
            endX   = startX + skin.ButtonWidth;

            Rect buttonRect;

            buttonRect = Rect.MinMaxRect(startX, startY, endX, endY);
            if (buttonRect.Contains(Event.current.mousePosition))
            {
                ImguiUtil.DrawColoredQuad(buttonRect, skin.MouseOverBackgroundColor);

                if (Event.current.type == EventType.MouseDown)
                {
                    SortDescending = !SortDescending;
                    this.UpdateIndices();
                }
            }
            GUI.DrawTexture(buttonRect, SortDescending ? skin.SortDirUpIcon : skin.SortDirDownIcon);

            startX = endX;
            endX   = startX + skin.ButtonWidth;

            buttonRect = Rect.MinMaxRect(startX, startY, endX, endY);
            if (buttonRect.Contains(Event.current.mousePosition))
            {
                ImguiUtil.DrawColoredQuad(buttonRect, skin.MouseOverBackgroundColor);

                if (Event.current.type == EventType.MouseDown && !_sortMethodCaptions.IsEmpty())
                {
                    var startPos = new Vector2(buttonRect.xMin, buttonRect.yMax);
                    ImguiUtil.OpenContextMenu(startPos, CreateSortMethodContextMenuItems());
                }
            }
            GUI.DrawTexture(buttonRect, skin.SortIcon);
        }