From e11b5694840ba23fa4662e81434dfc7df084fc52 Mon Sep 17 00:00:00 2001 From: John Luke Date: Thu, 20 Nov 2003 01:07:35 +0000 Subject: [PATCH] *.cs: update to use Button ("stock_id") DemoTextView.cs: use tag.FontDesc.Weight svn path=/trunk/gtk-sharp/; revision=20253 --- sample/GtkDemo/DemoApplicationWindow.cs | 4 ++-- sample/GtkDemo/DemoButtonBox.cs | 6 +++--- sample/GtkDemo/DemoSizeGroup.cs | 2 +- sample/GtkDemo/DemoTextView.cs | 27 +++++++++++++------------ 4 files changed, 20 insertions(+), 19 deletions(-) diff --git a/sample/GtkDemo/DemoApplicationWindow.cs b/sample/GtkDemo/DemoApplicationWindow.cs index e78446234..56e36cda9 100644 --- a/sample/GtkDemo/DemoApplicationWindow.cs +++ b/sample/GtkDemo/DemoApplicationWindow.cs @@ -79,11 +79,11 @@ namespace GtkDemo { Toolbar toolbar = new Toolbar (); - Button open = Button.NewFromStock (Stock.Open); + Button open = new Button (Stock.Open); open.Clicked += new EventHandler (OnToolbarClicked); toolbar.AppendWidget (open, "Open", "Open"); - Button quit = Button.NewFromStock (Stock.Quit); + Button quit = new Button (Stock.Quit); quit.Clicked += new EventHandler (OnToolbarClicked); toolbar.AppendWidget (quit, "Quit", "Quit"); diff --git a/sample/GtkDemo/DemoButtonBox.cs b/sample/GtkDemo/DemoButtonBox.cs index 43d0f6ba7..e9fb8dc38 100644 --- a/sample/GtkDemo/DemoButtonBox.cs +++ b/sample/GtkDemo/DemoButtonBox.cs @@ -84,11 +84,11 @@ namespace GtkDemo bbox.Layout = layout; bbox.Spacing= spacing; - Button buttonOk = Button.NewFromStock (Stock.Ok); + Button buttonOk = new Button (Stock.Ok); bbox.Add (buttonOk); - Button buttonCancel = Button.NewFromStock (Stock.Cancel); + Button buttonCancel = new Button (Stock.Cancel); bbox.Add (buttonCancel); - Button buttonHelp = Button.NewFromStock (Stock.Help); + Button buttonHelp = new Button (Stock.Help); bbox.Add (buttonHelp); return frame; diff --git a/sample/GtkDemo/DemoSizeGroup.cs b/sample/GtkDemo/DemoSizeGroup.cs index d330f4c0c..c349ed648 100644 --- a/sample/GtkDemo/DemoSizeGroup.cs +++ b/sample/GtkDemo/DemoSizeGroup.cs @@ -81,7 +81,7 @@ namespace GtkDemo checkButton.Active = true; checkButton.Toggled += new EventHandler (ButtonToggleCb); - Button CloseButton = Button.NewFromStock (Stock.Close); + Button CloseButton = new Button (Stock.Close); window.AddActionWidget (CloseButton, 5); window.Response += new ResponseHandler (ResponseCallback); diff --git a/sample/GtkDemo/DemoTextView.cs b/sample/GtkDemo/DemoTextView.cs index 76f32be13..ec303832c 100644 --- a/sample/GtkDemo/DemoTextView.cs +++ b/sample/GtkDemo/DemoTextView.cs @@ -132,7 +132,7 @@ namespace GtkDemo */ TextTag tag = new TextTag("heading"); - //tag.Weigth = Pango.Weight.Bold; + tag.FontDesc.Weight = Pango.Weight.Bold; tag.Size = (int) Pango.Scale.PangoScale * 15; buffer.TagTable.Add(tag); @@ -141,12 +141,10 @@ namespace GtkDemo buffer.TagTable.Add(tag); tag = new TextTag("bold"); - // An object reference is required for the non-static field `Weight' - //tag.Weight = Pango.Weight.Bold; + tag.FontDesc.Weight = Pango.Weight.Bold; buffer.TagTable.Add(tag); tag = new TextTag("big"); - // Expression denotes a `type' where a `variable, value' was expected tag.Size = (int) Pango.Scale.PangoScale * 20; buffer.TagTable.Add(tag); @@ -173,16 +171,16 @@ namespace GtkDemo int gray50_width = 2; int gray50_height = 2; string gray50_bits = new string ((char) 0x02, (char) 0x01); - //Bitmap stipple = Bitmap.CreateFromData(null, (string) gray50_bits, gray50_width, gray50_height ); - + // Pixmap stipple = Pixmap.CreateFromData (null, (string) gray50_bits, gray50_width, gray50_height, 16, Color.Zero, Color.Zero); + tag = new TextTag("background_stipple"); - // tag.BackgroundStipple = stipple; + // tag.BackgroundStipple = stipple; // Cannot convert type 'Gdk.Bitmap' to 'Gdk.Pixmap' buffer.TagTable.Add(tag); tag = new TextTag("foreground_stipple"); // Cannot convert type 'Gdk.Bitmap' to 'Gdk.Pixmap' - // tag.ForegroundStipple = stipple; + // tag.ForegroundStipple = stipple; buffer.TagTable.Add(tag); tag = new TextTag("big_gap_before_line"); @@ -250,7 +248,7 @@ namespace GtkDemo tag = new TextTag("rtl_quote"); tag.WrapMode = WrapMode.Word; - //tag.Direction = TextMode.Dir.Rtl + tag.Direction = TextDirection.Rtl; tag.Indent = 30; tag.LeftMargin = 20; tag.RightMargin = 20; @@ -266,10 +264,13 @@ namespace GtkDemo */ // Error handling here, check for file existence, etc. - - Pixbuf pixbuf = new Pixbuf ("images/gtk-logo-rgb.gif"); - pixbuf.ScaleSimple (32, 32, InterpType.Bilinear); - + Pixbuf pixbuf = null; + + if (File.Exists ("images/gtk-logo-rgb.gif")) + { + pixbuf = new Pixbuf ("images/gtk-logo-rgb.gif"); + pixbuf.ScaleSimple (32, 32, InterpType.Bilinear); + } /* get start of buffer; each insertion will revalidate the * iterator to point to just after the inserted text. */