本文整理汇总了C#中Gtk.MenuItem.ShowAll方法的典型用法代码示例。如果您正苦于以下问题:C# MenuItem.ShowAll方法的具体用法?C# MenuItem.ShowAll怎么用?C# MenuItem.ShowAll使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Gtk.MenuItem
的用法示例。
在下文中一共展示了MenuItem.ShowAll方法的7个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: AppendToMenu
public void AppendToMenu (Gtk.Menu menu)
{
if (list == null || list.Count == 0)
return;
Gtk.MenuItem open_with = new Gtk.MenuItem (Mono.Unix.Catalog.GetString ("Open With"));
open_with.Submenu = this;
open_with.ShowAll ();
menu.Append (open_with);
}
示例2: MenuItem
/*public GenerationMenuWidget(PathContainer referer)
{
MenuItem path = new MenuItem("Generate path " + referer.Path + " ...");
path.Activated += delegate {
GenerationDialog d = new GenerationDialog();
d.Modal = true;
if (d.Run() == (int)ResponseType.Ok) {
IGenerator generator = new CSharpCodeDomGenerator();
generator.Generate(referer, d.PathToSave);
}
d.Destroy();
};
this.Append(path);
path.ShowAll();
}*/
public GenerationMenuWidget(Window parent, Interface referer)
{
MenuItem path = new MenuItem("Generate " + referer.Name + "...");
IGenerator generator = new CSharpCodeDomGenerator();
Func<IEnumerable<IElement>, string> renderer = (elements) => {
try {
return generator.Generate(elements);
} catch (Exception e) {
Logging.Error ("Error during generation", e, parent);
return string.Empty;
}
};
path.Activated += delegate {
GenerationDialog d = new GenerationDialog (parent, referer, renderer);
d.Modal = true;
d.Run ();
d.Destroy();
};
this.Append(path);
path.ShowAll();
}
示例3: 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();
}
}
示例4: InfoManager
//
// Constructor
//
public InfoManager (MainWindow main)
{
this.main = main;
string corlibdir = System.IO.Path.GetDirectoryName (typeof (int).Assembly.Location);
monodir = System.IO.Path.GetFullPath (System.IO.Path.Combine (corlibdir, ".."));
moondir = System.IO.Path.Combine (monodir, @"../moonlight/plugin");
// Work around limitation in Stetic, there is no way
// of getting a handle on the menu (!!!)
// Populate File/Recent Comparisons, this would be so much
// easier if Stetic had any support for this.
recentmenu = new Menu ();
MenuItem filemenuitem = (main.MenuBar.Children [0]) as MenuItem;
Menu filesub = (Menu) filemenuitem.Submenu;
MenuItem recentmenuitem = new MenuItem ("Recent Comparisons");
recentmenuitem.Submenu = recentmenu;
recentmenuitem.ShowAll ();
filesub.Insert (recentmenuitem, 0);
MenuItem sep = new MenuItem ();
sep.ShowAll ();
filesub.Insert (sep, 1);
PopulateRecent ();
// Populate the list of profile comparisons
Menu sub = null;
foreach (MenuItem mi in main.MenuBar.AllChildren){
AccelLabel a = mi.Child as AccelLabel;
if (a == null || a.LabelProp != "_Compare")
continue;
if (a.LabelProp == "Recent Comparisons"){
}
sub = (Menu) mi.Submenu;
break;
}
if (sub == null){
Console.WriteLine ("Unable to found Compare submenu");
return;
}
MenuItem separator = new SeparatorMenuItem ();
separator.ShowAll ();
sub.Add (separator);
Populate (sub, "API 1.1", GetVersionPath ("1.0", "net_1_1"), "1.0", api_1_1);
Populate (sub, "API 2.0 sp2", GetVersionPath ("2.0", "net_2_0"), "2.0", api_2_0);
Populate (sub, "API 3.0 sp1", GetVersionPath ("2.0", "net_2_0"), "3.0", api_3_0);
Populate (sub, "API 3.5 sp1", GetVersionPath ("2.0", "net_2_0"), "3.5", api_3_5);
Populate (sub, "API 4.0", GetVersionPath ("4.0", "net_4_0"), "4.0", api_4_0);
Populate (sub, "API 4.5", GetVersionPath ("4.5", "net_4_5"), "4.5", api_4_5);
// Populate (sub, "Silverlight 2.0", GetVersionPath ("2.1", "net_2_1"), "SL2", api_sl2);
// Populate (sub, "Silverlight 3.0", GetVersionPath ("2.1", "net_2_1"), "SL3", api_sl2);
Populate (sub, "Silverlight 4.0", GetVersionPath ("2.1", "net_2_1"), "SL4", api_sl4);
}
示例5: Populate
void Populate (Menu container, string caption, string pdir, string collection, string [] elements)
{
string profiledir = System.IO.Path.Combine (monodir, pdir);
string MONO_GAC_PREFIX = Environment.GetEnvironmentVariable ("MONO_GAC_PREFIX");
string[] gac_prefixes = null;
if (!string.IsNullOrEmpty (MONO_GAC_PREFIX))
gac_prefixes = MONO_GAC_PREFIX.Split (':');
MenuItem item = new MenuItem (caption);
Menu sub = new Menu ();
item.Submenu = sub;
MenuItem child = null;
foreach (string e in elements){
if (e == String.Empty){
// Avoid inserting separators twice
if (child is SeparatorMenuItem || sub.Children.Length == 0)
continue;
child = new SeparatorMenuItem ();
} else {
string assemblyfile = null;
bool found = false;
if (gac_prefixes == null) {
assemblyfile = System.IO.Path.Combine (profiledir, e + ".dll");
found = System.IO.File.Exists (assemblyfile);
}
else {
foreach (string prefix in gac_prefixes) {
assemblyfile = System.IO.Path.Combine (
System.IO.Path.Combine (
System.IO.Path.Combine (
System.IO.Path.Combine (prefix, "lib"),
"mono"),
pdir),
e + ".dll");
found = System.IO.File.Exists (assemblyfile);
if (found)
break;
}
}
if (!found) {
assemblyfile = System.IO.Path.Combine (moondir, e + ".dll");
found = System.IO.File.Exists (assemblyfile);
}
if (!found) {
Console.WriteLine ("Skipping {0} for profile {1}, could not locate it in profile dir or MONO_GAC_PREFIX", e, pdir);
continue;
}
string element = e;
child = new MenuItem (e);
child.Activated += delegate {
StartPresetCompare (assemblyfile, collection, element, caption);
};
}
sub.Add (child);
}
if (sub.Children.Length > 0) {
item.ShowAll ();
container.Add (item);
}
}
示例6: CreateEntriesFromFactory
private static void CreateEntriesFromFactory (MenuItem menu, TreeStore store, EventHandler handler, TypeFactory factory, IList menuEntries)
{
GLib.SList group = new GLib.SList (IntPtr.Zero);
Menu submenu = new Menu ();
foreach (DictionaryEntry de in factory) {
TypeFactoryEntry entry = (TypeFactoryEntry) de.Value;
if (store != null)
store.AppendValues (false, entry.Description, entry.Key);
RadioMenuItem item = new RadioMenuItem (group, entry.Description);
item.Activated += handler;
group = item.Group;
submenu.Append (item);
menuEntries.Add (new RadioMenuItemInfo (item, entry.Key));
}
menu.Submenu = submenu;
menu.ShowAll ();
}
示例7: OnTomboyTrayMenuShown
private void OnTomboyTrayMenuShown (object sender, EventArgs args)
{
// Add in the top tasks
// TODO: Read the number of todo items to show from Preferences
int max_size = 5;
int list_size = 0;
Gtk.MenuItem item;
// Filter the tasks to the ones that are incomplete
Gtk.TreeModelFilter store_filter =
new Gtk.TreeModelFilter (TasksApplicationAddin.DefaultTaskManager.Tasks, null);
store_filter.VisibleFunc = FilterTasks;
// TODO: Sort the tasks to order by due date and priority
// store_sort = new Gtk.TreeModelSort (store_filter);
// store_sort.DefaultSortFunc =
// new Gtk.TreeIterCompareFunc (TaskSortFunc);
// tree.Model = store_sort;
// int cnt = tree.Model.IterNChildren ();
// task_count.Text = string.Format (
// Catalog.GetPluralString("Total: {0} task",
// "Total: {0} tasks",
// cnt),
// cnt);
// List the top "max_size" tasks
Gtk.TreeIter iter;
Gtk.SeparatorMenuItem separator;
// Determine whether the icon is near the top/bottom of the screen
int position;
if (!Tomboy.Tray.MenuOpensUpward ())
position = 2;
else
position = tomboy_tray_menu.Children.Length - 7;
separator = new Gtk.SeparatorMenuItem ();
tomboy_tray_menu.Insert (separator, position++);
separator.Show ();
top_tasks.Add (separator);
item = new Gtk.MenuItem (Catalog.GetString ("To Do List"));
tomboy_tray_menu.Insert (item, position++);
item.ShowAll ();
top_tasks.Add (item);
item.Activated += OnOpenTodoList;
if (store_filter.GetIterFirst (out iter)) {
do {
Task task = store_filter.GetValue (iter, 0) as Task;
item = new TomboyTaskMenuItem (task);
tomboy_tray_menu.Insert (item, list_size + position);
item.ShowAll ();
top_tasks.Add (item);
list_size++;
} while (store_filter.IterNext (ref iter) && list_size < max_size);
}
}