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

import dwt.internal.cocoa.NSActionCell;
import dwt.internal.cocoa.NSArray;
import dwt.internal.cocoa.NSAttributedString;
import dwt.internal.cocoa.NSColor;
import dwt.internal.cocoa.NSString;
import dwt.internal.cocoa.NSText;
import dwt.internal.cocoa.OS;
import objc = dwt.internal.objc.runtime;

enum NSTextFieldBezelStyle
{
    NSTextFieldSquareBezel = 0,
    NSTextFieldRoundedBezel = 1
}

alias NSTextFieldBezelStyle.NSTextFieldSquareBezel NSTextFieldSquareBezel;
alias NSTextFieldBezelStyle.NSTextFieldRoundedBezel NSTextFieldRoundedBezel;

public class NSTextFieldCell : NSActionCell
{

    public this ()
    {
        super();
    }

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

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

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

    public NSTextFieldBezelStyle bezelStyle ()
    {
        return cast(NSTextFieldBezelStyle) OS.objc_msgSend(this.id_, OS.sel_bezelStyle);
    }

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

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

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

    public void setAllowedInputSourceLocales (NSArray localeIdentifiers)
    {
        OS.objc_msgSend(this.id_, OS.sel_setAllowedInputSourceLocales_1, localeIdentifiers !is null ? localeIdentifiers.id_ : null);
    }

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

    public void setBezelStyle (NSTextFieldBezelStyle style)
    {
        OS.objc_msgSend(this.id_, OS.sel_setBezelStyle_1, style);
    }

    public void setDrawsBackground (bool flag)
    {
        OS.objc_msgSend(this.id_, OS.sel_setDrawsBackground_1, flag);
    }

    public void setPlaceholderAttributedString (NSAttributedString string)
    {
        OS.objc_msgSend(this.id_, OS.sel_setPlaceholderAttributedString_1, string !is null ? string.id_ : null);
    }

    public void setPlaceholderString (NSString string)
    {
        OS.objc_msgSend(this.id_, OS.sel_setPlaceholderString_1, string !is null ? string.id_ : null);
    }

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

    public NSText setUpFieldEditorAttributes (NSText textObj)
    {
        objc.id result = OS.objc_msgSend(this.id_, OS.sel_setUpFieldEditorAttributes_1, textObj !is null ? textObj.id_ : null);
        return result !is null ? new NSText(result) : null;
    }

    public void setWantsNotificationForMarkedText (bool flag)
    {
        OS.objc_msgSend(this.id_, OS.sel_setWantsNotificationForMarkedText_1, flag);
    }

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

}