1 // ------------------------------------------------------------------------------
3 // This code was generated by a tool.
6 // Changes to this file may cause incorrect behavior and will be lost if
7 // the code is regenerated.
9 // ------------------------------------------------------------------------------
16 private static bool initialized
;
18 internal static void Initialize(Gtk
.Widget iconRenderer
) {
19 if ((Stetic
.Gui
.initialized
== false)) {
20 Stetic
.Gui
.initialized
= true;
25 internal class BinContainer
{
27 private Gtk
.Widget child
;
29 private Gtk
.UIManager uimanager
;
31 public static BinContainer
Attach(Gtk
.Bin bin
) {
32 BinContainer bc
= new BinContainer();
33 bin
.SizeRequested
+= new Gtk
.SizeRequestedHandler(bc
.OnSizeRequested
);
34 bin
.SizeAllocated
+= new Gtk
.SizeAllocatedHandler(bc
.OnSizeAllocated
);
35 bin
.Added
+= new Gtk
.AddedHandler(bc
.OnAdded
);
39 private void OnSizeRequested(object sender
, Gtk
.SizeRequestedArgs args
) {
40 if ((this.child
!= null)) {
41 args
.Requisition
= this.child
.SizeRequest();
45 private void OnSizeAllocated(object sender
, Gtk
.SizeAllocatedArgs args
) {
46 if ((this.child
!= null)) {
47 this.child
.Allocation
= args
.Allocation
;
51 private void OnAdded(object sender
, Gtk
.AddedArgs args
) {
52 this.child
= args
.Widget
;
55 public void SetUiManager(Gtk
.UIManager uim
) {
57 this.child
.Realized
+= new System
.EventHandler(this.OnRealized
);
60 private void OnRealized(object sender
, System
.EventArgs args
) {
61 if ((this.uimanager
!= null)) {
63 w
= this.child
.Toplevel
;
64 if (((w
!= null) && typeof(Gtk
.Window
).IsInstanceOfType(w
))) {
65 ((Gtk
.Window
)(w
)).AddAccelGroup(this.uimanager
.AccelGroup
);
66 this.uimanager
= null;
72 internal class IconLoader
{
74 public static Gdk
.Pixbuf
LoadIcon(Gtk
.Widget widget
, string name
, Gtk
.IconSize size
, int sz
) {
75 Gdk
.Pixbuf res
= widget
.RenderIcon(name
, size
, null);
81 return Gtk
.IconTheme
.Default
.LoadIcon(name
, sz
, 0);
83 catch (System
.Exception
) {
84 if ((name
!= "gtk-missing-image")) {
85 return Stetic
.IconLoader
.LoadIcon(widget
, "gtk-missing-image", size
, sz
);
88 Gdk
.Pixmap pmap
= new Gdk
.Pixmap(Gdk
.Screen
.Default
.RootWindow
, sz
, sz
);
89 Gdk
.GC gc
= new Gdk
.GC(pmap
);
90 gc
.RgbFgColor
= new Gdk
.Color(255, 255, 255);
91 pmap
.DrawRectangle(gc
, true, 0, 0, sz
, sz
);
92 gc
.RgbFgColor
= new Gdk
.Color(0, 0, 0);
93 pmap
.DrawRectangle(gc
, false, 0, 0, (sz
- 1), (sz
- 1));
94 gc
.SetLineAttributes(3, Gdk
.LineStyle
.Solid
, Gdk
.CapStyle
.Round
, Gdk
.JoinStyle
.Round
);
95 gc
.RgbFgColor
= new Gdk
.Color(255, 0, 0);
96 pmap
.DrawLine(gc
, (sz
/ 4), (sz
/ 4), ((sz
- 1) - (sz
/ 4)), ((sz
- 1) - (sz
/ 4)));
97 pmap
.DrawLine(gc
, ((sz
- 1) - (sz
/ 4)), (sz
/ 4), (sz
/ 4), ((sz
- 1) - (sz
/ 4)));
98 return Gdk
.Pixbuf
.FromDrawable(pmap
, pmap
.Colormap
, 0, 0, 0, 0, sz
, sz
);
105 internal class ActionGroups
{
107 public static Gtk
.ActionGroup
GetActionGroup(System
.Type type
) {
108 return Stetic
.ActionGroups
.GetActionGroup(type
.FullName
);
111 public static Gtk
.ActionGroup
GetActionGroup(string name
) {