From a7730e448baf389ab182d3a3816222c0c42e1cb9 Mon Sep 17 00:00:00 2001 From: Fabien_ Date: Thu, 24 Nov 2005 10:28:06 +0000 Subject: [PATCH] Improved documentation git-svn-id: svn+ssh://svn.gna.org/svn/gnustep/libs/gui/trunk@22090 72102866-910b-0410-8b05-ffd578937521 --- ChangeLog | 1 + Source/NSPopUpButton.m | 90 +++++++++++++++++++++++++++++++++++++++++- 2 files changed, 89 insertions(+), 2 deletions(-) diff --git a/ChangeLog b/ChangeLog index 2ec9a31a1..97fe24118 100644 --- a/ChangeLog +++ b/ChangeLog @@ -3,6 +3,7 @@ * Source/NSMatrix.m: Improved documentation, various cleanups * Source/NSOpenPanel.m: Improved documentation * Source/NSPageLayout.m: Improved documentation + * Source/NSPopUpButton.m: Improved documentation 2005-11-22 Richard Frith-Macdonald diff --git a/Source/NSPopUpButton.m b/Source/NSPopUpButton.m index b8c5cf60b..eef9c6db6 100644 --- a/Source/NSPopUpButton.m +++ b/Source/NSPopUpButton.m @@ -82,10 +82,16 @@ Class _nspopupbuttonCellClass = 0; return [self initWithFrame: frameRect pullsDown: NO]; } +/**

Initialize and returns a new NSPopUpButton into the frame frameRect + and specified by flag if the NSPopUpButton is a pull-down list

+

See Also: -setPullsDown: [NSView-initWithFrame:]

