X-Git-Url: https://git.saurik.com/wxWidgets.git/blobdiff_plain/96defed03c190cb602ed4f7ca6e962a49e10dddd..86ac84b8ce086e6bbda58f422d41f84268606e35:/include/wx/osx/cocoa/private.h?ds=sidebyside diff --git a/include/wx/osx/cocoa/private.h b/include/wx/osx/cocoa/private.h index f590361da1..fb8f330b3d 100644 --- a/include/wx/osx/cocoa/private.h +++ b/include/wx/osx/cocoa/private.h @@ -98,7 +98,7 @@ public : void SetDefaultButton( bool isDefault ); void PerformClick(); - void SetLabel(const wxString& title, wxFontEncoding encoding); + virtual void SetLabel(const wxString& title, wxFontEncoding encoding); void SetCursor( const wxCursor & cursor ); void CaptureMouse(); @@ -124,11 +124,12 @@ public : void InstallEventHandler( WXWidget control = NULL ); virtual bool DoHandleMouseEvent(NSEvent *event); - virtual bool DoHandleKeyEvent(NSEvent *event); - virtual void DoNotifyFocusEvent(bool receivedFocus); + virtual bool DoHandleKeyEvent(NSEvent *event); + virtual bool DoHandleCharEvent(NSEvent *event, NSString *text); + virtual void DoNotifyFocusEvent(bool receivedFocus, wxWidgetImpl* otherWindow); void SetFlipped(bool flipped); - bool IsFlipped() const { return m_isFlipped; } + virtual bool IsFlipped() const { return m_isFlipped; } // cocoa thunk connected calls @@ -138,19 +139,25 @@ public : virtual bool performDragOperation(void* sender, WXWidget slf, void* _cmd); virtual void mouseEvent(WX_NSEvent event, WXWidget slf, void* _cmd); virtual void keyEvent(WX_NSEvent event, WXWidget slf, void* _cmd); + virtual void insertText(NSString* text, WXWidget slf, void* _cmd); virtual bool performKeyEquivalent(WX_NSEvent event, WXWidget slf, void* _cmd); + virtual bool acceptsFirstResponder(WXWidget slf, void* _cmd); virtual bool becomeFirstResponder(WXWidget slf, void* _cmd); virtual bool resignFirstResponder(WXWidget slf, void* _cmd); virtual void resetCursorRects(WXWidget slf, void* _cmd); virtual bool isFlipped(WXWidget slf, void* _cmd); virtual void drawRect(void* rect, WXWidget slf, void* _cmd); - virtual void clickedAction(WXWidget slf, void* _cmd, void* sender); - virtual void doubleClickedAction(WXWidget slf, void* _cmd, void *sender); + virtual void controlAction(WXWidget slf, void* _cmd, void* sender); + virtual void controlDoubleAction(WXWidget slf, void* _cmd, void *sender); protected: WXWidget m_osxView; + NSEvent* m_lastKeyDownEvent; bool m_isFlipped; + // if it the control has an editor, that editor will already send some + // events, don't resend them + bool m_hasEditor; DECLARE_DYNAMIC_CLASS_NO_COPY(wxWidgetCocoaImpl) }; @@ -218,10 +225,10 @@ protected : #ifdef __OBJC__ - extern NSRect wxToNSRect( NSView* parent, const wxRect& r ); - extern wxRect wxFromNSRect( NSView* parent, const NSRect& rect ); - extern NSPoint wxToNSPoint( NSView* parent, const wxPoint& p ); - extern wxPoint wxFromNSPoint( NSView* parent, const NSPoint& p ); + WXDLLIMPEXP_CORE NSRect wxToNSRect( NSView* parent, const wxRect& r ); + WXDLLIMPEXP_CORE wxRect wxFromNSRect( NSView* parent, const NSRect& rect ); + WXDLLIMPEXP_CORE NSPoint wxToNSPoint( NSView* parent, const wxPoint& p ); + WXDLLIMPEXP_CORE wxPoint wxFromNSPoint( NSView* parent, const NSPoint& p ); NSRect WXDLLIMPEXP_CORE wxOSXGetFrameForControl( wxWindowMac* window , const wxPoint& pos , const wxSize &size , bool adjustForOrigin = true ); @@ -240,12 +247,36 @@ protected : @end + @interface wxNSTextFieldEditor : NSTextView + { + NSEvent* lastKeyDownEvent; + } + + @end + @interface wxNSTextField : NSTextField + { + wxNSTextFieldEditor* fieldEditor; + } + + - (wxNSTextFieldEditor*) fieldEditor; + - (void) setFieldEditor:(wxNSTextFieldEditor*) fieldEditor; + + @end + + @interface wxNSSecureTextField : NSSecureTextField { } @end + + @interface wxNSTextView : NSTextView + { + } + + @end + @interface wxNSMenu : NSMenu { wxMenuImpl* impl; @@ -271,6 +302,24 @@ protected : void WXDLLIMPEXP_CORE wxOSXCocoaClassAddWXMethods(Class c); + /* + We need this for ShowModal, as the sheet just disables the parent window and + returns control to the app, whereas we don't want to return from ShowModal + until the sheet has been dismissed. + */ + @interface ModalDialogDelegate : NSObject + { + BOOL sheetFinished; + int resultCode; + } + + - (BOOL)finished; + - (int)code; + - (void)waitForSheetToFinish; + - (void)sheetDidEnd:(NSWindow *)sheet returnCode:(int)returnCode contextInfo:(void *)contextInfo; + @end + + #endif // __OBJC__ // NSCursor