40
|
1
|
|
2 // This file has been generated by the GUI designer. Do not modify.
|
|
3 namespace Stetic
|
|
4 {
|
|
5 internal class Gui
|
|
6 {
|
|
7 private static bool initialized;
|
|
8
|
|
9 static internal void Initialize(Gtk.Widget iconRenderer)
|
|
10 {
|
|
11 if ((Stetic.Gui.initialized == false))
|
|
12 {
|
|
13 Stetic.Gui.initialized = true;
|
|
14 }
|
|
15 }
|
|
16 }
|
|
17
|
|
18 internal class IconLoader
|
|
19 {
|
|
20 public static Gdk.Pixbuf LoadIcon(Gtk.Widget widget, string name, Gtk.IconSize size)
|
|
21 {
|
|
22 Gdk.Pixbuf res = widget.RenderIcon(name, size, null);
|
|
23 if ((res != null))
|
|
24 {
|
|
25 return res;
|
|
26 }
|
|
27
|
|
28 else
|
|
29 {
|
|
30 int sz;
|
|
31 int sy;
|
|
32 global::Gtk.Icon.SizeLookup(size, out sz, out sy);
|
|
33 try
|
|
34 {
|
|
35 return Gtk.IconTheme.Default.LoadIcon(name, sz, 0);
|
|
36 }
|
|
37 catch (System.Exception)
|
|
38 {
|
|
39 if ((name != "gtk-missing-image"))
|
|
40 {
|
|
41 return Stetic.IconLoader.LoadIcon(widget, "gtk-missing-image", size);
|
|
42 }
|
|
43
|
|
44 else
|
|
45 {
|
|
46 Gdk.Pixmap pmap = new Gdk.Pixmap(Gdk.Screen.Default.RootWindow, sz, sz);
|
|
47 Gdk.GC gc = new Gdk.GC(pmap);
|
|
48 gc.RgbFgColor = new Gdk.Color(255, 255, 255);
|
|
49 pmap.DrawRectangle(gc, true, 0, 0, sz, sz);
|
|
50 gc.RgbFgColor = new Gdk.Color(0, 0, 0);
|
|
51 pmap.DrawRectangle(gc, false, 0, 0, (sz - 1), (sz - 1));
|
|
52 gc.SetLineAttributes(3, Gdk.LineStyle.Solid, Gdk.CapStyle.Round, Gdk.JoinStyle.Round);
|
|
53 gc.RgbFgColor = new Gdk.Color(255, 0, 0);
|
|
54 pmap.DrawLine(gc, (sz / 4), (sz / 4), ((sz - 1) - (sz / 4)), ((sz - 1) - (sz / 4)));
|
|
55 pmap.DrawLine(gc, ((sz - 1) - (sz / 4)), (sz / 4), (sz / 4), ((sz - 1) - (sz / 4)));
|
|
56 return Gdk.Pixbuf.FromDrawable(pmap, pmap.Colormap, 0, 0, 0, 0, sz, sz);
|
|
57 }
|
|
58 }
|
|
59 }
|
|
60 }
|
|
61 }
|
|
62
|
|
63 internal class BinContainer
|
|
64 {
|
|
65 private Gtk.Widget child;
|
0
|
66
|
40
|
67 private Gtk.UIManager uimanager;
|
|
68
|
|
69 public static BinContainer Attach(Gtk.Bin bin)
|
|
70 {
|
|
71 BinContainer bc = new BinContainer();
|
|
72 bin.SizeRequested += new Gtk.SizeRequestedHandler(bc.OnSizeRequested);
|
|
73 bin.SizeAllocated += new Gtk.SizeAllocatedHandler(bc.OnSizeAllocated);
|
|
74 bin.Added += new Gtk.AddedHandler(bc.OnAdded);
|
|
75 return bc;
|
|
76 }
|
|
77
|
|
78 private void OnSizeRequested(object sender, Gtk.SizeRequestedArgs args)
|
|
79 {
|
|
80 if ((this.child != null))
|
|
81 {
|
|
82 args.Requisition = this.child.SizeRequest();
|
|
83 }
|
|
84 }
|
|
85
|
|
86 private void OnSizeAllocated(object sender, Gtk.SizeAllocatedArgs args)
|
|
87 {
|
|
88 if ((this.child != null))
|
|
89 {
|
|
90 this.child.Allocation = args.Allocation;
|
|
91 }
|
|
92 }
|
|
93
|
|
94 private void OnAdded(object sender, Gtk.AddedArgs args)
|
|
95 {
|
|
96 this.child = args.Widget;
|
|
97 }
|
|
98
|
|
99 public void SetUiManager(Gtk.UIManager uim)
|
|
100 {
|
|
101 this.uimanager = uim;
|
|
102 this.child.Realized += new System.EventHandler(this.OnRealized);
|
|
103 }
|
|
104
|
|
105 private void OnRealized(object sender, System.EventArgs args)
|
|
106 {
|
|
107 if ((this.uimanager != null))
|
|
108 {
|
|
109 Gtk.Widget w;
|
|
110 w = this.child.Toplevel;
|
|
111 if (((w != null) && typeof(Gtk.Window).IsInstanceOfType(w)))
|
|
112 {
|
|
113 ((Gtk.Window)(w)).AddAccelGroup(this.uimanager.AccelGroup);
|
|
114 this.uimanager = null;
|
|
115 }
|
|
116 }
|
|
117 }
|
|
118 }
|
|
119
|
|
120 internal class ActionGroups
|
|
121 {
|
|
122 public static Gtk.ActionGroup GetActionGroup(System.Type type)
|
|
123 {
|
|
124 return Stetic.ActionGroups.GetActionGroup(type.FullName);
|
|
125 }
|
|
126
|
|
127 public static Gtk.ActionGroup GetActionGroup(string name)
|
|
128 {
|
|
129 return null;
|
|
130 }
|
|
131 }
|
0
|
132 }
|