view dwt/internal/cocoa/NSCell.d @ 45:d8635bb48c7c

Merge with SWT 3.5
author Jacob Carlborg <doob@me.com>
date Mon, 01 Dec 2008 17:07:00 +0100
parents 642f460a0908
children 62202ce0039f
line wrap: on
line source

/*******************************************************************************
 * Copyright (c) 2000, 2008 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 <doob@me.com>
 *******************************************************************************/
module dwt.internal.cocoa.NSCell;

import dwt.dwthelper.utils;
import cocoa = dwt.internal.cocoa.id;
import dwt.internal.cocoa.NSAttributedString;
import dwt.internal.cocoa.NSFont;
import dwt.internal.cocoa.NSFormatter;
import dwt.internal.cocoa.NSImage;
import dwt.internal.cocoa.NSObject;
import dwt.internal.cocoa.NSRect;
import dwt.internal.cocoa.NSSize;
import dwt.internal.cocoa.NSString;
import dwt.internal.cocoa.NSView;
import dwt.internal.cocoa.OS;
import dwt.internal.objc.cocoa.Cocoa;
import objc = dwt.internal.objc.runtime;

enum NSControlSize : NSUInteger
{
    NSRegularControlSize,
    NSSmallControlSize,
    NSMiniControlSize
}

enum NSImageScaling : NSUInteger
{
    NSImageScaleProportionallyDown = 0,
    NSImageScaleAxesIndependently,
    NSImageScaleNone,
    NSImageScaleProportionallyUpOrDown
}

enum NSCellImagePosition : NSUInteger
{
    NSNoImage       = 0,
    NSImageOnly     = 1,
    NSImageLeft     = 2,
    NSImageRight    = 3,
    NSImageBelow    = 4,
    NSImageAbove    = 5,
    NSImageOverlaps = 6
}

public class NSCell : NSObject {

public this() {
    super();
}

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

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

public NSSize cellSizeForBounds(NSRect aRect) {
    NSSize result = NSSize();
    OS.objc_msgSend_stret(result, this.id, OS.sel_cellSizeForBounds_, aRect);
    return result;
}

public void drawInteriorWithFrame(NSRect cellFrame, NSView controlView) {
    OS.objc_msgSend(this.id, OS.sel_drawInteriorWithFrame_inView_, cellFrame, controlView !is null ? controlView.id : null);
}

public NSRect drawingRectForBounds(NSRect theRect) {
    NSRect result = NSRect();
    OS.objc_msgSend_stret(result, this.id, OS.sel_drawingRectForBounds_, theRect);
    return result;
}

public NSFont font() {
    objc.id result = OS.objc_msgSend(this.id, OS.sel_font);
    return result !is null ? new NSFont(result) : null;
}

public void setAllowsMixedState(bool flag) {
    OS.objc_msgSend(this.id, OS.sel_setAllowsMixedState_, flag);
}

public void setAttributedStringValue(NSAttributedString obj) {
    OS.objc_msgSend(this.id, OS.sel_setAttributedStringValue_, obj !is null ? obj.id : null);
}

public void setFont(NSFont fontObj) {
    OS.objc_msgSend(this.id, OS.sel_setFont_, fontObj !is null ? fontObj.id : null);
}

public void setFormatter(NSFormatter newFormatter) {
    OS.objc_msgSend(this.id, OS.sel_setFormatter_, newFormatter !is null ? newFormatter.id : null);
}

public void setHighlighted(bool flag) {
    OS.objc_msgSend(this.id, OS.sel_setHighlighted_, flag);
}

public void setImage(NSImage image) {
    OS.objc_msgSend(this.id, OS.sel_setImage_, image !is null ? image.id : null);
}

public void setTitle(NSString aString) {
    OS.objc_msgSend(this.id, OS.sel_setTitle_, aString !is null ? aString.id : null);
}

public void setWraps(bool flag) {
    OS.objc_msgSend(this.id, OS.sel_setWraps_, flag);
}

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

public NSRect titleRectForBounds(NSRect theRect) {
    NSRect result = NSRect();
    OS.objc_msgSend_stret(result, this.id, OS.sel_titleRectForBounds_, theRect);
    return result;
}

public bool wraps() {
    return OS.objc_msgSend_bool(this.id, OS.sel_wraps);
}

}