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

import dwt.internal.cocoa.id;
import dwt.internal.cocoa.NSArray;
import dwt.internal.cocoa.NSObject;
import dwt.internal.cocoa.NSString;
import dwt.internal.cocoa.OS;
import objc = dwt.internal.objc.runtime;

public class NSValueTransformer : NSObject
{

    public this ()
    {
        super();
    }

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

    public static bool allowsReverseTransformation ()
    {
        return OS.objc_msgSend(OS.class_NSValueTransformer, OS.sel_allowsReverseTransformation) !is null;
    }

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

    public static void setValueTransformer (NSValueTransformer transformer, NSString name)
    {
        OS.objc_msgSend(OS.class_NSValueTransformer, OS.sel_setValueTransformer_1forName_1, transformer !is null ? transformer.id_ : null,
                name !is null ? name.id_ : null);
    }

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

    public static objc.Class transformedValueClass ()
    {
        return cast(objc.Class) OS.objc_msgSend(OS.class_NSValueTransformer, OS.sel_transformedValueClass);
    }

    public static NSValueTransformer valueTransformerForName (NSString name)
    {
        objc.id result = OS.objc_msgSend(OS.class_NSValueTransformer, OS.sel_valueTransformerForName_1, name !is null ? name.id_ : null);
        return result !is null ? new NSValueTransformer(result) : null;
    }

    public static NSArray valueTransformerNames ()
    {
        objc.id result = OS.objc_msgSend(OS.class_NSValueTransformer, OS.sel_valueTransformerNames);
        return result !is null ? new NSArray(result) : null;
    }

}