osx new layout

git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@55419 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
This commit is contained in:
Stefan Csomor
2008-09-02 16:53:23 +00:00
parent 70231bce2d
commit 524c47aa3a
149 changed files with 10286 additions and 9751 deletions

View File

@@ -44,21 +44,20 @@ class WXDLLIMPEXP_CORE wxApp: public wxAppBase
virtual void SetPrintMode(int mode) { m_printMode = mode; }
virtual int GetPrintMode() const { return m_printMode; }
// calling OnInit with an auto-release pool ready ...
virtual bool CallOnInit();
#if wxUSE_GUI
// setting up all MacOS Specific Event-Handlers etc
virtual bool OnInitGui();
#endif // wxUSE_GUI
#if wxOSX_USE_IPHONE
virtual bool CallOnInit();
virtual int OnRun();
#endif
virtual bool ProcessIdle();
// implementation only
void OnIdle(wxIdleEvent& event);
void OnEndSession(wxCloseEvent& event);
void OnQueryEndSession(wxCloseEvent& event);
void MacDoOneEvent() ;
protected:
int m_printMode; // wxPRINT_WINDOWS, wxPRINT_POSTSCRIPT
@@ -88,6 +87,8 @@ public:
private:
// mac specifics
virtual bool DoInitGui();
virtual void DoCleanUp();
WXEVENTHANDLERREF m_macEventHandler ;
WXEVENTHANDLERCALLREF m_macCurrentEventHandlerCallRef ;
@@ -101,7 +102,6 @@ public:
static wxString s_macHelpMenuTitleName ;
WXEVENTREF MacGetCurrentEvent() { return m_macCurrentEvent ; }
void MacHandleOneEvent( WXEVENTREF ev ) ;
// For embedded use. By default does nothing.
virtual void MacHandleUnhandledEvent( WXEVENTREF ev );

View File

@@ -162,6 +162,10 @@ public:
// returns a CGImageRef which must released after usage with CGImageRelease
CGImageRef CreateCGImage() const ;
#if wxOSX_USE_COCOA_OR_IPHONE
// returns an autoreleased version of the image
WX_NSImage GetNSImage() const;
#endif
// returns a IconRef which must be retained before and released after usage
IconRef GetIconRef() const;
// returns a IconRef which must be released after usage

View File

@@ -43,12 +43,15 @@ public:
const wxValidator& validator = wxDefaultValidator,
const wxString& name = wxButtonNameStr);
virtual wxInt32 MacControlHit( WXEVENTHANDLERREF handler , WXEVENTREF event ) ;
static wxSize GetDefaultSize();
virtual wxWindow *SetDefault();
virtual void Command(wxCommandEvent& event);
// osx specific event handling common for all osx-ports
virtual bool HandleClicked( double timestampsec );
protected:
virtual wxSize DoGetBestSize() const ;
@@ -82,7 +85,9 @@ public:
void SetOpen( bool open );
bool IsOpen() const;
virtual wxInt32 MacControlHit( WXEVENTHANDLERREF handler , WXEVENTREF event ) ;
// osx specific event handling common for all osx-ports
virtual bool HandleClicked( double timestampsec );
protected:
virtual wxSize DoGetBestSize() const ;

View File

@@ -34,9 +34,11 @@ public:
virtual void SetValue(bool);
virtual bool GetValue() const;
virtual wxInt32 MacControlHit( WXEVENTHANDLERREF handler , WXEVENTREF event ) ;
virtual void Command(wxCommandEvent& event);
// osx specific event handling common for all osx-ports
virtual bool HandleClicked( double timestampsec );
protected:
void DoSet3StateValue(wxCheckBoxState val);
virtual wxCheckBoxState DoGet3StateValue() const;

View File

@@ -13,15 +13,6 @@
#ifndef _WX_MAC_CHECKLST_H_
#define _WX_MAC_CHECKLST_H_
class wxMacCheckListControl
{
public :
virtual bool MacIsChecked(unsigned int n) const = 0;
virtual void MacCheck(unsigned int n, bool bCheck = true) = 0;
virtual ~wxMacCheckListControl() { }
};
class WXDLLIMPEXP_CORE wxCheckListBox : public wxCheckListBoxBase
{
public:
@@ -77,9 +68,22 @@ public:
bool IsChecked(unsigned int uiIndex) const;
void Check(unsigned int uiIndex, bool bCheck = true);
wxMacCheckListControl* GetPeer() const;
// data callbacks
virtual void GetValueCallback( unsigned int n, wxListWidgetColumn* col , wxListWidgetCellValue& value );
virtual void SetValueCallback( unsigned int n, wxListWidgetColumn* col , wxListWidgetCellValue& value );
protected:
// override all methods which add/delete items to update m_checks array as
// well
virtual void OnItemInserted(unsigned int pos);
virtual void DoDeleteOneItem(unsigned int n);
virtual void DoClear();
// the array containing the checked status of the items
wxArrayInt m_checks;
wxListWidgetColumn* m_checkColumn ;
void Init();
private:

View File

@@ -28,7 +28,7 @@ class WXDLLIMPEXP_CORE wxChoice: public wxChoiceBase
public:
wxChoice()
: m_strings(), m_datas(), m_macPopUpMenuHandle(NULL)
: m_strings(), m_datas()
{}
virtual ~wxChoice() ;
@@ -76,7 +76,9 @@ public:
virtual int FindString(const wxString& s, bool bCase = false) const;
virtual wxString GetString(unsigned int n) const ;
virtual void SetString(unsigned int pos, const wxString& s);
virtual wxInt32 MacControlHit( WXEVENTHANDLERREF handler , WXEVENTREF event ) ;
// osx specific event handling common for all osx-ports
virtual bool HandleClicked( double timestampsec );
protected:
virtual void DoDeleteOneItem(unsigned int n);
@@ -92,7 +94,7 @@ protected:
wxArrayString m_strings;
wxChoiceDataArray m_datas ;
WXHMENU m_macPopUpMenuHandle ;
wxMenu* m_popUpMenu ;
};
#endif

View File

@@ -125,7 +125,9 @@ class WXDLLIMPEXP_CORE wxComboBox : public wxControl, public wxComboBoxBase
virtual wxClientDataType GetClientDataType() const;
wxInt32 MacControlHit( WXEVENTHANDLERREF handler, WXEVENTREF event );
// osx specific event handling common for all osx-ports
virtual bool HandleClicked( double timestampsec );
wxCONTROL_ITEMCONTAINER_CLIENTDATAOBJECT_RECAST

View File

@@ -12,53 +12,19 @@
#ifndef _WX_MAC_CARBON_EVTLOOP_H_
#define _WX_MAC_CARBON_EVTLOOP_H_
// set wxOSX_USE_RUN_APP_EVENT_LOOP to 1 if the standard
// RunApplicationEventLoop function should be used, otherwise
// the lower level CarbonEventLoop will be used
//
// in the long run we should make this 1 by default but we will have to clean
// up event handling to make sure we don't miss handling of things like pending
// events etc and perhaps we will also have to pipe events through an
// ueber-event-handler to make sure we have one place to do all these
// house-keeping functions
#define wxOSX_USE_RUN_APP_EVENT_LOOP 0
// ----------------------------------------------------------------------------
// wxEventLoop
// ----------------------------------------------------------------------------
#if wxOSX_USE_RUN_APP_EVENT_LOOP
class WXDLLIMPEXP_CORE wxGUIEventLoop : public wxEventLoopBase
{
public:
wxGUIEventLoop() { m_exitcode = 0; }
// implement base class pure virtuals
virtual int Run();
virtual void Exit(int rc = 0);
virtual bool Pending() const;
virtual bool Dispatch();
private:
int m_exitcode;
};
#else // manual event loop
class WXDLLIMPEXP_CORE wxGUIEventLoop : public wxEventLoopManual
{
public:
wxGUIEventLoop() { }
wxGUIEventLoop();
virtual bool Pending() const;
virtual bool Dispatch();
// implement base class pure virtual
virtual void WakeUp();
private:
double m_sleepTime;
};
#endif // auto/manual event loop
#endif // _WX_MAC_CARBON_EVTLOOP_H_

