本文整理汇总了C#中Gtk.ImageMenuItem.Show方法的典型用法代码示例。如果您正苦于以下问题:C# ImageMenuItem.Show方法的具体用法?C# ImageMenuItem.Show怎么用?C# ImageMenuItem.Show使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Gtk.ImageMenuItem
的用法示例。
在下文中一共展示了ImageMenuItem.Show方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: OnNoteOpened
public override void OnNoteOpened()
{
item = new Gtk.ImageMenuItem (Catalog.GetString("Email"));
item.Activated += OnImageMenuItemActivated;
item.AddAccelerator ("activate", Window.AccelGroup,
(uint) Gdk.Key.e, Gdk.ModifierType.ControlMask,
Gtk.AccelFlags.Visible);
item.Show ();
AddPluginMenuItem (item);
}
示例2: AppendMenuItem
public static void AppendMenuItem(Gtk.Menu menu, string label,
string image_name, EventHandler e,
bool enabled)
{
Gtk.ImageMenuItem i = new Gtk.ImageMenuItem (label);
i.Activated += e;
i.Sensitive = enabled;
i.Image = new Gtk.Image (image_name, Gtk.IconSize.Menu);
menu.Append (i);
i.Show ();
}
示例3: OnNoteOpened
public override void OnNoteOpened ()
{
// Adding menu item when note is opened and window created
item = new Gtk.ImageMenuItem (Catalog.GetString ("Remove broken links"));
item.Image = new Gtk.Image (Gtk.Stock.Clear, Gtk.IconSize.Menu);
item.AddAccelerator ("activate", Window.AccelGroup,
(uint) Gdk.Key.r, Gdk.ModifierType.ControlMask,
Gtk.AccelFlags.Visible);
item.Activated += OnMenuItemActivated;
item.Show ();
AddPluginMenuItem (item);
}
示例4: SearchEntry
public SearchEntry ()
{
BuildSearchEntry ();
InterfaceActionService uia = ServiceManager.Get<InterfaceActionService> ();
if (uia != null) {
Gtk.Action action = uia.GlobalActions["WikiSearchHelpAction"];
if (action != null) {
MenuItem item = new SeparatorMenuItem ();
item.Show ();
Menu.Append (item);
item = new ImageMenuItem (Stock.Help, null);
item.Activated += delegate { action.Activate (); };
item.Show ();
Menu.Append (item);
}
}
SearchSensitive = true;
Show ();
}
示例5: ColorToolButton
public ColorToolButton(Color color, string name) :
base(new ColorBlockWidget(color), name)
{
Menu = new Menu();
SeparatorMenuItem sep = new SeparatorMenuItem();
(Menu as Menu).Append(sep);
sep.Show();
// TODO: Figure out how to replace "new AccelGroup()"
ImageMenuItem colors = new ImageMenuItem(Stock.ColorPicker,
new AccelGroup());
if(colors.Child is Label) (colors.Child as Label).Text =
"More Colors...";
colors.Activated += MoreColorsActivated;
(Menu as Menu).Append(colors);
colors.Show();
SetMainColor(AddColor(color, name));
numCustomItems = 0;
}
示例6: OnPopupMenu
protected override bool OnPopupMenu ()
{
Stetic.Wrapper.Widget selection = SelectedWrapper;
if (selection != null) {
Menu m = new ContextMenu (selection);
if (selection.IsTopLevel) {
// Allow deleting top levels from the project view
ImageMenuItem item = new ImageMenuItem (Gtk.Stock.Delete, null);
item.Activated += delegate (object obj, EventArgs args) {
selection.Delete ();
};
item.Show ();
m.Add (item);
}
m.Popup ();
return true;
} else
return base.OnPopupMenu ();
}
示例7: setUp
//Checks prefs and sets up system
private void setUp()
{
bool auto;
try {
auto = (bool) Preferences.Get(CalculatorAddin.CALCULATOR_AUTOMATIC_MODE);
} catch (Exception e) {
Logger.Debug(e.Message);
auto = false; //Defaults to manual if no preference is set.
}
if (!auto) {
//Clean up automatic listeners in case a switch has been made with the note open
if (buffer != null) buffer.InsertText -= OnInsertText;
//Sets up a menu item and listener
item = new Gtk.ImageMenuItem (Catalog.GetString ("Calculate Answer"));
item.Activated += OnMenuItemActivated;
item.AddAccelerator ("activate", Window.AccelGroup,
(uint) Gdk.Key.e, Gdk.ModifierType.ControlMask,
Gtk.AccelFlags.Visible);
item.Image = new Gtk.Image (Gtk.Stock.Execute, Gtk.IconSize.Menu);
item.Show ();
AddPluginMenuItem (item);
} else {
//Clean up manual listeners in case a switch has been made with the note open
if (item != null){
item.Activated -= OnMenuItemActivated;
item.Hide();
}
//Add listener to check for braces being typed in
buffer.InsertText += OnInsertText;
Logger.Debug("CalcAddin: Listening for equation brackets");
equation_ends = new List<TextMark>();
equation_starts = new List<TextMark>();
//TODO: Set up a watcher that notes when braces are deleted and removes the marks.
//TODO: Set up a method to search through for existing brackets at startup
}
}
示例8: DoPopUp
private void DoPopUp()
{
Menu popup = new Menu();
ImageMenuItem newItem = new ImageMenuItem (Stock.New, new Gtk.AccelGroup(IntPtr.Zero));
newItem.Activated += new EventHandler (OnNewEntryActivate);
newItem.Show ();
popup.Append (newItem);
MenuItem renameItem = new MenuItem ("Rename...");
renameItem.Activated += new EventHandler (OnRenameActivate);
renameItem.Show ();
popup.Append (renameItem);
MenuItem exportItem = new MenuItem ("Export...");
exportItem.Activated += new EventHandler (OnExportActivate);
exportItem.Show ();
popup.Append (exportItem);
ImageMenuItem deleteItem = new ImageMenuItem (Stock.Delete, new Gtk.AccelGroup(IntPtr.Zero));
deleteItem.Activated += new EventHandler (OnDeleteActivate);
deleteItem.Show ();
popup.Append (deleteItem);
popup.Popup(null, null, null, 3,
Gtk.Global.CurrentEventTime);
}
示例9: BuildHeader
private void BuildHeader ()
{
source_actions_align = new Gtk.Alignment (0f, .5f, 1f, 0f) {
RightPadding = 0,
LeftPadding = 0,
NoShowAll = true
};
if (Hyena.PlatformDetection.IsMeeGo) {
source_actions_align.RightPadding = 5;
source_actions_align.TopPadding = 5;
}
footer = new VBox ();
source_actions_box = new EventBox () { Visible = true };
BuildSearchEntry ();
InterfaceActionService uia = ServiceManager.Get<InterfaceActionService> ();
if (uia != null) {
Gtk.Action action = uia.GlobalActions["WikiSearchHelpAction"];
if (action != null) {
MenuItem item = new SeparatorMenuItem ();
item.Show ();
search_entry.Menu.Append (item);
item = new ImageMenuItem (Stock.Help, null);
item.Activated += delegate { action.Activate (); };
item.Show ();
search_entry.Menu.Append (item);
}
}
source_actions_box.ShowAll ();
source_actions_align.Add (source_actions_box);
source_actions_align.Hide ();
search_entry.Show ();
context_pane = new Banshee.ContextPane.ContextPane ();
context_pane.ExpandHandler = b => {
SetChildPacking (content.Widget, !b, true, 0, PackType.Start);
SetChildPacking (context_pane, b, b, 0, PackType.End);
};
// Top to bottom, their order is reverse of this:
PackEnd (footer, false, false, 0);
PackEnd (context_pane, false, false, 0);
PackEnd (source_actions_align, false, false, 0);
PackEnd (new ConnectedMessageBar (), false, true, 0);
}
示例10: OnNoteOpened
public override void OnNoteOpened()
{
insertLocalImageMenuItem = new Gtk.ImageMenuItem (
Catalog.GetString ("Insert Local Image"));
insertLocalImageMenuItem.Image = new Gtk.Image (Gtk.Stock.Harddisk, Gtk.IconSize.Menu);
insertLocalImageMenuItem.Activated += OnInsertLocalImage;
insertLocalImageMenuItem.AddAccelerator ("activate", Window.AccelGroup,
(uint)Gdk.Key.l, Gdk.ModifierType.ControlMask | Gdk.ModifierType.ShiftMask,
Gtk.AccelFlags.Visible);
insertLocalImageMenuItem.Show ();
AddPluginMenuItem (insertLocalImageMenuItem);
insertWebImageMenuItem = new Gtk.ImageMenuItem (
Catalog.GetString ("Insert Web Image"));
insertWebImageMenuItem.Image = new Gtk.Image (Gtk.Stock.Network, Gtk.IconSize.Menu);
insertWebImageMenuItem.Activated += OnInsertWebImage;
insertWebImageMenuItem.AddAccelerator ("activate", Window.AccelGroup,
(uint)Gdk.Key.w, Gdk.ModifierType.ControlMask | Gdk.ModifierType.ShiftMask,
Gtk.AccelFlags.Visible);
insertWebImageMenuItem.Show ();
AddPluginMenuItem (insertWebImageMenuItem);
LoadImageBoxes ();
Note.Saved += OnNoteSaved;
Buffer.DeleteRange += new DeleteRangeHandler (Buffer_DeleteRange);
}
示例11: DoPopUp
void DoPopUp()
{
popup = new Menu();
ImageMenuItem newItem = new ImageMenuItem ("New");
Gtk.Image newImage = new Gtk.Image (Stock.New, IconSize.Menu);
newItem.Image = newImage;
newItem.Activated += new EventHandler (OnNewEntryActivate);
newItem.Show ();
popup.Append (newItem);
Gdk.Pixbuf pb = Gdk.Pixbuf.LoadFromResource ("document-save.png");
ImageMenuItem exportItem = new ImageMenuItem ("Export");
exportItem.Image = new Gtk.Image (pb);
exportItem.Activated += new EventHandler (OnExportActivate);
exportItem.Show ();
popup.Append (exportItem);
ImageMenuItem deleteItem = new ImageMenuItem ("Delete");
Gtk.Image deleteImage = new Gtk.Image (Stock.Delete, IconSize.Menu);
deleteItem.Image = deleteImage;
deleteItem.Activated += new EventHandler (OnDeleteActivate);
deleteItem.Show ();
popup.Append (deleteItem);
ImageMenuItem propItem = new ImageMenuItem ("Properties");
Gtk.Image propImage = new Gtk.Image (Stock.Properties, IconSize.Menu);
propItem.Image = propImage;
propItem.Activated += new EventHandler (OnEditActivate);
propItem.Show ();
popup.Append (propItem);
bool users = false;
if (viewPlugin.Name.ToLower() == "users") {
SeparatorMenuItem sm = new SeparatorMenuItem ();
sm.Show ();
popup.Append (sm);
Gdk.Pixbuf pwdImage = Gdk.Pixbuf.LoadFromResource ("locked16x16.png");
ImageMenuItem pwdItem = new ImageMenuItem ("Change password");
pwdItem.Image = new Gtk.Image (pwdImage);
pwdItem.Activated += new EventHandler (OnPwdActivate);
pwdItem.Show ();
popup.Append (pwdItem);
users = true;
}
if (users || viewPlugin.Name.ToLower() == "contacts") {
if (!users) {
SeparatorMenuItem sm = new SeparatorMenuItem ();
sm.Show ();
popup.Append (sm);
}
pb = Gdk.Pixbuf.LoadFromResource ("mail-message-new.png");
ImageMenuItem mailItem = new ImageMenuItem ("Send email");
mailItem.Image = new Gtk.Image (pb);
mailItem.Activated += new EventHandler (OnEmailActivate);
mailItem.Show ();
popup.Append (mailItem);
Gdk.Pixbuf wwwImage = Gdk.Pixbuf.LoadFromResource ("go-home.png");
ImageMenuItem wwwItem = new ImageMenuItem ("Open home page");
wwwItem.Image = new Gtk.Image (wwwImage);
wwwItem.Activated += new EventHandler (OnWWWActivate);
wwwItem.Show ();
popup.Append (wwwItem);
}
popup.Popup(null, null, null, 3, Gtk.Global.CurrentEventTime);
}
示例12: NoteTextMenu
// FIXME: Tags applied to a word should hold over the space
// between the next word, as thats where you'll start typeing.
// Tags are only active -after- a character with that tag. This
// is different from the way gtk-textbuffer applies tags.
//
// Text menu
//
// Menu for font style and size, and set the active radio
// menuitem depending on the cursor poition.
//
public NoteTextMenu (Gtk.AccelGroup accel_group,
NoteBuffer buffer,
UndoManager undo_manager)
: base ()
{
this.buffer = buffer;
this.undo_manager = undo_manager;
if (undo_manager != null) {
undo = new Gtk.ImageMenuItem (Gtk.Stock.Undo, accel_group);
undo.Activated += UndoClicked;
undo.AddAccelerator ("activate",
accel_group,
(uint) Gdk.Key.z,
Gdk.ModifierType.ControlMask,
Gtk.AccelFlags.Visible);
undo.Show ();
Append (undo);
redo = new Gtk.ImageMenuItem (Gtk.Stock.Redo, accel_group);
redo.Activated += RedoClicked;
redo.AddAccelerator ("activate",
accel_group,
(uint) Gdk.Key.z,
(Gdk.ModifierType.ControlMask |
Gdk.ModifierType.ShiftMask),
Gtk.AccelFlags.Visible);
redo.Show ();
Append (redo);
Gtk.SeparatorMenuItem undo_spacer = new Gtk.SeparatorMenuItem ();
Append (undo_spacer);
// Listen to events so we can sensitize and
// enable keybinding
undo_manager.UndoChanged += UndoChanged;
}
bold = new Gtk.CheckMenuItem ("<b>" +
Catalog.GetString ("_Bold") +
"</b>");
MarkupLabel (bold);
bold.Data ["Tag"] = "bold";
bold.Activated += FontStyleClicked;
bold.AddAccelerator ("activate",
accel_group,
(uint) Gdk.Key.b,
Gdk.ModifierType.ControlMask,
Gtk.AccelFlags.Visible);
italic = new Gtk.CheckMenuItem ("<i>" +
Catalog.GetString ("_Italic") +
"</i>");
MarkupLabel (italic);
italic.Data ["Tag"] = "italic";
italic.Activated += FontStyleClicked;
italic.AddAccelerator ("activate",
accel_group,
(uint) Gdk.Key.i,
Gdk.ModifierType.ControlMask,
Gtk.AccelFlags.Visible);
strikeout = new Gtk.CheckMenuItem ("<s>" +
Catalog.GetString ("_Strikeout") +
"</s>");
MarkupLabel (strikeout);
strikeout.Data ["Tag"] = "strikethrough";
strikeout.Activated += FontStyleClicked;
strikeout.AddAccelerator ("activate",
accel_group,
(uint) Gdk.Key.s,
Gdk.ModifierType.ControlMask,
Gtk.AccelFlags.Visible);
highlight = new Gtk.CheckMenuItem ("<span background='yellow'>" +
Catalog.GetString ("_Highlight") +
"</span>");
MarkupLabel (highlight);
highlight.Data ["Tag"] = "highlight";
highlight.Activated += FontStyleClicked;
highlight.AddAccelerator ("activate",
accel_group,
(uint) Gdk.Key.h,
Gdk.ModifierType.ControlMask,
Gtk.AccelFlags.Visible);
Gtk.SeparatorMenuItem spacer1 = new Gtk.SeparatorMenuItem ();
//.........这里部分代码省略.........
示例13: DoPopUp
void DoPopUp()
{
Menu popup = new Menu();
ImageMenuItem addBinaryValueItem = new ImageMenuItem ("Add binary value...");
addBinaryValueItem.Image = new Gtk.Image (Stock.Open, IconSize.Menu);
addBinaryValueItem.Activated += new EventHandler (OnAddBinaryValueActivate);
addBinaryValueItem.Show ();
popup.Append (addBinaryValueItem);
ImageMenuItem newObjectClassItem = new ImageMenuItem ("Add object class(es)...");
newObjectClassItem.Image = new Gtk.Image (Stock.Add, IconSize.Menu);
newObjectClassItem.Activated += new EventHandler (OnAddObjectClassActivate);
newObjectClassItem.Show ();
popup.Append (newObjectClassItem);
ImageMenuItem deleteItem = new ImageMenuItem ("Delete attribute");
deleteItem.Image = new Gtk.Image (Stock.Delete, IconSize.Menu);
deleteItem.Activated += new EventHandler (OnDeleteActivate);
deleteItem.Show ();
popup.Append (deleteItem);
ImageMenuItem newItem = new ImageMenuItem ("Insert attribute");
newItem.Image = new Gtk.Image (Stock.New, IconSize.Menu);
newItem.Activated += new EventHandler (OnInsertActivate);
newItem.Show ();
popup.Append (newItem);
ImageMenuItem saveBinaryValueItem = new ImageMenuItem ("Save binary value...");
saveBinaryValueItem.Image = new Gtk.Image (Stock.Save, IconSize.Menu);
saveBinaryValueItem.Activated += new EventHandler (OnSaveBinaryValueActivate);
saveBinaryValueItem.Show ();
popup.Append (saveBinaryValueItem);
popup.Popup(null, null, null, 3, Gtk.Global.CurrentEventTime);
}
示例14: OnPopulatePopup
void OnPopulatePopup (object sender, Gtk.PopulatePopupArgs args)
{
args.Menu.AccelGroup = accel_group;
Logger.Debug ("Populating context menu...");
// Remove the lame-o gigantic Insert Unicode Control
// Characters menu item.
Gtk.Widget lame_unicode;
lame_unicode = (Gtk.Widget)
args.Menu.Children [args.Menu.Children.Length - 1];
args.Menu.Remove (lame_unicode);
Gtk.MenuItem spacer1 = new Gtk.SeparatorMenuItem ();
spacer1.Show ();
Gtk.ImageMenuItem search = new Gtk.ImageMenuItem (
Catalog.GetString ("_Search All Notes"));
search.Image = new Gtk.Image (Gtk.Stock.Find, Gtk.IconSize.Menu);
search.Activated += SearchActivate;
search.AddAccelerator ("activate",
accel_group,
(uint) Gdk.Key.f,
(Gdk.ModifierType.ControlMask |
Gdk.ModifierType.ShiftMask),
Gtk.AccelFlags.Visible);
search.Show ();
Gtk.ImageMenuItem link =
new Gtk.ImageMenuItem (Catalog.GetString ("_Link to New Note"));
link.Image = new Gtk.Image (Gtk.Stock.JumpTo, Gtk.IconSize.Menu);
link.Sensitive = (note.Buffer.Selection != null);
link.Activated += LinkToNoteActivate;
link.AddAccelerator ("activate",
accel_group,
(uint) Gdk.Key.l,
Gdk.ModifierType.ControlMask,
Gtk.AccelFlags.Visible);
link.Show ();
Gtk.ImageMenuItem text_item =
new Gtk.ImageMenuItem (Catalog.GetString ("Te_xt"));
text_item.Image = new Gtk.Image (Gtk.Stock.SelectFont, Gtk.IconSize.Menu);
text_item.Submenu = new NoteTextMenu (accel_group,
note.Buffer,
note.Buffer.Undoer);
text_item.Show ();
Gtk.ImageMenuItem find_item =
new Gtk.ImageMenuItem (Catalog.GetString ("_Find in This Note"));
find_item.Image = new Gtk.Image (Gtk.Stock.Find, Gtk.IconSize.Menu);
find_item.Submenu = MakeFindMenu ();
find_item.Show ();
Gtk.MenuItem spacer2 = new Gtk.SeparatorMenuItem ();
spacer2.Show ();
args.Menu.Prepend (spacer1);
args.Menu.Prepend (text_item);
args.Menu.Prepend (find_item);
args.Menu.Prepend (link);
args.Menu.Prepend (search);
Gtk.MenuItem close_all =
new Gtk.MenuItem (Catalog.GetString ("Clos_e All Notes"));
close_all.Activated += CloseAllWindowsHandler;
close_all.AddAccelerator ("activate",
accel_group,
(uint) Gdk.Key.q,
Gdk.ModifierType.ControlMask,
Gtk.AccelFlags.Visible);
close_all.Show ();
Gtk.ImageMenuItem close_window =
new Gtk.ImageMenuItem (Catalog.GetString ("_Close"));
close_window.Image = new Gtk.Image (Gtk.Stock.Close, Gtk.IconSize.Menu);
close_window.Activated += CloseWindowHandler;
close_window.AddAccelerator ("activate",
accel_group,
(uint) Gdk.Key.w,
Gdk.ModifierType.ControlMask,
Gtk.AccelFlags.Visible);
close_window.Show ();
args.Menu.Append (close_all);
args.Menu.Append (close_window);
}
示例15: AppMenuBar
public AppMenuBar()
: base()
{
/* File menu */
fileMenuItem =
new MenuItem (Catalog.GetString ("_File"));
Append (fileMenuItem);
Menu menu = new Menu ();
fileMenuItem.Submenu = menu;
menu.Append (new SeparatorMenuItem ());
ImageMenuItem item =
new ImageMenuItem (Catalog.
GetString ("_Quit"));
item.Image = new Image (Stock.Quit, IconSize.Menu);
item.Activated += OnQuit;
quitMenuItem = item;
menu.Append (item);
/* Edit menu */
editMenuItem =
new MenuItem (Catalog.GetString ("_Edit"));
editMenuItem.Submenu = new Menu ();
Append (editMenuItem);
/* View menu */
viewMenuItem =
new MenuItem (Catalog.GetString ("_View"));
viewMenuItem.Submenu = new Menu ();
Append (viewMenuItem);
menu = new Menu ();
viewMenuItem.Submenu = menu;
fullscreenMenuItem = item =
new ImageMenuItem (Catalog.
GetString ("_Fullscreen"));
item.Activated += OnFullscreenActivated;
item.Image =
new Image (Stock.Fullscreen, IconSize.Menu);
menu.Append (item);
unfullscreenMenuItem = item =
new ImageMenuItem (Catalog.
GetString
("_Leave Fullscreen"));
item.Activated += OnUnfullscreenActivated;
item.Image =
new Image (Stock.LeaveFullscreen,
IconSize.Menu);
item.Show ();
//menu.Append(item);
/* Help menu */
helpMenuItem =
new MenuItem (Catalog.GetString ("_Help"));
Append (helpMenuItem);
menu = new Menu ();
helpMenuItem.Submenu = menu;
item = new ImageMenuItem (Catalog.
GetString ("_About"));
item.Image = new Image (Stock.About, IconSize.Menu);
item.Activated += OnAbout;
menu.Append (item);
item = new ImageMenuItem (Catalog.
GetString ("_Contents"));
item.Activated += OnContents;
item.Image = new Image (Stock.Help, IconSize.Menu);
menu.Append (item);
ShowAll ();
CsBoardApp.Instance.Window.WindowStateEvent +=
OnWindowStateEvent;
accel = new AccelGroup ();
set_accel_group (accel);
}