diff dwt/internal/cocoa/NSBox.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 diff
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/dwt/internal/cocoa/NSBox.d	Sat Aug 09 17:00:02 2008 +0200
@@ -0,0 +1,222 @@
+/*******************************************************************************
+ * 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.NSBox;
+
+import dwt.internal.cocoa.CGFloat;
+import dwt.internal.cocoa.NSCell;
+import dwt.internal.cocoa.NSColor;
+import dwt.internal.cocoa.NSFont;
+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 objc = dwt.internal.objc.runtime;
+
+alias NSUInteger NSBoxType;
+
+enum
+{
+    NSBoxPrimary = 0,
+    NSBoxSecondary = 1,
+    NSBoxSeparator = 2,
+    NSBoxOldStyle = 3,
+    NSBoxCustom = 4
+}
+
+enum NSTitlePosition
+{
+    NSNoTitle = 0,
+    NSAboveTop = 1,
+    NSAtTop = 2,
+    NSBelowTop = 3,
+    NSAboveBottom = 4,
+    NSAtBottom = 5,
+    NSBelowBottom = 6
+}
+
+public class NSBox : NSView
+{
+    public this ()
+    {
+        super();
+    }
+
+    public this (objc.id id)
+    {
+        super(id);
+    }
+
+    public NSColor borderColor ()
+    {
+        objc.id result = OS.objc_msgSend(this.id, OS.sel_borderColor);
+        return result !is null ? new NSColor(result) : null;
+    }
+
+    public NSRect borderRect ()
+    {
+        NSRect result;
+        OS.objc_msgSend_stret(result, this.id, OS.sel_borderRect);
+        return result;
+    }
+
+    public NSBorderType borderType ()
+    {
+        return OS.objc_msgSend(this.id, OS.sel_borderType);
+    }
+
+    public CGFloat borderWidth ()
+    {
+        return cast(CGFloat) OS.objc_msgSend_fpret(this.id, OS.sel_borderWidth);
+    }
+
+    public NSBoxType boxType ()
+    {
+        return OS.objc_msgSend(this.id, OS.sel_boxType);
+    }
+
+    public NSView contentView ()
+    {
+        objc.id result = OS.objc_msgSend(this.id, OS.sel_contentView);
+        return result !is null ? new NSView(result) : null;
+    }
+
+    public NSSize contentViewMargins ()
+    {
+        NSSize result;
+        OS.objc_msgSend_stret(result, this.id, OS.sel_contentViewMargins);
+        return result;
+    }
+
+    public CGFloat cornerRadius ()
+    {
+        return cast(CGFloat) OS.objc_msgSend_fpret(this.id, OS.sel_cornerRadius);
+    }
+
+    public NSColor fillColor ()
+    {
+        objc.id result = OS.objc_msgSend(this.id, OS.sel_fillColor);
+        return result !is null ? new NSColor(result) : null;
+    }
+
+    public bool isTransparent ()
+    {
+        return OS.objc_msgSend(this.id, OS.sel_isTransparent) !is null;
+    }
+
+    public void setBorderColor (NSColor borderColor)
+    {
+        OS.objc_msgSend(this.id, OS.sel_setBorderColor_1, borderColor !is null ? borderColor.id : null);
+    }
+
+    public void setBorderType (NSBorderType aType)
+    {
+        OS.objc_msgSend(this.id, OS.sel_setBorderType_1, aType);
+    }
+
+    public void setBorderWidth (CGFloat borderWidth)
+    {
+        OS.objc_msgSend(this.id, OS.sel_setBorderWidth_1, borderWidth);
+    }
+
+    public void setBoxType (NSBoxType boxType)
+    {
+        OS.objc_msgSend(this.id, OS.sel_setBoxType_1, boxType);
+    }
+
+    public void setContentView (NSView aView)
+    {
+        OS.objc_msgSend(this.id, OS.sel_setContentView_1, aView !is null ? aView.id : null);
+    }
+
+    public void setContentViewMargins (NSSize offsetSize)
+    {
+        OS.objc_msgSend(this.id, OS.sel_setContentViewMargins_1, offsetSize);
+    }
+
+    public void setCornerRadius (CGFloat cornerRadius)
+    {
+        OS.objc_msgSend(this.id, OS.sel_setCornerRadius_1, cornerRadius);
+    }
+
+    public void setFillColor (NSColor fillColor)
+    {
+        OS.objc_msgSend(this.id, OS.sel_setFillColor_1, fillColor !is null ? fillColor.id : null);
+    }
+
+    public void setFrameFromContentFrame (NSRect contentFrame)
+    {
+        OS.objc_msgSend(this.id, OS.sel_setFrameFromContentFrame_1, contentFrame);
+    }
+
+    public void setTitle (NSString aString)
+    {
+        OS.objc_msgSend(this.id, OS.sel_setTitle_1, aString !is null ? aString.id : null);
+    }
+
+    public void setTitleFont (NSFont fontObj)
+    {
+        OS.objc_msgSend(this.id, OS.sel_setTitleFont_1, fontObj !is null ? fontObj.id : null);
+    }
+
+    public void setTitlePosition (NSTitlePosition aPosition)
+    {
+        OS.objc_msgSend(this.id, OS.sel_setTitlePosition_1, aPosition);
+    }
+
+    public void setTitleWithMnemonic (NSString StringWithAmpersand)
+    {
+        OS.objc_msgSend(this.id, OS.sel_setTitleWithMnemonic_1, StringWithAmpersand !is null ? StringWithAmpersand.id : null);
+    }
+
+    public void setTransparent (bool flag)
+    {
+        OS.objc_msgSend(this.id, OS.sel_setTransparent_1, flag);
+    }
+
+    public void sizeToFit ()
+    {
+        OS.objc_msgSend(this.id, OS.sel_sizeToFit);
+    }
+
+    public NSString title ()
+    {
+        objc.id result = OS.objc_msgSend(this.id, OS.sel_title);
+        return result !is null ? new NSString(result) : null;
+    }
+
+    public NSCell titleCell ()
+    {
+        objc.id result = OS.objc_msgSend(this.id, OS.sel_titleCell);
+        return result !is null ? new NSCell(result) : null;
+    }
+
+    public NSFont titleFont ()
+    {
+        objc.id result = OS.objc_msgSend(this.id, OS.sel_titleFont);
+        return result !is null ? new NSFont(result) : null;
+    }
+
+    public NSTitlePosition titlePosition ()
+    {
+        return OS.objc_msgSend(this.id, OS.sel_titlePosition);
+    }
+
+    public NSRect titleRect ()
+    {
+        NSRect result;
+        OS.objc_msgSend_stret(result, this.id, OS.sel_titleRect);
+        return result;
+    }
+}