Mercurial > repos > IBDev-IBBoard.WarFoundry.GUI.GTK
comparison gtk-gui/generated.cs @ 145:135491fd1830
* Commit reformatted auto-generated code, because MonoDevelop changed its behaviour and now always uses its own format, not user format, for autogen code
author | IBBoard <dev@ibboard.co.uk> |
---|---|
date | Sat, 12 Nov 2011 19:53:26 +0000 |
parents | 68804784bf6f |
children | 7b091ea86819 |
comparison
equal
deleted
inserted
replaced
144:929ef50c3919 | 145:135491fd1830 |
---|---|
3 namespace Stetic | 3 namespace Stetic |
4 { | 4 { |
5 internal class Gui | 5 internal class Gui |
6 { | 6 { |
7 private static bool initialized; | 7 private static bool initialized; |
8 | 8 |
9 internal static void Initialize(Gtk.Widget iconRenderer) | 9 internal static void Initialize (Gtk.Widget iconRenderer) |
10 { | 10 { |
11 if ((Stetic.Gui.initialized == false)) | 11 if ((Stetic.Gui.initialized == false)) { |
12 { | |
13 Stetic.Gui.initialized = true; | 12 Stetic.Gui.initialized = true; |
14 } | 13 } |
15 } | 14 } |
16 } | 15 } |
17 | 16 |
18 internal class IconLoader | 17 internal class IconLoader |
19 { | 18 { |
20 public static Gdk.Pixbuf LoadIcon(Gtk.Widget widget, string name, Gtk.IconSize size) | 19 public static Gdk.Pixbuf LoadIcon (Gtk.Widget widget, string name, Gtk.IconSize size) |
21 { | 20 { |
22 Gdk.Pixbuf res = widget.RenderIcon(name, size, null); | 21 Gdk.Pixbuf res = widget.RenderIcon (name, size, null); |
23 if ((res != null)) | 22 if ((res != null)) { |
24 { | |
25 return res; | 23 return res; |
26 } | 24 } else { |
27 else | |
28 { | |
29 int sz; | 25 int sz; |
30 int sy; | 26 int sy; |
31 global::Gtk.Icon.SizeLookup(size, out sz, out sy); | 27 global::Gtk.Icon.SizeLookup (size, out sz, out sy); |
32 try | 28 try { |
33 { | 29 return Gtk.IconTheme.Default.LoadIcon (name, sz, 0); |
34 return Gtk.IconTheme.Default.LoadIcon(name, sz, 0); | 30 } catch (System.Exception) { |
35 } | 31 if ((name != "gtk-missing-image")) { |
36 catch (System.Exception) | 32 return Stetic.IconLoader.LoadIcon (widget, "gtk-missing-image", size); |
37 { | 33 } else { |
38 if ((name != "gtk-missing-image")) | 34 Gdk.Pixmap pmap = new Gdk.Pixmap (Gdk.Screen.Default.RootWindow, sz, sz); |
39 { | 35 Gdk.GC gc = new Gdk.GC (pmap); |
40 return Stetic.IconLoader.LoadIcon(widget, "gtk-missing-image", size); | 36 gc.RgbFgColor = new Gdk.Color (255, 255, 255); |
41 } | 37 pmap.DrawRectangle (gc, true, 0, 0, sz, sz); |
42 else | 38 gc.RgbFgColor = new Gdk.Color (0, 0, 0); |
43 { | 39 pmap.DrawRectangle (gc, false, 0, 0, (sz - 1), (sz - 1)); |
44 Gdk.Pixmap pmap = new Gdk.Pixmap(Gdk.Screen.Default.RootWindow, sz, sz); | 40 gc.SetLineAttributes (3, Gdk.LineStyle.Solid, Gdk.CapStyle.Round, Gdk.JoinStyle.Round); |
45 Gdk.GC gc = new Gdk.GC(pmap); | 41 gc.RgbFgColor = new Gdk.Color (255, 0, 0); |
46 gc.RgbFgColor = new Gdk.Color(255, 255, 255); | 42 pmap.DrawLine (gc, (sz / 4), (sz / 4), ((sz - 1) - (sz / 4)), ((sz - 1) - (sz / 4))); |
47 pmap.DrawRectangle(gc, true, 0, 0, sz, sz); | 43 pmap.DrawLine (gc, ((sz - 1) - (sz / 4)), (sz / 4), (sz / 4), ((sz - 1) - (sz / 4))); |
48 gc.RgbFgColor = new Gdk.Color(0, 0, 0); | 44 return Gdk.Pixbuf.FromDrawable (pmap, pmap.Colormap, 0, 0, 0, 0, sz, sz); |
49 pmap.DrawRectangle(gc, false, 0, 0, (sz - 1), (sz - 1)); | |
50 gc.SetLineAttributes(3, Gdk.LineStyle.Solid, Gdk.CapStyle.Round, Gdk.JoinStyle.Round); | |
51 gc.RgbFgColor = new Gdk.Color(255, 0, 0); | |
52 pmap.DrawLine(gc, (sz / 4), (sz / 4), ((sz - 1) - (sz / 4)), ((sz - 1) - (sz / 4))); | |
53 pmap.DrawLine(gc, ((sz - 1) - (sz / 4)), (sz / 4), (sz / 4), ((sz - 1) - (sz / 4))); | |
54 return Gdk.Pixbuf.FromDrawable(pmap, pmap.Colormap, 0, 0, 0, 0, sz, sz); | |
55 } | 45 } |
56 } | 46 } |
57 } | 47 } |
58 } | 48 } |
59 } | 49 } |
60 | 50 |
61 internal class BinContainer | 51 internal class BinContainer |
62 { | 52 { |
63 private Gtk.Widget child; | 53 private Gtk.Widget child; |
64 private Gtk.UIManager uimanager; | 54 private Gtk.UIManager uimanager; |
65 | 55 |
66 public static BinContainer Attach(Gtk.Bin bin) | 56 public static BinContainer Attach (Gtk.Bin bin) |
67 { | 57 { |
68 BinContainer bc = new BinContainer(); | 58 BinContainer bc = new BinContainer (); |
69 bin.SizeRequested += new Gtk.SizeRequestedHandler(bc.OnSizeRequested); | 59 bin.SizeRequested += new Gtk.SizeRequestedHandler (bc.OnSizeRequested); |
70 bin.SizeAllocated += new Gtk.SizeAllocatedHandler(bc.OnSizeAllocated); | 60 bin.SizeAllocated += new Gtk.SizeAllocatedHandler (bc.OnSizeAllocated); |
71 bin.Added += new Gtk.AddedHandler(bc.OnAdded); | 61 bin.Added += new Gtk.AddedHandler (bc.OnAdded); |
72 return bc; | 62 return bc; |
73 } | 63 } |
74 | 64 |
75 private void OnSizeRequested(object sender, Gtk.SizeRequestedArgs args) | 65 private void OnSizeRequested (object sender, Gtk.SizeRequestedArgs args) |
76 { | 66 { |
77 if ((this.child != null)) | 67 if ((this.child != null)) { |
78 { | 68 args.Requisition = this.child.SizeRequest (); |
79 args.Requisition = this.child.SizeRequest(); | |
80 } | 69 } |
81 } | 70 } |
82 | 71 |
83 private void OnSizeAllocated(object sender, Gtk.SizeAllocatedArgs args) | 72 private void OnSizeAllocated (object sender, Gtk.SizeAllocatedArgs args) |
84 { | 73 { |
85 if ((this.child != null)) | 74 if ((this.child != null)) { |
86 { | |
87 this.child.Allocation = args.Allocation; | 75 this.child.Allocation = args.Allocation; |
88 } | 76 } |
89 } | 77 } |
90 | 78 |
91 private void OnAdded(object sender, Gtk.AddedArgs args) | 79 private void OnAdded (object sender, Gtk.AddedArgs args) |
92 { | 80 { |
93 this.child = args.Widget; | 81 this.child = args.Widget; |
94 } | 82 } |
95 | 83 |
96 public void SetUiManager(Gtk.UIManager uim) | 84 public void SetUiManager (Gtk.UIManager uim) |
97 { | 85 { |
98 this.uimanager = uim; | 86 this.uimanager = uim; |
99 this.child.Realized += new System.EventHandler(this.OnRealized); | 87 this.child.Realized += new System.EventHandler (this.OnRealized); |
100 } | 88 } |
101 | 89 |
102 private void OnRealized(object sender, System.EventArgs args) | 90 private void OnRealized (object sender, System.EventArgs args) |
103 { | 91 { |
104 if ((this.uimanager != null)) | 92 if ((this.uimanager != null)) { |
105 { | |
106 Gtk.Widget w; | 93 Gtk.Widget w; |
107 w = this.child.Toplevel; | 94 w = this.child.Toplevel; |
108 if (((w != null) && typeof(Gtk.Window).IsInstanceOfType(w))) | 95 if (((w != null) && typeof(Gtk.Window).IsInstanceOfType (w))) { |
109 { | 96 ((Gtk.Window)(w)).AddAccelGroup (this.uimanager.AccelGroup); |
110 ((Gtk.Window)(w)).AddAccelGroup(this.uimanager.AccelGroup); | |
111 this.uimanager = null; | 97 this.uimanager = null; |
112 } | 98 } |
113 } | 99 } |
114 } | 100 } |
115 } | 101 } |
116 | 102 |
117 internal class ActionGroups | 103 internal class ActionGroups |
118 { | 104 { |
119 public static Gtk.ActionGroup GetActionGroup(System.Type type) | 105 public static Gtk.ActionGroup GetActionGroup (System.Type type) |
120 { | 106 { |
121 return Stetic.ActionGroups.GetActionGroup(type.FullName); | 107 return Stetic.ActionGroups.GetActionGroup (type.FullName); |
122 } | 108 } |
123 | 109 |
124 public static Gtk.ActionGroup GetActionGroup(string name) | 110 public static Gtk.ActionGroup GetActionGroup (string name) |
125 { | 111 { |
126 return null; | 112 return null; |
127 } | 113 } |
128 } | 114 } |
129 } | 115 } |