view dwt/internal/cocoa/NSUndoManager.d @ 0:380af2bdd8e5

Upload of whole dwt tree
author Jacob Carlborg <doob@me.com> <jacob.carlborg@gmail.com>
date Sat, 09 Aug 2008 17:00:02 +0200
parents
children 8b48be5454ce
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.NSUndoManager;

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

public class NSUndoManager : NSObject
{

    public this ()
    {
        super();
    }

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

    public void beginUndoGrouping ()
    {
        OS.objc_msgSend(this.id, OS.sel_beginUndoGrouping);
    }

    public bool canRedo ()
    {
        return OS.objc_msgSend(this.id, OS.sel_canRedo) !is null;
    }

    public bool canUndo ()
    {
        return OS.objc_msgSend(this.id, OS.sel_canUndo) !is null;
    }

    public void disableUndoRegistration ()
    {
        OS.objc_msgSend(this.id, OS.sel_disableUndoRegistration);
    }

    public void enableUndoRegistration ()
    {
        OS.objc_msgSend(this.id, OS.sel_enableUndoRegistration);
    }

    public void endUndoGrouping ()
    {
        OS.objc_msgSend(this.id, OS.sel_endUndoGrouping);
    }

    public NSInteger groupingLevel ()
    {
        return cast(NSInteger) OS.objc_msgSend(this.id, OS.sel_groupingLevel);
    }

    public bool groupsByEvent ()
    {
        return OS.objc_msgSend(this.id, OS.sel_groupsByEvent) !is null;
    }

    public bool isRedoing ()
    {
        return OS.objc_msgSend(this.id, OS.sel_isRedoing) !is null;
    }

    public bool isUndoRegistrationEnabled ()
    {
        return OS.objc_msgSend(this.id, OS.sel_isUndoRegistrationEnabled) !is null;
    }

    public bool isUndoing ()
    {
        return OS.objc_msgSend(this.id, OS.sel_isUndoing) !is null;
    }

    public NSUInteger levelsOfUndo ()
    {
        return cast(NSUInteger) OS.objc_msgSend(this.id, OS.sel_levelsOfUndo);
    }

    public id prepareWithInvocationTarget (id target)
    {
        objc.id result = OS.objc_msgSend(this.id, OS.sel_prepareWithInvocationTarget_1, target !is null ? target.id : null);
        return result !is null ? new id(result) : null;
    }

    public void redo ()
    {
        OS.objc_msgSend(this.id, OS.sel_redo);
    }

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

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

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

    public void registerUndoWithTarget (id target, objc.SEL selector, id anObject)
    {
        OS.objc_msgSend(this.id, OS.sel_registerUndoWithTarget_1selector_1object_1, target !is null ? target.id : null, selector,
                anObject !is null ? anObject.id : null);
    }

    public void removeAllActions ()
    {
        OS.objc_msgSend(this.id, OS.sel_removeAllActions);
    }

    public void removeAllActionsWithTarget (id target)
    {
        OS.objc_msgSend(this.id, OS.sel_removeAllActionsWithTarget_1, target !is null ? target.id : null);
    }

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

    public void setActionName (NSString actionName)
    {
        OS.objc_msgSend(this.id, OS.sel_setActionName_1, actionName !is null ? actionName.id : null);
    }

    public void setGroupsByEvent (bool groupsByEvent)
    {
        OS.objc_msgSend(this.id, OS.sel_setGroupsByEvent_1, groupsByEvent);
    }

    public void setLevelsOfUndo (NSUInteger levels)
    {
        OS.objc_msgSend(this.id, OS.sel_setLevelsOfUndo_1, levels);
    }

    public void setRunLoopModes (NSArray runLoopModes)
    {
        OS.objc_msgSend(this.id, OS.sel_setRunLoopModes_1, runLoopModes !is null ? runLoopModes.id : null);
    }

    public void undo ()
    {
        OS.objc_msgSend(this.id, OS.sel_undo);
    }

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

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

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

    public void undoNestedGroup ()
    {
        OS.objc_msgSend(this.id, OS.sel_undoNestedGroup);
    }

}