view dwt/internal/cocoa/NSDrawer.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.NSDrawer;

import dwt.internal.cocoa.CGFloat;
import dwt.internal.cocoa.id;
import dwt.internal.cocoa.NSInteger;
import dwt.internal.cocoa.NSRect : NSRectEdge;
import dwt.internal.cocoa.NSResponder;
import dwt.internal.cocoa.NSSize;
import dwt.internal.cocoa.NSView;
import dwt.internal.cocoa.NSWindow;
import dwt.internal.cocoa.OS;
//import dwt.internal.objc.foundation.NSGeometry;
import objc = dwt.internal.objc.runtime;

public class NSDrawer : NSResponder
{

    public this ()
    {
        super();
    }

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

    public void close ()
    {
        OS.objc_msgSend(this.id_, OS.sel_close);
    }

    public void close_ (id sender)
    {
        OS.objc_msgSend(this.id_, OS.sel_close_1, sender !is null ? sender.id_ : null);
    }

    public NSSize contentSize ()
    {
        NSSize result;
        OS.objc_msgSend_stret(&result, this.id_, OS.sel_contentSize);
        return result;
    }

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

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

    public NSRectEdge edge ()
    {
        return cast(NSRectEdge) OS.objc_msgSend(this.id_, OS.sel_edge);
    }

    public NSDrawer initWithContentSize (NSSize contentSize, NSRectEdge edge)
    {
        objc.id result = OS.objc_msgSend(this.id_, OS.sel_initWithContentSize_1preferredEdge_1, contentSize, edge);
        return result !is null ? this : null;
    }

    public CGFloat leadingOffset ()
    {
        return cast(CGFloat) OS.objc_msgSend_fpret(this.id_, OS.sel_leadingOffset);
    }

    public NSSize maxContentSize ()
    {
        NSSize result;
        OS.objc_msgSend_stret(&result, this.id_, OS.sel_maxContentSize);
        return result;
    }

    public NSSize minContentSize ()
    {
        NSSize result;
        OS.objc_msgSend_stret(&result, this.id_, OS.sel_minContentSize);
        return result;
    }

    public void open ()
    {
        OS.objc_msgSend(this.id_, OS.sel_open);
    }

    public void open_ (id sender)
    {
        OS.objc_msgSend(this.id_, OS.sel_open_1, sender !is null ? sender.id_ : null);
    }

    public void openOnEdge (NSRectEdge edge)
    {
        OS.objc_msgSend(this.id_, OS.sel_openOnEdge_1, edge);
    }

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

    public NSRectEdge preferredEdge ()
    {
        return cast(NSRectEdge) OS.objc_msgSend(this.id_, OS.sel_preferredEdge);
    }

    public void setContentSize (NSSize size)
    {
        OS.objc_msgSend(this.id_, OS.sel_setContentSize_1, size);
    }

    public void setContentView (NSView aView)
    {
        OS.objc_msgSend(this.id_, OS.sel_setContentView_1, aView !is null ? aView.id_ : null);
    }

    public void setDelegate (id anObject)
    {
        OS.objc_msgSend(this.id_, OS.sel_setDelegate_1, anObject !is null ? anObject.id_ : null);
    }

    public void setLeadingOffset (CGFloat offset)
    {
        OS.objc_msgSend(this.id_, OS.sel_setLeadingOffset_1, offset);
    }

    public void setMaxContentSize (NSSize size)
    {
        OS.objc_msgSend(this.id_, OS.sel_setMaxContentSize_1, size);
    }

    public void setMinContentSize (NSSize size)
    {
        OS.objc_msgSend(this.id_, OS.sel_setMinContentSize_1, size);
    }

    public void setParentWindow (NSWindow parent)
    {
        OS.objc_msgSend(this.id_, OS.sel_setParentWindow_1, parent !is null ? parent.id_ : null);
    }

    public void setPreferredEdge (NSRectEdge edge)
    {
        OS.objc_msgSend(this.id_, OS.sel_setPreferredEdge_1, edge);
    }

    public void setTrailingOffset (CGFloat offset)
    {
        OS.objc_msgSend(this.id_, OS.sel_setTrailingOffset_1, offset);
    }

    public NSInteger state ()
    {
        return cast(NSInteger) OS.objc_msgSend(this.id_, OS.sel_state);
    }

    public void toggle (id sender)
    {
        OS.objc_msgSend(this.id_, OS.sel_toggle_1, sender !is null ? sender.id_ : null);
    }

    public CGFloat trailingOffset ()
    {
        return cast(CGFloat) OS.objc_msgSend_fpret(this.id_, OS.sel_trailingOffset);
    }

}