public TreeViewExample() { Gtk.Window window = new Gtk.Window("TreeView Example"); window.SetSizeRequest(500, 200); Gtk.TreeView tree = new Gtk.TreeView(); window.Add(tree); Gtk.TreeViewColumn Parent = new Gtk.TreeViewColumn(); Parent.Title = "Parent"; Gtk.CellRendererText Parent1 = new Gtk.CellRendererText(); Parent.PackStart(Parent1, true); Gtk.TreeViewColumn ChildColoumn1 = new Gtk.TreeViewColumn(); ChildColoumn1.Title = "Column 1"; Gtk.CellRendererText Child1 = new Gtk.CellRendererText(); ChildColoumn1.PackStart(Child1, true); Gtk.TreeViewColumn ChildColumn2 = new Gtk.TreeViewColumn(); ChildColumn2.Title = "Column 2"; Gtk.CellRendererText Child2 = new Gtk.CellRendererText(); ChildColumn2.PackStart(Child2, true); tree.AppendColumn(Parent); tree.AppendColumn(ChildColoumn1); tree.AppendColumn(ChildColumn2); Parent.AddAttribute(Parent1, "text", 0); ChildColoumn1.AddAttribute(Child1, "text", 1); ChildColumn2.AddAttribute(Child2, "text", 2); Gtk.TreeStore Tree = new Gtk.TreeStore(typeof(string), typeof(string), typeof(string)); Gtk.TreeIter iter = Tree.AppendValues("Parent1"); Tree.AppendValues(iter, "Child1", "Node 1"); iter = Tree.AppendValues("Parent2"); Tree.AppendValues(iter, "Child1", "Node 1", "Node 2"); tree.Model = Tree; window.ShowAll(); }
internal void SetFloatMode(Gdk.Rectangle rect) { if (floatingWindow == null) { ResetMode(); SetRegionStyle(frame.GetRegionStyleForItem(this)); floatingWindow = new DockFloatingWindow((Gtk.Window)frame.Toplevel, GetWindowTitle()); Ide.IdeApp.CommandService.RegisterTopWindow(floatingWindow); Gtk.VBox box = new Gtk.VBox(); box.Show(); box.PackStart(TitleTab, false, false, 0); box.PackStart(Widget, true, true, 0); floatingWindow.Add(box); floatingWindow.DeleteEvent += delegate(object o, Gtk.DeleteEventArgs a) { if (behavior == DockItemBehavior.CantClose) { Status = DockItemStatus.Dockable; } else { Visible = false; } a.RetVal = true; }; } floatingWindow.Show(); Ide.DesktopService.PlaceWindow(floatingWindow, rect.X, rect.Y, rect.Width, rect.Height); if (titleTab != null) { titleTab.UpdateBehavior(); } Widget.Show(); }
static void RunGtkWindow() { Gtk.Application.Init(); Gtk.Window myWin = new Gtk.Window("My first GTK# Application! "); myWin.Resize(200, 200); myWin.ButtonPressEvent += (s, ev) => { }; //Create a label and put some text in it. Gtk.Label myLabel = new Gtk.Label(); myLabel.Text = "Hello World!!!!"; //Add the label to the form // myWin.Add(myLabel); Gtk.Button gtk_but = new Gtk.Button(); gtk_but.HeightRequest = 100; gtk_but.WidthRequest = 100; gtk_but.Label = "button"; myWin.Add(gtk_but); //Show Everything myWin.ShowAll(); Gtk.Application.Run(); }
public static void Main(string[] args) { Gtk.Application.Init("test", ref args); Gtk.Window window = new Gtk.Window("Test"); Gtk.WindowGroup grp = new Gtk.WindowGroup(); grp.AddWindow(window); window.SetDefaultSize(400, 300); Plot.Widget area = new Plot.Widget(); d_graph = area.Graph; d_graph.AxisAspect = 1; d_graph.KeepAspect = true; window.Add(area); window.ShowAll(); window.DeleteEvent += delegate { Gtk.Application.Quit(); }; d_i = 0; Plot.Series.Point s1 = new Plot.Series.Point("test 1"); s1.Size = 5; s1.ShowLines = true; Plot.Series.Line s2 = new Plot.Series.Line("test 2"); d_graph.ShowRuler = true; d_graph.Add(s1); d_graph.Add(s2); List <Plot.Point <double> > d1 = new List <Plot.Point <double> >(); List <Plot.Point <double> > d2 = new List <Plot.Point <double> >(); int samplesize = 1000; //GLib.Timeout.Add(10, delegate { for (int i = 0; i <= samplesize; ++i) { d_i = i; double x = d_i++ / (double)samplesize; Plot.Point <double> pt1 = new Plot.Point <double>(x, Math.Sin(x * Math.PI * 2)); Plot.Point <double> pt2 = new Plot.Point <double>(x, Math.Cos(x * Math.PI * 2)); d1.Add(pt1); d2.Add(pt2); } s1.Data = d1; s2.Data = d2; Gtk.Application.Run(); }
public static Gtk.Window Show(Gtk.Window parent) { Gtk.Builder builder = new Gtk.Builder(null, "Mono.Addins.GuiGtk3.interfaces.AddinManagerDialog.ui", null); AddinManagerDialog dlg = new AddinManagerDialog(builder, builder.GetObject("AddinManagerDialog").Handle); InitDialog(dlg); parent.Add(dlg); dlg.Show(); return(dlg); }
public WindowBackend() { Window = new Gtk.Window(""); mainBox = new Gtk.VBox(); Window.Add(mainBox); mainBox.Show(); alignment = new Gtk.Alignment(0, 0, 1, 1); mainBox.PackStart(alignment, true, true, 0); alignment.Show(); }
public WindowBackend() { Window = new Gtk.Window (""); mainBox = new Gtk.VBox (); Window.Add (mainBox); mainBox.Show (); alignment = new Gtk.Alignment (0, 0, 1, 1); mainBox.PackStart (alignment, true, true, 0); alignment.Show (); }
public static void show() { Gtk.Window window = new Gtk.Window("TreeView Example"); window.SetSizeRequest(500, 200); window.Show(); Gtk.Image img = new Gtk.Image(); img.File = "/home/okg/caribbean_diplom.gif"; window.Add(img); img.SizeRequest(); img.Show(); }
// Drag function for automatic sources, called from DragBegin static void Drag(Gtk.Widget source, Gdk.DragContext ctx, WidgetDropCallback dropCallback, Gtk.Widget dragWidget) { if (ctx == null) { return; } Gtk.Window dragWin; Gtk.Requisition req; ShowFaults(); DND.dragWidget = dragWidget; DND.dropCallback = dropCallback; dragWin = new Gtk.Window(Gtk.WindowType.Popup); dragWin.Add(dragWidget); req = dragWidget.SizeRequest(); if (req.Width < 20 && req.Height < 20) { dragWin.SetSizeRequest(20, 20); } else if (req.Width < 20) { dragWin.SetSizeRequest(20, -1); } else if (req.Height < 20) { dragWin.SetSizeRequest(-1, 20); } req = dragWin.SizeRequest(); if (ctx.SourceWindow != null) { int px, py, rx, ry; Gdk.ModifierType pmask; ctx.SourceWindow.GetPointer(out px, out py, out pmask); ctx.SourceWindow.GetRootOrigin(out rx, out ry); dragWin.Move(rx + px, ry + py); dragWin.Show(); dragHotX = req.Width / 2; dragHotY = -3; Gtk.Drag.SetIconWidget(ctx, dragWin, dragHotX, dragHotY); } if (source != null) { source.DragDataGet += DragDataGet; source.DragEnd += DragEnded; } }
public override Atk.Object ActivateAdditionalForm(string name) { Gtk.Window win = new Gtk.Window(name); Gtk.Button button = new Gtk.Button("test"); win.Add(button); RunInGuiThread(delegate() { win.Show(); button.GrabFocus(); }); mappings [win.Accessible] = win; return(win.Accessible); }
public static void Main(string[] args) { GLib.Thread.Init (); Gtk.Application.Init (); ColorMaker maker = new ColorMaker (); Gtk.Window window = new Gtk.Window ("Test"); window.Add (maker); window.ShowAll (); Gtk.Application.Run (); }
public static void Main(string[] args) { GLib.Thread.Init(); Gtk.Application.Init(); ColorMaker maker = new ColorMaker(); Gtk.Window window = new Gtk.Window("Test"); window.Add(maker); window.ShowAll(); Gtk.Application.Run(); }
static void GetDefaults() { if (!gotDefault) { // Is there a better way of getting the default? Gtk.Window d = new Gtk.Window(""); Gtk.Toolbar t = new Gtk.Toolbar(); d.Add(t); defaultStyle = t.ToolbarStyle; defaultSize = t.IconSize; d.Destroy(); gotDefault = true; } }
public TreeViewExample() { // Create a Window Gtk.Window window = new Gtk.Window("TreeView Example"); window.SetSizeRequest(500, 200); // Create our TreeView Gtk.TreeView tree = new Gtk.TreeView(); // Add our tree to the window window.Add(tree); // Create a column for the artist name Gtk.TreeViewColumn artistColumn = new Gtk.TreeViewColumn(); artistColumn.Title = "Artist"; // Create the text cell that will display the artist name Gtk.CellRendererText artistNameCell = new Gtk.CellRendererText(); // Add the cell to the column artistColumn.PackStart(artistNameCell, true); // Create a column for the song title Gtk.TreeViewColumn songColumn = new Gtk.TreeViewColumn(); songColumn.Title = "Song Title"; // Do the same for the song title column Gtk.CellRendererText songTitleCell = new Gtk.CellRendererText(); songColumn.PackStart(songTitleCell, true); // Add the columns to the TreeView tree.AppendColumn(artistColumn); tree.AppendColumn(songColumn); // Tell the Cell Renderers which items in the model to display artistColumn.AddAttribute(artistNameCell, "text", 0); songColumn.AddAttribute(songTitleCell, "text", 1); // Create a model that will hold two strings - Artist Name and Song Title Gtk.ListStore musicListStore = new Gtk.ListStore(typeof(string), typeof(string)); // Add some data to the store musicListStore.AppendValues("Garbage", "Dog New Tricks"); // Assign the model to the TreeView tree.Model = musicListStore; // Show the window and everything on it window.ShowAll(); }
public SendMessagesOverviewWindow() { // Create window Gtk.Window window = new Gtk.Window ( "Verzonden Berichten" ); window.SetSizeRequest (700, 200); // Add tree to window Gtk.TreeView tree = new Gtk.TreeView (); window.Add (tree); // Create the column for displaying the telephone number. Gtk.TreeViewColumn numberReceiverColumn = new Gtk.TreeViewColumn (); numberReceiverColumn.Title = "Telefoon nummer"; numberReceiverColumn.MinWidth = 200; // Create the text cell that will display the telephone number. Gtk.CellRendererText numberReceiverCell = new Gtk.CellRendererText (); // Add the cell to the column. numberReceiverColumn.PackStart (numberReceiverCell, true); // Create the column for displaing the message. Gtk.TreeViewColumn messageColumn = new Gtk.TreeViewColumn (); messageColumn.Title = "Bericht"; messageColumn.MinWidth = 300; // Create the text cell that will display the message. Gtk.CellRendererText messageCell = new Gtk.CellRendererText (); messageColumn.PackStart (messageCell, true); // Create the column for displaying the date send. Gtk.TreeViewColumn sendAtColumn = new Gtk.TreeViewColumn (); sendAtColumn.Title = "Verstuurd op"; sendAtColumn.MinWidth = 200; // Create the text cell that will display the date send. Gtk.CellRendererText sendAtCell = new Gtk.CellRendererText (); sendAtColumn.PackStart (sendAtCell, true); tree.AppendColumn (numberReceiverColumn); tree.AppendColumn (messageColumn); tree.AppendColumn (sendAtColumn); // Tell the cell renderers which items in the model to display numberReceiverColumn.AddAttribute (numberReceiverCell, "text", 0); messageColumn.AddAttribute (messageCell, "text", 1); sendAtColumn.AddAttribute (sendAtCell, "text", 2); // Assign the model to the TreeView tree.Model = this.getMessageList (); // Show the window and everythin on it. window.ShowAll (); }
public static void Main(string [] args) { Gtk.Application.Init(); Gdk.Pixbuf pixbuf = new Gdk.Pixbuf(args [0]); Log.DebugFormat("loaded {0}", args [0]); Histogram hist = new Histogram(); Log.DebugFormat("loaded histgram", args [0]); Gtk.Window win = new Gtk.Window("display"); Gtk.Image image = new Gtk.Image(); Gdk.Pixbuf img = hist.Generate(pixbuf); image.Pixbuf = img; win.Add(image); win.ShowAll(); Gtk.Application.Run(); }
public GtkSharpWindow(Widget shellobject, string caption) : base(shellobject) { window = new Gtk.Window(caption); GtkSharpDriver.InitWidget(window, shellobject); window.ResizeChecked += new EventHandler(EventResizeChecked); window.Hidden += new EventHandler(EventClosed); //window.WindowPosition = Gtk.WindowPosition.Mouse; fixchild = new Gtk.Fixed(); fixchild.Show(); window.Add(fixchild); window.DeleteEvent += new Gtk.DeleteEventHandler(window_DeleteEvent); window.KeyPressEvent += new Gtk.KeyPressEventHandler(window_KeyPressEvent); }
public TreeViewExample() { Gtk.Window window = new Gtk.Window("TreeView Example"); window.SetSizeRequest(500, 200); Gtk.TreeView tree = new Gtk.TreeView(); Gtk.ListStore musicListStore = new Gtk.ListStore(typeof(Gdk.Pixbuf), typeof(string), typeof(string)); tree.AppendColumn("Icon", new Gtk.CellRendererPixbuf(), "pixbuf", 0); tree.AppendColumn("Artist", new Gtk.CellRendererText(), "text", 1); tree.AppendColumn("Title", new Gtk.CellRendererText(), "text", 2); musicListStore.AppendValues(new Gdk.Pixbuf("TreeViewRupertIcon.png"), "Rupert", "Yellow bananas"); tree.Model = musicListStore; window.Add(tree); window.ShowAll(); }
public TreeViewExample() { Gtk.Window window = new Gtk.Window("TreeView Example"); window.SetSizeRequest(500, 200); Gtk.TreeView tree = new Gtk.TreeView(); window.Add(tree); Gtk.TreeViewColumn artistColumn = new Gtk.TreeViewColumn(); artistColumn.Title = "Artist"; Gtk.CellRendererText artistNameCell = new Gtk.CellRendererText(); artistColumn.PackStart(artistNameCell, true); Gtk.TreeViewColumn songColumn = new Gtk.TreeViewColumn(); songColumn.Title = "Song Title"; Gtk.CellRendererText songTitleCell = new Gtk.CellRendererText(); songColumn.PackStart(songTitleCell, true); tree.AppendColumn(artistColumn); tree.AppendColumn(songColumn); artistColumn.AddAttribute(artistNameCell, "text", 0); songColumn.AddAttribute(songTitleCell, "text", 1); Gtk.TreeStore musicListStore = new Gtk.TreeStore(typeof(string), typeof(string)); Gtk.TreeIter iter = musicListStore.AppendValues("Dance"); musicListStore.AppendValues(iter, "Fannypack", "Nu Nu (Yeah Yeah) (double j and haze radio edit)"); iter = musicListStore.AppendValues("Hip-hop"); musicListStore.AppendValues(iter, "Nelly", "Country Grammer"); tree.Model = musicListStore; window.ShowAll(); }
public static Gtk.Window CreateTreeWindow() { Gtk.Window window = new Gtk.Window("Sortable TreeView"); Gtk.TreeIter iter; Gtk.TreeViewColumn col; Gtk.CellRendererText cell; Gtk.TreeView tree = new Gtk.TreeView(); cell = new Gtk.CellRendererText(); col = new Gtk.TreeViewColumn(); col.Title = "Column 1"; col.PackStart(cell, true); col.AddAttribute(cell, "text", 0); col.SortColumnId = 0; tree.AppendColumn(col); cell = new Gtk.CellRendererText(); col = new Gtk.TreeViewColumn(); col.Title = "Column 2"; col.PackStart(cell, true); col.AddAttribute(cell, "text", 1); tree.AppendColumn(col); Gtk.TreeStore store = new Gtk.TreeStore(typeof(string), typeof(string)); iter = store.AppendValues("BBB"); store.AppendValues(iter, "AAA", "Zzz"); store.AppendValues(iter, "DDD", "Ttt"); store.AppendValues(iter, "CCC", "Ggg"); iter = store.AppendValues("AAA"); store.AppendValues(iter, "ZZZ", "Zzz"); store.AppendValues(iter, "GGG", "Ggg"); store.AppendValues(iter, "TTT", "Ttt"); Gtk.TreeModelSort sortable = new Gtk.TreeModelSort(store); sortable.SetSortFunc(0, delegate(TreeModel model, TreeIter a, TreeIter b) { string s1 = (string)model.GetValue(a, 0); string s2 = (string)model.GetValue(b, 0); return(String.Compare(s1, s2)); }); tree.Model = sortable; window.Add(tree); return(window); }
public TreeViewExample() { // Create a Window Gtk.Window window = new Gtk.Window("TreeView Example"); window.SetSizeRequest(500, 200); // Create our TreeView Gtk.TreeView tree = new Gtk.TreeView(); // Add our tree to the window window.Add(tree); // Create a column for the artist name Gtk.TreeViewColumn artistColumn = new Gtk.TreeViewColumn(); artistColumn.Title = "Artist"; // Create a column for the song title Gtk.TreeViewColumn songColumn = new Gtk.TreeViewColumn(); songColumn.Title = "Song Title"; // Add the columns to the TreeView tree.AppendColumn(artistColumn); tree.AppendColumn(songColumn); // Create a model that will hold two strings - Artist Name and Song Title Gtk.ListStore musicListStore = new Gtk.ListStore(typeof(string), typeof(string)); // Assign the model to the TreeView tree.Model = musicListStore; // Show the window and everything on it window.ShowAll(); }
void ShowTip(int x, int y, string text) { if (GdkWindow == null) { return; } if (tipWindow == null) { tipWindow = new TipWindow(); Gtk.Label lab = new Gtk.Label(text); lab.Xalign = 0; lab.Xpad = 3; lab.Ypad = 3; tipWindow.Add(lab); } ((Gtk.Label)tipWindow.Child).Text = text; int w = tipWindow.Child.SizeRequest().Width; int ox, oy; GdkWindow.GetOrigin(out ox, out oy); tipWindow.Move(ox + x - (w / 2) + (iconSize / 2), oy + y); tipWindow.ShowAll(); }
static void Main() { using var runtime = new Runtime(); runtime.Initialize(); Gtk.Application.Init(); using var window = new Gtk.Window("ChromiumGTK Demo") { WidthRequest = 1200, HeightRequest = 800 }; window.Destroyed += (sender, args) => runtime.QuitMessageLoop(); InteropLinux.SetDefaultWindowVisual(window.Handle); using var webView = new WebView(); webView.LoadUrl("https://dotnet.microsoft.com/"); window.Add(webView); window.ShowAll(); runtime.RunMessageLoop(); }
public MusicSource() : base("Google Music", "Google Music", 30) { api = new Google.Music.Api(); downloadWrapper = new MusicDownloadWrapper(api); downloadWrapper.Start(); TypeUniqueId = "google-music"; Properties.Set <Gdk.Pixbuf>("Icon.Pixbuf_16", Gdk.Pixbuf.LoadFromResource("google-music-favicon")); var win = new Gtk.Window("Google Music Login"); var loginWidget = new LoginWidget(); loginWidget.UserLoggedIn += (cookies) => { api.SetCookies(cookies); AsyncUserJob.Create(() => { Refetch(); }, "Fetching playlist"); win.Destroy(); }; win.Add(loginWidget); win.ShowAll(); }
public MusicSource() : base("Google Music", "Google Music", 30) { api = new Google.Music.Api(); downloadWrapper = new MusicDownloadWrapper(api); downloadWrapper.Start(); TypeUniqueId = "google-music"; Properties.Set<Gdk.Pixbuf>("Icon.Pixbuf_16", Gdk.Pixbuf.LoadFromResource("google-music-favicon")); var win = new Gtk.Window("Google Music Login"); var loginWidget = new LoginWidget(); loginWidget.UserLoggedIn += (cookies) => { api.SetCookies(cookies); AsyncUserJob.Create(() => { Refetch(); }, "Fetching playlist"); win.Destroy(); }; win.Add(loginWidget); win.ShowAll(); }
protected void OnButtonMapInWindowClicked(object sender, EventArgs e) { if (mapWindow == null) { toggleButtonHideAddresses.Sensitive = false; toggleButtonHideAddresses.Active = false; mapWindow = new Gtk.Window("Карта мониторинга автомобилей на маршруте"); mapWindow.SetDefaultSize(700, 600); mapWindow.DeleteEvent += MapWindow_DeleteEvent; vboxRight.Remove(gmapWidget); mapWindow.Add(gmapWidget); mapWindow.Show(); } else { toggleButtonHideAddresses.Sensitive = true; mapWindow.Remove(gmapWidget); vboxRight.PackEnd(gmapWidget, true, true, 1); gmapWidget.Show(); mapWindow.Destroy(); mapWindow = null; } }
void HandleBrowseExisting(object sender, System.EventArgs args) { #if GIO_2_16 if (listwindow == null) { listwindow = new Gtk.Window("Pending files to write"); listwindow.SetDefaultSize(400, 200); listwindow.DeleteEvent += delegate(object o, Gtk.DeleteEventArgs e) { (o as Gtk.Window).Destroy(); listwindow = null; }; Gtk.TextView view = new Gtk.TextView(); Gtk.TextBuffer buffer = view.Buffer; Gtk.ScrolledWindow sw = new Gtk.ScrolledWindow(); sw.Add(view); listwindow.Add(sw); } else { ((listwindow.Child as Gtk.ScrolledWindow).Child as Gtk.TextView).Buffer.Text = ""; } ListAll(((listwindow.Child as Gtk.ScrolledWindow).Child as Gtk.TextView).Buffer, dest); listwindow.ShowAll(); #else GnomeUtil.UrlShow(dest.ToString()); #endif }
/// <summary>Writes PDF for specified auto-doc commands.</summary> /// <param name="section">The writer to write to.</param> /// <param name="tags">The autodoc tags.</param> /// <param name="workingDirectory">The working directory.</param> private void TagsToMigraDoc(Section section, List <AutoDocumentation.ITag> tags, string workingDirectory) { int figureNumber = 0; foreach (AutoDocumentation.ITag tag in tags) { if (tag is AutoDocumentation.Heading) { AutoDocumentation.Heading heading = tag as AutoDocumentation.Heading; if (heading.headingLevel > 0 && heading.headingLevel <= 6) { Paragraph para = section.AddParagraph(heading.text, "Heading" + heading.headingLevel); para.Format.KeepWithNext = true; if (heading.headingLevel == 1) { para.Format.OutlineLevel = OutlineLevel.Level1; } else if (heading.headingLevel == 2) { para.Format.OutlineLevel = OutlineLevel.Level2; } else if (heading.headingLevel == 3) { para.Format.OutlineLevel = OutlineLevel.Level3; } else if (heading.headingLevel == 4) { para.Format.OutlineLevel = OutlineLevel.Level4; } else if (heading.headingLevel == 5) { para.Format.OutlineLevel = OutlineLevel.Level5; } else if (heading.headingLevel == 6) { para.Format.OutlineLevel = OutlineLevel.Level6; } } } else if (tag is AutoDocumentation.Paragraph) { AutoDocumentation.Paragraph paragraph = tag as AutoDocumentation.Paragraph; if (paragraph.text.Contains("![Alt Text]")) { figureNumber++; } paragraph.text = paragraph.text.Replace("[FigureNumber]", figureNumber.ToString()); AddFormattedParagraphToSection(section, paragraph); } else if (tag is AutoDocumentation.GraphAndTable) { CreateGraphPDF(section, tag as AutoDocumentation.GraphAndTable, workingDirectory); } else if (tag is GraphPage) { CreateGraphPage(section, tag as GraphPage, workingDirectory); } else if (tag is AutoDocumentation.NewPage) { section.AddPageBreak(); } else if (tag is AutoDocumentation.Table) { CreateTable(section, tag as AutoDocumentation.Table, workingDirectory); } else if (tag is Graph) { GraphPresenter graphPresenter = new GraphPresenter(); explorerPresenter.ApsimXFile.Links.Resolve(graphPresenter); GraphView graphView = new GraphView(); graphView.BackColor = OxyPlot.OxyColors.White; graphView.ForegroundColour = OxyPlot.OxyColors.Black; graphView.FontSize = 12; graphView.Width = 500; graphView.Height = 500; graphPresenter.Attach(tag, graphView, explorerPresenter); string pngFileName = graphPresenter.ExportToPNG(workingDirectory); section.AddImage(pngFileName); string caption = (tag as Graph).Caption; if (caption != null) { section.AddParagraph(caption); } graphPresenter.Detach(); graphView.MainWidget.Destroy(); } else if (tag is Map && (tag as Map).GetCoordinates().Count > 0) { MapPresenter mapPresenter = new MapPresenter(); MapView mapView = new MapView(null); mapPresenter.Attach(tag, mapView, explorerPresenter); string pngFileName = mapPresenter.ExportToPNG(workingDirectory); if (!String.IsNullOrEmpty(pngFileName)) { section.AddImage(pngFileName); } mapPresenter.Detach(); mapView.MainWidget.Destroy(); } else if (tag is AutoDocumentation.Image) { AutoDocumentation.Image imageTag = tag as AutoDocumentation.Image; if (imageTag.image.Width > 700) { imageTag.image = ImageUtilities.ResizeImage(imageTag.image, 700, 500); } string pngFileName = Path.Combine(workingDirectory, imageTag.name); imageTag.image.Save(pngFileName, System.Drawing.Imaging.ImageFormat.Png); section.AddImage(pngFileName); figureNumber++; } else if (tag is AutoDocumentation.ModelView) { AutoDocumentation.ModelView modelView = tag as AutoDocumentation.ModelView; ViewNameAttribute viewName = ReflectionUtilities.GetAttribute(modelView.model.GetType(), typeof(ViewNameAttribute), false) as ViewNameAttribute; PresenterNameAttribute presenterName = ReflectionUtilities.GetAttribute(modelView.model.GetType(), typeof(PresenterNameAttribute), false) as PresenterNameAttribute; if (viewName != null && presenterName != null) { ViewBase view = Assembly.GetExecutingAssembly().CreateInstance(viewName.ToString(), false, BindingFlags.Default, null, new object[] { ViewBase.MasterView }, null, null) as ViewBase; IPresenter presenter = Assembly.GetExecutingAssembly().CreateInstance(presenterName.ToString()) as IPresenter; if (view != null && presenter != null) { explorerPresenter.ApsimXFile.Links.Resolve(presenter); presenter.Attach(modelView.model, view, explorerPresenter); Gtk.Window popupWin = null; if (view is MapView) { popupWin = (view as MapView)?.GetPopupWin(); popupWin?.SetSizeRequest(515, 500); } if (popupWin == null) { popupWin = new Gtk.Window(Gtk.WindowType.Popup); popupWin.SetSizeRequest(800, 800); popupWin.Add(view.MainWidget); } popupWin.ShowAll(); while (Gtk.Application.EventsPending()) { Gtk.Application.RunIteration(); } string pngFileName = (presenter as IExportable).ExportToPNG(workingDirectory); section.AddImage(pngFileName); presenter.Detach(); view.MainWidget.Destroy(); popupWin.Destroy(); } } } } }
protected virtual void Build() { dialog2 = new Gtk.Window("Copying files..."); // Widget copy.CopyWidget dialog2.Name = "copy.CopyWidget"; dialog2.Title = Mono.Unix.Catalog.GetString("CopyWidget"); dialog2.WindowPosition = ((Gtk.WindowPosition)(3)); // Container child copy.CopyWidget.Gtk.Container+ContainerChild this.vbox1 = new Gtk.VBox(); this.vbox1.Name = "vbox1"; this.vbox1.Spacing = 6; // Container child vbox1.Gtk.Box+BoxChild this.frame1 = new Gtk.Frame(); this.frame1.Name = "frame1"; this.frame1.ShadowType = ((Gtk.ShadowType)(2)); this.frame1.LabelXalign = 1F; this.frame1.BorderWidth = ((uint)(6)); // Container child frame1.Gtk.Container+ContainerChild this.GtkAlignment = new Gtk.Alignment(0F, 0F, 1F, 1F); this.GtkAlignment.Name = "GtkAlignment"; this.GtkAlignment.LeftPadding = ((uint)(12)); this.GtkAlignment.TopPadding = ((uint)(6)); this.GtkAlignment.RightPadding = ((uint)(10)); this.GtkAlignment.BottomPadding = ((uint)(10)); // Container child GtkAlignment.Gtk.Container+ContainerChild this.vbox2 = new Gtk.VBox(); this.vbox2.Name = "vbox2"; this.vbox2.Spacing = 6; // Container child vbox2.Gtk.Box+BoxChild this.hbox1 = new Gtk.HBox(); this.hbox1.Name = "hbox1"; this.hbox1.Spacing = 6; // Container child hbox1.Gtk.Box+BoxChild this.copyLabel = new Gtk.Label(); this.copyLabel.Name = "copyLabel"; this.copyLabel.LabelProp = Mono.Unix.Catalog.GetString("label2"); this.hbox1.Add(this.copyLabel); Gtk.Box.BoxChild w1 = ((Gtk.Box.BoxChild)(this.hbox1[this.copyLabel])); w1.Position = 0; w1.Expand = false; w1.Fill = false; this.vbox2.Add(this.hbox1); Gtk.Box.BoxChild w2 = ((Gtk.Box.BoxChild)(this.vbox2[this.hbox1])); w2.Position = 0; w2.Expand = false; w2.Fill = false; // Container child vbox2.Gtk.Box+BoxChild this.progressbar1 = new Gtk.ProgressBar(); this.progressbar1.Name = "progressbar1"; this.vbox2.Add(this.progressbar1); Gtk.Box.BoxChild w3 = ((Gtk.Box.BoxChild)(this.vbox2[this.progressbar1])); w3.Position = 1; w3.Expand = false; w3.Fill = false; this.GtkAlignment.Add(this.vbox2); this.frame1.Add(this.GtkAlignment); this.frameLabel = new Gtk.Label(); this.frameLabel.Name = "frameLabel"; this.frameLabel.Xpad = 8; this.frameLabel.LabelProp = Mono.Unix.Catalog.GetString("<b>GtkFrame</b>"); this.frameLabel.UseMarkup = true; this.frame1.LabelWidget = this.frameLabel; this.vbox1.Add(this.frame1); Gtk.Box.BoxChild w6 = ((Gtk.Box.BoxChild)(this.vbox1[this.frame1])); w6.Position = 0; w6.Expand = false; w6.Fill = false; dialog2.Add(this.vbox1); if ((dialog2.Child != null)) { dialog2.Child.ShowAll(); } dialog2.DefaultWidth = 400; dialog2.DefaultHeight = 100; // dialog2.Show(); }
void ShowTip (int x, int y, string text) { if (GdkWindow == null) return; if (tipWindow == null) { tipWindow = new TipWindow (); Gtk.Label lab = new Gtk.Label (text); lab.Xalign = 0; lab.Xpad = 3; lab.Ypad = 3; tipWindow.Add (lab); } ((Gtk.Label)tipWindow.Child).Text = text; int w = tipWindow.Child.SizeRequest().Width; int ox, oy; GdkWindow.GetOrigin (out ox, out oy); tipWindow.Move (ox + x - (w/2) + (iconSize/2), oy + y); tipWindow.ShowAll (); }
public override void Initialize() { Window = new Gtk.Window(""); Window.Add(CreateMainLayout()); }
public void Run() { Gtk.Application.Init(); ApiExtensibility.Register(typeof(Windows.UI.Core.ICoreWindowExtension), o => new GtkUIElementPointersSupport(o)); ApiExtensibility.Register(typeof(Windows.UI.ViewManagement.IApplicationViewExtension), o => new GtkApplicationViewExtension(o)); ApiExtensibility.Register(typeof(IApplicationExtension), o => new GtkApplicationExtension(o)); ApiExtensibility.Register(typeof(Windows.Graphics.Display.IDisplayInformationExtension), o => _displayInformationExtension ??= new GtkDisplayInformationExtension(o, _window)); _window = new Gtk.Window("Uno Host"); _window.SetDefaultSize(1024, 800); _window.SetPosition(Gtk.WindowPosition.Center); _window.DeleteEvent += delegate { Gtk.Application.Quit(); }; Windows.UI.Core.CoreDispatcher.DispatchOverride = d => { if (Gtk.Application.EventsPending()) { Gtk.Application.RunIteration(false); } GLib.Idle.Add(delegate { if (this.Log().IsEnabled(Microsoft.Extensions.Logging.LogLevel.Trace)) { this.Log().Trace($"Iteration"); } try { d(); } catch (Exception e) { Console.WriteLine(e); } return(false); }); }; _window.Realized += (s, e) => { WUX.Window.Current.OnNativeSizeChanged(new Windows.Foundation.Size(_window.AllocatedWidth, _window.AllocatedHeight)); }; _window.SizeAllocated += (s, e) => { WUX.Window.Current.OnNativeSizeChanged(new Windows.Foundation.Size(e.Allocation.Width, e.Allocation.Height)); }; _area = new UnoDrawingArea(); _window.Add(_area); /* avoids double invokes at window level */ _area.AddEvents((int)( Gdk.EventMask.PointerMotionMask | Gdk.EventMask.ButtonPressMask | Gdk.EventMask.ButtonReleaseMask )); _window.ShowAll(); void CreateApp(ApplicationInitializationCallbackParams _) { var app = _appBuilder(); app.Host = this; } WUX.Application.Start(CreateApp, _args); UpdateWindowPropertiesFromPackage(); Gtk.Application.Run(); }
public static void Main(string[] args) { Gtk.Application.Init(); string method; if (args.Length < 1) method = "train"; else method = args[0]; StrongClassifier? classifier; if (method == "load") classifier = StrongClassifier.LoadFromFile(args[1]); else if (method == "train") { string trainingDir = args[1]; classifier = StrongClassifier.Train(trainingDir); if (args.Length > 2) classifier.Value.Save(args[2]); } var win = new Gtk.Window("Détecteur de visages"); win.DefaultHeight = 350; win.DefaultWidth = 400; var toolbar = new Gtk.Toolbar(); var openButton = new Gtk.ToolButton(Gtk.Stock.Open); toolbar.Add(openButton); var image = new Gtk.Image(); openButton.Clicked += (sender, eventArgs) => { var fileDialog = new Gtk.FileChooserDialog("Choisissez une photo", null, Gtk.FileChooserAction.Open, "Open", Gtk.ResponseType.Accept); fileDialog.Run(); var photo = new Gdk.Pixbuf(fileDialog.Filename); fileDialog.Destroy(); // var photo = new Gdk.Pixbuf("/home/rapha/Bureau/300px-Thief_-_Radiohead.jpg"); // var photo = new IntegralImage("/home/rapha/Bureau/The_Beatles_Abbey_Road.jpg").Pixbuf; var detector = new Detector(photo, classifier.Value); foreach (var rect in detector.Detect()) { rect.Draw(photo); Console.WriteLine(rect); } image.Pixbuf = photo; }; var vbox = new Gtk.VBox(); vbox.PackStart(toolbar, false, false, 0); vbox.PackStart(image, true, true, 0); win.Add(vbox); win.ShowAll(); Gtk.Application.Run(); }
private void ShowStats(string title, int lines, int words, int chars) { Logger.Log ("Wordcount: {0}: {1} {2} {3}", title, lines, words, chars); stat_win = new Gtk.Window (String.Format ( "{0} - Word count", title)); stat_win.Resize (200, 100); Gtk.VBox box = new Gtk.VBox (false, 0); Gtk.Label stat_label = new Gtk.Label (); stat_label.Text = String.Format ( "{0}\n\nLines: {1}\nWords: {2}\nCharacters: {3}\n", title, lines, words, chars); box.PackStart (stat_label, true, true, 0); Gtk.Button ok = new Gtk.Button ("Close"); ok.Clicked += new EventHandler (OkHandler); box.PackStart (ok, true, true, 0); stat_win.Add (box); stat_win.ShowAll (); }
public SlideShow(string name) { Tag tag; if (name != null) { tag = Database.Tags.GetTagByName(name); } else { int id = (int)Preferences.Get(Preferences.SCREENSAVER_TAG); tag = Database.Tags.GetTagById(id); } Photo [] photos; if (tag != null) { photos = Database.Photos.Query(new Tag [] { tag }); } else if ((int)Preferences.Get(Preferences.SCREENSAVER_TAG) == 0) { photos = db.Photos.Query(new Tag [] {}); } else { photos = new Photo [0]; } window = new XScreenSaverSlide(); SetStyle(window); if (photos.Length > 0) { Array.Sort(photos, new Photo.RandomSort()); Gdk.Pixbuf black = new Gdk.Pixbuf(Gdk.Colorspace.Rgb, false, 8, 1, 1); black.Fill(0x00000000); slideview = new SlideView(black, photos); window.Add(slideview); } else { Gtk.HBox outer = new Gtk.HBox(); Gtk.HBox hbox = new Gtk.HBox(); Gtk.VBox vbox = new Gtk.VBox(); outer.PackStart(new Gtk.Label(String.Empty)); outer.PackStart(vbox, false, false, 0); vbox.PackStart(new Gtk.Label(String.Empty)); vbox.PackStart(hbox, false, false, 0); hbox.PackStart(new Gtk.Image(Gtk.Stock.DialogWarning, Gtk.IconSize.Dialog), false, false, 0); outer.PackStart(new Gtk.Label(String.Empty)); string msg; string long_msg; if (tag != null) { msg = String.Format(Catalog.GetString("No photos matching {0} found"), tag.Name); long_msg = String.Format(Catalog.GetString("The tag \"{0}\" is not applied to any photos. Try adding\n" + "the tag to some photos or selecting a different tag in the\n" + "F-Spot preference dialog."), tag.Name); } else { msg = Catalog.GetString("Search returned no results"); long_msg = Catalog.GetString("The tag F-Spot is looking for does not exist. Try\n" + "selecting a different tag in the F-Spot preference\n" + "dialog."); } Gtk.Label label = new Gtk.Label(msg); hbox.PackStart(label, false, false, 0); Gtk.Label long_label = new Gtk.Label(long_msg); long_label.Markup = String.Format("<small>{0}</small>", long_msg); vbox.PackStart(long_label, false, false, 0); vbox.PackStart(new Gtk.Label(String.Empty)); window.Add(outer); SetStyle(label); SetStyle(long_label); //SetStyle (image); } window.ShowAll(); }
static void GetDefaults () { if (!gotDefault) { // Is there a better way of getting the default? Gtk.Window d = new Gtk.Window (""); Gtk.Toolbar t = new Gtk.Toolbar (); d.Add (t); defaultStyle = t.ToolbarStyle; defaultSize = t.IconSize; d.Destroy (); gotDefault = true; } }
internal void SetFloatMode (Gdk.Rectangle rect) { if (floatingWindow == null) { ResetMode (); SetRegionStyle (frame.GetRegionStyleForItem (this)); floatingWindow = new DockFloatingWindow ((Gtk.Window)frame.Toplevel, GetWindowTitle ()); Ide.IdeApp.CommandService.RegisterTopWindow (floatingWindow); Gtk.VBox box = new Gtk.VBox (); box.Show (); box.PackStart (TitleTab, false, false, 0); box.PackStart (Widget, true, true, 0); floatingWindow.Add (box); floatingWindow.DeleteEvent += delegate (object o, Gtk.DeleteEventArgs a) { if (behavior == DockItemBehavior.CantClose) Status = DockItemStatus.Dockable; else Visible = false; a.RetVal = true; }; } floatingWindow.Move (rect.X, rect.Y); floatingWindow.Resize (rect.Width, rect.Height); floatingWindow.Show (); if (titleTab != null) titleTab.UpdateBehavior (); Widget.Show (); }
public void Run() { Gtk.Application.Init(); ApiExtensibility.Register(typeof(Windows.UI.Core.ICoreWindowExtension), o => new GtkUIElementPointersSupport(o)); _window = new Gtk.Window("Uno Host"); _window.SetDefaultSize(1024, 800); _window.SetPosition(Gtk.WindowPosition.Center); _window.DeleteEvent += delegate { Gtk.Application.Quit(); }; Windows.UI.Core.CoreDispatcher.DispatchOverride = d => { if (Gtk.Application.EventsPending()) { Gtk.Application.RunIteration(false); } GLib.Idle.Add(delegate { Console.WriteLine("iteration"); try { d(); } catch (Exception e) { Console.WriteLine(e); } return(false); }); }; _window.Realized += (s, e) => { WUX.Window.Current.OnNativeSizeChanged(new Windows.Foundation.Size(_window.AllocatedWidth, _window.AllocatedHeight)); }; _window.SizeAllocated += (s, e) => { WUX.Window.Current.OnNativeSizeChanged(new Windows.Foundation.Size(e.Allocation.Width, e.Allocation.Height)); }; var area = new UnoDrawingArea(); _window.Add(area); /* avoids double invokes at window level */ area.AddEvents((int)( Gdk.EventMask.PointerMotionMask | Gdk.EventMask.ButtonPressMask | Gdk.EventMask.ButtonReleaseMask )); _window.ShowAll(); WUX.Application.Start(_ => _appBuilder()); Gtk.Application.Run(); }
/// <summary>Writes PDF for specified auto-doc commands.</summary> /// <param name="section">The writer to write to.</param> /// <param name="tags">The autodoc tags.</param> private void TagsToMigraDoc(Section section, List <AutoDocumentation.ITag> tags) { int figureNumber = 0; foreach (AutoDocumentation.ITag tag in tags) { if (tag is AutoDocumentation.Heading) { AutoDocumentation.Heading heading = tag as AutoDocumentation.Heading; if (heading.headingLevel > 0 && heading.headingLevel <= 6) { Paragraph para = section.AddParagraph(heading.text, "Heading" + heading.headingLevel); para.Format.KeepWithNext = true; int posSpace = heading.text.IndexOf(' '); if (posSpace > 0) { para.AddBookmark(heading.text.Substring(posSpace + 1)); } if (heading.headingLevel == 1) { para.Format.OutlineLevel = OutlineLevel.Level1; } else if (heading.headingLevel == 2) { para.Format.OutlineLevel = OutlineLevel.Level2; } else if (heading.headingLevel == 3) { para.Format.OutlineLevel = OutlineLevel.Level3; } else if (heading.headingLevel == 4) { para.Format.OutlineLevel = OutlineLevel.Level4; } else if (heading.headingLevel == 5) { para.Format.OutlineLevel = OutlineLevel.Level5; } else if (heading.headingLevel == 6) { para.Format.OutlineLevel = OutlineLevel.Level6; } } } else if (tag is AutoDocumentation.Paragraph) { AutoDocumentation.Paragraph paragraph = tag as AutoDocumentation.Paragraph; if (paragraph.text.Contains("![Alt Text]")) { figureNumber++; } paragraph.text = paragraph.text.Replace("[FigureNumber]", figureNumber.ToString()); AddFormattedParagraphToSection(section, paragraph); } else if (tag is AutoDocumentation.GraphAndTable) { CreateGraphPDF(section, tag as AutoDocumentation.GraphAndTable); } else if (tag is GraphPage) { CreateGraphPage(section, tag as GraphPage); } else if (tag is AutoDocumentation.NewPage) { section.AddPageBreak(); } else if (tag is AutoDocumentation.Table) { CreateTable(section, tag as AutoDocumentation.Table); } else if (tag is Graph) { GraphPresenter graphPresenter = new GraphPresenter(); explorerPresenter.ApsimXFile.Links.Resolve(graphPresenter); GraphView graphView = new GraphView(); graphView.BackColor = OxyPlot.OxyColors.White; graphView.ForegroundColour = OxyPlot.OxyColors.Black; graphView.FontSize = 12; graphView.Width = 500; graphView.Height = 500; graphPresenter.Attach(tag, graphView, explorerPresenter); string pngFileName = graphPresenter.ExportToPNG(WorkingDirectory); section.AddImage(pngFileName); string caption = (tag as Graph).Caption; if (caption != null) { section.AddParagraph(caption); } graphPresenter.Detach(); graphView.MainWidget.Destroy(); } else if (tag is Map && (tag as Map).GetCoordinates().Count > 0) { MapPresenter mapPresenter = new MapPresenter(); MapView mapView = new MapView(null); mapPresenter.Attach(tag, mapView, explorerPresenter); string pngFileName = mapPresenter.ExportToPNG(WorkingDirectory); if (!String.IsNullOrEmpty(pngFileName)) { section.AddImage(pngFileName); } mapPresenter.Detach(); mapView.MainWidget.Destroy(); } else if (tag is AutoDocumentation.Image) { AutoDocumentation.Image imageTag = tag as AutoDocumentation.Image; if (imageTag.image.Width > 700) { imageTag.image = ImageUtilities.ResizeImage(imageTag.image, 700, 500); } string pngFileName = Path.Combine(WorkingDirectory, imageTag.name); imageTag.image.Save(pngFileName, System.Drawing.Imaging.ImageFormat.Png); section.AddImage(pngFileName); figureNumber++; } else if (tag is AutoDocumentation.ModelView) { AutoDocumentation.ModelView modelView = tag as AutoDocumentation.ModelView; ViewNameAttribute viewName = ReflectionUtilities.GetAttribute(modelView.model.GetType(), typeof(ViewNameAttribute), false) as ViewNameAttribute; PresenterNameAttribute presenterName = ReflectionUtilities.GetAttribute(modelView.model.GetType(), typeof(PresenterNameAttribute), false) as PresenterNameAttribute; if (viewName != null && presenterName != null) { ViewBase owner = ViewBase.MasterView as ViewBase; if (viewName.ToString() == "UserInterface.Views.MapView") { owner = null; } ViewBase view = Assembly.GetExecutingAssembly().CreateInstance(viewName.ToString(), false, BindingFlags.Default, null, new object[] { owner }, null, null) as ViewBase; IPresenter presenter = Assembly.GetExecutingAssembly().CreateInstance(presenterName.ToString()) as IPresenter; if (view != null && presenter != null) { explorerPresenter.ApsimXFile.Links.Resolve(presenter); presenter.Attach(modelView.model, view, explorerPresenter); Gtk.Window popupWin = new Gtk.Window(Gtk.WindowType.Popup); popupWin.SetSizeRequest(800, 800); popupWin.Add(view.MainWidget); if (view is IMapView map) { map.HideZoomControls(); } popupWin.ShowAll(); while (Gtk.Application.EventsPending()) { Gtk.Application.RunIteration(); } // From MapView: // With WebKit, it appears we need to give it time to actually update the display // Really only a problem with the temporary windows used for generating documentation if (view is MapView) { var watch = new System.Diagnostics.Stopwatch(); watch.Start(); while (watch.ElapsedMilliseconds < 1000) { Gtk.Application.RunIteration(); } } string pngFileName = (presenter as IExportable).ExportToPNG(WorkingDirectory); section.AddImage(pngFileName); presenter.Detach(); view.MainWidget.Destroy(); popupWin.Destroy(); } } } } }
public static void Main (string [] args) { System.Collections.ArrayList failed = new System.Collections.ArrayList (); Gtk.Application.Init (); foreach (string path in args) { Gtk.Window win = new Gtk.Window (path); Gtk.HBox box = new Gtk.HBox (); box.Spacing = 12; win.Add (box); Gtk.Image image; image = new Gtk.Image (); System.DateTime start = System.DateTime.Now; System.TimeSpan one = start - start; System.TimeSpan two = start - start; try { start = System.DateTime.Now; image.Pixbuf = new Gdk.Pixbuf (path); one = System.DateTime.Now - start; } catch (System.Exception e) { } box.PackStart (image); image = new Gtk.Image (); try { start = System.DateTime.Now; PngFile png = new PngFile (path); image.Pixbuf = png.GetPixbuf (); two = System.DateTime.Now - start; } catch (System.Exception e) { failed.Add (path); //System.Console.WriteLine ("Error loading {0}", path); //System.Console.WriteLine (e.ToString ()); } //System.Console.WriteLine ("{2} Load Time {0} vs {1}", one.TotalMilliseconds, two.TotalMilliseconds, path); box.PackStart (image); win.ShowAll (); } //System.Console.WriteLine ("{0} Failed to Load", failed.Count); foreach (string fail_path in failed) { //System.Console.WriteLine (fail_path); } Gtk.Application.Run (); }
public override void Initialize() { Window = new Gtk.Window (""); Window.Add (CreateMainLayout ()); }
public static void Main (string [] args) { Gtk.Application.Init (); Gdk.Pixbuf pixbuf = new Gdk.Pixbuf (args [0]); Log.DebugFormat ("loaded {0}", args [0]); Histogram hist = new Histogram (); Log.DebugFormat ("loaded histgram", args [0]); Gtk.Window win = new Gtk.Window ("display"); Gtk.Image image = new Gtk.Image (); Gdk.Pixbuf img = hist.Generate (pixbuf); image.Pixbuf = img; win.Add (image); win.ShowAll (); Gtk.Application.Run (); }
// Drag function for automatic sources, called from DragBegin static void Drag(Gtk.Widget source, Gdk.DragContext ctx, WidgetDropCallback dropCallback, Gtk.Widget dragWidget) { if (ctx == null) return; Gtk.Window dragWin; Gtk.Requisition req; ShowFaults (); DND.dragWidget = dragWidget; DND.dropCallback = dropCallback; dragWin = new Gtk.Window (Gtk.WindowType.Popup); dragWin.Add (dragWidget); req = dragWidget.SizeRequest (); if (req.Width < 20 && req.Height < 20) dragWin.SetSizeRequest (20, 20); else if (req.Width < 20) dragWin.SetSizeRequest (20, -1); else if (req.Height < 20) dragWin.SetSizeRequest (-1, 20); req = dragWin.SizeRequest (); int px, py, rx, ry; Gdk.ModifierType pmask; ctx.SourceWindow.GetPointer (out px, out py, out pmask); ctx.SourceWindow.GetRootOrigin (out rx, out ry); dragWin.Move (rx + px, ry + py); dragWin.Show (); dragHotX = req.Width / 2; dragHotY = -3; Gtk.Drag.SetIconWidget (ctx, dragWin, dragHotX, dragHotY); if (source != null) { source.DragDataGet += DragDataGet; source.DragEnd += DragEnded; } }
public SlideShow (string name) { Tag tag; if (name != null) tag = Database.Tags.GetTagByName (name); else { int id = (int) Preferences.Get (Preferences.SCREENSAVER_TAG); tag = Database.Tags.GetTagById (id); } Photo [] photos; if (tag != null) photos = Database.Photos.Query (new Tag [] { tag } ); else if ((int) Preferences.Get (Preferences.SCREENSAVER_TAG) == 0) photos = db.Photos.Query (new Tag [] {}); else photos = new Photo [0]; window = new XScreenSaverSlide (); SetStyle (window); if (photos.Length > 0) { Array.Sort (photos, new Photo.RandomSort ()); Gdk.Pixbuf black = new Gdk.Pixbuf (Gdk.Colorspace.Rgb, false, 8, 1, 1); black.Fill (0x00000000); slideview = new SlideView (black, photos); window.Add (slideview); } else { Gtk.HBox outer = new Gtk.HBox (); Gtk.HBox hbox = new Gtk.HBox (); Gtk.VBox vbox = new Gtk.VBox (); outer.PackStart (new Gtk.Label (String.Empty)); outer.PackStart (vbox, false, false, 0); vbox.PackStart (new Gtk.Label (String.Empty)); vbox.PackStart (hbox, false, false, 0); hbox.PackStart (new Gtk.Image (Gtk.Stock.DialogWarning, Gtk.IconSize.Dialog), false, false, 0); outer.PackStart (new Gtk.Label (String.Empty)); string msg; string long_msg; if (tag != null) { msg = String.Format (Catalog.GetString ("No photos matching {0} found"), tag.Name); long_msg = String.Format (Catalog.GetString ("The tag \"{0}\" is not applied to any photos. Try adding\n" + "the tag to some photos or selecting a different tag in the\n" + "F-Spot preference dialog."), tag.Name); } else { msg = Catalog.GetString ("Search returned no results"); long_msg = Catalog.GetString ("The tag F-Spot is looking for does not exist. Try\n" + "selecting a different tag in the F-Spot preference\n" + "dialog."); } Gtk.Label label = new Gtk.Label (msg); hbox.PackStart (label, false, false, 0); Gtk.Label long_label = new Gtk.Label (long_msg); long_label.Markup = String.Format ("<small>{0}</small>", long_msg); vbox.PackStart (long_label, false, false, 0); vbox.PackStart (new Gtk.Label (String.Empty)); window.Add (outer); SetStyle (label); SetStyle (long_label); //SetStyle (image); } window.ShowAll (); }