本文整理汇总了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();
}
示例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 ();
}
示例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;
}
示例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);
}
示例5: FullscreenControls
public FullscreenControls(Window toplevel, InterfaceActionService actionService)
: base(toplevel, 1)
{
action_service = actionService;
AddAccelGroup (action_service.UIManager.AccelGroup);
BuildInterface ();
}
示例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;
}
示例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 ();
}
示例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}");
}
示例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 ();
};
}
示例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();
}
示例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;
}
示例12: EditCategoryDialog
public EditCategoryDialog(ProjectLongoMatch project, EventType eventType, Window parent)
{
TransientFor = parent;
this.Build ();
timenodeproperties2.EventType = eventType;
timenodeproperties2.Dashboard = project.Dashboard;
}
示例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();
}
}
示例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;
}
示例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;
}