public StatusIcon(StatusArea statusBar, Gdk.Pixbuf icon) { this.statusBar = statusBar; this.icon = icon; box = new EventBox(); box.VisibleWindow = false; image = new Image(icon); image.SetPadding(0, 0); box.Child = image; box.Events |= Gdk.EventMask.EnterNotifyMask | Gdk.EventMask.LeaveNotifyMask; box.EnterNotifyEvent += HandleEnterNotifyEvent; box.LeaveNotifyEvent += HandleLeaveNotifyEvent; }
public StatusIcon(StatusArea statusBar, Xwt.Drawing.Image icon) { if (!icon.HasFixedSize) { icon = icon.WithSize(IconSize.Menu); } this.statusBar = statusBar; this.icon = icon; box = new EventBox(); box.VisibleWindow = false; image = new Xwt.ImageView(icon); box.Child = image.ToGtkWidget(); box.Events |= Gdk.EventMask.EnterNotifyMask | Gdk.EventMask.LeaveNotifyMask; box.EnterNotifyEvent += HandleEnterNotifyEvent; box.LeaveNotifyEvent += HandleLeaveNotifyEvent; }
public StatusIcon(StatusArea statusBar, Xwt.Drawing.Image icon) { if (!icon.HasFixedSize) { icon = icon.WithSize(IconSize.Menu); } this.statusBar = statusBar; this.icon = icon; box = new EventBox(); box.VisibleWindow = false; image = new Xwt.ImageView(icon); box.Child = image.ToGtkWidget(); box.Events |= Gdk.EventMask.EnterNotifyMask | Gdk.EventMask.LeaveNotifyMask; box.EnterNotifyEvent += HandleEnterNotifyEvent; box.LeaveNotifyEvent += HandleLeaveNotifyEvent; box.ButtonPressEvent += (o, e) => { // TODO: Refactor this in Xwt as an extension method. var m = Xwt.ModifierKeys.None; if ((e.Event.State & Gdk.ModifierType.ShiftMask) != 0) { m |= Xwt.ModifierKeys.Shift; } if ((e.Event.State & Gdk.ModifierType.ControlMask) != 0) { m |= Xwt.ModifierKeys.Control; } if ((e.Event.State & Gdk.ModifierType.Mod1Mask) != 0) { m |= Xwt.ModifierKeys.Alt; } // TODO: Backport this one. if ((e.Event.State & Gdk.ModifierType.Mod2Mask) != 0) { m |= Xwt.ModifierKeys.Command; } Clicked(o, new StatusBarIconClickedEventArgs { Button = (Xwt.PointerButton)e.Event.Button, Modifiers = m, }); }; }
void DrawErrorAnimation (Cairo.Context context, StatusArea.RenderArg arg) { const int surfaceWidth = 2000; double opacity; int progress; if (arg.ErrorAnimationProgress < .5f) { progress = (int) (arg.ErrorAnimationProgress * arg.Allocation.Width * 2.4); opacity = 1.0d; } else { progress = (int) (arg.ErrorAnimationProgress * arg.Allocation.Width * 2.4); opacity = 1.0d - (arg.ErrorAnimationProgress - .5d) * 2; } LayoutRoundedRectangle (context, arg.Allocation); context.Clip (); context.CachedDraw (surface: ref errorSurface, position: new Gdk.Point (arg.Allocation.X - surfaceWidth + progress, arg.Allocation.Y), size: new Gdk.Size (surfaceWidth, arg.Allocation.Height), opacity: (float)opacity, draw: (c, o) => { // The smaller the pixel range of our gradient the less error there will be in it. using (var lg = new LinearGradient (surfaceWidth - 250, 0, surfaceWidth, 0)) { lg.AddColorStop (0.00, Styles.WithAlpha (Styles.StatusBarErrorColor, 0.15 * o)); lg.AddColorStop (0.10, Styles.WithAlpha (Styles.StatusBarErrorColor, 0.15 * o)); lg.AddColorStop (0.88, Styles.WithAlpha (Styles.StatusBarErrorColor, 0.30 * o)); lg.AddColorStop (1.00, Styles.WithAlpha (Styles.StatusBarErrorColor, 0.00 * o)); c.Pattern = lg; c.Paint (); } }); context.ResetClip (); }
public MainToolbar() { executionTargetsChanged = DispatchService.GuiDispatch(new EventHandler(HandleExecutionTargetsChanged)); IdeApp.Workspace.ActiveConfigurationChanged += (sender, e) => UpdateCombos(); IdeApp.Workspace.ConfigurationsChanged += (sender, e) => UpdateCombos(); IdeApp.Workspace.SolutionLoaded += (sender, e) => UpdateCombos(); IdeApp.Workspace.SolutionUnloaded += (sender, e) => UpdateCombos(); IdeApp.ProjectOperations.CurrentSelectedSolutionChanged += HandleCurrentSelectedSolutionChanged; WidgetFlags |= Gtk.WidgetFlags.AppPaintable; AddWidget(button); AddSpace(8); configurationCombo = new Gtk.ComboBox(); configurationCombo.Model = configurationStore; var ctx = new Gtk.CellRendererText(); configurationCombo.PackStart(ctx, true); configurationCombo.AddAttribute(ctx, "text", 0); configurationCombosBox = new HBox(false, 8); var configurationComboVBox = new VBox(); configurationComboVBox.PackStart(configurationCombo, true, false, 0); configurationCombosBox.PackStart(configurationComboVBox, false, false, 0); runtimeCombo = new Gtk.ComboBox(); runtimeCombo.Model = runtimeStore; ctx = new Gtk.CellRendererText(); runtimeCombo.PackStart(ctx, true); runtimeCombo.SetCellDataFunc(ctx, RuntimeRenderCell); runtimeCombo.RowSeparatorFunc = RuntimeIsSeparator; var runtimeComboVBox = new VBox(); runtimeComboVBox.PackStart(runtimeCombo, true, false, 0); configurationCombosBox.PackStart(runtimeComboVBox, false, false, 0); AddWidget(configurationCombosBox); buttonBarBox = new Alignment(0.5f, 0.5f, 0, 0); buttonBarBox.LeftPadding = (uint)7; buttonBarBox.Add(buttonBar); buttonBarBox.NoShowAll = true; AddWidget(buttonBarBox); AddSpace(24); statusArea = new StatusArea(); statusArea.ShowMessage(BrandingService.ApplicationName); var statusAreaAlign = new Alignment(0, 0, 1, 1); statusAreaAlign.Add(statusArea); contentBox.PackStart(statusAreaAlign, true, true, 0); AddSpace(24); statusAreaAlign.SizeAllocated += (object o, SizeAllocatedArgs args) => { Gtk.Widget toplevel = this.Toplevel; if (toplevel == null) { return; } var pixel_scale = GtkWorkarounds.GetPixelScale(); int windowWidth = toplevel.Allocation.Width; int center = windowWidth / 2; int left = Math.Max(center - (int)(300 * pixel_scale), args.Allocation.Left); int right = Math.Min(left + (int)(600 * pixel_scale), args.Allocation.Right); uint left_padding = (uint)(left - args.Allocation.Left); uint right_padding = (uint)(args.Allocation.Right - right); if (left_padding != statusAreaAlign.LeftPadding || right_padding != statusAreaAlign.RightPadding) { statusAreaAlign.SetPadding(0, 0, (uint)left_padding, (uint)right_padding); } }; matchEntry = new SearchEntry(); var searchFiles = this.matchEntry.AddMenuItem(GettextCatalog.GetString("Search Files")); searchFiles.Activated += delegate { SetSearchCategory("files"); }; var searchTypes = this.matchEntry.AddMenuItem(GettextCatalog.GetString("Search Types")); searchTypes.Activated += delegate { SetSearchCategory("type"); }; var searchMembers = this.matchEntry.AddMenuItem(GettextCatalog.GetString("Search Members")); searchMembers.Activated += delegate { SetSearchCategory("member"); }; matchEntry.ForceFilterButtonVisible = true; matchEntry.Entry.FocusOutEvent += delegate { matchEntry.Entry.Text = ""; }; var cmd = IdeApp.CommandService.GetCommand(Commands.NavigateTo); cmd.KeyBindingChanged += delegate { UpdateSearchEntryLabel(); }; UpdateSearchEntryLabel(); matchEntry.Ready = true; matchEntry.Visible = true; matchEntry.IsCheckMenu = true; matchEntry.Entry.ModifyBase(StateType.Normal, Style.White); matchEntry.WidthRequest = 240; if (!Platform.IsMac && !Platform.IsWindows) { matchEntry.Entry.ModifyFont(Pango.FontDescription.FromString("Sans 9")); // TODO: VV: "Segoe UI 9" } matchEntry.RoundedShape = true; matchEntry.Entry.Changed += HandleSearchEntryChanged; matchEntry.Activated += (sender, e) => { var pattern = SearchPopupSearchPattern.ParsePattern(matchEntry.Entry.Text); if (pattern.Pattern == null && pattern.LineNumber > 0) { popup.Destroy(); var doc = IdeApp.Workbench.ActiveDocument; if (doc != null && doc.Editor != null) { doc.Select(); doc.Editor.Caret.Location = new Mono.TextEditor.DocumentLocation(pattern.LineNumber, pattern.Column > 0 ? pattern.Column : 1); doc.Editor.CenterToCaret(); doc.Editor.Parent.StartCaretPulseAnimation(); } return; } if (popup != null) { popup.OpenFile(); } }; matchEntry.Entry.KeyPressEvent += (o, args) => { if (args.Event.Key == Gdk.Key.Escape) { var doc = IdeApp.Workbench.ActiveDocument; if (doc != null) { if (popup != null) { popup.Destroy(); } doc.Select(); } return; } if (popup != null) { args.RetVal = popup.ProcessKey(args.Event.Key, args.Event.State); } }; IdeApp.Workbench.RootWindow.WidgetEvent += delegate(object o, WidgetEventArgs args) { if (args.Event is Gdk.EventConfigure) { PositionPopup(); } }; SizeAllocated += delegate { PositionPopup(); }; BuildToolbar(); IdeApp.CommandService.RegisterCommandBar(buttonBar); AddinManager.ExtensionChanged += OnExtensionChanged; contentBox.PackStart(matchEntry, false, false, 0); var align = new Gtk.Alignment(0, 0, 1f, 1f); align.Show(); align.TopPadding = (uint)5; align.LeftPadding = (uint)9; align.RightPadding = (uint)18; align.BottomPadding = (uint)10; align.Add(contentBox); Add(align); SetDefaultSizes(-1, 21); configurationCombo.Changed += HandleConfigurationChanged; runtimeCombo.Changed += HandleRuntimeChanged; UpdateCombos(); button.Clicked += HandleStartButtonClicked; IdeApp.CommandService.RegisterCommandBar(this); IdeApp.CommandService.ActiveWidgetChanged += (sender, e) => { lastCommandTarget = new WeakReference(e.OldActiveWidget); }; this.ShowAll(); this.statusArea.statusIconBox.HideAll(); }
public MainToolbar() { WidgetFlags |= Gtk.WidgetFlags.AppPaintable; AddWidget(button); AddSpace(8); configurationCombo = new Gtk.ComboBox(); configurationCombo.Model = configurationStore; var ctx = new Gtk.CellRendererText(); configurationCombo.PackStart(ctx, true); configurationCombo.AddAttribute(ctx, "text", 0); configurationCombosBox = new HBox(false, 8); var configurationComboVBox = new VBox(); configurationComboVBox.PackStart(configurationCombo, true, false, 0); configurationCombosBox.PackStart(configurationComboVBox, false, false, 0); // bold attributes for running runtime targets / (emulators) boldAttributes.Insert(new Pango.AttrWeight(Pango.Weight.Bold)); runtimeCombo = new Gtk.ComboBox(); runtimeCombo.Model = runtimeStore; ctx = new Gtk.CellRendererText(); if (Platform.IsWindows) { ctx.Ellipsize = Pango.EllipsizeMode.Middle; } runtimeCombo.PackStart(ctx, true); runtimeCombo.SetCellDataFunc(ctx, RuntimeRenderCell); runtimeCombo.RowSeparatorFunc = RuntimeIsSeparator; var runtimeComboVBox = new VBox(); runtimeComboVBox.PackStart(runtimeCombo, true, false, 0); configurationCombosBox.PackStart(runtimeComboVBox, false, false, 0); AddWidget(configurationCombosBox); buttonBarBox = new Alignment(0.5f, 0.5f, 0, 0); buttonBarBox.LeftPadding = (uint)7; buttonBarBox.Add(buttonBar); buttonBarBox.NoShowAll = true; AddWidget(buttonBarBox); AddSpace(24); statusArea = new StatusArea(); statusArea.ShowMessage(BrandingService.ApplicationName); var statusAreaAlign = new Alignment(0, 0, 1, 1); statusAreaAlign.Add(statusArea); contentBox.PackStart(statusAreaAlign, true, true, 0); AddSpace(24); statusAreaAlign.SizeAllocated += (object o, SizeAllocatedArgs args) => { Gtk.Widget toplevel = this.Toplevel; if (toplevel == null) { return; } var pixel_scale = GtkWorkarounds.GetPixelScale(); int windowWidth = toplevel.Allocation.Width; int center = windowWidth / 2; int left = Math.Max(center - (int)(300 * pixel_scale), args.Allocation.Left); int right = Math.Min(left + (int)(600 * pixel_scale), args.Allocation.Right); uint left_padding = (uint)(left - args.Allocation.Left); uint right_padding = (uint)(args.Allocation.Right - right); if (left_padding != statusAreaAlign.LeftPadding || right_padding != statusAreaAlign.RightPadding) { statusAreaAlign.SetPadding(0, 0, (uint)left_padding, (uint)right_padding); } }; matchEntry = new SearchEntry(); matchEntry.ForceFilterButtonVisible = true; matchEntry.Entry.FocusOutEvent += (o, e) => { if (SearchEntryLostFocus != null) { SearchEntryLostFocus(o, e); } }; matchEntry.Ready = true; matchEntry.Visible = true; matchEntry.IsCheckMenu = true; matchEntry.Entry.ModifyBase(StateType.Normal, Style.White); matchEntry.WidthRequest = 240; if (!Platform.IsMac && !Platform.IsWindows) { matchEntry.Entry.ModifyFont(Pango.FontDescription.FromString("Sans 9")); // TODO: VV: "Segoe UI 9" } matchEntry.RoundedShape = true; matchEntry.Entry.Changed += HandleSearchEntryChanged; matchEntry.Activated += HandleSearchEntryActivated; matchEntry.Entry.KeyPressEvent += HandleSearchEntryKeyPressed; SizeAllocated += (o, e) => { if (SearchEntryResized != null) { SearchEntryResized(o, e); } }; contentBox.PackStart(matchEntry, false, false, 0); var align = new Gtk.Alignment(0, 0, 1f, 1f); align.Show(); align.TopPadding = (uint)5; align.LeftPadding = (uint)9; align.RightPadding = (uint)18; align.BottomPadding = (uint)10; align.Add(contentBox); Add(align); SetDefaultSizes(-1, (int)(21 * GtkWorkarounds.GetPixelScale())); configurationCombo.Changed += (o, e) => { if (ConfigurationChanged != null) { ConfigurationChanged(o, e); } }; runtimeCombo.Changed += (o, e) => { var ea = new HandledEventArgs(); if (RuntimeChanged != null) { RuntimeChanged(o, ea); } TreeIter it; if (runtimeCombo.GetActiveIter(out it)) { if (ea.Handled) { runtimeCombo.SetActiveIter(lastSelection); return; } lastSelection = it; } }; button.Clicked += HandleStartButtonClicked; IdeApp.CommandService.ActiveWidgetChanged += (sender, e) => { lastCommandTarget = new WeakReference(e.OldActiveWidget); }; this.ShowAll(); this.statusArea.statusIconBox.HideAll(); }
public MainStatusBarContextImpl(StatusArea statusBar) : base(statusBar) { StatusChanged = true; }
public void Render (Cairo.Context context, StatusArea.RenderArg arg) { context.CachedDraw (surface: ref backgroundSurface, region: arg.Allocation, draw: (c, o) => DrawBackground (c, new Gdk.Rectangle (0, 0, arg.Allocation.Width, arg.Allocation.Height))); if (arg.BuildAnimationOpacity > 0.001f) DrawBuildEffect (context, arg.Allocation, arg.BuildAnimationProgress, arg.BuildAnimationOpacity); if (arg.ErrorAnimationProgress > 0.001 && arg.ErrorAnimationProgress < .999) { DrawErrorAnimation (context, arg); } DrawBorder (context, arg.Allocation); if (arg.HoverProgress > 0.001f) { context.Clip (); int x1 = arg.Allocation.X + arg.MousePosition.X - 200; int x2 = x1 + 400; using (Cairo.LinearGradient gradient = new LinearGradient (x1, 0, x2, 0)) { Cairo.Color targetColor = Styles.StatusBarFill1Color; Cairo.Color transparentColor = targetColor; targetColor.A = .7; transparentColor.A = 0; targetColor.A = .7 * arg.HoverProgress; gradient.AddColorStop (0.0, transparentColor); gradient.AddColorStop (0.5, targetColor); gradient.AddColorStop (1.0, transparentColor); context.Pattern = gradient; context.Rectangle (x1, arg.Allocation.Y, x2 - x1, arg.Allocation.Height); context.Fill (); } context.ResetClip (); } else { context.NewPath (); } int progress_bar_x = arg.ChildAllocation.X; int progress_bar_width = arg.ChildAllocation.Width; if (arg.CurrentPixbuf != null) { int y = arg.Allocation.Y + (arg.Allocation.Height - arg.CurrentPixbuf.Height) / 2; Gdk.CairoHelper.SetSourcePixbuf (context, arg.CurrentPixbuf, arg.ChildAllocation.X, y); context.Paint (); progress_bar_x += arg.CurrentPixbuf.Width + Styles.ProgressBarOuterPadding; progress_bar_width -= arg.CurrentPixbuf.Width + Styles.ProgressBarOuterPadding; } int center = arg.Allocation.Y + arg.Allocation.Height / 2; Gdk.Rectangle progressArea = new Gdk.Rectangle (progress_bar_x, center - Styles.ProgressBarHeight / 2, progress_bar_width, Styles.ProgressBarHeight); if (arg.ShowProgressBar || arg.ProgressBarAlpha > 0) { DrawProgressBar (context, arg.ProgressBarFraction, progressArea, arg); ClipProgressBar (context, progressArea); } int text_x = progress_bar_x + Styles.ProgressBarInnerPadding; int text_width = progress_bar_width - (Styles.ProgressBarInnerPadding * 2); double textTweenValue = arg.TextAnimationProgress; if (arg.LastText != null) { double opacity = Math.Max (0.0f, 1.0f - textTweenValue); DrawString (arg.LastText, arg.LastTextIsMarkup, context, text_x, center - (int)(textTweenValue * arg.Allocation.Height * 0.3), text_width, opacity, arg.Pango, arg); } if (arg.CurrentText != null) { DrawString (arg.CurrentText, arg.CurrentTextIsMarkup, context, text_x, center + (int)((1.0f - textTweenValue) * arg.Allocation.Height * 0.3), text_width, Math.Min (textTweenValue, 1.0), arg.Pango, arg); } if (arg.ShowProgressBar || arg.ProgressBarAlpha > 0) context.ResetClip (); }
public StatusIcon(StatusArea statusBar, Xwt.Drawing.Image icon) { if (!icon.HasFixedSize) icon = icon.WithSize (IconSize.Menu); this.statusBar = statusBar; this.icon = icon; box = new EventBox (); box.VisibleWindow = false; image = new Xwt.ImageView (icon); box.Child = image.ToGtkWidget (); box.Events |= Gdk.EventMask.EnterNotifyMask | Gdk.EventMask.LeaveNotifyMask; box.EnterNotifyEvent += HandleEnterNotifyEvent; box.LeaveNotifyEvent += HandleLeaveNotifyEvent; }
public MainStatusBarContextImpl (StatusArea statusBar): base (statusBar) { StatusChanged = true; }
public StatusIcon (StatusArea statusBar, Gdk.Pixbuf icon) { this.statusBar = statusBar; this.icon = icon; box = new EventBox (); box.VisibleWindow = false; image = new Image (icon); image.SetPadding (0, 0); box.Child = image; box.Events |= Gdk.EventMask.EnterNotifyMask | Gdk.EventMask.LeaveNotifyMask; box.EnterNotifyEvent += HandleEnterNotifyEvent; box.LeaveNotifyEvent += HandleLeaveNotifyEvent; }
public StatusIcon (StatusArea statusBar, Xwt.Drawing.Image icon) { if (!icon.HasFixedSize) icon = icon.WithSize (IconSize.Menu); this.statusBar = statusBar; this.icon = icon; box = new EventBox (); box.VisibleWindow = false; image = new Xwt.ImageView (icon); box.Child = image.ToGtkWidget (); box.Events |= Gdk.EventMask.EnterNotifyMask | Gdk.EventMask.LeaveNotifyMask; box.EnterNotifyEvent += HandleEnterNotifyEvent; box.LeaveNotifyEvent += HandleLeaveNotifyEvent; box.ButtonPressEvent += (o, e) => { // TODO: Refactor this in Xwt as an extension method. var m = Xwt.ModifierKeys.None; if ((e.Event.State & Gdk.ModifierType.ShiftMask) != 0) m |= Xwt.ModifierKeys.Shift; if ((e.Event.State & Gdk.ModifierType.ControlMask) != 0) m |= Xwt.ModifierKeys.Control; if ((e.Event.State & Gdk.ModifierType.Mod1Mask) != 0) m |= Xwt.ModifierKeys.Alt; // TODO: Backport this one. if ((e.Event.State & Gdk.ModifierType.Mod2Mask) != 0) m |= Xwt.ModifierKeys.Command; Clicked (o, new StatusBarIconClickedEventArgs { Button = (Xwt.PointerButton)e.Event.Button, Modifiers = m, }); }; }
internal StatusBarContextImpl(StatusArea statusBar) { this.statusBar = statusBar; }
public MainToolbar() { WidgetFlags |= Gtk.WidgetFlags.AppPaintable; AddWidget(button); AddSpace(8); configurationCombosBox = new HBox(false, 8); var ctx = new Gtk.CellRendererText(); runConfigurationCombo = new Gtk.ComboBox(); runConfigurationCombo.Model = runConfigurationStore; runConfigurationCombo.PackStart(ctx, true); runConfigurationCombo.AddAttribute(ctx, "text", 0); runConfigurationCombo.TooltipText = GettextCatalog.GetString("A project or named set of projects and execution options that should be launched when running or debugging the solution."); var runConfigurationComboVBox = new VBox(); runConfigurationComboVBox.PackStart(runConfigurationCombo, true, false, 0); configurationCombosBox.PackStart(runConfigurationComboVBox, false, false, 0); configurationCombo = new Gtk.ComboBox(); configurationCombo.Model = configurationStore; configurationCombo.PackStart(ctx, true); configurationCombo.AddAttribute(ctx, "text", 0); configurationCombo.TooltipText = GettextCatalog.GetString("A named set of projects and their configurations to be built when building the solution."); var configurationComboVBox = new VBox(); configurationComboVBox.PackStart(configurationCombo, true, false, 0); configurationCombosBox.PackStart(configurationComboVBox, false, false, 0); // bold attributes for running runtime targets / (emulators) boldAttributes.Insert(new Pango.AttrWeight(Pango.Weight.Bold)); runtimeCombo = new Gtk.ComboBox(); runtimeCombo.Model = runtimeStore; ctx = new Gtk.CellRendererText(); if (Platform.IsWindows) { ctx.Ellipsize = Pango.EllipsizeMode.Middle; } runtimeCombo.PackStart(ctx, true); runtimeCombo.SetCellDataFunc(ctx, RuntimeRenderCell); runtimeCombo.RowSeparatorFunc = RuntimeIsSeparator; runtimeCombo.TooltipText = GettextCatalog.GetString("The device on which to deploy and launch the projects when running or debugging."); var runtimeComboVBox = new VBox(); runtimeComboVBox.PackStart(runtimeCombo, true, false, 0); configurationCombosBox.PackStart(runtimeComboVBox, false, false, 0); AddWidget(configurationCombosBox); buttonBarBox = new Alignment(0.5f, 0.5f, 0, 0); buttonBarBox.LeftPadding = (uint)7; buttonBarBox.Add(buttonBar); buttonBarBox.NoShowAll = true; AddWidget(buttonBarBox); AddSpace(24); statusArea = new StatusArea(); statusArea.ShowMessage(BrandingService.ApplicationName); var statusAreaAlign = new Alignment(0, 0, 1, 1); statusAreaAlign.Add(statusArea); contentBox.PackStart(statusAreaAlign, true, true, 0); AddSpace(24); statusAreaAlign.SizeAllocated += (object o, SizeAllocatedArgs args) => { Gtk.Widget toplevel = this.Toplevel; if (toplevel == null) { return; } int windowWidth = toplevel.Allocation.Width; int center = windowWidth / 2; int left = Math.Max(center - 300, args.Allocation.Left); int right = Math.Min(left + 600, args.Allocation.Right); uint left_padding = (uint)(left - args.Allocation.Left); uint right_padding = (uint)(args.Allocation.Right - right); if (left_padding != statusAreaAlign.LeftPadding || right_padding != statusAreaAlign.RightPadding) { statusAreaAlign.SetPadding(0, 0, (uint)left_padding, (uint)right_padding); } }; matchEntry = new SearchEntry(); matchEntry.ForceFilterButtonVisible = true; matchEntry.Entry.FocusOutEvent += (o, e) => { if (SearchEntryLostFocus != null) { SearchEntryLostFocus(o, e); } }; matchEntry.Ready = true; matchEntry.Visible = true; matchEntry.IsCheckMenu = true; matchEntry.WidthRequest = 240; if (!Platform.IsMac && !Platform.IsWindows) { matchEntry.Entry.ModifyFont(Pango.FontDescription.FromString("Sans 9")); // TODO: VV: "Segoe UI 9" } matchEntry.RoundedShape = true; matchEntry.Entry.Changed += HandleSearchEntryChanged; matchEntry.Activated += HandleSearchEntryActivated; matchEntry.Entry.KeyPressEvent += HandleSearchEntryKeyPressed; SizeAllocated += (o, e) => { if (SearchEntryResized != null) { SearchEntryResized(o, e); } }; contentBox.PackStart(matchEntry, false, false, 0); var align = new Gtk.Alignment(0, 0, 1f, 1f); align.Show(); align.TopPadding = (uint)5; align.LeftPadding = (uint)9; align.RightPadding = (uint)18; align.BottomPadding = (uint)10; align.Add(contentBox); Add(align); SetDefaultSizes(-1, 21); configurationCombo.Changed += (o, e) => { if (ConfigurationChanged != null) { ConfigurationChanged(o, e); } }; runConfigurationCombo.Changed += (o, e) => { if (RunConfigurationChanged != null) { RunConfigurationChanged(o, e); } }; runtimeCombo.Changed += (o, e) => { var ea = new HandledEventArgs(); if (RuntimeChanged != null) { RuntimeChanged(o, ea); } TreeIter it; if (runtimeCombo.GetActiveIter(out it)) { if (ea.Handled) { runtimeCombo.SetActiveIter(lastSelection); return; } lastSelection = it; } }; button.Clicked += HandleStartButtonClicked; this.ShowAll(); this.statusArea.statusIconBox.HideAll(); }
void DrawProgressBar (Cairo.Context context, double progress, Gdk.Rectangle bounding, StatusArea.RenderArg arg) { LayoutRoundedRectangle (context, new Gdk.Rectangle (bounding.X, bounding.Y, (int) (bounding.Width * progress), bounding.Height)); context.Clip (); LayoutRoundedRectangle (context, bounding); context.Color = Styles.WithAlpha (Styles.StatusBarProgressBackgroundColor, Styles.StatusBarProgressBackgroundColor.A * arg.ProgressBarAlpha); context.FillPreserve (); context.ResetClip (); context.Color = Styles.WithAlpha (Styles.StatusBarProgressOutlineColor, Styles.StatusBarProgressOutlineColor.A * arg.ProgressBarAlpha); context.LineWidth = 1; context.Stroke (); }
void DrawString (string text, bool isMarkup, Cairo.Context context, int x, int y, int width, double opacity, Pango.Context pango, StatusArea.RenderArg arg) { Pango.Layout pl = new Pango.Layout (pango); if (isMarkup) pl.SetMarkup (text); else pl.SetText (text); pl.FontDescription = Styles.StatusFont; pl.FontDescription.AbsoluteSize = Pango.Units.FromPixels (Styles.StatusFontPixelHeight); pl.Ellipsize = Pango.EllipsizeMode.End; pl.Width = Pango.Units.FromPixels(width); int w, h; pl.GetPixelSize (out w, out h); context.Save (); // use widget height instead of message box height as message box does not have a true height when no widgets are packed in it // also ensures animations work properly instead of getting clipped context.Rectangle (new Rectangle (x, arg.Allocation.Y, width, arg.Allocation.Height)); context.Clip (); // Subtract off remainder instead of drop to prefer higher centering when centering an odd number of pixels context.MoveTo (x, y - h / 2 - (h % 2)); context.Color = Styles.WithAlpha (FontColor (), opacity); Pango.CairoHelper.ShowLayout (context, pl); pl.Dispose (); context.Restore (); }
public MainToolbar () { WidgetFlags |= Gtk.WidgetFlags.AppPaintable; AddWidget (button); AddSpace (8); configurationCombo = new Gtk.ComboBox (); configurationCombo.Model = configurationStore; var ctx = new Gtk.CellRendererText (); configurationCombo.PackStart (ctx, true); configurationCombo.AddAttribute (ctx, "text", 0); configurationCombosBox = new HBox (false, 8); var configurationComboVBox = new VBox (); configurationComboVBox.PackStart (configurationCombo, true, false, 0); configurationCombosBox.PackStart (configurationComboVBox, false, false, 0); // bold attributes for running runtime targets / (emulators) boldAttributes.Insert (new Pango.AttrWeight (Pango.Weight.Bold)); runtimeCombo = new Gtk.ComboBox (); runtimeCombo.Model = runtimeStore; ctx = new Gtk.CellRendererText (); if (Platform.IsWindows) ctx.Ellipsize = Pango.EllipsizeMode.Middle; runtimeCombo.PackStart (ctx, true); runtimeCombo.SetCellDataFunc (ctx, RuntimeRenderCell); runtimeCombo.RowSeparatorFunc = RuntimeIsSeparator; var runtimeComboVBox = new VBox (); runtimeComboVBox.PackStart (runtimeCombo, true, false, 0); configurationCombosBox.PackStart (runtimeComboVBox, false, false, 0); AddWidget (configurationCombosBox); buttonBarBox = new Alignment (0.5f, 0.5f, 0, 0); buttonBarBox.LeftPadding = (uint) 7; buttonBarBox.Add (buttonBar); buttonBarBox.NoShowAll = true; AddWidget (buttonBarBox); AddSpace (24); statusArea = new StatusArea (); statusArea.ShowMessage (BrandingService.ApplicationName); var statusAreaAlign = new Alignment (0, 0, 1, 1); statusAreaAlign.Add (statusArea); contentBox.PackStart (statusAreaAlign, true, true, 0); AddSpace (24); statusAreaAlign.SizeAllocated += (object o, SizeAllocatedArgs args) => { Gtk.Widget toplevel = this.Toplevel; if (toplevel == null) return; int windowWidth = toplevel.Allocation.Width; int center = windowWidth / 2; int left = Math.Max (center - 300, args.Allocation.Left); int right = Math.Min (left + 600, args.Allocation.Right); uint left_padding = (uint) (left - args.Allocation.Left); uint right_padding = (uint) (args.Allocation.Right - right); if (left_padding != statusAreaAlign.LeftPadding || right_padding != statusAreaAlign.RightPadding) statusAreaAlign.SetPadding (0, 0, (uint) left_padding, (uint) right_padding); }; matchEntry = new SearchEntry (); matchEntry.ForceFilterButtonVisible = true; matchEntry.Entry.FocusOutEvent += (o, e) => { if (SearchEntryLostFocus != null) SearchEntryLostFocus (o, e); }; matchEntry.Ready = true; matchEntry.Visible = true; matchEntry.IsCheckMenu = true; matchEntry.WidthRequest = 240; if (!Platform.IsMac && !Platform.IsWindows) matchEntry.Entry.ModifyFont (Pango.FontDescription.FromString ("Sans 9")); // TODO: VV: "Segoe UI 9" matchEntry.RoundedShape = true; matchEntry.Entry.Changed += HandleSearchEntryChanged; matchEntry.Activated += HandleSearchEntryActivated; matchEntry.Entry.KeyPressEvent += HandleSearchEntryKeyPressed; SizeAllocated += (o, e) => { if (SearchEntryResized != null) SearchEntryResized (o, e); }; contentBox.PackStart (matchEntry, false, false, 0); var align = new Gtk.Alignment (0, 0, 1f, 1f); align.Show (); align.TopPadding = (uint) 5; align.LeftPadding = (uint) 9; align.RightPadding = (uint) 18; align.BottomPadding = (uint) 10; align.Add (contentBox); Add (align); SetDefaultSizes (-1, 21); configurationCombo.Changed += (o, e) => { if (ConfigurationChanged != null) ConfigurationChanged (o, e); }; runtimeCombo.Changed += (o, e) => { var ea = new HandledEventArgs (); if (RuntimeChanged != null) RuntimeChanged (o, ea); TreeIter it; if (runtimeCombo.GetActiveIter (out it)) { if (ea.Handled) { runtimeCombo.SetActiveIter (lastSelection); return; } lastSelection = it; } }; button.Clicked += HandleStartButtonClicked; IdeApp.CommandService.ActiveWidgetChanged += (sender, e) => { lastCommandTarget = new WeakReference (e.OldActiveWidget); }; this.ShowAll (); this.statusArea.statusIconBox.HideAll (); }
public MainToolbar () { executionTargetsChanged = DispatchService.GuiDispatch (new EventHandler (HandleExecutionTargetsChanged)); IdeApp.Workspace.ActiveConfigurationChanged += (sender, e) => UpdateCombos (); IdeApp.Workspace.ConfigurationsChanged += (sender, e) => UpdateCombos (); IdeApp.Workspace.SolutionLoaded += (sender, e) => UpdateCombos (); IdeApp.Workspace.SolutionUnloaded += (sender, e) => UpdateCombos (); IdeApp.ProjectOperations.CurrentSelectedSolutionChanged += HandleCurrentSelectedSolutionChanged; WidgetFlags |= Gtk.WidgetFlags.AppPaintable; AddWidget (button); AddSpace (8); configurationCombo = new Gtk.ComboBox (); configurationCombo.Model = configurationStore; var ctx = new Gtk.CellRendererText (); configurationCombo.PackStart (ctx, true); configurationCombo.AddAttribute (ctx, "text", 0); configurationCombosBox = new HBox (false, 8); var configurationComboVBox = new VBox (); configurationComboVBox.PackStart (configurationCombo, true, false, 0); configurationCombosBox.PackStart (configurationComboVBox, false, false, 0); runtimeCombo = new Gtk.ComboBox (); runtimeCombo.Model = runtimeStore; ctx = new Gtk.CellRendererText (); runtimeCombo.PackStart (ctx, true); runtimeCombo.SetCellDataFunc (ctx, RuntimeRenderCell); runtimeCombo.RowSeparatorFunc = RuntimeIsSeparator; var runtimeComboVBox = new VBox (); runtimeComboVBox.PackStart (runtimeCombo, true, false, 0); configurationCombosBox.PackStart (runtimeComboVBox, false, false, 0); AddWidget (configurationCombosBox); buttonBarBox = new Alignment (0.5f, 0.5f, 0, 0); buttonBarBox.LeftPadding = (uint) 7; buttonBarBox.Add (buttonBar); buttonBarBox.NoShowAll = true; AddWidget (buttonBarBox); AddSpace (24); statusArea = new StatusArea (); statusArea.ShowMessage (BrandingService.ApplicationName); var statusAreaAlign = new Alignment (0, 0, 1, 1); statusAreaAlign.Add (statusArea); contentBox.PackStart (statusAreaAlign, true, true, 0); AddSpace (24); statusAreaAlign.SizeAllocated += (object o, SizeAllocatedArgs args) => { Gtk.Widget toplevel = this.Toplevel; if (toplevel == null) return; int windowWidth = toplevel.Allocation.Width; int center = windowWidth / 2; int left = Math.Max (center - 300, args.Allocation.Left); int right = Math.Min (left + 600, args.Allocation.Right); uint left_padding = (uint) (left - args.Allocation.Left); uint right_padding = (uint) (args.Allocation.Right - right); if (left_padding != statusAreaAlign.LeftPadding || right_padding != statusAreaAlign.RightPadding) statusAreaAlign.SetPadding (0, 0, (uint) left_padding, (uint) right_padding); }; matchEntry = new SearchEntry (); var searchFiles = this.matchEntry.AddMenuItem (GettextCatalog.GetString ("Search Files")); searchFiles.Activated += delegate { SetSearchCategory ("files"); }; var searchTypes = this.matchEntry.AddMenuItem (GettextCatalog.GetString ("Search Types")); searchTypes.Activated += delegate { SetSearchCategory ("type"); }; var searchMembers = this.matchEntry.AddMenuItem (GettextCatalog.GetString ("Search Members")); searchMembers.Activated += delegate { SetSearchCategory ("member"); }; matchEntry.ForceFilterButtonVisible = true; matchEntry.Entry.FocusOutEvent += delegate { matchEntry.Entry.Text = ""; }; var cmd = IdeApp.CommandService.GetCommand (Commands.NavigateTo); cmd.KeyBindingChanged += delegate { UpdateSearchEntryLabel (); }; UpdateSearchEntryLabel (); matchEntry.Ready = true; matchEntry.Visible = true; matchEntry.IsCheckMenu = true; matchEntry.Entry.ModifyBase (StateType.Normal, Style.White); matchEntry.WidthRequest = 240; matchEntry.RoundedShape = true; matchEntry.Entry.Changed += HandleSearchEntryChanged; matchEntry.Activated += (sender, e) => { var pattern = SearchPopupSearchPattern.ParsePattern (matchEntry.Entry.Text); if (pattern.Pattern == null && pattern.LineNumber > 0) { popup.Destroy (); var doc = IdeApp.Workbench.ActiveDocument; if (doc != null && doc != null) { doc.Select (); doc.Editor.Caret.Location = new Mono.TextEditor.DocumentLocation (pattern.LineNumber, pattern.Column > 0 ? pattern.Column : 1); doc.Editor.CenterToCaret (); doc.Editor.Parent.StartCaretPulseAnimation (); } return; } if (popup != null) popup.OpenFile (); }; matchEntry.Entry.KeyPressEvent += (o, args) => { if (args.Event.Key == Gdk.Key.Escape) { var doc = IdeApp.Workbench.ActiveDocument; if (doc != null) { if (popup != null) popup.Destroy (); doc.Select (); } return; } if (popup != null) { args.RetVal = popup.ProcessKey (args.Event.Key, args.Event.State); } }; IdeApp.Workbench.RootWindow.WidgetEvent += delegate(object o, WidgetEventArgs args) { if (args.Event is Gdk.EventConfigure) PositionPopup (); }; BuildToolbar (); IdeApp.CommandService.RegisterCommandBar (buttonBar); AddinManager.ExtensionChanged += delegate(object sender, ExtensionEventArgs args) { if (args.PathChanged (ToolbarExtensionPath)) BuildToolbar (); }; contentBox.PackStart (matchEntry, false, false, 0); var align = new Gtk.Alignment (0, 0, 1f, 1f); align.Show (); align.TopPadding = (uint) 5; align.LeftPadding = (uint) 9; align.RightPadding = (uint) 18; align.BottomPadding = (uint) 10; align.Add (contentBox); Add (align); SetDefaultSizes (-1, 21); UpdateCombos (); button.Clicked += HandleStartButtonClicked; IdeApp.CommandService.RegisterCommandBar (this); IdeApp.CommandService.ActiveWidgetChanged += (sender, e) => { lastCommandTarget = e.OldActiveWidget; }; this.ShowAll (); this.statusArea.statusIconBox.HideAll (); }
public MainToolbar() { IdeApp.Workspace.ActiveConfigurationChanged += (sender, e) => UpdateCombos(); IdeApp.Workspace.ConfigurationsChanged += (sender, e) => UpdateCombos(); IdeApp.Workspace.SolutionLoaded += (sender, e) => UpdateCombos(); IdeApp.Workspace.SolutionUnloaded += (sender, e) => UpdateCombos(); IdeApp.ProjectOperations.CurrentSelectedSolutionChanged += HandleCurrentSelectedSolutionChanged; WidgetFlags |= Gtk.WidgetFlags.AppPaintable; AddWidget(button); AddSpace(8); configurationCombo = new Gtk.ComboBox(); configurationCombo.Model = configurationStore; var ctx = new Gtk.CellRendererText(); configurationCombo.PackStart(ctx, true); configurationCombo.AddAttribute(ctx, "text", 0); configurationCombosBox = new HBox(false, 8); var configurationComboVBox = new VBox(); configurationComboVBox.PackStart(configurationCombo, true, false, 0); configurationCombosBox.PackStart(configurationComboVBox, false, false, 0); runtimeCombo = new Gtk.ComboBox(); runtimeCombo.Model = runtimeStore; runtimeCombo.PackStart(ctx, true); runtimeCombo.AddAttribute(ctx, "text", 0); var runtimeComboVBox = new VBox(); runtimeComboVBox.PackStart(runtimeCombo, true, false, 0); configurationCombosBox.PackStart(runtimeComboVBox, false, false, 0); AddWidget(configurationCombosBox); buttonBarBox = new Alignment(0.5f, 0.5f, 0, 0); buttonBarBox.LeftPadding = 7; buttonBarBox.Add(buttonBar); buttonBarBox.NoShowAll = true; AddWidget(buttonBarBox); AddSpace(24); statusArea = new StatusArea(); statusArea.ShowMessage(BrandingService.ApplicationName); var statusAreaAlign = new Alignment(0, 0, 1, 1); statusAreaAlign.Add(statusArea); contentBox.PackStart(statusAreaAlign, true, true, 0); AddSpace(24); statusAreaAlign.SizeAllocated += (object o, SizeAllocatedArgs args) => { Gtk.Widget toplevel = this.Toplevel; if (toplevel == null) { return; } int windowWidth = toplevel.Allocation.Width; int center = windowWidth / 2; int left = Math.Max(center - 300, args.Allocation.Left); int right = Math.Min(left + 600, args.Allocation.Right); uint left_padding = (uint)(left - args.Allocation.Left); uint right_padding = (uint)(args.Allocation.Right - right); if (left_padding != statusAreaAlign.LeftPadding || right_padding != statusAreaAlign.RightPadding) { statusAreaAlign.SetPadding(0, 0, (uint)left_padding, (uint)right_padding); } }; matchEntry = new SearchEntry(); var searchFiles = this.matchEntry.AddMenuItem(GettextCatalog.GetString("Search Files")); searchFiles.Activated += delegate { SetSearchCategory("files"); }; var searchTypes = this.matchEntry.AddMenuItem(GettextCatalog.GetString("Search Types")); searchTypes.Activated += delegate { SetSearchCategory("type"); }; var searchMembers = this.matchEntry.AddMenuItem(GettextCatalog.GetString("Search Members")); searchMembers.Activated += delegate { SetSearchCategory("member"); }; matchEntry.ForceFilterButtonVisible = true; matchEntry.Entry.FocusOutEvent += delegate { matchEntry.Entry.Text = ""; }; var cmd = IdeApp.CommandService.GetCommand(Commands.NavigateTo); cmd.KeyBindingChanged += delegate { UpdateSearchEntryLabel(); }; UpdateSearchEntryLabel(); matchEntry.Ready = true; matchEntry.Visible = true; matchEntry.IsCheckMenu = true; matchEntry.Entry.ModifyBase(StateType.Normal, Style.White); matchEntry.WidthRequest = 240; matchEntry.RoundedShape = true; matchEntry.Entry.Changed += HandleSearchEntryChanged; matchEntry.Activated += (sender, e) => { if (popup != null) { popup.OpenFile(); } }; matchEntry.Entry.KeyPressEvent += (o, args) => { if (args.Event.Key == Gdk.Key.Escape) { var doc = IdeApp.Workbench.ActiveDocument; if (doc != null) { if (popup != null) { popup.Destroy(); } doc.Select(); } return; } if (popup != null) { args.RetVal = popup.ProcessKey(args.Event.Key, args.Event.State); } }; IdeApp.Workbench.RootWindow.WidgetEvent += delegate(object o, WidgetEventArgs args) { if (args.Event is Gdk.EventConfigure) { PositionPopup(); } }; BuildToolbar(); IdeApp.CommandService.RegisterCommandBar(buttonBar); AddinManager.ExtensionChanged += delegate(object sender, ExtensionEventArgs args) { if (args.PathChanged(ToolbarExtensionPath)) { BuildToolbar(); } }; contentBox.PackStart(matchEntry, false, false, 0); var align = new Gtk.Alignment(0, 0, 1f, 1f); align.Show(); align.TopPadding = 5; align.LeftPadding = 9; align.RightPadding = 18; align.BottomPadding = 10; align.Add(contentBox); Add(align); UpdateCombos(); button.Clicked += HandleStartButtonClicked; IdeApp.CommandService.RegisterCommandBar(this); this.ShowAll(); this.statusArea.statusIconBox.HideAll(); }