2002-07-18 Duncan Mak <duncan@ximian.com>

* WidgetViewer.cs: Fixed InvalidCastException.

	* TestStatusbar.cs: Made it work. Sigh, I dunno why I got it wrong
	the first time.

	* TestMenus.cs: Use null instead of new SList (IntPtr.Zero); and
	remove the unnecessary try... catch block.

svn path=/trunk/gtk-sharp/; revision=5889
This commit is contained in:
Duncan Mak 2002-07-18 12:06:17 +00:00
parent 6f5bbc2259
commit aeb6280e2f
5 changed files with 30 additions and 15 deletions

View file

@ -1,7 +1,12 @@
2002-07-18 Duncan Mak <duncan@ximian.com>
* WidgetViewer.cs: Fixed InvalidCastException.
* TestStatusbar.cs: Made it work. Sigh, I dunno why I got it wrong
the first time.
* TestMenus.cs: Use null instead of new SList (IntPtr.Zero); and
remove try... catch block.
remove the unnecessary try... catch block.
2002-07-18 Duncan Mak <duncan@ximian.com>
@ -10,7 +15,6 @@
* TestFileSelection.cs:
* TestFlipping.cs:
* TestMenus.cs:
* TestRadioButton.cs:
* TestRange.cs:
* TestStatusbar.cs:

View file

@ -2,9 +2,9 @@ MCS=mcs
all:
$(MCS) -o WidgetViewer.exe -r glib-sharp -r gdk-sharp -r gtk-sharp \
TestCheckButton.cs TestColorSelection.cs TestFileSelection.cs TestRadioButton.cs \
TestRange.cs TestStatusbar.cs TestToolbar.cs TestDialog.cs TestFlipping.cs \
TestMenus.cs \
TestCheckButton.cs TestColorSelection.cs TestFileSelection.cs \
TestRadioButton.cs TestRange.cs TestStatusbar.cs TestToolbar.cs \
TestDialog.csTestFlipping.cs TestMenus.cs \
WidgetViewer.cs
clean:
rm -f *.exe *~

View file

@ -40,7 +40,7 @@ namespace WidgetViewer {
menuitem.Submenu = Create_Menu (3, true);
menubar.Append (menuitem);
Image image = new Image ("gtk-help", IconSize.Menu);
Image image = new Image (Stock.Help, IconSize.Menu);
menuitem = new ImageMenuItem ("Help");
((ImageMenuItem) menuitem).Image = image;

View file

@ -18,6 +18,7 @@ namespace WidgetViewer {
static Window window = null;
static Statusbar statusbar = null;
static int counter = 1;
static uint context_id ;
public static Gtk.Window Create ()
{
@ -33,7 +34,7 @@ namespace WidgetViewer {
statusbar = new Statusbar ();
box1.PackEnd (statusbar, true, true, 0);
statusbar.TextPopped += new EventHandler (statusbar_popped);
statusbar.TextPopped += new TextPoppedHandler (statusbar_popped);
Button button = new Button ("push");
box2.PackStart (button, false, false, 0);
@ -41,7 +42,7 @@ namespace WidgetViewer {
button = new Button ("pop");
box2.PackStart (button, false, false, 0);
button.Clicked += new EventHandler (statusbar_popped);
button.Clicked += new EventHandler (pop_clicked);
box1.PackStart (new HSeparator (), false, true, 0);
@ -59,17 +60,27 @@ namespace WidgetViewer {
return window;
}
static void statusbar_popped (object o, EventArgs args)
static void pop_clicked (object o, EventArgs args)
{
statusbar.Pop ((uint) 1);
Console.WriteLine ("Pop");
statusbar.Pop (context_id);
}
static void statusbar_popped (object o, TextPoppedArgs args)
{
Console.WriteLine ("statusbar_popped signal");
Console.WriteLine (args.Text);
Console.WriteLine (args.ContextId);
}
static void statusbar_pushed (object o, EventArgs args)
{
if (counter < 1024) {
statusbar.Push (1, String.Format ("Push #{0}", counter));
counter ++;
}
string content = String.Format ("Push #{0}", counter);
context_id = statusbar.GetContextId (content);
statusbar.Push (context_id, content);
counter ++;
return;
}
static void Close_Button (object o, EventArgs args)

View file

@ -86,7 +86,7 @@ namespace WidgetViewer {
static void Close_Button (object o, EventArgs args)
{
Window_Delete (o, (DeleteEventArgs) args);
Application.Quit ();
}
static void Check_Buttons (object o, EventArgs args)