, m_style(wxNORMAL)
, m_weight(wxNORMAL)
, m_underlined(FALSE)
- , m_faceName("Geneva")
+ , m_faceName(wxT("Geneva"))
, m_encoding(wxFONTENCODING_DEFAULT)
{
Init(10, wxDEFAULT, wxNORMAL, wxNORMAL, FALSE,
- "Geneva", wxFONTENCODING_DEFAULT);
+ wxT("Geneva"), wxFONTENCODING_DEFAULT);
}
wxFontRefData(const wxFontRefData& data)
@implementation wxPoserNSButton : NSButton
- (void)wxNSButtonAction: (id)sender
{
- wxASSERT_MSG((id)self==sender,"Received wxNSButtonAction from another object");
+ wxASSERT_MSG((id)self==sender,wxT("Received wxNSButtonAction from another object"));
wxCocoaNSButton *button = wxCocoaNSButton::GetFromCocoa(self);
- wxCHECK_RET(button,"wxNSButtonAction received without associated wx object");
+ wxCHECK_RET(button,wxT("wxNSButtonAction received without associated wx object"));
button->Cocoa_wxNSButtonAction();
}
- (void)wxNSControlAction: (id)sender
{
- wxLogDebug("wxNSControlAction");
+ wxLogDebug(wxT("wxNSControlAction"));
wxCocoaNSControl *wxcontrol = wxCocoaNSControl::GetFromCocoa(sender);
- wxCHECK_RET(wxcontrol,"wxNSControlAction received but no wxCocoaNSControl exists!");
+ wxCHECK_RET(wxcontrol,wxT("wxNSControlAction received but no wxCocoaNSControl exists!"));
wxcontrol->CocoaTarget_action();
}
- (void)menuDidAddItem: (NSNotification *)notification
{
wxCocoaNSMenu *menu = wxCocoaNSMenu::GetFromCocoa([notification object]);
- wxCHECK_RET(menu,"menuDidAddItem received but no wxMenu exists");
+ wxCHECK_RET(menu,wxT("menuDidAddItem received but no wxMenu exists"));
menu->CocoaNotification_menuDidAddItem(notification);
}
- (void)menuDidChangeItem: (NSNotification *)notification
{
wxCocoaNSMenu *menu = wxCocoaNSMenu::GetFromCocoa([notification object]);
- wxCHECK_RET(menu,"menuDidChangeItem received but no wxMenu exists");
+ wxCHECK_RET(menu,wxT("menuDidChangeItem received but no wxMenu exists"));
menu->CocoaNotification_menuDidChangeItem(notification);
}
- (void)menuDidRemoveItem: (NSNotification *)notification
{
wxCocoaNSMenu *menu = wxCocoaNSMenu::GetFromCocoa([notification object]);
- wxCHECK_RET(menu,"menuDidRemoveItem received but no wxMenu exists");
+ wxCHECK_RET(menu,wxT("menuDidRemoveItem received but no wxMenu exists"));
menu->CocoaNotification_menuDidRemoveItem(notification);
}
- (void)menuDidSendAction: (NSNotification *)notification
{
wxCocoaNSMenu *menu = wxCocoaNSMenu::GetFromCocoa([notification object]);
- wxCHECK_RET(menu,"menuDidSendAction received but no wxMenu exists");
+ wxCHECK_RET(menu,wxT("menuDidSendAction received but no wxMenu exists"));
menu->CocoaNotification_menuDidSendAction(notification);
}
- (void)menuWillSendAction: (NSNotification *)notification
{
wxCocoaNSMenu *menu = wxCocoaNSMenu::GetFromCocoa([notification object]);
- wxCHECK_RET(menu,"menuWillSendAction received but no wxMenu exists");
+ wxCHECK_RET(menu,wxT("menuWillSendAction received but no wxMenu exists"));
menu->CocoaNotification_menuWillSendAction(notification);
}
- (int)numberOfRowsInTableView: (NSTableView *)tableView
{
wxCocoaNSTableView *wxView = wxCocoaNSTableView::GetFromCocoa(tableView);
- wxCHECK_MSG(wxView, 0, "No associated wx object");
+ wxCHECK_MSG(wxView, 0, wxT("No associated wx object"));
return wxView->CocoaDataSource_numberOfRows();
}
row: (int)rowIndex
{
wxCocoaNSTableView *wxView = wxCocoaNSTableView::GetFromCocoa(tableView);
- wxCHECK_MSG(wxView, nil, "No associated wx object");
+ wxCHECK_MSG(wxView, nil, wxT("No associated wx object"));
return wxView->CocoaDataSource_objectForTableColumn(tableColumn,rowIndex);
}
- (void)notificationFrameChanged: (NSNotification *)notification;
{
wxCocoaNSView *win = wxCocoaNSView::GetFromCocoa([notification object]);
- wxCHECK_RET(win,"notificationFrameChanged received but no wxWindow exists");
+ wxCHECK_RET(win,wxT("notificationFrameChanged received but no wxWindow exists"));
win->Cocoa_FrameChanged();
}
- (void)windowDidBecomeKey: (NSNotification *)notification
{
wxCocoaNSWindow *win = wxCocoaNSWindow::GetFromCocoa([notification object]);
- wxCHECK_RET(win,"notificationDidBecomeKey received but no wxWindow exists");
+ wxCHECK_RET(win,wxT("notificationDidBecomeKey received but no wxWindow exists"));
win->CocoaDelegate_windowDidBecomeKey();
}
- (void)windowDidResignKey: (NSNotification *)notification
{
wxCocoaNSWindow *win = wxCocoaNSWindow::GetFromCocoa([notification object]);
- wxCHECK_RET(win,"notificationDidResignKey received but no wxWindow exists");
+ wxCHECK_RET(win,wxT("notificationDidResignKey received but no wxWindow exists"));
win->CocoaDelegate_windowDidResignKey();
}
- (void)windowDidBecomeMain: (NSNotification *)notification
{
wxCocoaNSWindow *win = wxCocoaNSWindow::GetFromCocoa([notification object]);
- wxCHECK_RET(win,"notificationDidBecomeMain received but no wxWindow exists");
+ wxCHECK_RET(win,wxT("notificationDidBecomeMain received but no wxWindow exists"));
win->CocoaDelegate_windowDidBecomeMain();
}
- (void)windowDidResignMain: (NSNotification *)notification
{
wxCocoaNSWindow *win = wxCocoaNSWindow::GetFromCocoa([notification object]);
- wxCHECK_RET(win,"notificationDidResignMain received but no wxWindow exists");
+ wxCHECK_RET(win,wxT("notificationDidResignMain received but no wxWindow exists"));
win->CocoaDelegate_windowDidResignMain();
}
- (BOOL)windowShouldClose: (id)sender
{
- wxLogDebug("windowShouldClose");
+ wxLogDebug(wxT("windowShouldClose"));
wxCocoaNSWindow *tlw = wxCocoaNSWindow::GetFromCocoa(sender);
if(tlw && !tlw->CocoaDelegate_windowShouldClose())
{
- wxLogDebug("Window will not be closed");
+ wxLogDebug(wxT("Window will not be closed"));
return NO;
}
- wxLogDebug("Window will be closed");
+ wxLogDebug(wxT("Window will be closed"));
return YES;
}
- (void)windowWillClose: (NSNotification *)notification
{
wxCocoaNSWindow *win = wxCocoaNSWindow::GetFromCocoa([notification object]);
- wxCHECK_RET(win,"windowWillClose received but no wxWindow exists");
+ wxCHECK_RET(win,wxT("windowWillClose received but no wxWindow exists"));
win->CocoaDelegate_windowWillClose();
}
&& ([NSDefaultRunLoopMode isEqualToString:mode] || [NSModalPanelRunLoopMode isEqualToString:mode]))
{
sg_needIdle = false;
- wxLogDebug("Processing idle events");
+ wxLogDebug(wxT("Processing idle events"));
while(wxTheApp->ProcessIdle())
{
// Get the same events except don't block
if(event)
return event;
// we didn't get one, do some idle work
- wxLogDebug("Looping idle events");
+ wxLogDebug(wxT("Looping idle events"));
}
// No more idle work requested, block
- wxLogDebug("Finished idle processing");
+ wxLogDebug(wxT("Finished idle processing"));
}
else
- wxLogDebug("Avoiding idle processing sg_needIdle=%d",sg_needIdle);
+ wxLogDebug(wxT("Avoiding idle processing sg_needIdle=%d"),sg_needIdle);
return [super nextEventMatchingMask:mask untilDate:expiration inMode:mode dequeue:flag];
}
- (void)sendEvent: (NSEvent*)anEvent
{
- wxLogDebug("SendEvent");
+ wxLogDebug(wxT("SendEvent"));
sg_needIdle = true;
[super sendEvent: anEvent];
}
bytesPerRow: 0
bitsPerPixel: 0];
- wxLogDebug("M_BITMAPDATA=%p NSBitmapImageRep bitmapData=%p", M_BITMAPDATA, [M_BITMAPDATA->m_cocoaNSBitmapImageRep bitmapData]);
+ wxLogDebug(wxT("M_BITMAPDATA=%p NSBitmapImageRep bitmapData=%p"), M_BITMAPDATA, [M_BITMAPDATA->m_cocoaNSBitmapImageRep bitmapData]);
M_BITMAPDATA->m_ok = true;
M_BITMAPDATA->m_numColors = 0;
M_BITMAPDATA->m_quality = 0;
template <class PixelData>
static bool wxMask_CreateFromBitmapData(PixelData srcData, const wxColour& colour, unsigned char *dstData)
{
- wxCHECK_MSG(dstData,false,"Couldn't access mask data");
+ wxCHECK_MSG(dstData,false,wxT("Couldn't access mask data"));
class PixelData::Iterator p(srcData);
const int nRows = srcData.GetHeight();
const int nCols = srcData.GetWidth();
// We need the source NSBitmapImageRep to detemine its pixel format
NSBitmapImageRep *srcBitmapRep = const_cast<wxBitmap&>(bitmap).GetNSBitmapImageRep();
- wxCHECK_MSG(srcBitmapRep,false,"Can't create mask for an uninitialized bitmap");
+ wxCHECK_MSG(srcBitmapRep,false,wxT("Can't create mask for an uninitialized bitmap"));
// Get a pointer to the destination data
unsigned char *dstPlanes[5] = {NULL,NULL,NULL,NULL,NULL};
{
wxPixelData<wxBitmap,wxNativePixelFormat> pixelData(const_cast<wxBitmap&>(bitmap));
wxCHECK_MSG(wxMask_CreateFromBitmapData(pixelData, colour, dstData),
- false, "Unable to access raw data");
+ false, wxT("Unable to access raw data"));
}
// 32-bpp RGBx (x=throw away, no alpha)
else if([srcBitmapRep bitsPerPixel]==32 && [srcBitmapRep bitsPerSample]==8 && [srcBitmapRep samplesPerPixel]==3 && [srcBitmapRep hasAlpha]==NO)
typedef wxPixelFormat<unsigned char,32,0,1,2> PixelFormat;
wxPixelData<wxBitmap,PixelFormat> pixelData(const_cast<wxBitmap&>(bitmap));
wxCHECK_MSG(wxMask_CreateFromBitmapData(pixelData, colour, dstData),
- false, "Unable to access raw data");
+ false, wxT("Unable to access raw data"));
}
// 32-bpp RGBA
else if([srcBitmapRep bitsPerPixel]==32 && [srcBitmapRep bitsPerSample]==8 && [srcBitmapRep samplesPerPixel]==4 && [srcBitmapRep hasAlpha]==YES)
{
wxPixelData<wxBitmap,wxAlphaPixelFormat> pixelData(const_cast<wxBitmap&>(bitmap));
wxCHECK_MSG(wxMask_CreateFromBitmapData(pixelData, colour, dstData),
- false, "Unable to access raw data");
+ false, wxT("Unable to access raw data"));
}
else
- { wxCHECK_MSG(false,false,"Unimplemented pixel format"); }
+ { wxCHECK_MSG(false,false,wxT("Unimplemented pixel format")); }
// maskRep was autoreleased in case we had to exit quickly
m_cocoaNSBitmapImageRep = [maskRep retain];
const wxValidator& validator, const wxString& name)
{
wxAutoNSAutoreleasePool pool;
- wxLogDebug("Creating control with id=%d",winid);
+ wxLogDebug(wxT("Creating control with id=%d"),winid);
if(!CreateControl(parent,winid,pos,size,style,validator,name))
return false;
- wxLogDebug("Created control with id=%d",GetId());
+ wxLogDebug(wxT("Created control with id=%d"),GetId());
m_cocoaNSView = NULL;
SetNSButton([[NSButton alloc] initWithFrame: MakeDefaultNSRect(size)]);
// NOTE: YES we want to release this (to match the alloc).
void wxBitmapButton::Cocoa_wxNSButtonAction(void)
{
- wxLogDebug("YAY!");
+ wxLogDebug(wxT("YAY!"));
wxCommandEvent event(wxEVT_COMMAND_BUTTON_CLICKED, GetId());
InitCommandEvent(event); // event.SetEventObject(this);
Command(event);
const wxValidator& validator, const wxString& name)
{
wxAutoNSAutoreleasePool pool;
- wxLogDebug("Creating control with id=%d",winid);
+ wxLogDebug(wxT("Creating control with id=%d"),winid);
if(!CreateControl(parent,winid,pos,size,style,validator,name))
return false;
- wxLogDebug("Created control with id=%d",GetId());
+ wxLogDebug(wxT("Created control with id=%d"),GetId());
m_cocoaNSView = NULL;
SetNSButton([[NSButton alloc] initWithFrame: MakeDefaultNSRect(size)]);
// NOTE: YES we want to release this (to match the alloc).
void wxButton::Cocoa_wxNSButtonAction(void)
{
- wxLogDebug("YAY!");
+ wxLogDebug(wxT("YAY!"));
wxCommandEvent event(wxEVT_COMMAND_BUTTON_CLICKED, GetId());
InitCommandEvent(event); // event.SetEventObject(this);
Command(event);
void wxCheckBox::Cocoa_wxNSButtonAction(void)
{
- wxLogDebug("Checkbox");
+ wxLogDebug(wxT("Checkbox"));
wxCommandEvent event(wxEVT_COMMAND_CHECKBOX_CLICKED, GetId());
InitCommandEvent(event); // event.SetEventObject(this);
event.SetInt(GetValue());
NSMenuItem *menuitem = [userInfo objectForKey:@"MenuItem"];
int index = [[(NSPopUpButton*)m_cocoaNSView menu] indexOfItem: menuitem];
int selectedItem = [(NSPopUpButton*)m_cocoaNSView indexOfSelectedItem];
- wxLogDebug("menuDidSendAction, index=%d, selectedItem=%d", index, selectedItem);
+ wxLogDebug(wxT("menuDidSendAction, index=%d, selectedItem=%d"), index, selectedItem);
wxCommandEvent event(wxEVT_COMMAND_CHOICE_SELECTED, m_windowId);
event.SetInt(index);
event.SetEventObject(this);
const wxPoint& pos, const wxSize& size, long style,
const wxValidator& validator, const wxString& name)
{
- wxLogDebug("Creating control with id=%d",winid);
+ wxLogDebug(wxT("Creating control with id=%d"),winid);
if(!CreateControl(parent,winid,pos,size,style,validator,name))
return false;
- wxLogDebug("Created control with id=%d",GetId());
+ wxLogDebug(wxT("Created control with id=%d"),GetId());
m_cocoaNSView = NULL;
SetNSControl([[wxNonControlNSControl alloc] initWithFrame: MakeDefaultNSRect(size)]);
// NOTE: YES we want to release this (to match the alloc).
NSRect cocoaRect = [m_cocoaNSView frame];
wxSize size((int)cocoaRect.size.width+10,(int)cocoaRect.size.height);
[m_cocoaNSView setFrame: storedRect];
- wxLogDebug("wxControl=%p::DoGetBestSize()==(%d,%d)",this,size.x,size.y);
+ wxLogDebug(wxT("wxControl=%p::DoGetBestSize()==(%d,%d)"),this,size.x,size.y);
return size;
}
void wxDC::CocoaInitializeTextSystem()
{
- wxASSERT_MSG(!sm_cocoaNSTextStorage && !sm_cocoaNSLayoutManager && !sm_cocoaNSTextContainer,"Text system already initalized! BAD PROGRAMMER!");
+ wxASSERT_MSG(!sm_cocoaNSTextStorage && !sm_cocoaNSLayoutManager && !sm_cocoaNSTextContainer,wxT("Text system already initalized! BAD PROGRAMMER!"));
sm_cocoaNSTextStorage = [[NSTextStorage alloc] init];
wxASSERT(dc!=this);
if(!dc->CocoaUnlockFocus())
{
- wxFAIL_MSG("Unable to unlock focus on higher-level DC!");
+ wxFAIL_MSG(wxT("Unable to unlock focus on higher-level DC!"));
}
sm_cocoaDCStack.DeleteNode(node);
}
{
wxAutoNSAutoreleasePool pool;
// FIXME: Cache this so it can be used for DoDrawText
- wxASSERT_MSG(sm_cocoaNSTextStorage && sm_cocoaNSLayoutManager && sm_cocoaNSTextContainer, "Text system has not been initialized. BAD PROGRAMMER!");
+ 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()]];
[sm_cocoaNSTextStorage setAttributedString:attributedString];
void wxDC::DoDrawText(const wxString& text, wxCoord x, wxCoord y)
{
if(!CocoaTakeFocus()) return;
- wxASSERT_MSG(sm_cocoaNSTextStorage && sm_cocoaNSLayoutManager && sm_cocoaNSTextContainer, "Text system has not been initialized. BAD PROGRAMMER!");
+ 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()]];
[sm_cocoaNSTextStorage setAttributedString:attributedString];
// there is no length or we don't start at zero
if(!glyphRange.length)
return;
- wxASSERT_MSG(glyphRange.location==0,"glyphRange must begin at zero");
+ wxASSERT_MSG(glyphRange.location==0,wxT("glyphRange must begin at zero"));
NSAffineTransform *transform = [NSAffineTransform transform];
[transform translateXBy:x yBy:y];
[flipTransform concat];
#if 0
// Draw+fill a rectangle so we can see where the shit is supposed to be.
- wxLogDebug("(%f,%f) (%fx%f)",usedRect.origin.x,usedRect.origin.y,usedRect.size.width,usedRect.size.height);
+ wxLogDebug(wxT("(%f,%f) (%fx%f)"),usedRect.origin.x,usedRect.origin.y,usedRect.size.width,usedRect.size.height);
NSBezierPath *bezpath = [NSBezierPath bezierPathWithRect:NSMakeRect(0,0,usedRect.size.width,usedRect.size.height)];
[[NSColor blackColor] set];
[bezpath stroke];
#if 0
// Draw a rect so we can see where it's supposed to be
- wxLogDebug("image at (%d,%d) size %dx%d",x,y,bmp.GetWidth(),bmp.GetHeight());
+ wxLogDebug(wxT("image at (%d,%d) size %dx%d"),x,y,bmp.GetWidth(),bmp.GetHeight());
NSBezierPath *bezpath = [NSBezierPath bezierPathWithRect:NSMakeRect(x,y,bmp.GetWidth(),bmp.GetHeight())];
[[NSColor blackColor] set];
[bezpath stroke];
: m_window(window)
, m_lockedNSView(NULL)
{
- wxLogDebug("non-client window DC's are not supported, oh well");
+ wxLogDebug(wxT("non-client window DC's are not supported, oh well"));
};
wxWindowDC::~wxWindowDC(void)
m_lockedNSView = nsview;
return true;
}
- wxLogDebug("focus lock failed!");
+ wxLogDebug(wxT("focus lock failed!"));
return false;
}
bool wxWindowDC::CocoaLockFocus()
{
- wxLogDebug("Locking focus on wxWindowDC=%p, NSView=%p",this, m_window->GetNonClientNSView());
+ wxLogDebug(wxT("Locking focus on wxWindowDC=%p, NSView=%p"),this, m_window->GetNonClientNSView());
return CocoaLockFocusOnNSView(m_window->GetNonClientNSView());
}
bool wxWindowDC::CocoaUnlockFocus()
{
- wxLogDebug("Unlocking focus on wxWindowDC=%p, NSView=%p",this, m_window->GetNonClientNSView());
+ wxLogDebug(wxT("Unlocking focus on wxWindowDC=%p, NSView=%p"),this, m_window->GetNonClientNSView());
return CocoaUnlockFocusOnNSView();
}
bool wxClientDC::CocoaLockFocus()
{
- wxLogDebug("Locking focus on wxClientDC=%p, NSView=%p",this, m_window->GetNSView());
+ wxLogDebug(wxT("Locking focus on wxClientDC=%p, NSView=%p"),this, m_window->GetNSView());
return CocoaLockFocusOnNSView(m_window->GetNSView());
}
bool wxClientDC::CocoaUnlockFocus()
{
- wxLogDebug("Unlocking focus on wxClientDC=%p, NSView=%p",this, m_window->GetNSView());
+ wxLogDebug(wxT("Unlocking focus on wxClientDC=%p, NSView=%p"),this, m_window->GetNSView());
return CocoaUnlockFocusOnNSView();
}
wxPaintDC::wxPaintDC( wxWindow *window )
{
m_window = window;
- wxASSERT_MSG([NSView focusView]==window->GetNSView(), "PaintDC's NSView does not have focus. Please use wxPaintDC only as the first DC created in a paint handler");
+ wxASSERT_MSG([NSView focusView]==window->GetNSView(), wxT("PaintDC's NSView does not have focus. Please use wxPaintDC only as the first DC created in a paint handler"));
sm_cocoaDCStack.Insert(this);
m_lockedNSView = window->GetNSView();
m_cocoaFlipped = [window->GetNSView() isFlipped];
bool wxPaintDC::CocoaLockFocus()
{
- wxFAIL_MSG("wxPaintDC cannot be asked to lock focus!");
+ wxFAIL_MSG(wxT("wxPaintDC cannot be asked to lock focus!"));
return false;
}
[transform concat];
[flipTransform concat];
- wxLogDebug("[m_cocoaNSImage isFlipped]=%d", [m_cocoaNSImage isFlipped]);
+ wxLogDebug(wxT("[m_cocoaNSImage isFlipped]=%d"), [m_cocoaNSImage isFlipped]);
[m_cocoaNSImage drawAtPoint: NSMakePoint(0,0)
fromRect: NSMakeRect(xsrc,
m_selectedBitmap.GetHeight()-height-ysrc,
// Because we do not release on close, the following release matches the
// above alloc and thus the retain count will be 1.
[m_cocoaNSWindow release];
- wxLogDebug("wxDialog m_cocoaNSWindow retainCount=%d",[m_cocoaNSWindow retainCount]);
+ wxLogDebug(wxT("wxDialog m_cocoaNSWindow retainCount=%d"),[m_cocoaNSWindow retainCount]);
[m_cocoaNSWindow setTitle:wxNSStringWithWxString(title)];
[m_cocoaNSWindow setHidesOnDeactivate:NO];
wxDialog::~wxDialog()
{
- wxLogDebug("Destroying");
+ wxLogDebug(wxT("Destroying"));
// setReleasedWhenClosed: NO
[m_cocoaNSWindow close];
DisassociateNSPanel(GetNSPanel());
{
m_closed = true;
/* Actually, this isn't true anymore */
- wxLogDebug("Woah: Dialogs are not generally closed");
+ wxLogDebug(wxT("Woah: Dialogs are not generally closed"));
}
void wxDialog::SetModal(bool flag)
{
wxAutoNSAutoreleasePool pool;
wxModalDialogs.Append(this);
- wxLogDebug("runModal");
+ wxLogDebug(wxT("runModal"));
NSApplication *theNSApp = wxTheApp->GetNSApplication();
// If the app hasn't started, flush the event queue
// If we don't do this, the Dock doesn't get the message that
}
}
[wxTheApp->GetNSApplication() runModalForWindow:m_cocoaNSWindow];
- wxLogDebug("runModal END");
+ wxLogDebug(wxT("runModal END"));
}
else
{
- wxLogDebug("abortModal");
+ wxLogDebug(wxT("abortModal"));
[wxTheApp->GetNSApplication() abortModal];
wxModalDialogs.DeleteObject(this);
}
if ( closing.Member(this) )
{
- wxLogDebug("WARNING: Attempting to recursively call Close for dialog");
+ wxLogDebug(wxT("WARNING: Attempting to recursively call Close for dialog"));
return;
}
closing.Append(this);
- wxLogDebug("Sending Cancel Event");
+ wxLogDebug(wxT("Sending Cancel Event"));
wxCommandEvent cancelEvent(wxEVT_COMMAND_BUTTON_CLICKED, wxID_CANCEL);
cancelEvent.SetEventObject( this );
GetEventHandler()->ProcessEvent(cancelEvent); // This may close the dialog
void wxDialog::OnCancel(wxCommandEvent& event)
{
- wxLogDebug("Cancelled!");
+ wxLogDebug(wxT("Cancelled!"));
EndModal(wxID_CANCEL);
}
m_impl->SetExitCode(rc);
NSApplication *cocoaApp = [NSApplication sharedApplication];
- wxLogDebug("wxEventLoop::Exit isRunning=%d", (int)[cocoaApp isRunning]);
+ wxLogDebug(wxT("wxEventLoop::Exit isRunning=%d"), (int)[cocoaApp isRunning]);
wxTheApp->WakeUpIdle();
/* Notes:
If we're being called from idle time (which occurs while checking the
[sbarNSView setAutoresizingMask: NSViewWidthSizable|NSViewMaxYMargin];
sbarheight = sbarRect.size.height;
}
- wxLogDebug("frame height=%f, tbar=%f, sbar=%f",frameRect.size.height,tbarheight,sbarheight);
+ wxLogDebug(wxT("frame height=%f, tbar=%f, sbar=%f"),frameRect.size.height,tbarheight,sbarheight);
NSRect innerRect = [m_cocoaNSView frame];
innerRect.size.height = frameRect.size.height - tbarheight - sbarheight;
innerRect.origin.y = sbarheight;
@implementation wxMenuBarManagerObserver : NSObject
- (id)init
{
- wxFAIL_MSG("[wxMenuBarManagerObserver -init] should never be called!");
+ wxFAIL_MSG(wxT("[wxMenuBarManagerObserver -init] should never be called!"));
m_mbarman = NULL;
return self;
}
wxASSERT(win);
m_windowCurrent = win;
wxMenuBar *menubar = win->GetAppMenuBar(win);
- wxLogDebug("Found menubar=%p for window=%p.",menubar,win);
+ wxLogDebug(wxT("Found menubar=%p for window=%p."),menubar,win);
SetMenuBar(menubar);
}
@implementation wxMDIParentFrameObserver : NSObject
- (id)init
{
- wxFAIL_MSG("[wxMDIParentFrameObserver -init] should never be called!");
+ wxFAIL_MSG(wxT("[wxMDIParentFrameObserver -init] should never be called!"));
m_mdiParent = NULL;
return self;
}
void wxMDIParentFrame::CocoaDelegate_windowDidBecomeKey(void)
{
- wxLogDebug("wxMDIParentFrame=%p::CocoaDelegate_windowDidBecomeKey",this);
+ wxLogDebug(wxT("wxMDIParentFrame=%p::CocoaDelegate_windowDidBecomeKey"),this);
if(sm_cocoaDeactivateWindow && sm_cocoaDeactivateWindow==m_currentChild)
{
sm_cocoaDeactivateWindow = NULL;
void wxMDIParentFrame::CocoaDelegate_windowDidResignKey(void)
{
- wxLogDebug("wxMDIParentFrame=%p::CocoaDelegate_windowDidResignKey",this);
+ wxLogDebug(wxT("wxMDIParentFrame=%p::CocoaDelegate_windowDidResignKey"),this);
if(m_closed)
wxFrame::CocoaDelegate_windowDidResignKey();
else
void wxMDIChildFrame::CocoaDelegate_windowDidBecomeKey(void)
{
- wxLogDebug("wxMDIChildFrame=%p::CocoaDelegate_windowDidBecomeKey",this);
+ wxLogDebug(wxT("wxMDIChildFrame=%p::CocoaDelegate_windowDidBecomeKey"),this);
if(sm_cocoaDeactivateWindow && sm_cocoaDeactivateWindow==m_mdiParent)
{
sm_cocoaDeactivateWindow = NULL;
void wxMDIChildFrame::CocoaDelegate_windowDidResignKey(void)
{
- wxLogDebug("wxMDIChildFrame=%p::CocoaDelegate_windowDidResignKey",this);
+ wxLogDebug(wxT("wxMDIChildFrame=%p::CocoaDelegate_windowDidResignKey"),this);
sm_cocoaDeactivateWindow = this;
}
bool wxMenuBar::Append( wxMenu *menu, const wxString &title )
{
wxAutoNSAutoreleasePool pool;
- wxLogDebug("append menu=%p, title=%s",menu,title.c_str());
+ wxLogDebug(wxT("append menu=%p, title=%s"),menu,title.c_str());
if(!wxMenuBarBase::Append(menu,title))
return false;
wxASSERT(menu);
bool wxMenuBar::Insert(size_t pos, wxMenu *menu, const wxString& title)
{
wxAutoNSAutoreleasePool pool;
- wxLogDebug("insert pos=%lu, menu=%p, title=%s",pos,menu,title.c_str());
+ wxLogDebug(wxT("insert pos=%lu, menu=%p, title=%s"),pos,menu,title.c_str());
// Get the current menu at this position
wxMenu *nextmenu = GetMenu(pos);
if(!wxMenuBarBase::Insert(pos,menu,title))
- (void)wxMenuItemAction: (id)sender
{
- wxLogDebug("wxMenuItemAction");
+ wxLogDebug(wxT("wxMenuItemAction"));
wxMenuItem *item = wxMenuItem::GetFromCocoa(sender);
- wxCHECK_RET(item,"wxMenuItemAction received but no wxMenuItem exists!");
+ wxCHECK_RET(item,wxT("wxMenuItemAction received but no wxMenuItem exists!"));
wxMenu *menu = item->GetMenu();
- wxCHECK_RET(menu,"wxMenuItemAction received but wxMenuItem is not in a wxMenu");
+ wxCHECK_RET(menu,wxT("wxMenuItemAction received but wxMenuItem is not in a wxMenu"));
wxMenuBar *menubar = menu->GetMenuBar();
if(menubar)
{
wxFrame *frame = menubar->GetFrame();
- wxCHECK_RET(frame, "wxMenuBar MUST be attached to a wxFrame!");
+ wxCHECK_RET(frame, wxT("wxMenuBar MUST be attached to a wxFrame!"));
frame->ProcessCommand(item->GetId());
}
}
- (BOOL)validateMenuItem: (id)menuItem
{
// TODO: Do wxWindows validation here and avoid sending during idle time
- wxLogDebug("wxMenuItemAction");
+ wxLogDebug(wxT("wxMenuItemAction"));
wxMenuItem *item = wxMenuItem::GetFromCocoa(menuItem);
- wxCHECK_MSG(item,NO,"validateMenuItem received but no wxMenuItem exists!");
+ wxCHECK_MSG(item,NO,wxT("validateMenuItem received but no wxMenuItem exists!"));
return item->IsEnabled();
}
void wxMenuItem::Check(bool bDoCheck)
{
- wxCHECK_RET( IsCheckable(), "only checkable items may be checked" );
+ wxCHECK_RET( IsCheckable(), wxT("only checkable items may be checked") );
wxMenuItemBase::Check(bDoCheck);
}
{
m_radioMaster = radioButton->m_radioMaster;
wxASSERT_MSG(m_radioMaster,
- "Previous radio button should be part of a group");
+ wxT("Previous radio button should be part of a group"));
// Don't crash, assume user meant wxRB_SINGLE
if(m_radioMaster)
m_radioMaster->m_radioSlaves.Append(this);
void wxRadioButton::Cocoa_wxNSButtonAction(void)
{
- wxLogDebug("wxRadioButton");
+ wxLogDebug(wxT("wxRadioButton"));
if(m_radioMaster && ([GetNSButton() state] == NSOnState))
{
for(wxRadioButtonList::compatibility_iterator slaveNode =
- (void)wxNSActionCellAction: (id)sender
{
- wxLogDebug("wxNSActionCellAction");
+ wxLogDebug(wxT("wxNSActionCellAction"));
wxCocoaNSActionCell *wxcontrol = wxCocoaNSActionCell::GetFromCocoa(sender);
- wxCHECK_RET(wxcontrol,"wxNSActionCellAction received but no wxCocoaNSActionCell exists!");
+ wxCHECK_RET(wxcontrol,wxT("wxNSActionCellAction received but no wxCocoaNSActionCell exists!"));
wxcontrol->CocoaTarget_wxNSActionCellAction();
}
untilMouseUp:NO])
{
m_mouseDownTool = NULL;
- wxLogDebug("Button was clicked after drag!");
+ wxLogDebug(wxT("Button was clicked after drag!"));
}
[buttonCell setHighlighted: NO];
}
untilMouseUp:NO])
{
m_mouseDownTool = NULL;
- wxLogDebug("Button was clicked!");
+ wxLogDebug(wxT("Button was clicked!"));
}
[buttonCell setHighlighted: NO];
}
void wxTopLevelWindowCocoa::SetNSWindow(WX_NSWindow cocoaNSWindow)
{
bool need_debug = cocoaNSWindow || m_cocoaNSWindow;
- if(need_debug) wxLogDebug("wxTopLevelWindowCocoa=%p::SetNSWindow [m_cocoaNSWindow=%p retainCount]=%d",this,m_cocoaNSWindow,[m_cocoaNSWindow retainCount]);
+ if(need_debug) wxLogDebug(wxT("wxTopLevelWindowCocoa=%p::SetNSWindow [m_cocoaNSWindow=%p retainCount]=%d"),this,m_cocoaNSWindow,[m_cocoaNSWindow retainCount]);
DisassociateNSWindow(m_cocoaNSWindow);
[cocoaNSWindow retain];
[m_cocoaNSWindow release];
else
SetNSView(NULL);
AssociateNSWindow(m_cocoaNSWindow);
- if(need_debug) wxLogDebug("wxTopLevelWindowCocoa=%p::SetNSWindow [cocoaNSWindow=%p retainCount]=%d",this,cocoaNSWindow,[cocoaNSWindow retainCount]);
+ if(need_debug) wxLogDebug(wxT("wxTopLevelWindowCocoa=%p::SetNSWindow [cocoaNSWindow=%p retainCount]=%d"),this,cocoaNSWindow,[cocoaNSWindow retainCount]);
}
void wxTopLevelWindowCocoa::CocoaReplaceView(WX_NSView oldView, WX_NSView newView)
void wxTopLevelWindowCocoa::CocoaDelegate_windowDidBecomeKey(void)
{
DeactivatePendingWindow();
- wxLogDebug("wxTopLevelWindowCocoa=%p::CocoaDelegate_windowDidBecomeKey",this);
+ wxLogDebug(wxT("wxTopLevelWindowCocoa=%p::CocoaDelegate_windowDidBecomeKey"),this);
wxActivateEvent event(wxEVT_ACTIVATE, TRUE, GetId());
event.SetEventObject(this);
GetEventHandler()->ProcessEvent(event);
void wxTopLevelWindowCocoa::CocoaDelegate_windowDidResignKey(void)
{
- wxLogDebug("wxTopLevelWindowCocoa=%p::CocoaDelegate_windowDidResignKey",this);
+ wxLogDebug(wxT("wxTopLevelWindowCocoa=%p::CocoaDelegate_windowDidResignKey"),this);
wxActivateEvent event(wxEVT_ACTIVATE, FALSE, GetId());
event.SetEventObject(this);
GetEventHandler()->ProcessEvent(event);
void wxTopLevelWindowCocoa::CocoaDelegate_windowDidBecomeMain(void)
{
- wxLogDebug("wxTopLevelWindowCocoa=%p::CocoaDelegate_windowDidBecomeMain",this);
+ wxLogDebug(wxT("wxTopLevelWindowCocoa=%p::CocoaDelegate_windowDidBecomeMain"),this);
}
void wxTopLevelWindowCocoa::CocoaDelegate_windowDidResignMain(void)
{
- wxLogDebug("wxTopLevelWindowCocoa=%p::CocoaDelegate_windowDidResignMain",this);
+ wxLogDebug(wxT("wxTopLevelWindowCocoa=%p::CocoaDelegate_windowDidResignMain"),this);
}
void wxTopLevelWindowCocoa::CocoaDelegate_windowWillClose(void)
void wxWindowCocoaScroller::Cocoa_FrameChanged(void)
{
- wxLogDebug("Cocoa_FrameChanged");
+ wxLogDebug(wxT("Cocoa_FrameChanged"));
wxSizeEvent event(m_owner->GetSize(), m_owner->GetId());
event.SetEventObject(m_owner);
m_owner->GetEventHandler()->ProcessEvent(event);
void wxWindowCocoa::SetNSView(WX_NSView cocoaNSView)
{
bool need_debug = cocoaNSView || m_cocoaNSView;
- if(need_debug) wxLogDebug("wxWindowCocoa=%p::SetNSView [m_cocoaNSView=%p retainCount]=%d",this,m_cocoaNSView,[m_cocoaNSView retainCount]);
+ if(need_debug) wxLogDebug(wxT("wxWindowCocoa=%p::SetNSView [m_cocoaNSView=%p retainCount]=%d"),this,m_cocoaNSView,[m_cocoaNSView retainCount]);
DisassociateNSView(m_cocoaNSView);
[cocoaNSView retain];
[m_cocoaNSView release];
m_cocoaNSView = cocoaNSView;
AssociateNSView(m_cocoaNSView);
- if(need_debug) wxLogDebug("wxWindowCocoa=%p::SetNSView [cocoaNSView=%p retainCount]=%d",this,cocoaNSView,[cocoaNSView retainCount]);
+ if(need_debug) wxLogDebug(wxT("wxWindowCocoa=%p::SetNSView [cocoaNSView=%p retainCount]=%d"),this,cocoaNSView,[cocoaNSView retainCount]);
}
WX_NSView wxWindowCocoa::GetNSViewForSuperview() const
bool wxWindowCocoa::Cocoa_drawRect(const NSRect &rect)
{
- wxLogDebug("Cocoa_drawRect");
+ wxLogDebug(wxT("Cocoa_drawRect"));
// Recursion can happen if the event loop runs from within the paint
// handler. For instance, if an assertion dialog is shown.
// FIXME: This seems less than ideal.
if(m_isInPaint)
{
- wxLogDebug("Paint event recursion!");
+ wxLogDebug(wxT("Paint event recursion!"));
return false;
}
//FIXME: should probably turn that rect into the update region
void wxWindowCocoa::InitMouseEvent(wxMouseEvent& event, WX_NSEvent cocoaEvent)
{
- wxASSERT_MSG([m_cocoaNSView window]==[cocoaEvent window],"Mouse event for different NSWindow");
+ wxASSERT_MSG([m_cocoaNSView window]==[cocoaEvent window],wxT("Mouse event for different NSWindow"));
NSPoint cocoaPoint = [m_cocoaNSView convertPoint:[(NSEvent*)cocoaEvent locationInWindow] fromView:nil];
NSRect cocoaRect = [m_cocoaNSView frame];
const wxPoint &clientorigin = GetClientAreaOrigin();
{
wxMouseEvent event(wxEVT_MOTION);
InitMouseEvent(event,theEvent);
- wxLogDebug("Mouse Drag @%d,%d",event.m_x,event.m_y);
+ wxLogDebug(wxT("Mouse Drag @%d,%d"),event.m_x,event.m_y);
return GetEventHandler()->ProcessEvent(event);
}
{
wxMouseEvent event([theEvent clickCount]<2?wxEVT_LEFT_DOWN:wxEVT_LEFT_DCLICK);
InitMouseEvent(event,theEvent);
- wxLogDebug("Mouse Down @%d,%d num clicks=%d",event.m_x,event.m_y,[theEvent clickCount]);
+ wxLogDebug(wxT("Mouse Down @%d,%d num clicks=%d"),event.m_x,event.m_y,[theEvent clickCount]);
return GetEventHandler()->ProcessEvent(event);
}
wxMouseEvent event(wxEVT_MOTION);
InitMouseEvent(event,theEvent);
event.m_leftDown = true;
- wxLogDebug("Mouse Drag @%d,%d",event.m_x,event.m_y);
+ wxLogDebug(wxT("Mouse Drag @%d,%d"),event.m_x,event.m_y);
return GetEventHandler()->ProcessEvent(event);
}
{
wxMouseEvent event(wxEVT_LEFT_UP);
InitMouseEvent(event,theEvent);
- wxLogDebug("Mouse Up @%d,%d",event.m_x,event.m_y);
+ wxLogDebug(wxT("Mouse Up @%d,%d"),event.m_x,event.m_y);
return GetEventHandler()->ProcessEvent(event);
}
void wxWindowCocoa::Cocoa_FrameChanged(void)
{
- wxLogDebug("Cocoa_FrameChanged");
+ wxLogDebug(wxT("Cocoa_FrameChanged"));
wxSizeEvent event(GetSize(), m_windowId);
event.SetEventObject(this);
GetEventHandler()->ProcessEvent(event);
// If the window is marked as visible, then it shouldn't have a dummy view
// If the window is marked hidden, then it should have a dummy view
// wxSpinCtrl (generic) abuses m_isShown, don't use it for any logic
-// wxASSERT_MSG( (m_isShown && !m_dummyNSView) || (!m_isShown && m_dummyNSView),"wxWindow: m_isShown does not agree with m_dummyNSView");
+// wxASSERT_MSG( (m_isShown && !m_dummyNSView) || (!m_isShown && m_dummyNSView),wxT("wxWindow: m_isShown does not agree with m_dummyNSView"));
// Return false if there isn't a window to show or hide
NSView *cocoaView = GetNSViewForHiding();
if(!cocoaView)
NSView *nsview = GetNSViewForSuperview();
NSView *superview = [nsview superview];
- wxCHECK_RET(superview,"NSView does not have a superview");
+ wxCHECK_RET(superview,wxT("NSView does not have a superview"));
NSRect parentRect = [superview bounds];
NSRect cocoaRect = NSMakeRect(x,parentRect.size.height-(y+height),width,height);
{
NSView *nsview = GetNSViewForSuperview();
NSView *superview = [nsview superview];
- wxCHECK_RET(superview,"NSView does not have a superview");
+ wxCHECK_RET(superview,wxT("NSView does not have a superview"));
NSRect parentRect = [superview bounds];
NSRect frameRect = [nsview frame];
if(size.x!=-1)
{
NSView *nsview = GetNSViewForSuperview();
NSView *superview = [nsview superview];
- wxCHECK_RET(superview,"NSView does not have a superview");
+ wxCHECK_RET(superview,wxT("NSView does not have a superview"));
NSRect parentRect = [superview bounds];
NSRect cocoaRect = [nsview frame];
// Get size *available for subwindows* i.e. excluding menu bar etc.
void wxWindow::DoGetClientSize(int *x, int *y) const
{
- wxLogDebug("DoGetClientSize:");
+ wxLogDebug(wxT("DoGetClientSize:"));
if(m_cocoaScroller)
m_cocoaScroller->DoGetClientSize(x,y);
else
void wxWindow::DoSetClientSize(int width, int height)
{
- wxLogDebug("DoSetClientSize=(%d,%d)",width,height);
+ wxLogDebug(wxT("DoSetClientSize=(%d,%d)"),width,height);
if(m_cocoaScroller)
m_cocoaScroller->ClientSizeToSize(width,height);
CocoaSetWxWindowSize(width,height);