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;