public ThemedTab() { Padding = Theme.Metrics.ControlsPadding + new Thickness(right: 5.0f); MinSize = Theme.Metrics.MinTabSize; MaxSize = Theme.Metrics.MaxTabSize; Size = MinSize; Layout = new HBoxLayout(); var caption = new SimpleText { Id = "TextPresenter", ForceUncutText = false, FontHeight = Theme.Metrics.TextHeight, HAlignment = HAlignment.Center, VAlignment = VAlignment.Center, OverflowMode = TextOverflowMode.Ellipsis, LayoutCell = new LayoutCell(Alignment.Center) }; var presenter = new TabPresenter(caption); Presenter = presenter; DefaultAnimation.AnimationEngine = new AnimationEngineDelegate { OnRunAnimation = (animation, markerId, animationTimeCorrection) => { presenter.SetState(markerId); return(true); } }; var closeButton = new ThemedTabCloseButton { Id = "CloseButton" }; AddNode(caption); AddNode(closeButton); LateTasks.Add(Theme.MouseHoverInvalidationTask(this)); }
public ThemedNumericEditBox() { ThemedEditBox.Decorate(this); MinMaxWidth = 80; TextWidget.Padding = new Thickness(2); Layout = new HBoxLayout(); Nodes.Insert(0, CreateSpinButton(SpinButtonType.Subtractive)); Nodes.Add(CreateSpinButton(SpinButtonType.Additive)); }
public ThemedNumericEditBox() { ThemedEditBox.Decorate(this); MinWidth = 0.0f; MaxWidth = 105.0f; TextWidget.Padding = new Thickness(left: 5.0f, right: 5.0f, top: 2.0f, bottom: 2.0f); Layout = new HBoxLayout(); // Lime.EditorParams.MouseSelectionThreshold is 3 by default and this gesture should be recognized first. // To achieve that we're setting its drag threshold to 2.0f, add it to Editor.ClickableWidget (same collection // editor adds its widgets to) and do it in LateTasks. var dragGesture = new DragGesture(exclusive: true, dragThreshold: 2.0f); Updated += (delta) => { if (Editor.FocusableWidget.IsFocused()) { dragGesture.OnCancel(dragGesture); } else if (IsMouseOverThisOrDescendant() || isDragging) { WidgetContext.Current.MouseCursor = MouseCursor.SizeWE; } }; LateTasks.Add(Task.Repeat(() => { dragGesture.Recognized += () => { if (!GloballyEnabled) { return; } if (Focused != null && !this.SameOrDescendantOf(Focused)) { Focused.RevokeFocus(); } Tasks.Add(SpinByDragTask(dragGesture)); }; Editor.ClickableWidget.Gestures.Insert(0, dragGesture); return(false); })); }
public ThemedFileChooserButton() { FileDialog = new FileDialog(); Layout = new HBoxLayout(); label = new ThemedSimpleText { Id = "Label", ForceUncutText = false, MinMaxHeight = Theme.Metrics.DefaultButtonSize.Y, Padding = Theme.Metrics.ControlsPadding, LayoutCell = new LayoutCell { StretchX = float.MaxValue } }; button = new ThemedButton { Id = "Button", Text = "...", MinMaxWidth = 20 }; button.Clicked += HandleButtonClick; PostPresenter = new ThemedFramePresenter(Theme.Colors.GrayBackground, Theme.Colors.ControlBorder); AddNode(label); AddNode(button); }
public ThemedTabBar() { Layout = new HBoxLayout(); }