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

import dwt.internal.cocoa.NSColor;
import dwt.internal.cocoa.NSCursor;
import dwt.internal.cocoa.NSEvent;
import dwt.internal.cocoa.NSNotification;
import dwt.internal.cocoa.NSPoint;
import dwt.internal.cocoa.NSRect;
import dwt.internal.cocoa.NSView;
import dwt.internal.cocoa.OS;
import objc = dwt.internal.objc.runtime;

public class NSClipView : NSView
{

    public this ()
    {
        super();
    }

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

    public bool autoscroll (NSEvent theEvent)
    {
        return OS.objc_msgSend(this.id, OS.sel_autoscroll_1, theEvent !is null ? theEvent.id : null) !is null;
    }

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

    public NSPoint constrainScrollPoint (NSPoint newOrigin)
    {
        NSPoint result;
        OS.objc_msgSend_stret(result, this.id, OS.sel_constrainScrollPoint_1, newOrigin);
        return result;
    }

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

    public NSCursor documentCursor ()
    {
        objc.id result = OS.objc_msgSend(this.id, OS.sel_documentCursor);
        return result !is null ? new NSCursor(result) : null;
    }

    public NSRect documentRect ()
    {
        NSRect result;
        OS.objc_msgSend_stret(result, this.id, OS.sel_documentRect);
        return result;
    }

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

    public NSRect documentVisibleRect ()
    {
        NSRect result;
        OS.objc_msgSend_stret(result, this.id, OS.sel_documentVisibleRect);
        return result;
    }

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

    public void scrollToPoint (NSPoint newOrigin)
    {
        OS.objc_msgSend(this.id, OS.sel_scrollToPoint_1, newOrigin);
    }

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

    public void setCopiesOnScroll (bool flag)
    {
        OS.objc_msgSend(this.id, OS.sel_setCopiesOnScroll_1, flag);
    }

    public void setDocumentCursor (NSCursor anObj)
    {
        OS.objc_msgSend(this.id, OS.sel_setDocumentCursor_1, anObj !is null ? anObj.id : null);
    }

    public void setDocumentView (NSView aView)
    {
        OS.objc_msgSend(this.id, OS.sel_setDocumentView_1, aView !is null ? aView.id : null);
    }

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

    public void viewBoundsChanged (NSNotification notification)
    {
        OS.objc_msgSend(this.id, OS.sel_viewBoundsChanged_1, notification !is null ? notification.id : null);
    }

    public void viewFrameChanged (NSNotification notification)
    {
        OS.objc_msgSend(this.id, OS.sel_viewFrameChanged_1, notification !is null ? notification.id : null);
    }

}