Merge pull request #8 from bl8/update-samples

Update most remaining samples to the new APIs
This commit is contained in:
Mike Kestner 2011-06-29 17:53:03 -07:00
commit ebc40cd400
32 changed files with 142 additions and 573 deletions

View File

@ -71,6 +71,19 @@ namespace Gdk {
{ {
return !(r1 == r2); return !(r1 == r2);
} }
public static explicit operator GLib.Value (Gdk.Rectangle boxed)
{
GLib.Value val = GLib.Value.Empty;
val.Init (Gdk.Rectangle.GType);
val.Val = boxed;
return val;
}
public static explicit operator Gdk.Rectangle (GLib.Value val)
{
return (Gdk.Rectangle) val.Val;
}
public override string ToString () public override string ToString ()
{ {

View File

@ -330,7 +330,7 @@
<attr path="/api/namespace/object[@cname='GtkContainer']/virtual_method[@cname='forall']" name="hidden">1</attr> <attr path="/api/namespace/object[@cname='GtkContainer']/virtual_method[@cname='forall']" name="hidden">1</attr>
<attr path="/api/namespace/object[@cname='GtkDialog']/constructor[@cname='gtk_dialog_new_with_buttons']" name="hidden">1</attr> <attr path="/api/namespace/object[@cname='GtkDialog']/constructor[@cname='gtk_dialog_new_with_buttons']" name="hidden">1</attr>
<attr path="/api/namespace/object[@cname='GtkDialog']/method[@name='AddButtons']" name="hidden">1</attr> <attr path="/api/namespace/object[@cname='GtkDialog']/method[@name='AddButtons']" name="hidden">1</attr>
<attr path="/api/namespace/object[@cname='GtkDialog']/method[@name='GetActionArea']/return-type" name="type">GtkHButtonBox*</attr> <attr path="/api/namespace/object[@cname='GtkDialog']/method[@name='GetActionArea']/return-type" name="type">GtkButtonBox*</attr>
<attr path="/api/namespace/object[@cname='GtkDialog']/method[@name='GetContentArea']/return-type" name="type">GtkBox*</attr> <attr path="/api/namespace/object[@cname='GtkDialog']/method[@name='GetContentArea']/return-type" name="type">GtkBox*</attr>
<attr path="/api/namespace/object[@cname='GtkDialog']/method[@name='Response']" name="name">Respond</attr> <attr path="/api/namespace/object[@cname='GtkDialog']/method[@name='Response']" name="name">Respond</attr>
<attr path="/api/namespace/object[@cname='GtkDialog']/method[@name='SetDefaultResponse']/*/*[@name='response_id']" name="type">GtkResponseType</attr> <attr path="/api/namespace/object[@cname='GtkDialog']/method[@name='SetDefaultResponse']/*/*[@name='response_id']" name="type">GtkResponseType</attr>

View File

@ -192,7 +192,7 @@ namespace GtkDemo
protected override bool OnWindowStateEvent (Gdk.EventWindowState evt) protected override bool OnWindowStateEvent (Gdk.EventWindowState evt)
{ {
if ((evt.ChangedMask & (Gdk.WindowState.Maximized | Gdk.WindowState.Fullscreen)) != 0) if ((evt.ChangedMask & (Gdk.WindowState.Maximized | Gdk.WindowState.Fullscreen)) != 0)
statusbar.HasResizeGrip = (evt.NewWindowState & (Gdk.WindowState.Maximized | Gdk.WindowState.Fullscreen)) == 0; HasResizeGrip = (evt.NewWindowState & (Gdk.WindowState.Maximized | Gdk.WindowState.Fullscreen)) == 0;
return false; return false;
} }

View File

@ -14,7 +14,7 @@ namespace GtkDemo
[Demo ("Color Selection", "DemoColorSelection.cs")] [Demo ("Color Selection", "DemoColorSelection.cs")]
public class DemoColorSelection : Gtk.Window public class DemoColorSelection : Gtk.Window
{ {
private Gdk.Color color; private Gdk.RGBA color;
private Gtk.DrawingArea drawingArea; private Gtk.DrawingArea drawingArea;
public DemoColorSelection () : base ("Color Selection") public DemoColorSelection () : base ("Color Selection")
@ -30,19 +30,22 @@ namespace GtkDemo
vbox.PackStart (frame, true, true, 0); vbox.PackStart (frame, true, true, 0);
drawingArea = new DrawingArea (); drawingArea = new DrawingArea ();
drawingArea.ExposeEvent += new ExposeEventHandler (ExposeEventCallback); drawingArea.Drawn += new DrawnHandler (DrawnCallback);
// set a minimum size // set a minimum size
drawingArea.SetSizeRequest (200,200); drawingArea.SetSizeRequest (200,200);
// set the color // set the color
color = new Gdk.Color (0, 0, 0xff); color.Red = 0;
drawingArea.ModifyBg (StateType.Normal, color); color.Green = 0;
color.Blue = 1;
color.Alpha = 1;
drawingArea.OverrideBackgroundColor (StateFlags.Normal, color);
frame.Add (drawingArea); frame.Add (drawingArea);
Alignment alignment = new Alignment (1.0f, 0.5f, 0.0f, 0.0f); Alignment alignment = new Alignment (1.0f, 0.5f, 0.0f, 0.0f);
Button button = new Button ("_Change the above color"); Button button = new Button ("_Change the above color");
button.Clicked += new EventHandler (ChangeColorCallback); button.Clicked += new EventHandler (ChangeColorCallback);
alignment.Add (button); alignment.Add (button);
vbox.PackStart (alignment); vbox.PackStart (alignment, false, false, 0);
ShowAll (); ShowAll ();
} }
@ -53,17 +56,15 @@ namespace GtkDemo
return true; return true;
} }
// Expose callback for the drawing area // Drawn callback for the drawing area
private void ExposeEventCallback (object o, ExposeEventArgs args) private void DrawnCallback (object o, DrawnArgs args)
{ {
EventExpose eventExpose = args.Event; Cairo.Context cr = args.Cr;
Gdk.Window window = eventExpose.Window;
Rectangle area = eventExpose.Area; Gdk.RGBA rgba = StyleContext.GetBackgroundColor (StateFlags.Normal);
cr.SetSourceRGBA (rgba.Red, rgba.Green, rgba.Blue, rgba.Alpha);
cr.Paint ();
window.DrawRectangle (drawingArea.Style.BackgroundGC (StateType.Normal),
true,
area.X, area.Y,
area.Width, area.Height);
args.RetVal = true; args.RetVal = true;
} }
@ -71,13 +72,13 @@ namespace GtkDemo
{ {
using (ColorSelectionDialog colorSelectionDialog = new ColorSelectionDialog ("Changing color")) { using (ColorSelectionDialog colorSelectionDialog = new ColorSelectionDialog ("Changing color")) {
colorSelectionDialog.TransientFor = this; colorSelectionDialog.TransientFor = this;
colorSelectionDialog.ColorSelection.PreviousColor = color; colorSelectionDialog.ColorSelection.SetPreviousRgba (color);
colorSelectionDialog.ColorSelection.CurrentColor = color; colorSelectionDialog.ColorSelection.CurrentRgba = color;
colorSelectionDialog.ColorSelection.HasPalette = true; colorSelectionDialog.ColorSelection.HasPalette = true;
if (colorSelectionDialog.Run () == (int) ResponseType.Ok) { if (colorSelectionDialog.Run () == (int) ResponseType.Ok) {
Gdk.Color selected = colorSelectionDialog.ColorSelection.CurrentColor; Gdk.RGBA selected = colorSelectionDialog.ColorSelection.CurrentRgba;
drawingArea.ModifyBg (StateType.Normal, selected); drawingArea.OverrideBackgroundColor (StateFlags.Normal, selected);
} }
colorSelectionDialog.Hide (); colorSelectionDialog.Hide ();

View File

@ -94,7 +94,7 @@ namespace GtkDemo
HBox hbox = new HBox (false, 8); HBox hbox = new HBox (false, 8);
hbox.BorderWidth = 8; hbox.BorderWidth = 8;
dialog.VBox.PackStart (hbox, false, false, 0); dialog.ContentArea.PackStart (hbox, false, false, 0);
Image stock = new Image (Stock.DialogQuestion, IconSize.Dialog); Image stock = new Image (Stock.DialogQuestion, IconSize.Dialog);
hbox.PackStart (stock, false, false, 0); hbox.PackStart (stock, false, false, 0);

View File

@ -22,7 +22,7 @@ namespace GtkDemo
[Demo ("Drawing Area", "DemoDrawingArea.cs")] [Demo ("Drawing Area", "DemoDrawingArea.cs")]
public class DemoDrawingArea : Gtk.Window public class DemoDrawingArea : Gtk.Window
{ {
private Pixmap pixmap = null; private Cairo.Surface surface = null;
public DemoDrawingArea () : base ("Drawing Area") public DemoDrawingArea () : base ("Drawing Area")
{ {
@ -45,7 +45,7 @@ namespace GtkDemo
// set a minimum size // set a minimum size
da.SetSizeRequest (100,100); da.SetSizeRequest (100,100);
frame.Add (da); frame.Add (da);
da.ExposeEvent += new ExposeEventHandler (CheckerboardExpose); da.Drawn += new DrawnHandler (CheckerboardDrawn);
// Create the scribble area // Create the scribble area
label = new Label ("<u>Scribble area</u>"); label = new Label ("<u>Scribble area</u>");
@ -62,7 +62,7 @@ namespace GtkDemo
frame.Add (da); frame.Add (da);
// Signals used to handle backing pixmap // Signals used to handle backing pixmap
da.ExposeEvent += new ExposeEventHandler (ScribbleExpose); da.Drawn += new DrawnHandler (ScribbleDrawn);
da.ConfigureEvent += new ConfigureEventHandler (ScribbleConfigure); da.ConfigureEvent += new ConfigureEventHandler (ScribbleConfigure);
// Event signals // Event signals
@ -84,25 +84,21 @@ namespace GtkDemo
return true; return true;
} }
private void CheckerboardExpose (object o, ExposeEventArgs args) private void CheckerboardDrawn (object o, DrawnArgs args)
{ {
const int CheckSize = 10; const int CheckSize = 10;
const int Spacing = 2; const int Spacing = 2;
DrawingArea da = o as DrawingArea; Widget widget = o as Widget;
Cairo.Context cr = args.Cr;
// It would be a bit more efficient to keep these
// GC's around instead of recreating on each expose, but
// this is the lazy/slow way.
Gdk.GC gc1 = new Gdk.GC (da.GdkWindow);
gc1.RgbFgColor = new Gdk.Color (117, 0, 117);
Gdk.GC gc2 = new Gdk.GC (da.GdkWindow);
gc2.RgbFgColor = new Gdk.Color (255, 255, 255);
int i, j, xcount, ycount; int i, j, xcount, ycount;
Gdk.Rectangle alloc = da.Allocation;
// At the start of a draw handler, a clip region has been set on
// the Cairo context, and the contents have been cleared to the
// widget's background color.
Rectangle alloc = widget.Allocation;
// Start redrawing the Checkerboard // Start redrawing the Checkerboard
xcount = 0; xcount = 0;
i = Spacing; i = Spacing;
@ -110,13 +106,12 @@ namespace GtkDemo
j = Spacing; j = Spacing;
ycount = xcount % 2; // start with even/odd depending on row ycount = xcount % 2; // start with even/odd depending on row
while (j < alloc.Height) { while (j < alloc.Height) {
Gdk.GC gc;
if (ycount % 2 != 0) if (ycount % 2 != 0)
gc = gc1; cr.SetSourceRGB (0.45777, 0, 0.45777);
else else
gc = gc2; cr.SetSourceRGB (1, 1, 1);
da.GdkWindow.DrawRectangle (gc, true, i, j, // If we're outside the clip, this will do nothing.
CheckSize, CheckSize); cr.Rectangle (i, j, CheckSize, CheckSize);
j += CheckSize + Spacing; j += CheckSize + Spacing;
++ycount; ++ycount;
@ -130,33 +125,29 @@ namespace GtkDemo
args.RetVal = true; args.RetVal = true;
} }
private void ScribbleExpose (object o, ExposeEventArgs args) private void ScribbleDrawn (object o, DrawnArgs args)
{ {
Widget widget = o as Widget; Cairo.Context cr = args.Cr;
Gdk.Window window = widget.GdkWindow;
Rectangle area = args.Event.Area; cr.SetSourceSurface (surface, 0, 0);
cr.Paint ();
// We use the "ForegroundGC" for the widget since it already exists,
// but honestly any GC would work. The only thing to worry about
// is whether the GC has an inappropriate clip region set.
window.DrawDrawable (widget.Style.ForegroundGC (StateType.Normal),
pixmap,
area.X, area.Y,
area.X, area.Y,
area.Width, area.Height);
} }
// Create a new pixmap of the appropriate size to store our scribbles // Create a new surface of the appropriate size to store our scribbles
private void ScribbleConfigure (object o, ConfigureEventArgs args) private void ScribbleConfigure (object o, ConfigureEventArgs args)
{ {
Widget widget = o as Widget; Widget widget = o as Widget;
Rectangle allocation = widget.Allocation;
if (surface != null)
surface.Destroy ();
pixmap = new Pixmap (widget.GdkWindow, allocation.Width, allocation.Height, -1); var allocation = widget.Allocation;
// Initialize the pixmap to white surface = widget.Window.CreateSimilarSurface (Cairo.Content.Color, allocation.Width, allocation.Height);
pixmap.DrawRectangle (widget.Style.WhiteGC, true, 0, 0, var cr = new Cairo.Context (surface);
allocation.Width, allocation.Height);
cr.Paint ();
((IDisposable)cr).Dispose ();
// We've handled the configure event, no need for further processing. // We've handled the configure event, no need for further processing.
args.RetVal = true; args.RetVal = true;
@ -166,7 +157,7 @@ namespace GtkDemo
{ {
// paranoia check, in case we haven't gotten a configure event // paranoia check, in case we haven't gotten a configure event
if (pixmap == null) if (surface == null)
return; return;
// This call is very important; it requests the next motion event. // This call is very important; it requests the next motion event.
@ -192,19 +183,21 @@ namespace GtkDemo
// Draw a rectangle on the screen // Draw a rectangle on the screen
private void DrawBrush (Widget widget, double x, double y) private void DrawBrush (Widget widget, double x, double y)
{ {
Rectangle update_rect = new Rectangle ((int)x - 3, (int)y - 3, 6, 6); var update_rect = new Gdk.Rectangle ((int)x - 3, (int)y - 3, 6, 6);
var cr = new Cairo.Context (surface);
cr.Fill ();
Gdk.CairoHelper.Rectangle (cr, update_rect);
// Paint to the pixmap, where we store our state ((IDisposable)cr).Dispose ();
pixmap.DrawRectangle (widget.Style.BlackGC, true,
update_rect.X, update_rect.Y, widget.Window.InvalidateRect (update_rect, false);
update_rect.Width, update_rect.Height);
widget.GdkWindow.InvalidateRect (update_rect, false);
} }
private void ScribbleButtonPress (object o, ButtonPressEventArgs args) private void ScribbleButtonPress (object o, ButtonPressEventArgs args)
{ {
// paranoia check, in case we haven't gotten a configure event // paranoia check, in case we haven't gotten a configure event
if (pixmap == null) if (surface == null)
return; return;
EventButton ev = args.Event; EventButton ev = args.Event;

View File

@ -18,7 +18,7 @@ namespace GtkDemo
VBox vbox = new VBox (false, 5); VBox vbox = new VBox (false, 5);
vbox.BorderWidth = 5; vbox.BorderWidth = 5;
this.VBox.PackStart (vbox, true, true, 0); this.ContentArea.PackStart (vbox, true, true, 0);
Label label = new Label ("Completion demo, try writing <b>total</b> or <b>gnome</b> for example."); Label label = new Label ("Completion demo, try writing <b>total</b> or <b>gnome</b> for example.");
label.UseMarkup = true; label.UseMarkup = true;

View File

@ -17,7 +17,7 @@ namespace GtkDemo
Resizable = false; Resizable = false;
VBox vbox = new VBox (false, 5); VBox vbox = new VBox (false, 5);
this.VBox.PackStart (vbox, true, true, 0); this.ContentArea.PackStart (vbox, true, true, 0);
vbox.BorderWidth = 5; vbox.BorderWidth = 5;
vbox.PackStart (new Label ("Expander demo. Click on the triangle for details."), false, false, 0); vbox.PackStart (new Label ("Expander demo. Click on the triangle for details."), false, false, 0);

View File

@ -184,7 +184,7 @@ namespace GtkDemo
view.WindowToBufferCoords (TextWindowType.Widget, (int) args.Event.X, (int) args.Event.Y, out x, out y); view.WindowToBufferCoords (TextWindowType.Widget, (int) args.Event.X, (int) args.Event.Y, out x, out y);
SetCursorIfAppropriate (view, x, y); SetCursorIfAppropriate (view, x, y);
view.GdkWindow.GetPointer (out x, out y, out state); view.Window.GetPointer (out x, out y, out state);
} }
// Also update the cursor image if the window becomes visible // Also update the cursor image if the window becomes visible

View File

@ -170,7 +170,7 @@ namespace GtkDemo
{ {
Gdk.Pixbuf pixbuf = pixbufLoader.Pixbuf; Gdk.Pixbuf pixbuf = pixbufLoader.Pixbuf;
pixbuf.Fill (0xaaaaaaff); pixbuf.Fill (0xaaaaaaff);
progressiveImage.FromPixbuf = pixbuf; progressiveImage.Pixbuf = pixbuf;
} }
void ProgressiveUpdatedCallback (object obj, AreaUpdatedArgs args) void ProgressiveUpdatedCallback (object obj, AreaUpdatedArgs args)

View File

@ -180,8 +180,8 @@ namespace GtkDemo
scrolledWindow.Add (textView); scrolledWindow.Add (textView);
if (IsSource) { if (IsSource) {
FontDescription fontDescription = FontDescription.FromString ("Courier 12"); FontDescription fontDescription = FontDescription.FromString ("monospace");
textView.ModifyFont (fontDescription); textView.OverrideFont (fontDescription);
textView.WrapMode = Gtk.WrapMode.None; textView.WrapMode = Gtk.WrapMode.None;
} else { } else {
// Make it a bit nicer for text // Make it a bit nicer for text
@ -191,7 +191,7 @@ namespace GtkDemo
} }
return scrolledWindow; return scrolledWindow;
} }
private TreeStore FillTree () private TreeStore FillTree ()
{ {

View File

@ -71,23 +71,13 @@ namespace GtkDemo
} }
// Expose callback for the drawing area // Expose callback for the drawing area
void Expose (object o, ExposeEventArgs args) void DrawnCallback (object o, DrawnArgs args)
{ {
Widget widget = (Widget) o; Cairo.Context cr = args.Cr;
Gdk.Rectangle area = args.Event.Area;
byte[] pixels; Gdk.CairoHelper.SetSourcePixbuf (cr, frame, 0, 0);
int rowstride; cr.Paint ();
rowstride = frame.Rowstride;
pixels = new byte[(frame.Height - area.Y) * rowstride];
IntPtr src = (IntPtr)(frame.Pixels.ToInt64 () + rowstride * area.Y + area.X * 3);
Marshal.Copy (src, pixels, 0, pixels.Length);
widget.GdkWindow.DrawRgbImageDithalign (widget.Style.BlackGC,
area.X, area.Y, area.Width, area.Height,
Gdk.RgbDither.Normal,
pixels, rowstride,
area.X, area.Y);
args.RetVal = true; args.RetVal = true;
} }
@ -152,7 +142,7 @@ namespace GtkDemo
frame = new Pixbuf (Colorspace.Rgb, false, 8, backWidth, backHeight); frame = new Pixbuf (Colorspace.Rgb, false, 8, backWidth, backHeight);
drawingArea = new DrawingArea (); drawingArea = new DrawingArea ();
drawingArea.ExposeEvent += new ExposeEventHandler (Expose); drawingArea.Drawn += new DrawnHandler (DrawnCallback);
Add (drawingArea); Add (drawingArea);
timeoutId = GLib.Timeout.Add (FrameDelay, new GLib.TimeoutHandler(timeout)); timeoutId = GLib.Timeout.Add (FrameDelay, new GLib.TimeoutHandler(timeout));

View File

@ -33,7 +33,7 @@ namespace GtkDemo
Resizable = false; Resizable = false;
VBox vbox = new VBox (false, 5); VBox vbox = new VBox (false, 5);
this.VBox.PackStart (vbox, true, true, 0); this.ContentArea.PackStart (vbox, true, true, 0);
vbox.BorderWidth = 5; vbox.BorderWidth = 5;
sizeGroup = new SizeGroup (SizeGroupMode.Horizontal); sizeGroup = new SizeGroup (SizeGroupMode.Horizontal);
@ -76,7 +76,7 @@ namespace GtkDemo
// Convenience function to create a combo box holding a number of strings // Convenience function to create a combo box holding a number of strings
private ComboBox CreateComboBox (string [] strings) private ComboBox CreateComboBox (string [] strings)
{ {
ComboBox combo = ComboBox.NewText (); ComboBoxText combo = new ComboBoxText ();
foreach (string str in strings) foreach (string str in strings)
combo.AppendText (str); combo.AppendText (str);

View File

@ -71,7 +71,7 @@ namespace GtkDemo
textView.AddChildAtAnchor (button, buttonAnchor); textView.AddChildAtAnchor (button, buttonAnchor);
button.ShowAll (); button.ShowAll ();
ComboBox combo = ComboBox.NewText (); ComboBoxText combo = new ComboBoxText ();
combo.AppendText ("Option 1"); combo.AppendText ("Option 1");
combo.AppendText ("Option 2"); combo.AppendText ("Option 2");
combo.AppendText ("Option 3"); combo.AppendText ("Option 3");
@ -154,20 +154,6 @@ namespace GtkDemo
tag.Background = "red"; tag.Background = "red";
buffer.TagTable.Add (tag); buffer.TagTable.Add (tag);
// The C gtk-demo passes NULL for the drawable param, which isn't
// multi-head safe, so it seems bad to allow it in the C# API.
// But the Window isn't realized at this point, so we can't get
// an actual Drawable from it. So we kludge for now.
Pixmap stipple = Pixmap.CreateBitmapFromData (Gdk.Screen.Default.RootWindow, gray50_bits, gray50_width, gray50_height);
tag = new TextTag ("background_stipple");
tag.BackgroundStipple = stipple;
buffer.TagTable.Add (tag);
tag = new TextTag ("foreground_stipple");
tag.ForegroundStipple = stipple;
buffer.TagTable.Add (tag);
tag = new TextTag ("big_gap_before_line"); tag = new TextTag ("big_gap_before_line");
tag.PixelsAboveLines = 30; tag.PixelsAboveLines = 30;
buffer.TagTable.Add (tag); buffer.TagTable.Add (tag);
@ -278,17 +264,10 @@ namespace GtkDemo
buffer.Insert (ref insertIter, " or "); buffer.Insert (ref insertIter, " or ");
buffer.InsertWithTagsByName (ref insertIter, "a red background", "red_background"); buffer.InsertWithTagsByName (ref insertIter, "a red background", "red_background");
buffer.Insert (ref insertIter, " or even "); buffer.Insert (ref insertIter, " or even ");
buffer.InsertWithTagsByName (ref insertIter, "a stippled red background", buffer.InsertWithTagsByName (ref insertIter, "a blue foreground on red background",
"red_background", "blue_foreground",
"background_stipple"); "red_background");
buffer.Insert (ref insertIter, " (select that to read it) can be used.\n\n");
buffer.Insert (ref insertIter, " or ");
buffer.InsertWithTagsByName (ref insertIter,
"a stippled blue foreground on solid red background",
"blue_foreground",
"red_background",
"foreground_stipple");
buffer.Insert (ref insertIter, " (select that to read it) can be used.\n\n");
buffer.InsertWithTagsByName (ref insertIter, "Underline, strikethrough, and rise. ", "heading"); buffer.InsertWithTagsByName (ref insertIter, "Underline, strikethrough, and rise. ", "heading");
@ -389,9 +368,9 @@ namespace GtkDemo
// Event box is to add a black border around each child view // Event box is to add a black border around each child view
EventBox eventBox = new EventBox (); EventBox eventBox = new EventBox ();
Gdk.Color color = new Gdk.Color (); Gdk.RGBA color = new Gdk.RGBA ();
Gdk.Color.Parse ("black", ref color); color.Parse ("black");
eventBox.ModifyBg (StateType.Normal, color); eventBox.OverrideBackgroundColor (StateFlags.Normal, color);
Alignment align = new Alignment (0.5f, 0.5f, 1.0f, 1.0f); Alignment align = new Alignment (0.5f, 0.5f, 1.0f, 1.0f);
align.BorderWidth = 1; align.BorderWidth = 1;

View File

@ -1,4 +1,4 @@
# SUBDIRS = GtkDemo pixmaps valtest opaquetest gio gtk-gio SUBDIRS = test GtkDemo pixmaps valtest opaquetest gio gtk-gio
if ENABLE_DOTNET if ENABLE_DOTNET
DOTNET_TARGETS=drawing-sample.exe DOTNET_TARGETS=drawing-sample.exe

View File

@ -21,7 +21,7 @@ generated/*.cs: opaque-api.xml
$(RUNTIME) ../../generator/gapi_codegen.exe --generate $(srcdir)/opaque-api.xml --include ../../gtk/gtk-api.xml ../../gdk/gdk-api.xml --outdir=generated --assembly-name=opaque-sharp $(RUNTIME) ../../generator/gapi_codegen.exe --generate $(srcdir)/opaque-api.xml --include ../../gtk/gtk-api.xml ../../gdk/gdk-api.xml --outdir=generated --assembly-name=opaque-sharp
api: api:
PATH=../../parser:$PATH $(RUNTIME) ../../parser/gapi-parser.exe opaque-sources.xml PATH=../../parser:$(PATH) $(RUNTIME) ../../parser/gapi-parser.exe opaque-sources.xml
$(RUNTIME) ../../parser/gapi-fixup.exe --metadata=Opaque.metadata --api=opaque-api.xml $(RUNTIME) ../../parser/gapi-fixup.exe --metadata=Opaque.metadata --api=opaque-api.xml
install: install:

View File

@ -1,5 +1,5 @@
<?xml version="1.0"?> <?xml version="1.0"?>
<api> <api parser_version="2">
<!-- <!--
This file was automatically generated. This file was automatically generated.
@ -17,9 +17,9 @@
<return-type type="GtksharpRefcounted*" /> <return-type type="GtksharpRefcounted*" />
</callback> </callback>
<struct name="Opaque" cname="GtksharpOpaque" opaque="1"> <struct name="Opaque" cname="GtksharpOpaque" opaque="1">
<field name="Serial" cname="serial" type="int" /> <field name="Serial" cname="serial" type="int" access="public" />
<field name="Valid" cname="valid" type="gboolean" /> <field name="Valid" cname="valid" type="gboolean" access="public" writeable="true" />
<field name="Friend" cname="friend" type="GtksharpOpaque*" /> <field name="Friend" cname="friend" type="GtksharpOpaque*" access="public" writeable="true" />
<method name="Check" cname="gtksharp_opaque_check" shared="true"> <method name="Check" cname="gtksharp_opaque_check" shared="true">
<return-type type="GtksharpOpaque*" /> <return-type type="GtksharpOpaque*" />
<parameters> <parameters>
@ -58,10 +58,10 @@
</method> </method>
</struct> </struct>
<struct name="Refcounted" cname="GtksharpRefcounted" opaque="1"> <struct name="Refcounted" cname="GtksharpRefcounted" opaque="1">
<field name="Serial" cname="serial" type="int" /> <field name="Serial" cname="serial" type="int" access="public" />
<field name="Refcount" cname="refcount" type="int" /> <field name="Refcount" cname="refcount" type="int" access="public" />
<field name="Valid" cname="valid" type="gboolean" /> <field name="Valid" cname="valid" type="gboolean" access="public" writeable="true" />
<field name="Friend" cname="friend" type="GtksharpRefcounted*" /> <field name="Friend" cname="friend" type="GtksharpRefcounted*" access="public" writeable="true" />
<method name="Check" cname="gtksharp_refcounted_check" shared="true"> <method name="Check" cname="gtksharp_refcounted_check" shared="true">
<return-type type="GtksharpRefcounted*" /> <return-type type="GtksharpRefcounted*" />
<parameters> <parameters>
@ -120,4 +120,4 @@
</method> </method>
</class> </class>
</namespace> </namespace>
</api> </api>

View File

@ -19,13 +19,13 @@ EXTRA_DIST = $(sources) ChangeLog
sources = \ sources = \
TestCheckButton.cs \ TestCheckButton.cs \
TestColorSelection.cs \ TestColorSelection.cs \
TestRadioButton.cs \ TestComboBox.cs \
TestRange.cs \
TestStatusbar.cs \
TestDialog.cs \ TestDialog.cs \
TestFlipping.cs \ TestFlipping.cs \
TestRadioButton.cs \
TestRange.cs \
TestSizeGroup.cs \ TestSizeGroup.cs \
TestComboBox.cs \ TestStatusbar.cs \
WidgetViewer.cs WidgetViewer.cs
build_sources = $(addprefix $(srcdir)/, $(sources)) build_sources = $(addprefix $(srcdir)/, $(sources))

View File

@ -27,8 +27,8 @@ namespace WidgetViewer {
window.ColorSelection.HasPalette = true; window.ColorSelection.HasPalette = true;
window.SetDefaultSize (250, 200); window.SetDefaultSize (250, 200);
window.VBox.PackStart (options, false, false, 0); window.ContentArea.PackStart (options, false, false, 0);
window.VBox.BorderWidth = 10; window.ContentArea.BorderWidth = 10;
check_button = new CheckButton("Show Opacity"); check_button = new CheckButton("Show Opacity");
check_button.Active = true; check_button.Active = true;
@ -59,18 +59,18 @@ namespace WidgetViewer {
window.ColorSelection.HasPalette = ((ToggleButton )o).Active; window.ColorSelection.HasPalette = ((ToggleButton )o).Active;
} }
static string HexFormat (Gdk.Color color) static string HexFormat (Gdk.RGBA color)
{ {
StringBuilder s = new StringBuilder (); StringBuilder s = new StringBuilder ();
ushort[] vals = { color.Red, color.Green, color.Blue }; double[] vals = { color.Red, color.Green, color.Blue };
char[] hexchars = {'0', '1', '2', '3', '4', '5', '6', '7', '8', '9', char[] hexchars = {'0', '1', '2', '3', '4', '5', '6', '7', '8', '9',
'A', 'B', 'C', 'D', 'E', 'F'}; 'A', 'B', 'C', 'D', 'E', 'F'};
s.Append ('#'); s.Append ('#');
foreach (ushort val in vals) { foreach (double val in vals) {
/* Convert to a range of 0-255, then lookup the /* Convert to a range of 0-255, then lookup the
* digit for each half-byte */ * digit for each half-byte */
byte rounded = (byte) (val >> 8); byte rounded = (byte) (val * 255);
s.Append (hexchars[(rounded & 0xf0) >> 4]); s.Append (hexchars[(rounded & 0xf0) >> 4]);
s.Append (hexchars[rounded & 0x0f]); s.Append (hexchars[rounded & 0x0f]);
} }
@ -80,13 +80,13 @@ namespace WidgetViewer {
static void Color_Changed (object o, EventArgs args) static void Color_Changed (object o, EventArgs args)
{ {
Gdk.Color color = window.ColorSelection.CurrentColor; Gdk.RGBA color = window.ColorSelection.CurrentRgba;
Console.WriteLine (HexFormat (color)); Console.WriteLine (HexFormat (color));
} }
static void Color_Selection_OK (object o, EventArgs args) static void Color_Selection_OK (object o, EventArgs args)
{ {
Gdk.Color selected = window.ColorSelection.CurrentColor; Gdk.RGBA selected = window.ColorSelection.CurrentRgba;
window.Hide (); window.Hide ();
Display_Result (selected); Display_Result (selected);
} }
@ -102,18 +102,17 @@ namespace WidgetViewer {
window.ShowAll (); window.ShowAll ();
} }
static void Display_Result (Gdk.Color color) static void Display_Result (Gdk.RGBA color)
{ {
dialog = new Dialog (); dialog = new Dialog ();
dialog.Title = "Selected Color: " + HexFormat (color); dialog.Title = "Selected Color: " + HexFormat (color);
dialog.HasSeparator = true;
DrawingArea da = new DrawingArea (); DrawingArea da = new DrawingArea ();
da.ModifyBg (StateType.Normal, color); da.OverrideBackgroundColor (StateFlags.Normal, color);
dialog.VBox.BorderWidth = 10; dialog.ContentArea.BorderWidth = 10;
dialog.VBox.PackStart (da, true, true, 10); dialog.ContentArea.PackStart (da, true, true, 10);
dialog.SetDefaultSize (200, 200); dialog.SetDefaultSize (200, 200);
Button button = new Button (Stock.Ok); Button button = new Button (Stock.Ok);

View File

@ -25,9 +25,11 @@ namespace WidgetViewer {
box2.BorderWidth = 10; box2.BorderWidth = 10;
box1.PackStart (box2, true, true, 0); box1.PackStart (box2, true, true, 0);
ComboBoxEntry combo = new Gtk.ComboBoxEntry (new string[] {"Foo", "Bar"}); ComboBoxText combo = ComboBoxText.NewWithEntry ();
combo.AppendText ("Foo");
combo.AppendText ("Bar");
combo.Changed += new EventHandler (OnComboActivated); combo.Changed += new EventHandler (OnComboActivated);
combo.Entry.Changed += new EventHandler (OnComboEntryChanged); ((Entry)combo.Child).Changed += new EventHandler (OnComboEntryChanged);
box2.PackStart (combo, true, true, 0); box2.PackStart (combo, true, true, 0);
HSeparator separator = new HSeparator (); HSeparator separator = new HSeparator ();

View File

@ -34,10 +34,6 @@ namespace WidgetViewer {
toggle_button.Clicked += new EventHandler (Label_Toggle); toggle_button.Clicked += new EventHandler (Label_Toggle);
window.ActionArea.PackStart (toggle_button, true, true, 0); window.ActionArea.PackStart (toggle_button, true, true, 0);
toggle_button = new ToggleButton ("Toggle Separator");
toggle_button.Clicked += new EventHandler (Separator_Toggle);
window.ActionArea.PackStart (toggle_button, true, true, 0);
window.ShowAll (); window.ShowAll ();
return window; return window;
@ -58,18 +54,13 @@ namespace WidgetViewer {
if (label == null) { if (label == null) {
label = new Label ("This is Text label inside a Dialog"); label = new Label ("This is Text label inside a Dialog");
label.SetPadding (10, 10); label.SetPadding (10, 10);
window.VBox.PackStart (label, true, true, 0); window.ContentArea.PackStart (label, true, true, 0);
label.Show (); label.Show ();
} else { } else {
label.Destroy (); label.Destroy ();
label = null; label = null;
} }
} }
static void Separator_Toggle (object o, EventArgs args)
{
window.HasSeparator = (!((ToggleButton) o).Active);
}
} }
} }

View File

@ -1,67 +0,0 @@
//
// TestFileSelection.cs
//
// Author: Duncan Mak (duncan@ximian.com)
//
// Copyright (C) 2002, Duncan Mak, Ximian Inc.
//
using System;
using Gtk;
namespace WidgetViewer {
public class TestFileSelection
{
static FileSelection window = null;
static ToggleButton toggle_button = null;
static CheckButton check_button = null;
public static Gtk.Window Create ()
{
window = new FileSelection ("File Selection Dialog");
window.HideFileopButtons ();
window.OkButton.Clicked += new EventHandler (file_selection_ok);
window.CancelButton.Clicked += new EventHandler (file_selection_cancel);
check_button = new CheckButton ("Show Fileops");
check_button.Toggled += new EventHandler (show_fileops);
window.ActionArea.PackStart (check_button, false, false, 0);
toggle_button = new ToggleButton ("Select Multiple");
toggle_button.Clicked += new EventHandler (select_multiple);
window.ActionArea.PackStart (toggle_button, false, false, 0);
window.ShowAll ();
return window;
}
static void file_selection_ok (object o, EventArgs args)
{
Gtk.FileSelection.FSButton fsbutton = (Gtk.FileSelection.FSButton) o;
Console.WriteLine ("ok button clicked!");
fsbutton.FileSelection.Destroy ();
}
static void show_fileops (object o, EventArgs args)
{
if (((ToggleButton) o).Active)
window.ShowFileopButtons ();
else
window.HideFileopButtons ();
}
static void select_multiple (object o, EventArgs args)
{
window.SelectMultiple = toggle_button.Active;
}
static void file_selection_cancel (object o, EventArgs args)
{
window.Destroy ();
}
}
}

View File

@ -27,10 +27,10 @@ namespace WidgetViewer {
label = new Label ("Label direction: <b>Left-to-right</b>"); label = new Label ("Label direction: <b>Left-to-right</b>");
label.UseMarkup = true; label.UseMarkup = true;
label.SetPadding (3, 3); label.SetPadding (3, 3);
window.VBox.PackStart (label, true, true, 0); window.ContentArea.PackStart (label, true, true, 0);
check_button = new CheckButton ("Toggle label direction"); check_button = new CheckButton ("Toggle label direction");
window.VBox.PackStart (check_button, true, true, 2); window.ContentArea.PackStart (check_button, true, true, 2);
if (window.Direction == TextDirection.Ltr) if (window.Direction == TextDirection.Ltr)
check_button.Active = true; check_button.Active = true;

View File

@ -1,142 +0,0 @@
//
// TestMenus.cs
//
// Author: Duncan Mak (duncan@ximian.com)
//
// Copyright (C) 2002, Duncan Mak, Ximian Inc.
//
using System;
using Gtk;
namespace WidgetViewer {
public class TestMenus {
static Window window = null;
public static Gtk.Window Create ()
{
window = new Window ("Menus");
AccelGroup accel_group = new AccelGroup ();
window.AddAccelGroup (accel_group);
VBox box1 = new VBox (false, 0);
window.Add (box1);
MenuBar menubar = new MenuBar ();
box1.PackStart (menubar, false, false, 0);
Menu menu = Create_Menu (2, true);
MenuItem menuitem = new MenuItem ("foo");
menuitem.Submenu = menu;
menubar.Append (menuitem);
menuitem = new MenuItem ("bar");
menuitem.Submenu = Create_Menu (3, true);
menubar.Append (menuitem);
Image image = new Image (Stock.Help, IconSize.Menu);
menuitem = new ImageMenuItem ("Help");
((ImageMenuItem) menuitem).Image = image;
menuitem.Submenu = Create_Menu (4, true);
menuitem.RightJustified = true;
menubar.Append (menuitem);
menubar = new MenuBar ();
box1.PackStart (menubar, false, true, 0);
menu = Create_Menu (2, true);
menuitem = new MenuItem ("Second menu bar");
menuitem.Submenu = menu;
menubar.Append (menuitem);
VBox box2 = new VBox (false, 10);
box2.BorderWidth = 10;
box1.PackStart (box2, true, true, 0);
menu = Create_Menu (1, false);
menu.AccelGroup = accel_group;
menu.Append (new SeparatorMenuItem ());
menuitem = new CheckMenuItem ("Accelerate Me");
menu.Append (menuitem);
menuitem.AddAccelerator ("activate", accel_group, 0xFFBE, 0, AccelFlags.Visible);
menuitem = new CheckMenuItem ("Accelerator locked");
menu.Append (menuitem);
menuitem.AddAccelerator ("activate", accel_group, 0xFFBF, 0, AccelFlags.Visible | AccelFlags.Locked);
menuitem = new CheckMenuItem ("Accelerator Frozen");
menu.Append (menuitem);
menuitem.AddAccelerator ("activate", accel_group, 0xFFBF, 0, AccelFlags.Visible);
menuitem.AddAccelerator ("activate", accel_group, 0xFFC0, 0, AccelFlags.Visible);
OptionMenu option_menu = new OptionMenu ();
option_menu.Menu = menu;
option_menu.SetHistory (3);
box2.PackStart (option_menu, true, true, 0);
box1.PackStart (new HSeparator (), false, false, 0);
box2 = new VBox (false, 10);
box2.BorderWidth = 10;
box1.PackStart (box2, false, true, 0);
Button close_button = new Button (Stock.Close);
close_button.Clicked += new EventHandler (Close_Button);
box2.PackStart (close_button, true, true, 0);
close_button.CanDefault = true;
close_button.GrabDefault ();
window.ShowAll ();
return window;
}
static Menu Create_Menu (int depth, bool tearoff)
{
if (depth < 1)
return null;
Menu menu = new Menu ();
MenuItem menuitem = null;
string label = null;
GLib.SList group = new GLib.SList (IntPtr.Zero);
if (tearoff) {
menuitem = new TearoffMenuItem ();
menu.Append (menuitem);
menuitem.Show ();
}
for (int i = 0, j = 1; i < 5; i++, j++) {
label = String.Format ("item {0} - {1}", depth, j);
menuitem = new RadioMenuItem (group, label);
group = ((RadioMenuItem) menuitem).Group;
menuitem = new MenuItem (label);
menu.Append (menuitem);
if (i == 3)
menuitem.Sensitive = false;
Menu child = Create_Menu ((depth - 1), true);
if (child != null)
menuitem.Submenu = child;
}
return menu;
}
static void Close_Button (object o, EventArgs args)
{
window.Destroy ();
}
}
}

View File

@ -32,14 +32,12 @@ namespace WidgetViewer {
HScale hscale = new HScale (adjustment); HScale hscale = new HScale (adjustment);
hscale.SetSizeRequest (150, -1); hscale.SetSizeRequest (150, -1);
((Range) hscale).UpdatePolicy = UpdateType.Delayed;
hscale.Digits = 1; hscale.Digits = 1;
hscale.DrawValue = true; hscale.DrawValue = true;
box2.PackStart (hscale, true, true, 0); box2.PackStart (hscale, true, true, 0);
HScrollbar hscrollbar = new HScrollbar (adjustment); HScrollbar hscrollbar = new HScrollbar (adjustment);
((Range) hscrollbar).UpdatePolicy = UpdateType.Continuous;
box2.PackStart (hscrollbar, true, true, 0); box2.PackStart (hscrollbar, true, true, 0);
hscale = new HScale (adjustment); hscale = new HScale (adjustment);

View File

@ -23,7 +23,7 @@ namespace WidgetViewer {
window.Resizable = false; window.Resizable = false;
VBox vbox = new VBox (false, 5); VBox vbox = new VBox (false, 5);
window.VBox.PackStart (vbox, true, true, 0); window.ContentArea.PackStart (vbox, true, true, 0);
vbox.BorderWidth = 5; vbox.BorderWidth = 5;
size_group = new SizeGroup (SizeGroupMode.Horizontal); size_group = new SizeGroup (SizeGroupMode.Horizontal);
@ -85,7 +85,7 @@ namespace WidgetViewer {
option_menu.Menu = menu; option_menu.Menu = menu;
return option_menu;*/ return option_menu;*/
ComboBox combo_box = new ComboBox (); ComboBoxText combo_box = new ComboBoxText ();
foreach (string str in strings) { foreach (string str in strings) {
combo_box.AppendText (str); combo_box.AppendText (str);
} }

View File

@ -1,132 +0,0 @@
//
// TestToolbar.cs
//
// Author: Duncan Mak (duncan@ximian.com)
//
// Copyright (C) 2002, Duncan Mak, Ximian Inc.
//
using System;
using Gtk;
namespace WidgetViewer {
public class TestToolbar {
static Window window = null;
static Toolbar toolbar = null;
static bool showTooltips = true;
public static Gtk.Window Create ()
{
window = new Window ("Toolbar");
window.Resizable = false;
toolbar = new Toolbar ();
toolbar.InsertStock (Stock.New, "Stock icon: New", "Toolbar/New",
new SignalFunc (set_small_icon), IntPtr.Zero, -1);
toolbar.InsertStock (Stock.Open, "Stock icon: Open", "Toolbar/Open",
new SignalFunc (set_large_icon), IntPtr.Zero, -1);
toolbar.AppendSpace ();
toolbar.AppendItem ("Toggle tooltips", "toggle showing of tooltips", "Toolbar/Tooltips",
new Image (Stock.DialogInfo, IconSize.LargeToolbar),
new SignalFunc (toggle_tooltips));
toolbar.AppendSpace ();
toolbar.AppendItem ("Horizontal", "Horizontal layout", "Toolbar/Horizontal",
new Image (Stock.GoForward, IconSize.LargeToolbar),
new SignalFunc (set_horizontal));
toolbar.AppendItem ("Vertical", "Vertical layout", "Toolbar/Vertical",
new Image (Stock.GoUp, IconSize.LargeToolbar),
new SignalFunc (set_vertical));
toolbar.AppendSpace ();
toolbar.AppendItem ("Icons", "Only show icons", "Toolbar/IconsOnly",
new Image (Stock.Home, IconSize.LargeToolbar),
new SignalFunc (set_icon_only));
toolbar.AppendItem ("Text", "Only show Text", "Toolbar/TextOnly",
new Image (Stock.JustifyFill, IconSize.LargeToolbar),
new SignalFunc (set_text_only));
toolbar.AppendItem ("Both", "Show both Icon & Text", "Toolbar/Both",
new Image (Stock.Index, IconSize.LargeToolbar),
new SignalFunc (set_both));
toolbar.AppendItem ("Both (Horizontal)", "Show Icon & Text horizontally", "Toolbar/BothHoriz",
new Image (Stock.Index, IconSize.LargeToolbar),
new SignalFunc (set_both_horiz));
toolbar.AppendSpace ();
toolbar.InsertStock (Stock.Close, "Stock icon: Close", "Toolbar/Close",
new SignalFunc (Close_Button), IntPtr.Zero, -1);
window.Add (toolbar);
window.ShowAll ();
return window;
}
static void set_small_icon ()
{
toolbar.IconSize = IconSize.SmallToolbar;
}
static void set_large_icon ()
{
toolbar.IconSize = IconSize.LargeToolbar;
}
static void set_icon_only ()
{
toolbar.ToolbarStyle = ToolbarStyle.Icons;
}
static void set_text_only ()
{
toolbar.ToolbarStyle = ToolbarStyle.Text;
}
static void set_horizontal ()
{
toolbar.Orientation = Orientation.Horizontal;
}
static void set_vertical ()
{
toolbar.Orientation = Orientation.Vertical;
}
static void set_both ()
{
toolbar.ToolbarStyle = ToolbarStyle.Both;
}
static void set_both_horiz ()
{
toolbar.ToolbarStyle = ToolbarStyle.BothHoriz;
}
static void toggle_tooltips ()
{
if (showTooltips == true)
showTooltips = false;
else
showTooltips = true;
toolbar.Tooltips = showTooltips;
Console.WriteLine ("Show tooltips: " + showTooltips);
}
static void Close_Button ()
{
window.Destroy ();
}
}
}

View File

@ -1,34 +0,0 @@
//
// TestToolTip.cs
//
// Author: Duncan Mak (duncan@ximian.com)
//
// Copyright (C) 2002, Duncan Mak, Ximian Inc.
//
using System;
using Gtk;
namespace WidgetViewer {
public class TestToolTip
{
static Window window = null;
static Tooltips tooltips = null;
public Gtk.Window Create ()
{
window = new Window ("Tooltips");
window.DefaultSize = new Gdk.Size (200, 150);
tooltips = new Tooltips ();
return window;
}
static void Window_Delete (object o, EventArgs args)
{
window.Destroy ();
}
}
}

View File

@ -41,15 +41,11 @@ namespace WidgetViewer {
AddButton ("Check Buttons", new EventHandler (Check_Buttons)); AddButton ("Check Buttons", new EventHandler (Check_Buttons));
AddButton ("Color Selection", new EventHandler (Color_Selection)); AddButton ("Color Selection", new EventHandler (Color_Selection));
AddButton ("Combo Box", new EventHandler (Combo_Box)); AddButton ("Combo Box", new EventHandler (Combo_Box));
AddButton ("New Combo Box", new EventHandler (New_Combo_Box));
AddButton ("Dialog", new EventHandler (Dialog)); AddButton ("Dialog", new EventHandler (Dialog));
AddButton ("File Selection", new EventHandler (File_Selection));
AddButton ("Menus", new EventHandler (Menus));
AddButton ("Radio Buttons", new EventHandler (Radio_Buttons)); AddButton ("Radio Buttons", new EventHandler (Radio_Buttons));
AddButton ("Range Controls", new EventHandler (Range_Controls)); AddButton ("Range Controls", new EventHandler (Range_Controls));
AddButton ("Size Groups", new EventHandler (Size_Groups)); AddButton ("Size Groups", new EventHandler (Size_Groups));
AddButton ("Statusbar", new EventHandler (Statusbar)); AddButton ("Statusbar", new EventHandler (Statusbar));
AddButton ("Toolbar", new EventHandler (Toolbar));
box1.PackStart (new HSeparator (), false, false, 0); box1.PackStart (new HSeparator (), false, false, 0);
@ -107,11 +103,6 @@ namespace WidgetViewer {
AddWindow (TestColorSelection.Create ()); AddWindow (TestColorSelection.Create ());
} }
static void File_Selection (object o, EventArgs args)
{
//AddWindow (TestFileSelection.Create ());
}
static void Radio_Buttons (object o, EventArgs args) static void Radio_Buttons (object o, EventArgs args)
{ {
AddWindow (TestRadioButton.Create ()); AddWindow (TestRadioButton.Create ());
@ -127,11 +118,6 @@ namespace WidgetViewer {
AddWindow (TestStatusbar.Create ()); AddWindow (TestStatusbar.Create ());
} }
static void Toolbar (object o, EventArgs args)
{
//AddWindow (TestToolbar.Create ());
}
static void Dialog (object o, EventArgs args) static void Dialog (object o, EventArgs args)
{ {
AddWindow (TestDialog.Create ()); AddWindow (TestDialog.Create ());
@ -142,24 +128,14 @@ namespace WidgetViewer {
AddWindow (TestFlipping.Create ()); AddWindow (TestFlipping.Create ());
} }
static void Menus (object o, EventArgs args)
{
//AddWindow (TestMenus.Create ());
}
static void Size_Groups (object o, EventArgs args) static void Size_Groups (object o, EventArgs args)
{ {
AddWindow (TestSizeGroup.Create ()); AddWindow (TestSizeGroup.Create ());
} }
static void New_Combo_Box (object o, EventArgs args) static void Combo_Box (object o, EventArgs args)
{ {
AddWindow (TestComboBox.Create ()); AddWindow (TestComboBox.Create ());
} }
static void Combo_Box (object o, EventArgs args)
{
AddWindow (TestCombo.Create ());
}
} }
} }

View File

@ -21,7 +21,7 @@ Valobj.cs: valobj-api.xml
$(RUNTIME) ../../generator/gapi_codegen.exe --generate $(srcdir)/valobj-api.xml --include ../../gtk/gtk-api.xml ../../gdk/gdk-api.xml --outdir=. --assembly-name=valobj-sharp $(RUNTIME) ../../generator/gapi_codegen.exe --generate $(srcdir)/valobj-api.xml --include ../../gtk/gtk-api.xml ../../gdk/gdk-api.xml --outdir=. --assembly-name=valobj-sharp
api: api:
PATH=../../parser:$PATH $(RUNTIME) ../../parser/gapi-parser.exe valobj-sources.xml PATH=../../parser:$(PATH) $(RUNTIME) ../../parser/gapi-parser.exe valobj-sources.xml
install: install:

View File

@ -1,5 +1,5 @@
<?xml version="1.0"?> <?xml version="1.0"?>
<api> <api parser_version="2">
<!-- <!--
This file was automatically generated. This file was automatically generated.
@ -8,6 +8,9 @@
--> -->
<namespace name="Gtksharp" library="libvalobj.dll"> <namespace name="Gtksharp" library="libvalobj.dll">
<object name="Valobj" cname="GtksharpValobj" parent="GObject"> <object name="Valobj" cname="GtksharpValobj" parent="GObject">
<class_struct cname="GtksharpValobjClass">
<field name="ParentClass" cname="parent_class" type="GObjectClass" />
</class_struct>
<field name="TheBoolean" cname="the_boolean" type="gboolean" /> <field name="TheBoolean" cname="the_boolean" type="gboolean" />
<field name="TheInt" cname="the_int" type="int" /> <field name="TheInt" cname="the_int" type="int" />
<field name="TheUint" cname="the_uint" type="guint" /> <field name="TheUint" cname="the_uint" type="guint" />

View File

@ -6,8 +6,7 @@
#ifndef GTKSHARP_VALOBJ_H #ifndef GTKSHARP_VALOBJ_H
#define GTKSHARP_VALOBJ_H 1 #define GTKSHARP_VALOBJ_H 1
#include <gtk/gtkwidget.h> #include <gtk/gtk.h>
#include <gtk/gtkenums.h>
#define GTKSHARP_TYPE_VALOBJ (gtksharp_valobj_get_type ()) #define GTKSHARP_TYPE_VALOBJ (gtksharp_valobj_get_type ())
#define GTKSHARP_VALOBJ(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), GTKSHARP_TYPE_VALOBJ, GtksharpValobj)) #define GTKSHARP_VALOBJ(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), GTKSHARP_TYPE_VALOBJ, GtksharpValobj))