public static NSPopover MakePopover(Xwt.Widget child) { return(new NSPopover { Behavior = NSPopoverBehavior.Transient, ContentViewController = new FactoryViewController(child) }); }
private void UnsubscribeFromMouseContainer() { if (this.mouseContainer != null) { this.mouseContainer.MouseExited -= this.OnMouseLeaveContainer; this.mouseContainer.MouseMoved -= this.OnMouseMoveContainer; this.mouseContainer = null; } }
public override object ExtractValueFrom(Widget widget) { CheckBox cb = widget as CheckBox; if (cb != null) { return cb.State == CheckBoxState.On; } return null; }
public void Show(Xwt.Popover.Position orientation, Xwt.Widget referenceWidget, Xwt.Rectangle positionRect, Xwt.Widget child) { popover = MakePopover(child); ViewBackend backend = (ViewBackend)Toolkit.GetBackend(referenceWidget); var reference = backend.Widget; popover.Show(positionRect.ToRectangleF(), reference, ToRectEdge(orientation)); }
/// <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 Widget ProgressBox) { Title = Localizator.GetString("FileProgressDialogTitle"); cmdCancel.Label = Localizator.GetString("Cancel"); Decorated = false; Layout.PackStart(ProgressBox, true, true); Layout.PackStart(cmdCancel, false, false); Content = Layout; }
public static NSPopover MakePopover(Xwt.Widget child, Color backgroundColor) { return(new NSPopover { Behavior = NSPopoverBehavior.Transient, ContentViewController = new FactoryViewController(child) { BackgroundColor = backgroundColor.ToCGColor() } }); }
public void Add(Widget w) { var page = w as IPageView; if (page != null) { Add(w, page.DisplayName); page.DisplayNameChanged += Page_NameChanged; } }
public Popover(WindowFrame parent, Widget child, Position arrowPosition) { this.arrowPosition = arrowPosition; backend = WidgetRegistry.CreateBackend<IPopoverBackend> (GetType ()); backend.Init ((IWindowFrameBackend) WidgetRegistry.GetBackend (parent), (IWidgetBackend) WidgetRegistry.GetBackend (child), arrowPosition); backend.Closed += (sender, e) => { if (Closed != null) Closed (this, EventArgs.Empty); }; }
public override void Dismiss() { if (this.mouseContainer != null) { this.mouseContainer.MouseExited -= this.OnMouseLeaveContainer; this.mouseContainer.MouseMoved -= this.OnMouseMoveContainer; this.mouseContainer = null; } base.Dismiss(); }
private void SubscribeToContainerUnderMouse() { if (!this.isDismissed && (this.mouseContainer == null) && (((IMdTextView)textView).VisualElement.IsMouseOver() || (popup.IsMouseOver() && popup.Content != null))) { mouseContainer = popup.IsMouseOver() ? popup.Content : Xwt.Toolkit.CurrentEngine.WrapWidget(((IMdTextView)textView).VisualElement); mouseContainer.MouseExited += this.OnMouseLeaveContainer; mouseContainer.MouseMoved += this.OnMouseMoveContainer; } }
public void UpdatePlacement(Xwt.Widget widget) { LeftPadding = (uint)widget.MarginLeft; RightPadding = (uint)widget.MarginRight; TopPadding = (uint)widget.MarginTop; BottomPadding = (uint)widget.MarginBottom; Xalign = (float)widget.HorizontalPlacement.GetValue(); Yalign = (float)widget.VerticalPlacement.GetValue(); Xscale = (widget.HorizontalPlacement == WidgetPlacement.Fill) ? 1 : 0; Yscale = (widget.VerticalPlacement == WidgetPlacement.Fill) ? 1 : 0; }
public void ShowWidget(string name, Widget widget) { Clear(); _closeButton.Label = name; if (widget != null) { PackStart(_closeButtonBox); PackStart(widget); } }
public DeviceListControl() { deviceListStoreMirror = new List <DeviceInfo> (); uiThreadScheduler = TaskScheduler.Current; // // Device List // deviceListStore = new ListStore(idField, enabledField, nameField); deviceListView = new ListView(deviceListStore); var enabledColumn = new Xwt.ListViewColumn( "Enabled", new Xwt.CheckBoxCellView(enabledField) { Editable = true }); deviceListView.Columns.Add(enabledColumn); var nameColumn = new Xwt.ListViewColumn( "Device", new Xwt.TextCellView(nameField) { Editable = false }); deviceListView.Columns.Add(nameColumn); deviceList.CollectionChanged += (s, e) => { Application.Invoke(() => Devices_CollectionChanged(s, e)); }; PrepopulateList(); deviceListView.ButtonPressed += DeviceListView_ButtonPressed; // // Toolbar // var toolbar = new Xwt.HBox(); toolbar.PackStart(refreshButton); toolbar.PackStart(statusLabel); refreshButton.Clicked += RefreshButton_Clicked; // // Main UI // var vbox = new Xwt.VBox(); vbox.PackStart(toolbar); vbox.PackStart(deviceListView, fill: true, expand: true); Widget = vbox; }
public void ShowToolset(string key) { Console.WriteLine("Show {0}", key); if (_toolsets.ContainsKey(key)) { if (_currentToolset != null) { _contentBox.Remove(_currentToolset); } _currentToolset = _toolsets[key]; _contentBox.PackStart(_currentToolset); } }
public void Show(Xwt.Popover.Position orientation, Xwt.Widget referenceWidget, Xwt.Rectangle positionRect, Xwt.Widget child) { var controller = new FactoryViewController(child); popover = new NSPopover(); popover.Behavior = NSPopoverBehavior.Transient; popover.ContentViewController = controller; ViewBackend backend = (ViewBackend)Toolkit.GetBackend(referenceWidget); var reference = backend.Widget; popover.Show(System.Drawing.RectangleF.Empty, reference, ToRectEdge(orientation)); }
public new void AddChild(Widget widget) { if (widget == null) return; int addIndex = 0; for (int i = 0; i < children.Count; i++) { if (compareControls(widget, children[i])) break; addIndex = i + 1; } children.Insert(addIndex, widget); base.AddChild(widget); Layout(); }
/// <summary>Apply the specified selector (style) to the specified widget</summary> /// <param name="Widget">The widget that should "got" the style</param> /// <param name="Pattern">The specified selector with the desired style</param> public void ApplyStyle(Widget Widget, string Pattern) { if (Widget.GetType() == typeof(Label)) { ApplyStyle((Label)Widget, Pattern); return; } if (Widget.GetType() == typeof(Box)) { ApplyStyle((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 = Font.FromName( Selector.Declarations["font-family"].Value ); Widget.Visible = Selector.Declarations["display"].Value != "none"; }
public void Show(Xwt.Popover.Position orientation, Xwt.Widget referenceWidget, Xwt.Rectangle positionRect, Xwt.Widget child) { popover = MakePopover(child, BackgroundColor); ViewBackend backend = (ViewBackend)Toolkit.GetBackend(referenceWidget); var reference = backend.Widget; // If the position rect is empty, the coordinates of the rect will be ignored. // Width and Height of the rect must be > Epsilon, for the positioning to function correctly. if (Math.Abs(positionRect.Width) < double.Epsilon) { positionRect.Width = 1; } if (Math.Abs(positionRect.Height) < double.Epsilon) { positionRect.Height = 1; } popover.Show(positionRect.ToCGRect(), reference, ToRectEdge(orientation)); }
void MarkDestroyed(Widget w) { var wbk = Toolkit.GetBackend (w); var bk = wbk as WidgetBackend; if (bk == null) { var ew = wbk as Xwt.Widget; if (ew == null) return; bk = Toolkit.GetBackend (ew) as WidgetBackend; if (bk == null) return; } bk.destroyed = true; foreach (var c in w.Surface.Children) MarkDestroyed (c); }
protected override void AddChild (Widget parent, Widget child) { ((Table)parent).Clear (); ((Table)parent).Add (child, 0, 0, hexpand: true, vexpand: true); }
protected override void AddChild (Widget parent, Widget child) { ((Frame)parent).Content = child; }
void IBackend.Initialize(object frontend) { this.frontend = (Widget) frontend; }
protected void RegisterChild(Widget w) { if (children == null) children = new List<Widget> (); w.Parent = this; children.Add (w); }
public void Run(Widget referenceWidget) { if (backend == null) throw new InvalidOperationException ("The Popover was disposed"); backend.Run ((IWidgetBackend) WidgetRegistry.GetBackend (referenceWidget)); }
public TreePosition AddWiget(TreePosition pos, string name, Type type, Widget widget) { var item = new ItemWidget (type) { Widget = widget }; return store.AddNode (pos) .SetValue (nameCol, name) //.SetValue (iconCol, Icon) .SetValue (widgetCol, item) .CurrentPosition; }
static bool NeedsAlignmentWrapper(Widget fw) { return fw.HorizontalPlacement != WidgetPlacement.Fill || fw.VerticalPlacement != WidgetPlacement.Fill || fw.Margin.VerticalSpacing != 0 || fw.Margin.HorizontalSpacing != 0; }
internal DragOperation(Widget w) { source = w; AllowedActions = DragDropAction.All; }
void MarkDestroyed(Widget w) { var bk = (WidgetBackend) Toolkit.GetBackend (w); bk.destroyed = true; foreach (var c in w.Surface.Children) MarkDestroyed (c); }
public MacXwtViewWrapper(Xwt.Widget widget) { this.widget = widget; view = Xwt.Toolkit.NativeEngine.GetNativeWidget(widget) as NSView; }
protected void UnregisterChild(Widget w) { if (children == null || !children.Remove (w)) throw new InvalidOperationException ("Widget is not a child of this widget"); }
internal void OnChildPlacementChanged(Widget child) { Backend.UpdateChildPlacement (child.GetBackend ()); if (!BackendHost.EngineBackend.HandlesSizeNegotiation) Widget.QueueWindowSizeNegotiation (this); }
void QueueForReallocate(Widget w) { reallocationQueue.Add (w); }
/// <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, IFSPlugin FS, IVEPlugin plugin, bool AllowEdit) { //check for external editor try{ if (Settings.Default.UseExternalEditor && AllowEdit || Settings.Default.UseExternalViewer && !AllowEdit && URL.StartsWith("file:")){ CanBeShowed = false; if (AllowEdit){ ExecuteProgram(Settings.Default.ExternalEditor.Replace("$", "\"" + URL)); } else{ ExecuteProgram(Settings.Default.ExternalViewer.Replace("$", "\"" + URL)); } return; } } catch (Exception ex) { MessageDialog.ShowError(Localizator.GetString("CantRunEXE"), ex.Message); CanBeShowed = false; return; } FileNameForTitle = URL.Substring(URL.LastIndexOf(FS.DirSeparator, StringComparison.Ordinal) + 1); IsEditor = AllowEdit; if(AllowEdit) Title = string.Format(Localizator.GetString("FCETitle"), FileNameForTitle); else Title = string.Format(Localizator.GetString("FCVTitle"), FileNameForTitle); FileProcessDialog ProgressDialog = new FileProcessDialog(); string ProgressInitialText = String.Format(Localizator.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.Close(); }; ProgressDialog.Show(); Xwt.Application.MainLoop.DispatchPendingEvents(); if (!CanBeShowed) return; try { Plugin = plugin; Plugin.ReadOnly = !AllowEdit; Plugin.OpenFile(URL, FS); Plugin.ShowToolbar = Settings.Default.VE_ShowToolbar; Plugin.Stylist = s; mnuFormat.SubMenu = Plugin.FormatMenu; bool Mode = AllowEdit; if (!Plugin.CanEdit && AllowEdit) { MessageDialog.ShowWarning(String.Format(Localizator.GetString("FCVEpluginro1"), Plugin.Name + " " + Plugin.Version), Localizator.GetString("FCVEpluginro2")); Mode = false; } FSPlugin = FS; PluginBody = Plugin.Body; SetVEMode(Mode); } catch (Exception ex) { MessageDialog.ShowWarning(ex.Message); if(PluginBody.GetType() == typeof(Spinner)) { ProgressDialog.Close(); CanBeShowed = false; return;} } BuildLayout(); ProgressDialog.Close(); }
protected override void AddChild (Widget parent, Widget child) { var exp = (Expander)parent; exp.Expanded = true; exp.Content = child; }
protected static IWidgetBackend GetWidgetBackend(Widget w) { return (IWidgetBackend) GetBackend (w); }
internal OpenTKRenderer(FrameFactory owner, IXwtRender xwtrender, Xwt.Canvas window, IRenderOwner renderer, size videosize) { // OpenTKRenderer.usecnt = 1; this.owner = owner; this.Xwt = xwtrender; this.videosize = videosize; this.window = window; this.renderer = renderer; this.viewsize = window.Size; window.BoundsChanged += viewsizechanged; this.actionthread = new Thread(run) { Name = "opentk" }; this.actionthread.Start(); var _this = this; this.Xwt.CreateForWidgetContext(this, this.renderer, window); // Invoke(() => // { this.Lock(false); try { try { // GL.GetInternalformat(TextureTarget.Texture2D, SizedInternalFormat.Rgba8, InternalFormatParameter..TEXTUREIMAGEFORMAT, 1, &preferred_format). this.vertices1 = new vertices(_vertices); this.vertices2 = new vertices(_vertices2); /* GL.GenBuffers(1, out buf_vertices2); // Generate 1 buffer * GL.BindBuffer(BufferTarget.ArrayBuffer, buf_vertices2); * GL.VertexAttribPointer(0, 2, VertexAttribPointerType.Float, false, 4 * sizeof(float), 0); * GL.VertexAttribPointer(1, 2, VertexAttribPointerType.Float, false, 4 * sizeof(float), 2 * sizeof(float)); * GL.BufferData(BufferTarget.ArrayBuffer, sizeof(float) * vertices2.Length, vertices2, BufferUsageHint.StaticDraw); * GL.EnableVertexAttribArray(0); * GL.EnableVertexAttribArray(1); * * GL.GenBuffers(1, out buf_vertices3); // Generate 1 buffer * GL.BindBuffer(BufferTarget.ArrayBuffer, buf_vertices3); * GL.VertexAttribPointer(0, 2, VertexAttribPointerType.Float, false, 4 * sizeof(float), 0); * GL.VertexAttribPointer(1, 2, VertexAttribPointerType.Float, false, 4 * sizeof(float), 2 * sizeof(float)); * GL.BufferData(BufferTarget.ArrayBuffer, sizeof(float) * vertices3.Length, vertices3, BufferUsageHint.StaticDraw); * GL.EnableVertexAttribArray(0); * GL.EnableVertexAttribArray(1);*/ // GL.BindBuffer(BufferTarget.ArrayBuffer, 0); /* this.presentshader = new shader(shadervertex, shaderfragment, vertices1); * GL.UseProgram(this.presentshader); * var pos = GL.GetUniformLocation(this.presentshader, "tex"); * GL.Uniform1(pos, 0); */ /* this.combineshader = new shader(combineshadervertex, combineshaderfragment, vertices1); * * GL.UseProgram(combineshader); * var pos = GL.GetUniformLocation(this.combineshader, "tex"); * GL.Uniform1(pos, 0); * pos = GL.GetUniformLocation(this.combineshader, "vpHeight"); * GL.Uniform1(pos, (float)videosize.height); * * this.deinterlaceblendshader = new shader(combineshadervertex, blendshaderfragment, vertices1); * GL.UseProgram(deinterlaceblendshader); * pos = GL.GetUniformLocation(this.deinterlaceblendshader, "vpHeight"); * GL.Uniform1(pos, (float)videosize.height); * * this.deinterlacesplitshader = new shader(combineshadervertex, splitshaderfragment, vertices1); * * GL.UseProgram(deinterlacesplitshader); * pos = GL.GetUniformLocation(this.deinterlacesplitshader, "vpHeight"); * GL.Uniform1(pos, (float)videosize.height);*/ } catch (Exception e) { // Log.LogException(e); Dispose(true); GC.SuppressFinalize(this); throw; } } finally { Unlock(false); } // }); }
void IBackend.InitializeBackend(object frontend, ApplicationContext context) { this.frontend = (Widget) frontend; ApplicationContext = context; }
public VEd() { for (int i = 1; i < 11; i++) { KeybHelpButtons[i] = new KeyboardHelpButton(); KeybHelpButtons[i].FKey = "F" + i; KeybHelpButtons[i].Text = Localizator.GetString("FCVE_F" + i); KeybHelpButtons[i].CanGetFocus = false; KeybHelpButtons[i].Clicked += KeyboardHelpButton_Clicked; KeybHelpButtons[i].Tag = i; KeyBoardHelp.PackStart(KeybHelpButtons[i], true, WidgetPlacement.Fill, WidgetPlacement.Fill, 0,1,0,1); } Title = "File Commander VE"; Content = Layout; CommandBox.KeyReleased += CommandBox_KeyReleased; Layout.KeyReleased += Layout_KeyReleased; mnuFile.SubMenu = new 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 SeparatorMenuItem()); mnuFile.SubMenu.Items.Add(mnuFilePrint); mnuFile.SubMenu.Items.Add(mnuFilePrintPreview); mnuFile.SubMenu.Items.Add(mnuFilePrintSettings); mnuFile.SubMenu.Items.Add(new SeparatorMenuItem()); mnuFile.SubMenu.Items.Add(mnuFileClose); mnuEdit.SubMenu = new Menu(); mnuEdit.SubMenu.Items.Add(mnuEditCut); mnuEdit.SubMenu.Items.Add(mnuEditCopy); mnuEdit.SubMenu.Items.Add(mnuEditPaste); mnuEdit.SubMenu.Items.Add(new SeparatorMenuItem()); mnuEdit.SubMenu.Items.Add(mnuEditSelectAll); mnuEdit.SubMenu.Items.Add(new SeparatorMenuItem()); mnuEdit.SubMenu.Items.Add(mnuEditFindReplace); mnuEdit.SubMenu.Items.Add(mnuEditFindNext); mnuViewSettings.Clicked += (o, ea) => { new VEsettings().Run(); Plugin.ShowToolbar = Settings.Default.VE_ShowToolbar; KeyBoardHelp.Visible = Settings.Default.ShowKeybrdHelp; CommandBox.Visible = Settings.Default.VE_ShowCmdBar; }; mnuView.SubMenu = new Menu(); mnuView.SubMenu.Items.Add(mnuViewSettings); mnuHelp.SubMenu = new Menu(); mnuHelp.SubMenu.Items.Add(mnuHelpHelpme); mnuHelp.SubMenu.Items.Add(mnuHelpAbout); MainMenu = new Menu(); MainMenu.Items.Add(mnuFile); MainMenu.Items.Add(mnuEdit); MainMenu.Items.Add(mnuView); MainMenu.Items.Add(mnuFormat); 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 += mnuHelpAbout_Clicked; CloseRequested += VEd_CloseRequested; Localizator.LocalizationChanged += (o, ea) => Localize(); PluginBody = new Spinner { Animate = true }; BuildLayout(); Localize(); }
void QueueForSizeCheck(Widget w) { if (resizeRequestQueue.Add (Parent)) { int depth = w.Depth; bool inserted = false; for (int n=0; n<resizeDepths.Count; n++) { if (resizeDepths[n] < depth) { resizeDepths.Insert (n, depth); resizeWidgets.Insert (n, w); inserted = true; break; } } if (!inserted) { resizeDepths.Add (depth); resizeWidgets.Add (w); } } }
public FactoryViewController(Xwt.Widget child) : base(null, null) { this.child = child; }
void HandleSamplesTreeSelectionChanged(object sender, EventArgs e) { if (samplesTree.SelectedRow != null) { if (currentSample != null) sampleBox.Remove (currentSample); Sample s = store.GetNavigatorAt (samplesTree.SelectedRow).GetValue (widgetCol); if (s.Type != null) { if (s.Widget == null) s.Widget = (Widget)Activator.CreateInstance (s.Type); sampleBox.PackStart (s.Widget, true); } // Console.WriteLine (System.Xaml.XamlServices.Save (s.Widget)); currentSample = s.Widget; Dump (currentSample, 0); } }
void HandleSamplesTreeSelectionChanged(object sender, EventArgs e) { if (samplesTree.SelectedItem != null) { if (currentSample != null) sampleBox.Remove (currentSample); Sample s = store.GetNavigatorAt (samplesTree.SelectedItem).GetValue (widgetCol); if (s.Type != null) { if (s.Widget == null) s.Widget = (Widget)Activator.CreateInstance (s.Type); sampleBox.PackStart (s.Widget, BoxMode.FillAndExpand); } // string txt = System.Xaml.XamlServices.Save (s); currentSample = s.Widget; Dump (currentSample, 0); } }
public RadioButton (Widget content) { VerifyConstructorCall (this); Content = content; }