View File

@@ -50,7 +50,9 @@ public:
bool Create(const wxNativeFontInfo& info);
#if wxOSX_USE_CARBON
bool MacCreateFromThemeFont( wxUint16 themeFontID ) ;
#endif
#if wxOSX_USE_CORE_TEXT
bool MacCreateFromUIFont( wxUint32 coreTextFontType );
bool MacCreateFromCTFontDescriptor( const void * ctFontDescriptor, int pointSize = 0 );

View File

@@ -103,8 +103,13 @@ protected:
virtual void DoGetClientSize(int *width, int *height) const;
virtual void DoSetClientSize(int width, int height);
#if wxUSE_MENUS
virtual void DetachMenuBar();
virtual void AttachMenuBar(wxMenuBar *menubar);
#endif
// osx specific event handling common for all osx-ports
virtual void HandleResized( long timestamp );
protected:
// the last focused child: we restore focus to it on activation

View File

@@ -12,13 +12,17 @@
#ifndef _WX_GLCANVAS_H_
#define _WX_GLCANVAS_H_
#ifdef __DARWIN__
# include <OpenGL/gl.h>
# include <AGL/agl.h>
#else
# include <gl.h>
# include <agl.h>
#endif
#include <OpenGL/gl.h>
// low level calls
WXDLLIMPEXP_GL WXGLContext WXGLCreateContext( WXGLPixelFormat pixelFormat, WXGLContext shareContext );
WXDLLIMPEXP_GL void WXGLDestroyContext( WXGLContext context );
WXDLLIMPEXP_GL WXGLContext WXGLGetCurrentContext();
WXDLLIMPEXP_GL void WXGLSwapBuffers( WXGLContext context );
WXDLLIMPEXP_GL WXGLPixelFormat WXGLChoosePixelFormat(const int *attribList);
WXDLLIMPEXP_GL void WXGLDestroyPixelFormat( WXGLPixelFormat pixelFormat );
class WXDLLIMPEXP_GL wxGLContext : public wxGLContextBase
{
@@ -29,10 +33,10 @@ public:
virtual bool SetCurrent(const wxGLCanvas& win) const;
// Mac-specific
AGLContext GetAGLContext() const { return m_aglContext; }
WXGLContext GetWXGLContext() const { return m_glContext; }
private:
AGLContext m_aglContext;
WXGLContext m_glContext;
DECLARE_NO_COPY_CLASS(wxGLContext)
};
@@ -71,7 +75,7 @@ public:
static bool IsAGLMultiSampleAvailable();
// return the pixel format used by this window
AGLPixelFormat GetAGLPixelFormat() const { return m_aglFormat; }
WXGLPixelFormat GetWXGLPixelFormat() const { return m_glFormat; }
// update the view port of the current context to match this window
void SetViewport();
@@ -119,6 +123,7 @@ public:
// implementation-only from now on
#if wxOSX_USE_CARBON
// Unlike some other platforms, this must get called if you override it,
// i.e. don't forget "event.Skip()" in your EVT_SIZE handler
void OnSize(wxSizeEvent& event);
@@ -128,12 +133,19 @@ public:
virtual void MacVisibilityChanged();
void MacUpdateView();
GLint GetAglBufferName() const { return m_bufferName; }
#endif
protected:
AGLPixelFormat m_aglFormat;
WXGLPixelFormat m_glFormat;
#if wxOSX_USE_CARBON
bool m_macCanvasIsShown,
m_needsUpdate;
WXGLContext m_dummyContext;
GLint m_bufferName;
#endif
DECLARE_EVENT_TABLE()
DECLARE_CLASS(wxGLCanvas)

View File

@@ -21,8 +21,8 @@
// forward decl for GetSelections()
class wxArrayInt;
// forward decl for wxMacListControl data type.
class wxMacListControl;
// forward decl for wxListWidgetImpl data type.
class wxListWidgetImpl;
// List box item
@@ -32,6 +32,10 @@ WX_DEFINE_ARRAY( char* , wxListDataArray );
// List box control
// ----------------------------------------------------------------------------
class WXDLLIMPEXP_CORE wxListWidgetColumn;
class WXDLLIMPEXP_CORE wxListWidgetCellValue;
class WXDLLIMPEXP_CORE wxListBox : public wxListBoxBase
{
public:
@@ -86,7 +90,7 @@ public:
const wxString& name = wxListBoxNameStr);
virtual ~wxListBox();
// implement base class pure virtuals
virtual void Refresh(bool eraseBack = true, const wxRect *rect = NULL);
@@ -95,6 +99,10 @@ public:
virtual void SetString(unsigned int n, const wxString& s);
virtual int FindString(const wxString& s, bool bCase = false) const;
// data callbacks
virtual void GetValueCallback( unsigned int n, wxListWidgetColumn* col , wxListWidgetCellValue& value );
virtual void SetValueCallback( unsigned int n, wxListWidgetColumn* col , wxListWidgetCellValue& value );
virtual bool IsSelected(int n) const;
virtual int GetSelection() const;
virtual int GetSelections(wxArrayInt& aSelections) const;
@@ -110,11 +118,15 @@ public:
static wxVisualAttributes
GetClassDefaultAttributes(wxWindowVariant variant = wxWINDOW_VARIANT_NORMAL);
wxMacListControl* GetPeer() const;
wxListWidgetImpl* GetListPeer() const;
bool MacGetBlockEvents() const { return m_blockEvents; }
protected:
// callback for derived classes which may have to insert additional data
// at a certain line - which cannot be predetermined for sorted list data
virtual void OnItemInserted(unsigned int pos);
virtual void DoClear();
virtual void DoDeleteOneItem(unsigned int n);
@@ -139,6 +151,21 @@ protected:
bool m_blockEvents;
wxListWidgetColumn* m_textColumn;
// data storage (copied from univ)
// the array containing all items (it is sorted if the listbox has
// wxLB_SORT style)
union
{
wxArrayString *unsorted;
wxSortedArrayString *sorted;
} m_strings;
// and this one the client data (either void or wxClientData)
wxArrayPtrVoid m_itemsClientData;
private:
DECLARE_DYNAMIC_CLASS(wxListBox)
DECLARE_EVENT_TABLE()

View File

@@ -18,7 +18,6 @@
#define wxMAC_ALWAYS_USE_GENERIC_LISTCTRL wxT("mac.listctrl.always_use_generic")
class wxMacDataBrowserListCtrlControl;
class wxMacListControl;
class wxListCtrlTextCtrlWrapper;
class wxListCtrlRenameTimer;
@@ -281,7 +280,7 @@ class WXDLLIMPEXP_CORE wxListCtrl: public wxControl
// data is arbitrary data to be passed to the sort function.
bool SortItems(wxListCtrlCompare fn, long data);
wxMacListControl* GetPeer() const;
wxMacDataBrowserListCtrlControl* GetListPeer() const;
// these functions are only used for virtual list view controls, i.e. the
// ones with wxLC_VIRTUAL style

