本文整理汇总了C#中Gtk.Window.Move方法的典型用法代码示例。如果您正苦于以下问题:C# Window.Move方法的具体用法?C# Window.Move怎么用?C# Window.Move使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Gtk.Window
的用法示例。
在下文中一共展示了Window.Move方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: TransparentWindow
public TransparentWindow(Gtk.Widget main_widget, Function<int> x_pos_func, Function<int> y_pos_func, string the_name)
{
x_pos_function = x_pos_func;
y_pos_function = y_pos_func;
name = the_name;
window = new Window(WindowType.Popup);
// window.ExposeEvent += Expose;
window.Add(main_widget);
window.Move(x_pos_function(), y_pos_function());
window.ShowAll();
}
示例2: Start
public void Start()
{
currentStep = 0;
window = new Window(WindowType.Toplevel);
window.Move(10, 10);
window.KeepAbove = true;
window.Resize(400, 30);
window.AcceptFocus = false;
window.Title = "Progress Bar";
progressBar = new ProgressBar();
progressBar.Fraction = 0;
window.Add(progressBar);
window.ShowAll();
}
示例3: CenterWindow
/// <summary>Centers a window relative to its parent.</summary>
static void CenterWindow (Window child, Window parent)
{
child.Child.Show ();
int w, h, winw, winh, x, y, winx, winy;
child.GetSize (out w, out h);
parent.GetSize (out winw, out winh);
parent.GetPosition (out winx, out winy);
x = Math.Max (0, (winw - w) /2) + winx;
y = Math.Max (0, (winh - h) /2) + winy;
child.Move (x, y);
}
示例4: ShowCalendar
public void ShowCalendar()
{
popup = new Window(WindowType.Popup);
popup.Screen = parent.Screen;
Frame frame = new Frame();
frame.Shadow = ShadowType.Out;
frame.Show();
popup.Add(frame);
VBox box = new VBox(false, 0);
box.Show();
frame.Add(box);
cal = new Calendar();
cal.DisplayOptions = CalendarDisplayOptions.ShowHeading
| CalendarDisplayOptions.ShowDayNames
| CalendarDisplayOptions.ShowWeekNumbers;
cal.KeyPressEvent += OnCalendarKeyPressed;
popup.ButtonPressEvent += OnButtonPressed;
cal.Show();
Alignment calAlignment = new Alignment(0.0f, 0.0f, 1.0f, 1.0f);
calAlignment.Show();
calAlignment.SetPadding(4, 4, 4, 4);
calAlignment.Add(cal);
box.PackStart(calAlignment, false, false, 0);
//Requisition req = SizeRequest();
parent.GdkWindow.GetOrigin(out xPos, out yPos);
// popup.Move(x + Allocation.X, y + Allocation.Y + req.Height + 3);
popup.Move(xPos, yPos);
popup.Show();
popup.GrabFocus();
Grab.Add(popup);
Gdk.GrabStatus grabbed = Gdk.Pointer.Grab(popup.GdkWindow, true,
Gdk.EventMask.ButtonPressMask
| Gdk.EventMask.ButtonReleaseMask
| Gdk.EventMask.PointerMotionMask, null, null, CURRENT_TIME);
if (grabbed == Gdk.GrabStatus.Success) {
grabbed = Gdk.Keyboard.Grab(popup.GdkWindow,
true, CURRENT_TIME);
if (grabbed != Gdk.GrabStatus.Success) {
Grab.Remove(popup);
popup.Destroy();
popup = null;
}
} else {
Grab.Remove(popup);
popup.Destroy();
popup = null;
}
cal.DaySelected += OnCalendarDaySelected;
cal.MonthChanged += OnCalendarMonthChanged;
cal.Date = date;
}
示例5: ShowCalendar
private void ShowCalendar()
{
popup = new Window(WindowType.Popup);
popup.Screen = tree.Screen;
Frame frame = new Frame();
frame.Shadow = ShadowType.Out;
frame.Show();
popup.Add(frame);
VBox box = new VBox(false, 0);
box.Show();
frame.Add(box);
cal = new Calendar();
cal.DisplayOptions = CalendarDisplayOptions.ShowHeading
| CalendarDisplayOptions.ShowDayNames
| CalendarDisplayOptions.ShowWeekNumbers;
cal.KeyPressEvent += OnCalendarKeyPressed;
popup.ButtonPressEvent += OnButtonPressed;
cal.Show();
Alignment calAlignment = new Alignment(0.0f, 0.0f, 1.0f, 1.0f);
calAlignment.Show();
calAlignment.SetPadding(4, 4, 4, 4);
calAlignment.Add(cal);
box.PackStart(calAlignment, false, false, 0);
// FIXME: Make the popup appear directly below the date
Gdk.Rectangle allocation = tree.Allocation;
// Gtk.Requisition req = tree.SizeRequest ();
int x = 0, y = 0;
tree.GdkWindow.GetOrigin(out x, out y);
// popup.Move(x + allocation.X, y + allocation.Y + req.Height + 3);
popup.Move(x + allocation.X, y + allocation.Y);
popup.Show();
popup.GrabFocus();
Grab.Add(popup);
Gdk.GrabStatus grabbed = Gdk.Pointer.Grab(popup.GdkWindow, true,
Gdk.EventMask.ButtonPressMask
| Gdk.EventMask.ButtonReleaseMask
| Gdk.EventMask.PointerMotionMask, null, null, CURRENT_TIME);
if (grabbed == Gdk.GrabStatus.Success) {
grabbed = Gdk.Keyboard.Grab(popup.GdkWindow,
true, CURRENT_TIME);
if (grabbed != Gdk.GrabStatus.Success) {
Grab.Remove(popup);
popup.Destroy();
popup = null;
}
} else {
Grab.Remove(popup);
popup.Destroy();
popup = null;
}
cal.DaySelectedDoubleClick += OnCalendarDaySelected;
cal.ButtonPressEvent += OnCalendarButtonPressed;
cal.Date = date == DateTime.MinValue ? DateTime.Now : date;
}
示例6: Run
public void Run ()
{
var poof_file = DockServices.Paths.SystemDataFolder.GetChild ("poof.png");
if (!poof_file.Exists)
return;
poof = new Pixbuf (poof_file.Path);
window = new Gtk.Window (Gtk.WindowType.Toplevel);
window.AppPaintable = true;
window.Resizable = false;
window.KeepAbove = true;
window.CanFocus = false;
window.TypeHint = WindowTypeHint.Splashscreen;
window.SetCompositeColormap ();
window.Realized += delegate { window.GdkWindow.SetBackPixmap (null, false); };
window.SetSizeRequest (size, size);
window.ExposeEvent += HandleExposeEvent;
GLib.Timeout.Add (30, delegate {
if (AnimationState == 1) {
window.Hide ();
window.Destroy ();
poof.Dispose ();
return false;
} else {
window.QueueDraw ();
return true;
}
});
window.Move (x, y);
window.ShowAll ();
run_time = DateTime.UtcNow;
}
示例7: HTMLView
/// <summary>
/// Constructor
/// </summary>
public HTMLView(ViewBase owner)
: base(owner)
{
Glade.XML gxml = new Glade.XML("ApsimNG.Resources.Glade.HTMLView.glade", "vpaned1");
gxml.Autoconnect(this);
_mainWidget = vpaned1;
// Handle a temporary browser created when we want to export a map.
if (owner == null)
{
popupWin = new Gtk.Window(Gtk.WindowType.Popup);
popupWin.SetSizeRequest(500, 500);
// Move the window offscreen; the user doesn't need to see it.
// This works with IE, but not with WebKit
// Not yet tested on OSX
if (ProcessUtilities.CurrentOS.IsWindows)
popupWin.Move(-10000, -10000);
popupWin.Add(MainWidget);
popupWin.ShowAll();
while (Gtk.Application.EventsPending())
Gtk.Application.RunIteration();
}
memoView1 = new MemoView(this);
hbox1.PackStart(memoView1.MainWidget, true, true, 0);
vpaned1.PositionSet = true;
vpaned1.Position = 200;
hbox1.Visible = false;
hbox1.NoShowAll = true;
memoView1.ReadOnly = false;
memoView1.MemoChange += this.TextUpdate;
vpaned1.ShowAll();
frame1.ExposeEvent += OnWidgetExpose;
hbox1.Realized += Hbox1_Realized;
_mainWidget.Destroyed += _mainWidget_Destroyed;
}
示例8: Start
public void Start()
{
window = new Window(WindowType.Toplevel);
window.Move(10, 60);
window.Resize(230, 700);
window.Title = "Toolbar";
window.Deletable = false;
window.ModifyBg(StateType.Normal, new Gdk.Color(182, 195, 205));
Fixed fix = new Fixed();
openButton = new Button();
openButton.Label = "Open Images";
openButton.SetSizeRequest(100, 30);
openButton.TooltipText = "Shortcut: " + keymap["open images"].ToString();
openButton.Name = "open images";
openButton.Clicked += OperatorButtonClicked;
saveButton = new Button();
saveButton.Label = "Save Collage";
saveButton.SetSizeRequest(100, 30);
saveButton.TooltipText = "Shortcut: " + keymap["save collage"].ToString();
saveButton.Name = "save collage";
saveButton.Clicked += OperatorButtonClicked;
deleteButton = new Button();
deleteButton.Label = "Delete";
deleteButton.SetSizeRequest(100, 30);
deleteButton.TooltipText = "Shortcut: " + keymap["delete images"].ToString();
deleteButton.Name = "delete images";
deleteButton.Clicked += OperatorButtonClicked;
changeAspectRatioButton = new Button();
changeAspectRatioButton.Label = "Aspect Ratio";
changeAspectRatioButton.SetSizeRequest(100, 30);
changeAspectRatioButton.TooltipText = "Shortcut: " + keymap["change aspect ratio"].ToString();
changeAspectRatioButton.Name = "change aspect ratio";
changeAspectRatioButton.Clicked += OperatorButtonClicked;
autoPositionButton = new Button();
autoPositionButton.Label = "Auto Position";
autoPositionButton.SetSizeRequest(100, 30);
autoPositionButton.TooltipText = "Shortcut: " + keymap["auto position"].ToString();
autoPositionButton.Name = "auto position";
autoPositionButton.Clicked += OperatorButtonClicked;
changeBackgroundColorButton = new Button();
changeBackgroundColorButton.Label = "Background";
changeBackgroundColorButton.SetSizeRequest(100, 30);
changeBackgroundColorButton.TooltipText = "Shortcut: " + keymap["change background color"].ToString();
changeBackgroundColorButton.Name = "change background color";
changeBackgroundColorButton.Clicked += OperatorButtonClicked;
setBackwardButton = new Button();
setBackwardButton.Label = "Set Backward";
setBackwardButton.SetSizeRequest(100, 30);
setBackwardButton.TooltipText = "Shortcut: " + keymap["set backward"].ToString();
setBackwardButton.Name = "set backward";
setBackwardButton.Clicked += OperatorButtonClicked;
setForwardButton = new Button();
setForwardButton.Label = "Set Forward";
setForwardButton.SetSizeRequest(100, 30);
setForwardButton.TooltipText = "Shortcut: " + keymap["set forward"].ToString();
setForwardButton.Name = "set forward";
setForwardButton.Clicked += OperatorButtonClicked;
setAsBackgroundButton = new Button();
setAsBackgroundButton.Label = "Set Background";
setAsBackgroundButton.SetSizeRequest(100, 30);
setAsBackgroundButton.TooltipText = "Shortcut: " + keymap["set as background"].ToString();
setAsBackgroundButton.Name = "set as background";
setAsBackgroundButton.Clicked += OperatorButtonClicked;
setToFrontButton = new Button();
setToFrontButton.Label = "Set to Front";
setToFrontButton.SetSizeRequest(100, 30);
setToFrontButton.TooltipText = "Shortcut: " + keymap["set to front"].ToString();
setToFrontButton.Name = "set to front";
setToFrontButton.Clicked += OperatorButtonClicked;
clearButton = new Button();
clearButton.Label = "Clear Collage";
clearButton.SetSizeRequest(100, 30);
clearButton.TooltipText = "Shortcut: " + keymap["clear collage"].ToString();
clearButton.Name = "clear collage";
clearButton.Clicked += OperatorButtonClicked;
selectAllButton = new Button();
selectAllButton.Label = "Select All";
selectAllButton.SetSizeRequest(100, 30);
selectAllButton.TooltipText = "Shortcut: " + keymap["select all"].ToString();
selectAllButton.Name = "select all";
selectAllButton.Clicked += OperatorButtonClicked;
undoButton = new Button();
undoButton.Label = "Undo";
undoButton.SetSizeRequest(100, 30);
undoButton.TooltipText = "Shortcut: " + keymap["undo"].ToString();
undoButton.Name = "undo";
//.........这里部分代码省略.........
示例9: AddTopLevel
internal void AddTopLevel (DockFrameTopLevel w, int x, int y, int width, int height)
{
w.X = x;
w.Y = y;
if (UseWindowsForTopLevelFrames) {
var win = new Gtk.Window (Gtk.WindowType.Toplevel);
win.SkipTaskbarHint = true;
win.Decorated = false;
win.TypeHint = Gdk.WindowTypeHint.Toolbar;
w.ContainerWindow = win;
w.Size = new Size (width, height);
win.Add (w);
w.Show ();
var p = this.GetScreenCoordinates (new Gdk.Point (x, y));
win.Opacity = 0.0;
win.Move (p.X, p.Y);
win.Resize (width, height);
win.Show ();
Ide.DesktopService.AddChildWindow ((Gtk.Window)Toplevel, win);
win.AcceptFocus = true;
win.Opacity = 1.0;
/* When we use real windows for frames, it's possible for pads to be over other
* windows. For some reason simply presenting or raising those dialogs doesn't
* seem to work, so we hide/show them in order to force them above the pad. */
var toplevels = Gtk.Window.ListToplevels ().Where (t => t.IsRealized && t.Visible && t.TypeHint == WindowTypeHint.Dialog); // && t.TransientFor != null);
foreach (var t in toplevels) {
t.Hide ();
t.Show ();
}
MonoDevelop.Ide.IdeApp.CommandService.RegisterTopWindow (win);
} else {
w.Parent = this;
w.Size = new Size (width, height);
Requisition r = w.SizeRequest ();
w.Allocation = new Gdk.Rectangle (Allocation.X + x, Allocation.Y + y, r.Width, r.Height);
topLevels.Add (w);
}
}
示例10: AddTopLevel
internal void AddTopLevel (DockFrameTopLevel w, int x, int y, int width, int height)
{
w.X = x;
w.Y = y;
if (UseWindowsForTopLevelFrames) {
var win = new Gtk.Window (Gtk.WindowType.Toplevel);
win.AcceptFocus = false;
win.SkipTaskbarHint = true;
win.Decorated = false;
win.TypeHint = Gdk.WindowTypeHint.Toolbar;
w.ContainerWindow = win;
w.Size = new Size (width, height);
win.Add (w);
w.Show ();
var p = this.GetScreenCoordinates (new Gdk.Point (x, y));
win.Opacity = 0.0;
win.Move (p.X, p.Y);
win.Resize (width, height);
win.Show ();
Ide.DesktopService.AddChildWindow ((Gtk.Window)Toplevel, win);
win.AcceptFocus = true;
win.Opacity = 1.0;
} else {
w.Parent = this;
w.Size = new Size (width, height);
Requisition r = w.SizeRequest ();
w.Allocation = new Gdk.Rectangle (Allocation.X + x, Allocation.Y + y, r.Width, r.Height);
topLevels.Add (w);
}
}
示例11: GnomeArtNgApp
public GnomeArtNgApp(string[] args)
{
Application.Init();
//i18n
Catalog.Init("gnomeartng","./locale");
config=new CConfiguration();
//initialize Glade
string mainW = "MainWindow";
Glade.XML gxml = new Glade.XML (null, "gui.glade", mainW, null);
mainWindow = (Gtk.Window) gxml.GetWidget (mainW);
gxml.Autoconnect (this);
//Connect all events
mainWindow.DeleteEvent+=new DeleteEventHandler(OnWindowDeleteEvent);
ExtInfoPreviewButton.Clicked += new EventHandler(OnPreviewButtonClicked);
InstallButton.Clicked += new EventHandler(OnInstallButtonClicked);
RevertButton.Clicked += new EventHandler(OnRevertButtonClicked);
RefreshButton.Clicked += new EventHandler(OnRefreshButtonClicked);
SaveButton.Clicked += new EventHandler(OnSaveButtonClicked);
MainNotebook.SwitchPage += new SwitchPageHandler(OnSwitchPage);
FilterEntry.Changed += new EventHandler(OnFilterEntriesChanged);
// SortKindCb.Changed += new EventHandler(OnSortKindEntryChanged);
// SortDirectionCb.Changed += new EventHandler(OnSortDirectionEntryChanged);
// SortCloseButton.Clicked += new EventHandler(OnSortCloseClicked);
FilterEntry.KeyReleaseEvent += new KeyReleaseEventHandler(OnFilterbarKeyReleased);
FilterCloseButton.Clicked += new EventHandler(OnFilterbarCloseClicked);
//Menuitems
QuitMenuItem.Activated += new EventHandler(OnQuitItemSelected);
UpdateMenuItem.Activated += new EventHandler(OnUpdateItemSelected);
DonateMenuItem.Activated += new EventHandler(CUpdateWindow.onDonateButtonClicked);
FilterMenuItem.Activated += new EventHandler(OnFilterItemSelected);
// SortMenuItem.Activated += new EventHandler(OnSortItemSelected);
InfoMenuItem.Activated += new EventHandler(OnInfoItemSelected);
PreferencesMenuItem.Activated += new EventHandler(OnPreferencesItemSelected);
FTAItem.Activated += new EventHandler(onFtaItemSelected);
//First, download all thumbs...but don't bother the user with the update message, even if there is one
bool RestartApp= false;
if (config.NeverStartedBefore)
new CFirstTimeAssistant(config);
else if (config.DontBotherForUpdates==false) {
if (config.UpdateAvailable) {
Console.WriteLine("An update is available, newest version is: "+config.NewestVersionNumberOnServer);
RestartApp = ShowUpdateWindow();
}
}
if (!RestartApp) {
//Application placement - doesn't work properly with compiz (is it the window placement plugin?)
if (config.SettingsLoadOk) {
mainWindow.Resize(config.Window.Width, config.Window.Height);
mainWindow.Move(config.Window.X, config.Window.Y);
//Console.WriteLine(config.Window.X+" "+ config.Window.Y);
}
//ArtManager erzeugen
man = new CArtManager(config);
//Stores anlegen und IconViews anlegen
for(int i=0;i<ListStoreCount;i++){
sWins[i] = (Gtk.ScrolledWindow)(gxml.GetWidget("swin"+i));
stores[i]= new ListStore (typeof(Pixbuf),typeof (string), typeof (string), typeof(int));
IconViews[i] = new Gtk.IconView(stores[i]);
IconViews[i].SelectionChanged += new System.EventHandler(OnSelChanged);
IconViews[i].ItemActivated += new ItemActivatedHandler(OnItemActivated);
IconViews[i].PixbufColumn = 0;
CurrentIconView = IconViews[0];
sWins[i].Add(IconViews[i]);
IconViews[i].Show();
}
//Create the comboboxes
imageTypeBox = ComboBox.NewText();
imageResolutionsBox = ComboBox.NewText();
imageStyleBox = ComboBox.NewText();
//Verschiedene Styles hinzufügen
imageStyleBox.AppendText(Catalog.GetString("Centered"));
imageStyleBox.AppendText(Catalog.GetString("Filled"));
imageStyleBox.AppendText(Catalog.GetString("Scaled"));
imageStyleBox.AppendText(Catalog.GetString("Zoomed"));
imageStyleBox.AppendText(Catalog.GetString("Tiled"));
imageStyleBox.Active=0;
imageStyleBox.Changed += new EventHandler(OnImageStyleBoxChanged);
LowerTable.Attach(imageTypeBox,1,2,2,3);
LowerTable.Attach(imageResolutionsBox,1,2,3,4);
LowerTable.Attach(imageStyleBox,1,2,4,5);
OnSwitchPage(MainNotebook,new SwitchPageArgs());
Gtk.Application.Run ();
}
}
示例12: MainWindow
//.........这里部分代码省略.........
if (Common.OSName == "Darwin") {
MenuBar menubar = (MenuBar) Runtime.UIManager.GetWidget ("/OSXAppMenu");
Imendio.MacIntegration.Menu.SetMenuBar(menubar);
MenuItem preferencesItem = (MenuItem) Runtime.UIManager.GetWidget ("/OSXAppMenu/NetworkMenu/Preferences");
MenuItem aboutItem = (MenuItem) Runtime.UIManager.GetWidget ("/OSXAppMenu/NetworkMenu/About");
IntPtr group = Imendio.MacIntegration.Menu.AddAppMenuGroup();
Imendio.MacIntegration.Menu.AddAppMenuItem(group, aboutItem, "About Meshwork");
group = Imendio.MacIntegration.Menu.AddAppMenuGroup();
Imendio.MacIntegration.Menu.AddAppMenuItem(group, preferencesItem, "Preferences");
MenuItem quitItem = (MenuItem) Runtime.UIManager.GetWidget ("/OSXAppMenu/NetworkMenu/Quit");
Imendio.MacIntegration.Menu.SetQuitMenuItem(quitItem);
} else {
MenuBar menubar = (MenuBar) Runtime.UIManager.GetWidget ("/MainWindowMenuBar");
mainVBox.PackStart (menubar, false, false, 0);
menubar.Show ();
}
toolbar = (Toolbar) Runtime.UIManager.GetWidget ("/MainWindowToolbar");
toolbar.ToolbarStyle = ToolbarStyle.BothHoriz;
toolbar.IconSize = IconSize.LargeToolbar;
spacerItem = new ToolItem();
spacerItem.Expand = true;
toolbar.Insert(spacerItem, -1);
spacerItem.Show();
searchEntry = new FileSearchEntry();
searchEntryBox = new Alignment(0.5f, 0.5f, 0, 0);
searchEntryBox.LeftPadding = 4;
searchEntryBox.RightPadding = 1;
searchEntryBox.Add(searchEntry);
searchEntryItem = new ToolItem();
searchEntryItem.Add(searchEntryBox);
toolbar.Insert(searchEntryItem, -1);
searchEntryItem.ShowAll();
mainVBox.PackStart (toolbar, false, false, 0);
mainPaned = new HPaned();
mainPaned.Mapped += delegate (object sender, EventArgs args) {
// XXX: Remember the user's last setting instead
mainPaned.Position = 190;
// Set some colors
//infoBoxSeparator.ModifyBg(StateType.Normal, GtkHelper.DarkenColor (mainbar.Style.Background(StateType.Normal), 2));
//infoSwitcherTree.ModifyBase(StateType.Normal, infoSwitcherTree.Style.Base(StateType.Active));
//infoSwitcherTree.ModifyBase(StateType.Active, infoBoxSeparator.Style.Base(StateType.Selected));
};
mainPaned.Show();
mainVBox.PackStart (mainPaned, true, true, 0);
// Create page notebook
pageNotebook = new Notebook();
pageNotebook.ShowTabs = false;
pageNotebook.ShowBorder = false;
mainPaned.Pack2(pageNotebook, true, true);
pageNotebook.ShowAll();
// Create sidebar
sidebar = new MainSidebar();
sidebar.ItemAdded += sidebar_ItemAdded;
sidebar.SelectedItemChanged += sidebar_SelectedItemChanged;
sidebar.AddBuiltinItems();
mainPaned.Pack1(sidebar, false, false);
sidebar.ShowAll();
CreateStatusbar ();
// Apply "view" settings
toolbar.Visible = Gui.Settings.ShowToolbar;
statusBar.Visible = Gui.Settings.ShowStatusBar;
// Hook up Core events
Core.ShareBuilder.StartedIndexing += (EventHandler)DispatchService.GuiDispatch(new EventHandler(sb_StartedIndexing));
Core.ShareBuilder.FinishedIndexing += (EventHandler)DispatchService.GuiDispatch(new EventHandler(sb_FinishedIndexing));
Core.ShareBuilder.StoppedIndexing += (EventHandler)DispatchService.GuiDispatch(new EventHandler(sb_StoppedIndexing));
Core.ShareBuilder.ErrorIndexing += (ErrorEventHandler)DispatchService.GuiDispatch(new ErrorEventHandler(sb_ErrorIndexing));
Core.ShareHasher.StartedHashingFile += (ShareHasherTaskEventHandler)DispatchService.GuiDispatch(new ShareHasherTaskEventHandler(sh_StartedFinished));
Core.ShareHasher.FinishedHashingFile += (ShareHasherTaskEventHandler)DispatchService.GuiDispatch(new ShareHasherTaskEventHandler(sh_StartedFinished));
Core.ShareHasher.QueueChanged += (EventHandler)DispatchService.GuiDispatch(new EventHandler(sh_QueueChanged));
Core.FileSearchManager.SearchAdded += (FileSearchEventHandler)DispatchService.GuiDispatch(new FileSearchEventHandler(FileSearchManager_SearchAdded));
Core.FileSearchManager.SearchRemoved += (FileSearchEventHandler)DispatchService.GuiDispatch(new FileSearchEventHandler(FileSearchManager_SearchRemoved));
window.Resize (Gui.Settings.WindowSize.Width, Gui.Settings.WindowSize.Height);
window.Move (Gui.Settings.WindowPosition.X, Gui.Settings.WindowPosition.Y);
SelectedPage = NetworkOverviewPage.Instance;
}
示例13: ShowPopup
private void ShowPopup()
{
win = new Gtk.Window(Gtk.WindowType.Popup);
win.Screen = this.Screen;
win.WidthRequest = this.Allocation.Width;
cal = new Gtk.Calendar();
win.Add(cal);
if (validDate)
cal.Date = date;
// events
win.ButtonPressEvent += OnWinButtonPressEvent;
cal.DaySelectedDoubleClick += OnCalDaySelectedDoubleClick;
cal.KeyPressEvent += OnCalKeyPressEvent;
cal.ButtonPressEvent += OnCalButtonPressEvent;
int x, y;
GetWidgetPos(this, out x, out y);
win.Move(x, y + Allocation.Height + 2);
win.ShowAll();
win.GrabFocus();
Grab.Add(win);
Gdk.GrabStatus grabStatus;
grabStatus = Gdk.Pointer.Grab(win.GdkWindow, true, EventMask.ButtonPressMask | EventMask.ButtonReleaseMask | EventMask.PointerMotionMask, null, null, Gtk.Global.CurrentEventTime);
if (grabStatus == Gdk.GrabStatus.Success) {
grabStatus = Gdk.Keyboard.Grab(win.GdkWindow, true, Gtk.Global.CurrentEventTime);
if (grabStatus != Gdk.GrabStatus.Success) {
Grab.Remove(win);
win.Destroy();
win = null;
}
} else {
Grab.Remove(win);
win.Destroy();
win = null;
}
}
示例14: CenterWindow
/// <summary>Centers a window relative to its parent.</summary>
static void CenterWindow (Window child, Window parent)
{
if (child == null || parent == null)
return;
child.Child.Show ();
int w, h, winw, winh, x, y, winx, winy;
child.GetSize (out w, out h);
parent.GetSize (out winw, out winh);
parent.GetPosition (out winx, out winy);
x = System.Math.Max (0, (winw - w) /2) + winx;
y = System.Math.Max (0, (winh - h) /2) + winy;
child.Move (x, y);
}
示例15: LoadXap
static int LoadXap (string file, List<string> args)
{
string [] test = { "" };
if (sync)
test [0] = "--sync";
Application.Init ("mopen", ref test);
MoonlightRuntime.Init ();
window = new Gtk.Window (file);
window.SetDefaultSize (400, 400);
if (transparent) {
CompositeHelper.SetRgbaColormap (window);
window.AppPaintable = true;
window.ExposeEvent += HandleExposeEvent;
}
if (desklet) {
ConfigureDeskletWindow (window);
}
window.DeleteEvent += delegate {
Application.Quit ();
};
moon_host = new MoonlightHost ();
try {
moon_host.LoadXap (file);
} catch (Exception e) {
Console.Error.WriteLine ("mopen: Could not load xaml: {0}", e.Message);
return 1;
}
System.Windows.Application app = moon_host.Application;
FrameworkElement top = (FrameworkElement)app.RootVisual;
if (top is Moon.Windows.Desktop.Window) {
var moonwindow = ((Moon.Windows.Desktop.Window)top);
/* special window handling mode */
moonwindow.IsActive = window.IsActive;
Wnck.Screen.Default.ActiveWindowChanged += delegate {
moonwindow.IsActive = window.IsActive;
};
moonwindow.PositionChanged += delegate {
window.Move ((int)moonwindow.Position.X, (int)moonwindow.Position.Y);
};
moonwindow.SizeChanged += delegate {
window.Resize ((int)moonwindow.Size.Width, (int)moonwindow.Size.Height);
};
moonwindow.WindowOpacityChanged += delegate {
moon_host.QueueDraw ();
};
if (!transparent) {
CompositeHelper.SetRgbaColormap (window);
window.AppPaintable = true;
window.ExposeEvent += HandleExposeEvent;
moon_host.AppPaintable = true;
moon_host.Transparent = true;
}
}
if (parse_only)
return 0;
if (width == -1)
width = (int) top.Width;
if (height == -1)
height = (int) top.Height;
if (width > 0 && height > 0) {
moon_host.SetSizeRequest (width, height);
window.Resize (width, height);
}
if (transparent){
moon_host.AppPaintable = true;
moon_host.Transparent = true;
}
if (desklet) {
top.MouseLeftButtonDown += new MouseButtonEventHandler (HandleMouseLeftButtonDown);
top.MouseLeftButtonUp += new MouseButtonEventHandler (HandleMouseLeftButtonUp);
top.MouseMove += new MouseEventHandler (HandleMouseMove);
}
window.Add (moon_host);
window.ShowAll ();
if (story_names != null){
storyboards = new List<Storyboard> ();
//.........这里部分代码省略.........