public Widget() { InitializeComponent(); // create sidebar button SidebarButton = new BarButton(this, "Search"); SidebarButton.IsExpandable = true; SidebarButton.WidgetHeight = 190; // add keyboard shortcut Controller.Current.Keyboard.AddBinding(KeyCombination.Ctrl, Key.F, ShowWidgetAndGetFocus); Controller.Current.Keyboard.AddBinding(KeyCombination.None, Key.F3, () => { if (!Query.Text.IsBlank()) DoSearch(SearchAction.Jump); else ShowWidgetAndGetFocus(); }); // set default color foundTextBackground = Theme.Instance.MatchingTokensBackground.ToColor(); // set events Query.KeyUp += OnQueryKeyUp; Query.LostFocus += OnQueryLostFocus; }
public Widget() { InitializeComponent(); // create sidebar button SidebarButton = new BarButton(this, "Colors"); SidebarButton.IsExpandable = true; SidebarButton.WidgetHeight = 235; // get settings Settings = Core.Settings.Instance.GetWidgetSettings("ColorPicker"); // assign events to selectors HueSelector.ColorSelectionChanged += OnColorChanged; AlphaSelector.ColorSelectionChanged += OnColorChanged; SaturationSelector.ColorSelectionChanged += OnColorChanged; // assign update events to AHSB CurrentColorAHSB_A.KeyUp += (s, e) => UpdateColorFromAHSB(); CurrentColorAHSB_H.KeyUp += (s, e) => UpdateColorFromAHSB(); CurrentColorAHSB_S.KeyUp += (s, e) => UpdateColorFromAHSB(); CurrentColorAHSB_B.KeyUp += (s, e) => UpdateColorFromAHSB(); // assign update events to ARGB CurrentColorARGB_A.KeyUp += (s, e) => UpdateColorFromARGB(); CurrentColorARGB_R.KeyUp += (s, e) => UpdateColorFromARGB(); CurrentColorARGB_G.KeyUp += (s, e) => UpdateColorFromARGB(); CurrentColorARGB_B.KeyUp += (s, e) => UpdateColorFromARGB(); // assign update event to HEX CurrentColorHex.KeyUp += (s, e) => SetColor(CurrentColorHex.Text); // read previous color SetColor(Settings.KeyExists("Color") ? Settings["Color"] : "#FFFF0000"); }
public void OnButtonExpand(BarButton button) { // temporarily, emitate an accordion's behaviour foreach(var btn in Controller.Current.Widgets.Where(w => w != button.Widget && w.SidebarButton.IsExpanded).Select(b => b.SidebarButton)) btn.CollapseWidget(); }
public Widget() { InitializeComponent(); // create sidebar button SidebarButton = new BarButton(this, "Stats Window") { ShowInSidebar = false }; // bind events Controller.Current.MainWindow.KeyDown += OnKeyDown; KeyUp += OnKeyUp; }
public Widget() { InitializeComponent(); // create sidebar button SidebarButton = new BarButton(this, "Completion"); SidebarButton.IsExpandable = true; SidebarButton.IsStretchable = true; // get settings Settings = Core.Settings.Instance.GetWidgetSettings("Completion"); // assign events Controller.Current.OnTabCreated += OnNewTab; Controller.Current.OnContextLanguageChanged += OnContextLanguageChanged; // keyboard binding Controller.Current.Keyboard.AddBinding(KeyCombination.Ctrl, Key.Space, ManuallyShowCompletionWindow); // arrange Engine = new CompletionEngine(); }
public Widget() { InitializeComponent(); // create sidebar button SidebarButton = new BarButton(this, "Projects"); SidebarButton.IsExpandable = true; SidebarButton.IsStretchable = true; SidebarButton.ExpadedByDefault(); // get settings Settings = Core.Settings.Instance.GetWidgetSettings("Projects"); // arrange ExpandedNodes = new List<FileItem>(); // assign events Loaded += (s, e) => OnLoaded(); Files.MouseDown += (s, e) => { LastClickedFile = null; }; // create jump box ProjectFiles = new List<string>(); Jump = new Jump(this); }
private UIElement AddWidget(BarButton button) { // initialize grid var grid = new Grid(); grid.RowDefinitions.Add(new RowDefinition { Height = new GridLength(BUTTON_HEIGHT) }); // set properties for widget if (button.IsExpandable) { grid.RowDefinitions.Add(new RowDefinition()); button.Control.Margin = button.IsExpanded ? new Thickness(5) : new Thickness(5,0,5,0); button.Control.SetValue(Grid.RowProperty, 1); grid.Children.Add(button.Control); } // add button grid.Children.Add(button); // update bar on collapse button.OnExpand += () => OnButtonExpand(button); //button.OnCollapse += UpdateWidgetSize; return grid; }