View File

@@ -20,6 +20,8 @@ class WXDLLIMPEXP_FWD_CORE wxFrame;
// Menu
// ----------------------------------------------------------------------------
class WXDLLIMPEXP_FWD_CORE wxMenuImpl ;
class WXDLLIMPEXP_CORE wxMenu : public wxMenuBase
{
public:
@@ -37,34 +39,40 @@ public:
virtual void SetTitle(const wxString& title);
// MSW-specific
bool ProcessCommand(wxCommandEvent& event);
// semi-private accessors
// get the window which contains this menu
wxWindow *GetWindow() const;
// get the menu handle
WXHMENU GetHMenu() const ;
// implementation only from now on
// -------------------------------
int MacGetIndexFromId( int id ) ;
int MacGetIndexFromItem( wxMenuItem *pItem ) ;
void MacEnableMenu( bool bDoEnable ) ;
// MacOS needs to know about submenus somewhere within this menu
// before it can be displayed , also hide special menu items like preferences
// that are handled by the OS
void MacBeforeDisplay( bool isSubMenu ) ;
// undo all changes from the MacBeforeDisplay call
void MacAfterDisplay( bool isSubMenu ) ;
// semi-private accessors
// get the window which contains this menu
wxWindow *GetWindow() const;
// get the menu handle
WXHMENU GetHMenu() const { return m_hMenu; }
short MacGetMenuId() { return m_macMenuId ; }
wxInt32 MacHandleCommandProcess( wxMenuItem* item, int id, wxWindow* targetWindow = NULL );
wxInt32 MacHandleCommandUpdateStatus( wxMenuItem* item, int id, wxWindow* targetWindow = NULL);
bool HandleCommandUpdateStatus( wxMenuItem* menuItem, wxWindow* senderWindow = NULL);
bool HandleCommandProcess( wxMenuItem* menuItem, wxWindow* senderWindow = NULL);
void HandleMenuItemHighlighted( wxMenuItem* menuItem );
void HandleMenuOpened();
void HandleMenuClosed();
wxMenuImpl* GetPeer() { return m_peer; }
// make sure we can veto
void SetAllowRearrange( bool allow );
bool AllowRearrange() const { return m_allowRearrange; }
// if a menu is used purely for internal implementation reasons (eg wxChoice)
// we don't want native menu events being triggered
void SetNoEventsMode( bool noEvents );
bool GetNoEventsMode() const { return m_noEventsMode; }
protected:
// hide special menu items like exit, preferences etc
// that are expected in the app menu
void DoRearrange() ;
bool DoHandleMenuEvent( wxEvent& evt );
virtual wxMenuItem* DoAppend(wxMenuItem *item);
virtual wxMenuItem* DoInsert(size_t pos, wxMenuItem *item);
virtual wxMenuItem* DoRemove(wxMenuItem *item);
@@ -82,19 +90,24 @@ private:
// if TRUE, insert a breal before appending the next item
bool m_doBreak;
// in this menu rearranging of menu items (esp hiding) is allowed
bool m_allowRearrange;
// don't trigger native events
bool m_noEventsMode;
// the position of the first item in the current radio group or -1
int m_startRadioGroup;
// the menu handle of this menu
WXHMENU m_hMenu;
short m_macMenuId;
static short s_macNextMenuId ;
wxMenuImpl* m_peer;
DECLARE_DYNAMIC_CLASS(wxMenu)
};
#if wxOSX_USE_COCOA_OR_CARBON
// the iphone only has popup-menus
// ----------------------------------------------------------------------------
// Menu Bar (a la Windows)
// ----------------------------------------------------------------------------
@@ -132,7 +145,6 @@ public:
}
// implementation from now on
WXHMENU Create();
int FindMenu(const wxString& title);
void Detach();
@@ -173,10 +185,14 @@ protected:
static WXHMENU s_macWindowMenuHandle ;
private:
static wxMenuBar* s_macInstalledMenuBar ;
static wxMenuBar* s_macCommonMenuBar ;
static wxMenuBar* s_macInstalledMenuBar ;
static wxMenuBar* s_macCommonMenuBar ;
wxMenu* m_rootMenu;
DECLARE_DYNAMIC_CLASS(wxMenuBar)
};
#endif
#endif // _WX_MENU_H_

View File

@@ -22,6 +22,9 @@
// ----------------------------------------------------------------------------
// wxMenuItem: an item in the menu, optionally implements owner-drawn behaviour
// ----------------------------------------------------------------------------
class WXDLLIMPEXP_FWD_CORE wxMenuItemImpl ;
class WXDLLIMPEXP_CORE wxMenuItem: public wxMenuItemBase
{
public:
@@ -53,9 +56,8 @@ public:
void SetRadioGroupStart(int start);
void SetRadioGroupEnd(int end);
wxMenuItemImpl* GetPeer() { return m_peer; }
private:
void DoUpdateItemBitmap( WXHMENU menu, wxUint16 index) ;
void UncheckRadio() ;
// the positions of the first and last items of the radio group this item
@@ -73,6 +75,8 @@ private:
wxBitmap m_bitmap; // Bitmap for menuitem, if any
void* m_menu ; // the appropriate menu , may also be a system menu
wxMenuItemImpl* m_peer;
DECLARE_DYNAMIC_CLASS(wxMenuItem)
};

View File

@@ -97,7 +97,13 @@ public:
wxNonOwnedWindowImpl* GetNonOwnedPeer() const { return m_nowpeer; }
// osx specific event handling common for all osx-ports
virtual void HandleActivated( double timestampsec, bool didActivate );
virtual void HandleResized( double timestampsec );
virtual void HandleMoved( double timestampsec );
virtual void HandleResizing( double timestampsec, wxRect* rect );
protected:
// common part of all ctors
void Init();

View File

@@ -117,7 +117,9 @@ public:
// base class virtuals
// -------------------
virtual void Command(wxCommandEvent& event);
virtual wxInt32 MacControlHit(WXEVENTHANDLERREF handler, WXEVENTREF event);
// osx specific event handling common for all osx-ports
virtual bool HandleClicked( double timestampsec );
protected:
virtual wxNotebookPage *DoRemovePage(size_t page) ;

View File

