Merge branch '3.0-osx-fixes' into 3.0
Various fixes for wxOSX back ported from master.
This commit is contained in:
@@ -637,7 +637,21 @@ wxOSX:
|
|||||||
- Fix length of text in wxTextDataObject.
|
- Fix length of text in wxTextDataObject.
|
||||||
- Fix using wxHTTP and wxFTP from worker thread.
|
- Fix using wxHTTP and wxFTP from worker thread.
|
||||||
- Fix wxFileDialog::GetFilterIndex() for file open dialogs (phsilva).
|
- Fix wxFileDialog::GetFilterIndex() for file open dialogs (phsilva).
|
||||||
|
- Fix wxSearchCtrl appearance under 10.10 (John Roberts).
|
||||||
|
- Fix handling of "Cancel" button in wxSearchCtrl (John Roberts).
|
||||||
|
- Generate correct events for WXK_NUMPAD_ENTER (John Roberts).
|
||||||
|
- Fix handling of WXK_NUMPAD_ENTER in wxTextCtrl (John Roberts).
|
||||||
|
- Don't show wxDatePickerCtrl as being disabled when it isn't (John Roberts).
|
||||||
|
- Generate wxEVT_TEXT_ENTER for wxTE_PASSWORD controls too (mj_smoker).
|
||||||
|
- Send wxIconizeEvent when a window is iconized/restore (Rob Krakora).
|
||||||
|
- Use correct colour for disabled wxStaticText (sbrowne).
|
||||||
|
- Fix too large top and left margins inside wxStaticBox (sbrowne).
|
||||||
|
- Fix bottom margins sizes for several controls (sbrowne).
|
||||||
|
- Fix initial position of controls with layout insets (Tim Kosse).
|
||||||
|
- Don't allow pasting rich text in non-wxTE_RICH text controls (Tim Kosse).
|
||||||
|
- Fix printing all pages non-interactively (John Roberts).
|
||||||
- Fix custom paper support (tijsv).
|
- Fix custom paper support (tijsv).
|
||||||
|
- Return false from wxSound::Create()/IsOk() if the file doesn't exist.
|
||||||
|
|
||||||
|
|
||||||
3.0.2: (released 2014-10-06)
|
3.0.2: (released 2014-10-06)
|
||||||
|
@@ -114,6 +114,8 @@ public:
|
|||||||
virtual void HandleMoved( double timestampsec );
|
virtual void HandleMoved( double timestampsec );
|
||||||
virtual void HandleResizing( double timestampsec, wxRect* rect );
|
virtual void HandleResizing( double timestampsec, wxRect* rect );
|
||||||
|
|
||||||
|
void OSXHandleMiniaturize(double WXUNUSED(timestampsec), bool miniaturized);
|
||||||
|
|
||||||
void WindowWasPainted();
|
void WindowWasPainted();
|
||||||
|
|
||||||
virtual bool Destroy();
|
virtual bool Destroy();
|
||||||
|
@@ -81,6 +81,9 @@ public:
|
|||||||
|
|
||||||
virtual void SetRepresentedFilename(const wxString& filename);
|
virtual void SetRepresentedFilename(const wxString& filename);
|
||||||
|
|
||||||
|
// do *not* call this to iconize the frame, this is a private function!
|
||||||
|
void OSXSetIconizeState(bool iconic);
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
// common part of all ctors
|
// common part of all ctors
|
||||||
void Init();
|
void Init();
|
||||||
|
@@ -4210,8 +4210,6 @@ public:
|
|||||||
|
|
||||||
An event being sent when the frame is iconized (minimized) or restored.
|
An event being sent when the frame is iconized (minimized) or restored.
|
||||||
|
|
||||||
Currently only wxMSW and wxGTK generate such events.
|
|
||||||
|
|
||||||
@onlyfor{wxmsw,wxgtk}
|
@onlyfor{wxmsw,wxgtk}
|
||||||
|
|
||||||
@beginEventTable{wxIconizeEvent}
|
@beginEventTable{wxIconizeEvent}
|
||||||
|
@@ -81,6 +81,7 @@ public:
|
|||||||
|
|
||||||
private:
|
private:
|
||||||
bool CreateSound(wxSound& snd) const;
|
bool CreateSound(wxSound& snd) const;
|
||||||
|
wxSound* TryCreateSound() const;
|
||||||
|
|
||||||
wxSound* m_sound;
|
wxSound* m_sound;
|
||||||
wxString m_soundFile;
|
wxString m_soundFile;
|
||||||
@@ -975,6 +976,17 @@ bool MyFrame::CreateSound(wxSound& snd) const
|
|||||||
return snd.Create(m_soundFile);
|
return snd.Create(m_soundFile);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
wxSound* MyFrame::TryCreateSound() const
|
||||||
|
{
|
||||||
|
wxSound* const sound = new wxSound;
|
||||||
|
if ( !CreateSound(*sound) )
|
||||||
|
{
|
||||||
|
delete sound;
|
||||||
|
return NULL;
|
||||||
|
}
|
||||||
|
|
||||||
|
return sound;
|
||||||
|
}
|
||||||
|
|
||||||
void MyFrame::NotifyUsingFile(const wxString& name)
|
void MyFrame::NotifyUsingFile(const wxString& name)
|
||||||
{
|
{
|
||||||
@@ -1054,12 +1066,9 @@ void MyFrame::OnPlaySync(wxCommandEvent& WXUNUSED(event))
|
|||||||
{
|
{
|
||||||
wxBusyCursor busy;
|
wxBusyCursor busy;
|
||||||
if ( !m_sound )
|
if ( !m_sound )
|
||||||
{
|
m_sound = TryCreateSound();
|
||||||
m_sound = new wxSound;
|
|
||||||
CreateSound(*m_sound);
|
|
||||||
}
|
|
||||||
|
|
||||||
if (m_sound->IsOk())
|
if (m_sound)
|
||||||
m_sound->Play(wxSOUND_SYNC);
|
m_sound->Play(wxSOUND_SYNC);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -1067,12 +1076,9 @@ void MyFrame::OnPlayAsync(wxCommandEvent& WXUNUSED(event))
|
|||||||
{
|
{
|
||||||
wxBusyCursor busy;
|
wxBusyCursor busy;
|
||||||
if ( !m_sound )
|
if ( !m_sound )
|
||||||
{
|
m_sound = TryCreateSound();
|
||||||
m_sound = new wxSound;
|
|
||||||
CreateSound(*m_sound);
|
|
||||||
}
|
|
||||||
|
|
||||||
if (m_sound->IsOk())
|
if (m_sound)
|
||||||
m_sound->Play(wxSOUND_ASYNC);
|
m_sound->Play(wxSOUND_ASYNC);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -1089,10 +1095,7 @@ void MyFrame::OnPlayLoop(wxCommandEvent& WXUNUSED(event))
|
|||||||
{
|
{
|
||||||
wxBusyCursor busy;
|
wxBusyCursor busy;
|
||||||
if ( !m_sound )
|
if ( !m_sound )
|
||||||
{
|
m_sound = TryCreateSound();
|
||||||
m_sound = new wxSound;
|
|
||||||
CreateSound(*m_sound);
|
|
||||||
}
|
|
||||||
|
|
||||||
if (m_sound->IsOk())
|
if (m_sound->IsOk())
|
||||||
m_sound->Play(wxSOUND_ASYNC | wxSOUND_LOOP);
|
m_sound->Play(wxSOUND_ASYNC | wxSOUND_LOOP);
|
||||||
|
@@ -159,17 +159,17 @@ void wxButtonCocoaImpl::GetLayoutInset(int &left , int &top , int &right, int &b
|
|||||||
case NSRegularControlSize:
|
case NSRegularControlSize:
|
||||||
left = right = 6;
|
left = right = 6;
|
||||||
top = 4;
|
top = 4;
|
||||||
bottom = 8;
|
bottom = 7;
|
||||||
break;
|
break;
|
||||||
case NSSmallControlSize:
|
case NSSmallControlSize:
|
||||||
left = right = 5;
|
left = right = 5;
|
||||||
top = 4;
|
top = 4;
|
||||||
bottom = 7;
|
bottom = 6;
|
||||||
break;
|
break;
|
||||||
case NSMiniControlSize:
|
case NSMiniControlSize:
|
||||||
left = right = 1;
|
left = right = 1;
|
||||||
top = 0;
|
top = 0;
|
||||||
bottom = 2;
|
bottom = 1;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@@ -81,12 +81,12 @@ public:
|
|||||||
case NSRegularControlSize:
|
case NSRegularControlSize:
|
||||||
left = right = 3;
|
left = right = 3;
|
||||||
top = 2;
|
top = 2;
|
||||||
bottom = 4;
|
bottom = 3;
|
||||||
break;
|
break;
|
||||||
case NSSmallControlSize:
|
case NSSmallControlSize:
|
||||||
left = right = 3;
|
left = right = 3;
|
||||||
top = 1;
|
top = 1;
|
||||||
bottom = 4;
|
bottom = 3;
|
||||||
break;
|
break;
|
||||||
case NSMiniControlSize:
|
case NSMiniControlSize:
|
||||||
left = 1;
|
left = 1;
|
||||||
|
@@ -128,6 +128,26 @@ public:
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
virtual void Enable(bool enable = true)
|
||||||
|
{
|
||||||
|
wxNSDatePicker* const nsdatePicker = View();
|
||||||
|
|
||||||
|
[nsdatePicker setEnabled: enable];
|
||||||
|
|
||||||
|
if ( enable )
|
||||||
|
{
|
||||||
|
wxWindow* const wxpeer = GetWXPeer();
|
||||||
|
if ( wxpeer )
|
||||||
|
[nsdatePicker setTextColor: wxpeer->GetForegroundColour().OSXGetNSColor()];
|
||||||
|
else
|
||||||
|
[nsdatePicker setTextColor: [NSColor controlTextColor]];
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
[nsdatePicker setTextColor: [NSColor disabledControlTextColor]];
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
private:
|
private:
|
||||||
wxNSDatePicker* View() const
|
wxNSDatePicker* View() const
|
||||||
{
|
{
|
||||||
@@ -170,6 +190,9 @@ wxDateTimeWidgetImpl::CreateDateTimePicker(wxDateTimePickerCtrl* wxpeer,
|
|||||||
|
|
||||||
[v setDatePickerStyle: NSTextFieldAndStepperDatePickerStyle];
|
[v setDatePickerStyle: NSTextFieldAndStepperDatePickerStyle];
|
||||||
|
|
||||||
|
// Avoid a disabled looking transparent background for the text cells.
|
||||||
|
[v setDrawsBackground: YES];
|
||||||
|
|
||||||
if ( dt.IsValid() )
|
if ( dt.IsValid() )
|
||||||
{
|
{
|
||||||
[v setDateValue: NSDateFromWX(dt)];
|
[v setDateValue: NSDateFromWX(dt)];
|
||||||
|
@@ -81,13 +81,13 @@ public :
|
|||||||
case NSRegularControlSize:
|
case NSRegularControlSize:
|
||||||
left = right = 2;
|
left = right = 2;
|
||||||
top = 0;
|
top = 0;
|
||||||
bottom = 4;
|
bottom = 3;
|
||||||
break;
|
break;
|
||||||
case NSMiniControlSize:
|
case NSMiniControlSize:
|
||||||
case NSSmallControlSize:
|
case NSSmallControlSize:
|
||||||
left = right = 1;
|
left = right = 1;
|
||||||
top = 0;
|
top = 0;
|
||||||
bottom = 2;
|
bottom = 1;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@@ -309,6 +309,8 @@ static NSResponder* s_formerFirstResponder = NULL;
|
|||||||
- (void)windowDidResignKey:(NSNotification *)notification;
|
- (void)windowDidResignKey:(NSNotification *)notification;
|
||||||
- (void)windowDidBecomeKey:(NSNotification *)notification;
|
- (void)windowDidBecomeKey:(NSNotification *)notification;
|
||||||
- (void)windowDidMove:(NSNotification *)notification;
|
- (void)windowDidMove:(NSNotification *)notification;
|
||||||
|
- (void)windowDidMiniaturize:(NSNotification *)notification;
|
||||||
|
- (void)windowDidDeminiaturize:(NSNotification *)notification;
|
||||||
- (BOOL)windowShouldClose:(id)window;
|
- (BOOL)windowShouldClose:(id)window;
|
||||||
- (BOOL)windowShouldZoom:(NSWindow *)window toFrame:(NSRect)newFrame;
|
- (BOOL)windowShouldZoom:(NSWindow *)window toFrame:(NSRect)newFrame;
|
||||||
|
|
||||||
@@ -397,6 +399,28 @@ extern int wxOSXGetIdFromSelector(SEL action );
|
|||||||
[self triggerMenu:_cmd];
|
[self triggerMenu:_cmd];
|
||||||
}
|
}
|
||||||
|
|
||||||
|
- (void)windowDidMiniaturize:(NSNotification *)notification
|
||||||
|
{
|
||||||
|
NSWindow* window = (NSWindow*) [notification object];
|
||||||
|
wxNonOwnedWindowCocoaImpl* windowimpl = [window WX_implementation];
|
||||||
|
if ( windowimpl )
|
||||||
|
{
|
||||||
|
if ( wxNonOwnedWindow* wxpeer = windowimpl->GetWXPeer() )
|
||||||
|
wxpeer->OSXHandleMiniaturize(0, [window isMiniaturized]);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
- (void)windowDidDeminiaturize:(NSNotification *)notification
|
||||||
|
{
|
||||||
|
NSWindow* window = (NSWindow*) [notification object];
|
||||||
|
wxNonOwnedWindowCocoaImpl* windowimpl = [window WX_implementation];
|
||||||
|
if ( windowimpl )
|
||||||
|
{
|
||||||
|
if ( wxNonOwnedWindow* wxpeer = windowimpl->GetWXPeer() )
|
||||||
|
wxpeer->OSXHandleMiniaturize(0, [window isMiniaturized]);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
- (BOOL)windowShouldClose:(id)nwindow
|
- (BOOL)windowShouldClose:(id)nwindow
|
||||||
{
|
{
|
||||||
wxNonOwnedWindowCocoaImpl* windowimpl = [(NSWindow*) nwindow WX_implementation];
|
wxNonOwnedWindowCocoaImpl* windowimpl = [(NSWindow*) nwindow WX_implementation];
|
||||||
|
@@ -155,7 +155,7 @@ public :
|
|||||||
if ( wxpeer )
|
if ( wxpeer )
|
||||||
{
|
{
|
||||||
NSString *searchString = [m_searchField stringValue];
|
NSString *searchString = [m_searchField stringValue];
|
||||||
if ( searchString == nil )
|
if ( searchString == nil || !searchString.length )
|
||||||
{
|
{
|
||||||
wxpeer->HandleSearchFieldCancelHit();
|
wxpeer->HandleSearchFieldCancelHit();
|
||||||
}
|
}
|
||||||
@@ -166,6 +166,24 @@ public :
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
virtual void SetCentredLook( bool centre )
|
||||||
|
{
|
||||||
|
SEL sel = @selector(setCenteredLook:);
|
||||||
|
if ( [m_searchFieldCell respondsToSelector: sel] )
|
||||||
|
{
|
||||||
|
// all this avoids xcode parsing warnings when using
|
||||||
|
// [m_searchFieldCell setCenteredLook:NO];
|
||||||
|
NSMethodSignature* signature =
|
||||||
|
[NSSearchFieldCell instanceMethodSignatureForSelector:sel];
|
||||||
|
NSInvocation* invocation =
|
||||||
|
[NSInvocation invocationWithMethodSignature: signature];
|
||||||
|
[invocation setTarget: m_searchFieldCell];
|
||||||
|
[invocation setSelector:sel];
|
||||||
|
[invocation setArgument:¢re atIndex:2];
|
||||||
|
[invocation invoke];
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
private:
|
private:
|
||||||
wxNSSearchField* m_searchField;
|
wxNSSearchField* m_searchField;
|
||||||
NSSearchFieldCell* m_searchFieldCell;
|
NSSearchFieldCell* m_searchFieldCell;
|
||||||
@@ -192,6 +210,7 @@ wxWidgetImplType* wxWidgetImpl::CreateSearchControl( wxSearchCtrl* wxpeer,
|
|||||||
|
|
||||||
wxNSSearchFieldControl* c = new wxNSSearchFieldControl( wxpeer, v );
|
wxNSSearchFieldControl* c = new wxNSSearchFieldControl( wxpeer, v );
|
||||||
c->SetNeedsFrame( false );
|
c->SetNeedsFrame( false );
|
||||||
|
c->SetCentredLook( false );
|
||||||
c->SetStringValue( str );
|
c->SetStringValue( str );
|
||||||
return c;
|
return c;
|
||||||
}
|
}
|
||||||
|
@@ -71,6 +71,9 @@ wxWidgetImplType* wxWidgetImpl::CreateGroupBox( wxWindowMac* wxpeer,
|
|||||||
{
|
{
|
||||||
NSRect r = wxOSXGetFrameForControl( wxpeer, pos , size ) ;
|
NSRect r = wxOSXGetFrameForControl( wxpeer, pos , size ) ;
|
||||||
wxNSBox* v = [[wxNSBox alloc] initWithFrame:r];
|
wxNSBox* v = [[wxNSBox alloc] initWithFrame:r];
|
||||||
|
NSSize margin = { 0.0, 0.0 };
|
||||||
|
[v setContentViewMargins: margin];
|
||||||
|
[v sizeToFit];
|
||||||
wxStaticBoxCocoaImpl* c = new wxStaticBoxCocoaImpl( wxpeer, v );
|
wxStaticBoxCocoaImpl* c = new wxStaticBoxCocoaImpl( wxpeer, v );
|
||||||
#if !wxOSX_USE_NATIVE_FLIPPED
|
#if !wxOSX_USE_NATIVE_FLIPPED
|
||||||
c->SetFlipped(false);
|
c->SetFlipped(false);
|
||||||
|
@@ -76,7 +76,7 @@
|
|||||||
[m_textColor release];
|
[m_textColor release];
|
||||||
m_textColor = [[self textColor] retain];
|
m_textColor = [[self textColor] retain];
|
||||||
}
|
}
|
||||||
[self setTextColor: [NSColor secondarySelectedControlColor]];
|
[self setTextColor: [NSColor disabledControlTextColor]];
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@@ -213,17 +213,29 @@ NSView* wxMacEditHelper::ms_viewCurrentlyEdited = nil;
|
|||||||
{
|
{
|
||||||
if (commandSelector == @selector(insertNewline:))
|
if (commandSelector == @selector(insertNewline:))
|
||||||
{
|
{
|
||||||
wxTopLevelWindow *tlw = wxDynamicCast(wxGetTopLevelParent(wxpeer), wxTopLevelWindow);
|
if ( wxpeer->GetWindowStyle() & wxTE_PROCESS_ENTER )
|
||||||
if ( tlw && tlw->GetDefaultItem() )
|
|
||||||
{
|
{
|
||||||
wxButton *def = wxDynamicCast(tlw->GetDefaultItem(), wxButton);
|
wxCommandEvent event(wxEVT_TEXT_ENTER, wxpeer->GetId());
|
||||||
if ( def && def->IsEnabled() )
|
event.SetEventObject( wxpeer );
|
||||||
|
wxTextWidgetImpl* impl = (wxNSTextFieldControl * ) wxWidgetImpl::FindFromWXWidget( self );
|
||||||
|
wxTextEntry * const entry = impl->GetTextEntry();
|
||||||
|
event.SetString( entry->GetValue() );
|
||||||
|
handled = wxpeer->HandleWindowEvent( event );
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
wxTopLevelWindow *tlw = wxDynamicCast(wxGetTopLevelParent(wxpeer), wxTopLevelWindow);
|
||||||
|
if ( tlw && tlw->GetDefaultItem() )
|
||||||
{
|
{
|
||||||
wxCommandEvent event(wxEVT_BUTTON, def->GetId() );
|
wxButton *def = wxDynamicCast(tlw->GetDefaultItem(), wxButton);
|
||||||
event.SetEventObject(def);
|
if ( def && def->IsEnabled() )
|
||||||
def->Command(event);
|
{
|
||||||
handled = YES;
|
wxCommandEvent event(wxEVT_BUTTON, def->GetId() );
|
||||||
}
|
event.SetEventObject(def);
|
||||||
|
def->Command(event);
|
||||||
|
handled = YES;
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -568,6 +580,11 @@ wxNSTextViewControl::wxNSTextViewControl( wxTextCtrl *wxPeer, WXWidget w )
|
|||||||
[tv setHorizontallyResizable:NO];
|
[tv setHorizontallyResizable:NO];
|
||||||
[tv setAutoresizingMask:NSViewWidthSizable];
|
[tv setAutoresizingMask:NSViewWidthSizable];
|
||||||
|
|
||||||
|
if ( !wxPeer->HasFlag(wxTE_RICH | wxTE_RICH2) )
|
||||||
|
{
|
||||||
|
[tv setRichText:NO];
|
||||||
|
}
|
||||||
|
|
||||||
[m_scrollView setDocumentView: tv];
|
[m_scrollView setDocumentView: tv];
|
||||||
|
|
||||||
[tv setDelegate: tv];
|
[tv setDelegate: tv];
|
||||||
|
@@ -232,6 +232,10 @@ long wxOSXTranslateCocoaKey( NSEvent* event, int eventType )
|
|||||||
{
|
{
|
||||||
switch ( [s characterAtIndex:0] )
|
switch ( [s characterAtIndex:0] )
|
||||||
{
|
{
|
||||||
|
// numpad enter key End-of-text character ETX U+0003
|
||||||
|
case 3:
|
||||||
|
retval = WXK_NUMPAD_ENTER;
|
||||||
|
break;
|
||||||
// backspace key
|
// backspace key
|
||||||
case 0x7F :
|
case 0x7F :
|
||||||
case 8 :
|
case 8 :
|
||||||
@@ -345,9 +349,6 @@ long wxOSXTranslateCocoaKey( NSEvent* event, int eventType )
|
|||||||
case 69: // +
|
case 69: // +
|
||||||
retval = WXK_NUMPAD_ADD;
|
retval = WXK_NUMPAD_ADD;
|
||||||
break;
|
break;
|
||||||
case 76: // Enter
|
|
||||||
retval = WXK_NUMPAD_ENTER;
|
|
||||||
break;
|
|
||||||
case 65: // .
|
case 65: // .
|
||||||
retval = WXK_NUMPAD_DECIMAL;
|
retval = WXK_NUMPAD_DECIMAL;
|
||||||
break;
|
break;
|
||||||
|
@@ -637,10 +637,21 @@ bool wxMacPrinter::Print(wxWindow *parent, wxPrintout *printout, bool prompt)
|
|||||||
}
|
}
|
||||||
|
|
||||||
// Only set min and max, because from and to will be
|
// Only set min and max, because from and to will be
|
||||||
// set by the user
|
// set by the user if prompted for the print dialog above
|
||||||
m_printDialogData.SetMinPage(minPage);
|
m_printDialogData.SetMinPage(minPage);
|
||||||
m_printDialogData.SetMaxPage(maxPage);
|
m_printDialogData.SetMaxPage(maxPage);
|
||||||
|
|
||||||
|
// Set from and to pages if bypassing the print dialog
|
||||||
|
if ( !prompt )
|
||||||
|
{
|
||||||
|
m_printDialogData.SetFromPage(fromPage);
|
||||||
|
|
||||||
|
if( m_printDialogData.GetAllPages() )
|
||||||
|
m_printDialogData.SetToPage(maxPage);
|
||||||
|
else
|
||||||
|
m_printDialogData.SetToPage(toPage);
|
||||||
|
}
|
||||||
|
|
||||||
printout->OnBeginPrinting();
|
printout->OnBeginPrinting();
|
||||||
|
|
||||||
bool keepGoing = true;
|
bool keepGoing = true;
|
||||||
|
@@ -34,9 +34,9 @@
|
|||||||
class wxOSXAudioToolboxSoundData : public wxSoundData
|
class wxOSXAudioToolboxSoundData : public wxSoundData
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
wxOSXAudioToolboxSoundData(const wxString& fileName);
|
explicit wxOSXAudioToolboxSoundData(SystemSoundID soundID);
|
||||||
|
|
||||||
~wxOSXAudioToolboxSoundData();
|
virtual ~wxOSXAudioToolboxSoundData();
|
||||||
|
|
||||||
virtual bool Play(unsigned flags);
|
virtual bool Play(unsigned flags);
|
||||||
|
|
||||||
@@ -46,14 +46,12 @@ protected:
|
|||||||
void SoundCompleted();
|
void SoundCompleted();
|
||||||
|
|
||||||
SystemSoundID m_soundID;
|
SystemSoundID m_soundID;
|
||||||
wxString m_sndname; //file path
|
|
||||||
bool m_playing;
|
bool m_playing;
|
||||||
};
|
};
|
||||||
|
|
||||||
wxOSXAudioToolboxSoundData::wxOSXAudioToolboxSoundData(const wxString& fileName) :
|
wxOSXAudioToolboxSoundData::wxOSXAudioToolboxSoundData(SystemSoundID soundID) :
|
||||||
m_soundID(0)
|
m_soundID(soundID)
|
||||||
{
|
{
|
||||||
m_sndname = fileName;
|
|
||||||
m_playing = false;
|
m_playing = false;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -108,20 +106,13 @@ bool wxOSXAudioToolboxSoundData::Play(unsigned flags)
|
|||||||
|
|
||||||
m_flags = flags;
|
m_flags = flags;
|
||||||
|
|
||||||
wxCFRef<CFMutableStringRef> cfMutableString(CFStringCreateMutableCopy(NULL, 0, wxCFStringRef(m_sndname)));
|
|
||||||
CFStringNormalize(cfMutableString,kCFStringNormalizationFormD);
|
|
||||||
wxCFRef<CFURLRef> url(CFURLCreateWithFileSystemPath(kCFAllocatorDefault, cfMutableString , kCFURLPOSIXPathStyle, false));
|
|
||||||
|
|
||||||
AudioServicesCreateSystemSoundID(url, &m_soundID);
|
|
||||||
AudioServicesAddSystemSoundCompletion( m_soundID, CFRunLoopGetCurrent(), NULL, wxOSXAudioToolboxSoundData::CompletionCallback, (void *) this );
|
AudioServicesAddSystemSoundCompletion( m_soundID, CFRunLoopGetCurrent(), NULL, wxOSXAudioToolboxSoundData::CompletionCallback, (void *) this );
|
||||||
|
|
||||||
bool sync = !(flags & wxSOUND_ASYNC);
|
|
||||||
|
|
||||||
m_playing = true;
|
m_playing = true;
|
||||||
|
|
||||||
AudioServicesPlaySystemSound(m_soundID);
|
AudioServicesPlaySystemSound(m_soundID);
|
||||||
|
|
||||||
if ( sync )
|
if ( !(flags & wxSOUND_ASYNC) )
|
||||||
{
|
{
|
||||||
while ( m_playing )
|
while ( m_playing )
|
||||||
{
|
{
|
||||||
@@ -143,7 +134,20 @@ bool wxSound::Create(const wxString& fileName, bool isResource)
|
|||||||
{
|
{
|
||||||
wxCHECK_MSG( !isResource, false, "not implemented" );
|
wxCHECK_MSG( !isResource, false, "not implemented" );
|
||||||
|
|
||||||
m_data = new wxOSXAudioToolboxSoundData(fileName);
|
wxCFRef<CFMutableStringRef> cfMutableString(CFStringCreateMutableCopy(NULL, 0, wxCFStringRef(fileName)));
|
||||||
|
CFStringNormalize(cfMutableString,kCFStringNormalizationFormD);
|
||||||
|
wxCFRef<CFURLRef> url(CFURLCreateWithFileSystemPath(kCFAllocatorDefault, cfMutableString , kCFURLPOSIXPathStyle, false));
|
||||||
|
|
||||||
|
SystemSoundID soundID;
|
||||||
|
OSStatus err = AudioServicesCreateSystemSoundID(url, &soundID);
|
||||||
|
if ( err != 0 )
|
||||||
|
{
|
||||||
|
wxLogError(_("Failed to load sound from \"%s\" (error %d)."), fileName, err);
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
m_data = new wxOSXAudioToolboxSoundData(soundID);
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@@ -552,4 +552,12 @@ bool wxNonOwnedWindow::DoSetPathShape(const wxGraphicsPath& path)
|
|||||||
return DoSetRegionShape(wxRegion(bmp));
|
return DoSetRegionShape(wxRegion(bmp));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void
|
||||||
|
wxNonOwnedWindow::OSXHandleMiniaturize(double WXUNUSED(timestampsec),
|
||||||
|
bool miniaturized)
|
||||||
|
{
|
||||||
|
if ( wxTopLevelWindowMac* top = (wxTopLevelWindowMac*) MacGetTopLevelWindow() )
|
||||||
|
top->OSXSetIconizeState(miniaturized);
|
||||||
|
}
|
||||||
|
|
||||||
#endif // wxUSE_GRAPHICS_CONTEXT
|
#endif // wxUSE_GRAPHICS_CONTEXT
|
||||||
|
@@ -366,8 +366,10 @@ void wxTextCtrl::OnChar(wxKeyEvent& event)
|
|||||||
bool eat_key = false ;
|
bool eat_key = false ;
|
||||||
long from, to;
|
long from, to;
|
||||||
|
|
||||||
if ( !IsEditable() && !event.IsKeyInCategory(WXK_CATEGORY_ARROW | WXK_CATEGORY_TAB) &&
|
if ( !IsEditable() &&
|
||||||
!( key == WXK_RETURN && ( (m_windowStyle & wxTE_PROCESS_ENTER) || (m_windowStyle & wxTE_MULTILINE) ) )
|
!event.IsKeyInCategory(WXK_CATEGORY_ARROW | WXK_CATEGORY_TAB) &&
|
||||||
|
!( (key == WXK_RETURN || key == WXK_NUMPAD_ENTER) &&
|
||||||
|
( (m_windowStyle & wxTE_PROCESS_ENTER) || (m_windowStyle & wxTE_MULTILINE) ) )
|
||||||
// && key != WXK_PAGEUP && key != WXK_PAGEDOWN && key != WXK_HOME && key != WXK_END
|
// && key != WXK_PAGEUP && key != WXK_PAGEDOWN && key != WXK_HOME && key != WXK_END
|
||||||
)
|
)
|
||||||
{
|
{
|
||||||
@@ -382,7 +384,8 @@ void wxTextCtrl::OnChar(wxKeyEvent& event)
|
|||||||
GetSelection( &from, &to );
|
GetSelection( &from, &to );
|
||||||
if ( !IsMultiLine() && m_maxLength && GetValue().length() >= m_maxLength &&
|
if ( !IsMultiLine() && m_maxLength && GetValue().length() >= m_maxLength &&
|
||||||
!event.IsKeyInCategory(WXK_CATEGORY_ARROW | WXK_CATEGORY_TAB | WXK_CATEGORY_CUT) &&
|
!event.IsKeyInCategory(WXK_CATEGORY_ARROW | WXK_CATEGORY_TAB | WXK_CATEGORY_CUT) &&
|
||||||
!( key == WXK_RETURN && (m_windowStyle & wxTE_PROCESS_ENTER) ) &&
|
!( (key == WXK_RETURN || key == WXK_NUMPAD_ENTER) &&
|
||||||
|
(m_windowStyle & wxTE_PROCESS_ENTER) ) &&
|
||||||
from == to )
|
from == to )
|
||||||
{
|
{
|
||||||
// eat it, we don't want to add more than allowed # of characters
|
// eat it, we don't want to add more than allowed # of characters
|
||||||
@@ -398,6 +401,7 @@ void wxTextCtrl::OnChar(wxKeyEvent& event)
|
|||||||
switch ( key )
|
switch ( key )
|
||||||
{
|
{
|
||||||
case WXK_RETURN:
|
case WXK_RETURN:
|
||||||
|
case WXK_NUMPAD_ENTER:
|
||||||
if (m_windowStyle & wxTE_PROCESS_ENTER)
|
if (m_windowStyle & wxTE_PROCESS_ENTER)
|
||||||
{
|
{
|
||||||
wxCommandEvent event(wxEVT_TEXT_ENTER, m_windowId);
|
wxCommandEvent event(wxEVT_TEXT_ENTER, m_windowId);
|
||||||
@@ -466,6 +470,7 @@ void wxTextCtrl::OnChar(wxKeyEvent& event)
|
|||||||
( key >= WXK_NUMPAD0 && key <= WXK_DIVIDE ) ||
|
( key >= WXK_NUMPAD0 && key <= WXK_DIVIDE ) ||
|
||||||
key == WXK_RETURN ||
|
key == WXK_RETURN ||
|
||||||
key == WXK_DELETE ||
|
key == WXK_DELETE ||
|
||||||
|
key == WXK_NUMPAD_ENTER ||
|
||||||
key == WXK_BACK)
|
key == WXK_BACK)
|
||||||
{
|
{
|
||||||
wxCommandEvent event1(wxEVT_TEXT, m_windowId);
|
wxCommandEvent event1(wxEVT_TEXT, m_windowId);
|
||||||
|
@@ -224,3 +224,12 @@ void wxTopLevelWindowMac::SetRepresentedFilename(const wxString& filename)
|
|||||||
{
|
{
|
||||||
m_nowpeer->SetRepresentedFilename(filename);
|
m_nowpeer->SetRepresentedFilename(filename);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void wxTopLevelWindowMac::OSXSetIconizeState(bool iconize)
|
||||||
|
{
|
||||||
|
if ( iconize != m_iconized )
|
||||||
|
{
|
||||||
|
m_iconized = iconize;
|
||||||
|
(void)SendIconizeEvent(iconize);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
@@ -457,9 +457,16 @@ void wxWindowMac::MacChildAdded()
|
|||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
void wxWindowMac::MacPostControlCreate(const wxPoint& WXUNUSED(pos),
|
void wxWindowMac::MacPostControlCreate(const wxPoint& pos,
|
||||||
const wxSize& WXUNUSED(size))
|
const wxSize& WXUNUSED(size))
|
||||||
{
|
{
|
||||||
|
// Some controls may have a nonzero layout inset,
|
||||||
|
// so we may need to adjust control position.
|
||||||
|
if ( pos.IsFullySpecified() && GetPosition() != pos )
|
||||||
|
{
|
||||||
|
SetPosition(pos);
|
||||||
|
}
|
||||||
|
|
||||||
// todo remove if refactoring works correctly
|
// todo remove if refactoring works correctly
|
||||||
#if 0
|
#if 0
|
||||||
wxASSERT_MSG( GetPeer() != NULL && GetPeer()->IsOk() , wxT("No valid mac control") ) ;
|
wxASSERT_MSG( GetPeer() != NULL && GetPeer()->IsOk() , wxT("No valid mac control") ) ;
|
||||||
|
Reference in New Issue
Block a user