+ */ - (id) initWithFrame: (NSRect)frameRect pullsDown: (BOOL)flag { - self = [super initWithFrame: frameRect]; + if ( ! ( self = [super initWithFrame: frameRect] ) ) + return nil; + [self setPullsDown: flag]; return self; @@ -113,11 +119,19 @@ this to return nil to indicate that we have no context menu. return [_cell menu]; } +/**

Sets whether the NSPopUpButton's cell has a pulls-down list ( YES ) + or a pop-up list (NO)

See Also: -pullsDown + [NSPopUpButtonCell-setPullsDown:]

+*/ + - (void) setPullsDown: (BOOL)flag { [_cell setPullsDown: flag]; } - +/**

Returns whether the NSPopUpButton's cell has a pulls-down list ( YES ) + or a pop-up list (NO)

+

See Also: -setPullsDown: [NSPopUpButtonCell-pullsDown]

+ */ - (BOOL) pullsDown { return [_cell pullsDown]; @@ -133,6 +147,11 @@ this to return nil to indicate that we have no context menu. return [_cell autoenablesItems]; } +/**

Inserts a new item with title as its title at the end of the list and + synchronizes the NSPopUpButton's title with the title of the selected item. +

See Also: [NSPopUpButtonCell-addItemWithTitle:] + -synchronizeTitleAndSelectedItem

+ */ - (void) addItemWithTitle: (NSString *)title { [_cell addItemWithTitle: title]; @@ -140,6 +159,11 @@ this to return nil to indicate that we have no context menu. [self synchronizeTitleAndSelectedItem]; } +/**

Inserts a new list of items with titles as titles at the end of the list + and synchronizes the NSPopUpButton's title with the title of the selected + item.

See Also: [NSPopUpButtonCell-addItemsWithTitles:] + -synchronizeTitleAndSelectedItem

+ */ - (void) addItemsWithTitles: (NSArray*)itemTitles { [_cell addItemsWithTitles: itemTitles]; @@ -147,6 +171,11 @@ this to return nil to indicate that we have no context menu. [self synchronizeTitleAndSelectedItem]; } +/**

Inserts a new item with title as its title at the specified index + and synchronizes the NSPopUpButton's title with the title of the selected + item.

See Also: [NSPopUpButtonCell-insertItemWithTitle:atIndex:] + -synchronizeTitleAndSelectedItem

+ */ - (void) insertItemWithTitle: (NSString*)title atIndex: (int)index { @@ -156,6 +185,11 @@ this to return nil to indicate that we have no context menu. [self synchronizeTitleAndSelectedItem]; } +/**

Removes all items from the item list and synchronizes the + NSPopUpButton's title with the title of the selected

+

See Also: [NSPopUpButtonCell-removeAllItems] -removeItemWithTitle: + -synchronizeTitleAndSelectedItem

+*/ - (void) removeAllItems { [_cell removeAllItems]; @@ -163,6 +197,11 @@ this to return nil to indicate that we have no context menu. [self synchronizeTitleAndSelectedItem]; } +/**

Removes the item specified with title as its title from the item list + and synchronizes the NSPopUpButton's title with the title of the selected +

See Also: [NSPopUpButtonCell-removeItemWithTitle:] + -removeAllItems -removeItemAtIndex: -synchronizeTitleAndSelectedItem

+*/ - (void) removeItemWithTitle: (NSString*)title { [_cell removeItemWithTitle: title]; @@ -170,6 +209,11 @@ this to return nil to indicate that we have no context menu. [self synchronizeTitleAndSelectedItem]; } +/**

Removes the item at the specified index index from the item list + and synchronizes the NSPopUpButton's title with the title of the selected +

See Also: [NSPopUpButtonCell-removeItemAtIndex:] + -removeAllItems -removeItemWithTitle: -synchronizeTitleAndSelectedItem

+*/ - (void) removeItemAtIndex: (int)index { [_cell removeItemAtIndex: index]; @@ -177,16 +221,25 @@ this to return nil to indicate that we have no context menu. [self synchronizeTitleAndSelectedItem]; } +/**

Returns the selected item

+

See Also: [NSPopUpButtonCell-selectedItem]

+ */ - (id ) selectedItem { return [_cell selectedItem]; } +/**

Returns the title of the selected item

+

See Also: [NSPopUpButtonCell-titleOfSelectedItem]

+ */ - (NSString*) titleOfSelectedItem { return [_cell titleOfSelectedItem]; } +/**

Returns the index of the selected item

+

See Also: [NSPopUpButtonCell-indexOfSelectedItem]

+ */ - (int) indexOfSelectedItem { return [_cell indexOfSelectedItem]; @@ -198,18 +251,30 @@ this to return nil to indicate that we have no context menu. [self synchronizeTitleAndSelectedItem]; } +/**

Select the item at index index and synchronizes the + NSPopUpButton's title with the title of the selected

See Also: + [NSPopUpButtonCell-selectItemAtIndex:] -synchronizeTitleAndSelectedItem

+ */ - (void) selectItemAtIndex: (int)index { [_cell selectItemAtIndex: index]; [self synchronizeTitleAndSelectedItem]; } +/**

Select the item with title title and synchronizes the + NSPopUpButton's title with the title of the selected

See Also: + [NSPopUpButtonCell-selectItemWithTitle:] + -synchronizeTitleAndSelectedItem

+ */ - (void) selectItemWithTitle: (NSString*)title { [_cell selectItemWithTitle: title]; [self synchronizeTitleAndSelectedItem]; } +/**

Returns the number of items in the item list

+

See Also: [NSPopUpButtonCell-numberOfItems]

+ */ - (int) numberOfItems { return [_cell numberOfItems]; @@ -220,26 +285,37 @@ this to return nil to indicate that we have no context menu. return [_cell itemArray]; } +/**

Returns the NSMenuItem at index index or nil if index is out of + range

See Also: [NSPopUpButtonCell-itemAtIndex:]

+ */ - (id ) itemAtIndex: (int)index { return [_cell itemAtIndex: index]; } +/**

Returns the item's title at index index

+ */ - (NSString*) itemTitleAtIndex: (int)index { return [_cell itemTitleAtIndex: index]; } +/**

Returns an array containing the items's titles

+ */ - (NSArray*) itemTitles { return [_cell itemTitles]; } +/**

Returns the NSMenuItem with title as its title

+ */ - (id ) itemWithTitle: (NSString*)title { return [_cell itemWithTitle: title]; } +/**

Returns the last NSMenuItem of the list

+ */ - (id ) lastItem { return [_cell lastItem]; @@ -250,11 +326,21 @@ this to return nil to indicate that we have no context menu. return [_cell indexOfItem: anObject]; } +/**

Returns the index of the item with tag as its tag. Returns -1 + if the cell is not found

See Also: + [NSPopUpButtonCell-indexOfItemWithTag:] -indexOfItemWithTitle: + -indexOfItemWithRepresentedObject:

+*/ - (int) indexOfItemWithTag: (int)tag { return [_cell indexOfItemWithTag: tag]; } +/**

Returns the index of the item with title as its title. Returns -1 + if the cell is not found

See Also: + [NSPopUpButtonCell-indexOfItemWithTitle:] -indexOfItemWithTag: + -indexOfItemWithRepresentedObject:

+*/ - (int) indexOfItemWithTitle: (NSString*)title { return [_cell indexOfItemWithTitle: title];