public PathArrowButton(Func <string, bool> openPath, string path = null) : base() { this.path = path; this.openPath = openPath; MinMaxHeight = 20; Presenter = new PathButtonPresenter(); base.Presenter = Presenter; if (path == null) { Updating += (float delta) => { var prevState = State; if (Expanded) { State = PathBarButtonState.Press; } else { if (IsMouseOverThisOrDescendant()) { if (WasClicked()) { State = PathBarButtonState.Press; } else { State = PathBarButtonState.Hover; } } else { State = PathBarButtonState.Normal; } } if (prevState != State) { Presenter.SetState(State); } }; } Gestures.Add(new ClickGesture(0, FlipState)); Layout = new HBoxLayout(); MinMaxSize = new Vector2(11, 20); Nodes.Add(icon = new Image { LayoutCell = new LayoutCell { Alignment = new Alignment { X = HAlignment.Center, Y = VAlignment.Center } }, MinMaxSize = new Vector2(11, 6), Texture = IconPool.GetTexture("Filesystem.PathSeparatorCollapsed") }); Expanded = false; }
public void SetState(PathBarButtonState state) { Presenter.SetState(state); }