All pastes #101410 Raw Edit

Stuff

public text v1 · immutable
#101410 ·published 2006-07-26 21:27 UTC
rendered paste body
 #import <NGtk/NGtk.h>

 @interface Application : NSObject
 - (void) realize;
 - (void) button : (NGtkButton*)button;
 @end

 @implementation Application

 // Our signal handler.
 - (void) button : (NGtkButton*)button {
        g_print ("Hello World!\n");
 }

 // Create our window with buttons and connect signals.
 - (void) realize {
        NGtkWindow* window = [NGtkWindow new : GTK_WINDOW_TOPLEVEL];
        NGtkButton* button = [NGtkButton new_with_label : "Push me!"];
 
        [window set_title : "Application"];
        [window connect : "destroy":[NGtk class]:@selector(main_quit:)];
 
        [button connect : "clicked":self:@selector(button:)];
        [window add : button];
 
        [window set_border_width : 10];
        [window show_all];
 }
 @end

 int main (int argc, char* argv[])
 {
        // Initialize Gtk and NGtk
        gtk_init (&argc, &argv);
        [NGtk initialize];
 
        Application* app = [Application new];
        [app realize];
 
        [NGtk main];
 
        [app release];
 
        return 0;
 }