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

import dwt.internal.cocoa.id;
import dwt.internal.cocoa.NSColor;
import dwt.internal.cocoa.NSObject;
import dwt.internal.cocoa.NSRect;
import dwt.internal.cocoa.NSSize;
import dwt.internal.cocoa.NSString;
import dwt.internal.cocoa.NSTabView;
import dwt.internal.cocoa.NSView;
import dwt.internal.cocoa.OS;
import objc = dwt.internal.objc.runtime;

enum NSTabState
{
    NSSelectedTab = 0,
    NSBackgroundTab = 1,
    NSPressedTab = 2
}

alias NSTabState.NSSelectedTab NSSelectedTab;
alias NSTabState.NSBackgroundTab NSBackgroundTab;
alias NSTabState.NSPressedTab NSPressedTab;

public class NSTabViewItem : NSObject
{

    public this ()
    {
        super();
    }

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

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

    public void drawLabel (bool shouldTruncateLabel, NSRect labelRect)
    {
        OS.objc_msgSend(this.id_, OS.sel_drawLabel_1inRect_1, shouldTruncateLabel, labelRect);
    }

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

    public NSTabViewItem initWithIdentifier (id identifier)
    {
        objc.id result = OS.objc_msgSend(this.id_, OS.sel_initWithIdentifier_1, identifier !is null ? identifier.id_ : null);
        return result !is null ? this : null;
    }

    public NSTabViewItem initialFirstResponder ()
    {
        objc.id result = OS.objc_msgSend(this.id_, OS.sel_initialFirstResponder);
        return result !is null ? this : null;
    }

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

    public void setColor (NSColor color)
    {
        OS.objc_msgSend(this.id_, OS.sel_setColor_1, color !is null ? color.id_ : null);
    }

    public void setIdentifier (id identifier)
    {
        OS.objc_msgSend(this.id_, OS.sel_setIdentifier_1, identifier !is null ? identifier.id_ : null);
    }

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

    public void setLabel (NSString label)
    {
        OS.objc_msgSend(this.id_, OS.sel_setLabel_1, label !is null ? label.id_ : null);
    }

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

    public NSSize sizeOfLabel (bool computeMin)
    {
        NSSize result;
        OS.objc_msgSend_stret(&result, this.id_, OS.sel_sizeOfLabel_1, computeMin);
        return result;
    }

    public NSTabState tabState ()
    {
        return cast(NSTabState) OS.objc_msgSend(this.id_, OS.sel_tabState);
    }

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

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

}