当前位置: 首页>>代码示例>>C#>>正文


C# Gtk.Window类代码示例

本文整理汇总了C#中Gtk.Window的典型用法代码示例。如果您正苦于以下问题:C# Window类的具体用法?C# Window怎么用?C# Window使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。


Window类属于Gtk命名空间,在下文中一共展示了Window类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。

示例1: Main

        /// <summary>
        /// Defines the entry point of the application.
        /// </summary>
        private static void Main()
        {
            Application.Init();

            var window = new Window("GtkSharpDemo");
            var plotModel = new PlotModel
                         {
                             Title = "Trigonometric functions",
                             Subtitle = "Example using the FunctionSeries",
                             PlotType = PlotType.Cartesian,
                             Background = OxyColors.White
                         };
            plotModel.Series.Add(new FunctionSeries(Math.Sin, -10, 10, 0.1, "sin(x)") { Color = OxyColors.Black });
            plotModel.Series.Add(new FunctionSeries(Math.Cos, -10, 10, 0.1, "cos(x)") { Color = OxyColors.Green });
            plotModel.Series.Add(new FunctionSeries(t => 5 * Math.Cos(t), t => 5 * Math.Sin(t), 0, 2 * Math.PI, 0.1, "cos(t),sin(t)") { Color = OxyColors.Yellow });
            
            var plotView = new OxyPlot.GtkSharp.PlotView { Model = plotModel };
            plotView.SetSizeRequest(400, 400);
            plotView.Visible = true;

            window.SetSizeRequest(600, 600);
            window.Add(plotView);
            window.Focus = plotView;
            window.Show();
            window.DeleteEvent += (s, a) =>
                {
                    Application.Quit();
                    a.RetVal = true;
                };

            Application.Run();
        }
开发者ID:Celderon,项目名称:oxyplot,代码行数:35,代码来源:Program.cs

示例2: ShowError

		public static void ShowError (Exception ex, string message, Window parent, bool modal)
		{
			Gtk.Builder builder = new Gtk.Builder (null, "Mono.Addins.GuiGtk3.interfaces.ErrorDialog.ui", null);
			ErrorDialog dlg = new ErrorDialog (builder, builder.GetObject ("ErrorDialog").Handle);
			
			if (message == null) {
				if (ex != null)
					dlg.Message = string.Format (Catalog.GetString ("Exception occurred: {0}"), ex.Message);
				else {
					dlg.Message = "An unknown error occurred";
					dlg.AddDetails (Environment.StackTrace, false);
				}
			} else
				dlg.Message = message;
			
			if (ex != null) {
				dlg.AddDetails (string.Format (Catalog.GetString ("Exception occurred: {0}"), ex.Message) + "\n\n", true);
				dlg.AddDetails (ex.ToString (), false);
			}

			if (modal) {
				dlg.Run ();
				dlg.Destroy ();
			} else
				dlg.Show ();
		}
开发者ID:wanglehui,项目名称:mono-addins,代码行数:26,代码来源:Services.cs

示例3: show

 public static ResponseType show(Window parent_window, DialogFlags dialogFlags, MessageType messageType, ButtonsType buttonsType,string  message)
 {
     _dlg = new MessageDialog (parent_window, dialogFlags,messageType, buttonsType, message);
     ResponseType response = (ResponseType) _dlg.Run ();
     _dlg.Destroy ();
     return response;
 }
开发者ID:xmalmorthen,项目名称:DashBoard,代码行数:7,代码来源:dlg.cs

示例4: InfoWindow

        public InfoWindow(Song song, Window w)
            : base("", w, DialogFlags.DestroyWithParent)
        {
            this.HasSeparator = false;

            Glade.XML glade_xml = new Glade.XML (null, "InfoWindow.glade", "info_contents", null);
            glade_xml.Autoconnect (this);
            this.VBox.Add (info_contents);

            cover_image = new MagicCoverImage ();
            cover_image_container.Add (cover_image);
            cover_image.Visible = true;

            // Gdk.Pixbuf cover = new Gdk.Pixbuf (null, "unknown-cover.png", 66, 66);
            // cover_image.ChangePixbuf (cover);

            user_name_label = new UrlLabel ();
            user_name_label.UrlActivated += new UrlActivatedHandler (OnUrlActivated);
            user_name_container.Add (user_name_label);
            user_name_label.SetAlignment ((float) 0.0, (float) 0.5);
            user_name_label.Visible = true;

            real_name_label = new UrlLabel ();
            real_name_label.UrlActivated += new UrlActivatedHandler (OnUrlActivated);
            real_name_container.Add (real_name_label);
            real_name_label.SetAlignment ((float) 0.0, (float) 0.5);
            real_name_label.Visible = true;

            this.AddButton ("gtk-close", ResponseType.Close);

            SetSong (song);
        }
开发者ID:GNOME,项目名称:last-exit,代码行数:32,代码来源:InfoWindow.cs

示例5: FullscreenControls

 public FullscreenControls(Window toplevel, InterfaceActionService actionService)
     : base(toplevel, 1)
 {
     action_service = actionService;
     AddAccelGroup (action_service.UIManager.AccelGroup);
     BuildInterface ();
 }
