Hello, Here's a Patch for:
monkeyguide/Changelog
monkeyguide/html/en/gnome/bindings/gnome/hello_world.html
monkeyguide/html/en/cross_platform/gui.html
monkeyguide/html/en/gnome/bindings/gnome/gnome.html
(The ChangeLog update is included in the Patch, so you can
see what's been done there.)
I've also attached a GNOME.NET "Adding Contents" tutorial. This
should be placed at:
monkeyguide/html/en/gnome/bindings/gnome/adding_contents.html
Could someone submit all this.
See ya
--
Charles Iliya Krempeaux, BSc
[EMAIL PROTECTED]
________________________________________________________________________
Reptile Consulting & Services 604-REPTILE http://www.reptile.ca/
? html/en/gnome/bindings/gnome/adding_contents.html
Index: Changelog
===================================================================
RCS file: /mono/monkeyguide/Changelog,v
retrieving revision 1.27
diff -u -r1.27 Changelog
--- Changelog 13 Feb 2003 21:02:49 -0000 1.27
+++ Changelog 23 Feb 2003 05:31:00 -0000
@@ -1,3 +1,14 @@
+2003-02-22 Charles Iliya Krempeaux <[EMAIL PROTECTED]>
+ * monkeyguide/html/en/gnome/bindings/gnome/hello_world.html :
+ Updated it to my latest draft of this tutorial.
+ * html/en/cross_platform/gui.html : It previously called
+ the GNOME.NET chapter to be chapter 12. Corrected this
+ to say Chapter 18.
+ * html/en/gnome/bindings/gnome/gnome.html : Added a link for
+ "Adding Contents" tutorial, to the tables of contents.
+ * html/en/gnome/bindings/gnome/adding_contents.html : Created
+ the GNOME.NET "Adding Contents" tutorial.
+
2003-02-13 Martin Willemoes Hansen
* Corrected a bug using [GladeWidget] in
/gnome/bindings/glade/glade.html
@@ -166,4 +177,4 @@
2002-11-09 Johannes Roith <[EMAIL PROTECTED]>
* Initial import Martin Willemoes Hansen's tutorial and move
- stylesheets to an separate file
\ No newline at end of file
+ stylesheets to an separate file
Index: html/en/cross_platform/gui.html
===================================================================
RCS file: /mono/monkeyguide/html/en/cross_platform/gui.html,v
retrieving revision 1.3
diff -u -r1.3 gui.html
--- html/en/cross_platform/gui.html 19 Feb 2003 19:09:11 -0000 1.3
+++ html/en/cross_platform/gui.html 23 Feb 2003 05:31:01 -0000
@@ -47,9 +47,9 @@
<li>Glade - Forms, based on XML, that can be changed dynamically
<li>Glade Interface Builder - Tools to easily create those XML files.
</ul>
-The next step is, to learn about these in <a href="../index.html#gnome">chapter 12</a>.
+The next step is, to learn about these in <a href="../index.html#gnome">chapter 18</a>.
<p>
<div class="copyright">The Mono Handbook - <a href="http://www.go-mono.org">© Copyright 2003 by Johannes Roith</a></div>
</body>
-</html>
\ No newline at end of file
+</html>
Index: html/en/gnome/bindings/gnome/gnome.html
===================================================================
RCS file: /mono/monkeyguide/html/en/gnome/bindings/gnome/gnome.html,v
retrieving revision 1.3
diff -u -r1.3 gnome.html
--- html/en/gnome/bindings/gnome/gnome.html 19 Feb 2003 19:09:12 -0000 1.3
+++ html/en/gnome/bindings/gnome/gnome.html 23 Feb 2003 05:31:01 -0000
@@ -21,6 +21,7 @@
<ul>
<li>2.1. <a href="hello_world.html">Hello World in Gnome#</a>
+ <li>2.2. <a href="adding_contents.html">Adding Contents</a>
</ul>
</ul>
@@ -45,4 +46,4 @@
<div class="copyright">The Mono Handbook - <a href="http://www.go-mono.org">© Copyright 2002 by Johannes Roith & Martin Willemoes Hansen</a></div>
</body>
-</html>
\ No newline at end of file
+</html>
Index: html/en/gnome/bindings/gnome/hello_world.html
===================================================================
RCS file: /mono/monkeyguide/html/en/gnome/bindings/gnome/hello_world.html,v
retrieving revision 1.3
diff -u -r1.3 hello_world.html
--- html/en/gnome/bindings/gnome/hello_world.html 19 Feb 2003 19:09:12 -0000 1.3
+++ html/en/gnome/bindings/gnome/hello_world.html 23 Feb 2003 05:31:01 -0000
@@ -1,209 +1,271 @@
-<html>
-<head>
-<title>The Mono Handbook - GNOME.NET - GTK#</title>
-
-<link rel="stylesheet" type="text/css" href="../../../style.css" />
-
-</head>
-<body>
-
-<div class="topframe" width="100%"><a href="../../../index.html"><img src="../../../mg.png" border=0></a><a href="../../index.html"><img src="../../gn.png" border=0></a></div>
-<div class="navbar" width="100%"><a href="../../../index.html">The Mono Handbook</a> > <a href="../../index.html">GNOME.NET</a> > C# bindings > <b>GTK#</b></div>
-<p>
-
-<h1>GNOME#</h1>
-
-<h2>HelloWorld, first try</h2>
-
-HelloWorld in Gnome#:
-
-<pre class="code">
-
- class Hello
- {
- static void Main(string[] args)
- {
- Gnome.Program program =
- new Gnome.Program("Hello World", "1.0", Gnome.Modules.UI,
-args);
-
- Gnome.App app = new Gnome.App("Hello World", "Hello World");
- app.Show();
-
- program.Run();
- }
- }
-</pre>
-compile:
-
-<pre class="console">
-mcs helloworld.cs -r gnome-sharp.dll
-</pre>
-It's a bit longer than console hello world and needs some explanation.
-
-In Main() at first you see:
-
-<pre class="code">
- Gnome.Program program =
- new Gnome.Program("Hello World", "1.0", Gnome.Modules.UI,args);
-</pre>
-This initializes GNOME and is needed in every GNOME Application. Here
-we are creating a variable of type Gnome.Program, called program. This
-variable, program, is used to control the GNOME program, as we'll see
-later.
-
-Next we see:
-<pre class="code">
- Gnome.App app = new Gnome.App("Hello World", "Hello World");
-</pre>
-This creates our GNOME Application Window. (That's what you see on the
-screen.)
-
-We then see:
-<pre class="code">
- app.Show();
-</pre>
-This makes the GNOME Application Window (that you created with the
-previous line on code) visible on the screen. With GNOME, things don't
-automatically display themselves unless you explicitly tell them too.
-
-And finally we see:
-<pre class="code">
- program.Run();
-</pre>
-This make your GNOME program run. It makes all the magic happen, that
-you don't need to worry about at this moment. Needless to say though,
-you need to do this to make your GNOME Application work.
-
-
-<h2>HelloWorld, second try</h2>
-
-While the above program compiles and runs, it's doesn't quit, properly.
-You have to exit with CTRL+C. (Ideally, we want the program to close
-when you press the "X" on the title bar. Which is what this next
-example does.)
-
-
-<pre class="code">
-
- class Hello
- {
- static Gnome.Program program;
-
- static void Main(string[] args)
- {
- program =
- new Gnome.Program("Hello World", "1.0", Gnome.Modules.UI,
-args);
-
- Gnome.App app = new Gnome.App("Hello World", "Hello World");
- app.DeleteEvent += new
-GtkSharp.DeleteEventHandler(delete_event);
- app.Show();
-
- program.Run();
- }
-
- static void delete_event(object obj, GtkSharp.DeleteEventArgs
-args)
- {
- program.Quit();
- }
- }
-
-</pre>
-compile:
-<pre class="console">
-mcs helloworld.cs -r gnome-sharp.dll -r gtk-sharp.dll
-</pre>
-The first change to notice is that the variable program has been moved
-out of Main() and made a (static) class variable. We see this in the
-line:
-<pre class="code">
- static Gnome.Program program;
-</pre>
-This was done so we could access it from the delete_event function,
-which we will talk about later.
-<p>
-The next difference we is in the Main() method, and is:
-<pre class="code">
- app.DeleteEvent += new
-GtkSharp.DeleteEventHandler(delete_event);
-</pre>
-This makes it so that when the "X" button on the title bar is pressed,
-the function delete_event is called. Technically, when the "X" button
-is pressed, the program receives a DeleteEvent, which is what you see in
-the code above.
-<p>
-The final difference that you see is:
-<pre class="code">
- static void delete_event(object obj, GtkSharp.DeleteEventArgs
-args)
- {
- program.Quit();
- }
-</pre>
-This is the function that is called when the application receives a
-DeleteEvent. I.e., when the user clicks the "X" button on the title
-bar. As you can hopefully see, when this function is called, the
-program will quit.
-
-<p>
-
-<h2>HelloWorld, third try</h2>
-
-While the above code functioned properly, and did what we wanted, it was
-kind of sloppy. The sloppyness came from having to make the program
-variable a (static) class variable. A much more elegant way of doing
-the same thing involves using subclassing (also called inheritance) to
-accomplish the same thing. Which can be seen in the example below.
-<pre class="code">
- class Hello
- : Gnome.Program
- {
- Hello(string[] args)
- : base("Hello World", "1.0", Gnome.Modules.UI, args)
- {
- // Nothing here.
- }
-
- static void Main(string[] args)
- {
-
- Hello hello = new Hello(args);
-
- hello.run();
- }
-
- void delete_event(object obj, GtkSharp.DeleteEventArgs args)
- {
- this.Quit();
- }
-
- void run()
- {
- Gnome.App app = new Gnome.App("Hello World", "Hello World");
- app.DeleteEvent += new
-GtkSharp.DeleteEventHandler(delete_event);
- app.Show();
-
- this.Run();
- }
- }
-</pre>
-
-compile:
-<pre class="console">
-mcs helloworld.cs -r gnome-sharp.dll -r gtk-sharp.dll
-</pre>
-#### I'll add an explanation of this later today.
-
-
-
-
-<p>
-
-<div class="copyright">The Mono Handbook - <a href="http://www.go-mono.org">© Copyright 2002 by Johannes Roith & Martin Willemoes Hansen</a></div>
-
-</body>
-</html>
+<html>
+
+ <head>
+ <title>The Mono Handbook - GNOME.NET - GNOME#</title>
+ <link rel="stylesheet" type="text/css" href="../../../style.css" />
+ </head>
+
+
+ <body>
+
+ <div class="topframe" width="100%"><a href="../../../index.html"><img src="../../../mg.png" border=0></a><a href="../../index.html"><img src="../../gn.png" border=0></a></div>
+ <div class="navbar" width="100%"><a href="../../../index.html">The Mono Handbook</a> > <a href="../../index.html">GNOME.NET</a> > C# bindings > <b>GNOME#</b></div>
+
+ <p></p>
+
+ <h1>GNOME.NET</h1>
+
+ <p>
+ This tutorial gets you started with writing GNOME.NET programs.
+ </p>
+
+ <h2>HelloWorld, first try</h2>
+
+ <p>
+ <code>helloworld1.cs</code>:
+ </p>
+
+<pre class="code">
+ class HelloWorld
+ {
+ static void Main(string[] args)
+ {
+ Gnome.Program program =
+ new Gnome.Program("Hello World", "1.0", Gnome.Modules.UI, args);
+
+ Gnome.App app = new Gnome.App("Hello World", "Hello World");
+ app.Show();
+
+ program.Run();
+ }
+ }
+</pre>
+
+ <p>
+ compile:
+ </p>
+
+<pre class="console">
+mcs helloworld.cs -r gnome-sharp.dll
+</pre>
+
+ <p>
+ run:
+ </p>
+
+<pre class="console">
+mono helloworld1.exe
+</pre>
+
+
+ <p>
+ It's a bit longer than console Hello World and needs some explanation.
+ </p>
+
+ <p>
+ In <code>Main()</code> at first you see:
+ </p>
+
+
+<pre class="code">
+ Gnome.Program program =
+ new Gnome.Program("Hello World", "1.0", Gnome.Modules.UI, args);
+</pre>
+
+
+ <p>
+ This initializes GNOME and is needed in every GNOME application. Here we are
+ creating a variable of type <code>Gnome.Program</code>, called <code>program</code>.
+ This variable, <code>program</code>, is used to control the GNOME program, as we'll see later.
+ </p>
+
+ <p>
+ Next we see:
+ </p>
+
+<pre class="code">
+ Gnome.App app = new Gnome.App("Hello World", "Hello World");
+</pre>
+
+
+ <p>
+ This creates our GNOME application window. (That's what you see on the screen.)
+ </p>
+
+ <p>
+ We then see:
+ </p>
+
+<pre class="code">
+ app.Show();
+</pre>
+
+ <p>
+ This makes the GNOME Application Window (that you created with the previous line of code)
+ visible on the screen. With GNOME, things don't automatically display themselves unless
+ you explicitly tell them too.
+ </p>
+
+ <p>
+ And finally we see:
+ </p>
+
+<pre class="code">
+ program.Run();
+</pre>
+
+ <p>
+ This make your GNOME program <i>run</i>. It makes all the magic happen, that you don't
+ need to worry about at this moment. Needless to say though, you need to do this to make
+ your GNOME Application work.
+ </p>
+
+
+
+ <h2>HelloWorld, second try</h2>
+
+ <p>
+ While the above program compiles and runs, it's doesn't quit, properly. You have to exit
+ by pressing CTRL+C. (Ideally, we want the program to close when you press the "X" on the
+ title bar. Which is what this next example does.)
+ </p>
+
+ <p>
+ <code>helloworld2.cs</code>:
+ </p>
+
+<pre class="code">
+ class HelloWorld
+ {
+ static void Main(string[] args)
+ {
+ Gnome.Program program =
+ new Gnome.Program("Hello World", "1.0", Gnome.Modules.UI, args);
+
+ MyMainWindow app = new MyMainWindow(program);
+ app.Show();
+
+ program.Run();
+ }
+ }
+
+
+
+ class MyMainWindow
+ : Gnome.App
+ {
+ Gnome.Program program;
+
+ public MyMainWindow(Gnome.Program gnome_program)
+ : base("Hello World", "Hello World")
+ {
+ this.program = gnome_program;
+
+ this.DeleteEvent += new GtkSharp.DeleteEventHandler(delete_event);
+ }
+
+ private void delete_event(object obj, GtkSharp.DeleteEventArgs args)
+ {
+ this.program.Quit();
+ }
+ }
+</pre>
+
+
+ <p>
+ compile:
+ </p>
+
+<pre class="console">
+mcs helloworld2.cs -r gnome-sharp.dll -r gtk-sharp.dll
+</pre>
+
+ <p>
+ run:
+ </p>
+
+<pre class="console">
+mono helloworld2.exe
+</pre>
+
+ <p>
+ The first thing you probably have noticed is that there are now two classes.
+ The first class -- <code>HelloWorld</code> -- is almost identical to the version
+ in the previous example. Except for the following line:
+ </p>
+
+<pre class="code">
+ MyMainWindow app = new MyMainWindow(program);
+</pre>
+
+ <p>
+ You can compare this to the equivalent line in the previous code:
+ </p>
+
+<pre class="code">
+ Gnome.App app = new Gnome.App("Hello World", "Hello World");
+</pre>
+
+ <p>
+ The difference is that app is no longer an instance of <code>Gnome.App</code>,
+ as it was in the first example <code>helloworld.cs</code>. But is now an instance
+ of a new class that we just created: <code>MyMainWindow</code>. (Also, what we
+ pass to the constructor of <code>MyMainWindow</code> is different from what we
+ passed to the constructor of <code>Gnome.App</code>.)
+ </p>
+
+ <p>
+ In other words, the only difference (in this class) is that we are using a different
+ class for our window.
+ </p>
+
+ <p>
+ Now let us take a look at our <code>MyMainWindow</code> class.
+ </p>
+
+ <p>
+ We created this new class because Gnome.App did not do exactly what we wanted it to.
+ We want our application window to close when the "X" on the title bar is pressed.
+ Which is what the code in the <code>MyMainWindow</code> class accomplishes.
+ </p>
+
+ <p>
+ The important thing to focus on is this line:
+ </p>
+
+<pre class="code">
+ this.DeleteEvent += new GtkSharp.DeleteEventHandler(delete_event);
+</pre>
+
+ <p>
+ This makes it so that when the "X" button on the title bar is pressed, the
+ function <code>delete_event</code> is called. Technically, when the "X" button is pressed,
+ the program receives a <code>DeleteEvent</code>, which is what you see in the code above.
+ </p>
+
+ <p>
+ The next thing to focus on is the definition of <code>delete_event</code>:
+ </p>
+
+<pre class="code">
+ private void delete_event(object obj, GtkSharp.DeleteEventArgs args)
+ {
+ this.program.Quit();
+ }
+</pre>
+
+ <p>
+ This is the function that is called when the application receives a <code>DeleteEvent</code>.
+ I.e., when the user clicks the "X" button on the title bar. As you can hopefully see, when
+ this function is called, the program will quit.
+ </p>
+
+ <p>
+ Which is what we wanted.
+ </p>
+
+
+ </body>
+
+</html>
+
Title: The Mono Handbook - GNOME.NET - GNOME#
GNOME.NET
In the previous GNOME.NET tutorial, we learnt how to make a GNOME application window. However, other than being a good example to teach us GNOME.NET, that window was pretty useless, considering it didn't really do anything.
Any real application will have stuff inside the window. In this tutorial, we will show you how to give your window some contents.
Adding Contents
button.cs:
class MainClass
{
static void Main(string[] args)
{
Gnome.Program program =
new Gnome.Program("Hello World", "1.0", Gnome.Modules.UI, args);
MyMainWindow app = new MyMainWindow(program);
app.Show();
program.Run();
}
}
class MyMainWindow
: Gnome.App
{
Gnome.Program program;
public MyMainWindow(Gnome.Program gnome_program)
: base("Hello World", "Hello World")
{
this.program = gnome_program;
this.DeleteEvent += new GtkSharp.DeleteEventHandler(delete_event);
this.Contents = new Gtk.Button("Hello World");
}
private void delete_event(object obj, GtkSharp.DeleteEventArgs args)
{
this.program.Quit();
}
}
compile:
mcs button.cs -r gnome-sharp.dll
run:
mono button.exe
Except for one line, this code is virtually exactly like the helloworld2.cs
source code from the previous tutorial. The line that adds the button is:
this.Contents = new Gtk.Button("Hello World");
The magic comes from the Contents property of Gnome.App
(and all of Gnome.App's subclasses, like MyMainWindow).
What you assign to this goes inside the window. For example, I could put an image in there with:
Gtk.Image image = new Gtk.Image();
// put something in the image here.
this.Contents = image;
I could put in a Gnome.Canvas with.
this.Contents = new Gnome.Canvas();
(Hopefully you get the idea.) If you want to put something inside of
a Gnome.App (or one of its subclasses), then assign it to
its Contents property.
