public void Show(Xwt.Popover.Position orientation, Xwt.Widget reference, Xwt.Rectangle positionRect, Widget child) { var parent = reference.ParentWindow; popover = new PopoverWindow((Gtk.Widget)((WidgetBackend)Toolkit.GetBackend(child)).NativeWidget, orientation); popover.SetPadding(frontend.Padding); popover.TransientFor = ((WindowFrameBackend)Toolkit.GetBackend(parent)).Window; popover.DestroyWithParent = true; popover.Hidden += (o, args) => { popover.ReleaseInnerWidget(); sink.OnClosed(); popover.Destroy(); }; var screenBounds = reference.ScreenBounds; if (positionRect == Rectangle.Zero) { positionRect = new Rectangle(Point.Zero, screenBounds.Size); } positionRect = positionRect.Offset(screenBounds.Location); var position = new Point(positionRect.Center.X, popover.ArrowPosition == Popover.Position.Top ? positionRect.Bottom : positionRect.Top); popover.ShowAll(); popover.GrabFocus(); int w, h; popover.GetSize(out w, out h); popover.Move((int)position.X - w / 2, (int)position.Y); popover.SizeAllocated += (o, args) => { popover.Move((int)position.X - args.Allocation.Width / 2, (int)position.Y); popover.GrabFocus(); }; }
protected Xwt.Widget Read(string Text) { YAXLib.YAXSerializer Y = new YAXSerializer(typeof(FrameRootNode), YAXExceptionHandlingPolicies.DoNotThrow); FrameRootNode Target = (FrameRootNode)Y.Deserialize(Text); this.Root = Target.Content.Makeup(this); return Root; }
public static Gdk.Rectangle GetSceenBounds(this Xwt.Widget widget) { var wbounds = widget.ScreenBounds.ToGdkRectangle(); #if MAC // Xwt.Widget.ScreenBounds is toolkit specific and Cocoa uses a different screen coordinate system. var view = widget.Surface.NativeWidget as AppKit.NSView; if (view != null) { var point = ConvertToGdkCoordinates(view.Window?.Screen, wbounds.Location); wbounds.X = point.X; wbounds.Y = point.Y; //var monitor = AppKit.NSScreen.Screens.IndexOf (view.Window.Screen); //var macgeometry = view.Window.Screen.Frame; //Gdk.Rectangle geometry = Gdk.Screen.Default.GetMonitorGeometry (monitor); //// HACK: Cocoa screen frames are always relative to the main monitor 0, but we need absolute //// coordinates in the Gdk system (origin is top-left corner of the left screen). //// x position is relative to main monitor 0, //// calculate X pos relative to current monitor first //wbounds.X = (int) Math.Abs (macgeometry.X - wbounds.X); //wbounds.X += geometry.X; } #endif return(wbounds); }
/// <summary>Apply the specified selector (style) to the specified widget</summary> /// <param name="Widget">The widget that should "got" the style</param> /// <param name="Style">The specified selector with the desired style</param> public void ApplyStyle(Xwt.Widget Widget, string Pattern) { if (Widget.GetType() == typeof(Xwt.Label)) { ApplyStyle((Xwt.Label)Widget, Pattern); return; } if (Widget.GetType() == typeof(Xwt.Box)) { ApplyStyle((Xwt.Box)Widget, Pattern); return; } Selector Selector = CSS[Pattern]; if (Selector.Declarations["background-color"].Value != "inherit") { Widget.BackgroundColor = Utilities.GetXwtColor( Selector.Declarations["background-color"].Value ); } if (Selector.Declarations["font-family"].Value != "inherit") { Widget.Font = Xwt.Drawing.Font.FromName( Selector.Declarations["font-family"].Value ); } Widget.Visible = Selector.Declarations["display"].Value == "none" ? false : true; }
public void Show(Xwt.Popover.Position orientation, Xwt.Widget reference, Xwt.Rectangle positionRect, Widget child) { ActualPosition = orientation; Border.Child = (System.Windows.FrameworkElement)Xwt.Engine.WidgetRegistry.GetNativeWidget(child); NativeWidget.PlacementTarget = (System.Windows.FrameworkElement)Xwt.Engine.WidgetRegistry.GetNativeWidget(reference); NativeWidget.IsOpen = true; }
public static void SetCommonAccessibilityAttributes(this Xwt.Widget w, string name, Xwt.Widget label, string help) { w.Accessible.SetCommonAttributes(name, null, help); if (label != null) { // FIXME Add relationship to Xwt } }
public void Show(Xwt.Popover.Position orientation, Xwt.Widget reference, Xwt.Rectangle positionRect, Widget child) { popover.Content = (Gtk.Widget)((WidgetBackend)Toolkit.GetBackend(child)).NativeWidget; popover.ArrowPosition = orientation; popover.BackgroundColor = BackgroundColor.ToCairoColor(); popover.Padding = frontend.Padding; var parent = (WindowFrameBackend)Toolkit.GetBackend(reference.ParentWindow); if (popover.TransientFor != parent.Window) { if (popover.TransientFor != null) { popover.TransientFor.FocusInEvent -= HandleParentFocusInEvent; } popover.TransientFor = parent.Window; popover.TransientFor.FocusInEvent += HandleParentFocusInEvent; } popover.Hidden += (o, args) => sink.OnClosed(); var screenBounds = reference.ScreenBounds; if (positionRect == Rectangle.Zero) { positionRect = new Rectangle(Point.Zero, screenBounds.Size); } positionRect = positionRect.Offset(screenBounds.Location); var position = new Point(positionRect.Center.X, popover.ArrowPosition == Popover.Position.Top ? positionRect.Bottom : positionRect.Top); popover.Show(); popover.Present(); popover.GrabFocus(); int w, h; popover.GetSize(out w, out h); if (popover.ArrowPosition == Popover.Position.Top) { popover.Move((int)position.X - w / 2, (int)position.Y); } else { popover.Move((int)position.X - w / 2, (int)position.Y - h); } popover.SizeAllocated += (o, args) => { if (popover.ArrowPosition == Popover.Position.Top) { popover.Move((int)position.X - args.Allocation.Width / 2, (int)position.Y); } else { popover.Move((int)position.X - args.Allocation.Width / 2, (int)position.Y - args.Allocation.Height); } popover.GrabFocus(); }; }
internal void ShowPopup(Xwt.Widget widget, Xwt.Rectangle caret, PopupPosition position) { xwtParent = widget; this.currentCaret = new Gdk.Rectangle((int)caret.X, (int)caret.Y, (int)caret.Width, (int)caret.Height); Theme.TargetPosition = position; var pos = GtkUtil.GetSceenBounds(widget); targetWindowOrigin = new Point((int)pos.X, (int)pos.Y); RepositionWindow(); }
DocumentViewContent AttachView(Xwt.Widget childView, string title) { var content = new DocumentViewContent(() => new XwtControl(childView)) { Title = title }; mainView.AttachedViews.Add(content); return(content); }
public void CheckWidgetRender(string refImageName, Xwt.Widget widget, int winWidth = 300, int winHeight = 100) { using (var win = new Window { Width = winWidth, Height = winHeight }) { win.Content = widget; ShowWindow(win); var img = Toolkit.CurrentEngine.RenderWidget(widget); ReferenceImageManager.CheckImage(refImageName, img); } }
/// <summary>Initialize FileProcessDialog with a custom widget inside</summary> /// <param name="ProgressBox">Link to the xwt widget, which should be displayed in the FileProcessDialog.</param> public FileProcessDialog(ref Xwt.Widget ProgressBox) { Localizator locale = new Localizator(); this.Title = locale.GetString("FileProgressDialogTitle"); cmdCancel.Label = locale.GetString("Cancel"); this.Decorated = false; Layout.PackStart(ProgressBox, true, true); Layout.PackStart(cmdCancel, false, false); this.Content = Layout; }
public static Gdk.Point ToScreenCoordinates(this Xwt.Widget widget, Xwt.Point point) { var spoint = widget.ConvertToScreenCoordinates(point).ToGdkPoint(); #if MAC // Xwt.Widget.ScreenBounds is toolkit specific and Cocoa uses a different screen coordinate system. var view = widget.Surface.NativeWidget as AppKit.NSView; if (view != null) { spoint = ConvertToGdkCoordinates(view.Window?.Screen, spoint); } #endif return(spoint); }
internal void Show(Xwt.Widget parent, int x, int y, Action closeHandler, bool selectFirstItem = false) { if (parent.Surface.NativeWidget is Gtk.Widget widget) { Show(widget, x, y, closeHandler, selectFirstItem); return; } #if MAC if (parent.Surface.NativeWidget is AppKit.NSView view) { ContextMenuExtensionsMac.ShowContextMenu((AppKit.NSView)view, x, y, this, closeHandler, selectFirstItem); return; } #endif throw new NotSupportedException(); }
void RegisterFocusHandlers(Xwt.Widget widget) { // FIXME: No background color selection widget.CanGetFocus = true; widget.GotFocus += (sender, e) => { var w = (Xwt.Widget)sender; w.BackgroundColor = Ide.Gui.Styles.BaseSelectionBackgroundColor; }; widget.LostFocus += (sender, e) => { var w = (Xwt.Widget)sender; w.BackgroundColor = Ide.Gui.Styles.BackgroundColor; }; }
/// <summary>Enable theming of the widget</summary> /// <param name="Widget">The widget that needs to be themized</param> /// <param name="Selector">The selector pattern</param> public void Stylize(Xwt.Widget Widget, string Selector = "Widget") { if (!semaphore) { semaphore = true; Stylize(Widget, "Widget"); //apply default style for all widgets try { Stylize(Widget, Widget.GetType().ToString().Substring(Widget.GetType().ToString().IndexOf('.') + 1)); //apply default style for the widget type } catch { Console.WriteLine("NOTICE: No style is set for widgets of type " + Widget.GetType().ToString().Substring(Widget.GetType().ToString().IndexOf('.') + 1)); } semaphore = false; } ApplyStyle(Widget, Selector); Widget.MouseEntered += (o, ea) => { ApplyStyle(Widget, Selector + ":hover"); }; Widget.MouseExited += (o, ea) => { ApplyStyle(Widget, Selector); if (Widget.HasFocus) { ApplyStyle(Widget, Selector + ":focus"); } }; Widget.ButtonPressed += (o, ea) => { ApplyStyle(Widget, Selector + ":active"); }; Widget.GotFocus += (o, ea) => { ApplyStyle(Widget, Selector + ":focus"); }; Widget.LostFocus += (o, ea) => { ApplyStyle(Widget, Selector); }; Widget.ButtonReleased += (o, ea) => { ApplyStyle(Widget, Selector); if (Widget.HasFocus) { ApplyStyle(Widget, Selector + ":focus"); } }; }
public void Show(Xwt.Popover.Position orientation, Xwt.Widget reference, Xwt.Rectangle positionRect, Widget child) { ActualPosition = orientation; Border.Child = (System.Windows.FrameworkElement)Context.Toolkit.GetNativeWidget(child); NativeWidget.CustomPopupPlacementCallback = (popupSize, targetSize, offset) => { System.Windows.Point location; if (ActualPosition == Popover.Position.Top) { location = new System.Windows.Point(positionRect.Left, positionRect.Bottom); } else { location = new System.Windows.Point(positionRect.Left, positionRect.Top - popupSize.Height); } return(new[] { new System.Windows.Controls.Primitives.CustomPopupPlacement(location, System.Windows.Controls.Primitives.PopupPrimaryAxis.Horizontal) }); }; NativeWidget.PlacementTarget = (System.Windows.FrameworkElement)Context.Toolkit.GetNativeWidget(reference); NativeWidget.IsOpen = true; }
public void Show(Xwt.Popover.Position orientation, Xwt.Widget reference, Xwt.Rectangle positionRect, Widget child) { ActualPosition = orientation; SetupBorderMargin(); Border.Child = (System.Windows.FrameworkElement)Context.Toolkit.GetNativeWidget(child); NativeWidget.CustomPopupPlacementCallback = (popupSize, targetSize, offset) => { System.Windows.Point location; if (ActualPosition == Popover.Position.Top) { location = new System.Windows.Point(positionRect.Left - popupSize.Width / 2, positionRect.Height > 0 ? positionRect.Bottom : targetSize.Height); } else { location = new System.Windows.Point(positionRect.Left - popupSize.Width / 2, positionRect.Top - popupSize.Height); } return(new[] { new System.Windows.Controls.Primitives.CustomPopupPlacement(location, System.Windows.Controls.Primitives.PopupPrimaryAxis.Horizontal) }); }; NativeWidget.PlacementTarget = (System.Windows.FrameworkElement)Context.Toolkit.GetNativeWidget(reference); NativeWidget.IsOpen = true; // Popups are special in that the automation properties need to be set on the PopupRoot, which only exists when the popup is shown // See https://social.msdn.microsoft.com/Forums/vstudio/en-US/d4ba12c8-7a87-478e-b064-5620f929a0cf/how-to-set-automationid-and-name-for-popup?forum=wpf var accessibleBackend = (AccessibleBackend)Toolkit.GetBackend(Frontend.Accessible); if (accessibleBackend != null) { FrameworkElement popupRoot = GetPopupRoot(); if (popupRoot != null) { accessibleBackend.InitAutomationProperties(popupRoot); } } }
public static void SetCommonAccessibilityAttributes(this Xwt.Widget w, string name, string label, string help) { w.Accessible.SetCommonAttributes(name, label, help); }
public virtual override object GetNativeParentWindow(Xwt.Widget w) { throw new NotImplementedException(); }
public static Gdk.Rectangle ToScreenCoordinates(Xwt.Widget widget, Xwt.Rectangle rect) { return(new Gdk.Rectangle(ToScreenCoordinates(widget, rect.Location), new Gdk.Size((int)rect.Width, (int)rect.Height))); }
public override object GetNativeWidget(Xwt.Widget w) { throw new NotImplementedException(); }
/// <summary>Load the file in the VE</summary> /// <param name="URL">The URL of the file</param> /// <param name="FS">The filesystem of the file</param> /// <param name="plugin">The VE plugin, which will be used to load this file</param> /// <param name="AllowEdit">Allow editing the file</param> public void LoadFile(string URL, pluginner.IFSPlugin FS, pluginner.IVEPlugin plugin, bool AllowEdit) { //check for external editor try{ if (fcmd.Properties.Settings.Default.UseExternalEditor && AllowEdit || fcmd.Properties.Settings.Default.UseExternalViewer && !AllowEdit && URL.StartsWith("file:")){ CanBeShowed = false; if (AllowEdit){ ExecuteProgram(fcmd.Properties.Settings.Default.ExternalEditor.Replace("$", "\"" + URL)); } else{ ExecuteProgram(fcmd.Properties.Settings.Default.ExternalViewer.Replace("$", "\"" + URL)); } return; } } catch (Exception ex) { Xwt.MessageDialog.ShowError(Locale.GetString("CantRunEXE"), ex.Message); CanBeShowed = false; return; } string FiNa4Title = URL.Substring(URL.LastIndexOf(FS.DirSeparator) + 1); IsEditor = AllowEdit; if(AllowEdit) this.Title = string.Format(Locale.GetString("FCETitle"), FiNa4Title); else this.Title = string.Format(Locale.GetString("FCVTitle"), FiNa4Title); FileProcessDialog ProgressDialog = new FileProcessDialog(); string ProgressInitialText = String.Format(Locale.GetString("FCVELoadingMsg"),URL); ProgressDialog.lblStatus.Text = ProgressInitialText; FS.ProgressChanged += (d) => { ProgressDialog.pbrProgress.Fraction = (d >= 0 && d <= 1) ? d : ProgressDialog.pbrProgress.Fraction; Xwt.Application.MainLoop.DispatchPendingEvents(); }; FS.StatusChanged += (d) => { ProgressDialog.lblStatus.Text = ProgressInitialText + "\n" + d; Xwt.Application.MainLoop.DispatchPendingEvents(); }; ProgressDialog.cmdCancel.Clicked += (o, ea) => { CanBeShowed = false; ProgressDialog.Hide(); return; }; ProgressDialog.Show(); Xwt.Application.MainLoop.DispatchPendingEvents(); if (!CanBeShowed) return; Plugin = plugin; Plugin.ReadOnly = !AllowEdit; Plugin.OpenFile(URL, FS); Plugin.ShowToolbar = fcmd.Properties.Settings.Default.VE_ShowToolbar; Plugin.Stylist = s; mnuFormat.SubMenu = Plugin.FormatMenu; bool Mode = AllowEdit; if (!Plugin.CanEdit && AllowEdit) { Xwt.MessageDialog.ShowWarning(String.Format(Locale.GetString("FCVEpluginro1"), Plugin.Name + " " + Plugin.Version), Locale.GetString("FCVEpluginro2")); Mode = false; } FSPlugin = FS; PluginBody = Plugin.Body; SetVEMode(Mode); BuildLayout(); ProgressDialog.Hide(); PluginBody.KeyReleased += (sender, e) => { if(e.Key == Xwt.Key.Escape) CommandBox.SetFocus(); if(e.Key == Xwt.Key.q) this.OnCloseRequested(); }; }
public static Gtk.Widget ToGtkWidget(this Xwt.Widget widget) { return((Gtk.Widget)GtkToolkit.GetNativeWidget(widget)); }
public ISpaceReservationAgent CreatePopupAgent(ITrackingSpan visualSpan, PopupStyles styles, Xwt.Widget content) { return(new PopupAgent(_view, this, visualSpan, styles, content)); }
internal void ShowPopup (Xwt.Widget widget, Xwt.Rectangle caret, PopupPosition position) { xwtParent = widget; this.currentCaret = new Gdk.Rectangle ((int)caret.X, (int)caret.Y, (int)caret.Width, (int)caret.Height); Theme.TargetPosition = position; var pos = GtkUtil.GetSceenBounds (widget); targetWindowOrigin = new Point ((int)pos.X, (int)pos.Y); RepositionWindow (); }
public static bool IsMouseOver(this Xwt.Widget widget) { var mousePosition = Xwt.Desktop.MouseLocation; return(widget.ScreenBounds.Contains(mousePosition)); }
public VEd() { for (int i = 1; i < 11; i++) { KeybHelpButtons[i] = new KeyboardHelpButton(); KeybHelpButtons[i].FKey = "F" + i; KeybHelpButtons[i].Text = Locale.GetString("FCVE_F" + i); KeybHelpButtons[i].CanGetFocus = false; KeyBoardHelp.PackStart(KeybHelpButtons[i], true, Xwt.WidgetPlacement.Fill, Xwt.WidgetPlacement.Fill, 0,1,0,1); } this.Title = Locale.GetString("File Commander VE"); this.Content = Layout; CommandBox.KeyReleased += new EventHandler<Xwt.KeyEventArgs>(CommandBox_KeyReleased); mnuFile.Label = Locale.GetString("FCVE_mnuFile"); mnuFile.SubMenu = new Xwt.Menu(); mnuFile.SubMenu.Items.Add(mnuFileNew); mnuFile.SubMenu.Items.Add(mnuFileOpen); mnuFile.SubMenu.Items.Add(mnuFileReload); mnuFile.SubMenu.Items.Add(mnuFileSave); mnuFile.SubMenu.Items.Add(new Xwt.SeparatorMenuItem()); mnuFile.SubMenu.Items.Add(mnuFilePrint); mnuFile.SubMenu.Items.Add(mnuFilePrintPreview); mnuFile.SubMenu.Items.Add(mnuFilePrintSettings); mnuFile.SubMenu.Items.Add(new Xwt.SeparatorMenuItem()); mnuFile.SubMenu.Items.Add(mnuFileClose); TranslateMenu(mnuFile.SubMenu); mnuEdit.Label = Locale.GetString("FCVE_mnuEdit"); mnuEdit.SubMenu = new Xwt.Menu(); mnuEdit.SubMenu.Items.Add(mnuEditCut); mnuEdit.SubMenu.Items.Add(mnuEditCopy); mnuEdit.SubMenu.Items.Add(mnuEditPaste); mnuEdit.SubMenu.Items.Add(new Xwt.SeparatorMenuItem()); mnuEdit.SubMenu.Items.Add(mnuEditSelectAll); mnuEdit.SubMenu.Items.Add(new Xwt.SeparatorMenuItem()); mnuEdit.SubMenu.Items.Add(mnuEditFindReplace); mnuEdit.SubMenu.Items.Add(mnuEditFindNext); TranslateMenu(mnuEdit.SubMenu); mnuView.Label = Locale.GetString("FCVE_mnuView"); mnuViewSettings.Clicked += (o, ea) => { new VEsettings().Run(); Plugin.ShowToolbar = fcmd.Properties.Settings.Default.VE_ShowToolbar; KeyBoardHelp.Visible = Properties.Settings.Default.ShowKeybrdHelp; CommandBox.Visible = Properties.Settings.Default.VE_ShowCmdBar; }; mnuView.SubMenu = new Xwt.Menu(); mnuView.SubMenu.Items.Add(mnuViewSettings); TranslateMenu(mnuView.SubMenu); mnuFormat.Label = Locale.GetString("FCVE_mnuFormat"); mnuHelp.Label = Locale.GetString("FCVE_mnuHelp"); mnuHelp.SubMenu = new Xwt.Menu(); mnuHelp.SubMenu.Items.Add(mnuHelpHelpme); mnuHelp.SubMenu.Items.Add(mnuHelpAbout); TranslateMenu(mnuHelp.SubMenu); this.MainMenu = new Xwt.Menu(); this.MainMenu.Items.Add(mnuFile); this.MainMenu.Items.Add(mnuEdit); this.MainMenu.Items.Add(mnuView); this.MainMenu.Items.Add(mnuFormat); this.MainMenu.Items.Add(mnuHelp); mnuFileOpen.Clicked += (o, ea) => { OpenFile(); }; mnuFilePrint.Clicked += (o, ea) => { SendCommand("print"); }; mnuFilePrintSettings.Clicked += (o, ea) => { SendCommand("pagesetup"); }; mnuFilePrintPreview.Clicked += (o, ea) => { SendCommand("print preview"); }; mnuFileClose.Clicked += (o, ea) => { Exit(); }; mnuEditCut.Clicked += (o, ea) => { SendCommand("cut selected"); }; mnuEditCopy.Clicked += (o, ea) => { SendCommand("copy selected"); }; mnuEditPaste.Clicked += (o, ea) => { SendCommand("paste clipboard"); }; mnuEditSelectAll.Clicked += (o, ea) => { SendCommand("select *"); }; mnuEditFindReplace.Clicked += (o, ea) => { SendCommand("findreplace"); }; mnuEditFindNext.Clicked += (o, ea) => { SendCommand("findreplace last"); }; mnuHelpAbout.Clicked += new EventHandler(mnuHelpAbout_Clicked); this.CloseRequested += VEd_CloseRequested; this.Shown += new EventHandler(VEd_Shown); #if !MONO PluginBody = new Xwt.Spinner() { Animate = true }; #else PluginBody = new Xwt.HBox(); //"workaround" for xwt/XWT bug https://github.com/mono/xwt/issues/283 #endif BuildLayout(); }
KeyboardHelpButton[] KeybHelpButtons = new KeyboardHelpButton[11]; //одна лишняя, которая [0] public VEd() { for (int i = 1; i < 11; i++) { KeybHelpButtons[i] = new KeyboardHelpButton(); KeybHelpButtons[i].FKey = "F" + i; KeybHelpButtons[i].Text = Locale.GetString("FCVE_F" + i); KeybHelpButtons[i].CanGetFocus = false; KeyBoardHelp.PackStart(KeybHelpButtons[i], true, Xwt.WidgetPlacement.Fill, Xwt.WidgetPlacement.Fill, 0, 1, 0, 1); } this.Title = Locale.GetString("File Commander VE"); this.Content = Layout; CommandBox.KeyReleased += new EventHandler <Xwt.KeyEventArgs>(CommandBox_KeyReleased); mnuFile.Label = Locale.GetString("FCVE_mnuFile"); mnuFile.SubMenu = new Xwt.Menu(); mnuFile.SubMenu.Items.Add(mnuFileNew); mnuFile.SubMenu.Items.Add(mnuFileOpen); mnuFile.SubMenu.Items.Add(mnuFileReload); mnuFile.SubMenu.Items.Add(mnuFileSave); mnuFile.SubMenu.Items.Add(new Xwt.SeparatorMenuItem()); mnuFile.SubMenu.Items.Add(mnuFilePrint); mnuFile.SubMenu.Items.Add(mnuFilePrintPreview); mnuFile.SubMenu.Items.Add(mnuFilePrintSettings); mnuFile.SubMenu.Items.Add(new Xwt.SeparatorMenuItem()); mnuFile.SubMenu.Items.Add(mnuFileClose); TranslateMenu(mnuFile.SubMenu); mnuEdit.Label = Locale.GetString("FCVE_mnuEdit"); mnuEdit.SubMenu = new Xwt.Menu(); mnuEdit.SubMenu.Items.Add(mnuEditCut); mnuEdit.SubMenu.Items.Add(mnuEditCopy); mnuEdit.SubMenu.Items.Add(mnuEditPaste); mnuEdit.SubMenu.Items.Add(new Xwt.SeparatorMenuItem()); mnuEdit.SubMenu.Items.Add(mnuEditSelectAll); mnuEdit.SubMenu.Items.Add(new Xwt.SeparatorMenuItem()); mnuEdit.SubMenu.Items.Add(mnuEditFindReplace); mnuEdit.SubMenu.Items.Add(mnuEditFindNext); TranslateMenu(mnuEdit.SubMenu); mnuView.Label = Locale.GetString("FCVE_mnuView"); mnuViewSettings.Clicked += (o, ea) => { new VEsettings().Run(); Plugin.ShowToolbar = fcmd.Properties.Settings.Default.VE_ShowToolbar; KeyBoardHelp.Visible = Properties.Settings.Default.ShowKeybrdHelp; CommandBox.Visible = Properties.Settings.Default.VE_ShowCmdBar; }; mnuView.SubMenu = new Xwt.Menu(); mnuView.SubMenu.Items.Add(mnuViewSettings); TranslateMenu(mnuView.SubMenu); mnuFormat.Label = Locale.GetString("FCVE_mnuFormat"); mnuHelp.Label = Locale.GetString("FCVE_mnuHelp"); mnuHelp.SubMenu = new Xwt.Menu(); mnuHelp.SubMenu.Items.Add(mnuHelpHelpme); mnuHelp.SubMenu.Items.Add(mnuHelpAbout); TranslateMenu(mnuHelp.SubMenu); this.MainMenu = new Xwt.Menu(); this.MainMenu.Items.Add(mnuFile); this.MainMenu.Items.Add(mnuEdit); this.MainMenu.Items.Add(mnuView); this.MainMenu.Items.Add(mnuFormat); this.MainMenu.Items.Add(mnuHelp); mnuFileOpen.Clicked += (o, ea) => { OpenFile(); }; mnuFilePrint.Clicked += (o, ea) => { SendCommand("print"); }; mnuFilePrintSettings.Clicked += (o, ea) => { SendCommand("pagesetup"); }; mnuFilePrintPreview.Clicked += (o, ea) => { SendCommand("print preview"); }; mnuFileClose.Clicked += (o, ea) => { Exit(); }; mnuEditCut.Clicked += (o, ea) => { SendCommand("cut selected"); }; mnuEditCopy.Clicked += (o, ea) => { SendCommand("copy selected"); }; mnuEditPaste.Clicked += (o, ea) => { SendCommand("paste clipboard"); }; mnuEditSelectAll.Clicked += (o, ea) => { SendCommand("select *"); }; mnuEditFindReplace.Clicked += (o, ea) => { SendCommand("findreplace"); }; mnuEditFindNext.Clicked += (o, ea) => { SendCommand("findreplace last"); }; mnuHelpAbout.Clicked += new EventHandler(mnuHelpAbout_Clicked); this.CloseRequested += VEd_CloseRequested; this.Shown += new EventHandler(VEd_Shown); #if !MONO PluginBody = new Xwt.Spinner() { Animate = true }; #else PluginBody = new Xwt.HBox(); //"workaround" for xwt/XWT bug https://github.com/mono/xwt/issues/283 #endif BuildLayout(); }
public override bool HasNativeParent(Xwt.Widget w) { throw new NotImplementedException(); }
public virtual void UpdateLayout() { Xwt.Widget frontend = (Xwt.Widget)Frontend; widget.Margin = new Thickness(frontend.Margin.Left, frontend.Margin.Top, frontend.Margin.Right, frontend.Margin.Bottom); }
/// <summary>Load the file in the VE</summary> /// <param name="URL">The URL of the file</param> /// <param name="FS">The filesystem of the file</param> /// <param name="plugin">The VE plugin, which will be used to load this file</param> /// <param name="AllowEdit">Allow editing the file</param> public void LoadFile(string URL, pluginner.IFSPlugin FS, pluginner.IVEPlugin plugin, bool AllowEdit) { //check for external editor try{ if (fcmd.Properties.Settings.Default.UseExternalEditor && AllowEdit || fcmd.Properties.Settings.Default.UseExternalViewer && !AllowEdit && URL.StartsWith("file:")) { CanBeShowed = false; if (AllowEdit) { ExecuteProgram(fcmd.Properties.Settings.Default.ExternalEditor.Replace("$", "\"" + URL)); } else { ExecuteProgram(fcmd.Properties.Settings.Default.ExternalViewer.Replace("$", "\"" + URL)); } return; } } catch (Exception ex) { Xwt.MessageDialog.ShowError(Locale.GetString("CantRunEXE"), ex.Message); CanBeShowed = false; return; } string FiNa4Title = URL.Substring(URL.LastIndexOf(FS.DirSeparator) + 1); IsEditor = AllowEdit; if (AllowEdit) { this.Title = string.Format(Locale.GetString("FCETitle"), FiNa4Title); } else { this.Title = string.Format(Locale.GetString("FCVTitle"), FiNa4Title); } FileProcessDialog ProgressDialog = new FileProcessDialog(); string ProgressInitialText = String.Format(Locale.GetString("FCVELoadingMsg"), URL); ProgressDialog.lblStatus.Text = ProgressInitialText; FS.ProgressChanged += (d) => { ProgressDialog.pbrProgress.Fraction = (d >= 0 && d <= 1) ? d : ProgressDialog.pbrProgress.Fraction; Xwt.Application.MainLoop.DispatchPendingEvents(); }; FS.StatusChanged += (d) => { ProgressDialog.lblStatus.Text = ProgressInitialText + "\n" + d; Xwt.Application.MainLoop.DispatchPendingEvents(); }; ProgressDialog.cmdCancel.Clicked += (o, ea) => { CanBeShowed = false; ProgressDialog.Hide(); return; }; ProgressDialog.Show(); Xwt.Application.MainLoop.DispatchPendingEvents(); if (!CanBeShowed) { return; } Plugin = plugin; Plugin.ReadOnly = !AllowEdit; Plugin.OpenFile(URL, FS); Plugin.ShowToolbar = fcmd.Properties.Settings.Default.VE_ShowToolbar; Plugin.Stylist = s; mnuFormat.SubMenu = Plugin.FormatMenu; bool Mode = AllowEdit; if (!Plugin.CanEdit && AllowEdit) { Xwt.MessageDialog.ShowWarning(String.Format(Locale.GetString("FCVEpluginro1"), Plugin.Name + " " + Plugin.Version), Locale.GetString("FCVEpluginro2")); Mode = false; } FSPlugin = FS; PluginBody = Plugin.Body; SetVEMode(Mode); BuildLayout(); ProgressDialog.Hide(); PluginBody.KeyReleased += (sender, e) => { if (e.Key == Xwt.Key.Escape) { CommandBox.SetFocus(); } if (e.Key == Xwt.Key.q) { this.OnCloseRequested(); } }; }
public ViewBackend GetNativeBackend(Xwt.Widget w) { throw new NotImplementedException(); }
public static override AppKit.NSView GetWidget(Xwt.Widget w) { throw new NotImplementedException(); }
public override object RenderWidget(Xwt.Widget w) { throw new NotImplementedException(); }