// Author: David Elliott
// Modified by:
// Created: 2003/02/15
-// RCS-ID: $Id$
// Copyright: (c) 2003 David Elliott
// (c) 2007 Software 2000 Ltd.
-// Licence: wxWidgets licence
+// Licence: wxWindows licence
/////////////////////////////////////////////////////////////////////////////
#include "wx/wxprec.h"
#include "wx/cocoa/string.h"
#include "wx/cocoa/autorelease.h"
+#import <Foundation/NSArray.h>
#include "wx/cocoa/objc/NSView.h"
#import <AppKit/NSButton.h>
#import <AppKit/NSBox.h>
NSMutableArray *allCells = [NSMutableArray arrayWithCapacity:n];
for(int i=0; i<n; ++i)
{
- [currCell setTitle: wxNSStringWithWxString(wxStripMenuCodes(choices[i], wxStrip_Mnemonics))];
+ CocoaSetLabelForObject(choices[i], currCell);
[allCells addObject: currCell];
[currCell release];
// NOTE: We can still safely message currCell as the array has retained it.
[theBox release];
- [GetNSBox() setTitle:wxNSStringWithWxString(wxStripMenuCodes(title, wxStrip_Mnemonics))];
+ CocoaSetLabelForObject(title, GetNSBox());
// [GetNSBox() setBorderType:NSLineBorder]; // why??
SetMajorDim(majorDim, style);
+ // Set the selection to the first item if we have any items.
+ // This is for parity with other wx ports which do the same thing.
+ if(n > 0)
+ SetSelection(0);
+
if(m_parent)
m_parent->CocoaAddChild(this);
{
int r = GetRowForIndex(n);
int c = GetColumnForIndex(n);
- [[GetNSMatrix() cellAtRow:r column:c] setTitle:wxNSStringWithWxString(wxStripMenuCodes(label, wxStrip_Mnemonics))];
+ CocoaSetLabelForObject(label, [GetNSMatrix() cellAtRow:r column:c]);
}
// change the individual radio button state
// TODO
// NOTE: Cocoa has no visible state for cells so we'd need to replace the
// cell with a dummy one to hide it or alternatively subclass NSButtonCell
- // and add the behavior.
+ // and add the behaviour.
return false;
}
void wxRadioBox::CocoaTarget_action(void)
{
- wxCommandEvent event(wxEVT_COMMAND_RADIOBOX_SELECTED, GetId());
+ wxCommandEvent event(wxEVT_RADIOBOX, GetId());
InitCommandEvent(event);
event.SetInt(GetSelection()); // i.e. SetSelection.
Command(event);