本文整理汇总了C#中Gtk.ActionGroup类的典型用法代码示例。如果您正苦于以下问题:C# ActionGroup类的具体用法?C# ActionGroup怎么用?C# ActionGroup使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
ActionGroup类属于Gtk命名空间,在下文中一共展示了ActionGroup类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: Initialize
public override void Initialize ()
{
action_group = new Gtk.ActionGroup ("RemoveBrokenLinks");
action_group.Add (new Gtk.ActionEntry [] {
new Gtk.ActionEntry ("ToolsMenuAction", null,
Catalog.GetString ("_Tools"), null, null, null),
new Gtk.ActionEntry ("RemoveBrokenLinksAction", null,
Catalog.GetString ("_Remove broken links"), null, null,
delegate {
OnRemoveBrokenLinksActivated ();
})
});
rblUi = Tomboy.ActionManager.UI.AddUiFromString (@"
<ui>
<menubar name='MainWindowMenubar'>
<placeholder name='MainWindowMenuPlaceholder'>
<menu name='ToolsMenu' action='ToolsMenuAction'>
<menuitem name='RemoveBrokenLinks' action='RemoveBrokenLinksAction' />
</menu>
</placeholder>
</menubar>
</ui>
");
Tomboy.ActionManager.UI.InsertActionGroup (action_group, 0);
initialized = true;
}
示例2: EntityListView
public EntityListView()
{
SizeRequested += delegate(object o, SizeRequestedArgs args) {
if (Child != null)
args.Requisition = Child.SizeRequest ();
};
SizeAllocated += delegate(object o, SizeAllocatedArgs args) {
if (Child != null)
Child.Allocation = args.Allocation;
};
VBox vBox = new VBox();
ScrolledWindow scrolledWindow = new ScrolledWindow();
scrolledWindow.ShadowType = ShadowType.In;
treeView = new TreeView();
scrolledWindow.Add (treeView);
vBox.Add (scrolledWindow);
Add (vBox);
ShowAll ();
actionGroup = new ActionGroup("entityListView");
}
示例3: getUi
private string getUi(ActionGroup actionGroup)
{
string uiItems = "";
foreach (Gtk.Action action in actionGroup.ListActions())
uiItems = uiItems + String.Format (uiItem, action.Name);
return prefix + uiItems + sufix;
}
示例4: MainUIManager
public MainUIManager(ViewGui viewGui)
{
this.viewGui = viewGui;
actions = new ActionGroup ("Actions");
ActionEntry actionEntryQuit;
actionEntryQuit = new ActionEntry("Quitter", Gtk.Stock.Quit, null, "<control>Q", "Quitter l'environnement Sofia", new EventHandler (Quit));
ActionEntry[] entries = new ActionEntry [] {
new ActionEntry ("Fichier", null, "_Fichier", null, null, null),
new ActionEntry ("Editer", null, "Editio_n", null, null, null),
new ActionEntry ("Rechercher", null, "Recher_cher", null, null, null),
new ActionEntry ("Aide", null, "_Aide", null, null, null),
actionEntryQuit,
new ActionEntry ("Préférences", Gtk.Stock.Preferences, null, null, "Préférences", new EventHandler (Preferences)),
new ActionEntry ("RubriquesAide", Gtk.Stock.Help, "Rubriques d'_aide", "F1", "Aide - Rubriques d'aide", new EventHandler (Help)),
new ActionEntry ("APropos", Gtk.Stock.About, null, null, "A propos de l'environnement Sofia", new EventHandler (About))
};
actions.Add (entries);
InsertActionGroup(actions, 0);
this.viewGui.AddAccelGroup(AccelGroup);
uint id = 0;
try {
id = AddUiFromFile("MainUIDef.xml");
}
catch {
RemoveUi(id);
}
}
示例5: Shell
public Shell()
: base("Mono Heap Profiler")
{
entries = new ActionEntry[] {
new ActionEntry ("FileMenu", null, "_File", null, null, null),
new ActionEntry ("OpenAction", Stock.Open, null, "<control>O", "Open a profile...", new EventHandler (OnOpen)),
new ActionEntry ("QuitAction", Stock.Quit, null, "<control>Q", "Quit the application", delegate { Application.Quit (); }),
};
DefaultSize = new Gdk.Size (700, 700);
DeleteEvent += delegate { Application.Quit (); };
main_box = new VBox (false, 0);
Add (main_box);
shell_commands = new ActionGroup ("TestActions");
shell_commands.Add (entries);
uim = new UIManager ();
uim.AddWidget += delegate (object obj, AddWidgetArgs args) {
args.Widget.Show ();
main_box.PackStart (args.Widget, false, true, 0);
};
uim.ConnectProxy += OnProxyConnect;
uim.InsertActionGroup (shell_commands, 0);
uim.AddUiFromResource ("shell-ui.xml");
AddAccelGroup (uim.AccelGroup);
sb = new Statusbar ();
main_box.PackEnd (sb, false, true, 0);
pager = new ShellPager (this);
main_box.PackEnd (pager, true, true, 0);
}
示例6: Navbar
public Navbar (Gtk.IconSize size)
{
address = new Entry ("address");
// FIXME: this doesnt't seem to work yet
// address.Completion = new EntryCompletion ();
address.WidthChars = 50;
address.Activated += new EventHandler (OnGoUrl);
ActionEntry[] actions = new ActionEntry[]
{
new ActionEntry ("back", Gtk.Stock.GoBack, null, null, GettextCatalog.GetString ("Go back"), new EventHandler (OnBackClicked)),
new ActionEntry ("forward", Gtk.Stock.GoForward, null, null, GettextCatalog.GetString ("Go forward"), new EventHandler (OnForwardClicked)),
new ActionEntry ("stop", Gtk.Stock.Stop, null, null, GettextCatalog.GetString ("Stop loading"), new EventHandler (OnStopClicked)),
new ActionEntry ("reload", Gtk.Stock.Refresh, null, null, GettextCatalog.GetString ("Address"), new EventHandler (OnReloadClicked)),
new ActionEntry ("go", Gtk.Stock.Ok, null, null, GettextCatalog.GetString ("Load address"), new EventHandler (OnGoUrl))
};
ActionGroup ag = new ActionGroup ("navbarGroup");
ag.Add (actions);
UIManager uim = new UIManager ();
uim.InsertActionGroup (ag, 0);
uim.AddWidget += new AddWidgetHandler (OnAddWidget);
uim.AddUiFromString (uiInfo);
ToolItem item = new ToolItem ();
item.Add (address);
Toolbar tb = uim.GetWidget ("/ui/toolbar") as Toolbar;
tb.IconSize = size;
tb.Add (item);
this.ShowAll ();
}
示例7: MainWindow
public MainWindow()
: base(Gtk.WindowType.Toplevel)
{
Build ();
UiManagerHelper uiManagerHelper = new UiManagerHelper(UIManager);
ActionGroup actionGroup1 = new ActionGroup("pageActionGroup");
Gtk.Action newAction = new Gtk.Action("newAction", null, null, Stock.New);
actionGroup1.Add (newAction);
Gtk.Action editAction = new Gtk.Action("editAction", null, null, Stock.Edit);
actionGroup1.Add (editAction);
ActionGroup actionGroup2 = new ActionGroup("pageActionGroup");
Gtk.Action deleteAction = new Gtk.Action("deleteAction", null, null, Stock.Delete);
actionGroup2.Add (deleteAction);
ActionGroup currentActionGroup = actionGroup1;
uiManagerHelper.SetActionGroup (currentActionGroup);
executeAction.Activated += delegate {
Console.WriteLine("executeAction.Activated");
if (currentActionGroup == actionGroup1)
currentActionGroup = actionGroup2;
else
currentActionGroup = actionGroup1;
uiManagerHelper.SetActionGroup(currentActionGroup);
};
}
示例8: Window
public Window(Inventory inventory)
: this(new Builder("window.ui"))
{
Inventory = inventory;
// load the menues and toolbars
uiManager = new UIManager();
// create the file actions
Gtk.Action saveInventoryAction = new Gtk.Action("saveFile","Save","Save the active inventory",Stock.Save);
saveInventoryAction.Activated += OnSaveInventory;
Gtk.Action printLabelsAction = new Gtk.Action("printLabels","Print Labels","Print labels for items.",Stock.Print);
printLabelsAction.Activated += OnPrintLabels;
Gtk.Action quitAction = new Gtk.Action("quit","Quit","Quit the application",Stock.Quit);
quitAction.Activated += OnQuit;
Gtk.Action fileAction = new Gtk.Action("file","File");
ActionGroup fileActionGroup = new ActionGroup("file");
fileActionGroup.Add(saveInventoryAction);
fileActionGroup.Add(printLabelsAction);
fileActionGroup.Add(quitAction);
fileActionGroup.Add(fileAction);
uiManager.InsertActionGroup(fileActionGroup,0);
// create items box
itemsBox = new ItemsBox(inventory.Items, uiManager);
itemsBox.DrawDescriptionEntry += OnDrawDescriptionEntry;
itemsBox.ShowMe += OnShowItemsBox;
itemsAlign.Add(itemsBox);
// create locations box
locationsBox = new LocationsBox(inventory.Locations, uiManager);
locationsBox.DrawDescriptionEntry += OnDrawDescriptionEntry;
locationsBox.ShowMe += OnShowLocationsBox;
locationsBox.GotoItem += OnGotoLocationsItem;
locationsAlign.Add(locationsBox);
// create tags box
tagsBox = new TagsBox(inventory.Tags, uiManager);
tagsBox.ShowMe += OnShowTagsBox;
tagsAlign.Add(tagsBox);
// create tool and menubar
uiManager.AddUiFromResource("window_menues.xml");
menuBar = (MenuBar) uiManager.GetWidget("/menuBar");
toolbar = (Toolbar) uiManager.GetWidget("/toolbar");
toolbar.IconSize = IconSize.LargeToolbar;
toolbar.ToolbarStyle = ToolbarStyle.Both;
mainBox.PackStart(menuBar,false,true,0);
mainBox.PackStart(toolbar,false,true,0);
// laod category icons
itemsTabImage.Pixbuf = ((GtkSettings)Inventory.Settings).ItemsTabIcon;
locationsTabImage.Pixbuf = ((GtkSettings)Inventory.Settings).LocationsTabIcon;
tagsTabImage.Pixbuf = ((GtkSettings)Inventory.Settings).TagsTabIcon;
this.Icon = ((GtkSettings)Inventory.Settings).WindowIcon;
this.Resize(((GtkSettings)Inventory.Settings).MainWindowWidth,((GtkSettings)Inventory.Settings).MainWindowHeight);
}
示例9: MainWindow
public MainWindow (): base (Gtk.WindowType.Toplevel)
{
// this window
this.Title= "Supos";
this.DeleteEvent += OnDeleteEvent;
// main vbox
mainBox = new VBox(false, 0);
this.Add(mainBox);
// actiongroup and uimanager stuff (menubar)
actgroup = new ActionGroup ("TestActions");
SetUpActionGroup();
uim = new UIManager ();
uim.InsertActionGroup (actgroup, 0);
this.AddAccelGroup(uim.AccelGroup);
SetUpUiManager();
Gtk.Widget menubar = uim.GetWidget("/MenuBar");
mainBox.PackStart(menubar, false, false, 0);
actgroup.GetAction("disconnect").Sensitive=false;
// main panned view
mainPaned = new HPaned();
mainPaned.Sensitive = false;
mainPaned.Name = "toucharea";
mainBox.PackStart(mainPaned, true, true, 0);
// order editing view
orderview = new ViewOrderEdit();
mainPaned.Pack2(orderview, false, false);
// categories product paned view
HPaned hpan2;
hpan2 = new HPaned();
mainPaned.Pack1(hpan2, true, false);
// categories view
catview = new ViewNameIcon();
catview.DataMember="Categories";
catview.SelectionChanged += this.OnCatSelectionChanged;
catview.WidthRequest= 200;
hpan2.Pack1(catview, false, false);
// products view
prodview = new ViewNameIcon();
prodview.DataMember = "Products";
prodview.RowActivated += this.OnProdRowActivated;
prodview.WidthRequest= 400;
hpan2.Pack2(prodview, true, false);
// status bar
Statusbar statusbar;
statusbar = new Statusbar();
mainBox.PackStart(statusbar, false, false, 0);
// clock
Clock clock;
clock = new Clock();
clock.BorderWidth = 6;
statusbar.PackStart(clock, false, false, 0);
// END build interface
this.ApplyViewPreferences(SettingsHandler.Settings.viewSettings);
}
示例10: AddActionGroup
public void AddActionGroup (ActionGroup group)
{
lock (this) {
if (action_groups.ContainsKey (group.Name)) {
throw new ApplicationException ("Group already exists");
}
InnerAddActionGroup (group);
}
}
示例11: Initialize
public override void Initialize ()
{
Logger.Debug ("TasksApplicationAddin.Initialize ()");
if (manager == null) {
lock (locker) {
if (manager == null) {
manager = new TaskManager (
Path.Combine (Tomboy.DefaultNoteManager.NoteDirectoryPath, "Tasks"));
}
}
///
/// Add a "To Do List" to Tomboy's Tray Icon Menu
///
action_group = new Gtk.ActionGroup ("Tasks");
action_group.Add (new Gtk.ActionEntry [] {
new Gtk.ActionEntry ("ToolsMenuAction", null,
Catalog.GetString ("_Tools"), null, null, null),
new Gtk.ActionEntry ("OpenToDoListAction", null,
Catalog.GetString ("To Do List"), null, null,
delegate { OnOpenToDoListAction (); })
});
// tray_icon_ui = Tomboy.ActionManager.UI.AddUiFromString (@"
// <ui>
// <popup name='TrayIconMenu' action='TrayIconMenuAction'>
// <menuitem name='OpenToDoList' action='OpenToDoListAction' />
// </popup>
// </ui>
// ");
tools_menu_ui = Tomboy.ActionManager.UI.AddUiFromString (@"
<ui>
<menubar name='MainWindowMenubar'>
<placeholder name='MainWindowMenuPlaceholder'>
<menu name='ToolsMenu' action='ToolsMenuAction'>
<menuitem name='OpenToDoList' action='OpenToDoListAction' />
</menu>
</placeholder>
</menubar>
</ui>
");
Tomboy.ActionManager.UI.InsertActionGroup (action_group, 0);
Tomboy.DefaultNoteManager.NoteDeleted += OnNoteDeleted;
tomboy_tray_menu = GetTomboyTrayMenu ();
tomboy_tray_menu.Shown += OnTomboyTrayMenuShown;
tomboy_tray_menu.Hidden += OnTomboyTrayMenuHidden;
initialized = true;
}
}
示例12: TaskUIHandler
public TaskUIHandler()
{
m_Actions = new ActionGroup ("Task");
this.AddTaskActions (m_Actions);
var guiService = ServiceManager.Get<GuiService> ();
guiService.Window.Planning.TasksTreeView.Selection.Changed += delegate {
int count = guiService.Window.Planning.TasksTreeView.Selection.CountSelectedRows ();
m_removeTask.Sensitive = count > 0;
};
}
示例13: ShowWindow
public void ShowWindow ()
{
Application.Init ();
gxml = new Glade.XML ("contactviewer.glade", "MainWindow");
gxml.Autoconnect (this);
ActionEntry[] entries = new ActionEntry [] {
new ActionEntry ("FileMenuAction", null, "_File", null, null, null),
new ActionEntry ("OpenAction", Gtk.Stock.Open,
"_Open", "<control>O", Catalog.GetString ("Open..."), new EventHandler (OnOpenDatabase)),
new ActionEntry ("QuitAction", Gtk.Stock.Quit,
"_Quit", "<control>Q", Catalog.GetString ("Quit"), new EventHandler (OnQuit)),
new ActionEntry ("HelpMenuAction", null, "_Help", null, null, null),
new ActionEntry ("AboutAction", Gnome.Stock.About,
"_About", null, Catalog.GetString ("About"), new EventHandler (OnAbout))
};
ActionGroup grp = new ActionGroup ("MainGroup");
grp.Add (entries);
ui_manager = new UIManager ();
ui_manager.InsertActionGroup(grp, 0);
ui_manager.AddUiFromResource ("menu.xml");
MenubarHolder.Add (ui_manager.GetWidget ("/MainMenu"));
// Fix the TreeView that will contain all contacts
contact_store = new ListStore (typeof (string), typeof (string));
ContactList.Model = contact_store;
ContactList.RulesHint = true;
ContactList.AppendColumn (Catalog.GetString ("Contacts"), new CellRendererText (), "text", 1);
ContactList.ButtonReleaseEvent += OnContactSelected;
// This ListStore will let the user choose what to see in the contact list
contact_show_type_store = new ListStore (typeof (string), typeof (string));
contact_show_type_store.AppendValues ("DisplayName", Catalog.GetString ("Display name"));
contact_show_type_store.AppendValues ("PrimaryEmail", Catalog.GetString ("Primary E-mail"));
contact_show_type_store.AppendValues ("SecondEmail", Catalog.GetString ("Secondary E-mail"));
contact_show_type_store.AppendValues ("NickName", Catalog.GetString ("Nickname"));
CellRendererText cell = new CellRendererText ();
ListIdentifier.PackStart (cell, false);
ListIdentifier.AddAttribute (cell, "text", 1);
ListIdentifier.Model = contact_show_type_store;
ListIdentifier.Active = 0;
ListIdentifier.Changed += OnContactListTypeChanged;
MainWindow.Icon = Beagle.Images.GetPixbuf ("contact-icon.png");
MainWindow.DeleteEvent += OnDeleteEvent;
LoadDatabase ();
Application.Run ();
}
示例14: SetActionGroup
public void SetActionGroup(ActionGroup actionGroup)
{
if (this.actionGroup != null) { //this.actionGroup es el anterior
uIManager.RemoveUi(mergeId);
uIManager.RemoveActionGroup(this.actionGroup);
}
this.actionGroup = actionGroup;
if (actionGroup == null)
return;
uIManager.InsertActionGroup(actionGroup, 0);
mergeId = uIManager.AddUiFromString (getUi(actionGroup));
}
示例15: EditUIHandler
public EditUIHandler()
{
m_Actions = new ActionGroup ("Edit");
this.AddEditActions (m_Actions);
var cmdService = ServiceManager.Get<CommandService> ();
cmdService.Commands.Changed += delegate {
undo.Sensitive = cmdService.Commands.CanUndo;
redo.Sensitive = cmdService.Commands.CanRedo;
undo.Label = String.Format ("Undo {0}", cmdService.Commands.UndoText);
redo.Label = String.Format ("Redo {0}", cmdService.Commands.RedoText);
};
}