const wxPoint& pos = wxDefaultPosition,
const wxSize& size = wxDefaultSize,
long style = 0,
- const wxString& name = "notebook");
+ const wxString& name = wxT("notebook"));
// Create() function
bool Create(wxWindow *parent,
wxWindowID id,
const wxPoint& pos = wxDefaultPosition,
const wxSize& size = wxDefaultSize,
long style = 0,
- const wxString& name = "notebook");
+ const wxString& name = wxT("notebook"));
// dtor
~wxNotebook();
if ( argc > 1 )
{
static const wxChar *ARG_PSN = _T("-psn_");
- if ( wxStrncmp(argv[1], ARG_PSN, strlen(ARG_PSN)) == 0 )
+ if ( wxStrncmp(argv[1], ARG_PSN, wxStrlen(ARG_PSN)) == 0 )
{
// remove this argument
--argc;
- memmove(argv + 1, argv + 2, argc * sizeof(char *));
+ memmove(argv + 1, argv + 2, argc * sizeof(wxChar *));
}
}
wxString wxButton::GetLabel() const
{
- return wxString([[GetNSButton() title] lossyCString]);
+ return wxStringWithNSString([GetNSButton() title]);
}
void wxButton::SetLabel(const wxString& label)
wxString wxChoice::GetString(int n) const
{
- return wxString([[(NSPopUpButton*)m_cocoaNSView itemTitleAtIndex:n] lossyCString]);
+ return wxStringWithNSString([(NSPopUpButton*)m_cocoaNSView itemTitleAtIndex:n]);
}
void wxChoice::SetString(int n, const wxString& title)
#endif //WX_PRECOMP
#include "wx/cocoa/autorelease.h"
+#include "wx/cocoa/string.h"
#import <AppKit/NSBezierPath.h>
#import <AppKit/NSTextStorage.h>
// FIXME: Cache this so it can be used for DoDrawText
wxASSERT_MSG(sm_cocoaNSTextStorage && sm_cocoaNSLayoutManager && sm_cocoaNSTextContainer, wxT("Text system has not been initialized. BAD PROGRAMMER!"));
NSAttributedString *attributedString = [[NSAttributedString alloc]
- initWithString:[NSString stringWithCString:text.c_str()]];
+ initWithString:wxNSStringWithWxString(text.c_str())];
[sm_cocoaNSTextStorage setAttributedString:attributedString];
[attributedString release];
if(!CocoaTakeFocus()) return;
wxASSERT_MSG(sm_cocoaNSTextStorage && sm_cocoaNSLayoutManager && sm_cocoaNSTextContainer, wxT("Text system has not been initialized. BAD PROGRAMMER!"));
NSAttributedString *attributedString = [[NSAttributedString alloc]
- initWithString:[NSString stringWithCString:text.c_str()]];
+ initWithString:wxNSStringWithWxString(text.c_str())];
[sm_cocoaNSTextStorage setAttributedString:attributedString];
[attributedString release];
/* New font system */
wxString wxFont::GetFaceName() const
{
- wxString str("");
+ wxString str;
if (M_FONTDATA)
str = M_FONTDATA->m_faceName ;
return str;
#endif // WX_PRECOMP
#include "wx/cocoa/autorelease.h"
+#include "wx/cocoa/string.h"
#import <Foundation/NSString.h>
#import <AppKit/NSMenu.h>
bool wxMenu::Create(const wxString& title, long style)
{
wxAutoNSAutoreleasePool pool;
- m_cocoaNSMenu = [[NSMenu alloc] initWithTitle: [NSString stringWithCString: title.c_str()]];
+ m_cocoaNSMenu = [[NSMenu alloc] initWithTitle: wxNSStringWithWxString(title)];
return true;
}
return false;
wxASSERT(menu);
wxASSERT(menu->GetNSMenu());
- NSString *menuTitle = [[NSString alloc] initWithCString: wxStripMenuCodes(title).c_str()];
+ NSString *menuTitle = wxInitNSStringWithWxString([NSString alloc], wxStripMenuCodes(title));
NSMenuItem *newItem = [[NSMenuItem alloc] initWithTitle:menuTitle action:NULL keyEquivalent:@""];
[menu->GetNSMenu() setTitle:menuTitle];
[newItem setSubmenu:menu->GetNSMenu()];
return false;
wxASSERT(menu);
wxASSERT(menu->GetNSMenu());
- NSString *menuTitle = [[NSString alloc] initWithCString: title.c_str()];
+ NSString *menuTitle = wxInitNSStringWithWxString([NSString alloc], title);
NSMenuItem *newItem = [[NSMenuItem alloc] initWithTitle:menuTitle action:NULL keyEquivalent:@""];
[menu->GetNSMenu() setTitle:menuTitle];
[newItem setSubmenu:menu->GetNSMenu()];
wxMenu *menu = GetMenu(pos);
int itemindex = [m_cocoaNSMenu indexOfItemWithSubmenu:menu->GetNSMenu()];
wxASSERT(itemindex>=0);
- return wxString([[[m_cocoaNSMenu itemAtIndex:itemindex] title] lossyCString]);
+ return wxStringWithNSString([[m_cocoaNSMenu itemAtIndex:itemindex] title]);
}
void wxMenuBar::Attach(wxFrame *frame)
#include "wx/cocoa/ObjcPose.h"
#include "wx/cocoa/autorelease.h"
+#include "wx/cocoa/string.h"
#import <AppKit/NSMenuItem.h>
#import <AppKit/NSMenu.h>
: wxMenuItemBase(pParentMenu, itemid, strName, strHelp, kind, pSubMenu)
{
wxAutoNSAutoreleasePool pool;
- NSString *menuTitle = [[NSString alloc] initWithCString: wxStripMenuCodes(strName).c_str()];
+ NSString *menuTitle = wxInitNSStringWithWxString([NSString alloc],wxStripMenuCodes(strName));
m_cocoaNSMenuItem = [[NSMenuItem alloc] initWithTitle:menuTitle action:@selector(wxMenuItemAction:) keyEquivalent:@""];
sm_cocoaHash.insert(wxMenuItemCocoaHash::value_type(m_cocoaNSMenuItem,this));
[m_cocoaNSMenuItem setTarget:sm_cocoaTarget];
#endif //WX_PRECOMP
#include "wx/cocoa/autorelease.h"
+#include "wx/cocoa/string.h"
#import <Foundation/NSString.h>
#import <AppKit/NSTextField.h>
m_cocoaNSView = NULL;
SetNSTextField([[NSTextField alloc] initWithFrame:MakeDefaultNSRect(size)]);
[m_cocoaNSView release];
- [GetNSTextField() setStringValue:[NSString stringWithCString:label.c_str()]];
+ [GetNSTextField() setStringValue:wxNSStringWithWxString(label)];
// [GetNSTextField() setBordered: NO];
[GetNSTextField() setBezeled: NO];
[GetNSTextField() setEditable: NO];
m_cocoaNSView = NULL;
SetNSTextField([[NSTextField alloc] initWithFrame:MakeDefaultNSRect(size)]);
[m_cocoaNSView release];
- [GetNSTextField() setStringValue:[NSString stringWithCString:value.c_str()]];
+ [GetNSTextField() setStringValue:wxNSStringWithWxString(value)];
+
[GetNSControl() sizeToFit];
NSRect currentFrame = [m_cocoaNSView frame];
if(currentFrame.size.width < 70)
wxString wxTextCtrl::GetValue() const
{
wxAutoNSAutoreleasePool pool;
- return wxString([[GetNSTextField() stringValue] lossyCString]);
+ return wxStringWithNSString([GetNSTextField() stringValue]);
}
void wxNotebook::Command(wxCommandEvent& WXUNUSED(event))
{
- wxFAIL_MSG("wxNotebook::Command not implemented");
+ wxFAIL_MSG(wxT("wxNotebook::Command not implemented"));
}
// ----------------------------------------------------------------------------