@@ -25,6 +25,8 @@ 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"
@@ -289,8 +291,6 @@ public :
void Init();
virtual void Destroy();
void SetReferenceInNativeControl();
static wxMacControl* GetReferenceFromNativeControl(ControlRef control);
@@ -313,6 +313,7 @@ public :
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 );
@@ -325,6 +326,28 @@ public :
void RemoveFromParent();
void Embed( wxWidgetImpl *parent );
void SetDefaultButton( bool isDefault );
void PerformClick();
void SetLabel( const wxString& title, wxFontEncoding encoding );
wxInt32 GetValue() const;
void SetValue( wxInt32 v );
void SetBitmap( const wxBitmap& bitmap );
void SetupTabs( const wxNotebook &notebook );
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,14 +363,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 void SetValueAndRange( SInt32 value , SInt32 minimum , SInt32 maximum );
virtual void SetRange( SInt32 minimum , SInt32 maximum );
@@ -404,7 +421,6 @@ 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();
@@ -414,13 +430,11 @@ public :
virtual void SetBackgroundColour( const wxColour& col );
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,9 +443,7 @@ 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 );
@@ -614,38 +626,23 @@ 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 :
wxMacDataItem();
virtual ~wxMacDataItem();
@@ -664,24 +661,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 +677,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,6 +724,18 @@ public :
void GetSelectionAnchor( wxMacDataItemPtr* first , wxMacDataItemPtr* last) const;
// add and remove
virtual void MacDelete( unsigned int n );
virtual void MacInsert( unsigned int n, wxMacDataItem* item);
virtual void MacClear();
// accessing content
virtual unsigned int MacGetCount() const;
public :
// item aware methods, to be used in subclasses
virtual Boolean CompareItems(const wxMacDataItem* itemOneID,
@@ -763,35 +758,6 @@ public :
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 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;
// display
virtual void MacScrollTo( unsigned int n );
// accessing content
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;
// client data
virtual wxClientDataType GetClientDataType() const;
@@ -854,28 +820,112 @@ 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 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 void UpdateLine( unsigned int n, wxListWidgetColumn* col = NULL );
virtual void UpdateLineToEnd( unsigned int n) ;
virtual void ItemNotification(
const wxMacDataItem* itemID,
DataBrowserItemNotification message,
DataBrowserItemDataRef itemData);
// pointing back
// wxWindow * GetPeer() const;
wxMacDataBrowserColumn* GetColumnFromProperty( DataBrowserPropertyID );
private:
wxArrayMacDataBrowserColumns m_columns;
int m_nextColumnId ;
DECLARE_DYNAMIC_CLASS_NO_COPY(wxMacDataBrowserListControl)
};

View File

@@ -15,10 +15,19 @@
#include "wx/osx/private.h"
// common interface for all implementations
class wxMacTextControl : public wxMacControl
class wxMacTextControl :
#if wxOSX_USE_CARBON
public wxMacControl
#else
public wxWidgetCocoaImpl
#endif
{
public :
#if wxOSX_USE_CARBON
wxMacTextControl( wxTextCtrl *peer ) ;
#else
wxMacTextControl::wxMacTextControl(wxTextCtrl* peer, WXWidget w) ;
#endif
virtual ~wxMacTextControl() ;
virtual bool CanFocus() const { return true; }
@@ -61,6 +70,7 @@ public :
virtual void SetFont( const wxFont & font , const wxColour& foreground , long windowStyle );
};
#if wxOSX_USE_CARBON
class wxMacUnicodeTextControl : public wxMacTextControl
{
public :
@@ -95,5 +105,6 @@ protected :
public :
ControlEditTextSelectionRec m_selection ;
};
#endif
#endif // _WX_MAC_PRIVATE_MACTEXT_H_

View File

@@ -41,12 +41,14 @@ public:
// implementation
virtual wxInt32 MacControlHit( WXEVENTHANDLERREF handler , WXEVENTREF event ) ;
void Command(wxCommandEvent& event);
wxRadioButton *AddInCycle(wxRadioButton *cycle);
void RemoveFromCycle();
inline wxRadioButton *NextInCycle() {return m_cycle;}
// osx specific event handling common for all osx-ports
virtual bool HandleClicked( double timestampsec );
protected:
wxRadioButton *m_cycle;

View File

@@ -48,12 +48,12 @@ public:
// implementation only from now on
void Command(wxCommandEvent& event);
#if wxOSX_USE_CARBON
virtual void MacHandleControlClick( WXWidget control ,
wxInt16 controlpart ,
bool mouseStillDown ) ;
virtual wxInt32 MacControlHit( WXEVENTHANDLERREF handler ,
WXEVENTREF mevent ) ;
#endif
virtual bool HandleClicked( double timestampsec );
protected:
virtual wxSize DoGetBestSize() const;

View File

@@ -75,7 +75,9 @@ public:
void SetTick(int tickPos) ;
void Command(wxCommandEvent& event);
virtual wxInt32 MacControlHit(WXEVENTHANDLERREF handler, WXEVENTREF event);
// osx specific event handling common for all osx-ports
virtual bool HandleClicked( double timestampsec );
void MacHandleControlClick(WXWidget control, wxInt16 controlpart, bool mouseStillDown);
protected:

View File

@@ -52,21 +52,23 @@ public:
// accessors
virtual int GetMin() const;
virtual int GetMax() const;
virtual int GetValue() const;
virtual void SetValue(int val);
virtual void SetRange(int minVal, int maxVal);
virtual int GetValue() const ;
virtual void SetValue(int val);
// implementation
#if wxOSX_USE_CARBON
virtual void MacHandleControlClick( WXWidget control , wxInt16 controlpart , bool mouseStillDown ) ;
virtual wxInt32 MacControlHit( WXEVENTHANDLERREF handler , WXEVENTREF event ) ;
#endif
// osx specific event handling common for all osx-ports
virtual bool HandleClicked( double timestampsec );
protected:
void MacHandleValueChanged( int inc ) ;
virtual wxSize DoGetBestSize() const;
int m_value ;
void SendThumbTrackEvent() ;
virtual wxSize DoGetBestSize() const;
private:
DECLARE_DYNAMIC_CLASS(wxSpinButton)

View File

@@ -44,7 +44,7 @@ public:
virtual void SetValue(bool value);
virtual bool GetValue() const ;
virtual wxInt32 MacControlHit( WXEVENTHANDLERREF handler , WXEVENTREF event ) ;
virtual bool HandleClicked( double timestampsec );
virtual void Command(wxCommandEvent& event);
@@ -88,7 +88,7 @@ public:
virtual void SetValue(bool value);
virtual bool GetValue() const ;
virtual wxInt32 MacControlHit( WXEVENTHANDLERREF handler , WXEVENTREF event ) ;
virtual bool HandleClicked( double timestampsec );
virtual void Command(wxCommandEvent& event);

View File

@@ -99,7 +99,7 @@ protected:
DECLARE_EVENT_TABLE()
#if wxOSX_USE_NATIVE_TOOLBAR
bool m_macUsesNativeToolbar ;
void* m_macHIToolbarRef ;
void* m_macToolbar ;
#endif
};

View File

