*.cs: update to use Button ("stock_id")

DemoTextView.cs: use tag.FontDesc.Weight

svn path=/trunk/gtk-sharp/; revision=20253
This commit is contained in:
John Luke 2003-11-20 01:07:35 +00:00
parent 5cebcec983
commit e11b569484
4 changed files with 20 additions and 19 deletions

View File

@ -79,11 +79,11 @@ namespace GtkDemo
{ {
Toolbar toolbar = new Toolbar (); Toolbar toolbar = new Toolbar ();
Button open = Button.NewFromStock (Stock.Open); Button open = new Button (Stock.Open);
open.Clicked += new EventHandler (OnToolbarClicked); open.Clicked += new EventHandler (OnToolbarClicked);
toolbar.AppendWidget (open, "Open", "Open"); toolbar.AppendWidget (open, "Open", "Open");
Button quit = Button.NewFromStock (Stock.Quit); Button quit = new Button (Stock.Quit);
quit.Clicked += new EventHandler (OnToolbarClicked); quit.Clicked += new EventHandler (OnToolbarClicked);
toolbar.AppendWidget (quit, "Quit", "Quit"); toolbar.AppendWidget (quit, "Quit", "Quit");

View File

@ -84,11 +84,11 @@ namespace GtkDemo
bbox.Layout = layout; bbox.Layout = layout;
bbox.Spacing= spacing; bbox.Spacing= spacing;
Button buttonOk = Button.NewFromStock (Stock.Ok); Button buttonOk = new Button (Stock.Ok);
bbox.Add (buttonOk); bbox.Add (buttonOk);
Button buttonCancel = Button.NewFromStock (Stock.Cancel); Button buttonCancel = new Button (Stock.Cancel);
bbox.Add (buttonCancel); bbox.Add (buttonCancel);
Button buttonHelp = Button.NewFromStock (Stock.Help); Button buttonHelp = new Button (Stock.Help);
bbox.Add (buttonHelp); bbox.Add (buttonHelp);
return frame; return frame;

View File

@ -81,7 +81,7 @@ namespace GtkDemo
checkButton.Active = true; checkButton.Active = true;
checkButton.Toggled += new EventHandler (ButtonToggleCb); checkButton.Toggled += new EventHandler (ButtonToggleCb);
Button CloseButton = Button.NewFromStock (Stock.Close); Button CloseButton = new Button (Stock.Close);
window.AddActionWidget (CloseButton, 5); window.AddActionWidget (CloseButton, 5);
window.Response += new ResponseHandler (ResponseCallback); window.Response += new ResponseHandler (ResponseCallback);

View File

@ -132,7 +132,7 @@ namespace GtkDemo
*/ */
TextTag tag = new TextTag("heading"); TextTag tag = new TextTag("heading");
//tag.Weigth = Pango.Weight.Bold; tag.FontDesc.Weight = Pango.Weight.Bold;
tag.Size = (int) Pango.Scale.PangoScale * 15; tag.Size = (int) Pango.Scale.PangoScale * 15;
buffer.TagTable.Add(tag); buffer.TagTable.Add(tag);
@ -141,12 +141,10 @@ namespace GtkDemo
buffer.TagTable.Add(tag); buffer.TagTable.Add(tag);
tag = new TextTag("bold"); tag = new TextTag("bold");
// An object reference is required for the non-static field `Weight' tag.FontDesc.Weight = Pango.Weight.Bold;
//tag.Weight = Pango.Weight.Bold;
buffer.TagTable.Add(tag); buffer.TagTable.Add(tag);
tag = new TextTag("big"); tag = new TextTag("big");
// Expression denotes a `type' where a `variable, value' was expected
tag.Size = (int) Pango.Scale.PangoScale * 20; tag.Size = (int) Pango.Scale.PangoScale * 20;
buffer.TagTable.Add(tag); buffer.TagTable.Add(tag);
@ -173,16 +171,16 @@ namespace GtkDemo
int gray50_width = 2; int gray50_width = 2;
int gray50_height = 2; int gray50_height = 2;
string gray50_bits = new string ((char) 0x02, (char) 0x01); 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 = new TextTag("background_stipple");
// tag.BackgroundStipple = stipple; // tag.BackgroundStipple = stipple;
// Cannot convert type 'Gdk.Bitmap' to 'Gdk.Pixmap' // Cannot convert type 'Gdk.Bitmap' to 'Gdk.Pixmap'
buffer.TagTable.Add(tag); buffer.TagTable.Add(tag);
tag = new TextTag("foreground_stipple"); tag = new TextTag("foreground_stipple");
// Cannot convert type 'Gdk.Bitmap' to 'Gdk.Pixmap' // Cannot convert type 'Gdk.Bitmap' to 'Gdk.Pixmap'
// tag.ForegroundStipple = stipple; // tag.ForegroundStipple = stipple;
buffer.TagTable.Add(tag); buffer.TagTable.Add(tag);
tag = new TextTag("big_gap_before_line"); tag = new TextTag("big_gap_before_line");
@ -250,7 +248,7 @@ namespace GtkDemo
tag = new TextTag("rtl_quote"); tag = new TextTag("rtl_quote");
tag.WrapMode = WrapMode.Word; tag.WrapMode = WrapMode.Word;
//tag.Direction = TextMode.Dir.Rtl tag.Direction = TextDirection.Rtl;
tag.Indent = 30; tag.Indent = 30;
tag.LeftMargin = 20; tag.LeftMargin = 20;
tag.RightMargin = 20; tag.RightMargin = 20;
@ -266,10 +264,13 @@ namespace GtkDemo
*/ */
// Error handling here, check for file existence, etc. // Error handling here, check for file existence, etc.
Pixbuf pixbuf = null;
Pixbuf pixbuf = new Pixbuf ("images/gtk-logo-rgb.gif");
pixbuf.ScaleSimple (32, 32, InterpType.Bilinear); 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 /* get start of buffer; each insertion will revalidate the
* iterator to point to just after the inserted text. * iterator to point to just after the inserted text.
*/ */