开发者ID:knocte,项目名称:banshee,代码行数:7,代码来源:FullscreenControls.cs

示例6: SymbolLabelDialog

		/// <summary>
		/// <c>SymbolLabelInfoConfigDialog</c>'s constructor.
		/// </summary>
		/// <param name="parent">
		/// The dialog's parent window.
		/// </param>
		public SymbolLabelDialog(Window parent)
		{
			XML gxml = new XML(null, "gui.glade","symbolLabelDialog",null);
			
			gxml.Autoconnect(this);
			
			symbolLabelDialog.Modal = true;
			symbolLabelDialog.Resizable = false;
			symbolLabelDialog.TransientFor = parent;
			
			CellRendererText cellRenderer = new CellRendererText();			
			
			cellRenderer.Xalign = 0.5f;
			symbolLabelsTV.AppendColumn("Símbolo", cellRenderer,"text",0);
			symbolLabelsTV.AppendColumn("Etiqueta", new CellRendererText(),"text",1);
			
			symbolLabelsModel = new ListStore(typeof(string), 
			                                  typeof(string));
			
			symbolLabelsTV.Model = symbolLabelsModel;
			
			symbolLabelsTV.Selection.Changed += OnSymbolLabelsTVSelectionChanged;
			
			foreach (SymbolLabelInfo info in LibraryConfig.Instance.Symbols)
			{				
				symbolLabelsModel.AppendValues(info.Symbol, info.Label);
			}
			
			changes = false;
		}
开发者ID:coler706,项目名称:mathtextrecognizer,代码行数:36,代码来源:SymbolLabelDialog.cs

示例7: DemoMain

		public DemoMain ()
		{
			SetupDefaultIcon ();
		   	window = new Gtk.Window ("Gtk# Code Demos");
		   	window.SetDefaultSize (600, 400);
			window.DeleteEvent += new DeleteEventHandler (WindowDelete);

			HBox hbox = new HBox (false, 0);
			window.Add (hbox);

			treeView = CreateTree ();
			hbox.PackStart (treeView, false, false, 0);

			Notebook notebook = new Notebook ();
			hbox.PackStart (notebook, true, true, 0);

			notebook.AppendPage (CreateText (infoBuffer, false), new Label ("_Info"));
			TextTag heading = new TextTag ("heading");
			heading.Font = "Sans 18";
			infoBuffer.TagTable.Add (heading);

			notebook.AppendPage (CreateText (sourceBuffer, true), new Label ("_Source"));

			window.ShowAll ();
		}
开发者ID:ystk,项目名称:debian-gtk-sharp2,代码行数:25,代码来源:DemoMain.cs

示例8: MeeGoPanel

        public MeeGoPanel ()
        {
            if (Instance != null) {
                throw new InvalidOperationException ("Only one MeeGoPanel instance should exist");
            }

            Instance = this;

            var timer = Log.DebugTimerStart ();

            try {
                Log.Debug ("Attempting to create MeeGo toolbar panel");
                embedded_panel = new PanelGtk ("banshee", Catalog.GetString ("media"),
                    null, "media-button", true);
                embedded_panel.ShowBeginEvent += (o, e) => {
                    ServiceManager.SourceManager.SetActiveSource (ServiceManager.SourceManager.MusicLibrary);
                    if (Contents != null) {
                        Contents.SyncSearchEntry ();
                    }
                };
                while (Gtk.Application.EventsPending ()) {
                    Gtk.Application.RunIteration ();
                }
            } catch (Exception e) {
                if (!(e is DllNotFoundException)) {
                    Log.Exception ("Could not bind to MeeGo panel", e);
                }
                window_panel = new Gtk.Window ("MeeGo Media Panel");
            }

            Log.DebugTimerPrint (timer, "MeeGo panel created: {0}");
        }
开发者ID:haugjan,项目名称:banshee-hacks,代码行数:32,代码来源:MeeGoPanel.cs

示例9: ShowAt

        public void ShowAt(int x, int y, double horizontal_align, double vertical_align)
        {
            if(win == null)
            {
                win = new Window (WindowType.Popup);
            }

            Pango.Layout layout = win.CreatePangoLayout (accelerator);
            int width, height;
            layout.GetPixelSize (out width, out height);
            width += 2;
            height += 2;

            x -= (int)(horizontal_align * width);
            y -= (int)(vertical_align * height);

            win.Show ();
            win.GdkWindow.Move (x, y);
            win.GdkWindow.Resize (width, height);

            win.ExposeEvent += delegate(object Sender, ExposeEventArgs Args)
            {
                Gdk.EventExpose evnt = Args.Event;

                Cairo.Context cr = Gdk.CairoHelper.Create (win.GdkWindow);

                cr.Rectangle (evnt.Area.X, evnt.Area.Y, evnt.Area.Width, evnt.Area.Height);
                cr.Clip ();
                theme.DrawKeyTip (cr, new Cairo.Point (win.Allocation.X, win.Allocation.Y), 0, 0, layout);

                ((IDisposable)cr.Target).Dispose ();
                ((IDisposable)cr).Dispose ();
            };
        }