@@ -14,8 +14,6 @@
#include "wx/osx/private.h"
long UMAGetSystemVersion() ;
#if wxUSE_GUI
// menu manager
@@ -24,8 +22,6 @@ MenuRef UMANewMenu( SInt16 id , const wxString& title , wxFontEncoding e
void UMASetMenuTitle( MenuRef menu , const wxString& title , wxFontEncoding encoding) ;
void UMAEnableMenuItem( MenuRef inMenu , MenuItemIndex item , bool enable ) ;
void UMAAppendSubMenuItem( MenuRef menu , const wxString& title , wxFontEncoding encoding , SInt16 submenuid ) ;
void UMAInsertSubMenuItem( MenuRef menu , const wxString& title , wxFontEncoding encoding , MenuItemIndex item , SInt16 submenuid ) ;
void UMAAppendMenuItem( MenuRef menu , const wxString& title , wxFontEncoding encoding , wxAcceleratorEntry *entry = NULL ) ;
void UMAInsertMenuItem( MenuRef menu , const wxString& title , wxFontEncoding encoding , MenuItemIndex item , wxAcceleratorEntry *entry = NULL ) ;
void UMASetMenuItemShortcut( MenuRef menu , MenuItemIndex item , wxAcceleratorEntry *entry ) ;

View File

@@ -84,7 +84,9 @@ public:
const;
protected:
virtual void DoEnable( bool enable );
#if wxUSE_MENUS
virtual bool DoPopupMenu( wxMenu *menu, int x, int y );
#endif
virtual void DoFreeze();
virtual void DoThaw();
@@ -247,6 +249,9 @@ public:
void * MacGetCGContextRef() { return m_cgContextRef ; }
void MacSetCGContextRef(void * cg) { m_cgContextRef = cg ; }
// osx specific event handling common for all osx-ports
virtual bool HandleClicked( double timestampsec );
protected:
// For controls like radio buttons which are genuinely composite
wxList m_subControls;

View File

@@ -84,44 +84,8 @@
#define wxUSE_TASKBARICON 0
#endif
/*
#if wxUSE_POPUPWIN
#undef wxUSE_POPUPWIN
#define wxUSE_POPUPWIN 0
#endif
#if wxUSE_COMBOBOX
#undef wxUSE_COMBOBOX
#define wxUSE_COMBOBOX 0
#endif
#if wxUSE_MENUS
#undef wxUSE_MENUS
#define wxUSE_MENUS 0
#endif
#if wxUSE_CALENDARCTRL
#undef wxUSE_CALENDARCTRL
#define wxUSE_CALENDARCTRL 0
#endif
#if wxUSE_WXHTML_HELP
#undef wxUSE_WXHTML_HELP
#define wxUSE_WXHTML_HELP 0
#endif
#if wxUSE_DOC_VIEW_ARCHITECTURE
#undef wxUSE_DOC_VIEW_ARCHITECTURE
#define wxUSE_DOC_VIEW_ARCHITECTURE 0
#endif
#if wxUSE_PRINTING_ARCHITECTURE
#undef wxUSE_PRINTING_ARCHITECTURE
#define wxUSE_PRINTING_ARCHITECTURE 0
#endif
*/
#define wxUSE_WXHTML_HELP 0
#endif
/* _WX_MAC_CHKCONF_H_ */

View File

@@ -24,9 +24,72 @@
extern wxRect wxFromNSRect( NSView* parent, const NSRect& rect );
extern NSPoint wxToNSPoint( NSView* parent, const wxPoint& p );
extern wxPoint wxFromNSPoint( NSView* parent, const NSPoint& p );
// used for many wxControls
@interface wxNSButton : NSButton
{
wxWidgetImpl* impl;
}
- (void)setImplementation: (wxWidgetImpl *) theImplementation;
- (wxWidgetImpl*) implementation;
- (BOOL) isFlipped;
- (void) clickedAction: (id) sender;
@end
@interface wxNSBox : NSBox
{
wxWidgetImpl* impl;
}
- (void)setImplementation: (wxWidgetImpl *) theImplementation;
- (wxWidgetImpl*) implementation;
- (BOOL) isFlipped;
@end
@interface wxNSTextField : NSTextField
{
wxWidgetImpl* impl;
}
- (void)setImplementation: (wxWidgetImpl *) theImplementation;
- (wxWidgetImpl*) implementation;
- (BOOL) isFlipped;
@end
NSRect WXDLLIMPEXP_CORE wxOSXGetFrameForControl( wxWindowMac* window , const wxPoint& pos , const wxSize &size ,
bool adjustForOrigin = true );
#endif // __OBJC__
//
// shared between Cocoa and Carbon
//
// bring in themeing types without pulling in the headers
typedef SInt16 ThemeBrush;
long UMAGetSystemVersion() ;
CGColorRef wxMacCreateCGColorFromHITheme( ThemeBrush brush ) ;
OSStatus WXDLLIMPEXP_CORE wxMacDrawCGImage(
CGContextRef inContext,
const CGRect * inBounds,
CGImageRef inImage) ;
WX_NSImage wxOSXCreateNSImageFromCGImage( CGImageRef image );
WXDLLIMPEXP_BASE void wxMacStringToPascal( const wxString&from , StringPtr to );
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 );
//
//
//
#if wxUSE_GUI
class WXDLLIMPEXP_CORE wxWidgetCocoaImpl : public wxWidgetImpl
@@ -39,7 +102,8 @@ public :
void Init();
virtual bool IsVisible() const ;
virtual void SetVisibility(bool);
virtual void Raise();
virtual void Lower();
@@ -48,10 +112,13 @@ public :
virtual WXWidget GetWXWidget() const { return m_osxView; }
virtual void SetBackgroundColour(const wxColour&);
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 );
virtual void SetNeedsDisplay( const wxRect* where = NULL );
virtual bool GetNeedsDisplay() const;
@@ -63,6 +130,24 @@ public :
void RemoveFromParent();
void Embed( wxWidgetImpl *parent );
void SetDefaultButton( bool isDefault );
void PerformClick();
void SetLabel(const wxString& title, wxFontEncoding encoding);
wxInt32 GetValue() const;
void SetValue( wxInt32 v );
void SetBitmap( const wxBitmap& bitmap );
void SetupTabs( const wxNotebook &notebook );
void GetBestRect( wxRect *r ) const;
bool IsEnabled() const;
void Enable( bool enable );
bool ButtonClickDidStateChange() { return true ;}
void SetMinimum( wxInt32 v );
void SetMaximum( wxInt32 v );
void PulseGauge();
void SetScrollThumb( wxInt32 value, wxInt32 thumbSize );
protected:
WXWidget m_osxView;
DECLARE_DYNAMIC_CLASS_NO_COPY(wxWidgetCocoaImpl)
@@ -142,6 +227,27 @@ typedef struct tagClassicCursor
wxInt16 hotspot[2];
}ClassicCursor;
const short kwxCursorBullseye = 0;
const short kwxCursorBlank = 1;
const short kwxCursorPencil = 2;
const short kwxCursorMagnifier = 3;
const short kwxCursorNoEntry = 4;
const short kwxCursorPaintBrush = 5;
const short kwxCursorPointRight = 6;
const short kwxCursorPointLeft = 7;
const short kwxCursorQuestionArrow = 8;
const short kwxCursorRightArrow = 9;
const short kwxCursorSizeNS = 10;
const short kwxCursorSize = 11;
const short kwxCursorSizeNESW = 12;
const short kwxCursorSizeNWSE = 13;
const short kwxCursorRoller = 14;
const short kwxCursorLast = kwxCursorRoller;
// exposing our fallback cursor map
extern ClassicCursor gMacCursors[];
#endif
#endif

View File

