Mercurial > projects > dwt-mac
diff dwt/internal/cocoa/NSDatePicker.d @ 45:d8635bb48c7c
Merge with SWT 3.5
author | Jacob Carlborg <doob@me.com> |
---|---|
date | Mon, 01 Dec 2008 17:07:00 +0100 |
parents | f565d3a95c0a |
children | 63a09873578e |
line wrap: on
line diff
--- a/dwt/internal/cocoa/NSDatePicker.d Tue Oct 21 15:20:04 2008 +0200 +++ b/dwt/internal/cocoa/NSDatePicker.d Mon Dec 01 17:07:00 2008 +0100 @@ -1,208 +1,93 @@ /******************************************************************************* - * Copyright (c) 2007 IBM Corporation and others. + * Copyright (c) 2000, 2008 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 + * IBM Corporation - initial API and implementation * * Port to the D programming language: - * Jacob Carlborg <jacob.carlborg@gmail.com> + * Jacob Carlborg <doob@me.com> *******************************************************************************/ module dwt.internal.cocoa.NSDatePicker; -import dwt.internal.cocoa.id; -import dwt.internal.cocoa.NSCalendar; +import dwt.dwthelper.utils; +import cocoa = dwt.internal.cocoa.id; import dwt.internal.cocoa.NSColor; import dwt.internal.cocoa.NSControl; import dwt.internal.cocoa.NSDate; -import dwt.internal.cocoa.NSLocale; -import dwt.internal.cocoa.NSTimeZone; import dwt.internal.cocoa.OS; +import dwt.internal.objc.cocoa.Cocoa; import objc = dwt.internal.objc.runtime; -public class NSDatePicker : NSControl -{ - - public this () - { - super(); - } - - public this (objc.id id) - { - super(id); - } - - public NSColor backgroundColor () - { - objc.id result = OS.objc_msgSend(this.id_, OS.sel_backgroundColor); - return result !is null ? new NSColor(result) : null; - } +public class NSDatePicker : NSControl { - public NSCalendar calendar () - { - objc.id result = OS.objc_msgSend(this.id_, OS.sel_calendar); - return result !is null ? new NSCalendar(result) : null; - } +public this() { + super(); +} - public objc.id datePickerElements () - { - return OS.objc_msgSend(this.id_, OS.sel_datePickerElements); - } - - public objc.id datePickerMode () - { - return OS.objc_msgSend(this.id_, OS.sel_datePickerMode); - } - - public objc.id datePickerStyle () - { - return OS.objc_msgSend(this.id_, OS.sel_datePickerStyle); - } +public this(objc.id id) { + super(id); +} - public NSDate dateValue () - { - objc.id result = OS.objc_msgSend(this.id_, OS.sel_dateValue); - return result !is null ? new NSDate(result) : null; - } - - public id delegatee () - { - objc.id result = OS.objc_msgSend(this.id_, OS.sel_delegate); - return result !is null ? new id(result) : null; - } - - public bool drawsBackground () - { - return OS.objc_msgSend(this.id_, OS.sel_drawsBackground) !is null; - } - - public bool isBezeled () - { - return OS.objc_msgSend(this.id_, OS.sel_isBezeled) !is null; - } +public this(cocoa.id id) { + super(id); +} - public bool isBordered () - { - return OS.objc_msgSend(this.id_, OS.sel_isBordered) !is null; - } - - public NSLocale locale () - { - objc.id result = OS.objc_msgSend(this.id_, OS.sel_locale); - return result !is null ? new NSLocale(result) : null; - } +public NSDate dateValue() { + objc.id result = OS.objc_msgSend(this.id, OS.sel_dateValue); + return result !is null ? new NSDate(result) : null; +} - public NSDate maxDate () - { - objc.id result = OS.objc_msgSend(this.id_, OS.sel_maxDate); - return result !is null ? new NSDate(result) : null; - } - - public NSDate minDate () - { - objc.id result = OS.objc_msgSend(this.id_, OS.sel_minDate); - return result !is null ? new NSDate(result) : null; - } - - public void setBackgroundColor (NSColor color) - { - OS.objc_msgSend(this.id_, OS.sel_setBackgroundColor_1, color !is null ? color.id_ : null); - } +public void setBackgroundColor(NSColor color) { + OS.objc_msgSend(this.id, OS.sel_setBackgroundColor_, color !is null ? color.id : null); +} - public void setBezeled (bool flag) - { - OS.objc_msgSend(this.id_, OS.sel_setBezeled_1, flag); - } - - public void setBordered (bool flag) - { - OS.objc_msgSend(this.id_, OS.sel_setBordered_1, flag); - } - - public void setCalendar (NSCalendar newCalendar) - { - OS.objc_msgSend(this.id_, OS.sel_setCalendar_1, newCalendar !is null ? newCalendar.id_ : null); - } - - public void setDatePickerElements (objc.id elementFlags) - { - OS.objc_msgSend(this.id_, OS.sel_setDatePickerElements_1, elementFlags); - } +public void setDatePickerElements(NSDatePickerElementFlags elementFlags) { + OS.objc_msgSend(this.id, OS.sel_setDatePickerElements_, elementFlags); +} - public void setDatePickerMode (objc.id newMode) - { - OS.objc_msgSend(this.id_, OS.sel_setDatePickerMode_1, newMode); - } - - public void setDatePickerStyle (objc.id newStyle) - { - OS.objc_msgSend(this.id_, OS.sel_setDatePickerStyle_1, newStyle); - } +public void setDatePickerStyle(NSDatePickerStyle newStyle) { + OS.objc_msgSend(this.id, OS.sel_setDatePickerStyle_, newStyle); +} - public void setDateValue (NSDate newStartDate) - { - OS.objc_msgSend(this.id_, OS.sel_setDateValue_1, newStartDate !is null ? newStartDate.id_ : null); - } - - public void setDelegate (id anObject) - { - OS.objc_msgSend(this.id_, OS.sel_setDelegate_1, anObject !is null ? anObject.id_ : null); - } - - public void setDrawsBackground (bool flag) - { - OS.objc_msgSend(this.id_, OS.sel_setDrawsBackground_1, flag); - } +public void setDateValue(NSDate newStartDate) { + OS.objc_msgSend(this.id, OS.sel_setDateValue_, newStartDate !is null ? newStartDate.id : null); +} - public void setLocale (NSLocale newLocale) - { - OS.objc_msgSend(this.id_, OS.sel_setLocale_1, newLocale !is null ? newLocale.id_ : null); - } - - public void setMaxDate (NSDate date) - { - OS.objc_msgSend(this.id_, OS.sel_setMaxDate_1, date !is null ? date.id_ : null); - } +public void setDrawsBackground(bool flag) { + OS.objc_msgSend(this.id, OS.sel_setDrawsBackground_, flag); +} - public void setMinDate (NSDate date) - { - OS.objc_msgSend(this.id_, OS.sel_setMinDate_1, date !is null ? date.id_ : null); - } - - public void setTextColor (NSColor color) - { - OS.objc_msgSend(this.id_, OS.sel_setTextColor_1, color !is null ? color.id_ : null); - } +public void setTextColor(NSColor color) { + OS.objc_msgSend(this.id, OS.sel_setTextColor_, color !is null ? color.id : null); +} - public void setTimeInterval (double newTimeInterval) - { - OS.objc_msgSend(this.id_, OS.sel_setTimeInterval_1, newTimeInterval); - } - - public void setTimeZone (NSTimeZone newTimeZone) - { - OS.objc_msgSend(this.id_, OS.sel_setTimeZone_1, newTimeZone !is null ? newTimeZone.id_ : null); - } +public static objc.Class cellClass() { + return cast(objc.Class) OS.objc_msgSend(OS.class_NSDatePicker, OS.sel_cellClass); +} - public NSColor textColor () - { - objc.id result = OS.objc_msgSend(this.id_, OS.sel_textColor); - return result !is null ? new NSColor(result) : null; - } - - public double timeInterval () - { - return OS.objc_msgSend_fpret(this.id_, OS.sel_timeInterval); - } - - public NSTimeZone timeZone () - { - objc.id result = OS.objc_msgSend(this.id_, OS.sel_timeZone); - return result !is null ? new NSTimeZone(result) : null; - } +public static void setCellClass(int /*long*/ factoryId) { + OS.objc_msgSend(OS.class_NSDatePicker, OS.sel_setCellClass_, factoryId); +} } + +enum NSDatePickerElementFlags : NSUInteger +{ + NSHourMinuteDatePickerElementFlag = 0x000c, + NSHourMinuteSecondDatePickerElementFlag = 0x000e, + NSTimeZoneDatePickerElementFlag = 0x0010, + NSYearMonthDatePickerElementFlag = 0x00c0, + NSYearMonthDayDatePickerElementFlag = 0x00e0, + NSEraDatePickerElementFlag = 0x0100, +} + +enum NSDatePickerStyle : NSUInteger +{ + NSTextFieldAndStepperDatePickerStyle = 0, + NSClockAndCalendarDatePickerStyle = 1, + NSTextFieldDatePickerStyle = 2 +} \ No newline at end of file