mirror of
https://github.com/Ryujinx/GtkSharp.git
synced 2024-09-09 00:13:20 +02:00
add for Alejandro Snchez Acosta
svn path=/trunk/gtk-sharp/; revision=8888
This commit is contained in:
parent
19a8501d1e
commit
92500272bb
11
sample/tutorial/checkbuttons/Makefile
Normal file
11
sample/tutorial/checkbuttons/Makefile
Normal file
@ -0,0 +1,11 @@
|
||||
|
||||
CSC = mcs
|
||||
|
||||
DLLS = -r glib-sharp.dll \
|
||||
-r gtk-sharp.dll \
|
||||
-r System.Drawing.dll
|
||||
|
||||
all:
|
||||
$(CSC) /unsafe $(DLLS) checkbuttons.cs
|
||||
clean:
|
||||
rm -f *.exe
|
59
sample/tutorial/checkbuttons/checkbuttons.cs
Normal file
59
sample/tutorial/checkbuttons/checkbuttons.cs
Normal file
@ -0,0 +1,59 @@
|
||||
// checkbuttons.cs - GTK# Tutorial example
|
||||
//
|
||||
// Authors: Alejandro Sanchez Acosta <raciel@es.gnu.org>
|
||||
// Cesar Octavio Lopez Nataren <cesar@ciencias.unam.mx>
|
||||
//
|
||||
// (C) 2002 Alejandro Sanchez Acosta <raciel@es.gnu.org>
|
||||
// Cesar Octavio Lopez Nataren <cesar@ciencias.unam.mx>
|
||||
|
||||
namespace GtkSharpTutorial {
|
||||
|
||||
|
||||
using Gtk;
|
||||
using GtkSharp;
|
||||
using System;
|
||||
using System.Drawing;
|
||||
|
||||
|
||||
public class checkbuttons
|
||||
{
|
||||
static void delete_event(object obj, DeleteEventArgs args)
|
||||
{
|
||||
Application.Quit();
|
||||
}
|
||||
|
||||
static void clickedCallback(object obj, EventArgs args)
|
||||
{
|
||||
if (((CheckButton) obj).Active)
|
||||
Console.WriteLine ("CheckButton clicked, I'm activating");
|
||||
else
|
||||
Console.WriteLine ("CheckButton clicked, I'm desactivating");
|
||||
}
|
||||
|
||||
|
||||
public static void Main(string[] args)
|
||||
{
|
||||
Application.Init();
|
||||
|
||||
HBox hbox = new HBox(false, 0);
|
||||
hbox.BorderWidth = 2;
|
||||
|
||||
CheckButton cb1 = new CheckButton ("CheckButton 1");
|
||||
cb1.Clicked += new EventHandler (clickedCallback);
|
||||
|
||||
CheckButton cb2 = new CheckButton ("CheckButton 2");
|
||||
cb2.Clicked += new EventHandler (clickedCallback);
|
||||
|
||||
hbox.PackStart(cb1, false, false, 3);
|
||||
hbox.PackStart(cb2, false, false, 3);
|
||||
|
||||
Window window = new Window ("Check buttons");
|
||||
window.BorderWidth = 10;
|
||||
window.DeleteEvent += new DeleteEventHandler (delete_event);
|
||||
|
||||
window.Add(hbox);
|
||||
window.ShowAll();
|
||||
Application.Run();
|
||||
}
|
||||
}
|
||||
}
|
11
sample/tutorial/label/Makefile
Normal file
11
sample/tutorial/label/Makefile
Normal file
@ -0,0 +1,11 @@
|
||||
|
||||
CSC = mcs
|
||||
|
||||
DLLS = -r glib-sharp.dll \
|
||||
-r gtk-sharp.dll \
|
||||
-r System.Drawing.dll
|
||||
|
||||
all:
|
||||
$(CSC) /unsafe $(DLLS) label.cs
|
||||
clean:
|
||||
rm -f *.exe
|
133
sample/tutorial/label/label.cs
Normal file
133
sample/tutorial/label/label.cs
Normal file
@ -0,0 +1,133 @@
|
||||
// label.cs - Gtk# Tutorial example
|
||||
//
|
||||
// Author: Alejandro Sánchez Acosta <raciel@es.gnu.org>
|
||||
// Cesar Octavio Lopez Nataren <cesar@ciencias.unam.mx>
|
||||
//
|
||||
// (c) 2002 Alejandro Sánchez Acosta
|
||||
|
||||
namespace GtkSharpTutorial {
|
||||
|
||||
using Gtk;
|
||||
using GtkSharp;
|
||||
using System;
|
||||
using System.Drawing;
|
||||
|
||||
public class label
|
||||
{
|
||||
|
||||
static void delete_event (object obj, DeleteEventArgs args)
|
||||
{
|
||||
Application.Quit();
|
||||
}
|
||||
|
||||
static void exitbutton_event (object obj, EventArgs args)
|
||||
{
|
||||
Application.Quit();
|
||||
}
|
||||
|
||||
public static void Main (string[] args)
|
||||
{
|
||||
|
||||
Widget widget;
|
||||
Window window;
|
||||
HBox hbox;
|
||||
VBox vbox;
|
||||
Frame frame;
|
||||
Label label;
|
||||
|
||||
Application.Init ();
|
||||
|
||||
|
||||
window = new Window ("Label sample");
|
||||
|
||||
window.DeleteEvent += new DeleteEventHandler (delete_event);
|
||||
|
||||
window.Title = "Label";
|
||||
|
||||
hbox = new HBox (false, 5);
|
||||
vbox = new VBox (false, 5);
|
||||
|
||||
window.Add (hbox);
|
||||
hbox.PackStart (vbox, false, false, 0);
|
||||
|
||||
window.BorderWidth = 5;
|
||||
|
||||
frame = new Frame ("Normal Label");
|
||||
label = new Label ("This is a normal label");
|
||||
|
||||
frame.Add (label);
|
||||
vbox.PackStart (frame, false, false, 0);
|
||||
|
||||
frame = new Frame ("Multiline Label");
|
||||
label = new Label ("This is a Multi-line label\nSecond Line\nThird Line");
|
||||
|
||||
frame.Add (label);
|
||||
vbox.PackStart (frame, false, false, 0);
|
||||
|
||||
frame = new Frame ("Left Justified Label");
|
||||
label = new Label ("This is a Left-Justified\n" + "Multi-line label.\n" + "Third line");
|
||||
label.Justify = Justification.Left;
|
||||
|
||||
frame.Add (label);
|
||||
vbox.PackStart (frame, false, false, 0);
|
||||
|
||||
frame = new Frame ("Right Justified Label");
|
||||
label = new Label ("This is a Right Justified\nMulti-line label.\n" + "Fourth Line, (j/k)");
|
||||
label.Justify = Justification.Right;
|
||||
frame.Add (label);
|
||||
vbox.PackStart (frame, false, false, 0);
|
||||
|
||||
vbox = new VBox (false, 5);
|
||||
hbox.PackStart(vbox, false, false, 0);
|
||||
|
||||
frame = new Frame ("Line wrapped Label");
|
||||
label = new Label ("This is an example of a line-wrapped label. It " +
|
||||
"should not be taking up the entire " /* big space to test spacing */ +
|
||||
"width allocated to it, but automatically " +
|
||||
"wraps the words to fit. " +
|
||||
"The time has come, for all good men, to come to " +
|
||||
"the aid of their party. " +
|
||||
"The sixth sheik's six sheep's sick.\n" +
|
||||
" It supports multiple paragraphs correctly, " +
|
||||
"and correctly adds " +
|
||||
"many extra spaces. ");
|
||||
|
||||
label.LineWrap = true;
|
||||
|
||||
frame.Add (label);
|
||||
vbox.PackStart(frame, false, false, 0);
|
||||
|
||||
frame = new Frame ("Filled wrapped label");
|
||||
label = new Label ("This is an example of a line-wrapped, filled label. " +
|
||||
"It should be taking " +
|
||||
"up the entire width allocated to it. " +
|
||||
"Here is a sentence to prove " +
|
||||
"my point. Here is another sentence. " +
|
||||
"Here comes the sun, do de do de do.\n" +
|
||||
" This is a new paragraph.\n" +
|
||||
" This is another newer, longer, better " +
|
||||
"paragraph. It is coming to an end, "+
|
||||
"unfortunately.");
|
||||
|
||||
label.Justify = Justification.Fill;
|
||||
label.Wrap = true;
|
||||
frame.Add (label);
|
||||
vbox.PackStart (frame, false, false, 0);
|
||||
|
||||
|
||||
frame = new Frame ("Underlined label");
|
||||
|
||||
label = new Label ("This label is underlined!\n" + "This one is underlined in quite a funky fastion");
|
||||
|
||||
label.Justify = Justification.Left;
|
||||
label.Pattern = "_________________________ _ _________ _ ______ __ _______ ___";
|
||||
|
||||
frame.Add (label);
|
||||
vbox.PackStart (frame, false, false, 0);
|
||||
|
||||
window.ShowAll ();
|
||||
|
||||
Application.Run ();
|
||||
}
|
||||
}
|
||||
}
|
11
sample/tutorial/togglebutton/Makefile
Normal file
11
sample/tutorial/togglebutton/Makefile
Normal file
@ -0,0 +1,11 @@
|
||||
|
||||
CSC = mcs
|
||||
|
||||
DLLS = -r glib-sharp.dll \
|
||||
-r gtk-sharp.dll \
|
||||
-r System.Drawing.dll
|
||||
|
||||
all:
|
||||
$(CSC) /unsafe $(DLLS) togglebutton.cs
|
||||
clean:
|
||||
rm -f *.exe
|
80
sample/tutorial/togglebutton/togglebutton.cs
Normal file
80
sample/tutorial/togglebutton/togglebutton.cs
Normal file
@ -0,0 +1,80 @@
|
||||
// togglebuttons.cs - Gtk# Tutorial example
|
||||
//
|
||||
// Author: Alejandro Sánchez Acosta <raciel@es.gnu.org>
|
||||
// Cesar Octavio Lopez Nataren <cesar@ciencias.unam.mx>
|
||||
//
|
||||
// (c) 2002 Alejandro Sánchez Acosta
|
||||
|
||||
namespace GtkSharpTutorial {
|
||||
|
||||
using Gtk;
|
||||
using GtkSharp;
|
||||
using System;
|
||||
using System.Drawing;
|
||||
|
||||
public class checkbuttons
|
||||
{
|
||||
|
||||
static void delete_event (object obj, DeleteEventArgs args)
|
||||
{
|
||||
Application.Quit();
|
||||
}
|
||||
|
||||
static void exitbutton_event (object obj, EventArgs args)
|
||||
{
|
||||
Application.Quit();
|
||||
}
|
||||
|
||||
public static void Main(string[] args)
|
||||
{
|
||||
|
||||
Application.Init();
|
||||
|
||||
|
||||
Window window = new Window("toggle buttons");
|
||||
|
||||
window.DeleteEvent += new DeleteEventHandler (delete_event);
|
||||
|
||||
window.BorderWidth = 0;
|
||||
|
||||
VBox box1 = new VBox (false, 0);
|
||||
window.Add(box1);
|
||||
box1.Show();
|
||||
|
||||
VBox box2 = new VBox (false, 10);
|
||||
box2.BorderWidth = 10;
|
||||
box1.PackStart(box2, true, true, 0);
|
||||
box2.Show();
|
||||
|
||||
ToggleButton togglebutton = new ToggleButton ("button1");
|
||||
box2.PackStart(togglebutton, true, true, 0);
|
||||
togglebutton.Show();
|
||||
ToggleButton togglebutton2 = new ToggleButton("button2");
|
||||
togglebutton2.Active = true;
|
||||
box2.PackStart(togglebutton2, true, true, 0);
|
||||
togglebutton2.Show();
|
||||
|
||||
HSeparator separator = new HSeparator ();
|
||||
box1.PackStart (separator,false, true, 0);
|
||||
separator.Show();
|
||||
|
||||
VBox box3 = new VBox(false, 10);
|
||||
box3.BorderWidth = 10;
|
||||
box1.PackStart(box3,false, true, 0);
|
||||
box3.Show();
|
||||
|
||||
Button button = new Button ("close");
|
||||
button.Clicked += new EventHandler (exitbutton_event);
|
||||
|
||||
box3.PackStart(button, true, true, 0);
|
||||
button.CanDefault = true;
|
||||
button.GrabDefault();
|
||||
button.Show();
|
||||
|
||||
window.ShowAll();
|
||||
|
||||
Application.Run();
|
||||
|
||||
}
|
||||
}
|
||||
}
|
Loading…
Reference in New Issue
Block a user