@@ -0,0 +1,174 @@
/////////////////////////////////////////////////////////////////////////////
// Name: wx/osx/core/mimetype.h
// Purpose: classes and functions to manage MIME types
// Author: Vadim Zeitlin
// Modified by:
// Created: 23.09.98
// RCS-ID: $Id: mimetype.h 54448 2008-07-01 09:28:08Z RR $
// Copyright: (c) 1998 Vadim Zeitlin <zeitlin@dptmaths.ens-cachan.fr>
// Licence: wxWindows licence (part of wxExtra library)
/////////////////////////////////////////////////////////////////////////////
#ifndef _MIMETYPE_IMPL_H
#define _MIMETYPE_IMPL_H
#include "wx/mimetype.h"
#if wxUSE_MIMETYPE
class wxMimeTypeCommands;
WX_DEFINE_ARRAY_PTR(wxMimeTypeCommands *, wxMimeCommandsArray);
// this is the real wxMimeTypesManager for Unix
class WXDLLIMPEXP_BASE wxMimeTypesManagerImpl
{
public:
// ctor and dtor
wxMimeTypesManagerImpl();
virtual ~wxMimeTypesManagerImpl();
// load all data into memory - done when it is needed for the first time
void Initialize(int mailcapStyles = wxMAILCAP_ALL,
const wxString& extraDir = wxEmptyString);
// and delete the data here
void ClearData();
// implement containing class functions
wxFileType *GetFileTypeFromExtension(const wxString& ext);
wxFileType *GetFileTypeFromMimeType(const wxString& mimeType);
size_t EnumAllFileTypes(wxArrayString& mimetypes);
void AddFallback(const wxFileTypeInfo& filetype);
// add information about the given mimetype
void AddMimeTypeInfo(const wxString& mimetype,
const wxString& extensions,
const wxString& description);
void AddMailcapInfo(const wxString& strType,
const wxString& strOpenCmd,
const wxString& strPrintCmd,
const wxString& strTest,
const wxString& strDesc);
// add a new record to the user .mailcap/.mime.types files
wxFileType *Associate(const wxFileTypeInfo& ftInfo);
// remove association
bool Unassociate(wxFileType *ft);
// accessors
// get the string containing space separated extensions for the given
// file type
wxString GetExtension(size_t index) { return m_aExtensions[index]; }
protected:
void InitIfNeeded();
wxArrayString m_aTypes, // MIME types
m_aDescriptions, // descriptions (just some text)
m_aExtensions, // space separated list of extensions
m_aIcons; // Icon filenames
// verb=command pairs for this file type
wxMimeCommandsArray m_aEntries;
// are we initialized?
bool m_initialized;
wxString GetCommand(const wxString &verb, size_t nIndex) const;
// Read XDG *.desktop file
void LoadXDGApp(const wxString& filename);
// Scan XDG directory
void LoadXDGAppsFilesFromDir(const wxString& dirname);
// Load XDG globs files
void LoadXDGGlobs(const wxString& filename);
// functions used to do associations
virtual int AddToMimeData(const wxString& strType,
const wxString& strIcon,
wxMimeTypeCommands *entry,
const wxArrayString& strExtensions,
const wxString& strDesc,
bool replaceExisting = TRUE);
virtual bool DoAssociation(const wxString& strType,
const wxString& strIcon,
wxMimeTypeCommands *entry,
const wxArrayString& strExtensions,
const wxString& strDesc);
// give it access to m_aXXX variables
friend class WXDLLIMPEXP_FWD_BASE wxFileTypeImpl;
};
class WXDLLIMPEXP_BASE wxFileTypeImpl
{
public:
// initialization functions
// this is used to construct a list of mimetypes which match;
// if built with GetFileTypeFromMimetype index 0 has the exact match and
// index 1 the type / * match
// if built with GetFileTypeFromExtension, index 0 has the mimetype for
// the first extension found, index 1 for the second and so on
void Init(wxMimeTypesManagerImpl *manager, size_t index)
{ m_manager = manager; m_index.Add(index); }
// accessors
bool GetExtensions(wxArrayString& extensions);
bool GetMimeType(wxString *mimeType) const
{ *mimeType = m_manager->m_aTypes[m_index[0]]; return TRUE; }
bool GetMimeTypes(wxArrayString& mimeTypes) const;
bool GetIcon(wxIconLocation *iconLoc) const;
bool GetDescription(wxString *desc) const
{ *desc = m_manager->m_aDescriptions[m_index[0]]; return TRUE; }
bool GetOpenCommand(wxString *openCmd,
const wxFileType::MessageParameters& params) const
{
*openCmd = GetExpandedCommand(wxT("open"), params);
return (! openCmd -> IsEmpty() );
}
bool GetPrintCommand(wxString *printCmd,
const wxFileType::MessageParameters& params) const
{
*printCmd = GetExpandedCommand(wxT("print"), params);
return (! printCmd -> IsEmpty() );
}
// return the number of commands defined for this file type, 0 if none
size_t GetAllCommands(wxArrayString *verbs, wxArrayString *commands,
const wxFileType::MessageParameters& params) const;
// remove the record for this file type
// probably a mistake to come here, use wxMimeTypesManager.Unassociate (ft) instead
bool Unassociate(wxFileType *ft)
{
return m_manager->Unassociate(ft);
}
// set an arbitrary command, ask confirmation if it already exists and
// overwriteprompt is TRUE
bool SetCommand(const wxString& cmd, const wxString& verb, bool overwriteprompt = TRUE);
bool SetDefaultIcon(const wxString& strIcon = wxEmptyString, int index = 0);
private:
wxString
GetExpandedCommand(const wxString & verb,
const wxFileType::MessageParameters& params) const;
wxMimeTypesManagerImpl *m_manager;
wxArrayInt m_index; // in the wxMimeTypesManagerImpl arrays
};
#endif // wxUSE_MIMETYPE
#endif // _MIMETYPE_IMPL_H

View File

