本文整理汇总了C#中Gtk.Button.Add方法的典型用法代码示例。如果您正苦于以下问题:C# Button.Add方法的具体用法?C# Button.Add怎么用?C# Button.Add使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Gtk.Button
的用法示例。
在下文中一共展示了Button.Add方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: FindBar
/*
* Constructor
*/
public FindBar (PhotoQuery query, TreeModel model) : base(new HBox())
{
this.query = query;
box = Child as HBox;
box.Spacing = 6;
box.BorderWidth = 2;
box.PackStart (new Label (Catalog.GetString ("Find:")), false, false, 0);
entry = new Entry ();
entry.Completion = new LogicEntryCompletion (entry, model);
entry.TextInserted += HandleEntryTextInserted;
entry.TextDeleted += HandleEntryTextDeleted;
entry.KeyPressEvent += HandleEntryKeyPress;
box.PackStart (entry, true, true, 0);
Button clear_button = new Gtk.Button ();
clear_button.Add (new Gtk.Image ("gtk-close", Gtk.IconSize.Button));
clear_button.Clicked += HandleCloseButtonClicked;
clear_button.Relief = Gtk.ReliefStyle.None;
box.PackStart (clear_button, false, false, 0);
}
示例2: NoteBookLabel
// Constructor
private NoteBookLabel(DI.Diagram diagram)
: base(1, 3, false)
{
_parent = null;
_diagram = diagram;
//this must change depending of the diagram's type
string diagramType = ((DI.SimpleSemanticModelElement)diagram.SemanticModel).TypeInfo;
_icon = GetIcon(diagramType);
//_icon = new Gdk.Pixbuf (new Gdk.Colorspace(), false, 8, 15, 15);
//_icon.Fill (0xffff0000);
//
Attach(new Gtk.Image(_icon), 0, 1, 0, 1);
//
_label = new Label(_diagram.Name);
Attach(_label, 1, 2, 0, 1);
//
Image image = new Image();
image.Stock = Gtk.Stock.Close;
_close_button = new Button();
_close_button.Add(image);
_close_button.HeightRequest = 20;
_close_button.WidthRequest = 20;
_close_button.Relief = Gtk.ReliefStyle.None;
_close_button.Clicked += OnCloseButtonClicked;
Tooltips ttips = new Tooltips ();
ttips.SetTip (_close_button, GettextCatalog.GetString ("Close diagram"), GettextCatalog.GetString ("Close diagram"));
//_close_button.
Attach(_close_button, 2, 3, 0, 1);
ShowAll();
}
示例3: ModelElementTypeViewer
public ModelElementTypeViewer(IBroadcaster hub)
{
_hub = hub;
base.PackStart(new Gtk.Label("Model Element type:"), false, false, 2);
_lblType = new Gtk.Label();
base.PackStart(_lblType, false, false, 2);
base.PackStart(new Gtk.Label(String.Empty), true, true, 0);
// "Up" button
Gtk.Image image = new Gtk.Image();
image.Stock = Gtk.Stock.GoUp;
_btnGoUp = new Gtk.Button();
_btnGoUp.Add(image);
_btnGoUp.Relief = Gtk.ReliefStyle.None;
_btnGoUp.Clicked += new EventHandler(OnGoUpButtonClicked);
_btnGoUp.Sensitive = false;
base.PackStart(_btnGoUp, false, false, 0);
// "Delete" button
image = new Gtk.Image();
image.Stock = Gtk.Stock.Delete;
Gtk.Button btnDelete = new Gtk.Button();
btnDelete.Add(image);
btnDelete.Relief = Gtk.ReliefStyle.None;
btnDelete.Clicked += new EventHandler(OnDeleteButtonClicked);
btnDelete.Sensitive = true;
base.PackStart(btnDelete, false, false, 0);
}
示例4: Tab
public Tab (string tabName)
{
if (tabName == null)
throw new ArgumentNullException ("tabName");
Label label = new Label (tabName);
label.Justify = Justification.Left;
label.UseUnderline = false;
Gtk.Image image = new Gtk.Image (Stock.Close, IconSize.Menu);
image.Xalign = 0.5f;
image.Yalign = 0.5f;
Button button = new Button ();
button.HeightRequest = 20;
button.WidthRequest = 20;
button.Relief = ReliefStyle.None;
button.CanFocus = false;
button.Clicked += delegate {
if (CloseButtonClicked != null)
CloseButtonClicked (this, EventArgs.Empty);
};
button.Add (image);
this.PackStart (label, true, true, 0);
this.PackEnd (button, false, false, 0);
this.ShowAll ();
}
示例5: ViewOrderDetailEdit
public ViewOrderDetailEdit() : base()
{
rex = new Regex(@"(?<int>\d*)?(?<sep>.)?(?<dec>\d*)?");
ni = (System.Globalization.NumberFormatInfo)System.Globalization.CultureInfo.CurrentUICulture.NumberFormat.Clone();
ni.NumberDecimalSeparator = ".";
this.Resize(this.NRows, this.NColumns+1 );
spinprice.FocusGrabbed += this.OnActive;
spinprice.IsEditable = false;
spinquant.FocusGrabbed += this.OnActive;
spinquant.IsEditable = false;
Button butclearprice;
butclearprice = new Button();
butclearprice.Add( new Image(Stock.Clear, IconSize.Button) );
butclearprice.Clicked += OnClearPrice;
butclearprice.CanFocus = false;
Button butclearquant;
butclearquant = new Button();
butclearquant.Add( new Image(Stock.Clear, IconSize.Button) );
butclearquant.Clicked += OnClearQuant;
butclearquant.CanFocus = false;
this.Attach(butclearprice,2,3,1,2,AttachOptions.Expand,AttachOptions.Fill,0,0);
this.Attach(butclearquant,2,3,2,3,AttachOptions.Expand,AttachOptions.Fill,0,0);
this.ShowAll();
}
示例6: ViewNameIcon
public ViewNameIcon() : base()
{
upbutton = new Button();
upbutton.Add( new Image(Stock.GoUp, IconSize.Button) );
upbutton.Clicked += OnUpClicked;
downbutton = new Button();
downbutton.Add( new Image(Stock.GoDown, IconSize.Button) );
downbutton.Clicked += OnDownClicked;
swindow = new ScrolledWindow();
view = new IconView();
CellRendererPixbuf cellicon= new CellRendererPixbuf();
CellRendererText celltext = new CellRendererText();
celltext.Xalign=0.5f;
view.PackStart(cellicon, false);
view.SetCellDataFunc(cellicon, CellRenderFunctions.RenderIcon);
view.PackStart(celltext, false);
view.SetCellDataFunc(celltext, CellRenderFunctions.RenderName);
view.SelectionMode = Gtk.SelectionMode.Browse;
view.SelectionChanged += OnSelectionChanged;
view.ItemActivated += OnRowActivated;
swindow.Add(view);
swindow.HscrollbarPolicy = PolicyType.Never;
swindow.VscrollbarPolicy = PolicyType.Automatic;
this.PackStart(upbutton, false, false, 0);
this.PackStart(swindow, true, true, 0);
this.PackStart(downbutton, false, false, 0);
store = new StoreBase();
view.Model=store.ViewModel;
ShowAll();
}
示例7: CreateSmallStockButton
public static Button CreateSmallStockButton(string stock)
{
Button button = new Button ();
Image image = new Image (stock, IconSize.Menu);
button.Add (image);
button.Relief = ReliefStyle.None;
image.Show ();
return button;
}
示例8: CreatePopupButton
Gtk.Widget CreatePopupButton ()
{
this.popupButton = new Gtk.Button {
WidthRequest = 20,
CanFocus = true
};
popupButton.Add (new Gtk.Arrow (Gtk.ArrowType.Down, Gtk.ShadowType.Out));
return popupButton;
}
示例9: create_button_stock_image
public static Button create_button_stock_image(String stockid,String tooltip){
Button tb = new Button(stockid);
tb.Remove(tb.Child);
VBox v = new VBox();
v.Add(new Gtk.Image(tb.RenderIcon(stockid,IconSize.SmallToolbar,tooltip)));
tb.Add(v);
tb.WidthRequest = 30;
tb.CanFocus = false;
tb.TooltipText = tooltip;
tb.HasTooltip = true;
return tb;
}
示例10: MakeButton
private Gtk.Button MakeButton (Gtk.HBox header, string icon, EventHandler handler)
{
Gtk.Button button = new Gtk.Button ();
Gtk.Image img = new Gtk.Image (icon, Gtk.IconSize.Button);
button.Add (img);
button.Relief = Gtk.ReliefStyle.None;
button.Clicked += handler;
header.PackStart (button, false, false, 0);
button.ShowAll ();
return button;
}
示例11: AddWidget
public void AddWidget(KeyAction action, string desc, HotKey key, int position)
{
uint row_top, row_bottom, col_left, col_right;
HBox box;
Label descLabel, keyLabel;
Button edit;
Gtk.Image editImage;
box = new HBox ();
box.Spacing = 5;
descLabel = new Label ();
descLabel.Markup = String.Format ("<b>{0}</b>", desc);
keyLabel = new Label ();
keyLabel.Markup = GLib.Markup.EscapeText (key.ToString());
edit = new Button ();
editImage = new Gtk.Image (LongoMatch.Gui.Helpers.Misc.LoadIcon ("longomatch-pencil", 24));
edit.Add (editImage);
box.PackStart (descLabel, true, true, 0);
box.PackStart (keyLabel, false, true, 0);
box.PackStart (edit, false, true, 0);
box.ShowAll ();
sgroup.AddWidget (keyLabel);
descLabel.Justify = Justification.Left;
descLabel.SetAlignment (0f, 0.5f);
edit.Clicked += (sender, e) => {
HotKey hotkey = Config.GUIToolkit.SelectHotkey (key);
if (hotkey != null) {
if (Config.Hotkeys.ActionsHotkeys.ContainsValue (hotkey)) {
Config.GUIToolkit.ErrorMessage (Catalog.GetString ("Hotkey already in use: ") +
GLib.Markup.EscapeText (hotkey.ToString()), this);
} else {
Config.Hotkeys.ActionsHotkeys[action] = hotkey;
Config.Save ();
keyLabel.Markup = GLib.Markup.EscapeText (hotkey.ToString());
}
}
};
row_top = (uint)(position / table.NColumns);
row_bottom = (uint)row_top + 1;
col_left = (uint)position % table.NColumns;
col_right = (uint)col_left + 1;
table.Attach (box, col_left, col_right, row_top, row_bottom);
}
示例12: ViewOrderEdit
public ViewOrderEdit() : base()
{
comboorder = new ComboBoxOrders();
comboorder.Changed += OnOrderChanged;
comboorder.WidthRequest = 200;
butneworder = new Button();
butneworder.Add( new Image(Stock.New, IconSize.Button) );
butneworder.Clicked += OnNewOrderClicked;
buteditorder = new Button();
buteditorder.Add( new Image(Stock.Edit, IconSize.Button) );
buteditorder.Clicked += OnEditOrderClicked;
butdelorder = new Button();
butdelorder.Add( new Image(Stock.Delete, IconSize.Button) );
butdelorder.Clicked += OnDeleteOrderClicked;
HBox hb = new HBox();
hb.PackStart(butdelorder, false, false, 0);
hb.PackStart(comboorder,true, true, 0 );
hb.PackStart(butneworder, false, false, 0 );
hb.PackStart(buteditorder, false,false,0 );
viewtot = new ViewOrderTotal();
view = new ViewOrderDetails();
view.HeaderVisible = true;
view.FilterColumn="OrderId";
view.SelectionChanged += OnOrderDetailChanged;
Frame frame = new Frame();
frame.Label = "Oder item";
viewdet = new ViewOrderDetailEdit();
frame.Add(viewdet);
pad = new KeyPad();
pad.Clicked += OnPadClicked;
PackStart(hb, false, true, 0);
PackStart(viewtot, false, true, 3);
PackStart(view, true, true, 3);
PackStart(frame, false, false,3);
PackStart(pad, false, true, 3);
}
示例13: TabLabel
public TabLabel(Label label, Gtk.Image icon)
: base(false, 2)
{
this.icon = icon;
this.PackStart (icon, false, true, 2);
title = label;
this.PackStart (title, true, true, 0);
btn = new Button ();
btn.Add (new Gtk.Image (GetType().Assembly, "MonoDevelop.Close.png"));
btn.Relief = ReliefStyle.None;
btn.SetSizeRequest (18, 18);
this.PackStart (btn, false, false, 2);
this.ClearFlag (WidgetFlags.CanFocus);
this.ShowAll ();
}
示例14: MainWindow
public MainWindow(HttpAgent httpAgent, IRepositoryFactory repositoryFactory)
: base(Gtk.WindowType.Toplevel)
{
this.httpAgent = httpAgent;
WindowPosition = WindowPosition.Center;
rekeningRepository = repositoryFactory.CreateRepository<IRekeningRepository>();
consumptieRepository = repositoryFactory.CreateRepository<IConsumptieRepository>();
// Rekeningen overzicht
rekeningOverzichtWidget = new RekeningOverzichtWidget();
rekeningOverzichtWidget.Refresh(rekeningRepository.GetAll());
rekeningOverzichtWidget.RekeningClicked += handleRekeningClicked;
// Afrekenen button
Pango.FontDescription fontDescription = Pango.FontDescription.FromString("Arial");
fontDescription.Size = 13000;
fontDescription.Weight = Pango.Weight.Bold;
Label afrekenenLabel = new Label("Afrekenen");
afrekenenLabel.ModifyFont(fontDescription);
afrekenenButton = new Button();
afrekenenButton.Add(afrekenenLabel);
afrekenenButton.Clicked += handleAfrekenenButtonClicked;
// Rechter panel (bestellingen)
bestellingenOverzichtWidget = new BestellingenOverzichtWidget();
box = new HBox(false, 3);
box.PackStart(rekeningOverzichtWidget);
box.PackStart(bestellingenOverzichtWidget);
// Main box
vbox = new VBox(false, 0);
vbox.PackStart(box);
vbox.PackEnd(afrekenenButton);
Add(vbox);
ShowAll();
this.DeleteEvent += OnDeleteEvent;
}
示例15: SetButtonIcon
static void SetButtonIcon (Button button, string stockIcon)
{
Alignment alignment = new Alignment (0.5f, 0.5f, 0f, 0f);
Label label = new Label (button.Label);
HBox hbox = new HBox (false, 2);
Image image = new Image ();
image.Pixbuf = Stetic.IconLoader.LoadIcon (button, stockIcon, IconSize.Button);
image.Show ();
hbox.Add (image);
label.Show ();
hbox.Add (label);
hbox.Show ();
alignment.Add (hbox);
button.Child.Destroy ();
alignment.Show ();
button.Add (alignment);
}