[Top][All Lists]

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: GWorkspace - next steps

From: Ludovic Marcotte
Subject: Re: GWorkspace - next steps
Date: Thu, 15 Nov 2001 18:55:52 -0500 (EST)

> Now what do you think of the idea to "nibify" GWorkspace? Are nibs - or in 
> that case - gmodels supported well enough under GNUstep? Has somebody else 
> some experience using nibs/gmodels under GNUstep to share (Wasn't 
> GNUMail.app using gmodels or am I wrong here?)?

You're wrong :)

But, GNUMail.app is developped so that it uses nibs under MacOS-X and 
'handcoded guis' under GNUstep.

Why? As far I know, gmodel are deprecated and Gorm doesn't support (yet) 
some very important classes that GNUMail.app uses (like NSBrowser, 
NSTextView, NSTableView, ...).

Let me explain how it should work.

You should put all the 'logic' of a 'window' in a separated class. This 
class should extends NSWindowController.

In that class, you redefine: - (id) initWithWindowNibName: (NSString *) 

so it looks like this:

- (id) initWithWindowNibName: (NSString *) windowNibName
#ifdef MACOSX
  self = [super initWithWindowNibName: windowNibName];
  MyOwnWindow *win = ...

  self = [super initWithWindow: win];
  [win doYourLayoutHere];
  [win setDelegate: self];
  // connect your outlets
  okButton = [win okButton];
  textField = [win textField];  


  return self;

If you need any post-creation initialization, just implement:


in your class that extends NSWindowController. This method is gonna be 
called right after the self = [super initWithWindow: win]; under GNUstep 
or right after the nib was loaded under MacOS-X.

A simple implementation should do something like that:

- (void) windowDidLoad
  [[self window] setTitle: "woo!"];

You controller class should look like this:

// ...
#ifndef MACOSX
#import "MyOwnWindow.h"

@implementation MyOwnWindowController

- (id) initWithWindowNibName: (NSString *) windowNibName

- (void) windowDidLoad

You don't need (and don't WANT!) to import "MyOwnWindow.h" under MacOS-X 
since that will be repaced by a nib.

Also, in your controller class, you have to define your outlets/action 
like this:

@interface MailWindowController : NSWindowController
  // Outlets
  IBOutlet NSButton *okButton;
  IBOutlet NSTextField *textField;

  // other ivars

- (IBAction) okClicked: (id) sender;

Under GNUstep, you link manually all outlets in initWithWindowNibName 
while under MacOS-X, you link the outlets and the action with Interface 
Builder. That's why you use IBOutlet/IBAction - so that you can import 
your controller class in Interface Builder and instanciate it to create 
your links.

IB will automatically recognize your outlets/actions if they are defined 
with IBOutlet / IBAction.

You can look at GNUMail.app source code. It works quite well :)

If some people show interest, I could write a simple graphical application 
for demonstration purposes (like, a tutorial) that explains in details all 
the process of developping an app that works equally under GNUstep and 


Live as if you were to die tomorrow.
Learn as if you were to live forever.
 - Gandhi

reply via email to

[Prev in Thread] Current Thread [Next in Thread]