@@ -21,6 +21,10 @@
#include "wx/osx/core/cfstring.h"
#include "wx/osx/core/cfdataref.h"
#if wxOSX_USE_COCOA_OR_CARBON
WXDLLIMPEXP_BASE long UMAGetSystemVersion() ;
#endif
#if wxUSE_GUI
#if wxOSX_USE_IPHONE
@@ -79,6 +83,79 @@ class wxWindowMac;
extern wxWindow* g_MacLastWindow;
class wxNonOwnedWindow;
// temporary typedef so that no additional casts are necessary within carbon code at the moment
class wxMacControl;
class wxWidgetImpl;
class wxNotebook;
#if wxOSX_USE_CARBON
typedef wxMacControl wxWidgetImplType;
#else
typedef wxWidgetImpl wxWidgetImplType;
#endif
class wxMenuItemImpl : public wxObject
{
public :
wxMenuItemImpl( wxMenuItem* peer ) : m_peer(peer)
{
}
virtual ~wxMenuItemImpl() ;
virtual void SetBitmap( const wxBitmap& bitmap ) = 0;
virtual void Enable( bool enable ) = 0;
virtual void Check( bool check ) = 0;
virtual void SetLabel( const wxString& text, wxAcceleratorEntry *entry ) = 0;
virtual void Hide( bool hide = true ) = 0;
virtual void * GetHMenuItem() = 0;
wxMenuItem* GetWXPeer() { return m_peer ; }
static wxMenuItemImpl* Create( wxMenuItem* peer, wxMenu *pParentMenu,
int id,
const wxString& text,
wxAcceleratorEntry *entry,
const wxString& strHelp,
wxItemKind kind,
wxMenu *pSubMenu );
protected :
wxMenuItem* m_peer;
DECLARE_ABSTRACT_CLASS(wxMenuItemImpl);
} ;
class wxMenuImpl : public wxObject
{
public :
wxMenuImpl( wxMenu* peer ) : m_peer(peer)
{
}
virtual ~wxMenuImpl() ;
virtual void InsertOrAppend(wxMenuItem *pItem, size_t pos) = 0;
virtual void Remove( wxMenuItem *pItem ) = 0;
virtual void MakeRoot() = 0;
virtual void SetTitle( const wxString& text ) = 0;
virtual WXHMENU GetHMenu() = 0;
wxMenu* GetWXPeer() { return m_peer ; }
static wxMenuImpl* Create( wxMenu* peer, const wxString& title );
static wxMenuImpl* CreateRootMenu( wxMenu* peer );
protected :
wxMenu* m_peer;
DECLARE_ABSTRACT_CLASS(wxMenuItemImpl);
} ;
class WXDLLIMPEXP_CORE wxWidgetImpl : public wxObject
{
public :
@@ -88,8 +165,6 @@ public :
void Init();
virtual void Destroy();
bool IsRootControl() const { return m_isRootControl; }
wxWindowMac* GetWXPeer() const { return m_wxPeer; }
@@ -117,6 +192,7 @@ public :
virtual void Move(int x, int y, int width, int height) = 0;
virtual void GetPosition( int &x, int &y ) const = 0;
virtual void GetSize( int &width, int &height ) const = 0;
virtual void SetControlSize( wxWindowVariant variant ) = 0;
virtual void SetNeedsDisplay( const wxRect* where = NULL ) = 0;
virtual bool GetNeedsDisplay() const = 0;
@@ -131,12 +207,201 @@ public :
virtual void RemoveFromParent() = 0;
virtual void Embed( wxWidgetImpl *parent ) = 0;
virtual void SetDefaultButton( bool isDefault ) = 0;
virtual void PerformClick() = 0;
virtual void SetLabel( const wxString& title, wxFontEncoding encoding ) = 0;
virtual wxInt32 GetValue() const = 0;
virtual void SetValue( wxInt32 v ) = 0;
virtual void SetBitmap( const wxBitmap& bitmap ) = 0;
virtual void SetupTabs( const wxNotebook &notebook ) =0;
virtual void GetBestRect( wxRect *r ) const = 0;
virtual bool IsEnabled() const = 0;
virtual void Enable( bool enable ) = 0;
virtual void SetMinimum( wxInt32 v ) = 0;
virtual void SetMaximum( wxInt32 v ) = 0;
virtual void PulseGauge() = 0;
virtual void SetScrollThumb( wxInt32 value, wxInt32 thumbSize ) = 0;
// is the clicked event sent AFTER the state already changed, so no additional
// state changing logic is required from the outside
virtual bool ButtonClickDidStateChange() = 0;
// static creation methods, must be implemented by all toolkits
static wxWidgetImpl* CreateUserPane( wxWindowMac* wxpeer, const wxPoint& pos, const wxSize& size,
long style, long extraStyle, const wxString& name) ;
static wxWidgetImpl* CreateContentView( wxNonOwnedWindow* now ) ;
static wxWidgetImplType* CreateUserPane( wxWindowMac* wxpeer,
wxWindowMac* parent,
wxWindowID id,
const wxPoint& pos,
const wxSize& size,
long style,
long extraStyle) ;
static wxWidgetImplType* CreateContentView( wxNonOwnedWindow* now ) ;
static wxWidgetImplType* CreateButton( wxWindowMac* wxpeer,
wxWindowMac* parent,
wxWindowID id,
const wxString& label,
const wxPoint& pos,
const wxSize& size,
long style,
long extraStyle) ;
static wxWidgetImplType* CreateDisclosureTriangle( wxWindowMac* wxpeer,
wxWindowMac* parent,
wxWindowID id,
const wxString& label,
const wxPoint& pos,
const wxSize& size,
long style,
long extraStyle) ;
static wxWidgetImplType* CreateStaticLine( wxWindowMac* wxpeer,
wxWindowMac* parent,
wxWindowID id,
const wxPoint& pos,
const wxSize& size,
long style,
long extraStyle) ;
static wxWidgetImplType* CreateGroupBox( wxWindowMac* wxpeer,
wxWindowMac* parent,
wxWindowID id,
const wxString& label,
const wxPoint& pos,
const wxSize& size,
long style,
long extraStyle) ;
static wxWidgetImplType* CreateStaticText( wxWindowMac* wxpeer,
wxWindowMac* parent,
wxWindowID id,
const wxString& label,
const wxPoint& pos,
const wxSize& size,
long style,
long extraStyle) ;
static wxWidgetImplType* CreateTextControl( wxTextCtrl* wxpeer,
wxWindowMac* parent,
wxWindowID id,
const wxString& content,
const wxPoint& pos,
const wxSize& size,
long style,
long extraStyle) ;
static wxWidgetImplType* CreateCheckBox( wxWindowMac* wxpeer,
wxWindowMac* parent,
wxWindowID id,
const wxString& label,
const wxPoint& pos,
const wxSize& size,
long style,
long extraStyle);
static wxWidgetImplType* CreateRadioButton( wxWindowMac* wxpeer,
wxWindowMac* parent,
wxWindowID id,
const wxString& label,
const wxPoint& pos,
const wxSize& size,
long style,
long extraStyle);
static wxWidgetImplType* CreateToggleButton( wxWindowMac* wxpeer,
wxWindowMac* parent,
wxWindowID id,
const wxString& label,
const wxPoint& pos,
const wxSize& size,
long style,
long extraStyle);
static wxWidgetImplType* CreateBitmapToggleButton( wxWindowMac* wxpeer,
wxWindowMac* parent,
wxWindowID id,
const wxBitmap& bitmap,
const wxPoint& pos,
const wxSize& size,
long style,
long extraStyle);
static wxWidgetImplType* CreateBitmapButton( wxWindowMac* wxpeer,
wxWindowMac* parent,
wxWindowID id,
const wxBitmap& bitmap,
const wxPoint& pos,
const wxSize& size,
long style,
long extraStyle);
static wxWidgetImplType* CreateTabView( wxWindowMac* wxpeer,
wxWindowMac* parent,
wxWindowID id,
const wxPoint& pos,
const wxSize& size,
long style,
long extraStyle);
static wxWidgetImplType* CreateGauge( wxWindowMac* wxpeer,
wxWindowMac* parent,
wxWindowID id,
wxInt32 value,
wxInt32 minimum,
wxInt32 maximum,
const wxPoint& pos,
const wxSize& size,
long style,
long extraStyle);
static wxWidgetImplType* CreateSlider( wxWindowMac* wxpeer,
wxWindowMac* parent,
wxWindowID id,
wxInt32 value,
wxInt32 minimum,
wxInt32 maximum,
const wxPoint& pos,
const wxSize& size,
long style,
long extraStyle);
static wxWidgetImplType* CreateSpinButton( wxWindowMac* wxpeer,
wxWindowMac* parent,
wxWindowID id,
wxInt32 value,
wxInt32 minimum,
wxInt32 maximum,
const wxPoint& pos,
const wxSize& size,
long style,
long extraStyle);
static wxWidgetImplType* CreateScrollBar( wxWindowMac* wxpeer,
wxWindowMac* parent,
wxWindowID id,
const wxPoint& pos,
const wxSize& size,
long style,
long extraStyle);
static wxWidgetImplType* CreateChoice( wxWindowMac* wxpeer,
wxWindowMac* parent,
wxWindowID id,
wxMenu* menu,
const wxPoint& pos,
const wxSize& size,
long style,
long extraStyle);
static wxWidgetImplType* CreateListBox( wxWindowMac* wxpeer,
wxWindowMac* parent,
wxWindowID id,
const wxPoint& pos,
const wxSize& size,
long style,
long extraStyle);
// converts from Toplevel-Content relative to local
static void Convert( wxPoint *pt , wxWidgetImpl *from , wxWidgetImpl *to );
@@ -148,6 +413,73 @@ protected :
DECLARE_ABSTRACT_CLASS(wxWidgetImpl)
};
//
// the interface to be implemented eg by a listbox
//
class WXDLLIMPEXP_CORE wxMacDataItem ;
class WXDLLIMPEXP_CORE wxListWidgetColumn
{
public :
virtual ~wxListWidgetColumn() {}
} ;
class WXDLLIMPEXP_CORE wxListWidgetCellValue
{
public :
wxListWidgetCellValue() {}
virtual ~wxListWidgetCellValue() {}
virtual void Set( CFStringRef value ) = 0;
virtual void Set( const wxString& value ) = 0;
virtual void Set( int value ) = 0;
virtual int GetIntValue() const = 0;
virtual wxString GetStringValue() const = 0;
} ;
class WXDLLIMPEXP_CORE wxListWidgetImpl
{
public:
wxListWidgetImpl() {}
virtual ~wxListWidgetImpl() { }
virtual wxListWidgetColumn* InsertTextColumn( unsigned pos, const wxString& title, bool editable = false,
wxAlignment just = wxALIGN_LEFT , int defaultWidth = -1) = 0 ;
virtual wxListWidgetColumn* InsertCheckColumn( unsigned pos , const wxString& title, bool editable = false,
wxAlignment just = wxALIGN_LEFT , int defaultWidth = -1) = 0 ;
// add and remove
// TODO will be replaced
virtual void ListDelete( unsigned int n ) = 0;
virtual void ListInsert( unsigned int n ) = 0;
virtual void ListClear() = 0;
// selecting
virtual void ListDeselectAll() = 0;
virtual void ListSetSelection( unsigned int n, bool select, bool multi ) = 0;
virtual int ListGetSelection() const = 0;
virtual int ListGetSelections( wxArrayInt& aSelections ) const = 0;
virtual bool ListIsSelected( unsigned int n ) const = 0;
// display
virtual void ListScrollTo( unsigned int n ) = 0;
virtual void UpdateLine( unsigned int n, wxListWidgetColumn* col = NULL ) = 0;
virtual void UpdateLineToEnd( unsigned int n) = 0;
// accessing content
virtual unsigned int ListGetCount() const = 0;
};
//
// toplevel window implementation class
//
class wxNonOwnedWindowImpl : public wxObject
{
public :
@@ -248,6 +580,12 @@ public :
virtual void WindowToScreen( int *x, int *y ) = 0;
wxNonOwnedWindow* GetWXPeer() { return m_wxPeer; }
// static creation methods, must be implemented by all toolkits
static wxNonOwnedWindowImpl* CreateNonOwnedWindow( wxNonOwnedWindow* wxpeer, wxWindow* parent, const wxPoint& pos, const wxSize& size,
long style, long extraStyle, const wxString& name ) ;
protected :
wxNonOwnedWindow* m_wxPeer;
DECLARE_ABSTRACT_CLASS(wxNonOwnedWindowImpl)

View File

@@ -67,6 +67,84 @@
#define wxUSE_TASKBARICON 0
#endif
#define wxUSE_BUTTON 1
#define wxUSE_CARET 1
#define wxUSE_CHOICE 1
#define wxUSE_SCROLLBAR 1
#define wxUSE_STATUSBAR 1
#define wxUSE_NATIVE_STATUSBAR 0
#define wxUSE_TEXTCTRL 1
#define wxUSE_ABOUTDLG 1
#define wxUSE_STATTEXT 1
#define wxUSE_STATLINE 1
#define wxUSE_COLLPANE 1
#define wxUSE_STATBMP 1
#define wxUSE_STATBOX 1
#define wxUSE_CHECKBOX 1
#define wxUSE_RADIOBTN 1
#define wxUSE_RADIOBOX 1
#define wxUSE_TOGGLEBTN 1
#define wxUSE_TOOLBAR 0
#define wxUSE_HTML 0
#define wxUSE_RICHTEXT 0
#define wxUSE_ANIMATIONCTRL 0
#define wxUSE_CALENDARCTRL 0
#define wxUSE_COMBOBOX 0
#define wxUSE_COMBOCTRL 0
#define wxUSE_ODCOMBOBOX 0
#define wxUSE_BITMAPCOMBOBOX 0
#define wxUSE_BMPBUTTON 0
#define wxUSE_CHECKLISTBOX 0
#define wxUSE_GAUGE 0
#define wxUSE_GRID 0
#define wxUSE_LISTBOX 0
#define wxUSE_LISTCTRL 0
#define wxUSE_NOTEBOOK 0
#define wxUSE_SLIDER 0
#define wxUSE_SPINBTN 0
#define wxUSE_SPINCTRL 0
#define wxUSE_TREECTRL 0
#define wxUSE_DATEPICKCTRL 0
#define wxUSE_DATAVIEWCTRL 0
#define wxUSE_EDITABLELISTBOX 0
#define wxUSE_FILEPICKERCTRL 0
#define wxUSE_DIRPICKERCTRL 0
#define wxUSE_FILECTRL 0
#define wxUSE_COLOURPICKERCTRL 0
#define wxUSE_FONTPICKERCTRL 0
#define wxUSE_DEBUGREPORT 0
#define wxUSE_HYPERLINKCTRL 0
#define wxUSE_STC 0
#define wxUSE_AUI 0
#define wxUSE_BUSYINFO 0
#define wxUSE_SEARCHCTRL 0
#define wxUSE_LOGWINDOW 0
#define wxUSE_LOG_DIALOG 0
#define wxUSE_LISTBOOK 0
#define wxUSE_CHOICEBOOK 0
#define wxUSE_TREEBOOK 0
#define wxUSE_TOOLBOOK 0
#define wxUSE_CHOICEDLG 0
#define wxUSE_HELP 0
#define wxUSE_PROGRESSDLG 0
#define wxUSE_FONTDLG 0
#define wxUSE_FILEDLG 0
#define wxUSE_CHOICEDLG 0
#define wxUSE_NUMBERDLG 0
#define wxUSE_TEXTDLG 0
#define wxUSE_DIRDLG 0
#define wxUSE_STARTUP_TIPS 0
#define wxUSE_WIZARDDLG 0
#define wxUSE_TOOLBAR_NATIVE 0
#define wxUSE_FINDREPLDLG 0
#define wxUSE_TAB_DIALOG 0
#define wxUSE_TASKBARICON 0
/*
#if wxUSE_POPUPWIN
#undef wxUSE_POPUPWIN

View File

@@ -1,5 +1,5 @@
#ifdef __WXMAC_CLASSIC__
#include "wx/osx/classic/mimetype.h"
#else
#include "wx/osx/carbon/mimetype.h"
#include "wx/osx/core/mimetype.h"
#endif

View File

@@ -4,6 +4,9 @@
#error "this files should only be included after platform.h was included
#endif
#ifndef _WX_PRIVATE_OSX_H_
#define _WX_PRIVATE_OSX_H_
#if wxOSX_USE_IPHONE
#include "wx/osx/iphone/private.h"
#elif wxOSX_USE_CARBON
@@ -11,3 +14,5 @@
#elif wxOSX_USE_COCOA
#include "wx/osx/cocoa/private.h"
#endif
#endif

View File

@@ -1,5 +1,6 @@
#ifdef __WXMAC_CLASSIC__
#include "wx/osx/classic/statbmp.h"
#else
#if wxOSX_USE_CARBON
#include "wx/osx/carbon/statbmp.h"
#else
#define wxGenericStaticBitmap wxStaticBitmap
#include "wx/generic/statbmpg.h"
#endif

View File

@@ -1,5 +1,5 @@
#ifdef __WXMAC_CLASSIC__
#include "wx/osx/classic/statline.h"
#if wxOSX_USE_CARBON
#include "wx/osx/carbon/statline.h"
#else
#include "wx/osx/carbon/statline.h"
#endif