Mercurial > repos > IBDev-IBBoard.WarFoundry.GUI.GTK
annotate gtk-gui/generated.cs @ 139:d4b726cec12c
Fixes #326: Make army names and sizes modifiable after creation
* Only invoke command on change
* Make use of new "generate default name" function for consistency
* Commit missed auto-generated code file
author | IBBoard <dev@ibboard.co.uk> |
---|---|
date | Wed, 12 Oct 2011 20:36:02 +0100 |
parents | 68804784bf6f |
children | 135491fd1830 |
rev | line source |
---|---|
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 | |
77
68804784bf6f
Re #86: Complete initial GTK# UI
IBBoard <dev@ibboard.co.uk>
parents:
40
diff
changeset
|
9 internal static void Initialize(Gtk.Widget iconRenderer) |
40 | 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 else | |
28 { | |
29 int sz; | |
30 int sy; | |
77
68804784bf6f
Re #86: Complete initial GTK# UI
IBBoard <dev@ibboard.co.uk>
parents:
40
diff
changeset
|
31 global::Gtk.Icon.SizeLookup(size, out sz, out sy); |
40 | 32 try |
33 { | |
34 return Gtk.IconTheme.Default.LoadIcon(name, sz, 0); | |
35 } | |
36 catch (System.Exception) | |
37 { | |
38 if ((name != "gtk-missing-image")) | |
39 { | |
40 return Stetic.IconLoader.LoadIcon(widget, "gtk-missing-image", size); | |
41 } | |
42 else | |
43 { | |
44 Gdk.Pixmap pmap = new Gdk.Pixmap(Gdk.Screen.Default.RootWindow, sz, sz); | |
45 Gdk.GC gc = new Gdk.GC(pmap); | |
46 gc.RgbFgColor = new Gdk.Color(255, 255, 255); | |
47 pmap.DrawRectangle(gc, true, 0, 0, sz, sz); | |
48 gc.RgbFgColor = new Gdk.Color(0, 0, 0); | |
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 } | |
56 } | |
57 } | |
58 } | |
59 } | |
60 | |
61 internal class BinContainer | |
62 { | |
63 private Gtk.Widget child; | |
64 private Gtk.UIManager uimanager; | |
65 | |
66 public static BinContainer Attach(Gtk.Bin bin) | |
67 { | |
68 BinContainer bc = new BinContainer(); | |
69 bin.SizeRequested += new Gtk.SizeRequestedHandler(bc.OnSizeRequested); | |
70 bin.SizeAllocated += new Gtk.SizeAllocatedHandler(bc.OnSizeAllocated); | |
71 bin.Added += new Gtk.AddedHandler(bc.OnAdded); | |
72 return bc; | |
73 } | |
74 | |
75 private void OnSizeRequested(object sender, Gtk.SizeRequestedArgs args) | |
76 { | |
77 if ((this.child != null)) | |
78 { | |
79 args.Requisition = this.child.SizeRequest(); | |
80 } | |
81 } | |
82 | |
83 private void OnSizeAllocated(object sender, Gtk.SizeAllocatedArgs args) | |
84 { | |
85 if ((this.child != null)) | |
86 { | |
87 this.child.Allocation = args.Allocation; | |
88 } | |
89 } | |
90 | |
91 private void OnAdded(object sender, Gtk.AddedArgs args) | |
92 { | |
93 this.child = args.Widget; | |
94 } | |
95 | |
96 public void SetUiManager(Gtk.UIManager uim) | |
97 { | |
98 this.uimanager = uim; | |
99 this.child.Realized += new System.EventHandler(this.OnRealized); | |
100 } | |
101 | |
102 private void OnRealized(object sender, System.EventArgs args) | |
103 { | |
104 if ((this.uimanager != null)) | |
105 { | |
106 Gtk.Widget w; | |
107 w = this.child.Toplevel; | |
108 if (((w != null) && typeof(Gtk.Window).IsInstanceOfType(w))) | |
109 { | |
110 ((Gtk.Window)(w)).AddAccelGroup(this.uimanager.AccelGroup); | |
111 this.uimanager = null; | |
112 } | |
113 } | |
114 } | |
115 } | |
116 | |
117 internal class ActionGroups | |
118 { | |
119 public static Gtk.ActionGroup GetActionGroup(System.Type type) | |
120 { | |
121 return Stetic.ActionGroups.GetActionGroup(type.FullName); | |
122 } | |
123 | |
124 public static Gtk.ActionGroup GetActionGroup(string name) | |
125 { | |
126 return null; | |
127 } | |
128 } | |
0 | 129 } |