开发者ID:MASGAU,项目名称:gtk-sharp-ribbon,代码行数:34,代码来源:KeyTip.cs

示例10: frmAbout

        /// <summary>
        /// Creates an instance of the frmAbout class.
        /// </summary>
        /// <history>
        /// [Curtis_Beard]      11/02/2006  Created
        /// </history>
        public frmAbout(Window w, DialogFlags f)
            : base("", w, f)
        {
            InitializeComponent();

             SetVersion();
        }
开发者ID:joshball,项目名称:astrogrep,代码行数:13,代码来源:frmAbout.cs

示例11: AboutDialog

        public AboutDialog(Window parent)
            : base(parent, "AboutDialog")
        {
            string title = String.Empty;
            string version = String.Empty;

            var assembly = Assembly.GetExecutingAssembly();

            var titleAttributes = assembly.GetCustomAttributes(typeof(AssemblyTitleAttribute), false);
            if (titleAttributes.Length > 0) {
                AssemblyTitleAttribute titleAttribute = (AssemblyTitleAttribute)titleAttributes[0];
                if (!String.IsNullOrEmpty(titleAttribute.Title)) {
                    title = titleAttribute.Title;
                }
            }

            var versionAttributes = assembly.GetCustomAttributes(typeof(AssemblyVersionAttribute), false);
            if (versionAttributes.Length > 0) {
                AssemblyVersionAttribute versionAttribute = (AssemblyVersionAttribute)versionAttributes[0];
                if (!String.IsNullOrEmpty(versionAttribute.Version)) {
                    version =  versionAttribute.Version;
                }
            }

            Gtk.AboutDialog dialog = (Gtk.AboutDialog)base.Dialog;

            if (!String.IsNullOrEmpty(title))
                dialog.ProgramName = title;

            if (!String.IsNullOrEmpty(version))
                dialog.Version = version;
        }
开发者ID:codebutler,项目名称:meshwork,代码行数:32,代码来源:AboutDialog.cs

示例12: EditCategoryDialog

 public EditCategoryDialog(ProjectLongoMatch project, EventType eventType, Window parent)
 {
     TransientFor = parent;
     this.Build ();
     timenodeproperties2.EventType = eventType;
     timenodeproperties2.Dashboard = project.Dashboard;
 }
开发者ID:LongoMatch,项目名称:longomatch,代码行数:7,代码来源:EditCategoryDialog.cs

示例13: GenerationMenuWidget

        public GenerationMenuWidget(Window parent, IElement referer, Bus bus, string busName)
        {
            if (referer.Data != null) {
                MenuItem path = new MenuItem("Call " + referer.Name + "...");
                ObjectPath p = new ObjectPath(referer.Parent.Parent.Path);

                if (!referer.Data.IsProperty) {
                    path.Activated += delegate {
                        MethodInvokeDialog diag = new MethodInvokeDialog (parent, bus, busName, p, referer);

                        while (diag.Run () == (int)ResponseType.None);
                        diag.Destroy();
                    };
                } else {
                    path.Activated += delegate {
                        PropertyInvokeDialog diag = new PropertyInvokeDialog (parent, bus, busName, p, referer);

                        while (diag.Run () == (int)ResponseType.None);
                        diag.Destroy();
                    };
                }

                this.Append(path);
                path.ShowAll();
            }
        }
开发者ID:garuma,项目名称:dbus-explorer,代码行数:26,代码来源:GenerationMenuWidget.cs

示例14: CompareVersions

        public static bool CompareVersions(Window parent)
        {
            _parent = parent;
            var downloadToPath = Path.GetTempPath();
            var localVersion = Versions.LocalVersion();
            var remoteVersion = Versions.RemoteVersion(RemoteVersion);
            if (string.IsNullOrWhiteSpace(remoteVersion)) //prevent to reload first version
            {
                return true;
            }
            var c = 0;
            Version v;
            if(Version.TryParse(localVersion, out v))
            {
                c = v.CompareTo(Version.Parse(remoteVersion));
            }

            if (c < 0)
            {
                BeginDownload(RemoteFile, downloadToPath, remoteVersion, LocalFile);
                return false;
            }

            return true;
        }
开发者ID:jdpillon,项目名称:ArduinoLadder,代码行数:25,代码来源:UpdateHelper.cs

示例15: ShowMessageBox

        // Message box
        public static ResponseType ShowMessageBox(Window parent,
            MessageType mtype,
            ButtonsType buttons,
            string title,
            string message,
            params string[] args)
        {
            MessageDialog msgDlg =
                new MessageDialog(parent,
                                  DialogFlags.Modal,
                                  mtype,
                                  buttons,
                                  message,
                                  args);
            msgDlg.Title = title;
            msgDlg.UseMarkup = false;

            ResponseType response = ResponseType.None;
            msgDlg.Response += (object o, ResponseArgs args2) =>
            {
                msgDlg.Destroy();
                response = args2.ResponseId;
            };
            msgDlg.Run();
            return response;
        }
开发者ID:Orochimarufan,项目名称:MultiMC,代码行数:27,代码来源:MessageUtils.cs


注:本文中的Gtk.Window类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。