我有一个继承按钮的类,它看起来像这样:
public class MyButton : Button {
Gtk.Image image; // This doesn't work
}
我需要启动一个属于“MyButton”类的 GTK Widget。然而,我真的做不到。谢谢!
很难说出你到底想做什么......如果你想设置 GtkButton 的图像属性(参见http://developer.gnome.org/gtk/stable/GtkButton.html#GtkButton- -image),这样的事情应该可以工作:
public class MyButton : Gtk.Button {
public MyButton (Gtk.Image image) {
GLib.Object ();
this.image = image;
}
}