25
internal class IconLoader {
27
public static Gdk.Pixbuf LoadIcon(Gtk.Widget widget, string name, Gtk.IconSize size, int sz) {
28
Gdk.Pixbuf res = widget.RenderIcon(name, size, null);
34
return Gtk.IconTheme.Default.LoadIcon(name, sz, 0);
36
catch (System.Exception ) {
37
if ((name != "gtk-missing-image")) {
38
return Stetic.IconLoader.LoadIcon(widget, "gtk-missing-image", size, sz);
41
Gdk.Pixmap pmap = new Gdk.Pixmap(Gdk.Screen.Default.RootWindow, sz, sz);
42
Gdk.GC gc = new Gdk.GC(pmap);
43
gc.RgbFgColor = new Gdk.Color(255, 255, 255);
44
pmap.DrawRectangle(gc, true, 0, 0, sz, sz);
45
gc.RgbFgColor = new Gdk.Color(0, 0, 0);
46
pmap.DrawRectangle(gc, false, 0, 0, (sz - 1), (sz - 1));
47
gc.SetLineAttributes(3, Gdk.LineStyle.Solid, Gdk.CapStyle.Round, Gdk.JoinStyle.Round);
48
gc.RgbFgColor = new Gdk.Color(255, 0, 0);
49
pmap.DrawLine(gc, (sz / 4), (sz / 4), ((sz - 1) - (sz / 4)), ((sz - 1) - (sz / 4)));
50
pmap.DrawLine(gc, ((sz - 1) - (sz / 4)), (sz / 4), (sz / 4), ((sz - 1) - (sz / 4)));
51
return Gdk.Pixbuf.FromDrawable(pmap, pmap.Colormap, 0, 0, 0, 0, sz, sz);
58
internal class BinContainer {
60
private Gtk.Widget child;
62
private Gtk.UIManager uimanager;
64
public static BinContainer Attach(Gtk.Bin bin) {
65
BinContainer bc = new BinContainer();
66
bin.SizeRequested += new Gtk.SizeRequestedHandler(bc.OnSizeRequested);
67
bin.SizeAllocated += new Gtk.SizeAllocatedHandler(bc.OnSizeAllocated);
68
bin.Added += new Gtk.AddedHandler(bc.OnAdded);
72
private void OnSizeRequested(object sender, Gtk.SizeRequestedArgs args) {
73
if ((this.child != null)) {
74
args.Requisition = this.child.SizeRequest();
78
private void OnSizeAllocated(object sender, Gtk.SizeAllocatedArgs args) {
79
if ((this.child != null)) {
80
this.child.Allocation = args.Allocation;
84
private void OnAdded(object sender, Gtk.AddedArgs args) {
85
this.child = args.Widget;
88
public void SetUiManager(Gtk.UIManager uim) {
90
this.child.Realized += new System.EventHandler(this.OnRealized);
93
private void OnRealized(object sender, System.EventArgs args) {
94
if ((this.uimanager != null)) {
96
w = this.child.Toplevel;
97
if (((w != null) && typeof(Gtk.Window).IsInstanceOfType(w))) {
98
((Gtk.Window)(w)).AddAccelGroup(this.uimanager.AccelGroup);
99
this.uimanager = null;
25
105
internal class ActionGroups {
27
107
public static Gtk.ActionGroup GetActionGroup(System.Type type) {