How To GTK
Print Hello World
Write Basic Syntax
Use Properties
Make An If Else Ladder
Make A Branch Statement
Declare Inits
Use Lists
Use Arrays
Make A Class Hierarchy
Use Nil And Nilable Types
Use Dynamic Typing
Declare Variable Number Of Args
Read And Write Files
Check Inheritance And Implementation
Customize Object Equality
Pass References To Methods
Translate Pseudo Code To Cobra 1
Translate Pseudo Code To Cobra 2
Implement IEnumerable 1
Implement IEnumerable 2
Iterate Through Recursive Data With Yield
Make A Collection Class
Declare Contracts
Threads
Win Forms
WPF
GTK
Qyoto
Access MySQL
XNA
Open TK
 
"""
A small example of using the GTK GUI library.

How to compile:
cobra -c -pkg:gtk-sharp-2.0 390-GTK.cobra 

URLs of interest:
    http://www.mono-project.com/GtkSharp
    http://www.mono-project.com/GtkSharp:_Hello_World
    http://www.mono-project.com/GtkSharpBeginnersGuide
    http://go-mono.org/docs/index.aspx?tlink=5@N%3aGtk  (Mono Gtk Namespace Docs)
    http://en.wikipedia.org/wiki/Gtk_Sharp

Credit:
    Adapted from http://www.mono-project.com/GtkSharp:_Hello_World

Misc:
    Other GUI libraries include System.Windows.Forms and Cocoa#.
"""

@args -pkg:gtk-sharp-2.0

use Gtk

class ToggleButtons

    def main
        ToggleButtons().run

    def onDeleteEvent(obj, args as DeleteEventArgs)
        Application.quit

    def onExitButtonEvent(obj, args as EventArgs)
        Application.quit

    def run
        Application.init

        window = Window('Toggle Buttons')
        listen window.deleteEvent, ref .onDeleteEvent
        window.borderWidth = 0

        box1 = VBox(false, 10)
        window.add(box1)
        box1.show

        box2 = VBox(false, 10)
        box2.borderWidth = 10
        box1.packStart(box2, true, true, 0)
        box2.show

        toggleButt = ToggleButton('Button 1')
        box2.packStart(toggleButt, true, true, 0)
        toggleButt.show

        toggleButt = ToggleButton('Button 2')
        toggleButt.active = true
        box2.packStart(toggleButt, true, true, 0)
        toggleButt.show

        separator = HSeparator()
        box1.packStart(separator, false, true, 0)
        separator.show

        box3 = VBox(false, 10)
        box3.borderWidth = 10
        box1.packStart(box3, false, true, 0)

        button = Button('Close')
        listen button.clicked, ref .onExitButtonEvent

        box3.packStart(button, true, true, 0)
        button.canDefault = true
        button.grabDefault
        button.show

        window.showAll 

        Application.run