view dwt/internal/cocoa/NSViewController.d @ 1:8b48be5454ce

The internal cocoa classes compile now
author Jacob Carlborg <doob@me.com> <jacob.carlborg@gmail.com>
date Tue, 19 Aug 2008 17:35:17 +0200
parents 380af2bdd8e5
children f565d3a95c0a
line wrap: on
line source

/*******************************************************************************
 * Copyright (c) 2007 IBM Corporation and others.
 * All rights reserved. This program and the accompanying materials
 * are made available under the terms of the Eclipse Public License v1.0
 * which accompanies this distribution, and is available at
 * http://www.eclipse.org/legal/epl-v10.html
 *
 * Contributors:
 *     IBM Corporation - initial API and implementation
 *     
 * Port to the D Programming language:
 *     Jacob Carlborg <jacob.carlborg@gmail.com>
 *******************************************************************************/
module dwt.internal.cocoa.NSViewController;

import dwt.internal.cocoa.id;
import dwt.internal.cocoa.NSBundle;
import dwt.internal.cocoa.NSResponder;
import dwt.internal.cocoa.NSString;
import dwt.internal.cocoa.NSView;
import dwt.internal.cocoa.OS;
import objc = dwt.internal.objc.runtime;

public class NSViewController : NSResponder
{

    public this ()
    {
        super();
    }

    public this (objc.id id)
    {
        super(id);
    }

    public bool commitEditing ()
    {
        return OS.objc_msgSend(this.id_, OS.sel_commitEditing) !is null;
    }

    public void commitEditingWithDelegate (id delegatee, objc.SEL didCommitSelector, void* contextInfo)
    {
        OS.objc_msgSend(this.id_, OS.sel_commitEditingWithDelegate_1didCommitSelector_1contextInfo_1, delegatee !is null ? delegatee.id_ : null,
                didCommitSelector, contextInfo);
    }

    public void discardEditing ()
    {
        OS.objc_msgSend(this.id_, OS.sel_discardEditing);
    }

    public id initWithNibName (NSString nibNameOrNil, NSBundle nibBundleOrNil)
    {
        objc.id result = OS.objc_msgSend(this.id_, OS.sel_initWithNibName_1bundle_1, nibNameOrNil !is null ? nibNameOrNil.id_ : null,
                nibBundleOrNil !is null ? nibBundleOrNil.id_ : null);
        return result !is null ? new id(result) : null;
    }

    public void loadView ()
    {
        OS.objc_msgSend(this.id_, OS.sel_loadView);
    }

    public NSBundle nibBundle ()
    {
        objc.id result = OS.objc_msgSend(this.id_, OS.sel_nibBundle);
        return result !is null ? new NSBundle(result) : null;
    }

    public NSString nibName ()
    {
        objc.id result = OS.objc_msgSend(this.id_, OS.sel_nibName);
        return result !is null ? new NSString(result) : null;
    }

    public id representedObject ()
    {
        objc.id result = OS.objc_msgSend(this.id_, OS.sel_representedObject);
        return result !is null ? new id(result) : null;
    }

    public void setRepresentedObject (id representedObject)
    {
        OS.objc_msgSend(this.id_, OS.sel_setRepresentedObject_1, representedObject !is null ? representedObject.id_ : null);
    }

    public void setTitle (NSString title)
    {
        OS.objc_msgSend(this.id_, OS.sel_setTitle_1, title !is null ? title.id_ : null);
    }

    public void setView (NSView view)
    {
        OS.objc_msgSend(this.id_, OS.sel_setView_1, view !is null ? view.id_ : null);
    }

    public NSString title ()
    {
        objc.id result = OS.objc_msgSend(this.id_, OS.sel_title);
        return result !is null ? new NSString(result) : null;
    }

    public NSView view ()
    {
        objc.id result = OS.objc_msgSend(this.id_, OS.sel_view);
        return result !is null ? new NSView(result) : null;
    }

}