本文整理汇总了C#中Gtk.Add方法的典型用法代码示例。如果您正苦于以下问题:C# Gtk.Add方法的具体用法?C# Gtk.Add怎么用?C# Gtk.Add使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Gtk
的用法示例。
在下文中一共展示了Gtk.Add方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: Replace
public void Replace (Gtk.Bin parent)
{
Gtk.Widget c = parent.Child;
parent.Remove (c);
Add (c);
parent.Add (this);
}
示例2: AddImageMenuButton
public static ImageMenuItem AddImageMenuButton(string title, string imgName, Gtk.Menu parent,EventHandler OnMenuClicked)
{
var sep = System.IO.Path.DirectorySeparatorChar;
var menuItem = new ImageMenuItem(title);
if (imgName != null)
{
var picFileName = SupportMethods.AppPath + sep + "Icons" + sep + imgName;
if (System.IO.File.Exists(picFileName))
{
menuItem.Image = new Gtk.Image(picFileName);
}
}
if (OnMenuClicked != null)
{
menuItem.Activated+= OnMenuClicked;
}
if (parent != null)
{
parent.Add(menuItem);
}
return menuItem;
}
示例3: ConnectTextTagTable
protected void ConnectTextTagTable (Gtk.TextTagTable table, Monotalk.SourceView.Style [] styles)
{
foreach (Monotalk.SourceView.Style s in styles)
{
Gtk.TextTag tag = new TextTag(s.path);
tag.Foreground = s.color;
table.Add ( tag );
}
}
示例4: Show
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;
}
示例5: AuthoringPaneView
public AuthoringPaneView(Gtk.VBox parent, Project project)
{
Project = project;
active_item = -1;
DragDataReceived += new DragDataReceivedHandler (HandleTargetDragDataReceived);
EventBox eb = new EventBox (); // Provides a window for this windowless widget
parent.Add (eb);
eb.Add (this);
Gtk.Drag.DestSet (this, DestDefaults.All, tag_dest_target_table,
DragAction.Copy | DragAction.Move);
eb.ButtonPressEvent += HandleButtonPress;
eb.ButtonReleaseEvent += HandleButtonRelease;
eb.MotionNotifyEvent += HandleMotionNotify;
UpdateTheme ();
}
示例6: PopulateFixes
public void PopulateFixes (Gtk.Menu menu, ref int items)
{
int mnemonic = 1;
bool gotImportantFix = false, addedSeparator = false;
var fixesAdded = new List<string> ();
foreach (var fix_ in fixes.OrderByDescending (i => Tuple.Create (IsAnalysisOrErrorFix(i), (int)i.Severity, GetUsage (i.IdString)))) {
// filter out code actions that are already resolutions of a code issue
if (fixesAdded.Any (f => fix_.IdString.IndexOf (f, StringComparison.Ordinal) >= 0))
continue;
fixesAdded.Add (fix_.IdString);
if (IsAnalysisOrErrorFix (fix_))
gotImportantFix = true;
if (!addedSeparator && gotImportantFix && !IsAnalysisOrErrorFix(fix_)) {
menu.Add (new Gtk.SeparatorMenuItem ());
addedSeparator = true;
}
var fix = fix_;
var escapedLabel = fix.Title.Replace ("_", "__");
var label = (mnemonic <= 10)
? "_" + (mnemonic++ % 10).ToString () + " " + escapedLabel
: " " + escapedLabel;
var thisInstanceMenuItem = new Gtk.MenuItem (label);
thisInstanceMenuItem.Activated += new ContextActionRunner (fix, document, loc).Run;
thisInstanceMenuItem.Activated += delegate {
ConfirmUsage (fix.IdString);
menu.Destroy ();
};
menu.Add (thisInstanceMenuItem);
items++;
}
bool first = true;
var alreadyInserted = new HashSet<BaseCodeIssueProvider> ();
foreach (var analysisFix_ in fixes.OfType <AnalysisContextActionProvider.AnalysisCodeAction>().Where (f => f.Result is InspectorResults)) {
var analysisFix = analysisFix_;
var ir = analysisFix.Result as InspectorResults;
if (ir == null)
continue;
if (first) {
menu.Add (new Gtk.SeparatorMenuItem ());
first = false;
}
if (alreadyInserted.Contains (ir.Inspector))
continue;
alreadyInserted.Add (ir.Inspector);
var subMenu = new Gtk.Menu ();
if (analysisFix.SupportsBatchRunning) {
var batchRunMenuItem = new Gtk.MenuItem (GettextCatalog.GetString ("Fix all in this file"));
batchRunMenuItem.Activated += delegate {
ConfirmUsage (analysisFix.IdString);
menu.Destroy ();
};
batchRunMenuItem.Activated += new ContextActionRunner (analysisFix, document, loc).BatchRun;
subMenu.Add (batchRunMenuItem);
subMenu.Add (new Gtk.SeparatorMenuItem ());
}
var inspector = ir.Inspector;
if (inspector.CanSuppressWithAttribute) {
var menuItem = new Gtk.MenuItem (GettextCatalog.GetString ("_Suppress with attribute"));
menuItem.Activated += delegate {
inspector.SuppressWithAttribute (document, analysisFix.DocumentRegion);
};
subMenu.Add (menuItem);
}
if (inspector.CanDisableWithPragma) {
var menuItem = new Gtk.MenuItem (GettextCatalog.GetString ("_Suppress with #pragma"));
menuItem.Activated += delegate {
inspector.DisableWithPragma (document, analysisFix.DocumentRegion);
};
subMenu.Add (menuItem);
}
if (inspector.CanDisableOnce) {
var menuItem = new Gtk.MenuItem (GettextCatalog.GetString ("_Disable once with comment"));
menuItem.Activated += delegate {
inspector.DisableOnce (document, analysisFix.DocumentRegion);
};
subMenu.Add (menuItem);
}
if (inspector.CanDisableAndRestore) {
var menuItem = new Gtk.MenuItem (GettextCatalog.GetString ("Disable _and restore with comments"));
menuItem.Activated += delegate {
inspector.DisableAndRestore (document, analysisFix.DocumentRegion);
};
subMenu.Add (menuItem);
}
var label = GettextCatalog.GetString ("_Options for \"{0}\"", InspectorResults.GetTitle (ir.Inspector));
var subMenuItem = new Gtk.MenuItem (label);
var optionsMenuItem = new Gtk.MenuItem (GettextCatalog.GetString ("_Configure inspection"));
optionsMenuItem.Activated += analysisFix.ShowOptions;
optionsMenuItem.Activated += delegate {
menu.Destroy ();
};
//.........这里部分代码省略.........
示例7: AddSortContextMenuButton
private void AddSortContextMenuButton(Gtk.Menu menu, SongList.SortColumnEnum sortColumn, string title)
{
Gtk.MenuItem item = new MenuItem(title);
item.ButtonPressEvent +=new ButtonPressEventHandler(contextMenu_ButtonPressEvent);
item.Data["key"] = "sort";
item.Data["sort"] = sortColumn;
menu.Add(item);
}
示例8: AddSortContextMenu
private void AddSortContextMenu(Gtk.Menu menu)
{
Gtk.MenuItem sortItem = new MenuItem(Lng.Translate("Sort"));
menu.Add(sortItem);
// sort menu
Gtk.Menu sortMenu = new Menu();
AddSortContextMenuButton(sortMenu,SongList.SortColumnEnum.FileName,Lng.Translate("FileName"));
AddSortContextMenuButton(sortMenu,SongList.SortColumnEnum.Title,Lng.Translate("Title"));
AddSortContextMenuButton(sortMenu,SongList.SortColumnEnum.Artist,Lng.Translate("Artist"));
AddSortContextMenuButton(sortMenu,SongList.SortColumnEnum.Album,Lng.Translate("Album"));
AddSortContextMenuButton(sortMenu,SongList.SortColumnEnum.Year,Lng.Translate("Year"));
AddSortContextMenuButton(sortMenu,SongList.SortColumnEnum.Genre,Lng.Translate("Genre"));
AddSortContextMenuButton(sortMenu,SongList.SortColumnEnum.Album,Lng.Translate("Comment"));
AddSortContextMenuButton(sortMenu,SongList.SortColumnEnum.Track,Lng.Translate("TrackNumber"));
AddSortContextMenuButton(sortMenu,SongList.SortColumnEnum.Changed,Lng.Translate("Changed"));
sortItem.Submenu = sortMenu;
}
示例9: AddRunContextMenu
private void AddRunContextMenu(Gtk.Menu menu)
{
Gtk.MenuItem runItem = new MenuItem(Lng.Translate("Run"));
menu.Add(runItem);
// submenu
Gtk.Menu runMenu = new Menu();
foreach (var runApp in Configuration.RunApplications)
{
var item = AddContextMenuButton(runMenu,"run",runApp);
item.Data["runApp"] = runApp;
}
runItem.Submenu = runMenu;
}
示例10: AddContextMenuButton
private Gtk.MenuItem AddContextMenuButton(Gtk.Menu menu, string actionKey, string title)
{
Gtk.MenuItem item = new MenuItem(title);
item.ButtonPressEvent +=new ButtonPressEventHandler(contextMenu_ButtonPressEvent);
item.Data["key"] = actionKey;
menu.Add(item);
return item;
}
示例11: Add
public static void Add (Gtk.Container aContainer, Widget aWidget)
{
if (aWidget == null)
return;
if (aContainer == null)
throw new Exception ("Adding widget to null container");
aContainer.Add (aWidget);
}
示例12: RunInstall
void RunInstall (Gtk.Alignment commandBox, Update update)
{
installing = true;
ProgressBarMonitor monitorBar = new ProgressBarMonitor ();
monitorBar.ShowErrorsDialog = true;
monitorBar.Show ();
commandBox.Child.Destroy ();
commandBox.Add (monitorBar);
IAsyncOperation oper = update.InstallAction (monitorBar.CreateProgressMonitor ());
oper.Completed += delegate {
DispatchService.GuiDispatch (delegate {
monitorBar.Hide ();
Gtk.Label result = new Gtk.Label ();
if (oper.Success)
result.Text = GettextCatalog.GetString ("Completed");
else
result.Text = GettextCatalog.GetString ("Failed");
commandBox.Child.Destroy ();
commandBox.Add (result);
result.Show ();
installing = false;
if (installQueue.Count > 0)
installQueue.Dequeue ()();
});
};
}
示例13: InitIE
public void InitIE(Gtk.Box w)
{
wb = new System.Windows.Forms.WebBrowser();
w.SetSizeRequest(500, 500);
wb.Height = 500; // w.GdkWindow.FrameExtents.Height;
wb.Width = 500; // w.GdkWindow.FrameExtents.Width;
wb.Navigate("about:blank");
wb.Document.Write(String.Empty);
socket = new Gtk.Socket();
socket.SetSizeRequest(wb.Width, wb.Height);
w.Add(socket);
socket.Realize();
socket.Show();
socket.UnmapEvent += Socket_UnmapEvent;
IntPtr browser_handle = wb.Handle;
IntPtr window_handle = (IntPtr)socket.Id;
SetParent(browser_handle, window_handle);
/// Another interesting issue is that on Windows, the WebBrowser control by default is
/// effectively an IE7 browser, and I don't think you can easily change that without
/// changing registry settings. The lack of JSON parsing in IE7 triggers errors in google maps.
/// See https://code.google.com/p/gmaps-api-issues/issues/detail?id=9004 for the details.
/// Including the meta tag of <meta http-equiv="X-UA-Compatible" content="IE=edge"/>
/// fixes the problem, but we can't do that in the HTML that we set as InnerHtml in the
/// LoadHTML function, as the meta tag triggers a restart of the browser, so it
/// just reloads "about:blank", without the new innerHTML, and we get a blank browser.
/// Hence we set the browser type here.
/// Another way to get around this problem is to add JSON.Parse support available from
/// https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/JSON
/// into the HTML Script added when loading Google Maps
/// I am taking the belts-and-braces approach of doing both, primarily because the
/// meta tag, while probably the technically better" solution, sometimes doesn't work.
wb.DocumentText = @"<!DOCTYPE html>
<html>
<head>
<meta http-equiv=""X-UA-Compatible"" content=""IE=edge,10""/>
</head>
</html>";
}
示例14: GetOutputMenu
private void GetOutputMenu(ref Gtk.Menu outputMenu)
{
MenuItem miC = new MenuItem(MainClass.Languages.Translate("clear"));
miC.Activated+= delegate {
OutputConsole.Clear();
};
outputMenu.Add(miC);
MenuItem miS = new MenuItem(MainClass.Languages.Translate("save"));
miS.Activated+= delegate {
OutputConsole.Save();
};
outputMenu.Add(miS);
}
示例15: InsertMode
private void InsertMode(char item, ref Gtk.Layout vbox, ref int height)
{
string de = "unknown mode. Refer to ircd manual (/raw help)";
cm.Add(item);
if (channel._Network.Descriptions.ContainsKey(item))
{
de = channel._Network.Descriptions[item];
}
CheckButton xx = new CheckButton(item.ToString() + " : " + de);
xx.Active = channel.ChannelMode._Mode.Contains(item.ToString());
xx.Name = item.ToString();
options.Add(xx);
vbox.Add(xx);
global::Gtk.Layout.LayoutChild w1 = ((global::Gtk.Layout.LayoutChild)(vbox[xx]));
w1.X = 0;
w1.Y = height;
height += 20;
}