本文整理汇总了C#中Gtk.Dialog.AddAccelGroup方法的典型用法代码示例。如果您正苦于以下问题:C# Dialog.AddAccelGroup方法的具体用法?C# Dialog.AddAccelGroup怎么用?C# Dialog.AddAccelGroup使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Gtk.Dialog
的用法示例。
在下文中一共展示了Dialog.AddAccelGroup方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: CreateWidget
protected override Gtk.Widget CreateWidget(WindowContext context)
{
Window win;
if(HasAttribute("dialog"))
{
Dialog dialog = new Dialog();
dialog.AddAccelGroup(context.AccelGroup);
SetWindowAttribs(dialog);
if(Child != null)
dialog.VBox.Add(Child.Build(context));
foreach(string s in GetAttribute<Array>("dialog"))
{
string[] bits = s.Split(':');
string text = bits[0];
int response = 0;
if(bits.Length > 4)
throw new Exception("Neplatný počet parametrů tlačítka v poli tlačítek dialogu");
if(bits.Length > 1)
response = (int)IntLiteral.Parse(bits[1]);
Label l = new Label();
l.Markup = text;
Button btn;
if(bits.Length > 2 && !String.IsNullOrEmpty(bits[2]))
{
HBox hbox = new HBox(false, 0);
hbox.PackStart(ImageExpression.CreateImage(bits[2], IconSize.Button));
hbox.PackStart(l);
btn = new Button(hbox);
}
else
btn = new Button(l);
btn.ShowAll();
dialog.AddActionWidget(btn, response);
if(bits.Length > 3)
{
switch(bits[3].ToLower())
{
case "default":
btn.CanDefault = true;
dialog.Default = btn;
break;
case "cancel":
// set as cancel action - how?
break;
case "":
case "none":
break;
default:
throw new Exception("Neznámý příznak tlačítka dialogu");
}
}
}
win = dialog;
}
else
{
win = new Window(Gtk.WindowType.Toplevel);
win.AddAccelGroup(context.AccelGroup);
if(Child != null)
win.Add(Child.Build(context));
}
if(HasAttribute("iconset"))
{
IconSet icons = IconFactory.LookupDefault(GetAttribute<string>("iconset"));
List<Gdk.Pixbuf> list = new List<Gdk.Pixbuf>();
foreach(IconSize size in icons.Sizes)
{
list.Add(icons.RenderIcon(win.Style, TextDirection.Ltr, StateType.Normal, size, win, ""));
}
win.IconList = list.ToArray();
}
return win;
}