X-Git-Url: https://git.saurik.com/wxWidgets.git/blobdiff_plain/bcb07ff03e6c308e7a1c30479017d77dad9c4cb3..b02dd12239c8a59b9a545d9fcb04974f8ad02c6b:/include/wx/osx/carbon/private.h diff --git a/include/wx/osx/carbon/private.h b/include/wx/osx/carbon/private.h index c4f2ee8200..071ddbe384 100644 --- a/include/wx/osx/carbon/private.h +++ b/include/wx/osx/carbon/private.h @@ -14,10 +14,6 @@ #ifndef _WX_PRIVATE_H_ #define _WX_PRIVATE_H_ -#include "wx/osx/core/private.h" - -#include - #if MAC_OS_X_VERSION_MAX_ALLOWED < MAC_OS_X_VERSION_10_5 typedef UInt32 URefCon; typedef SInt32 SRefCon; @@ -25,10 +21,12 @@ typedef SInt32 SRefCon; #if wxUSE_GUI +#include "wx/osx/uma.h" + #include "wx/listbox.h" -#include "wx/osx/carbon/dc.h" -#include "wx/osx/carbon/dcclient.h" -#include "wx/osx/carbon/dcmemory.h" +#include "wx/osx/dc.h" +#include "wx/osx/dcclient.h" +#include "wx/osx/dcmemory.h" // app.h @@ -36,9 +34,6 @@ typedef SInt32 SRefCon; bool wxMacConvertEventToRecord( EventRef event , EventRecord *rec); #endif -WXDLLIMPEXP_CORE wxWindowMac * wxFindWindowFromWXWidget(WXWidget inControl ); -// TODO REMOVE WXDLLIMPEXP_CORE wxNonOwnedWindow* wxFindWindowFromWXWindow( WXWindow inWindow ); - #endif // wxUSE_GUI // filefn.h @@ -54,6 +49,7 @@ WXDLLIMPEXP_BASE wxString wxMacFindFolder(short vRefNum, Boolean createFolder); template EventParamType wxMacGetEventParamType() { wxFAIL_MSG( wxT("Unknown Param Type") ); return 0; } +template<> inline EventParamType wxMacGetEventParamType() { return typeHIShapeRef; } template<> inline EventParamType wxMacGetEventParamType() { return typeQDRgnHandle; } template<> inline EventParamType wxMacGetEventParamType() { return typeControlRef; } template<> inline EventParamType wxMacGetEventParamType() { return typeWindowRef; } @@ -283,14 +279,12 @@ enum { class WXDLLIMPEXP_CORE wxMacControl : public wxWidgetImpl { public : - wxMacControl( wxWindowMac* peer , bool isRootControl = false ); + wxMacControl( wxWindowMac* peer , bool isRootControl = false, bool isUserPane = false ); wxMacControl() ; virtual ~wxMacControl(); void Init(); - virtual void Destroy(); - void SetReferenceInNativeControl(); static wxMacControl* GetReferenceFromNativeControl(ControlRef control); @@ -299,25 +293,24 @@ public : virtual WXWidget GetWXWidget() const { return (WXWidget) m_controlRef; } - virtual void SetReference( URefCon data ); - virtual bool IsVisible() const; virtual void Raise(); - + virtual void Lower(); virtual void ScrollRect( const wxRect *rect, int dx, int dy ); - virtual void GetContentArea( int &left , int &top , int &width , int &height ) const; + virtual void GetContentArea( int &left , int &top , int &width , int &height ) const; virtual void Move(int x, int y, int width, int height); virtual void GetPosition( int &x, int &y ) const; virtual void GetSize( int &width, int &height ) const; + virtual void SetControlSize( wxWindowVariant variant ) ; // where is in native window relative coordinates virtual void SetNeedsDisplay( const wxRect* where = NULL ); virtual bool GetNeedsDisplay() const; - + virtual bool CanFocus() const; // return true if successful virtual bool SetFocus(); @@ -325,6 +318,34 @@ public : void RemoveFromParent(); void Embed( wxWidgetImpl *parent ); + + void SetDefaultButton( bool isDefault ); + void PerformClick(); + void SetLabel( const wxString& title, wxFontEncoding encoding ); + + void SetCursor( const wxCursor & cursor ); + void CaptureMouse(); + void ReleaseMouse(); + + wxInt32 GetValue() const; + void SetValue( wxInt32 v ); + wxBitmap GetBitmap() const; + void SetBitmap( const wxBitmap& bitmap ); + void SetBitmapPosition( wxDirection dir ); + void SetupTabs( const wxNotebook ¬ebook ); + + void GetBestRect( wxRect *r ) const; + bool IsEnabled() const; + void Enable( bool enable ); + bool ButtonClickDidStateChange() { return false ;} + void SetMinimum( wxInt32 v ); + void SetMaximum( wxInt32 v ); + void PulseGauge() ; + void SetScrollThumb( wxInt32 value, wxInt32 thumbSize ); + + // temp convenience methods + + void GetBestRect( Rect *r ) const; /* void operator= (ControlRef c) { m_controlRef = c; } operator ControlRef () { return m_controlRef; } @@ -340,13 +361,8 @@ public : virtual OSStatus SendHICommand( UInt32 commandID , OptionBits inOptions = 0 ); - virtual SInt32 GetValue() const; - virtual SInt32 GetMaximum() const; - virtual SInt32 GetMinimum() const; - - virtual void SetValue( SInt32 v ); - virtual void SetMinimum( SInt32 v ); - virtual void SetMaximum( SInt32 v ); + virtual wxInt32 GetMaximum() const; + virtual wxInt32 GetMinimum() const; virtual void SetValueAndRange( SInt32 value , SInt32 minimum , SInt32 maximum ); virtual void SetRange( SInt32 minimum , SInt32 maximum ); @@ -404,23 +420,21 @@ public : } // Flash the control for the specified amount of time - virtual void Flash( ControlPartCode part , UInt32 ticks = 8 ); virtual void VisibilityChanged( bool shown ); virtual void SuperChangedPosition(); - virtual void SetFont( const wxFont & font , const wxColour& foreground , long windowStyle ); + virtual void SetFont( const wxFont & font , const wxColour& foreground , long windowStyle, bool ignoreBlack = true ); virtual void SetBackgroundColour( const wxColour& col ); + virtual bool SetBackgroundStyle(wxBackgroundStyle style); virtual ControlPartCode HandleKey( SInt16 keyCode, SInt16 charCode, EventModifiers modifiers ); void SetActionProc( ControlActionUPP actionProc ); - void SetViewSize( SInt32 viewSize ); SInt32 GetViewSize() const; virtual void SetVisibility( bool visible ); - virtual bool IsEnabled() const; + virtual bool IsActive() const; - virtual void Enable( bool enable ); // invalidates this control and all children virtual void InvalidateWithChildren(); @@ -429,23 +443,15 @@ public : // in native parent window relative coordinates virtual void GetRectInWindowCoords( Rect *r ); - virtual void GetBestRect( Rect *r ); - virtual void SetLabel( const wxString &title ); virtual void GetFeatures( UInt32 *features ); - virtual OSStatus GetRegion( ControlPartCode partCode , RgnHandle region ); - + // to be moved into a tab control class virtual OSStatus SetTabEnabled( SInt16 tabNo , bool enable ); - void InstallEventHandler() - { - MacInstallEventHandler( m_controlRef, m_wxPeer ); - } - - static void MacInstallEventHandler( ControlRef control, wxWindowMac* wxPeer ); + virtual void InstallEventHandler( WXWidget control = NULL ); protected : WXEVENTHANDLERREF m_macControlEventHandler ; ControlRef m_controlRef; @@ -555,6 +561,8 @@ public : OSStatus SetHeaderDesc( DataBrowserPropertyID property, DataBrowserListViewHeaderDesc *desc ); OSStatus SetDisclosureColumn( DataBrowserPropertyID property , Boolean expandableRows ); + + OSStatus GetItemPartBounds( DataBrowserItemID item, DataBrowserPropertyID property, DataBrowserPropertyPart part, Rect * bounds ); protected : static pascal void DataBrowserItemNotificationProc( @@ -614,36 +622,21 @@ const DataBrowserPropertyID kMinColumnId = 1050; // base API for high-level databrowser operations -class WXDLLIMPEXP_CORE wxMacListControl -{ -public: - virtual void MacDelete( unsigned int n ) = 0; - virtual void MacInsert( unsigned int n, const wxArrayStringsAdapter& items, int column = -1 ) = 0; - // returns index of newly created line - virtual int MacAppend( const wxString& item ) = 0; - virtual void MacSetString( unsigned int n, const wxString& item ) = 0; - virtual void MacClear() = 0; - virtual void MacDeselectAll() = 0; - virtual void MacSetSelection( unsigned int n, bool select, bool multi ) = 0; - virtual int MacGetSelection() const = 0; - virtual int MacGetSelections( wxArrayInt& aSelections ) const = 0; - virtual bool MacIsSelected( unsigned int n ) const = 0; - virtual void MacScrollTo( unsigned int n ) = 0; - virtual wxString MacGetString( unsigned int n) const = 0; - virtual unsigned int MacGetCount() const = 0; - - virtual void MacSetClientData( unsigned int n, void * data) = 0; - virtual void * MacGetClientData( unsigned int) const = 0; - - virtual ~wxMacListControl() { } -}; - // base class for databrowser items enum DataItemType { DataItem_Text }; +/* +class WXDLLIMPEXP_CORE wxMacDataItem +{ +public : + wxMacDataItem(); + virtual ~wxMacDataItem(); +} ; +*/ + class WXDLLIMPEXP_CORE wxMacDataItem { public : @@ -664,24 +657,11 @@ public : DataBrowserItemNotification message, DataBrowserItemDataRef itemData ) const; - void SetLabel( const wxString& str); - const wxString& GetLabel() const; - void SetOrder( SInt32 order ); SInt32 GetOrder() const; - void SetData( void* data); - void* GetData() const; - - void SetColumn( short col ); - short GetColumn(); - protected : - wxString m_label; - wxCFStringRef m_cfLabel; - void * m_data; SInt32 m_order; - DataBrowserPropertyID m_colId; }; @@ -693,18 +673,17 @@ enum ListSortOrder { typedef wxMacDataItem* wxMacDataItemPtr; const wxMacDataItemPtr wxMacDataBrowserRootContainer = NULL; +typedef void * wxListColumnId ; WX_DEFINE_USER_EXPORTED_ARRAY_PTR(wxMacDataItemPtr, wxArrayMacDataItemPtr, class WXDLLIMPEXP_CORE); -class WXDLLIMPEXP_CORE wxMacDataItemBrowserControl : public wxMacDataBrowserControl, public wxMacListControl +class WXDLLIMPEXP_CORE wxMacDataItemBrowserControl : public wxMacDataBrowserControl { public : wxMacDataItemBrowserControl( wxWindow* peer , const wxPoint& pos, const wxSize& size, long style); wxMacDataItemBrowserControl() {} // create a list item (can be a subclass of wxMacListBoxItem) - virtual wxMacDataItem* CreateItem(); - unsigned int GetItemCount(const wxMacDataItem* container, bool recurse , DataBrowserItemState state) const; void GetItems(const wxMacDataItem* container, bool recurse , DataBrowserItemState state, wxArrayMacDataItemPtr &items ) const; @@ -741,56 +720,23 @@ public : void GetSelectionAnchor( wxMacDataItemPtr* first , wxMacDataItemPtr* last) const; - // item aware methods, to be used in subclasses - - virtual Boolean CompareItems(const wxMacDataItem* itemOneID, - const wxMacDataItem* itemTwoID, - DataBrowserPropertyID sortProperty); - - virtual OSStatus GetSetItemData(wxMacDataItem* itemID, - DataBrowserPropertyID property, - DataBrowserItemDataRef itemData, - Boolean changeValue ); - - virtual void ItemNotification( - const wxMacDataItem* itemID, - DataBrowserItemNotification message, - DataBrowserItemDataRef itemData); - - // as we are getting the same events for human and API selection we have to suppress - // events in the latter case, since this will be used from many subclasses we keep it here - - bool IsSelectionSuppressed() const { return m_suppressSelection; } - bool SuppressSelection( bool suppress ); - - - // wxMacListControl Methods // add and remove virtual void MacDelete( unsigned int n ); - virtual void MacInsert( unsigned int n, const wxArrayStringsAdapter& items, int column = -1 ); - virtual int MacAppend( const wxString& item ); + virtual void MacInsert( unsigned int n, wxMacDataItem* item); virtual void MacClear(); - // selecting - - virtual void MacDeselectAll(); - virtual void MacSetSelection( unsigned int n, bool select, bool multi = false ); - virtual int MacGetSelection() const; - virtual int MacGetSelections( wxArrayInt& aSelections ) const; - virtual bool MacIsSelected( unsigned int n ) const; + // accessing content - // display + virtual unsigned int MacGetCount() const; - virtual void MacScrollTo( unsigned int n ); +public : - // accessing content + // as we are getting the same events for human and API selection we have to suppress + // events in the latter case, since this will be used from many subclasses we keep it here - virtual void MacSetString( unsigned int n, const wxString& item ); - virtual void MacSetClientData( unsigned int n, void * data); - virtual wxString MacGetString( unsigned int n) const; - virtual void * MacGetClientData( unsigned int) const; - virtual unsigned int MacGetCount() const; + bool IsSelectionSuppressed() const { return m_suppressSelection; } + bool SuppressSelection( bool suppress ); // client data @@ -854,28 +800,116 @@ public : virtual ~wxMacListBoxItem(); + virtual OSStatus GetSetData(wxMacDataItemBrowserControl *owner , + DataBrowserPropertyID property, + DataBrowserItemDataRef itemData, + bool changeValue ); + virtual void Notification(wxMacDataItemBrowserControl *owner , DataBrowserItemNotification message, DataBrowserItemDataRef itemData ) const; +protected : }; -class WXDLLIMPEXP_CORE wxMacDataBrowserListControl : public wxMacDataItemBrowserControl +class WXDLLIMPEXP_CORE wxMacDataBrowserColumn : public wxListWidgetColumn +{ +public : + wxMacDataBrowserColumn( DataBrowserPropertyID propertyId, DataBrowserPropertyType colType, bool editable ) + : m_property(propertyId), m_editable(editable), m_type( colType ) + { + } + ~wxMacDataBrowserColumn() + { + } + DataBrowserPropertyID GetProperty() const { return m_property ; } + + bool IsEditable() const { return m_editable; } + + DataBrowserPropertyType GetType() const { return m_type; } + +protected : + DataBrowserPropertyID m_property; + bool m_editable; + DataBrowserPropertyType m_type; +} ; + +WX_DEFINE_ARRAY_PTR(wxMacDataBrowserColumn *, wxArrayMacDataBrowserColumns); + + +class WXDLLIMPEXP_CORE wxMacDataBrowserCellValue : public wxListWidgetCellValue +{ +public : + wxMacDataBrowserCellValue(DataBrowserItemDataRef data) : m_data(data) {} + virtual ~wxMacDataBrowserCellValue() {} + + virtual void Set( CFStringRef value ); + virtual void Set( const wxString& value ); + virtual void Set( int value ) ; + virtual void Check( bool check ); + + virtual int GetIntValue() const ; + virtual wxString GetStringValue() const ; +protected : + DataBrowserItemDataRef m_data; +} ; + + +class WXDLLIMPEXP_CORE wxMacDataBrowserListControl : public wxMacDataItemBrowserControl, public wxListWidgetImpl { public: wxMacDataBrowserListControl( wxWindow *peer, const wxPoint& pos, const wxSize& size, long style ); wxMacDataBrowserListControl() {} virtual ~wxMacDataBrowserListControl(); - virtual wxMacDataItem* CreateItem(); + // wxListWidgetImpl Methods - virtual void ItemNotification( - const wxMacDataItem* itemID, - DataBrowserItemNotification message, - DataBrowserItemDataRef itemData); + wxListWidgetColumn* InsertTextColumn( unsigned int pos, const wxString& title, bool editable = false, + wxAlignment just = wxALIGN_LEFT , int defaultWidth = -1) ; + wxListWidgetColumn* InsertCheckColumn( unsigned int pos , const wxString& title, bool editable = false, + wxAlignment just = wxALIGN_LEFT , int defaultWidth = -1) ; + + wxMacDataBrowserColumn* DoInsertColumn( unsigned int pos, DataBrowserPropertyID property, + const wxString& title, bool editable, + DataBrowserPropertyType colType, SInt16 just, int width ); + // add and remove + + virtual void ListDelete( unsigned int n ); + virtual void ListInsert( unsigned int n ); + virtual void ListClear(); + + // selecting + + virtual void ListDeselectAll(); + virtual void ListSetSelection( unsigned int n, bool select, bool multi = false ); + virtual int ListGetSelection() const; + virtual int ListGetSelections( wxArrayInt& aSelections ) const; + virtual bool ListIsSelected( unsigned int n ) const; + + // display + + virtual void ListScrollTo( unsigned int n ); + + // accessing content + + virtual unsigned int ListGetCount() const; + virtual int DoListHitTest( const wxPoint& inpoint ) const; + + virtual void UpdateLine( unsigned int n, wxListWidgetColumn* col = NULL ); + virtual void UpdateLineToEnd( unsigned int n) ; // pointing back - // wxWindow * GetPeer() const; + wxMacDataBrowserColumn* GetColumnFromProperty( DataBrowserPropertyID ); + +protected: + virtual void ItemNotification( + DataBrowserItemID itemID, + DataBrowserItemNotification message, + DataBrowserItemDataRef itemData); + +private: + wxArrayMacDataBrowserColumns m_columns; + int m_nextColumnId ; DECLARE_DYNAMIC_CLASS_NO_COPY(wxMacDataBrowserListControl) }; @@ -904,22 +938,6 @@ UPP Get##x() \ return sHandler; \ } -//--------------------------------------------------------------------------- -// wxMac string conversions -//--------------------------------------------------------------------------- - -void wxMacSetupConverters(); -void wxMacCleanupConverters(); - -WXDLLIMPEXP_BASE void wxMacStringToPascal( const wxString&from , StringPtr to ); -WXDLLIMPEXP_BASE wxString wxMacMakeStringFromPascal( ConstStringPtr from ); - -// filefn.cpp - -WXDLLIMPEXP_BASE wxString wxMacFSRefToPath( const FSRef *fsRef , CFStringRef additionalPathComponent = NULL ); -WXDLLIMPEXP_BASE OSStatus wxMacPathToFSRef( const wxString&path , FSRef *fsRef ); -WXDLLIMPEXP_BASE wxString wxMacHFSUniStrToString( ConstHFSUniStr255Param uniname ); - //--------------------------------------------------------------------------- // cocoa bridging utilities //--------------------------------------------------------------------------- @@ -949,7 +967,8 @@ const short kwxCursorSize = 11; const short kwxCursorSizeNESW = 12; const short kwxCursorSizeNWSE = 13; const short kwxCursorRoller = 14; -const short kwxCursorLast = kwxCursorRoller; +const short kwxCursorWatch = 15; +const short kwxCursorLast = kwxCursorWatch; // exposing our fallback cursor map @@ -965,53 +984,58 @@ class wxNonOwnedWindowCarbonImpl : public wxNonOwnedWindowImpl { public : wxNonOwnedWindowCarbonImpl( wxNonOwnedWindow* nonownedwnd) ; + wxNonOwnedWindowCarbonImpl(); virtual ~wxNonOwnedWindowCarbonImpl(); - - virtual void Destroy() ; + + virtual void WillBeDestroyed() ; void Create( wxWindow* parent, const wxPoint& pos, const wxSize& size, long style, long extraStyle, const wxString& name ) ; - + void Create( wxWindow* parent, WXWindow nativeWindow ); + WXWindow GetWXWindow() const; - void Raise(); + void Raise(); void Lower(); - bool Show(bool show); + bool Show(bool show); bool ShowWithEffect(bool show, wxShowEffect effect, unsigned timeout); - + void Update(); bool SetTransparent(wxByte alpha); bool SetBackgroundColour(const wxColour& col ); - void SetExtraStyle( long exStyle ); - bool SetBackgroundStyle(wxBackgroundStyle style); + void SetExtraStyle( long exStyle ); + bool SetBackgroundStyle(wxBackgroundStyle style); bool CanSetTransparent(); void MoveWindow(int x, int y, int width, int height); void GetPosition( int &x, int &y ) const; void GetSize( int &width, int &height ) const; - void GetContentArea( int &left , int &top , int &width , int &height ) const; + void GetContentArea( int &left , int &top , int &width , int &height ) const; bool SetShape(const wxRegion& region); virtual void SetTitle( const wxString& title, wxFontEncoding encoding ) ; - + virtual bool IsMaximized() const; - + virtual bool IsIconized() const; - + virtual void Iconize( bool iconize ); - + virtual void Maximize(bool maximize); - + virtual bool IsFullScreen() const; - + virtual bool ShowFullScreen(bool show, long style); + virtual void ShowWithoutActivating(); + virtual void RequestUserAttention(int flags); - + virtual void ScreenToWindow( int *x, int *y ); - + virtual void WindowToScreen( int *x, int *y ); - + virtual bool IsActive(); + bool MacGetUnifiedAppearance() const ; void MacChangeWindowAttributes( wxUint32 attributesToSet , wxUint32 attributesToClear ) ; @@ -1019,18 +1043,18 @@ public : void MacSetMetalAppearance( bool set ) ; bool MacGetMetalAppearance() const ; void MacSetUnifiedAppearance( bool set ); - + WXEVENTHANDLERREF MacGetEventHandler() { return m_macEventHandler ; } wxNonOwnedWindow* GetWXPeer() { return m_wxPeer; } protected : void MacInstallTopLevelWindowEventHandler(); - + WXEVENTHANDLERREF m_macEventHandler ; WindowRef m_macWindow; void * m_macFullScreenData ; - DECLARE_DYNAMIC_CLASS_NO_COPY(wxNonOwnedWindowCarbonImpl) -}; + DECLARE_DYNAMIC_CLASS_NO_COPY(wxNonOwnedWindowCarbonImpl) +}; #endif // wxUSE_GUI