Mercurial > projects > dwt-mac
view dwt/internal/cocoa/NSPopUpButton.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.NSPopUpButton; import dwt.internal.cocoa.NSArray; import dwt.internal.cocoa.NSButton; import dwt.internal.cocoa.NSInteger; import dwt.internal.cocoa.NSMenu; import dwt.internal.cocoa.NSMenuItem; import dwt.internal.cocoa.NSRect; import dwt.internal.cocoa.NSString; import dwt.internal.cocoa.OS; import objc = dwt.internal.objc.runtime; public class NSPopUpButton : NSButton { public this () { super(); } public this (objc.id id) { super(id); } public void addItemWithTitle (NSString title) { OS.objc_msgSend(this.id, OS.sel_addItemWithTitle_1, title !is null ? title.id : null); } public void addItemsWithTitles (NSArray itemTitles) { OS.objc_msgSend(this.id, OS.sel_addItemsWithTitles_1, itemTitles !is null ? itemTitles.id : null); } public bool autoenablesItems () { return OS.objc_msgSend(this.id, OS.sel_autoenablesItems) !is null; } public NSInteger indexOfItem (NSMenuItem item) { return cast(NSInteger) OS.objc_msgSend(this.id, OS.sel_indexOfItem_1, item !is null ? item.id : null); } public NSInteger indexOfItemWithRepresentedObject (id obj) { return cast(NSInteger) OS.objc_msgSend(this.id, OS.sel_indexOfItemWithRepresentedObject_1, obj !is null ? obj.id : null); } public NSInteger indexOfItemWithTag (NSInteger tag) { return cast(NSInteger) OS.objc_msgSend(this.id, OS.sel_indexOfItemWithTag_1, tag); } public NSInteger indexOfItemWithTarget (id target, objc.SEL actionSelector) { return cast(NSInteger) OS.objc_msgSend(this.id, OS.sel_indexOfItemWithTarget_1andAction_1, target !is null ? target.id : null, actionSelector); } public NSInteger indexOfItemWithTitle (NSString title) { return cast(NSInteger) OS.objc_msgSend(this.id, OS.sel_indexOfItemWithTitle_1, title !is null ? title.id : null); } public NSInteger indexOfSelectedItem () { return cast(NSInteger) OS.objc_msgSend(this.id, OS.sel_indexOfSelectedItem); } public NSPopUpButton initWithFrame (NSRect buttonFrame, bool flag) { objc.id result = OS.objc_msgSend(this.id, OS.sel_initWithFrame_1pullsDown_1, buttonFrame, flag); return result !is null ? this : null; } public void insertItemWithTitle (NSString title, NSInteger index) { OS.objc_msgSend(this.id, OS.sel_insertItemWithTitle_1atIndex_1, title !is null ? title.id : null, index); } public NSArray itemArray () { objc.id result = OS.objc_msgSend(this.id, OS.sel_itemArray); return result !is null ? new NSArray(result) : null; } public NSMenuItem itemAtIndex (NSInteger index) { objc.id result = OS.objc_msgSend(this.id, OS.sel_itemAtIndex_1, index); return result !is null ? new NSMenuItem(result) : null; } public NSString itemTitleAtIndex (NSInteger index) { objc.id result = OS.objc_msgSend(this.id, OS.sel_itemTitleAtIndex_1, index); return result !is null ? new NSString(result) : null; } public NSArray itemTitles () { objc.id result = OS.objc_msgSend(this.id, OS.sel_itemTitles); return result !is null ? new NSArray(result) : null; } public NSMenuItem itemWithTitle (NSString title) { objc.id result = OS.objc_msgSend(this.id, OS.sel_itemWithTitle_1, title !is null ? title.id : null); return result !is null ? new NSMenuItem(result) : null; } public NSMenuItem lastItem () { objc.id result = OS.objc_msgSend(this.id, OS.sel_lastItem); return result !is null ? new NSMenuItem(result) : null; } public NSMenu menu () { objc.id result = OS.objc_msgSend(this.id, OS.sel_menu); return result !is null ? new NSMenu(result) : null; } public NSInteger numberOfItems () { return OS.objc_msgSend(this.id, OS.sel_numberOfItems); } public NSRectEdge preferredEdge () { return OS.objc_msgSend(this.id, OS.sel_preferredEdge); } public bool pullsDown () { return OS.objc_msgSend(this.id, OS.sel_pullsDown) !is null; } public void removeAllItems () { OS.objc_msgSend(this.id, OS.sel_removeAllItems); } public void removeItemAtIndex (NSInteger index) { OS.objc_msgSend(this.id, OS.sel_removeItemAtIndex_1, index); } public void removeItemWithTitle (NSString title) { OS.objc_msgSend(this.id, OS.sel_removeItemWithTitle_1, title !is null ? title.id : null); } public void selectItem (NSMenuItem item) { OS.objc_msgSend(this.id, OS.sel_selectItem_1, item !is null ? item.id : null); } public void selectItemAtIndex (NSInteger index) { OS.objc_msgSend(this.id, OS.sel_selectItemAtIndex_1, index); } public bool selectItemWithTag (NSInteger tag) { return OS.objc_msgSend(this.id, OS.sel_selectItemWithTag_1, tag) !is null; } public void selectItemWithTitle (NSString title) { OS.objc_msgSend(this.id, OS.sel_selectItemWithTitle_1, title !is null ? title.id : null); } public NSMenuItem selectedItem () { objc.id result = OS.objc_msgSend(this.id, OS.sel_selectedItem); return result !is null ? new NSMenuItem(result) : null; } public void setAutoenablesItems (bool flag) { OS.objc_msgSend(this.id, OS.sel_setAutoenablesItems_1, flag); } public void setMenu (NSMenu menu) { OS.objc_msgSend(this.id, OS.sel_setMenu_1, menu !is null ? menu.id : null); } public void setPreferredEdge (NSRectEdge edge) { OS.objc_msgSend(this.id, OS.sel_setPreferredEdge_1, edge); } public void setPullsDown (bool flag) { OS.objc_msgSend(this.id, OS.sel_setPullsDown_1, flag); } public void setTitle (NSString aString) { OS.objc_msgSend(this.id, OS.sel_setTitle_1, aString !is null ? aString.id : null); } public void synchronizeTitleAndSelectedItem () { OS.objc_msgSend(this.id, OS.sel_synchronizeTitleAndSelectedItem); } public NSString titleOfSelectedItem () { objc.id result = OS.objc_msgSend(this.id, OS.sel_titleOfSelectedItem); return result !is null ? new NSString(result) : null; } }