Пример #1
0
        private void CreateButtons()
        {
            topFoldersPaths = GetTopFoldersPaths(filesystemModel.CurrentPath);
            buttons         = new PathBarButton[topFoldersPaths.Count];

            Nodes.Add(rootArrowButton = new PathArrowButton(openPath));
            for (var i = topFoldersPaths.Count - 1; i >= 0; i--)
            {
                Nodes.Add(buttons[i] = new PathBarButton(openPath, topFoldersPaths[i]));
            }
        }
Пример #2
0
        public PathBarButton(Func <string, bool> openPath, string path) : base()
        {
            Layout        = new HBoxLayout();
            HitTestTarget = true;

            folderButton = new PathFolderButton(openPath, path);
            arrowButton  = new PathArrowButton(openPath, path);

            Nodes.Add(folderButton);
            Nodes.Add(arrowButton);

            Updating += (float delta) => {
                if (arrowButton.Expanded)
                {
                    state = PathBarButtonState.Press;
                }
                else
                {
                    if (IsMouseOverThisOrDescendant())
                    {
                        if (
                            folderButton.WasClicked() ||
                            arrowButton.WasClicked()
                            )
                        {
                            state = PathBarButtonState.Press;
                        }
                        else
                        {
                            state = PathBarButtonState.Hover;
                        }
                    }
                    else
                    {
                        state = PathBarButtonState.Normal;
                    }
                }
                folderButton.SetState(state);
                arrowButton.SetState(state);
            };
        }