本文整理汇总了C#中Gtk.Window.Add方法的典型用法代码示例。如果您正苦于以下问题:C# Gtk.Window.Add方法的具体用法?C# Gtk.Window.Add怎么用?C# Gtk.Window.Add使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Gtk.Window
的用法示例。
在下文中一共展示了Gtk.Window.Add方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: WindowBackend
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 ();
}
示例2: Main
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 ();
}
示例3: SendMessagesOverviewWindow
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 ();
}
示例4: MusicSource
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();
}
示例5: Drag
// 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;
}
}
示例6: Initialize
public override void Initialize()
{
Window = new Gtk.Window ("");
Window.Add (CreateMainLayout ());
}
示例7: SetFloatMode
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 ();
}
示例8: Main
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 ();
}
示例9: Main
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();
}
示例10: ShowStats
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 ();
}
示例11: ShowTip
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 ();
}
示例12: SlideShow
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 ();
}
示例13: Main
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 ();
}
示例14: OnButtonMapInWindowClicked
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;
}
}
示例15: GetDefaults
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;
}
}