本文整理汇总了C#中Gtk.Button.AddAccelerator方法的典型用法代码示例。如果您正苦于以下问题:C# Button.AddAccelerator方法的具体用法?C# Button.AddAccelerator怎么用?C# Button.AddAccelerator使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Gtk.Button
的用法示例。
在下文中一共展示了Button.AddAccelerator方法的10个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: VersionInformationDialog
public VersionInformationDialog()
: base()
{
AccelGroup accel_group = new AccelGroup();
AddAccelGroup(accel_group);
Modal = true;
Button button = new Button("gtk-close");
button.CanDefault = true;
button.UseStock = true;
button.Show();
DefaultResponse = ResponseType.Close;
button.AddAccelerator("activate", accel_group, (uint)Gdk.Key.Escape,
0, Gtk.AccelFlags.Visible);
AddActionWidget(button, ResponseType.Close);
Title = Catalog.GetString("Assembly Version Information");
BorderWidth = 10;
version_tree = new TreeView();
version_tree.RulesHint = true;
version_tree.AppendColumn(Catalog.GetString("Assembly Name"),
new CellRendererText(), "text", 0);
version_tree.AppendColumn(Catalog.GetString("Version"),
new CellRendererText(), "text", 1);
version_tree.Model = FillStore();
version_tree.CursorChanged += OnCursorChanged;
ScrolledWindow scroll = new ScrolledWindow();
scroll.Add(version_tree);
scroll.ShadowType = ShadowType.In;
scroll.SetSizeRequest(420, 200);
ContentArea.PackStart(scroll, true, true, 0);
ContentArea.Spacing = 5;
path_label = new Label();
path_label.Ellipsize = Pango.EllipsizeMode.End;
path_label.Hide();
path_label.Xalign = 0.0f;
path_label.Yalign = 1.0f;
ContentArea.PackStart(path_label, false, true, 0);
scroll.ShowAll();
}
示例2: AddButton
private void AddButton(string stock_id, Gtk.ResponseType response, bool is_default)
{
Button button = new Button(stock_id);
button.CanDefault = true;
button.Show();
AddActionWidget(button, response);
if(is_default) {
DefaultResponse = response;
button.AddAccelerator("activate", accel_group, (uint)Gdk.Key.Return,
0, AccelFlags.Visible);
}
}
示例3: StationEditor
public StationEditor(DatabaseTrackInfo track)
: base()
{
AccelGroup accel_group = new AccelGroup ();
AddAccelGroup (accel_group);
Title = String.Empty;
SkipTaskbarHint = true;
Modal = true;
this.track = track;
string title = track == null
? Catalog.GetString ("Add new radio station")
: Catalog.GetString ("Edit radio station");
BorderWidth = 6;
DefaultResponse = ResponseType.Ok;
Modal = true;
ContentArea.Spacing = 6;
HBox split_box = new HBox ();
split_box.Spacing = 12;
split_box.BorderWidth = 6;
Image image = new Image ();
image.IconSize = (int)IconSize.Dialog;
image.IconName = "radio";
image.Yalign = 0.0f;
image.Show ();
VBox main_box = new VBox ();
main_box.BorderWidth = 5;
main_box.Spacing = 10;
Label header = new Label ();
header.Markup = String.Format ("<big><b>{0}</b></big>", GLib.Markup.EscapeText (title));
header.Xalign = 0.0f;
header.Show ();
Label message = new Label ();
message.Text = Catalog.GetString ("Enter the Genre, Title and URL of the radio station you wish to add. A description is optional.");
message.Xalign = 0.0f;
message.Wrap = true;
message.Show ();
table = new Table (5, 2, false);
table.RowSpacing = 6;
table.ColumnSpacing = 6;
genre_entry = ComboBoxText.NewWithEntry ();
foreach (string genre in ServiceManager.DbConnection.QueryEnumerable<string> ("SELECT DISTINCT Genre FROM CoreTracks ORDER BY Genre")) {
if (!String.IsNullOrEmpty (genre)) {
genre_entry.AppendText (genre);
}
}
if (track != null && !String.IsNullOrEmpty (track.Genre)) {
genre_entry.Entry.Text = track.Genre;
}
AddRow (Catalog.GetString ("Station Genre:"), genre_entry);
name_entry = AddEntryRow (Catalog.GetString ("Station Name:"));
stream_entry = AddEntryRow (Catalog.GetString ("Stream URL:"));
creator_entry = AddEntryRow (Catalog.GetString ("Station Creator:"));
description_entry = AddEntryRow (Catalog.GetString ("Description:"));
rating_entry = new RatingEntry ();
HBox rating_box = new HBox ();
rating_box.PackStart (rating_entry, false, false, 0);
AddRow (Catalog.GetString ("Rating:"), rating_box);
table.ShowAll ();
main_box.PackStart (header, false, false, 0);
main_box.PackStart (message, false, false, 0);
main_box.PackStart (table, false, false, 0);
main_box.Show ();
split_box.PackStart (image, false, false, 0);
split_box.PackStart (main_box, true, true, 0);
split_box.Show ();
ContentArea.PackStart (split_box, true, true, 0);
Button cancel_button = new Button (Stock.Cancel);
cancel_button.CanDefault = false;
cancel_button.UseStock = true;
cancel_button.Show ();
AddActionWidget (cancel_button, ResponseType.Close);
cancel_button.AddAccelerator ("activate", accel_group, (uint)Gdk.Key.Escape,
0, Gtk.AccelFlags.Visible);
save_button = new Button (Stock.Save);
save_button.CanDefault = true;
save_button.UseStock = true;
//.........这里部分代码省略.........
示例4: ProfileConfigurationDialog
public ProfileConfigurationDialog(Profile profile)
: base()
{
this.profile = profile;
BorderWidth = 5;
AccelGroup accel_group = new AccelGroup();
AddAccelGroup(accel_group);
Button button = new Button(Stock.Close);
button.CanDefault = true;
button.Show();
if(ApplicationContext.Debugging) {
Button test_button = new Button("Test S-Expr");
test_button.Show();
test_button.Clicked += delegate {
if(sexpr_results != null) {
sexpr_results.Buffer.Text = profile.Pipeline.GetDefaultProcess();
}
};
ActionArea.PackStart(test_button, true, true, 0);
sexpr_results = new TextView();
}
AddActionWidget(button, ResponseType.Close);
DefaultResponse = ResponseType.Close;
button.AddAccelerator("activate", accel_group, (uint)Gdk.Key.Return,
0, AccelFlags.Visible);
BuildContents();
LoadProfile();
}
示例5: AddButton
public Button AddButton (Button button, ResponseType response, bool isDefault)
{
AddActionWidget (button, response);
if (isDefault) {
DefaultResponse = response;
button.AddAccelerator ("activate", accel_group, (uint)Gdk.Key.Return, 0, AccelFlags.Visible);
}
return button;
}
示例6: PreferencesDialog
public PreferencesDialog (NoteManager manager) : base(Gtk.WindowType.Toplevel)
{
this.addin_manager = manager.AddinManager;
IconName = "tomboy";
BorderWidth = 5;
Resizable = true;
Title = Catalog.GetString ("Tomboy Preferences");
WindowPosition = WindowPosition.Center;
addin_prefs_dialogs = new Dictionary<string, Gtk.Dialog> ();
addin_info_dialogs = new Dictionary<string, Gtk.Dialog> ();
// Notebook Tabs (Editing, Hotkeys)...
Gtk.Notebook notebook = new Gtk.Notebook ();
notebook.TabPos = Gtk.PositionType.Top;
notebook.Show ();
notebook.AppendPage (MakeEditingPane (), new Gtk.Label (Catalog.GetString ("Editing")));
if (!(Services.Keybinder is NullKeybinder))
notebook.AppendPage (MakeHotkeysPane (), new Gtk.Label (Catalog.GetString ("Hotkeys")));
notebook.AppendPage (MakeSyncPane (), new Gtk.Label (Catalog.GetString ("Synchronization")));
notebook.AppendPage (MakeAddinsPane (), new Gtk.Label (Catalog.GetString ("Add-ins")));
// TODO: Figure out a way to have these be placed in a specific order
foreach (PreferenceTabAddin tabAddin in addin_manager.GetPreferenceTabAddins ()) {
Logger.Debug ("Adding preference tab addin: {0}", tabAddin.GetType ().Name);
try {
string tabName;
Gtk.Widget tabWidget;
if (tabAddin.GetPreferenceTabWidget (this, out tabName, out tabWidget) == true) {
notebook.AppendPage (tabWidget, new Gtk.Label (tabName));
}
} catch (Exception e) {
Logger.Warn ("Problems adding preferences tab addin: {0}", tabAddin.GetType ().Name);
Logger.Debug ("{0}:\n{1}", e.Message, e.StackTrace);
}
}
Gtk.VBox VBox = new Gtk.VBox ();
VBox.PackStart (notebook, true, true, 0);
addin_manager.ApplicationAddinListChanged += OnAppAddinListChanged;
// Close Button
Gtk.Button button = new Gtk.Button (Gtk.Stock.Close);
button.CanDefault = true;
button.Label = "Close";
button.Clicked += OnClickedClose;
VBox.Add (button);
button.Show ();
Gtk.AccelGroup accel_group = new Gtk.AccelGroup ();
AddAccelGroup (accel_group);
button.AddAccelerator ("activate", accel_group, (uint)Gdk.Key.Escape, 0, 0);
this.Add (VBox);
if ((this.Child != null)) {
this.Child.ShowAll ();
}
this.Show ();
Preferences.SettingChanged += HandlePreferencesSettingChanged;
}
示例7: InitializeDialog
//.........这里部分代码省略.........
HasSeparator = false;
DefaultResponse = ResponseType.Ok;
VBox.Spacing = 6;
HBox split_box = new HBox ();
split_box.Spacing = 12;
split_box.BorderWidth = 6;
Image image = new Image ();
image.IconSize = (int)IconSize.Dialog;
image.IconName = "radio";
image.Yalign = 0.0f;
image.Show ();
VBox main_box = new VBox ();
main_box.BorderWidth = 5;
main_box.Spacing = 10;
Label header = new Label ();
header.Text = String.Format (AddinManager.CurrentLocalizer.GetString ("{0}Radiostation fetcher{1}\n({2})"),
"<span weight=\"bold\" size=\"larger\">", "</span>",source_name);
header.Xalign = 0.0f;
header.Yalign = 0.0f;
header.UseMarkup = true;
header.Wrap = true;
header.Show ();
Label message = new Label ();
message.Text = AddinManager.CurrentLocalizer.GetString ("Choose a genre or enter a text that you wish to be queried, " +
"then press the Get stations button. Found stations will be added to internet-radio source.");
message.Xalign = 0.0f;
message.Wrap = true;
message.Show ();
table = new Table (5, 2, false);
table.RowSpacing = 6;
table.ColumnSpacing = 6;
genre_entry = ComboBox.NewText ();
freeText_entry = new Entry ();
genre_button = new Button (AddinManager.CurrentLocalizer.GetString ("Get stations"));
freeText_button = new Button (AddinManager.CurrentLocalizer.GetString ("Get stations"));
genre_button.CanDefault = true;
genre_button.UseStock = true;
genre_button.Clicked += OnGenreQueryButtonClick;
genre_button.Show ();
freeText_button.CanDefault = true;
freeText_button.UseStock = true;
freeText_button.Clicked += OnFreetextQueryButtonClick;
freeText_button.Show ();
foreach (string genre in genre_list) {
if (!String.IsNullOrEmpty (genre))
genre_entry.AppendText (genre);
}
if (this is IGenreSearchable) {
AddRow (AddinManager.CurrentLocalizer.GetString ("Query by genre:"), genre_entry, genre_button);
}
if (this is IFreetextSearchable) {
AddRow (AddinManager.CurrentLocalizer.GetString ("Query by free text:"), freeText_entry, freeText_button);
}
table.ShowAll ();
main_box.PackStart (header, false, false, 0);
main_box.PackStart (message, false, false, 0);
main_box.PackStart (table, false, false, 0);
main_box.Show ();
split_box.PackStart (image, false, false, 0);
split_box.PackStart (main_box, true, true, 0);
split_box.Show ();
VBox.PackStart (split_box, true, true, 0);
close_button = new Button ();
close_button.Image = new Image ("gtk-close", IconSize.Button);
close_button.Label = AddinManager.CurrentLocalizer.GetString ("_Close");
close_button.CanDefault = true;
close_button.UseStock = true;
close_button.Show ();
AddActionWidget (close_button, ResponseType.Close);
close_button.AddAccelerator ("activate", accel_group, (uint)Gdk.Key.Escape,
0, Gtk.AccelFlags.Visible);
close_button.Clicked += OnCloseButtonClick;
statusbar = new Statusbar ();
statusbar.HasResizeGrip = false;
SetStatusBarMessage (source_name);
main_box.PackEnd (statusbar, false, false, 0);
}
示例8: BuildUI
private void BuildUI()
{
// The BorderWidth situation here is a bit nuts b/c the
// ActionArea's is set to 5. So we work everything else out
// so it all totals to 12.
//
// WIDGET BorderWidth
// Dialog 5
// VBox 2
// inner_vbox 5 => total = 12
// ActionArea 5 => total = 12
BorderWidth = 5;
base.VBox.BorderWidth = 0;
// This spacing is 2 b/c the inner_vbox and ActionArea should be
// 12 apart, and they already have BorderWidth 5 each
base.VBox.Spacing = 2;
inner_vbox = new VBox () { Spacing = 12, BorderWidth = 5, Visible = true };
base.VBox.PackStart (inner_vbox, true, true, 0);
Visible = false;
HasSeparator = false;
var table = new Table (3, 2, false) {
RowSpacing = 12,
ColumnSpacing = 16
};
table.Attach (new Image () {
IconName = "dialog-error",
IconSize = (int)IconSize.Dialog,
Yalign = 0.0f
}, 0, 1, 0, 3, AttachOptions.Shrink, AttachOptions.Fill | AttachOptions.Expand, 0, 0);
table.Attach (header_label = new Label () { Xalign = 0.0f }, 1, 2, 0, 1,
AttachOptions.Fill | AttachOptions.Expand,
AttachOptions.Shrink, 0, 0);
table.Attach (message_label = new Hyena.Widgets.WrapLabel (), 1, 2, 1, 2,
AttachOptions.Fill | AttachOptions.Expand,
AttachOptions.Shrink, 0, 0);
var scrolled_window = new ScrolledWindow () {
HscrollbarPolicy = PolicyType.Automatic,
VscrollbarPolicy = PolicyType.Automatic,
ShadowType = ShadowType.In
};
list_view = new TreeView () {
HeightRequest = 120,
WidthRequest = 200
};
scrolled_window.Add (list_view);
table.Attach (details_expander = new Expander (Catalog.GetString ("Details")),
1, 2, 2, 3,
AttachOptions.Fill | AttachOptions.Expand,
AttachOptions.Fill | AttachOptions.Expand,
0, 0);
details_expander.Add (scrolled_window);
VBox.PackStart (table, true, true, 0);
VBox.Spacing = 12;
VBox.ShowAll ();
accel_group = new AccelGroup ();
AddAccelGroup (accel_group);
Button button = new Button (Stock.Close);
button.CanDefault = true;
button.UseStock = true;
button.Show ();
button.Clicked += (o, a) => {
Destroy ();
};
AddActionWidget (button, ResponseType.Close);
DefaultResponse = ResponseType.Close;
button.AddAccelerator ("activate", accel_group, (uint)Gdk.Key.Return, 0, AccelFlags.Visible);
}
示例9: ArtistAdder
public ArtistAdder()
: base()
{
string title = Catalog.GetString("Add new SoundCloud artist");
AccelGroup accel_group = new AccelGroup();
AddAccelGroup(accel_group);
Title = title;
SkipTaskbarHint = true;
Modal = true;
BorderWidth = 6;
HasSeparator = false;
DefaultResponse = ResponseType.Ok;
Modal = true;
VBox.Spacing = 6;
HBox split_box = new HBox();
split_box.Spacing = 12;
split_box.BorderWidth = 6;
/* TODO:
* Get this bloody image to display.
Image image = new Image("soundcloud");
image.IconSize =(int)IconSize.Dialog;
image.IconName = "soundcloudd";
image.Yalign = 0.0f;
image.Show();
*/
VBox main_box = new VBox();
main_box.BorderWidth = 5;
main_box.Spacing = 10;
Label header = new Label();
header.Markup = String.Format("<big><b>{0}</b></big>", GLib.Markup.EscapeText(title));
header.Xalign = 0.0f;
header.Show();
Label message = new Label();
message.Text = Catalog.GetString("Enter the name of the artist you'd like to add.");
message.Xalign = 0.0f;
message.Wrap = true;
message.Show();
table = new Table(5, 2, false);
table.RowSpacing = 6;
table.ColumnSpacing = 6;
artist_entry = AddEntryRow(Catalog.GetString("Artist Name:"));
table.ShowAll();
main_box.PackStart(header, false, false, 0);
main_box.PackStart(message, false, false, 0);
main_box.PackStart(table, false, false, 0);
main_box.Show();
//split_box.PackStart(image, false, false, 0);
split_box.PackStart(main_box, true, true, 0);
split_box.Show();
VBox.PackStart(split_box, true, true, 0);
Button cancel_button = new Button(Stock.Cancel);
cancel_button.CanDefault = false;
cancel_button.UseStock = true;
cancel_button.Show();
AddActionWidget(cancel_button, ResponseType.Close);
cancel_button.AddAccelerator("activate", accel_group,(uint)Gdk.Key.Escape,
0, Gtk.AccelFlags.Visible);
save_button = new Button(Stock.Save);
save_button.CanDefault = true;
save_button.UseStock = true;
save_button.Sensitive = false;
save_button.Show();
AddActionWidget(save_button, ResponseType.Ok);
save_button.AddAccelerator("activate", accel_group,(uint)Gdk.Key.Return,
0, Gtk.AccelFlags.Visible);
artist_entry.HasFocus = true;
error_container = new Alignment(0.0f, 0.0f, 1.0f, 1.0f);
error_container.TopPadding = 6;
HBox error_box = new HBox();
error_box.Spacing = 4;
Image error_image = new Image();
error_image.Stock = Stock.DialogError;
error_image.IconSize =(int)IconSize.Menu;
error_image.Show();
error = new Label();
error.Xalign = 0.0f;
error.Show();
//.........这里部分代码省略.........
示例10: PreferencesDialog
// Entry sipServerAddressEntry;
// Entry sipUsernameEntry;
// Entry sipPasswordEntry;
public PreferencesDialog()
: base()
{
SetDefaultSize (600, 600);
WindowPosition = WindowPosition.Center;
IconName = "rtc";
HasSeparator = false;
BorderWidth = 5;
Resizable = true;
Title = Catalog.GetString ("Banter Preferences");
VBox.Spacing = 5;
ActionArea.Layout = ButtonBoxStyle.End;
// Notebook Tabs (General, Messages)...
Gtk.Notebook notebook = new Notebook ();
notebook.TabPos = PositionType.Top;
notebook.BorderWidth = 5;
notebook.Show ();
// notebook.AppendPage (MakeGeneralPage (),
// new Label (Catalog.GetString ("General")));
notebook.AppendPage (MakeAccountsPage (),
new Label (Catalog.GetString ("Accounts")));
notebook.AppendPage (MakeMessagesPage (),
new Label (Catalog.GetString ("Messages")));
VBox.PackStart (notebook, true, true, 0);
// Close button...
Button button = new Button (Stock.Close);
button.CanDefault = true;
button.Show ();
AccelGroup accelGroup = new AccelGroup ();
AddAccelGroup (accelGroup);
button.AddAccelerator ("activate",
accelGroup,
(uint) Gdk.Key.Escape,
0,
0);
AddActionWidget (button, ResponseType.Close);
DefaultResponse = ResponseType.Close;
Realized += DialogRealized;
Preferences.PreferenceChanged += PreferenceChanged;
ShowAll ();
}