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:
@@ -44,21 +44,20 @@ class WXDLLIMPEXP_CORE wxApp: public wxAppBase
|
|||||||
virtual void SetPrintMode(int mode) { m_printMode = mode; }
|
virtual void SetPrintMode(int mode) { m_printMode = mode; }
|
||||||
virtual int GetPrintMode() const { return m_printMode; }
|
virtual int GetPrintMode() const { return m_printMode; }
|
||||||
|
|
||||||
|
// calling OnInit with an auto-release pool ready ...
|
||||||
|
virtual bool CallOnInit();
|
||||||
#if wxUSE_GUI
|
#if wxUSE_GUI
|
||||||
// setting up all MacOS Specific Event-Handlers etc
|
// setting up all MacOS Specific Event-Handlers etc
|
||||||
virtual bool OnInitGui();
|
virtual bool OnInitGui();
|
||||||
#endif // wxUSE_GUI
|
#endif // wxUSE_GUI
|
||||||
#if wxOSX_USE_IPHONE
|
|
||||||
virtual bool CallOnInit();
|
virtual bool ProcessIdle();
|
||||||
virtual int OnRun();
|
|
||||||
#endif
|
|
||||||
// implementation only
|
// implementation only
|
||||||
void OnIdle(wxIdleEvent& event);
|
void OnIdle(wxIdleEvent& event);
|
||||||
void OnEndSession(wxCloseEvent& event);
|
void OnEndSession(wxCloseEvent& event);
|
||||||
void OnQueryEndSession(wxCloseEvent& event);
|
void OnQueryEndSession(wxCloseEvent& event);
|
||||||
|
|
||||||
void MacDoOneEvent() ;
|
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
int m_printMode; // wxPRINT_WINDOWS, wxPRINT_POSTSCRIPT
|
int m_printMode; // wxPRINT_WINDOWS, wxPRINT_POSTSCRIPT
|
||||||
|
|
||||||
@@ -88,6 +87,8 @@ public:
|
|||||||
|
|
||||||
private:
|
private:
|
||||||
// mac specifics
|
// mac specifics
|
||||||
|
virtual bool DoInitGui();
|
||||||
|
virtual void DoCleanUp();
|
||||||
|
|
||||||
WXEVENTHANDLERREF m_macEventHandler ;
|
WXEVENTHANDLERREF m_macEventHandler ;
|
||||||
WXEVENTHANDLERCALLREF m_macCurrentEventHandlerCallRef ;
|
WXEVENTHANDLERCALLREF m_macCurrentEventHandlerCallRef ;
|
||||||
@@ -101,7 +102,6 @@ public:
|
|||||||
static wxString s_macHelpMenuTitleName ;
|
static wxString s_macHelpMenuTitleName ;
|
||||||
|
|
||||||
WXEVENTREF MacGetCurrentEvent() { return m_macCurrentEvent ; }
|
WXEVENTREF MacGetCurrentEvent() { return m_macCurrentEvent ; }
|
||||||
void MacHandleOneEvent( WXEVENTREF ev ) ;
|
|
||||||
|
|
||||||
// For embedded use. By default does nothing.
|
// For embedded use. By default does nothing.
|
||||||
virtual void MacHandleUnhandledEvent( WXEVENTREF ev );
|
virtual void MacHandleUnhandledEvent( WXEVENTREF ev );
|
||||||
|
@@ -162,6 +162,10 @@ public:
|
|||||||
// returns a CGImageRef which must released after usage with CGImageRelease
|
// returns a CGImageRef which must released after usage with CGImageRelease
|
||||||
CGImageRef CreateCGImage() const ;
|
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
|
// returns a IconRef which must be retained before and released after usage
|
||||||
IconRef GetIconRef() const;
|
IconRef GetIconRef() const;
|
||||||
// returns a IconRef which must be released after usage
|
// returns a IconRef which must be released after usage
|
||||||
|
@@ -43,12 +43,15 @@ public:
|
|||||||
const wxValidator& validator = wxDefaultValidator,
|
const wxValidator& validator = wxDefaultValidator,
|
||||||
const wxString& name = wxButtonNameStr);
|
const wxString& name = wxButtonNameStr);
|
||||||
|
|
||||||
virtual wxInt32 MacControlHit( WXEVENTHANDLERREF handler , WXEVENTREF event ) ;
|
|
||||||
static wxSize GetDefaultSize();
|
static wxSize GetDefaultSize();
|
||||||
|
|
||||||
virtual wxWindow *SetDefault();
|
virtual wxWindow *SetDefault();
|
||||||
virtual void Command(wxCommandEvent& event);
|
virtual void Command(wxCommandEvent& event);
|
||||||
|
|
||||||
|
// osx specific event handling common for all osx-ports
|
||||||
|
|
||||||
|
virtual bool HandleClicked( double timestampsec );
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
virtual wxSize DoGetBestSize() const ;
|
virtual wxSize DoGetBestSize() const ;
|
||||||
|
|
||||||
@@ -82,7 +85,9 @@ public:
|
|||||||
void SetOpen( bool open );
|
void SetOpen( bool open );
|
||||||
bool IsOpen() const;
|
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:
|
protected:
|
||||||
virtual wxSize DoGetBestSize() const ;
|
virtual wxSize DoGetBestSize() const ;
|
||||||
|
@@ -34,9 +34,11 @@ public:
|
|||||||
virtual void SetValue(bool);
|
virtual void SetValue(bool);
|
||||||
virtual bool GetValue() const;
|
virtual bool GetValue() const;
|
||||||
|
|
||||||
virtual wxInt32 MacControlHit( WXEVENTHANDLERREF handler , WXEVENTREF event ) ;
|
|
||||||
virtual void Command(wxCommandEvent& event);
|
virtual void Command(wxCommandEvent& event);
|
||||||
|
|
||||||
|
// osx specific event handling common for all osx-ports
|
||||||
|
|
||||||
|
virtual bool HandleClicked( double timestampsec );
|
||||||
protected:
|
protected:
|
||||||
void DoSet3StateValue(wxCheckBoxState val);
|
void DoSet3StateValue(wxCheckBoxState val);
|
||||||
virtual wxCheckBoxState DoGet3StateValue() const;
|
virtual wxCheckBoxState DoGet3StateValue() const;
|
||||||
|
@@ -13,15 +13,6 @@
|
|||||||
#ifndef _WX_MAC_CHECKLST_H_
|
#ifndef _WX_MAC_CHECKLST_H_
|
||||||
#define _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
|
class WXDLLIMPEXP_CORE wxCheckListBox : public wxCheckListBoxBase
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
@@ -77,9 +68,22 @@ public:
|
|||||||
bool IsChecked(unsigned int uiIndex) const;
|
bool IsChecked(unsigned int uiIndex) const;
|
||||||
void Check(unsigned int uiIndex, bool bCheck = true);
|
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:
|
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();
|
void Init();
|
||||||
|
|
||||||
private:
|
private:
|
||||||
|
@@ -28,7 +28,7 @@ class WXDLLIMPEXP_CORE wxChoice: public wxChoiceBase
|
|||||||
|
|
||||||
public:
|
public:
|
||||||
wxChoice()
|
wxChoice()
|
||||||
: m_strings(), m_datas(), m_macPopUpMenuHandle(NULL)
|
: m_strings(), m_datas()
|
||||||
{}
|
{}
|
||||||
|
|
||||||
virtual ~wxChoice() ;
|
virtual ~wxChoice() ;
|
||||||
@@ -76,7 +76,9 @@ public:
|
|||||||
virtual int FindString(const wxString& s, bool bCase = false) const;
|
virtual int FindString(const wxString& s, bool bCase = false) const;
|
||||||
virtual wxString GetString(unsigned int n) const ;
|
virtual wxString GetString(unsigned int n) const ;
|
||||||
virtual void SetString(unsigned int pos, const wxString& s);
|
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:
|
protected:
|
||||||
virtual void DoDeleteOneItem(unsigned int n);
|
virtual void DoDeleteOneItem(unsigned int n);
|
||||||
@@ -92,7 +94,7 @@ protected:
|
|||||||
|
|
||||||
wxArrayString m_strings;
|
wxArrayString m_strings;
|
||||||
wxChoiceDataArray m_datas ;
|
wxChoiceDataArray m_datas ;
|
||||||
WXHMENU m_macPopUpMenuHandle ;
|
wxMenu* m_popUpMenu ;
|
||||||
};
|
};
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
@@ -125,7 +125,9 @@ class WXDLLIMPEXP_CORE wxComboBox : public wxControl, public wxComboBoxBase
|
|||||||
|
|
||||||
virtual wxClientDataType GetClientDataType() const;
|
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
|
wxCONTROL_ITEMCONTAINER_CLIENTDATAOBJECT_RECAST
|
||||||
|
|
||||||
|
@@ -12,53 +12,19 @@
|
|||||||
#ifndef _WX_MAC_CARBON_EVTLOOP_H_
|
#ifndef _WX_MAC_CARBON_EVTLOOP_H_
|
||||||
#define _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
|
class WXDLLIMPEXP_CORE wxGUIEventLoop : public wxEventLoopManual
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
wxGUIEventLoop() { }
|
wxGUIEventLoop();
|
||||||
|
|
||||||
virtual bool Pending() const;
|
virtual bool Pending() const;
|
||||||
virtual bool Dispatch();
|
virtual bool Dispatch();
|
||||||
|
|
||||||
// implement base class pure virtual
|
// implement base class pure virtual
|
||||||
virtual void WakeUp();
|
virtual void WakeUp();
|
||||||
|
private:
|
||||||
|
double m_sleepTime;
|
||||||
};
|
};
|
||||||
|
|
||||||
#endif // auto/manual event loop
|
|
||||||
|
|
||||||
#endif // _WX_MAC_CARBON_EVTLOOP_H_
|
#endif // _WX_MAC_CARBON_EVTLOOP_H_
|
||||||
|
|
||||||
|
@@ -50,7 +50,9 @@ public:
|
|||||||
|
|
||||||
bool Create(const wxNativeFontInfo& info);
|
bool Create(const wxNativeFontInfo& info);
|
||||||
|
|
||||||
|
#if wxOSX_USE_CARBON
|
||||||
bool MacCreateFromThemeFont( wxUint16 themeFontID ) ;
|
bool MacCreateFromThemeFont( wxUint16 themeFontID ) ;
|
||||||
|
#endif
|
||||||
#if wxOSX_USE_CORE_TEXT
|
#if wxOSX_USE_CORE_TEXT
|
||||||
bool MacCreateFromUIFont( wxUint32 coreTextFontType );
|
bool MacCreateFromUIFont( wxUint32 coreTextFontType );
|
||||||
bool MacCreateFromCTFontDescriptor( const void * ctFontDescriptor, int pointSize = 0 );
|
bool MacCreateFromCTFontDescriptor( const void * ctFontDescriptor, int pointSize = 0 );
|
||||||
|
@@ -103,8 +103,13 @@ protected:
|
|||||||
virtual void DoGetClientSize(int *width, int *height) const;
|
virtual void DoGetClientSize(int *width, int *height) const;
|
||||||
virtual void DoSetClientSize(int width, int height);
|
virtual void DoSetClientSize(int width, int height);
|
||||||
|
|
||||||
|
#if wxUSE_MENUS
|
||||||
virtual void DetachMenuBar();
|
virtual void DetachMenuBar();
|
||||||
virtual void AttachMenuBar(wxMenuBar *menubar);
|
virtual void AttachMenuBar(wxMenuBar *menubar);
|
||||||
|
#endif
|
||||||
|
|
||||||
|
// osx specific event handling common for all osx-ports
|
||||||
|
virtual void HandleResized( long timestamp );
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
// the last focused child: we restore focus to it on activation
|
// the last focused child: we restore focus to it on activation
|
||||||
|
@@ -12,13 +12,17 @@
|
|||||||
#ifndef _WX_GLCANVAS_H_
|
#ifndef _WX_GLCANVAS_H_
|
||||||
#define _WX_GLCANVAS_H_
|
#define _WX_GLCANVAS_H_
|
||||||
|
|
||||||
#ifdef __DARWIN__
|
#include <OpenGL/gl.h>
|
||||||
# include <OpenGL/gl.h>
|
|
||||||
# include <AGL/agl.h>
|
// low level calls
|
||||||
#else
|
|
||||||
# include <gl.h>
|
WXDLLIMPEXP_GL WXGLContext WXGLCreateContext( WXGLPixelFormat pixelFormat, WXGLContext shareContext );
|
||||||
# include <agl.h>
|
WXDLLIMPEXP_GL void WXGLDestroyContext( WXGLContext context );
|
||||||
#endif
|
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
|
class WXDLLIMPEXP_GL wxGLContext : public wxGLContextBase
|
||||||
{
|
{
|
||||||
@@ -29,10 +33,10 @@ public:
|
|||||||
virtual bool SetCurrent(const wxGLCanvas& win) const;
|
virtual bool SetCurrent(const wxGLCanvas& win) const;
|
||||||
|
|
||||||
// Mac-specific
|
// Mac-specific
|
||||||
AGLContext GetAGLContext() const { return m_aglContext; }
|
WXGLContext GetWXGLContext() const { return m_glContext; }
|
||||||
|
|
||||||
private:
|
private:
|
||||||
AGLContext m_aglContext;
|
WXGLContext m_glContext;
|
||||||
|
|
||||||
DECLARE_NO_COPY_CLASS(wxGLContext)
|
DECLARE_NO_COPY_CLASS(wxGLContext)
|
||||||
};
|
};
|
||||||
@@ -71,7 +75,7 @@ public:
|
|||||||
static bool IsAGLMultiSampleAvailable();
|
static bool IsAGLMultiSampleAvailable();
|
||||||
|
|
||||||
// return the pixel format used by this window
|
// 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
|
// update the view port of the current context to match this window
|
||||||
void SetViewport();
|
void SetViewport();
|
||||||
@@ -119,6 +123,7 @@ public:
|
|||||||
|
|
||||||
// implementation-only from now on
|
// implementation-only from now on
|
||||||
|
|
||||||
|
#if wxOSX_USE_CARBON
|
||||||
// Unlike some other platforms, this must get called if you override it,
|
// Unlike some other platforms, this must get called if you override it,
|
||||||
// i.e. don't forget "event.Skip()" in your EVT_SIZE handler
|
// i.e. don't forget "event.Skip()" in your EVT_SIZE handler
|
||||||
void OnSize(wxSizeEvent& event);
|
void OnSize(wxSizeEvent& event);
|
||||||
@@ -129,11 +134,18 @@ public:
|
|||||||
|
|
||||||
void MacUpdateView();
|
void MacUpdateView();
|
||||||
|
|
||||||
protected:
|
GLint GetAglBufferName() const { return m_bufferName; }
|
||||||
AGLPixelFormat m_aglFormat;
|
#endif
|
||||||
|
|
||||||
|
protected:
|
||||||
|
WXGLPixelFormat m_glFormat;
|
||||||
|
|
||||||
|
#if wxOSX_USE_CARBON
|
||||||
bool m_macCanvasIsShown,
|
bool m_macCanvasIsShown,
|
||||||
m_needsUpdate;
|
m_needsUpdate;
|
||||||
|
WXGLContext m_dummyContext;
|
||||||
|
GLint m_bufferName;
|
||||||
|
#endif
|
||||||
|
|
||||||
DECLARE_EVENT_TABLE()
|
DECLARE_EVENT_TABLE()
|
||||||
DECLARE_CLASS(wxGLCanvas)
|
DECLARE_CLASS(wxGLCanvas)
|
||||||
|
@@ -21,8 +21,8 @@
|
|||||||
// forward decl for GetSelections()
|
// forward decl for GetSelections()
|
||||||
class wxArrayInt;
|
class wxArrayInt;
|
||||||
|
|
||||||
// forward decl for wxMacListControl data type.
|
// forward decl for wxListWidgetImpl data type.
|
||||||
class wxMacListControl;
|
class wxListWidgetImpl;
|
||||||
|
|
||||||
// List box item
|
// List box item
|
||||||
|
|
||||||
@@ -32,6 +32,10 @@ WX_DEFINE_ARRAY( char* , wxListDataArray );
|
|||||||
// List box control
|
// List box control
|
||||||
// ----------------------------------------------------------------------------
|
// ----------------------------------------------------------------------------
|
||||||
|
|
||||||
|
class WXDLLIMPEXP_CORE wxListWidgetColumn;
|
||||||
|
|
||||||
|
class WXDLLIMPEXP_CORE wxListWidgetCellValue;
|
||||||
|
|
||||||
class WXDLLIMPEXP_CORE wxListBox : public wxListBoxBase
|
class WXDLLIMPEXP_CORE wxListBox : public wxListBoxBase
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
@@ -95,6 +99,10 @@ public:
|
|||||||
virtual void SetString(unsigned int n, const wxString& s);
|
virtual void SetString(unsigned int n, const wxString& s);
|
||||||
virtual int FindString(const wxString& s, bool bCase = false) const;
|
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 bool IsSelected(int n) const;
|
||||||
virtual int GetSelection() const;
|
virtual int GetSelection() const;
|
||||||
virtual int GetSelections(wxArrayInt& aSelections) const;
|
virtual int GetSelections(wxArrayInt& aSelections) const;
|
||||||
@@ -110,11 +118,15 @@ public:
|
|||||||
static wxVisualAttributes
|
static wxVisualAttributes
|
||||||
GetClassDefaultAttributes(wxWindowVariant variant = wxWINDOW_VARIANT_NORMAL);
|
GetClassDefaultAttributes(wxWindowVariant variant = wxWINDOW_VARIANT_NORMAL);
|
||||||
|
|
||||||
wxMacListControl* GetPeer() const;
|
wxListWidgetImpl* GetListPeer() const;
|
||||||
|
|
||||||
bool MacGetBlockEvents() const { return m_blockEvents; }
|
bool MacGetBlockEvents() const { return m_blockEvents; }
|
||||||
|
|
||||||
protected:
|
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 DoClear();
|
||||||
virtual void DoDeleteOneItem(unsigned int n);
|
virtual void DoDeleteOneItem(unsigned int n);
|
||||||
|
|
||||||
@@ -139,6 +151,21 @@ protected:
|
|||||||
|
|
||||||
bool m_blockEvents;
|
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:
|
private:
|
||||||
DECLARE_DYNAMIC_CLASS(wxListBox)
|
DECLARE_DYNAMIC_CLASS(wxListBox)
|
||||||
DECLARE_EVENT_TABLE()
|
DECLARE_EVENT_TABLE()
|
||||||
|
@@ -18,7 +18,6 @@
|
|||||||
#define wxMAC_ALWAYS_USE_GENERIC_LISTCTRL wxT("mac.listctrl.always_use_generic")
|
#define wxMAC_ALWAYS_USE_GENERIC_LISTCTRL wxT("mac.listctrl.always_use_generic")
|
||||||
|
|
||||||
class wxMacDataBrowserListCtrlControl;
|
class wxMacDataBrowserListCtrlControl;
|
||||||
class wxMacListControl;
|
|
||||||
class wxListCtrlTextCtrlWrapper;
|
class wxListCtrlTextCtrlWrapper;
|
||||||
class wxListCtrlRenameTimer;
|
class wxListCtrlRenameTimer;
|
||||||
|
|
||||||
@@ -281,7 +280,7 @@ class WXDLLIMPEXP_CORE wxListCtrl: public wxControl
|
|||||||
// data is arbitrary data to be passed to the sort function.
|
// data is arbitrary data to be passed to the sort function.
|
||||||
bool SortItems(wxListCtrlCompare fn, long data);
|
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
|
// these functions are only used for virtual list view controls, i.e. the
|
||||||
// ones with wxLC_VIRTUAL style
|
// ones with wxLC_VIRTUAL style
|
||||||
|
@@ -20,6 +20,8 @@ class WXDLLIMPEXP_FWD_CORE wxFrame;
|
|||||||
// Menu
|
// Menu
|
||||||
// ----------------------------------------------------------------------------
|
// ----------------------------------------------------------------------------
|
||||||
|
|
||||||
|
class WXDLLIMPEXP_FWD_CORE wxMenuImpl ;
|
||||||
|
|
||||||
class WXDLLIMPEXP_CORE wxMenu : public wxMenuBase
|
class WXDLLIMPEXP_CORE wxMenu : public wxMenuBase
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
@@ -37,34 +39,40 @@ public:
|
|||||||
|
|
||||||
virtual void SetTitle(const wxString& title);
|
virtual void SetTitle(const wxString& title);
|
||||||
|
|
||||||
// MSW-specific
|
|
||||||
bool ProcessCommand(wxCommandEvent& event);
|
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
|
// implementation only from now on
|
||||||
// -------------------------------
|
// -------------------------------
|
||||||
|
|
||||||
int MacGetIndexFromId( int id ) ;
|
bool HandleCommandUpdateStatus( wxMenuItem* menuItem, wxWindow* senderWindow = NULL);
|
||||||
int MacGetIndexFromItem( wxMenuItem *pItem ) ;
|
bool HandleCommandProcess( wxMenuItem* menuItem, wxWindow* senderWindow = NULL);
|
||||||
void MacEnableMenu( bool bDoEnable ) ;
|
void HandleMenuItemHighlighted( wxMenuItem* menuItem );
|
||||||
// MacOS needs to know about submenus somewhere within this menu
|
void HandleMenuOpened();
|
||||||
// before it can be displayed , also hide special menu items like preferences
|
void HandleMenuClosed();
|
||||||
// that are handled by the OS
|
|
||||||
void MacBeforeDisplay( bool isSubMenu ) ;
|
|
||||||
// undo all changes from the MacBeforeDisplay call
|
|
||||||
void MacAfterDisplay( bool isSubMenu ) ;
|
|
||||||
|
|
||||||
// semi-private accessors
|
wxMenuImpl* GetPeer() { return m_peer; }
|
||||||
// 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 ; }
|
// make sure we can veto
|
||||||
|
void SetAllowRearrange( bool allow );
|
||||||
wxInt32 MacHandleCommandProcess( wxMenuItem* item, int id, wxWindow* targetWindow = NULL );
|
bool AllowRearrange() const { return m_allowRearrange; }
|
||||||
wxInt32 MacHandleCommandUpdateStatus( wxMenuItem* item, int id, wxWindow* targetWindow = NULL);
|
|
||||||
|
|
||||||
|
// 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:
|
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* DoAppend(wxMenuItem *item);
|
||||||
virtual wxMenuItem* DoInsert(size_t pos, wxMenuItem *item);
|
virtual wxMenuItem* DoInsert(size_t pos, wxMenuItem *item);
|
||||||
virtual wxMenuItem* DoRemove(wxMenuItem *item);
|
virtual wxMenuItem* DoRemove(wxMenuItem *item);
|
||||||
@@ -82,19 +90,24 @@ private:
|
|||||||
// if TRUE, insert a breal before appending the next item
|
// if TRUE, insert a breal before appending the next item
|
||||||
bool m_doBreak;
|
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
|
// the position of the first item in the current radio group or -1
|
||||||
int m_startRadioGroup;
|
int m_startRadioGroup;
|
||||||
|
|
||||||
// the menu handle of this menu
|
wxMenuImpl* m_peer;
|
||||||
WXHMENU m_hMenu;
|
|
||||||
|
|
||||||
short m_macMenuId;
|
|
||||||
|
|
||||||
static short s_macNextMenuId ;
|
|
||||||
|
|
||||||
DECLARE_DYNAMIC_CLASS(wxMenu)
|
DECLARE_DYNAMIC_CLASS(wxMenu)
|
||||||
};
|
};
|
||||||
|
|
||||||
|
#if wxOSX_USE_COCOA_OR_CARBON
|
||||||
|
|
||||||
|
// the iphone only has popup-menus
|
||||||
|
|
||||||
// ----------------------------------------------------------------------------
|
// ----------------------------------------------------------------------------
|
||||||
// Menu Bar (a la Windows)
|
// Menu Bar (a la Windows)
|
||||||
// ----------------------------------------------------------------------------
|
// ----------------------------------------------------------------------------
|
||||||
@@ -132,7 +145,6 @@ public:
|
|||||||
}
|
}
|
||||||
|
|
||||||
// implementation from now on
|
// implementation from now on
|
||||||
WXHMENU Create();
|
|
||||||
int FindMenu(const wxString& title);
|
int FindMenu(const wxString& title);
|
||||||
void Detach();
|
void Detach();
|
||||||
|
|
||||||
@@ -173,10 +185,14 @@ protected:
|
|||||||
static WXHMENU s_macWindowMenuHandle ;
|
static WXHMENU s_macWindowMenuHandle ;
|
||||||
|
|
||||||
private:
|
private:
|
||||||
static wxMenuBar* s_macInstalledMenuBar ;
|
static wxMenuBar* s_macInstalledMenuBar ;
|
||||||
static wxMenuBar* s_macCommonMenuBar ;
|
static wxMenuBar* s_macCommonMenuBar ;
|
||||||
|
|
||||||
|
wxMenu* m_rootMenu;
|
||||||
|
|
||||||
DECLARE_DYNAMIC_CLASS(wxMenuBar)
|
DECLARE_DYNAMIC_CLASS(wxMenuBar)
|
||||||
};
|
};
|
||||||
|
|
||||||
|
#endif
|
||||||
|
|
||||||
#endif // _WX_MENU_H_
|
#endif // _WX_MENU_H_
|
||||||
|
@@ -22,6 +22,9 @@
|
|||||||
// ----------------------------------------------------------------------------
|
// ----------------------------------------------------------------------------
|
||||||
// wxMenuItem: an item in the menu, optionally implements owner-drawn behaviour
|
// wxMenuItem: an item in the menu, optionally implements owner-drawn behaviour
|
||||||
// ----------------------------------------------------------------------------
|
// ----------------------------------------------------------------------------
|
||||||
|
|
||||||
|
class WXDLLIMPEXP_FWD_CORE wxMenuItemImpl ;
|
||||||
|
|
||||||
class WXDLLIMPEXP_CORE wxMenuItem: public wxMenuItemBase
|
class WXDLLIMPEXP_CORE wxMenuItem: public wxMenuItemBase
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
@@ -53,9 +56,8 @@ public:
|
|||||||
void SetRadioGroupStart(int start);
|
void SetRadioGroupStart(int start);
|
||||||
void SetRadioGroupEnd(int end);
|
void SetRadioGroupEnd(int end);
|
||||||
|
|
||||||
|
wxMenuItemImpl* GetPeer() { return m_peer; }
|
||||||
private:
|
private:
|
||||||
void DoUpdateItemBitmap( WXHMENU menu, wxUint16 index) ;
|
|
||||||
|
|
||||||
void UncheckRadio() ;
|
void UncheckRadio() ;
|
||||||
|
|
||||||
// the positions of the first and last items of the radio group this item
|
// the positions of the first and last items of the radio group this item
|
||||||
@@ -74,6 +76,8 @@ private:
|
|||||||
wxBitmap m_bitmap; // Bitmap for menuitem, if any
|
wxBitmap m_bitmap; // Bitmap for menuitem, if any
|
||||||
void* m_menu ; // the appropriate menu , may also be a system menu
|
void* m_menu ; // the appropriate menu , may also be a system menu
|
||||||
|
|
||||||
|
wxMenuItemImpl* m_peer;
|
||||||
|
|
||||||
DECLARE_DYNAMIC_CLASS(wxMenuItem)
|
DECLARE_DYNAMIC_CLASS(wxMenuItem)
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@@ -97,6 +97,12 @@ public:
|
|||||||
|
|
||||||
wxNonOwnedWindowImpl* GetNonOwnedPeer() const { return m_nowpeer; }
|
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:
|
protected:
|
||||||
// common part of all ctors
|
// common part of all ctors
|
||||||
|
@@ -117,7 +117,9 @@ public:
|
|||||||
// base class virtuals
|
// base class virtuals
|
||||||
// -------------------
|
// -------------------
|
||||||
virtual void Command(wxCommandEvent& event);
|
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:
|
protected:
|
||||||
virtual wxNotebookPage *DoRemovePage(size_t page) ;
|
virtual wxNotebookPage *DoRemovePage(size_t page) ;
|
||||||
|
@@ -25,6 +25,8 @@ typedef SInt32 SRefCon;
|
|||||||
|
|
||||||
#if wxUSE_GUI
|
#if wxUSE_GUI
|
||||||
|
|
||||||
|
#include "wx/osx/uma.h"
|
||||||
|
|
||||||
#include "wx/listbox.h"
|
#include "wx/listbox.h"
|
||||||
#include "wx/osx/carbon/dc.h"
|
#include "wx/osx/carbon/dc.h"
|
||||||
#include "wx/osx/carbon/dcclient.h"
|
#include "wx/osx/carbon/dcclient.h"
|
||||||
@@ -289,8 +291,6 @@ public :
|
|||||||
|
|
||||||
void Init();
|
void Init();
|
||||||
|
|
||||||
virtual void Destroy();
|
|
||||||
|
|
||||||
void SetReferenceInNativeControl();
|
void SetReferenceInNativeControl();
|
||||||
static wxMacControl* GetReferenceFromNativeControl(ControlRef control);
|
static wxMacControl* GetReferenceFromNativeControl(ControlRef control);
|
||||||
|
|
||||||
@@ -313,6 +313,7 @@ public :
|
|||||||
virtual void Move(int x, int y, int width, int height);
|
virtual void Move(int x, int y, int width, int height);
|
||||||
virtual void GetPosition( int &x, int &y ) const;
|
virtual void GetPosition( int &x, int &y ) const;
|
||||||
virtual void GetSize( int &width, int &height ) const;
|
virtual void GetSize( int &width, int &height ) const;
|
||||||
|
virtual void SetControlSize( wxWindowVariant variant ) ;
|
||||||
|
|
||||||
// where is in native window relative coordinates
|
// where is in native window relative coordinates
|
||||||
virtual void SetNeedsDisplay( const wxRect* where = NULL );
|
virtual void SetNeedsDisplay( const wxRect* where = NULL );
|
||||||
@@ -325,6 +326,28 @@ public :
|
|||||||
|
|
||||||
void RemoveFromParent();
|
void RemoveFromParent();
|
||||||
void Embed( wxWidgetImpl *parent );
|
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 ¬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; }
|
void operator= (ControlRef c) { m_controlRef = c; }
|
||||||
operator ControlRef () { return m_controlRef; }
|
operator ControlRef () { return m_controlRef; }
|
||||||
@@ -340,13 +363,7 @@ public :
|
|||||||
|
|
||||||
virtual OSStatus SendHICommand( UInt32 commandID , OptionBits inOptions = 0 );
|
virtual OSStatus SendHICommand( UInt32 commandID , OptionBits inOptions = 0 );
|
||||||
|
|
||||||
virtual SInt32 GetValue() const;
|
|
||||||
virtual SInt32 GetMaximum() 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 SetValueAndRange( SInt32 value , SInt32 minimum , SInt32 maximum );
|
||||||
virtual void SetRange( 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
|
// Flash the control for the specified amount of time
|
||||||
virtual void Flash( ControlPartCode part , UInt32 ticks = 8 );
|
|
||||||
|
|
||||||
virtual void VisibilityChanged( bool shown );
|
virtual void VisibilityChanged( bool shown );
|
||||||
virtual void SuperChangedPosition();
|
virtual void SuperChangedPosition();
|
||||||
@@ -414,13 +430,11 @@ public :
|
|||||||
virtual void SetBackgroundColour( const wxColour& col );
|
virtual void SetBackgroundColour( const wxColour& col );
|
||||||
virtual ControlPartCode HandleKey( SInt16 keyCode, SInt16 charCode, EventModifiers modifiers );
|
virtual ControlPartCode HandleKey( SInt16 keyCode, SInt16 charCode, EventModifiers modifiers );
|
||||||
void SetActionProc( ControlActionUPP actionProc );
|
void SetActionProc( ControlActionUPP actionProc );
|
||||||
void SetViewSize( SInt32 viewSize );
|
|
||||||
SInt32 GetViewSize() const;
|
SInt32 GetViewSize() const;
|
||||||
|
|
||||||
virtual void SetVisibility( bool visible );
|
virtual void SetVisibility( bool visible );
|
||||||
virtual bool IsEnabled() const;
|
|
||||||
virtual bool IsActive() const;
|
virtual bool IsActive() const;
|
||||||
virtual void Enable( bool enable );
|
|
||||||
|
|
||||||
// invalidates this control and all children
|
// invalidates this control and all children
|
||||||
virtual void InvalidateWithChildren();
|
virtual void InvalidateWithChildren();
|
||||||
@@ -429,9 +443,7 @@ public :
|
|||||||
// in native parent window relative coordinates
|
// in native parent window relative coordinates
|
||||||
|
|
||||||
virtual void GetRectInWindowCoords( Rect *r );
|
virtual void GetRectInWindowCoords( Rect *r );
|
||||||
virtual void GetBestRect( Rect *r );
|
|
||||||
|
|
||||||
virtual void SetLabel( const wxString &title );
|
|
||||||
|
|
||||||
virtual void GetFeatures( UInt32 *features );
|
virtual void GetFeatures( UInt32 *features );
|
||||||
virtual OSStatus GetRegion( ControlPartCode partCode , RgnHandle region );
|
virtual OSStatus GetRegion( ControlPartCode partCode , RgnHandle region );
|
||||||
@@ -614,36 +626,21 @@ const DataBrowserPropertyID kMinColumnId = 1050;
|
|||||||
|
|
||||||
// base API for high-level databrowser operations
|
// 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
|
// base class for databrowser items
|
||||||
|
|
||||||
enum DataItemType {
|
enum DataItemType {
|
||||||
DataItem_Text
|
DataItem_Text
|
||||||
};
|
};
|
||||||
|
|
||||||
|
/*
|
||||||
|
class WXDLLIMPEXP_CORE wxMacDataItem
|
||||||
|
{
|
||||||
|
public :
|
||||||
|
wxMacDataItem();
|
||||||
|
virtual ~wxMacDataItem();
|
||||||
|
} ;
|
||||||
|
*/
|
||||||
|
|
||||||
class WXDLLIMPEXP_CORE wxMacDataItem
|
class WXDLLIMPEXP_CORE wxMacDataItem
|
||||||
{
|
{
|
||||||
public :
|
public :
|
||||||
@@ -664,24 +661,11 @@ public :
|
|||||||
DataBrowserItemNotification message,
|
DataBrowserItemNotification message,
|
||||||
DataBrowserItemDataRef itemData ) const;
|
DataBrowserItemDataRef itemData ) const;
|
||||||
|
|
||||||
void SetLabel( const wxString& str);
|
|
||||||
const wxString& GetLabel() const;
|
|
||||||
|
|
||||||
void SetOrder( SInt32 order );
|
void SetOrder( SInt32 order );
|
||||||
SInt32 GetOrder() const;
|
SInt32 GetOrder() const;
|
||||||
|
|
||||||
void SetData( void* data);
|
|
||||||
void* GetData() const;
|
|
||||||
|
|
||||||
void SetColumn( short col );
|
|
||||||
short GetColumn();
|
|
||||||
|
|
||||||
protected :
|
protected :
|
||||||
wxString m_label;
|
|
||||||
wxCFStringRef m_cfLabel;
|
|
||||||
void * m_data;
|
|
||||||
SInt32 m_order;
|
SInt32 m_order;
|
||||||
DataBrowserPropertyID m_colId;
|
|
||||||
|
|
||||||
};
|
};
|
||||||
|
|
||||||
@@ -693,18 +677,17 @@ enum ListSortOrder {
|
|||||||
|
|
||||||
typedef wxMacDataItem* wxMacDataItemPtr;
|
typedef wxMacDataItem* wxMacDataItemPtr;
|
||||||
const wxMacDataItemPtr wxMacDataBrowserRootContainer = NULL;
|
const wxMacDataItemPtr wxMacDataBrowserRootContainer = NULL;
|
||||||
|
typedef void * wxListColumnId ;
|
||||||
|
|
||||||
WX_DEFINE_USER_EXPORTED_ARRAY_PTR(wxMacDataItemPtr, wxArrayMacDataItemPtr, class WXDLLIMPEXP_CORE);
|
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 :
|
public :
|
||||||
wxMacDataItemBrowserControl( wxWindow* peer , const wxPoint& pos, const wxSize& size, long style);
|
wxMacDataItemBrowserControl( wxWindow* peer , const wxPoint& pos, const wxSize& size, long style);
|
||||||
wxMacDataItemBrowserControl() {}
|
wxMacDataItemBrowserControl() {}
|
||||||
// create a list item (can be a subclass of wxMacListBoxItem)
|
// create a list item (can be a subclass of wxMacListBoxItem)
|
||||||
|
|
||||||
virtual wxMacDataItem* CreateItem();
|
|
||||||
|
|
||||||
unsigned int GetItemCount(const wxMacDataItem* container, bool recurse , DataBrowserItemState state) const;
|
unsigned int GetItemCount(const wxMacDataItem* container, bool recurse , DataBrowserItemState state) const;
|
||||||
void GetItems(const wxMacDataItem* container, bool recurse ,
|
void GetItems(const wxMacDataItem* container, bool recurse ,
|
||||||
DataBrowserItemState state, wxArrayMacDataItemPtr &items ) const;
|
DataBrowserItemState state, wxArrayMacDataItemPtr &items ) const;
|
||||||
@@ -741,6 +724,18 @@ public :
|
|||||||
|
|
||||||
void GetSelectionAnchor( wxMacDataItemPtr* first , wxMacDataItemPtr* last) const;
|
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
|
// item aware methods, to be used in subclasses
|
||||||
|
|
||||||
virtual Boolean CompareItems(const wxMacDataItem* itemOneID,
|
virtual Boolean CompareItems(const wxMacDataItem* itemOneID,
|
||||||
@@ -763,35 +758,6 @@ public :
|
|||||||
bool IsSelectionSuppressed() const { return m_suppressSelection; }
|
bool IsSelectionSuppressed() const { return m_suppressSelection; }
|
||||||
bool SuppressSelection( bool suppress );
|
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
|
// client data
|
||||||
|
|
||||||
virtual wxClientDataType GetClientDataType() const;
|
virtual wxClientDataType GetClientDataType() const;
|
||||||
@@ -854,28 +820,112 @@ public :
|
|||||||
|
|
||||||
virtual ~wxMacListBoxItem();
|
virtual ~wxMacListBoxItem();
|
||||||
|
|
||||||
|
virtual OSStatus GetSetData(wxMacDataItemBrowserControl *owner ,
|
||||||
|
DataBrowserPropertyID property,
|
||||||
|
DataBrowserItemDataRef itemData,
|
||||||
|
bool changeValue );
|
||||||
|
|
||||||
virtual void Notification(wxMacDataItemBrowserControl *owner ,
|
virtual void Notification(wxMacDataItemBrowserControl *owner ,
|
||||||
DataBrowserItemNotification message,
|
DataBrowserItemNotification message,
|
||||||
DataBrowserItemDataRef itemData ) const;
|
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:
|
public:
|
||||||
wxMacDataBrowserListControl( wxWindow *peer, const wxPoint& pos, const wxSize& size, long style );
|
wxMacDataBrowserListControl( wxWindow *peer, const wxPoint& pos, const wxSize& size, long style );
|
||||||
wxMacDataBrowserListControl() {}
|
wxMacDataBrowserListControl() {}
|
||||||
virtual ~wxMacDataBrowserListControl();
|
virtual ~wxMacDataBrowserListControl();
|
||||||
|
|
||||||
virtual wxMacDataItem* CreateItem();
|
// wxListWidgetImpl Methods
|
||||||
|
|
||||||
virtual void ItemNotification(
|
wxListWidgetColumn* InsertTextColumn( unsigned int pos, const wxString& title, bool editable = false,
|
||||||
const wxMacDataItem* itemID,
|
wxAlignment just = wxALIGN_LEFT , int defaultWidth = -1) ;
|
||||||
DataBrowserItemNotification message,
|
wxListWidgetColumn* InsertCheckColumn( unsigned int pos , const wxString& title, bool editable = false,
|
||||||
DataBrowserItemDataRef itemData);
|
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
|
// pointing back
|
||||||
|
|
||||||
// wxWindow * GetPeer() const;
|
wxMacDataBrowserColumn* GetColumnFromProperty( DataBrowserPropertyID );
|
||||||
|
private:
|
||||||
|
wxArrayMacDataBrowserColumns m_columns;
|
||||||
|
int m_nextColumnId ;
|
||||||
|
|
||||||
DECLARE_DYNAMIC_CLASS_NO_COPY(wxMacDataBrowserListControl)
|
DECLARE_DYNAMIC_CLASS_NO_COPY(wxMacDataBrowserListControl)
|
||||||
};
|
};
|
||||||
|
@@ -15,10 +15,19 @@
|
|||||||
#include "wx/osx/private.h"
|
#include "wx/osx/private.h"
|
||||||
|
|
||||||
// common interface for all implementations
|
// common interface for all implementations
|
||||||
class wxMacTextControl : public wxMacControl
|
class wxMacTextControl :
|
||||||
|
#if wxOSX_USE_CARBON
|
||||||
|
public wxMacControl
|
||||||
|
#else
|
||||||
|
public wxWidgetCocoaImpl
|
||||||
|
#endif
|
||||||
{
|
{
|
||||||
public :
|
public :
|
||||||
|
#if wxOSX_USE_CARBON
|
||||||
wxMacTextControl( wxTextCtrl *peer ) ;
|
wxMacTextControl( wxTextCtrl *peer ) ;
|
||||||
|
#else
|
||||||
|
wxMacTextControl::wxMacTextControl(wxTextCtrl* peer, WXWidget w) ;
|
||||||
|
#endif
|
||||||
virtual ~wxMacTextControl() ;
|
virtual ~wxMacTextControl() ;
|
||||||
|
|
||||||
virtual bool CanFocus() const { return true; }
|
virtual bool CanFocus() const { return true; }
|
||||||
@@ -61,6 +70,7 @@ public :
|
|||||||
virtual void SetFont( const wxFont & font , const wxColour& foreground , long windowStyle );
|
virtual void SetFont( const wxFont & font , const wxColour& foreground , long windowStyle );
|
||||||
};
|
};
|
||||||
|
|
||||||
|
#if wxOSX_USE_CARBON
|
||||||
class wxMacUnicodeTextControl : public wxMacTextControl
|
class wxMacUnicodeTextControl : public wxMacTextControl
|
||||||
{
|
{
|
||||||
public :
|
public :
|
||||||
@@ -95,5 +105,6 @@ protected :
|
|||||||
public :
|
public :
|
||||||
ControlEditTextSelectionRec m_selection ;
|
ControlEditTextSelectionRec m_selection ;
|
||||||
};
|
};
|
||||||
|
#endif
|
||||||
|
|
||||||
#endif // _WX_MAC_PRIVATE_MACTEXT_H_
|
#endif // _WX_MAC_PRIVATE_MACTEXT_H_
|
||||||
|
@@ -41,12 +41,14 @@ public:
|
|||||||
|
|
||||||
// implementation
|
// implementation
|
||||||
|
|
||||||
virtual wxInt32 MacControlHit( WXEVENTHANDLERREF handler , WXEVENTREF event ) ;
|
|
||||||
void Command(wxCommandEvent& event);
|
void Command(wxCommandEvent& event);
|
||||||
wxRadioButton *AddInCycle(wxRadioButton *cycle);
|
wxRadioButton *AddInCycle(wxRadioButton *cycle);
|
||||||
void RemoveFromCycle();
|
void RemoveFromCycle();
|
||||||
inline wxRadioButton *NextInCycle() {return m_cycle;}
|
inline wxRadioButton *NextInCycle() {return m_cycle;}
|
||||||
|
|
||||||
|
// osx specific event handling common for all osx-ports
|
||||||
|
|
||||||
|
virtual bool HandleClicked( double timestampsec );
|
||||||
protected:
|
protected:
|
||||||
|
|
||||||
wxRadioButton *m_cycle;
|
wxRadioButton *m_cycle;
|
||||||
|
@@ -48,12 +48,12 @@ public:
|
|||||||
|
|
||||||
// implementation only from now on
|
// implementation only from now on
|
||||||
void Command(wxCommandEvent& event);
|
void Command(wxCommandEvent& event);
|
||||||
|
#if wxOSX_USE_CARBON
|
||||||
virtual void MacHandleControlClick( WXWidget control ,
|
virtual void MacHandleControlClick( WXWidget control ,
|
||||||
wxInt16 controlpart ,
|
wxInt16 controlpart ,
|
||||||
bool mouseStillDown ) ;
|
bool mouseStillDown ) ;
|
||||||
virtual wxInt32 MacControlHit( WXEVENTHANDLERREF handler ,
|
#endif
|
||||||
WXEVENTREF mevent ) ;
|
virtual bool HandleClicked( double timestampsec );
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
virtual wxSize DoGetBestSize() const;
|
virtual wxSize DoGetBestSize() const;
|
||||||
|
|
||||||
|
@@ -75,7 +75,9 @@ public:
|
|||||||
void SetTick(int tickPos) ;
|
void SetTick(int tickPos) ;
|
||||||
|
|
||||||
void Command(wxCommandEvent& event);
|
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);
|
void MacHandleControlClick(WXWidget control, wxInt16 controlpart, bool mouseStillDown);
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
|
@@ -52,21 +52,23 @@ public:
|
|||||||
|
|
||||||
|
|
||||||
// accessors
|
// 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 void SetRange(int minVal, int maxVal);
|
||||||
|
virtual int GetValue() const ;
|
||||||
|
virtual void SetValue(int val);
|
||||||
|
|
||||||
// implementation
|
// implementation
|
||||||
|
|
||||||
|
#if wxOSX_USE_CARBON
|
||||||
virtual void MacHandleControlClick( WXWidget control , wxInt16 controlpart , bool mouseStillDown ) ;
|
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:
|
protected:
|
||||||
void MacHandleValueChanged( int inc ) ;
|
void SendThumbTrackEvent() ;
|
||||||
virtual wxSize DoGetBestSize() const;
|
|
||||||
int m_value ;
|
virtual wxSize DoGetBestSize() const;
|
||||||
|
|
||||||
private:
|
private:
|
||||||
DECLARE_DYNAMIC_CLASS(wxSpinButton)
|
DECLARE_DYNAMIC_CLASS(wxSpinButton)
|
||||||
|
@@ -44,7 +44,7 @@ public:
|
|||||||
virtual void SetValue(bool value);
|
virtual void SetValue(bool value);
|
||||||
virtual bool GetValue() const ;
|
virtual bool GetValue() const ;
|
||||||
|
|
||||||
virtual wxInt32 MacControlHit( WXEVENTHANDLERREF handler , WXEVENTREF event ) ;
|
virtual bool HandleClicked( double timestampsec );
|
||||||
|
|
||||||
virtual void Command(wxCommandEvent& event);
|
virtual void Command(wxCommandEvent& event);
|
||||||
|
|
||||||
@@ -88,7 +88,7 @@ public:
|
|||||||
virtual void SetValue(bool value);
|
virtual void SetValue(bool value);
|
||||||
virtual bool GetValue() const ;
|
virtual bool GetValue() const ;
|
||||||
|
|
||||||
virtual wxInt32 MacControlHit( WXEVENTHANDLERREF handler , WXEVENTREF event ) ;
|
virtual bool HandleClicked( double timestampsec );
|
||||||
|
|
||||||
virtual void Command(wxCommandEvent& event);
|
virtual void Command(wxCommandEvent& event);
|
||||||
|
|
||||||
|
@@ -99,7 +99,7 @@ protected:
|
|||||||
DECLARE_EVENT_TABLE()
|
DECLARE_EVENT_TABLE()
|
||||||
#if wxOSX_USE_NATIVE_TOOLBAR
|
#if wxOSX_USE_NATIVE_TOOLBAR
|
||||||
bool m_macUsesNativeToolbar ;
|
bool m_macUsesNativeToolbar ;
|
||||||
void* m_macHIToolbarRef ;
|
void* m_macToolbar ;
|
||||||
#endif
|
#endif
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@@ -14,8 +14,6 @@
|
|||||||
|
|
||||||
#include "wx/osx/private.h"
|
#include "wx/osx/private.h"
|
||||||
|
|
||||||
long UMAGetSystemVersion() ;
|
|
||||||
|
|
||||||
#if wxUSE_GUI
|
#if wxUSE_GUI
|
||||||
|
|
||||||
// menu manager
|
// 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 UMASetMenuTitle( MenuRef menu , const wxString& title , wxFontEncoding encoding) ;
|
||||||
void UMAEnableMenuItem( MenuRef inMenu , MenuItemIndex item , bool enable ) ;
|
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 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 UMAInsertMenuItem( MenuRef menu , const wxString& title , wxFontEncoding encoding , MenuItemIndex item , wxAcceleratorEntry *entry = NULL ) ;
|
||||||
void UMASetMenuItemShortcut( MenuRef menu , MenuItemIndex item , wxAcceleratorEntry *entry ) ;
|
void UMASetMenuItemShortcut( MenuRef menu , MenuItemIndex item , wxAcceleratorEntry *entry ) ;
|
||||||
|
@@ -84,7 +84,9 @@ public:
|
|||||||
const;
|
const;
|
||||||
protected:
|
protected:
|
||||||
virtual void DoEnable( bool enable );
|
virtual void DoEnable( bool enable );
|
||||||
|
#if wxUSE_MENUS
|
||||||
virtual bool DoPopupMenu( wxMenu *menu, int x, int y );
|
virtual bool DoPopupMenu( wxMenu *menu, int x, int y );
|
||||||
|
#endif
|
||||||
|
|
||||||
virtual void DoFreeze();
|
virtual void DoFreeze();
|
||||||
virtual void DoThaw();
|
virtual void DoThaw();
|
||||||
@@ -247,6 +249,9 @@ public:
|
|||||||
void * MacGetCGContextRef() { return m_cgContextRef ; }
|
void * MacGetCGContextRef() { return m_cgContextRef ; }
|
||||||
void MacSetCGContextRef(void * cg) { m_cgContextRef = cg ; }
|
void MacSetCGContextRef(void * cg) { m_cgContextRef = cg ; }
|
||||||
|
|
||||||
|
// osx specific event handling common for all osx-ports
|
||||||
|
|
||||||
|
virtual bool HandleClicked( double timestampsec );
|
||||||
protected:
|
protected:
|
||||||
// For controls like radio buttons which are genuinely composite
|
// For controls like radio buttons which are genuinely composite
|
||||||
wxList m_subControls;
|
wxList m_subControls;
|
||||||
|
@@ -84,44 +84,8 @@
|
|||||||
#define wxUSE_TASKBARICON 0
|
#define wxUSE_TASKBARICON 0
|
||||||
#endif
|
#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
|
#define wxUSE_DOC_VIEW_ARCHITECTURE 0
|
||||||
#endif
|
#define wxUSE_WXHTML_HELP 0
|
||||||
|
|
||||||
#if wxUSE_PRINTING_ARCHITECTURE
|
|
||||||
#undef wxUSE_PRINTING_ARCHITECTURE
|
|
||||||
#define wxUSE_PRINTING_ARCHITECTURE 0
|
|
||||||
#endif
|
|
||||||
|
|
||||||
*/
|
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
/* _WX_MAC_CHKCONF_H_ */
|
/* _WX_MAC_CHKCONF_H_ */
|
||||||
|
@@ -25,8 +25,71 @@
|
|||||||
extern NSPoint wxToNSPoint( NSView* parent, const wxPoint& p );
|
extern NSPoint wxToNSPoint( NSView* parent, const wxPoint& p );
|
||||||
extern wxPoint wxFromNSPoint( NSView* parent, const NSPoint& 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__
|
#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
|
#if wxUSE_GUI
|
||||||
|
|
||||||
class WXDLLIMPEXP_CORE wxWidgetCocoaImpl : public wxWidgetImpl
|
class WXDLLIMPEXP_CORE wxWidgetCocoaImpl : public wxWidgetImpl
|
||||||
@@ -39,6 +102,7 @@ public :
|
|||||||
void Init();
|
void Init();
|
||||||
|
|
||||||
virtual bool IsVisible() const ;
|
virtual bool IsVisible() const ;
|
||||||
|
virtual void SetVisibility(bool);
|
||||||
|
|
||||||
virtual void Raise();
|
virtual void Raise();
|
||||||
|
|
||||||
@@ -48,10 +112,13 @@ public :
|
|||||||
|
|
||||||
virtual WXWidget GetWXWidget() const { return m_osxView; }
|
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 GetContentArea( int &left , int &top , int &width , int &height ) const;
|
||||||
virtual void Move(int x, int y, int width, int height);
|
virtual void Move(int x, int y, int width, int height);
|
||||||
virtual void GetPosition( int &x, int &y ) const;
|
virtual void GetPosition( int &x, int &y ) const;
|
||||||
virtual void GetSize( int &width, int &height ) const;
|
virtual void GetSize( int &width, int &height ) const;
|
||||||
|
virtual void SetControlSize( wxWindowVariant variant );
|
||||||
|
|
||||||
virtual void SetNeedsDisplay( const wxRect* where = NULL );
|
virtual void SetNeedsDisplay( const wxRect* where = NULL );
|
||||||
virtual bool GetNeedsDisplay() const;
|
virtual bool GetNeedsDisplay() const;
|
||||||
@@ -63,6 +130,24 @@ public :
|
|||||||
|
|
||||||
void RemoveFromParent();
|
void RemoveFromParent();
|
||||||
void Embed( wxWidgetImpl *parent );
|
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 ¬ebook );
|
||||||
|
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:
|
protected:
|
||||||
WXWidget m_osxView;
|
WXWidget m_osxView;
|
||||||
DECLARE_DYNAMIC_CLASS_NO_COPY(wxWidgetCocoaImpl)
|
DECLARE_DYNAMIC_CLASS_NO_COPY(wxWidgetCocoaImpl)
|
||||||
@@ -142,6 +227,27 @@ typedef struct tagClassicCursor
|
|||||||
wxInt16 hotspot[2];
|
wxInt16 hotspot[2];
|
||||||
}ClassicCursor;
|
}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
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
174
include/wx/osx/core/mimetype.h
Normal file
174
include/wx/osx/core/mimetype.h
Normal 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
|
||||||
|
|
||||||
|
|
@@ -21,6 +21,10 @@
|
|||||||
#include "wx/osx/core/cfstring.h"
|
#include "wx/osx/core/cfstring.h"
|
||||||
#include "wx/osx/core/cfdataref.h"
|
#include "wx/osx/core/cfdataref.h"
|
||||||
|
|
||||||
|
#if wxOSX_USE_COCOA_OR_CARBON
|
||||||
|
WXDLLIMPEXP_BASE long UMAGetSystemVersion() ;
|
||||||
|
#endif
|
||||||
|
|
||||||
#if wxUSE_GUI
|
#if wxUSE_GUI
|
||||||
|
|
||||||
#if wxOSX_USE_IPHONE
|
#if wxOSX_USE_IPHONE
|
||||||
@@ -79,6 +83,79 @@ class wxWindowMac;
|
|||||||
extern wxWindow* g_MacLastWindow;
|
extern wxWindow* g_MacLastWindow;
|
||||||
class wxNonOwnedWindow;
|
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
|
class WXDLLIMPEXP_CORE wxWidgetImpl : public wxObject
|
||||||
{
|
{
|
||||||
public :
|
public :
|
||||||
@@ -88,8 +165,6 @@ public :
|
|||||||
|
|
||||||
void Init();
|
void Init();
|
||||||
|
|
||||||
virtual void Destroy();
|
|
||||||
|
|
||||||
bool IsRootControl() const { return m_isRootControl; }
|
bool IsRootControl() const { return m_isRootControl; }
|
||||||
|
|
||||||
wxWindowMac* GetWXPeer() const { return m_wxPeer; }
|
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 Move(int x, int y, int width, int height) = 0;
|
||||||
virtual void GetPosition( int &x, int &y ) const = 0;
|
virtual void GetPosition( int &x, int &y ) const = 0;
|
||||||
virtual void GetSize( int &width, int &height ) 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 void SetNeedsDisplay( const wxRect* where = NULL ) = 0;
|
||||||
virtual bool GetNeedsDisplay() const = 0;
|
virtual bool GetNeedsDisplay() const = 0;
|
||||||
@@ -132,11 +208,200 @@ public :
|
|||||||
virtual void RemoveFromParent() = 0;
|
virtual void RemoveFromParent() = 0;
|
||||||
virtual void Embed( wxWidgetImpl *parent ) = 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 ¬ebook ) =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 creation methods, must be implemented by all toolkits
|
||||||
|
|
||||||
static wxWidgetImpl* CreateUserPane( wxWindowMac* wxpeer, const wxPoint& pos, const wxSize& size,
|
static wxWidgetImplType* CreateUserPane( wxWindowMac* wxpeer,
|
||||||
long style, long extraStyle, const wxString& name) ;
|
wxWindowMac* parent,
|
||||||
static wxWidgetImpl* CreateContentView( wxNonOwnedWindow* now ) ;
|
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
|
// converts from Toplevel-Content relative to local
|
||||||
static void Convert( wxPoint *pt , wxWidgetImpl *from , wxWidgetImpl *to );
|
static void Convert( wxPoint *pt , wxWidgetImpl *from , wxWidgetImpl *to );
|
||||||
@@ -148,6 +413,73 @@ protected :
|
|||||||
DECLARE_ABSTRACT_CLASS(wxWidgetImpl)
|
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
|
class wxNonOwnedWindowImpl : public wxObject
|
||||||
{
|
{
|
||||||
public :
|
public :
|
||||||
@@ -248,6 +580,12 @@ public :
|
|||||||
virtual void WindowToScreen( int *x, int *y ) = 0;
|
virtual void WindowToScreen( int *x, int *y ) = 0;
|
||||||
|
|
||||||
wxNonOwnedWindow* GetWXPeer() { return m_wxPeer; }
|
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 :
|
protected :
|
||||||
wxNonOwnedWindow* m_wxPeer;
|
wxNonOwnedWindow* m_wxPeer;
|
||||||
DECLARE_ABSTRACT_CLASS(wxNonOwnedWindowImpl)
|
DECLARE_ABSTRACT_CLASS(wxNonOwnedWindowImpl)
|
||||||
|
@@ -67,6 +67,84 @@
|
|||||||
#define wxUSE_TASKBARICON 0
|
#define wxUSE_TASKBARICON 0
|
||||||
#endif
|
#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
|
#if wxUSE_POPUPWIN
|
||||||
#undef wxUSE_POPUPWIN
|
#undef wxUSE_POPUPWIN
|
||||||
|
@@ -1,5 +1,5 @@
|
|||||||
#ifdef __WXMAC_CLASSIC__
|
#ifdef __WXMAC_CLASSIC__
|
||||||
#include "wx/osx/classic/mimetype.h"
|
#include "wx/osx/classic/mimetype.h"
|
||||||
#else
|
#else
|
||||||
#include "wx/osx/carbon/mimetype.h"
|
#include "wx/osx/core/mimetype.h"
|
||||||
#endif
|
#endif
|
||||||
|
@@ -4,6 +4,9 @@
|
|||||||
#error "this files should only be included after platform.h was included
|
#error "this files should only be included after platform.h was included
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
#ifndef _WX_PRIVATE_OSX_H_
|
||||||
|
#define _WX_PRIVATE_OSX_H_
|
||||||
|
|
||||||
#if wxOSX_USE_IPHONE
|
#if wxOSX_USE_IPHONE
|
||||||
#include "wx/osx/iphone/private.h"
|
#include "wx/osx/iphone/private.h"
|
||||||
#elif wxOSX_USE_CARBON
|
#elif wxOSX_USE_CARBON
|
||||||
@@ -11,3 +14,5 @@
|
|||||||
#elif wxOSX_USE_COCOA
|
#elif wxOSX_USE_COCOA
|
||||||
#include "wx/osx/cocoa/private.h"
|
#include "wx/osx/cocoa/private.h"
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
#endif
|
@@ -1,5 +1,6 @@
|
|||||||
#ifdef __WXMAC_CLASSIC__
|
#if wxOSX_USE_CARBON
|
||||||
#include "wx/osx/classic/statbmp.h"
|
|
||||||
#else
|
|
||||||
#include "wx/osx/carbon/statbmp.h"
|
#include "wx/osx/carbon/statbmp.h"
|
||||||
|
#else
|
||||||
|
#define wxGenericStaticBitmap wxStaticBitmap
|
||||||
|
#include "wx/generic/statbmpg.h"
|
||||||
#endif
|
#endif
|
||||||
|
@@ -1,5 +1,5 @@
|
|||||||
#ifdef __WXMAC_CLASSIC__
|
#if wxOSX_USE_CARBON
|
||||||
#include "wx/osx/classic/statline.h"
|
#include "wx/osx/carbon/statline.h"
|
||||||
#else
|
#else
|
||||||
#include "wx/osx/carbon/statline.h"
|
#include "wx/osx/carbon/statline.h"
|
||||||
#endif
|
#endif
|
||||||
|
@@ -23,7 +23,7 @@
|
|||||||
#include "wx/image.h"
|
#include "wx/image.h"
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#if !defined(__WXUNIVERSAL__)
|
#if !defined(__WXUNIVERSAL__) && wxOSX_USE_CARBON
|
||||||
|
|
||||||
#include "wx/artprov.h"
|
#include "wx/artprov.h"
|
||||||
#include "wx/image.h"
|
#include "wx/image.h"
|
||||||
|
@@ -92,22 +92,7 @@ bool wxDisclosureTriangle::Create(wxWindow *parent, wxWindowID id, const wxStrin
|
|||||||
if ( !wxControl::Create(parent, id, pos, size, style, validator, name) )
|
if ( !wxControl::Create(parent, id, pos, size, style, validator, name) )
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
#if wxOSX_USE_CARBON
|
m_peer = wxWidgetImpl::CreateDisclosureTriangle(this, parent, id, label, pos, size, style, GetExtraStyle() );
|
||||||
Rect bounds = wxMacGetBoundsForControl( this , pos , size ) ;
|
|
||||||
m_peer = new wxMacControl(this) ;
|
|
||||||
|
|
||||||
OSStatus err = CreateDisclosureTriangleControl(
|
|
||||||
MAC_WXHWND(parent->MacGetTopLevelWindowRef()) , &bounds,
|
|
||||||
kControlDisclosureTrianglePointDefault,
|
|
||||||
wxCFStringRef( label ),
|
|
||||||
0, // closed
|
|
||||||
TRUE, // draw title
|
|
||||||
TRUE, // auto toggle back and forth
|
|
||||||
m_peer->GetControlRefAddr() );
|
|
||||||
|
|
||||||
verify_noerr( err );
|
|
||||||
#endif
|
|
||||||
wxASSERT_MSG( m_peer != NULL && m_peer->IsOk() , wxT("No valid Mac control") ) ;
|
|
||||||
|
|
||||||
MacPostControlCreate( pos, size );
|
MacPostControlCreate( pos, size );
|
||||||
// passing the text in the param doesn't seem to work, so lets do if again
|
// passing the text in the param doesn't seem to work, so lets do if again
|
||||||
@@ -118,16 +103,12 @@ bool wxDisclosureTriangle::Create(wxWindow *parent, wxWindowID id, const wxStrin
|
|||||||
|
|
||||||
void wxDisclosureTriangle::SetOpen( bool open )
|
void wxDisclosureTriangle::SetOpen( bool open )
|
||||||
{
|
{
|
||||||
#if wxOSX_USE_CARBON
|
|
||||||
m_peer->SetValue( open ? 1 : 0 );
|
m_peer->SetValue( open ? 1 : 0 );
|
||||||
#endif
|
|
||||||
}
|
}
|
||||||
|
|
||||||
bool wxDisclosureTriangle::IsOpen() const
|
bool wxDisclosureTriangle::IsOpen() const
|
||||||
{
|
{
|
||||||
#if wxOSX_USE_CARBON
|
|
||||||
return m_peer->GetValue() == 1;
|
return m_peer->GetValue() == 1;
|
||||||
#endif
|
|
||||||
}
|
}
|
||||||
|
|
||||||
bool wxDisclosureTriangle::HandleClicked( double timestampsec )
|
bool wxDisclosureTriangle::HandleClicked( double timestampsec )
|
||||||
|
@@ -8,6 +8,13 @@
|
|||||||
<string>org.wxwindows.IDENTIFIER</string>
|
<string>org.wxwindows.IDENTIFIER</string>
|
||||||
<key>CFBundleDevelopmentRegion</key>
|
<key>CFBundleDevelopmentRegion</key>
|
||||||
<string>English</string>
|
<string>English</string>
|
||||||
|
<key>CFBundleLocalizations</key>
|
||||||
|
<array>
|
||||||
|
<string>de</string>
|
||||||
|
<string>en</string>
|
||||||
|
<string>fr</string>
|
||||||
|
<string>it</string>
|
||||||
|
</array>
|
||||||
<key>CFBundleExecutable</key>
|
<key>CFBundleExecutable</key>
|
||||||
<string>EXECUTABLE</string>
|
<string>EXECUTABLE</string>
|
||||||
<key>CFBundleIconFile</key>
|
<key>CFBundleIconFile</key>
|
||||||
@@ -23,11 +30,11 @@
|
|||||||
<key>CFBundleShortVersionString</key>
|
<key>CFBundleShortVersionString</key>
|
||||||
<string>VERSION</string>
|
<string>VERSION</string>
|
||||||
<key>CFBundleGetInfoString</key>
|
<key>CFBundleGetInfoString</key>
|
||||||
<string>EXECUTABLE version VERSION, (c) 2002-2006 wxWidgets</string>
|
<string>EXECUTABLE version VERSION, (c) 2002-2008 wxWidgets</string>
|
||||||
<key>CFBundleLongVersionString</key>
|
<key>CFBundleLongVersionString</key>
|
||||||
<string>VERSION, (c) 2002-2006 wxWidgets</string>
|
<string>VERSION, (c) 2002-2008 wxWidgets</string>
|
||||||
<key>NSHumanReadableCopyright</key>
|
<key>NSHumanReadableCopyright</key>
|
||||||
<string>Copyright 2002-2006 wxWidgets</string>
|
<string>Copyright 2002-2008 wxWidgets</string>
|
||||||
<key>LSRequiresCarbon</key>
|
<key>LSRequiresCarbon</key>
|
||||||
<true/>
|
<true/>
|
||||||
<key>CSResourcesFileMapped</key>
|
<key>CSResourcesFileMapped</key>
|
||||||
|
@@ -61,7 +61,7 @@ void wxAboutBox(const wxAboutDialogInfo& info)
|
|||||||
// Mac native about box currently can show only name, version, copyright
|
// Mac native about box currently can show only name, version, copyright
|
||||||
// and description fields and we also shoehorn the credits text into the
|
// and description fields and we also shoehorn the credits text into the
|
||||||
// description but if we have anything else we must use the generic version
|
// description but if we have anything else we must use the generic version
|
||||||
#if wxOSX_USE_CARBON
|
|
||||||
if ( info.IsSimple() )
|
if ( info.IsSimple() )
|
||||||
{
|
{
|
||||||
AboutBoxOptions opts;
|
AboutBoxOptions opts;
|
||||||
@@ -82,7 +82,6 @@ void wxAboutBox(const wxAboutDialogInfo& info)
|
|||||||
HIAboutBox(opts);
|
HIAboutBox(opts);
|
||||||
}
|
}
|
||||||
else // simple "native" version is not enough
|
else // simple "native" version is not enough
|
||||||
#endif
|
|
||||||
{
|
{
|
||||||
// we need to use the full-blown generic version
|
// we need to use the full-blown generic version
|
||||||
wxGenericAboutBox(info);
|
wxGenericAboutBox(info);
|
||||||
|
@@ -1,5 +1,5 @@
|
|||||||
/////////////////////////////////////////////////////////////////////////////
|
/////////////////////////////////////////////////////////////////////////////
|
||||||
// Name: src/mac/carbon/app.cpp
|
// Name: src/osx/carbon/app.cpp
|
||||||
// Purpose: wxApp
|
// Purpose: wxApp
|
||||||
// Author: Stefan Csomor
|
// Author: Stefan Csomor
|
||||||
// Modified by:
|
// Modified by:
|
||||||
@@ -40,6 +40,7 @@
|
|||||||
#include "wx/filename.h"
|
#include "wx/filename.h"
|
||||||
#include "wx/link.h"
|
#include "wx/link.h"
|
||||||
#include "wx/thread.h"
|
#include "wx/thread.h"
|
||||||
|
#include "wx/evtloop.h"
|
||||||
|
|
||||||
#include <string.h>
|
#include <string.h>
|
||||||
|
|
||||||
@@ -57,13 +58,6 @@
|
|||||||
// Keep linker from discarding wxStockGDIMac
|
// Keep linker from discarding wxStockGDIMac
|
||||||
wxFORCE_LINK_MODULE(gdiobj)
|
wxFORCE_LINK_MODULE(gdiobj)
|
||||||
|
|
||||||
// statics for implementation
|
|
||||||
static bool s_inYield = false;
|
|
||||||
static bool s_inReceiveEvent = false ;
|
|
||||||
#if wxOSX_USE_COCOA_OR_CARBON
|
|
||||||
static EventTime sleepTime = kEventDurationNoWait ;
|
|
||||||
#endif
|
|
||||||
|
|
||||||
IMPLEMENT_DYNAMIC_CLASS(wxApp, wxEvtHandler)
|
IMPLEMENT_DYNAMIC_CLASS(wxApp, wxEvtHandler)
|
||||||
BEGIN_EVENT_TABLE(wxApp, wxEvtHandler)
|
BEGIN_EVENT_TABLE(wxApp, wxEvtHandler)
|
||||||
EVT_IDLE(wxApp::OnIdle)
|
EVT_IDLE(wxApp::OnIdle)
|
||||||
@@ -514,12 +508,12 @@ wxMenu* wxFindMenuFromMacCommand( const HICommand &command , wxMenuItem* &item )
|
|||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
URefCon refCon ;
|
URefCon refCon = NULL ;
|
||||||
|
|
||||||
GetMenuItemRefCon( command.menu.menuRef , command.menu.menuItemIndex , &refCon ) ;
|
GetMenuItemRefCon( command.menu.menuRef , command.menu.menuItemIndex , &refCon ) ;
|
||||||
itemMenu = wxFindMenuFromMacMenu( command.menu.menuRef ) ;
|
itemMenu = wxFindMenuFromMacMenu( command.menu.menuRef ) ;
|
||||||
if ( itemMenu != NULL )
|
if ( itemMenu != NULL && refCon != 0)
|
||||||
item = (wxMenuItem*) refCon ;
|
item = ((wxMenuItemImpl*) refCon)->GetWXPeer() ;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
@@ -569,22 +563,31 @@ wxMacAppMenuEventHandler( EventHandlerCallRef WXUNUSED(handler),
|
|||||||
|
|
||||||
if ( menu )
|
if ( menu )
|
||||||
{
|
{
|
||||||
wxEventType type=0;
|
|
||||||
MenuCommand cmd=0;
|
|
||||||
switch (GetEventKind(event))
|
switch (GetEventKind(event))
|
||||||
{
|
{
|
||||||
case kEventMenuOpening:
|
case kEventMenuOpening:
|
||||||
type = wxEVT_MENU_OPEN;
|
menu->HandleMenuOpened();
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case kEventMenuClosed:
|
case kEventMenuClosed:
|
||||||
type = wxEVT_MENU_CLOSE;
|
menu->HandleMenuClosed();
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case kEventMenuTargetItem:
|
case kEventMenuTargetItem:
|
||||||
cmd = cEvent.GetParameter<MenuCommand>(kEventParamMenuCommand,typeMenuCommand) ;
|
{
|
||||||
if (cmd != 0)
|
HICommand command ;
|
||||||
type = wxEVT_MENU_HIGHLIGHT;
|
|
||||||
|
command.menu.menuRef = menuRef;
|
||||||
|
command.menu.menuItemIndex = cEvent.GetParameter<MenuItemIndex>(kEventParamMenuItemIndex,typeMenuItemIndex) ;
|
||||||
|
command.commandID = cEvent.GetParameter<MenuCommand>(kEventParamMenuCommand,typeMenuCommand) ;
|
||||||
|
if (command.commandID != 0)
|
||||||
|
{
|
||||||
|
wxMenuItem* item = NULL ;
|
||||||
|
wxMenu* itemMenu = wxFindMenuFromMacCommand( command , item ) ;
|
||||||
|
if ( itemMenu && item )
|
||||||
|
itemMenu->HandleMenuItemHighlighted( item );
|
||||||
|
}
|
||||||
|
}
|
||||||
break;
|
break;
|
||||||
|
|
||||||
default:
|
default:
|
||||||
@@ -592,23 +595,6 @@ wxMacAppMenuEventHandler( EventHandlerCallRef WXUNUSED(handler),
|
|||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
if ( type )
|
|
||||||
{
|
|
||||||
wxMenuEvent wxevent(type, cmd, menu);
|
|
||||||
wxevent.SetEventObject(menu);
|
|
||||||
|
|
||||||
wxEvtHandler* handler = menu->GetEventHandler();
|
|
||||||
if (handler && handler->ProcessEvent(wxevent))
|
|
||||||
{
|
|
||||||
// handled
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
wxWindow *win = menu->GetInvokingWindow();
|
|
||||||
if (win)
|
|
||||||
win->HandleWindowEvent(wxevent);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
return eventNotHandledErr;
|
return eventNotHandledErr;
|
||||||
@@ -628,7 +614,6 @@ wxMacAppCommandEventHandler( EventHandlerCallRef WXUNUSED(handler) ,
|
|||||||
|
|
||||||
wxMenuItem* item = NULL ;
|
wxMenuItem* item = NULL ;
|
||||||
wxMenu* itemMenu = wxFindMenuFromMacCommand( command , item ) ;
|
wxMenu* itemMenu = wxFindMenuFromMacCommand( command , item ) ;
|
||||||
int id = wxMacCommandToId( command.commandID ) ;
|
|
||||||
|
|
||||||
if ( item )
|
if ( item )
|
||||||
{
|
{
|
||||||
@@ -637,11 +622,13 @@ wxMacAppCommandEventHandler( EventHandlerCallRef WXUNUSED(handler) ,
|
|||||||
switch ( cEvent.GetKind() )
|
switch ( cEvent.GetKind() )
|
||||||
{
|
{
|
||||||
case kEventProcessCommand :
|
case kEventProcessCommand :
|
||||||
result = itemMenu->MacHandleCommandProcess( item, id );
|
if ( itemMenu->HandleCommandProcess( item ) )
|
||||||
|
result = noErr;
|
||||||
break ;
|
break ;
|
||||||
|
|
||||||
case kEventCommandUpdateStatus:
|
case kEventCommandUpdateStatus:
|
||||||
result = itemMenu->MacHandleCommandUpdateStatus( item, id );
|
if ( itemMenu->HandleCommandUpdateStatus( item ) )
|
||||||
|
result = noErr;
|
||||||
break ;
|
break ;
|
||||||
|
|
||||||
default :
|
default :
|
||||||
@@ -843,21 +830,43 @@ bool wxApp::Initialize(int& argc, wxChar **argv)
|
|||||||
|
|
||||||
/* connect posted events to common-mode run loop so that wxPostEvent events
|
/* connect posted events to common-mode run loop so that wxPostEvent events
|
||||||
are handled even while we're in the menu or on a scrollbar */
|
are handled even while we're in the menu or on a scrollbar */
|
||||||
|
/*
|
||||||
CFRunLoopSourceContext event_posted_context = {0};
|
CFRunLoopSourceContext event_posted_context = {0};
|
||||||
event_posted_context.perform = macPostedEventCallback;
|
event_posted_context.perform = macPostedEventCallback;
|
||||||
m_macEventPosted = CFRunLoopSourceCreate(NULL,0,&event_posted_context);
|
m_macEventPosted = CFRunLoopSourceCreate(NULL,0,&event_posted_context);
|
||||||
CFRunLoopAddSource(CFRunLoopGetCurrent(), m_macEventPosted, kCFRunLoopCommonModes);
|
CFRunLoopAddSource(CFRunLoopGetCurrent(), m_macEventPosted, kCFRunLoopCommonModes);
|
||||||
// run loop takes ownership
|
// run loop takes ownership
|
||||||
CFRelease(m_macEventPosted);
|
CFRelease(m_macEventPosted);
|
||||||
|
*/
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
bool wxApp::CallOnInit()
|
||||||
|
{
|
||||||
|
wxMacAutoreleasePool autoreleasepool;
|
||||||
|
return OnInit();
|
||||||
|
}
|
||||||
|
|
||||||
bool wxApp::OnInitGui()
|
bool wxApp::OnInitGui()
|
||||||
{
|
{
|
||||||
if ( !wxAppBase::OnInitGui() )
|
if ( !wxAppBase::OnInitGui() )
|
||||||
return false ;
|
return false ;
|
||||||
|
|
||||||
|
if ( !DoInitGui() )
|
||||||
|
return false;
|
||||||
|
|
||||||
|
return true ;
|
||||||
|
}
|
||||||
|
|
||||||
|
bool wxApp::ProcessIdle()
|
||||||
|
{
|
||||||
|
wxMacAutoreleasePool autoreleasepool;
|
||||||
|
return wxAppBase::ProcessIdle();
|
||||||
|
}
|
||||||
|
|
||||||
#if wxOSX_USE_CARBON
|
#if wxOSX_USE_CARBON
|
||||||
|
bool wxApp::DoInitGui()
|
||||||
|
{
|
||||||
InstallStandardEventHandler( GetApplicationEventTarget() ) ;
|
InstallStandardEventHandler( GetApplicationEventTarget() ) ;
|
||||||
if (!sm_isEmbedded)
|
if (!sm_isEmbedded)
|
||||||
{
|
{
|
||||||
@@ -865,9 +874,7 @@ bool wxApp::OnInitGui()
|
|||||||
GetwxMacAppEventHandlerUPP(),
|
GetwxMacAppEventHandlerUPP(),
|
||||||
GetEventTypeCount(eventList), eventList, wxTheApp, (EventHandlerRef *)&(wxTheApp->m_macEventHandler));
|
GetEventTypeCount(eventList), eventList, wxTheApp, (EventHandlerRef *)&(wxTheApp->m_macEventHandler));
|
||||||
}
|
}
|
||||||
#endif
|
|
||||||
|
|
||||||
#if wxOSX_USE_COCOA_OR_CARBON
|
|
||||||
if (!sm_isEmbedded)
|
if (!sm_isEmbedded)
|
||||||
{
|
{
|
||||||
sODocHandler = NewAEEventHandlerUPP(AEHandleODoc) ;
|
sODocHandler = NewAEEventHandlerUPP(AEHandleODoc) ;
|
||||||
@@ -890,32 +897,15 @@ bool wxApp::OnInitGui()
|
|||||||
AEInstallEventHandler( kCoreEventClass , kAEQuitApplication ,
|
AEInstallEventHandler( kCoreEventClass , kAEQuitApplication ,
|
||||||
sQuitHandler , 0 , FALSE ) ;
|
sQuitHandler , 0 , FALSE ) ;
|
||||||
}
|
}
|
||||||
#endif
|
|
||||||
#if wxOSX_USE_CARBON
|
|
||||||
if ( !wxMacInitCocoa() )
|
if ( !wxMacInitCocoa() )
|
||||||
return false;
|
return false;
|
||||||
#endif
|
|
||||||
|
|
||||||
return true ;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
void wxApp::CleanUp()
|
void wxApp::DoCleanUp()
|
||||||
{
|
{
|
||||||
#if wxUSE_TOOLTIPS
|
|
||||||
wxToolTip::RemoveToolTips() ;
|
|
||||||
#endif
|
|
||||||
|
|
||||||
if (m_macEventPosted)
|
|
||||||
{
|
|
||||||
CFRunLoopRemoveSource(CFRunLoopGetCurrent(), m_macEventPosted, kCFRunLoopCommonModes);
|
|
||||||
m_macEventPosted = NULL;
|
|
||||||
}
|
|
||||||
|
|
||||||
// One last chance for pending objects to be cleaned up
|
|
||||||
wxTheApp->DeletePendingObjects();
|
|
||||||
|
|
||||||
#if wxOSX_USE_COCOA_OR_CARBON
|
|
||||||
|
|
||||||
if (!sm_isEmbedded)
|
if (!sm_isEmbedded)
|
||||||
RemoveEventHandler( (EventHandlerRef)(wxTheApp->m_macEventHandler) );
|
RemoveEventHandler( (EventHandlerRef)(wxTheApp->m_macEventHandler) );
|
||||||
|
|
||||||
@@ -941,9 +931,24 @@ void wxApp::CleanUp()
|
|||||||
DisposeAEEventHandlerUPP( sRAppHandler ) ;
|
DisposeAEEventHandlerUPP( sRAppHandler ) ;
|
||||||
DisposeAEEventHandlerUPP( sQuitHandler ) ;
|
DisposeAEEventHandlerUPP( sQuitHandler ) ;
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
void wxApp::CleanUp()
|
||||||
|
{
|
||||||
|
#if wxUSE_TOOLTIPS
|
||||||
|
wxToolTip::RemoveToolTips() ;
|
||||||
|
#endif
|
||||||
|
|
||||||
|
if (m_macEventPosted)
|
||||||
|
{
|
||||||
|
CFRunLoopRemoveSource(CFRunLoopGetCurrent(), m_macEventPosted, kCFRunLoopCommonModes);
|
||||||
|
m_macEventPosted = NULL;
|
||||||
|
}
|
||||||
|
|
||||||
|
DoCleanUp();
|
||||||
|
|
||||||
wxAppBase::CleanUp();
|
wxAppBase::CleanUp();
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -1052,15 +1057,31 @@ wxApp::wxApp()
|
|||||||
m_macEventPosted = NULL ;
|
m_macEventPosted = NULL ;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
CFMutableArrayRef GetAutoReleaseArray()
|
||||||
|
{
|
||||||
|
static CFMutableArrayRef array = 0;
|
||||||
|
if ( array == 0)
|
||||||
|
array= CFArrayCreateMutable(kCFAllocatorDefault,0,&kCFTypeArrayCallBacks);
|
||||||
|
return array;
|
||||||
|
}
|
||||||
|
|
||||||
|
void wxApp::MacAddToAutorelease( void* cfrefobj )
|
||||||
|
{
|
||||||
|
CFArrayAppendValue( GetAutoReleaseArray(), cfrefobj );
|
||||||
|
}
|
||||||
|
|
||||||
void wxApp::OnIdle(wxIdleEvent& WXUNUSED(event))
|
void wxApp::OnIdle(wxIdleEvent& WXUNUSED(event))
|
||||||
{
|
{
|
||||||
// If they are pending events, we must process them: pending events are
|
// If they are pending events, we must process them: pending events are
|
||||||
// either events to the threads other than main or events posted with
|
// either events to the threads other than main or events posted with
|
||||||
// wxPostEvent() functions
|
// wxPostEvent() functions
|
||||||
#ifndef __WXUNIVERSAL__
|
#ifndef __WXUNIVERSAL__
|
||||||
|
#if wxUSE_MENU
|
||||||
if (!wxMenuBar::MacGetInstalledMenuBar() && wxMenuBar::MacGetCommonMenuBar())
|
if (!wxMenuBar::MacGetInstalledMenuBar() && wxMenuBar::MacGetCommonMenuBar())
|
||||||
wxMenuBar::MacGetCommonMenuBar()->MacInstallMenuBar();
|
wxMenuBar::MacGetCommonMenuBar()->MacInstallMenuBar();
|
||||||
#endif
|
#endif
|
||||||
|
#endif
|
||||||
|
CFArrayRemoveAllValues( GetAutoReleaseArray() );
|
||||||
}
|
}
|
||||||
|
|
||||||
void wxApp::WakeUpIdle()
|
void wxApp::WakeUpIdle()
|
||||||
@@ -1100,6 +1121,17 @@ void wxCYield()
|
|||||||
|
|
||||||
bool wxApp::Yield(bool onlyIfNeeded)
|
bool wxApp::Yield(bool onlyIfNeeded)
|
||||||
{
|
{
|
||||||
|
#if wxUSE_THREADS
|
||||||
|
// Yielding from a non-gui thread needs to bail out, otherwise we end up
|
||||||
|
// possibly sending events in the thread too.
|
||||||
|
if ( !wxThread::IsMain() )
|
||||||
|
{
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
#endif // wxUSE_THREADS
|
||||||
|
|
||||||
|
static bool s_inYield = false;
|
||||||
|
|
||||||
if (s_inYield)
|
if (s_inYield)
|
||||||
{
|
{
|
||||||
if ( !onlyIfNeeded )
|
if ( !onlyIfNeeded )
|
||||||
@@ -1110,147 +1142,43 @@ bool wxApp::Yield(bool onlyIfNeeded)
|
|||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
#if wxUSE_THREADS
|
|
||||||
// Yielding from a non-gui thread needs to bail out, otherwise we end up
|
|
||||||
// possibly sending events in the thread too.
|
|
||||||
if ( !wxThread::IsMain() )
|
|
||||||
{
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
#endif // wxUSE_THREADS
|
|
||||||
|
|
||||||
s_inYield = true;
|
s_inYield = true;
|
||||||
|
|
||||||
// by definition yield should handle all non-processed events
|
#if wxUSE_LOG
|
||||||
|
// disable log flushing from here because a call to wxYield() shouldn't
|
||||||
|
// normally result in message boxes popping up &c
|
||||||
|
wxLog::Suspend();
|
||||||
|
#endif // wxUSE_LOG
|
||||||
|
|
||||||
#if wxOSX_USE_COCOA_OR_CARBON
|
wxEventLoop * const
|
||||||
|
loop = wx_static_cast(wxEventLoop *, wxEventLoop::GetActive());
|
||||||
EventRef theEvent;
|
if ( loop )
|
||||||
|
|
||||||
OSStatus status = noErr ;
|
|
||||||
|
|
||||||
while ( status == noErr )
|
|
||||||
{
|
{
|
||||||
s_inReceiveEvent = true ;
|
// process all pending events:
|
||||||
status = ReceiveNextEvent(0, NULL,kEventDurationNoWait,true,&theEvent) ;
|
while ( loop->Pending() )
|
||||||
s_inReceiveEvent = false ;
|
loop->Dispatch();
|
||||||
|
|
||||||
if ( status == eventLoopTimedOutErr )
|
|
||||||
{
|
|
||||||
// make sure next time the event loop will trigger idle events
|
|
||||||
sleepTime = kEventDurationNoWait ;
|
|
||||||
}
|
|
||||||
else if ( status == eventLoopQuitErr )
|
|
||||||
{
|
|
||||||
// according to QA1061 this may also occur when a WakeUp Process
|
|
||||||
// is executed
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
MacHandleOneEvent( theEvent ) ;
|
|
||||||
ReleaseEvent(theEvent);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
#else
|
// it's necessary to call ProcessIdle() to update the frames sizes which
|
||||||
|
// might have been changed (it also will update other things set from
|
||||||
#endif
|
// OnUpdateUI() which is a nice (and desired) side effect)
|
||||||
|
while ( ProcessIdle() ) {}
|
||||||
|
|
||||||
|
#if wxUSE_LOG
|
||||||
|
wxLog::Resume();
|
||||||
|
#endif // wxUSE_LOG
|
||||||
s_inYield = false;
|
s_inYield = false;
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
void wxApp::MacDoOneEvent()
|
|
||||||
{
|
|
||||||
#if wxOSX_USE_COCOA_OR_CARBON
|
|
||||||
wxMacAutoreleasePool autoreleasepool;
|
|
||||||
EventRef theEvent;
|
|
||||||
|
|
||||||
s_inReceiveEvent = true ;
|
|
||||||
OSStatus status = ReceiveNextEvent(0, NULL, sleepTime, true, &theEvent) ;
|
|
||||||
s_inReceiveEvent = false ;
|
|
||||||
|
|
||||||
switch (status)
|
|
||||||
{
|
|
||||||
case eventLoopTimedOutErr :
|
|
||||||
if ( wxTheApp->ProcessIdle() )
|
|
||||||
sleepTime = kEventDurationNoWait ;
|
|
||||||
else
|
|
||||||
{
|
|
||||||
sleepTime = kEventDurationSecond;
|
|
||||||
#if wxUSE_THREADS
|
|
||||||
wxMutexGuiLeave();
|
|
||||||
wxMilliSleep(20);
|
|
||||||
wxMutexGuiEnter();
|
|
||||||
#endif
|
|
||||||
}
|
|
||||||
break;
|
|
||||||
|
|
||||||
case eventLoopQuitErr :
|
|
||||||
// according to QA1061 this may also occur
|
|
||||||
// when a WakeUp Process is executed
|
|
||||||
break;
|
|
||||||
|
|
||||||
default:
|
|
||||||
MacHandleOneEvent( theEvent ) ;
|
|
||||||
ReleaseEvent( theEvent );
|
|
||||||
sleepTime = kEventDurationNoWait ;
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
// repeaters
|
|
||||||
#else
|
|
||||||
#endif
|
|
||||||
DeletePendingObjects() ;
|
|
||||||
}
|
|
||||||
|
|
||||||
// virtual
|
// virtual
|
||||||
void wxApp::MacHandleUnhandledEvent( WXEVENTREF WXUNUSED(evr) )
|
void wxApp::MacHandleUnhandledEvent( WXEVENTREF WXUNUSED(evr) )
|
||||||
{
|
{
|
||||||
// Override to process unhandled events as you please
|
// Override to process unhandled events as you please
|
||||||
}
|
}
|
||||||
|
|
||||||
CFMutableArrayRef GetAutoReleaseArray()
|
#if wxOSX_USE_CARBON
|
||||||
{
|
|
||||||
static CFMutableArrayRef array = 0;
|
|
||||||
if ( array == 0)
|
|
||||||
array= CFArrayCreateMutable(kCFAllocatorDefault,0,&kCFTypeArrayCallBacks);
|
|
||||||
return array;
|
|
||||||
}
|
|
||||||
|
|
||||||
//
|
|
||||||
//
|
|
||||||
//
|
|
||||||
|
|
||||||
|
|
||||||
//
|
|
||||||
//
|
|
||||||
//
|
|
||||||
|
|
||||||
void wxApp::MacHandleOneEvent( WXEVENTREF evr )
|
|
||||||
{
|
|
||||||
#if wxOSX_USE_COCOA_OR_CARBON
|
|
||||||
EventTargetRef theTarget;
|
|
||||||
theTarget = GetEventDispatcherTarget();
|
|
||||||
m_macCurrentEvent = evr ;
|
|
||||||
|
|
||||||
OSStatus status = SendEventToEventTarget((EventRef) evr , theTarget);
|
|
||||||
if (status == eventNotHandledErr)
|
|
||||||
MacHandleUnhandledEvent(evr);
|
|
||||||
#else
|
|
||||||
// TODO Threads
|
|
||||||
#endif
|
|
||||||
|
|
||||||
|
|
||||||
CFArrayRemoveAllValues( GetAutoReleaseArray() );
|
|
||||||
}
|
|
||||||
|
|
||||||
void wxApp::MacAddToAutorelease( void* cfrefobj )
|
|
||||||
{
|
|
||||||
CFArrayAppendValue( GetAutoReleaseArray(), cfrefobj );
|
|
||||||
}
|
|
||||||
|
|
||||||
#if wxOSX_USE_COCOA_OR_CARBON
|
|
||||||
|
|
||||||
long wxMacTranslateKey(unsigned char key, unsigned char code)
|
long wxMacTranslateKey(unsigned char key, unsigned char code)
|
||||||
{
|
{
|
||||||
@@ -1422,12 +1350,12 @@ int wxMacKeyCodeToModifier(wxKeyCode key)
|
|||||||
wxMouseState wxGetMouseState()
|
wxMouseState wxGetMouseState()
|
||||||
{
|
{
|
||||||
wxMouseState ms;
|
wxMouseState ms;
|
||||||
#if wxOSX_USE_COCOA_OR_CARBON
|
|
||||||
|
|
||||||
wxPoint pt = wxGetMousePosition();
|
wxPoint pt = wxGetMousePosition();
|
||||||
ms.SetX(pt.x);
|
ms.SetX(pt.x);
|
||||||
ms.SetY(pt.y);
|
ms.SetY(pt.y);
|
||||||
|
|
||||||
|
#if wxOSX_USE_CARBON
|
||||||
UInt32 buttons = GetCurrentButtonState();
|
UInt32 buttons = GetCurrentButtonState();
|
||||||
ms.SetLeftDown( (buttons & 0x01) != 0 );
|
ms.SetLeftDown( (buttons & 0x01) != 0 );
|
||||||
ms.SetMiddleDown( (buttons & 0x04) != 0 );
|
ms.SetMiddleDown( (buttons & 0x04) != 0 );
|
||||||
@@ -1438,7 +1366,8 @@ wxMouseState wxGetMouseState()
|
|||||||
ms.SetShiftDown(modifiers & shiftKey);
|
ms.SetShiftDown(modifiers & shiftKey);
|
||||||
ms.SetAltDown(modifiers & optionKey);
|
ms.SetAltDown(modifiers & optionKey);
|
||||||
ms.SetMetaDown(modifiers & cmdKey);
|
ms.SetMetaDown(modifiers & cmdKey);
|
||||||
|
#else
|
||||||
|
// TODO
|
||||||
#endif
|
#endif
|
||||||
return ms;
|
return ms;
|
||||||
}
|
}
|
||||||
@@ -1598,7 +1527,7 @@ bool wxApp::MacSendCharEvent( wxWindow* focus , long keymessage , long modifiers
|
|||||||
// This method handles common code for SendKeyDown, SendKeyUp, and SendChar events.
|
// This method handles common code for SendKeyDown, SendKeyUp, and SendChar events.
|
||||||
void wxApp::MacCreateKeyEvent( wxKeyEvent& event, wxWindow* focus , long keymessage , long modifiers , long when , short wherex , short wherey , wxChar uniChar )
|
void wxApp::MacCreateKeyEvent( wxKeyEvent& event, wxWindow* focus , long keymessage , long modifiers , long when , short wherex , short wherey , wxChar uniChar )
|
||||||
{
|
{
|
||||||
#if wxOSX_USE_COCOA_OR_CARBON
|
#if wxOSX_USE_CARBON
|
||||||
short keycode, keychar ;
|
short keycode, keychar ;
|
||||||
|
|
||||||
keychar = short(keymessage & charCodeMask);
|
keychar = short(keymessage & charCodeMask);
|
||||||
|
@@ -1,5 +1,5 @@
|
|||||||
/////////////////////////////////////////////////////////////////////////////
|
/////////////////////////////////////////////////////////////////////////////
|
||||||
// Name: src/mac/carbon/bmpbuttn.cpp
|
// Name: src/osx/carbon/bmpbuttn.cpp
|
||||||
// Purpose: wxBitmapButton
|
// Purpose: wxBitmapButton
|
||||||
// Author: Stefan Csomor
|
// Author: Stefan Csomor
|
||||||
// Modified by:
|
// Modified by:
|
||||||
@@ -20,9 +20,7 @@
|
|||||||
#include "wx/dcmemory.h"
|
#include "wx/dcmemory.h"
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
IMPLEMENT_DYNAMIC_CLASS(wxBitmapButton, wxButton)
|
#include "wx/osx/private.h"
|
||||||
|
|
||||||
#include "wx/osx/uma.h"
|
|
||||||
|
|
||||||
//---------------------------------------------------------------------------
|
//---------------------------------------------------------------------------
|
||||||
// Helper functions
|
// Helper functions
|
||||||
@@ -79,111 +77,88 @@ static wxBitmap wxMakeStdSizeBitmap(const wxBitmap& bitmap)
|
|||||||
|
|
||||||
//---------------------------------------------------------------------------
|
//---------------------------------------------------------------------------
|
||||||
|
|
||||||
bool wxBitmapButton::Create( wxWindow *parent,
|
class wxMacBitmapButton : public wxMacControl
|
||||||
wxWindowID id, const wxBitmap& bitmap,
|
|
||||||
const wxPoint& pos,
|
|
||||||
const wxSize& size,
|
|
||||||
long style,
|
|
||||||
const wxValidator& validator,
|
|
||||||
const wxString& name )
|
|
||||||
{
|
{
|
||||||
m_macIsUserPane = false;
|
public:
|
||||||
|
wxMacBitmapButton( wxWindowMac* peer ) : wxMacControl(peer)
|
||||||
// since bitmapbuttonbase is subclass of button calling wxBitmapButtonBase::Create
|
|
||||||
// essentially creates an additional button
|
|
||||||
if ( !wxControl::Create( parent, id, pos, size, style, validator, name ) )
|
|
||||||
return false;
|
|
||||||
|
|
||||||
if ( style & wxBU_AUTODRAW )
|
|
||||||
{
|
{
|
||||||
m_marginX =
|
|
||||||
m_marginY = wxDEFAULT_BUTTON_MARGIN;
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
m_marginX =
|
|
||||||
m_marginY = 0;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void SetBitmap(const wxBitmap& bitmap)
|
||||||
|
{
|
||||||
|
wxBitmap bmp;
|
||||||
|
if ( GetWXPeer()->HasFlag( wxBORDER_NONE ) )
|
||||||
|
{
|
||||||
|
bmp = wxMakeStdSizeBitmap(bitmap);
|
||||||
|
// TODO set bitmap in peer as well
|
||||||
|
}
|
||||||
|
else
|
||||||
|
bmp = bitmap;
|
||||||
|
|
||||||
|
ControlButtonContentInfo info;
|
||||||
|
|
||||||
|
if ( GetWXPeer()->HasFlag( wxBORDER_NONE ) )
|
||||||
|
{
|
||||||
|
wxMacCreateBitmapButton( &info, bmp, kControlContentIconRef );
|
||||||
|
if ( info.contentType != kControlNoContent )
|
||||||
|
SetData( kControlIconPart, kControlIconContentTag, info );
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
wxMacCreateBitmapButton( &info, bmp );
|
||||||
|
if ( info.contentType != kControlNoContent )
|
||||||
|
SetData( kControlButtonPart, kControlBevelButtonContentTag, info );
|
||||||
|
}
|
||||||
|
|
||||||
|
wxMacReleaseBitmapButton( &info );
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
|
wxWidgetImplType* wxWidgetImpl::CreateBitmapButton( wxWindowMac* wxpeer,
|
||||||
|
wxWindowMac* parent,
|
||||||
|
wxWindowID id,
|
||||||
|
const wxBitmap& bitmap,
|
||||||
|
const wxPoint& pos,
|
||||||
|
const wxSize& size,
|
||||||
|
long style,
|
||||||
|
long extraStyle)
|
||||||
|
{
|
||||||
OSStatus err = noErr;
|
OSStatus err = noErr;
|
||||||
ControlButtonContentInfo info;
|
ControlButtonContentInfo info;
|
||||||
|
|
||||||
Rect bounds = wxMacGetBoundsForControl( this, pos, size );
|
Rect bounds = wxMacGetBoundsForControl( wxpeer, pos, size );
|
||||||
m_peer = new wxMacControl( this );
|
wxMacControl* peer = new wxMacBitmapButton( wxpeer );
|
||||||
|
wxBitmap bmp;
|
||||||
|
|
||||||
if ( bitmap.Ok() && HasFlag(wxBORDER_NONE) )
|
if ( bitmap.Ok() && (style & wxBORDER_NONE) )
|
||||||
m_bmpNormal = wxMakeStdSizeBitmap(bitmap);
|
{
|
||||||
|
bmp = wxMakeStdSizeBitmap(bitmap);
|
||||||
|
// TODO set bitmap in peer as well
|
||||||
|
}
|
||||||
else
|
else
|
||||||
m_bmpNormal = bitmap;
|
bmp = bitmap;
|
||||||
|
|
||||||
|
|
||||||
if ( HasFlag( wxBORDER_NONE ) )
|
if ( style & wxBORDER_NONE )
|
||||||
{
|
{
|
||||||
// contrary to the docs this control only works with iconrefs
|
// contrary to the docs this control only works with iconrefs
|
||||||
wxMacCreateBitmapButton( &info, m_bmpNormal, kControlContentIconRef );
|
wxMacCreateBitmapButton( &info, bmp, kControlContentIconRef );
|
||||||
err = CreateIconControl(
|
err = CreateIconControl(
|
||||||
MAC_WXHWND(parent->MacGetTopLevelWindowRef()),
|
MAC_WXHWND(parent->MacGetTopLevelWindowRef()),
|
||||||
&bounds, &info, false, m_peer->GetControlRefAddr() );
|
&bounds, &info, false, peer->GetControlRefAddr() );
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
wxMacCreateBitmapButton( &info, m_bmpNormal );
|
wxMacCreateBitmapButton( &info, bmp );
|
||||||
err = CreateBevelButtonControl(
|
err = CreateBevelButtonControl(
|
||||||
MAC_WXHWND(parent->MacGetTopLevelWindowRef()), &bounds, CFSTR(""),
|
MAC_WXHWND(parent->MacGetTopLevelWindowRef()), &bounds, CFSTR(""),
|
||||||
((style & wxBU_AUTODRAW) ? kControlBevelButtonSmallBevel : kControlBevelButtonNormalBevel ),
|
((style & wxBU_AUTODRAW) ? kControlBevelButtonSmallBevel : kControlBevelButtonNormalBevel ),
|
||||||
kControlBehaviorOffsetContents, &info, 0, 0, 0, m_peer->GetControlRefAddr() );
|
kControlBehaviorOffsetContents, &info, 0, 0, 0, peer->GetControlRefAddr() );
|
||||||
}
|
}
|
||||||
|
|
||||||
verify_noerr( err );
|
verify_noerr( err );
|
||||||
|
|
||||||
wxMacReleaseBitmapButton( &info );
|
wxMacReleaseBitmapButton( &info );
|
||||||
wxASSERT_MSG( m_peer != NULL && m_peer->IsOk(), wxT("No valid native Mac control") );
|
return peer;
|
||||||
|
|
||||||
MacPostControlCreate( pos, size );
|
|
||||||
|
|
||||||
return true;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void wxBitmapButton::SetBitmapLabel( const wxBitmap& bitmap )
|
|
||||||
{
|
|
||||||
if ( HasFlag( wxBORDER_NONE ) )
|
|
||||||
m_bmpNormal = wxMakeStdSizeBitmap(bitmap);
|
|
||||||
else
|
|
||||||
m_bmpNormal = bitmap;
|
|
||||||
|
|
||||||
InvalidateBestSize();
|
|
||||||
|
|
||||||
ControlButtonContentInfo info;
|
|
||||||
|
|
||||||
if ( HasFlag( wxBORDER_NONE ) )
|
|
||||||
{
|
|
||||||
wxMacCreateBitmapButton( &info, m_bmpNormal, kControlContentIconRef );
|
|
||||||
if ( info.contentType != kControlNoContent )
|
|
||||||
m_peer->SetData( kControlIconPart, kControlIconContentTag, info );
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
wxMacCreateBitmapButton( &info, m_bmpNormal );
|
|
||||||
if ( info.contentType != kControlNoContent )
|
|
||||||
m_peer->SetData( kControlButtonPart, kControlBevelButtonContentTag, info );
|
|
||||||
}
|
|
||||||
|
|
||||||
wxMacReleaseBitmapButton( &info );
|
|
||||||
}
|
|
||||||
|
|
||||||
wxSize wxBitmapButton::DoGetBestSize() const
|
|
||||||
{
|
|
||||||
wxSize best;
|
|
||||||
|
|
||||||
best.x = 2 * m_marginX;
|
|
||||||
best.y = 2 * m_marginY;
|
|
||||||
if ( m_bmpNormal.Ok() )
|
|
||||||
{
|
|
||||||
best.x += m_bmpNormal.GetWidth();
|
|
||||||
best.y += m_bmpNormal.GetHeight();
|
|
||||||
}
|
|
||||||
|
|
||||||
return best;
|
|
||||||
}
|
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
@@ -1,5 +1,5 @@
|
|||||||
/////////////////////////////////////////////////////////////////////////////
|
/////////////////////////////////////////////////////////////////////////////
|
||||||
// Name: src/mac/carbon/button.cpp
|
// Name: src/osx/carbon/button.cpp
|
||||||
// Purpose: wxButton
|
// Purpose: wxButton
|
||||||
// Author: Stefan Csomor
|
// Author: Stefan Csomor
|
||||||
// Modified by:
|
// Modified by:
|
||||||
@@ -21,98 +21,11 @@
|
|||||||
|
|
||||||
#include "wx/stockitem.h"
|
#include "wx/stockitem.h"
|
||||||
|
|
||||||
#include "wx/osx/uma.h"
|
#include "wx/osx/private.h"
|
||||||
|
|
||||||
IMPLEMENT_DYNAMIC_CLASS(wxButton, wxControl)
|
//
|
||||||
|
//
|
||||||
|
//
|
||||||
bool wxButton::Create(wxWindow *parent,
|
|
||||||
wxWindowID id,
|
|
||||||
const wxString& lbl,
|
|
||||||
const wxPoint& pos,
|
|
||||||
const wxSize& size,
|
|
||||||
long style,
|
|
||||||
const wxValidator& validator,
|
|
||||||
const wxString& name)
|
|
||||||
{
|
|
||||||
wxString label(lbl);
|
|
||||||
if (label.empty() && wxIsStockID(id))
|
|
||||||
label = wxGetStockLabel(id);
|
|
||||||
|
|
||||||
m_macIsUserPane = false ;
|
|
||||||
|
|
||||||
if ( !wxButtonBase::Create(parent, id, pos, size, style, validator, name) )
|
|
||||||
return false;
|
|
||||||
|
|
||||||
m_labelOrig = m_label = label ;
|
|
||||||
|
|
||||||
OSStatus err;
|
|
||||||
Rect bounds = wxMacGetBoundsForControl( this , pos , size ) ;
|
|
||||||
m_peer = new wxMacControl(this) ;
|
|
||||||
if ( id == wxID_HELP )
|
|
||||||
{
|
|
||||||
ControlButtonContentInfo info ;
|
|
||||||
info.contentType = kControlContentIconRef ;
|
|
||||||
GetIconRef(kOnSystemDisk, kSystemIconsCreator, kHelpIcon, &info.u.iconRef);
|
|
||||||
err = CreateRoundButtonControl(
|
|
||||||
MAC_WXHWND(parent->MacGetTopLevelWindowRef()),
|
|
||||||
&bounds, kControlRoundButtonNormalSize,
|
|
||||||
&info, m_peer->GetControlRefAddr() );
|
|
||||||
}
|
|
||||||
else if ( label.Find('\n' ) == wxNOT_FOUND && label.Find('\r' ) == wxNOT_FOUND)
|
|
||||||
{
|
|
||||||
// Button height is static in Mac, can't be changed, so we need to force it here
|
|
||||||
if ( GetWindowVariant() == wxWINDOW_VARIANT_NORMAL || GetWindowVariant() == wxWINDOW_VARIANT_LARGE )
|
|
||||||
{
|
|
||||||
bounds.bottom = bounds.top + 20 ;
|
|
||||||
m_maxHeight = 20 ;
|
|
||||||
}
|
|
||||||
else if ( GetWindowVariant() == wxWINDOW_VARIANT_SMALL )
|
|
||||||
{
|
|
||||||
bounds.bottom = bounds.top + 17 ;
|
|
||||||
m_maxHeight = 17 ;
|
|
||||||
}
|
|
||||||
else if ( GetWindowVariant() == wxWINDOW_VARIANT_MINI )
|
|
||||||
{
|
|
||||||
bounds.bottom = bounds.top + 15 ;
|
|
||||||
m_maxHeight = 15 ;
|
|
||||||
}
|
|
||||||
err = CreatePushButtonControl(
|
|
||||||
MAC_WXHWND(parent->MacGetTopLevelWindowRef()),
|
|
||||||
&bounds, CFSTR(""), m_peer->GetControlRefAddr() );
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
ControlButtonContentInfo info ;
|
|
||||||
info.contentType = kControlNoContent ;
|
|
||||||
err = CreateBevelButtonControl(
|
|
||||||
MAC_WXHWND(parent->MacGetTopLevelWindowRef()) , &bounds, CFSTR(""),
|
|
||||||
kControlBevelButtonLargeBevel, kControlBehaviorPushbutton,
|
|
||||||
&info, 0, 0, 0, m_peer->GetControlRefAddr() );
|
|
||||||
}
|
|
||||||
|
|
||||||
verify_noerr( err );
|
|
||||||
wxASSERT_MSG( m_peer != NULL && m_peer->IsOk() , wxT("No valid Mac control") ) ;
|
|
||||||
|
|
||||||
MacPostControlCreate( pos, size );
|
|
||||||
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
|
|
||||||
wxWindow *wxButton::SetDefault()
|
|
||||||
{
|
|
||||||
wxWindow *btnOldDefault = wxButtonBase::SetDefault();
|
|
||||||
|
|
||||||
if ( btnOldDefault )
|
|
||||||
{
|
|
||||||
// cast needed to access the protected member
|
|
||||||
btnOldDefault->GetPeer()->SetData(kControlButtonPart , kControlPushButtonDefaultTag , (Boolean) 0 ) ;
|
|
||||||
}
|
|
||||||
|
|
||||||
m_peer->SetData(kControlButtonPart , kControlPushButtonDefaultTag , (Boolean) 1 ) ;
|
|
||||||
|
|
||||||
return btnOldDefault;
|
|
||||||
}
|
|
||||||
|
|
||||||
wxSize wxButton::DoGetBestSize() const
|
wxSize wxButton::DoGetBestSize() const
|
||||||
{
|
{
|
||||||
@@ -140,6 +53,7 @@ wxSize wxButton::DoGetBestSize() const
|
|||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#if wxOSX_USE_CARBON
|
||||||
Rect bestsize = { 0 , 0 , 0 , 0 } ;
|
Rect bestsize = { 0 , 0 , 0 , 0 } ;
|
||||||
m_peer->GetBestRect( &bestsize ) ;
|
m_peer->GetBestRect( &bestsize ) ;
|
||||||
|
|
||||||
@@ -181,9 +95,9 @@ wxSize wxButton::DoGetBestSize() const
|
|||||||
// non 'normal' window variants don't return the correct height
|
// non 'normal' window variants don't return the correct height
|
||||||
// sz.y = bestsize.bottom - bestsize.top ;
|
// sz.y = bestsize.bottom - bestsize.top ;
|
||||||
}
|
}
|
||||||
|
|
||||||
if ((wBtn > sz.x) || ( GetWindowStyle() & wxBU_EXACTFIT))
|
if ((wBtn > sz.x) || ( GetWindowStyle() & wxBU_EXACTFIT))
|
||||||
sz.x = wBtn;
|
sz.x = wBtn;
|
||||||
|
#endif
|
||||||
|
|
||||||
return sz ;
|
return sz ;
|
||||||
}
|
}
|
||||||
@@ -196,35 +110,80 @@ wxSize wxButton::GetDefaultSize()
|
|||||||
return wxSize(wBtn, hBtn);
|
return wxSize(wBtn, hBtn);
|
||||||
}
|
}
|
||||||
|
|
||||||
void wxButton::Command (wxCommandEvent & event)
|
wxWidgetImplType* wxWidgetImpl::CreateButton( wxWindowMac* wxpeer,
|
||||||
|
wxWindowMac* parent,
|
||||||
|
wxWindowID id,
|
||||||
|
const wxString& label,
|
||||||
|
const wxPoint& pos,
|
||||||
|
const wxSize& size,
|
||||||
|
long style,
|
||||||
|
long extraStyle)
|
||||||
{
|
{
|
||||||
m_peer->Flash(kControlButtonPart) ;
|
OSStatus err;
|
||||||
ProcessCommand(event);
|
Rect bounds = wxMacGetBoundsForControl( wxpeer , pos , size ) ;
|
||||||
|
wxMacControl* peer = new wxMacControl(wxpeer) ;
|
||||||
|
if ( id == wxID_HELP )
|
||||||
|
{
|
||||||
|
ControlButtonContentInfo info ;
|
||||||
|
info.contentType = kControlContentIconRef ;
|
||||||
|
GetIconRef(kOnSystemDisk, kSystemIconsCreator, kHelpIcon, &info.u.iconRef);
|
||||||
|
err = CreateRoundButtonControl(
|
||||||
|
MAC_WXHWND(parent->MacGetTopLevelWindowRef()),
|
||||||
|
&bounds, kControlRoundButtonNormalSize,
|
||||||
|
&info, peer->GetControlRefAddr() );
|
||||||
|
}
|
||||||
|
else if ( label.Find('\n' ) == wxNOT_FOUND && label.Find('\r' ) == wxNOT_FOUND)
|
||||||
|
{
|
||||||
|
// Button height is static in Mac, can't be changed, so we need to force it here
|
||||||
|
int maxHeight;
|
||||||
|
switch (wxpeer->GetWindowVariant() )
|
||||||
|
{
|
||||||
|
case wxWINDOW_VARIANT_NORMAL:
|
||||||
|
case wxWINDOW_VARIANT_LARGE:
|
||||||
|
maxHeight = 20 ;
|
||||||
|
break;
|
||||||
|
case wxWINDOW_VARIANT_SMALL:
|
||||||
|
maxHeight = 17;
|
||||||
|
case wxWINDOW_VARIANT_MINI:
|
||||||
|
maxHeight = 15;
|
||||||
|
default:
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
bounds.bottom = bounds.top + maxHeight ;
|
||||||
|
wxpeer->SetMaxSize( wxSize( wxpeer->GetMaxWidth() , maxHeight ));
|
||||||
|
err = CreatePushButtonControl(
|
||||||
|
MAC_WXHWND(parent->MacGetTopLevelWindowRef()),
|
||||||
|
&bounds, CFSTR(""), peer->GetControlRefAddr() );
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
ControlButtonContentInfo info ;
|
||||||
|
info.contentType = kControlNoContent ;
|
||||||
|
err = CreateBevelButtonControl(
|
||||||
|
MAC_WXHWND(parent->MacGetTopLevelWindowRef()) , &bounds, CFSTR(""),
|
||||||
|
kControlBevelButtonLargeBevel, kControlBehaviorPushbutton,
|
||||||
|
&info, 0, 0, 0, peer->GetControlRefAddr() );
|
||||||
|
}
|
||||||
|
verify_noerr( err );
|
||||||
|
return peer;
|
||||||
}
|
}
|
||||||
|
|
||||||
wxInt32 wxButton::MacControlHit(WXEVENTHANDLERREF WXUNUSED(handler) , WXEVENTREF WXUNUSED(event) )
|
void wxMacControl::SetDefaultButton( bool isDefault )
|
||||||
{
|
{
|
||||||
wxCommandEvent event(wxEVT_COMMAND_BUTTON_CLICKED, m_windowId);
|
SetData(kControlButtonPart , kControlPushButtonDefaultTag , (Boolean) isDefault ) ;
|
||||||
event.SetEventObject(this);
|
|
||||||
ProcessCommand(event);
|
|
||||||
|
|
||||||
return noErr;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
//-------------------------------------------------------
|
wxWidgetImplType* wxWidgetImpl::CreateDisclosureTriangle( wxWindowMac* wxpeer,
|
||||||
// wxDisclosureTriangle
|
wxWindowMac* parent,
|
||||||
//-------------------------------------------------------
|
wxWindowID id,
|
||||||
|
const wxString& label,
|
||||||
bool wxDisclosureTriangle::Create(wxWindow *parent, wxWindowID id, const wxString& label,
|
const wxPoint& pos,
|
||||||
const wxPoint& pos, const wxSize& size, long style,const wxValidator& validator, const wxString& name )
|
const wxSize& size,
|
||||||
|
long style,
|
||||||
|
long extraStyle)
|
||||||
{
|
{
|
||||||
m_macIsUserPane = false ;
|
Rect bounds = wxMacGetBoundsForControl( wxpeer , pos , size ) ;
|
||||||
|
wxMacControl* peer = new wxMacControl(wxpeer) ;
|
||||||
if ( !wxControl::Create(parent, id, pos, size, style, validator, name) )
|
|
||||||
return false;
|
|
||||||
|
|
||||||
Rect bounds = wxMacGetBoundsForControl( this , pos , size ) ;
|
|
||||||
m_peer = new wxMacControl(this) ;
|
|
||||||
|
|
||||||
OSStatus err = CreateDisclosureTriangleControl(
|
OSStatus err = CreateDisclosureTriangleControl(
|
||||||
MAC_WXHWND(parent->MacGetTopLevelWindowRef()) , &bounds,
|
MAC_WXHWND(parent->MacGetTopLevelWindowRef()) , &bounds,
|
||||||
@@ -233,41 +192,10 @@ bool wxDisclosureTriangle::Create(wxWindow *parent, wxWindowID id, const wxStrin
|
|||||||
0, // closed
|
0, // closed
|
||||||
TRUE, // draw title
|
TRUE, // draw title
|
||||||
TRUE, // auto toggle back and forth
|
TRUE, // auto toggle back and forth
|
||||||
m_peer->GetControlRefAddr() );
|
peer->GetControlRefAddr() );
|
||||||
|
|
||||||
verify_noerr( err );
|
verify_noerr( err );
|
||||||
wxASSERT_MSG( m_peer != NULL && m_peer->IsOk() , wxT("No valid Mac control") ) ;
|
return peer;
|
||||||
|
|
||||||
MacPostControlCreate( pos, size );
|
|
||||||
// passing the text in the param doesn't seem to work, so lets do if again
|
|
||||||
SetLabel( label );
|
|
||||||
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
|
|
||||||
void wxDisclosureTriangle::SetOpen( bool open )
|
|
||||||
{
|
|
||||||
m_peer->SetValue( open ? 1 : 0 );
|
|
||||||
}
|
|
||||||
|
|
||||||
bool wxDisclosureTriangle::IsOpen() const
|
|
||||||
{
|
|
||||||
return m_peer->GetValue() == 1;
|
|
||||||
}
|
|
||||||
|
|
||||||
wxInt32 wxDisclosureTriangle::MacControlHit( WXEVENTHANDLERREF WXUNUSED(handler) , WXEVENTREF WXUNUSED(event) )
|
|
||||||
{
|
|
||||||
// Just emit button event for now
|
|
||||||
wxCommandEvent event(wxEVT_COMMAND_BUTTON_CLICKED, m_windowId);
|
|
||||||
event.SetEventObject(this);
|
|
||||||
ProcessCommand(event);
|
|
||||||
|
|
||||||
return noErr;
|
|
||||||
}
|
|
||||||
|
|
||||||
wxSize wxDisclosureTriangle::DoGetBestSize() const
|
|
||||||
{
|
|
||||||
return wxSize(16,16);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@@ -1,5 +1,5 @@
|
|||||||
/////////////////////////////////////////////////////////////////////////////
|
/////////////////////////////////////////////////////////////////////////////
|
||||||
// Name: src/mac/carbon/checkbox.cpp
|
// Name: src/osx/carbon/checkbox.cpp
|
||||||
// Purpose: wxCheckBox
|
// Purpose: wxCheckBox
|
||||||
// Author: Stefan Csomor
|
// Author: Stefan Csomor
|
||||||
// Modified by:
|
// Modified by:
|
||||||
@@ -16,171 +16,27 @@
|
|||||||
#include "wx/checkbox.h"
|
#include "wx/checkbox.h"
|
||||||
#include "wx/osx/uma.h"
|
#include "wx/osx/uma.h"
|
||||||
|
|
||||||
|
wxWidgetImplType* wxWidgetImpl::CreateCheckBox( wxWindowMac* wxpeer,
|
||||||
IMPLEMENT_DYNAMIC_CLASS(wxCheckBox, wxControl)
|
wxWindowMac* parent,
|
||||||
IMPLEMENT_DYNAMIC_CLASS(wxBitmapCheckBox, wxCheckBox)
|
wxWindowID id,
|
||||||
|
const wxString& label,
|
||||||
|
const wxPoint& pos,
|
||||||
// Single check box item
|
const wxSize& size,
|
||||||
bool wxCheckBox::Create(wxWindow *parent,
|
long style,
|
||||||
wxWindowID id,
|
long extraStyle)
|
||||||
const wxString& label,
|
|
||||||
const wxPoint& pos,
|
|
||||||
const wxSize& size,
|
|
||||||
long style,
|
|
||||||
const wxValidator& validator,
|
|
||||||
const wxString& name)
|
|
||||||
{
|
{
|
||||||
m_macIsUserPane = false ;
|
Rect bounds = wxMacGetBoundsForControl( wxpeer , pos , size ) ;
|
||||||
|
wxMacControl* peer = new wxMacControl(wxpeer) ;
|
||||||
if ( !wxCheckBoxBase::Create(parent, id, pos, size, style, validator, name) )
|
|
||||||
return false;
|
|
||||||
|
|
||||||
m_labelOrig = m_label = label ;
|
|
||||||
|
|
||||||
|
verify_noerr( CreateCheckBoxControl(MAC_WXHWND(parent->MacGetTopLevelWindowRef()), &bounds ,
|
||||||
|
CFSTR("") , 0 , false , peer->GetControlRefAddr() ) );
|
||||||
SInt32 maxValue = 1 /* kControlCheckboxCheckedValue */;
|
SInt32 maxValue = 1 /* kControlCheckboxCheckedValue */;
|
||||||
if (style & wxCHK_3STATE)
|
if (style & wxCHK_3STATE)
|
||||||
maxValue = 2 /* kControlCheckboxMixedValue */;
|
maxValue = 2 /* kControlCheckboxMixedValue */;
|
||||||
|
|
||||||
Rect bounds = wxMacGetBoundsForControl( this , pos , size ) ;
|
peer->SetMaximum( maxValue ) ;
|
||||||
m_peer = new wxMacControl( this ) ;
|
|
||||||
verify_noerr( CreateCheckBoxControl(MAC_WXHWND(parent->MacGetTopLevelWindowRef()), &bounds ,
|
|
||||||
CFSTR("") , 0 , false , m_peer->GetControlRefAddr() ) );
|
|
||||||
|
|
||||||
m_peer->SetMaximum( maxValue ) ;
|
return peer;
|
||||||
|
|
||||||
MacPostControlCreate(pos, size) ;
|
|
||||||
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
|
|
||||||
void wxCheckBox::SetValue(bool val)
|
|
||||||
{
|
|
||||||
if (val)
|
|
||||||
Set3StateValue(wxCHK_CHECKED);
|
|
||||||
else
|
|
||||||
Set3StateValue(wxCHK_UNCHECKED);
|
|
||||||
}
|
|
||||||
|
|
||||||
bool wxCheckBox::GetValue() const
|
|
||||||
{
|
|
||||||
return (DoGet3StateValue() != 0);
|
|
||||||
}
|
|
||||||
|
|
||||||
void wxCheckBox::Command(wxCommandEvent & event)
|
|
||||||
{
|
|
||||||
int state = event.GetInt();
|
|
||||||
|
|
||||||
wxCHECK_RET( (state == wxCHK_UNCHECKED) || (state == wxCHK_CHECKED)
|
|
||||||
|| (state == wxCHK_UNDETERMINED),
|
|
||||||
wxT("event.GetInt() returned an invalid checkbox state") );
|
|
||||||
|
|
||||||
Set3StateValue((wxCheckBoxState)state);
|
|
||||||
|
|
||||||
ProcessCommand(event);
|
|
||||||
}
|
|
||||||
|
|
||||||
wxCheckBoxState wxCheckBox::DoGet3StateValue() const
|
|
||||||
{
|
|
||||||
return (wxCheckBoxState)m_peer->GetValue() ;
|
|
||||||
}
|
|
||||||
|
|
||||||
void wxCheckBox::DoSet3StateValue(wxCheckBoxState val)
|
|
||||||
{
|
|
||||||
m_peer->SetValue( val ) ;
|
|
||||||
}
|
|
||||||
|
|
||||||
wxInt32 wxCheckBox::MacControlHit( WXEVENTHANDLERREF WXUNUSED(handler) , WXEVENTREF WXUNUSED(event) )
|
|
||||||
{
|
|
||||||
wxCheckBoxState origState, newState;
|
|
||||||
|
|
||||||
newState = origState = Get3StateValue();
|
|
||||||
|
|
||||||
switch (origState)
|
|
||||||
{
|
|
||||||
case wxCHK_UNCHECKED:
|
|
||||||
newState = wxCHK_CHECKED;
|
|
||||||
break;
|
|
||||||
|
|
||||||
case wxCHK_CHECKED:
|
|
||||||
// If the style flag to allow the user setting the undetermined state is set,
|
|
||||||
// then set the state to undetermined; otherwise set state to unchecked.
|
|
||||||
newState = Is3rdStateAllowedForUser() ? wxCHK_UNDETERMINED : wxCHK_UNCHECKED;
|
|
||||||
break;
|
|
||||||
|
|
||||||
case wxCHK_UNDETERMINED:
|
|
||||||
newState = wxCHK_UNCHECKED;
|
|
||||||
break;
|
|
||||||
|
|
||||||
default:
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (newState != origState)
|
|
||||||
{
|
|
||||||
Set3StateValue( newState );
|
|
||||||
|
|
||||||
wxCommandEvent event( wxEVT_COMMAND_CHECKBOX_CLICKED, m_windowId );
|
|
||||||
event.SetInt( newState );
|
|
||||||
event.SetEventObject( this );
|
|
||||||
ProcessCommand( event );
|
|
||||||
}
|
|
||||||
|
|
||||||
return noErr;
|
|
||||||
}
|
|
||||||
|
|
||||||
// Bitmap checkbox
|
|
||||||
bool wxBitmapCheckBox::Create(wxWindow *parent,
|
|
||||||
wxWindowID id,
|
|
||||||
const wxBitmap *WXUNUSED(label),
|
|
||||||
const wxPoint& WXUNUSED(pos),
|
|
||||||
const wxSize& WXUNUSED(size),
|
|
||||||
long style,
|
|
||||||
const wxValidator& wxVALIDATOR_PARAM(validator),
|
|
||||||
const wxString& name)
|
|
||||||
{
|
|
||||||
SetName(name);
|
|
||||||
#if wxUSE_VALIDATORS
|
|
||||||
SetValidator(validator);
|
|
||||||
#endif
|
|
||||||
m_windowStyle = style;
|
|
||||||
|
|
||||||
if (parent)
|
|
||||||
parent->AddChild(this);
|
|
||||||
|
|
||||||
if ( id == -1 )
|
|
||||||
m_windowId = NewControlId();
|
|
||||||
else
|
|
||||||
m_windowId = id;
|
|
||||||
|
|
||||||
// TODO: Create the bitmap checkbox
|
|
||||||
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
|
|
||||||
void wxBitmapCheckBox::SetLabel(const wxBitmap *WXUNUSED(bitmap))
|
|
||||||
{
|
|
||||||
// TODO
|
|
||||||
wxFAIL_MSG(wxT("wxBitmapCheckBox::SetLabel() not yet implemented"));
|
|
||||||
}
|
|
||||||
|
|
||||||
void wxBitmapCheckBox::SetSize(int x, int y, int width, int height, int sizeFlags)
|
|
||||||
{
|
|
||||||
wxControl::SetSize( x , y , width , height , sizeFlags ) ;
|
|
||||||
}
|
|
||||||
|
|
||||||
void wxBitmapCheckBox::SetValue(bool WXUNUSED(val))
|
|
||||||
{
|
|
||||||
// TODO
|
|
||||||
wxFAIL_MSG(wxT("wxBitmapCheckBox::SetValue() not yet implemented"));
|
|
||||||
}
|
|
||||||
|
|
||||||
bool wxBitmapCheckBox::GetValue() const
|
|
||||||
{
|
|
||||||
// TODO
|
|
||||||
wxFAIL_MSG(wxT("wxBitmapCheckBox::GetValue() not yet implemented"));
|
|
||||||
|
|
||||||
return false;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
@@ -1,273 +0,0 @@
|
|||||||
///////////////////////////////////////////////////////////////////////////////
|
|
||||||
// Name: src/mac/carbon/checklst.cpp
|
|
||||||
// Purpose: implementation of wxCheckListBox class
|
|
||||||
// Author: Stefan Csomor
|
|
||||||
// Modified by:
|
|
||||||
// Created: 1998-01-01
|
|
||||||
// RCS-ID: $Id$
|
|
||||||
// Copyright: (c) Stefan Csomor
|
|
||||||
// Licence: wxWindows licence
|
|
||||||
///////////////////////////////////////////////////////////////////////////////
|
|
||||||
//
|
|
||||||
// new DataBrowser-based version
|
|
||||||
|
|
||||||
|
|
||||||
#include "wx/wxprec.h"
|
|
||||||
|
|
||||||
#if wxUSE_CHECKLISTBOX
|
|
||||||
|
|
||||||
#include "wx/checklst.h"
|
|
||||||
|
|
||||||
#ifndef WX_PRECOMP
|
|
||||||
#include "wx/arrstr.h"
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#include "wx/osx/uma.h"
|
|
||||||
|
|
||||||
IMPLEMENT_DYNAMIC_CLASS(wxCheckListBox, wxListBox)
|
|
||||||
|
|
||||||
BEGIN_EVENT_TABLE(wxCheckListBox, wxListBox)
|
|
||||||
END_EVENT_TABLE()
|
|
||||||
|
|
||||||
class wxMacDataBrowserCheckListControl : public wxMacDataBrowserListControl , public wxMacCheckListControl
|
|
||||||
{
|
|
||||||
public:
|
|
||||||
wxMacDataBrowserCheckListControl( wxListBox *peer, const wxPoint& pos, const wxSize& size, long style );
|
|
||||||
wxMacDataBrowserCheckListControl() {}
|
|
||||||
virtual ~wxMacDataBrowserCheckListControl();
|
|
||||||
|
|
||||||
virtual wxMacDataItem* CreateItem();
|
|
||||||
|
|
||||||
virtual bool MacIsChecked(unsigned int n) const;
|
|
||||||
virtual void MacCheck(unsigned int n, bool bCheck = true);
|
|
||||||
DECLARE_DYNAMIC_CLASS_NO_COPY(wxMacDataBrowserCheckListControl)
|
|
||||||
};
|
|
||||||
|
|
||||||
IMPLEMENT_DYNAMIC_CLASS( wxMacDataBrowserCheckListControl , wxMacDataBrowserListControl )
|
|
||||||
|
|
||||||
void wxCheckListBox::Init()
|
|
||||||
{
|
|
||||||
}
|
|
||||||
|
|
||||||
bool wxCheckListBox::Create(
|
|
||||||
wxWindow *parent,
|
|
||||||
wxWindowID id,
|
|
||||||
const wxPoint &pos,
|
|
||||||
const wxSize &size,
|
|
||||||
const wxArrayString& choices,
|
|
||||||
long style,
|
|
||||||
const wxValidator& validator,
|
|
||||||
const wxString &name )
|
|
||||||
{
|
|
||||||
wxCArrayString chs( choices );
|
|
||||||
|
|
||||||
return Create( parent, id, pos, size, chs.GetCount(), chs.GetStrings(), style, validator, name );
|
|
||||||
}
|
|
||||||
|
|
||||||
bool wxCheckListBox::Create(
|
|
||||||
wxWindow *parent,
|
|
||||||
wxWindowID id,
|
|
||||||
const wxPoint& pos,
|
|
||||||
const wxSize& size,
|
|
||||||
int n,
|
|
||||||
const wxString choices[],
|
|
||||||
long style,
|
|
||||||
const wxValidator& validator,
|
|
||||||
const wxString& name )
|
|
||||||
{
|
|
||||||
m_macIsUserPane = false;
|
|
||||||
|
|
||||||
wxASSERT_MSG( !(style & wxLB_MULTIPLE) || !(style & wxLB_EXTENDED),
|
|
||||||
wxT("only one of listbox selection modes can be specified") );
|
|
||||||
|
|
||||||
if ( !wxListBoxBase::Create( parent, id, pos, size, style & ~(wxHSCROLL | wxVSCROLL), validator, name ) )
|
|
||||||
return false;
|
|
||||||
|
|
||||||
// this will be increased by our Append command
|
|
||||||
wxMacDataBrowserCheckListControl* control = new wxMacDataBrowserCheckListControl( this, pos, size, style );
|
|
||||||
// TODO CHECK control->SetClientDataType( m_clientDataItemsType );
|
|
||||||
m_peer = control;
|
|
||||||
|
|
||||||
MacPostControlCreate(pos,size);
|
|
||||||
|
|
||||||
InsertItems( n , choices , 0 );
|
|
||||||
|
|
||||||
// Needed because it is a wxControlWithItems
|
|
||||||
SetInitialSize( size );
|
|
||||||
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
|
|
||||||
// ----------------------------------------------------------------------------
|
|
||||||
// wxCheckListBox functions
|
|
||||||
// ----------------------------------------------------------------------------
|
|
||||||
|
|
||||||
bool wxCheckListBox::IsChecked(unsigned int item) const
|
|
||||||
{
|
|
||||||
wxCHECK_MSG( IsValid(item), false,
|
|
||||||
wxT("invalid index in wxCheckListBox::IsChecked") );
|
|
||||||
|
|
||||||
return GetPeer()->MacIsChecked( item );
|
|
||||||
}
|
|
||||||
|
|
||||||
void wxCheckListBox::Check(unsigned int item, bool check)
|
|
||||||
{
|
|
||||||
wxCHECK_RET( IsValid(item),
|
|
||||||
wxT("invalid index in wxCheckListBox::Check") );
|
|
||||||
|
|
||||||
bool isChecked = GetPeer()->MacIsChecked( item );
|
|
||||||
if ( check != isChecked )
|
|
||||||
{
|
|
||||||
GetPeer()->MacCheck( item , check );
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
wxMacCheckListControl* wxCheckListBox::GetPeer() const
|
|
||||||
{
|
|
||||||
wxMacDataBrowserCheckListControl *lb = wxDynamicCast(m_peer,wxMacDataBrowserCheckListControl);
|
|
||||||
return lb ? wx_static_cast(wxMacCheckListControl*,lb) : 0 ;
|
|
||||||
}
|
|
||||||
|
|
||||||
const short kCheckboxColumnId = 1026;
|
|
||||||
|
|
||||||
wxMacDataBrowserCheckListControl::wxMacDataBrowserCheckListControl( wxListBox *peer, const wxPoint& pos, const wxSize& size, long style)
|
|
||||||
: wxMacDataBrowserListControl( peer, pos, size, style )
|
|
||||||
{
|
|
||||||
OSStatus err = noErr;
|
|
||||||
|
|
||||||
DataBrowserListViewColumnDesc columnDesc;
|
|
||||||
columnDesc.headerBtnDesc.titleOffset = 0;
|
|
||||||
columnDesc.headerBtnDesc.version = kDataBrowserListViewLatestHeaderDesc;
|
|
||||||
|
|
||||||
columnDesc.headerBtnDesc.btnFontStyle.flags =
|
|
||||||
kControlUseFontMask | kControlUseJustMask;
|
|
||||||
|
|
||||||
columnDesc.headerBtnDesc.btnContentInfo.contentType = kControlNoContent;
|
|
||||||
columnDesc.headerBtnDesc.btnFontStyle.just = teFlushDefault;
|
|
||||||
columnDesc.headerBtnDesc.btnFontStyle.font = kControlFontViewSystemFont;
|
|
||||||
columnDesc.headerBtnDesc.btnFontStyle.style = normal;
|
|
||||||
columnDesc.headerBtnDesc.titleString = NULL;
|
|
||||||
|
|
||||||
columnDesc.headerBtnDesc.minimumWidth = 30;
|
|
||||||
columnDesc.headerBtnDesc.maximumWidth = 30;
|
|
||||||
|
|
||||||
columnDesc.propertyDesc.propertyID = kCheckboxColumnId;
|
|
||||||
columnDesc.propertyDesc.propertyType = kDataBrowserCheckboxType;
|
|
||||||
columnDesc.propertyDesc.propertyFlags =
|
|
||||||
kDataBrowserPropertyIsMutable
|
|
||||||
| kDataBrowserTableViewSelectionColumn
|
|
||||||
| kDataBrowserDefaultPropertyFlags;
|
|
||||||
|
|
||||||
err = AddColumn( &columnDesc, 0 );
|
|
||||||
verify_noerr( err );
|
|
||||||
}
|
|
||||||
|
|
||||||
wxMacDataBrowserCheckListControl::~wxMacDataBrowserCheckListControl()
|
|
||||||
{
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
class wxMacCheckListBoxItem : public wxMacListBoxItem
|
|
||||||
{
|
|
||||||
public :
|
|
||||||
wxMacCheckListBoxItem()
|
|
||||||
{
|
|
||||||
m_isChecked = false;
|
|
||||||
}
|
|
||||||
|
|
||||||
virtual ~wxMacCheckListBoxItem()
|
|
||||||
{
|
|
||||||
}
|
|
||||||
|
|
||||||
virtual OSStatus GetSetData( wxMacDataItemBrowserControl *owner ,
|
|
||||||
DataBrowserPropertyID property,
|
|
||||||
DataBrowserItemDataRef itemData,
|
|
||||||
bool changeValue )
|
|
||||||
{
|
|
||||||
OSStatus err = errDataBrowserPropertyNotSupported;
|
|
||||||
|
|
||||||
wxCheckListBox *checklist = wxDynamicCast( owner->GetWXPeer() , wxCheckListBox );
|
|
||||||
wxCHECK_MSG( checklist != NULL , errDataBrowserPropertyNotSupported , wxT("wxCheckListBox expected"));
|
|
||||||
|
|
||||||
if ( !changeValue )
|
|
||||||
{
|
|
||||||
switch (property)
|
|
||||||
{
|
|
||||||
case kCheckboxColumnId:
|
|
||||||
verify_noerr(SetDataBrowserItemDataButtonValue( itemData, m_isChecked ? kThemeButtonOn : kThemeButtonOff ));
|
|
||||||
err = noErr;
|
|
||||||
break;
|
|
||||||
|
|
||||||
case kDataBrowserItemIsEditableProperty:
|
|
||||||
verify_noerr(SetDataBrowserItemDataBooleanValue( itemData, true ));
|
|
||||||
err = noErr;
|
|
||||||
break;
|
|
||||||
|
|
||||||
default:
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
switch (property)
|
|
||||||
{
|
|
||||||
case kCheckboxColumnId:
|
|
||||||
{
|
|
||||||
// we have to change this behind the back, since Check() would be triggering another update round
|
|
||||||
bool newVal = !m_isChecked;
|
|
||||||
verify_noerr(SetDataBrowserItemDataButtonValue( itemData, newVal ? kThemeButtonOn : kThemeButtonOff ));
|
|
||||||
m_isChecked = newVal;
|
|
||||||
err = noErr;
|
|
||||||
|
|
||||||
wxCommandEvent event( wxEVT_COMMAND_CHECKLISTBOX_TOGGLED, checklist->GetId() );
|
|
||||||
event.SetInt( owner->GetLineFromItem( this ) );
|
|
||||||
event.SetEventObject( checklist );
|
|
||||||
checklist->HandleWindowEvent( event );
|
|
||||||
}
|
|
||||||
break;
|
|
||||||
|
|
||||||
default:
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
if ( err == errDataBrowserPropertyNotSupported )
|
|
||||||
err = wxMacListBoxItem::GetSetData( owner , property, itemData , changeValue);
|
|
||||||
|
|
||||||
return err;
|
|
||||||
}
|
|
||||||
|
|
||||||
void Check( bool check )
|
|
||||||
{
|
|
||||||
m_isChecked = check;
|
|
||||||
}
|
|
||||||
bool IsChecked() const
|
|
||||||
{
|
|
||||||
return m_isChecked;
|
|
||||||
}
|
|
||||||
|
|
||||||
protected :
|
|
||||||
bool m_isChecked;
|
|
||||||
};
|
|
||||||
|
|
||||||
wxMacDataItem* wxMacDataBrowserCheckListControl::CreateItem()
|
|
||||||
{
|
|
||||||
return new wxMacCheckListBoxItem();
|
|
||||||
}
|
|
||||||
|
|
||||||
void wxMacDataBrowserCheckListControl::MacCheck( unsigned int n, bool bCheck)
|
|
||||||
{
|
|
||||||
wxMacCheckListBoxItem* item = wx_static_cast(wxMacCheckListBoxItem*, GetItemFromLine( n) );
|
|
||||||
item->Check( bCheck);
|
|
||||||
UpdateItem(wxMacDataBrowserRootContainer, item , kCheckboxColumnId);
|
|
||||||
}
|
|
||||||
|
|
||||||
bool wxMacDataBrowserCheckListControl::MacIsChecked( unsigned int n) const
|
|
||||||
{
|
|
||||||
wxMacCheckListBoxItem * item = wx_static_cast( wxMacCheckListBoxItem*, GetItemFromLine( n ) );
|
|
||||||
return item->IsChecked();
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
#endif // wxUSE_CHECKLISTBOX
|
|
@@ -1,5 +1,5 @@
|
|||||||
/////////////////////////////////////////////////////////////////////////////
|
/////////////////////////////////////////////////////////////////////////////
|
||||||
// Name: src/mac/carbon/choice.cpp
|
// Name: src/osx/carbon/choice.cpp
|
||||||
// Purpose: wxChoice
|
// Purpose: wxChoice
|
||||||
// Author: Stefan Csomor
|
// Author: Stefan Csomor
|
||||||
// Modified by:
|
// Modified by:
|
||||||
@@ -20,289 +20,47 @@
|
|||||||
#include "wx/dcclient.h"
|
#include "wx/dcclient.h"
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#include "wx/osx/uma.h"
|
#include "wx/osx/private.h"
|
||||||
|
|
||||||
extern MenuHandle NewUniqueMenu() ;
|
// adapt the number offset (mac menu are 1 based)
|
||||||
|
|
||||||
IMPLEMENT_DYNAMIC_CLASS(wxChoice, wxControlWithItems)
|
class wxMacChoiceCarbonControl : public wxMacControl
|
||||||
|
|
||||||
|
|
||||||
wxChoice::~wxChoice()
|
|
||||||
{
|
{
|
||||||
if ( HasClientObjectData() )
|
public :
|
||||||
|
wxMacChoiceCarbonControl( wxWindowMac* peer ) : wxMacControl( peer )
|
||||||
{
|
{
|
||||||
unsigned int i, max = GetCount();
|
|
||||||
|
|
||||||
for ( i = 0; i < max; ++i )
|
|
||||||
delete GetClientObject( i );
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// DeleteMenu( m_macPopUpMenuId ) ;
|
void SetValue(wxInt32 v)
|
||||||
// DisposeMenu( m_macPopUpMenuHandle ) ;
|
{
|
||||||
}
|
wxMacControl::SetValue( v + 1 );
|
||||||
|
}
|
||||||
|
|
||||||
bool wxChoice::Create(wxWindow *parent,
|
wxInt32 GetValue()
|
||||||
wxWindowID id,
|
{
|
||||||
const wxPoint& pos,
|
return wxMacControl::GetValue() - 1;
|
||||||
const wxSize& size,
|
}
|
||||||
const wxArrayString& choices,
|
};
|
||||||
long style,
|
|
||||||
const wxValidator& validator,
|
wxWidgetImplType* wxWidgetImpl::CreateChoice( wxWindowMac* wxpeer,
|
||||||
const wxString& name )
|
wxWindowMac* parent,
|
||||||
|
wxWindowID id,
|
||||||
|
wxMenu* menu,
|
||||||
|
const wxPoint& pos,
|
||||||
|
const wxSize& size,
|
||||||
|
long style,
|
||||||
|
long extraStylew)
|
||||||
{
|
{
|
||||||
if ( !Create( parent, id, pos, size, 0, NULL, style, validator, name ) )
|
Rect bounds = wxMacGetBoundsForControl( wxpeer , pos , size );
|
||||||
return false;
|
|
||||||
|
|
||||||
Append( choices );
|
wxMacControl* peer = new wxMacChoiceCarbonControl( wxpeer ) ;
|
||||||
|
|
||||||
if ( !choices.empty() )
|
|
||||||
SetSelection( 0 );
|
|
||||||
|
|
||||||
SetInitialSize( size );
|
|
||||||
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
|
|
||||||
bool wxChoice::Create(wxWindow *parent,
|
|
||||||
wxWindowID id,
|
|
||||||
const wxPoint& pos,
|
|
||||||
const wxSize& size,
|
|
||||||
int n,
|
|
||||||
const wxString choices[],
|
|
||||||
long style,
|
|
||||||
const wxValidator& validator,
|
|
||||||
const wxString& name )
|
|
||||||
{
|
|
||||||
m_macIsUserPane = false;
|
|
||||||
|
|
||||||
if ( !wxChoiceBase::Create( parent, id, pos, size, style, validator, name ) )
|
|
||||||
return false;
|
|
||||||
|
|
||||||
Rect bounds = wxMacGetBoundsForControl( this , pos , size );
|
|
||||||
|
|
||||||
m_peer = new wxMacControl( this ) ;
|
|
||||||
OSStatus err = CreatePopupButtonControl(
|
OSStatus err = CreatePopupButtonControl(
|
||||||
MAC_WXHWND(parent->MacGetTopLevelWindowRef()) , &bounds , CFSTR("") ,
|
MAC_WXHWND(parent->MacGetTopLevelWindowRef()) , &bounds , CFSTR("") ,
|
||||||
-12345 , false /* no variable width */ , 0 , 0 , 0 , m_peer->GetControlRefAddr() );
|
-12345 , false /* no variable width */ , 0 , 0 , 0 , peer->GetControlRefAddr() );
|
||||||
verify_noerr( err );
|
verify_noerr( err );
|
||||||
|
|
||||||
m_macPopUpMenuHandle = NewUniqueMenu() ;
|
peer->SetData<MenuHandle>( kControlNoPart , kControlPopupButtonMenuHandleTag , (MenuHandle) menu->GetHMenu() ) ;
|
||||||
m_peer->SetData<MenuHandle>( kControlNoPart , kControlPopupButtonMenuHandleTag , (MenuHandle) m_macPopUpMenuHandle ) ;
|
return peer;
|
||||||
m_peer->SetValueAndRange( n > 0 ? 1 : 0 , 0 , 0 );
|
|
||||||
MacPostControlCreate( pos, size );
|
|
||||||
|
|
||||||
#if !wxUSE_STL
|
|
||||||
if ( style & wxCB_SORT )
|
|
||||||
// autosort
|
|
||||||
m_strings = wxArrayString( 1 );
|
|
||||||
#endif
|
|
||||||
|
|
||||||
Append(n, choices);
|
|
||||||
|
|
||||||
// Set the first item as being selected
|
|
||||||
if (n > 0)
|
|
||||||
SetSelection( 0 );
|
|
||||||
|
|
||||||
// Needed because it is a wxControlWithItems
|
|
||||||
SetInitialSize( size );
|
|
||||||
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
|
|
||||||
// ----------------------------------------------------------------------------
|
|
||||||
// adding/deleting items to/from the list
|
|
||||||
// ----------------------------------------------------------------------------
|
|
||||||
|
|
||||||
int wxChoice::DoInsertItems(const wxArrayStringsAdapter & items,
|
|
||||||
unsigned int pos,
|
|
||||||
void **clientData, wxClientDataType type)
|
|
||||||
{
|
|
||||||
const unsigned int numItems = items.GetCount();
|
|
||||||
for( unsigned int i = 0; i < numItems; ++i, ++pos )
|
|
||||||
{
|
|
||||||
unsigned int idx;
|
|
||||||
|
|
||||||
#if wxUSE_STL
|
|
||||||
if ( IsSorted() )
|
|
||||||
{
|
|
||||||
wxArrayString::iterator
|
|
||||||
insertPoint = std::lower_bound( m_strings.begin(), m_strings.end(), items[i] );
|
|
||||||
idx = insertPoint - m_strings.begin();
|
|
||||||
m_strings.insert( insertPoint, items[i] );
|
|
||||||
}
|
|
||||||
else
|
|
||||||
#endif // wxUSE_STL
|
|
||||||
{
|
|
||||||
idx = pos;
|
|
||||||
m_strings.Insert( items[i], idx );
|
|
||||||
}
|
|
||||||
|
|
||||||
UMAInsertMenuItem(MAC_WXHMENU( m_macPopUpMenuHandle ),
|
|
||||||
items[i],
|
|
||||||
GetFont().GetEncoding(),
|
|
||||||
idx);
|
|
||||||
m_datas.Insert( NULL, idx );
|
|
||||||
AssignNewItemClientData(idx, clientData, i, type);
|
|
||||||
}
|
|
||||||
|
|
||||||
m_peer->SetMaximum( GetCount() );
|
|
||||||
|
|
||||||
return pos - 1;
|
|
||||||
}
|
|
||||||
|
|
||||||
void wxChoice::DoDeleteOneItem(unsigned int n)
|
|
||||||
{
|
|
||||||
wxCHECK_RET( IsValid(n) , wxT("wxChoice::Delete: invalid index") );
|
|
||||||
|
|
||||||
if ( HasClientObjectData() )
|
|
||||||
delete GetClientObject( n );
|
|
||||||
|
|
||||||
::DeleteMenuItem( MAC_WXHMENU(m_macPopUpMenuHandle) , n + 1 ) ;
|
|
||||||
m_strings.RemoveAt( n ) ;
|
|
||||||
m_datas.RemoveAt( n ) ;
|
|
||||||
m_peer->SetMaximum( GetCount() ) ;
|
|
||||||
}
|
|
||||||
|
|
||||||
void wxChoice::DoClear()
|
|
||||||
{
|
|
||||||
for ( unsigned int i = 0 ; i < GetCount() ; i++ )
|
|
||||||
{
|
|
||||||
::DeleteMenuItem( MAC_WXHMENU(m_macPopUpMenuHandle) , 1 ) ;
|
|
||||||
}
|
|
||||||
|
|
||||||
m_strings.Empty() ;
|
|
||||||
m_datas.Empty() ;
|
|
||||||
m_peer->SetMaximum( 0 ) ;
|
|
||||||
}
|
|
||||||
|
|
||||||
// ----------------------------------------------------------------------------
|
|
||||||
// selection
|
|
||||||
// ----------------------------------------------------------------------------
|
|
||||||
int wxChoice::GetSelection() const
|
|
||||||
{
|
|
||||||
return m_peer->GetValue() - 1 ;
|
|
||||||
}
|
|
||||||
|
|
||||||
void wxChoice::SetSelection( int n )
|
|
||||||
{
|
|
||||||
m_peer->SetValue( n + 1 ) ;
|
|
||||||
}
|
|
||||||
|
|
||||||
// ----------------------------------------------------------------------------
|
|
||||||
// string list functions
|
|
||||||
// ----------------------------------------------------------------------------
|
|
||||||
|
|
||||||
unsigned int wxChoice::GetCount() const
|
|
||||||
{
|
|
||||||
return m_strings.GetCount() ;
|
|
||||||
}
|
|
||||||
|
|
||||||
int wxChoice::FindString( const wxString& s, bool bCase ) const
|
|
||||||
{
|
|
||||||
#if !wxUSE_STL
|
|
||||||
// Avoid assert for non-default args passed to sorted array Index
|
|
||||||
if ( IsSorted() )
|
|
||||||
bCase = true;
|
|
||||||
#endif
|
|
||||||
|
|
||||||
return m_strings.Index( s , bCase ) ;
|
|
||||||
}
|
|
||||||
|
|
||||||
void wxChoice::SetString(unsigned int n, const wxString& s)
|
|
||||||
{
|
|
||||||
wxCHECK_RET( IsValid(n), wxT("wxChoice::SetString(): invalid index") );
|
|
||||||
|
|
||||||
m_strings[n] = s ;
|
|
||||||
|
|
||||||
// apple menu pos is 1-based
|
|
||||||
UMASetMenuItemText( MAC_WXHMENU(m_macPopUpMenuHandle) , n + 1 , s , wxFont::GetDefaultEncoding() ) ;
|
|
||||||
}
|
|
||||||
|
|
||||||
wxString wxChoice::GetString(unsigned int n) const
|
|
||||||
{
|
|
||||||
wxCHECK_MSG( IsValid(n), wxEmptyString, wxT("wxChoice::GetString(): invalid index") );
|
|
||||||
|
|
||||||
return m_strings[n] ;
|
|
||||||
}
|
|
||||||
|
|
||||||
// ----------------------------------------------------------------------------
|
|
||||||
// client data
|
|
||||||
// ----------------------------------------------------------------------------
|
|
||||||
void wxChoice::DoSetItemClientData(unsigned int n, void* clientData)
|
|
||||||
{
|
|
||||||
wxCHECK_RET( IsValid(n), wxT("wxChoice::DoSetItemClientData: invalid index") );
|
|
||||||
|
|
||||||
m_datas[n] = (char*)clientData ;
|
|
||||||
}
|
|
||||||
|
|
||||||
void * wxChoice::DoGetItemClientData(unsigned int n) const
|
|
||||||
{
|
|
||||||
wxCHECK_MSG( IsValid(n), NULL, wxT("wxChoice::DoGetClientData: invalid index") );
|
|
||||||
|
|
||||||
return (void *)m_datas[n];
|
|
||||||
}
|
|
||||||
|
|
||||||
wxInt32 wxChoice::MacControlHit( WXEVENTHANDLERREF WXUNUSED(handler) , WXEVENTREF WXUNUSED(event) )
|
|
||||||
{
|
|
||||||
wxCommandEvent event( wxEVT_COMMAND_CHOICE_SELECTED, m_windowId );
|
|
||||||
|
|
||||||
// actually n should be made sure by the os to be a valid selection, but ...
|
|
||||||
int n = GetSelection();
|
|
||||||
if ( n > -1 )
|
|
||||||
{
|
|
||||||
event.SetInt( n );
|
|
||||||
event.SetString( GetStringSelection() );
|
|
||||||
event.SetEventObject( this );
|
|
||||||
|
|
||||||
if ( HasClientObjectData() )
|
|
||||||
event.SetClientObject( GetClientObject( n ) );
|
|
||||||
else if ( HasClientUntypedData() )
|
|
||||||
event.SetClientData( GetClientData( n ) );
|
|
||||||
|
|
||||||
ProcessCommand( event );
|
|
||||||
}
|
|
||||||
|
|
||||||
return noErr ;
|
|
||||||
}
|
|
||||||
|
|
||||||
wxSize wxChoice::DoGetBestSize() const
|
|
||||||
{
|
|
||||||
int lbWidth = GetCount() > 0 ? 20 : 100; // some defaults
|
|
||||||
int lbHeight = 20;
|
|
||||||
int wLine;
|
|
||||||
|
|
||||||
SInt32 metric ;
|
|
||||||
|
|
||||||
GetThemeMetric( kThemeMetricPopupButtonHeight , &metric );
|
|
||||||
lbHeight = metric ;
|
|
||||||
|
|
||||||
{
|
|
||||||
wxClientDC dc(const_cast<wxChoice*>(this));
|
|
||||||
|
|
||||||
// Find the widest line
|
|
||||||
for(unsigned int i = 0; i < GetCount(); i++)
|
|
||||||
{
|
|
||||||
wxString str(GetString(i));
|
|
||||||
|
|
||||||
wxCoord width, height ;
|
|
||||||
dc.GetTextExtent( str , &width, &height);
|
|
||||||
wLine = width ;
|
|
||||||
|
|
||||||
lbWidth = wxMax( lbWidth, wLine ) ;
|
|
||||||
}
|
|
||||||
|
|
||||||
// Add room for the popup arrow
|
|
||||||
lbWidth += 2 * lbHeight ;
|
|
||||||
|
|
||||||
wxCoord width, height ;
|
|
||||||
dc.GetTextExtent( wxT("X"), &width, &height);
|
|
||||||
int cx = width ;
|
|
||||||
lbHeight += 4;
|
|
||||||
|
|
||||||
lbWidth += cx ;
|
|
||||||
}
|
|
||||||
|
|
||||||
return wxSize( lbWidth, lbHeight );
|
|
||||||
}
|
}
|
||||||
|
|
||||||
#endif // wxUSE_CHOICE
|
#endif // wxUSE_CHOICE
|
||||||
|
@@ -1,5 +1,5 @@
|
|||||||
/////////////////////////////////////////////////////////////////////////////
|
/////////////////////////////////////////////////////////////////////////////
|
||||||
// Name: src/mac/carbon/clipbrd.cpp
|
// Name: src/osx/carbon/clipbrd.cpp
|
||||||
// Purpose: Clipboard functionality
|
// Purpose: Clipboard functionality
|
||||||
// Author: Stefan Csomor;
|
// Author: Stefan Csomor;
|
||||||
// Generalized clipboard implementation by Matthew Flatt
|
// Generalized clipboard implementation by Matthew Flatt
|
||||||
|
@@ -1,5 +1,5 @@
|
|||||||
/////////////////////////////////////////////////////////////////////////////
|
/////////////////////////////////////////////////////////////////////////////
|
||||||
// Name: src/mac/carbon/colordlg.mm
|
// Name: src/osx/carbon/colordlg.mm
|
||||||
// Purpose: wxColourDialog class. NOTE: you can use the generic class
|
// Purpose: wxColourDialog class. NOTE: you can use the generic class
|
||||||
// if you wish, instead of implementing this.
|
// if you wish, instead of implementing this.
|
||||||
// Author: Ryan Norton
|
// Author: Ryan Norton
|
||||||
|
@@ -1,5 +1,5 @@
|
|||||||
/////////////////////////////////////////////////////////////////////////////
|
/////////////////////////////////////////////////////////////////////////////
|
||||||
// Name: src/mac/carbon/combobox.cpp
|
// Name: src/osx/carbon/combobox.cpp
|
||||||
// Purpose: wxComboBox class
|
// Purpose: wxComboBox class
|
||||||
// Author: Stefan Csomor, Dan "Bud" Keith (composite combobox)
|
// Author: Stefan Csomor, Dan "Bud" Keith (composite combobox)
|
||||||
// Modified by:
|
// Modified by:
|
||||||
@@ -23,7 +23,7 @@
|
|||||||
#include "wx/textctrl.h"
|
#include "wx/textctrl.h"
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#include "wx/osx/uma.h"
|
#include "wx/osx/private.h"
|
||||||
|
|
||||||
IMPLEMENT_DYNAMIC_CLASS(wxComboBox, wxControl)
|
IMPLEMENT_DYNAMIC_CLASS(wxComboBox, wxControl)
|
||||||
|
|
||||||
@@ -34,17 +34,6 @@ BEGIN_EVENT_TABLE(wxComboBox, wxControl)
|
|||||||
END_EVENT_TABLE()
|
END_EVENT_TABLE()
|
||||||
|
|
||||||
|
|
||||||
static int nextPopUpMenuId = 1000 ;
|
|
||||||
|
|
||||||
MenuHandle NewUniqueMenu()
|
|
||||||
{
|
|
||||||
MenuHandle handle = UMANewMenu(nextPopUpMenuId, wxString(wxT("Menu")), wxFont::GetDefaultEncoding() );
|
|
||||||
nextPopUpMenuId++ ;
|
|
||||||
|
|
||||||
return handle ;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
// ----------------------------------------------------------------------------
|
// ----------------------------------------------------------------------------
|
||||||
// constants
|
// constants
|
||||||
// ----------------------------------------------------------------------------
|
// ----------------------------------------------------------------------------
|
||||||
@@ -651,7 +640,7 @@ bool wxComboBox::CanRedo() const
|
|||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
wxInt32 wxComboBox::MacControlHit( WXEVENTHANDLERREF WXUNUSED(handler) , WXEVENTREF WXUNUSED(event) )
|
bool wxComboBox::HandleClicked( double timestampsec )
|
||||||
{
|
{
|
||||||
/*
|
/*
|
||||||
For consistency with other platforms, clicking in the text area does not constitute a selection
|
For consistency with other platforms, clicking in the text area does not constitute a selection
|
||||||
@@ -662,7 +651,7 @@ wxInt32 wxComboBox::MacControlHit( WXEVENTHANDLERREF WXUNUSED(handler) , WXEVENT
|
|||||||
ProcessCommand(event);
|
ProcessCommand(event);
|
||||||
*/
|
*/
|
||||||
|
|
||||||
return noErr ;
|
return true ;
|
||||||
}
|
}
|
||||||
|
|
||||||
#endif // wxUSE_COMBOBOX
|
#endif // wxUSE_COMBOBOX
|
||||||
|
@@ -1,5 +1,5 @@
|
|||||||
/////////////////////////////////////////////////////////////////////////////
|
/////////////////////////////////////////////////////////////////////////////
|
||||||
// Name: src/mac/carbon/combobxc.cpp
|
// Name: src/osx/carbon/combobxc.cpp
|
||||||
// Purpose: wxComboBox class using HIView ComboBox
|
// Purpose: wxComboBox class using HIView ComboBox
|
||||||
// Author: Stefan Csomor
|
// Author: Stefan Csomor
|
||||||
// Modified by:
|
// Modified by:
|
||||||
@@ -219,14 +219,8 @@ wxComboBox::~wxComboBox()
|
|||||||
// delete the controls now, don't leave them alive even though they would
|
// delete the controls now, don't leave them alive even though they would
|
||||||
// still be eventually deleted by our parent - but it will be too late, the
|
// still be eventually deleted by our parent - but it will be too late, the
|
||||||
// user code expects them to be gone now
|
// user code expects them to be gone now
|
||||||
if (m_text != NULL) {
|
wxDELETE( m_text );
|
||||||
delete m_text;
|
wxDELETE( m_choice );
|
||||||
m_text = NULL;
|
|
||||||
}
|
|
||||||
if (m_choice != NULL) {
|
|
||||||
delete m_choice;
|
|
||||||
m_choice = NULL;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@@ -782,12 +776,12 @@ bool wxComboBox::CanRedo() const
|
|||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
wxInt32 wxComboBox::MacControlHit(WXEVENTHANDLERREF WXUNUSED(handler) , WXEVENTREF WXUNUSED(event) )
|
bool wxComboBox::HandleClicked( double timestampsec )
|
||||||
{
|
{
|
||||||
wxCommandEvent event(wxEVT_COMMAND_COMBOBOX_SELECTED, m_windowId );
|
wxCommandEvent event(wxEVT_COMMAND_COMBOBOX_SELECTED, m_windowId );
|
||||||
event.SetInt(GetSelection());
|
event.SetInt(GetSelection());
|
||||||
event.SetEventObject(this);
|
event.SetEventObject(this);
|
||||||
event.SetString(GetStringSelection());
|
event.SetString(GetStringSelection());
|
||||||
ProcessCommand(event);
|
ProcessCommand(event);
|
||||||
return noErr;
|
return true;
|
||||||
}
|
}
|
||||||
|
@@ -1,5 +1,5 @@
|
|||||||
/////////////////////////////////////////////////////////////////////////////
|
/////////////////////////////////////////////////////////////////////////////
|
||||||
// Name: src/mac/carbon/control.cpp
|
// Name: src/osx/carbon/control.cpp
|
||||||
// Purpose: wxControl class
|
// Purpose: wxControl class
|
||||||
// Author: Stefan Csomor
|
// Author: Stefan Csomor
|
||||||
// Modified by:
|
// Modified by:
|
||||||
@@ -31,7 +31,6 @@
|
|||||||
#include "wx/tabctrl.h"
|
#include "wx/tabctrl.h"
|
||||||
#include "wx/spinbutt.h"
|
#include "wx/spinbutt.h"
|
||||||
|
|
||||||
#include "wx/osx/uma.h"
|
|
||||||
#include "wx/osx/private.h"
|
#include "wx/osx/private.h"
|
||||||
|
|
||||||
IMPLEMENT_ABSTRACT_CLASS(wxControl, wxWindow)
|
IMPLEMENT_ABSTRACT_CLASS(wxControl, wxWindow)
|
||||||
@@ -86,6 +85,7 @@ void wxControl::OnKeyDown( wxKeyEvent &WXUNUSED(event) )
|
|||||||
if ( m_peer == NULL || !m_peer->IsOk() )
|
if ( m_peer == NULL || !m_peer->IsOk() )
|
||||||
return;
|
return;
|
||||||
|
|
||||||
|
#if wxOSX_USE_CARBON
|
||||||
UInt32 keyCode, modifiers;
|
UInt32 keyCode, modifiers;
|
||||||
char charCode;
|
char charCode;
|
||||||
|
|
||||||
@@ -94,4 +94,7 @@ void wxControl::OnKeyDown( wxKeyEvent &WXUNUSED(event) )
|
|||||||
GetEventParameter( (EventRef)wxTheApp->MacGetCurrentEvent(), kEventParamKeyModifiers, typeUInt32, NULL, sizeof(UInt32), NULL, &modifiers );
|
GetEventParameter( (EventRef)wxTheApp->MacGetCurrentEvent(), kEventParamKeyModifiers, typeUInt32, NULL, sizeof(UInt32), NULL, &modifiers );
|
||||||
|
|
||||||
m_peer->HandleKey( keyCode, charCode, modifiers );
|
m_peer->HandleKey( keyCode, charCode, modifiers );
|
||||||
|
#else
|
||||||
|
// TODO
|
||||||
|
#endif
|
||||||
}
|
}
|
||||||
|
@@ -1,5 +1,5 @@
|
|||||||
/////////////////////////////////////////////////////////////////////////////
|
/////////////////////////////////////////////////////////////////////////////
|
||||||
// Name: src/mac/carbon/cursor.cpp
|
// Name: src/osx/carbon/cursor.cpp
|
||||||
// Purpose: wxCursor class
|
// Purpose: wxCursor class
|
||||||
// Author: Stefan Csomor
|
// Author: Stefan Csomor
|
||||||
// Modified by:
|
// Modified by:
|
||||||
|
@@ -1,5 +1,5 @@
|
|||||||
/////////////////////////////////////////////////////////////////////////////
|
/////////////////////////////////////////////////////////////////////////////
|
||||||
// Name: src/mac/carbon/databrow.cpp
|
// Name: src/osx/carbon/databrow.cpp
|
||||||
// Purpose: Classes and functions for the Carbon data browser
|
// Purpose: Classes and functions for the Carbon data browser
|
||||||
// Author:
|
// Author:
|
||||||
// Modified by:
|
// Modified by:
|
||||||
|
@@ -1,5 +1,5 @@
|
|||||||
///////////////////////////////////////////////////////////////////////////////
|
///////////////////////////////////////////////////////////////////////////////
|
||||||
// Name: src/mac/carbon/dataobj.cpp
|
// Name: src/osx/carbon/dataobj.cpp
|
||||||
// Purpose: implementation of wxDataObject class
|
// Purpose: implementation of wxDataObject class
|
||||||
// Author: Stefan Csomor
|
// Author: Stefan Csomor
|
||||||
// Modified by:
|
// Modified by:
|
||||||
@@ -27,7 +27,7 @@
|
|||||||
#include "wx/metafile.h"
|
#include "wx/metafile.h"
|
||||||
#include "wx/tokenzr.h"
|
#include "wx/tokenzr.h"
|
||||||
|
|
||||||
#include "wx/osx/uma.h"
|
#include "wx/osx/private.h"
|
||||||
|
|
||||||
#ifdef __DARWIN__
|
#ifdef __DARWIN__
|
||||||
#include <QuickTime/QuickTime.h>
|
#include <QuickTime/QuickTime.h>
|
||||||
|
@@ -1,5 +1,5 @@
|
|||||||
/////////////////////////////////////////////////////////////////////////////
|
/////////////////////////////////////////////////////////////////////////////
|
||||||
// Name: src/mac/carbon/datavgen.cpp
|
// Name: src/osx/carbon/datavgen.cpp
|
||||||
// Purpose: wxDataViewCtrl native mac implementation
|
// Purpose: wxDataViewCtrl native mac implementation
|
||||||
// Author:
|
// Author:
|
||||||
// Id: $Id$
|
// Id: $Id$
|
||||||
|
@@ -1,5 +1,5 @@
|
|||||||
/////////////////////////////////////////////////////////////////////////////
|
/////////////////////////////////////////////////////////////////////////////
|
||||||
// Name: src/mac/carbon/dcclient.cpp
|
// Name: src/osx/carbon/dcclient.cpp
|
||||||
// Purpose: wxClientDCImpl class
|
// Purpose: wxClientDCImpl class
|
||||||
// Author: Stefan Csomor
|
// Author: Stefan Csomor
|
||||||
// Modified by:
|
// Modified by:
|
||||||
@@ -96,7 +96,6 @@ void wxWindowDCImpl::DoGetSize( int* width, int* height ) const
|
|||||||
*height = m_height;
|
*height = m_height;
|
||||||
}
|
}
|
||||||
|
|
||||||
#if wxOSX_USE_CARBON
|
|
||||||
wxBitmap wxWindowDCImpl::DoGetAsBitmap(const wxRect *subrect) const
|
wxBitmap wxWindowDCImpl::DoGetAsBitmap(const wxRect *subrect) const
|
||||||
{
|
{
|
||||||
// wxScreenDC is derived from wxWindowDC, so a screen dc will
|
// wxScreenDC is derived from wxWindowDC, so a screen dc will
|
||||||
@@ -104,6 +103,7 @@ wxBitmap wxWindowDCImpl::DoGetAsBitmap(const wxRect *subrect) const
|
|||||||
if (!m_window)
|
if (!m_window)
|
||||||
return wxNullBitmap;
|
return wxNullBitmap;
|
||||||
|
|
||||||
|
#if wxOSX_USE_CARBON
|
||||||
ControlRef handle = (ControlRef) m_window->GetHandle();
|
ControlRef handle = (ControlRef) m_window->GetHandle();
|
||||||
if ( !handle )
|
if ( !handle )
|
||||||
return wxNullBitmap;
|
return wxNullBitmap;
|
||||||
@@ -135,10 +135,11 @@ wxBitmap wxWindowDCImpl::DoGetAsBitmap(const wxRect *subrect) const
|
|||||||
CGContextDrawImage( context, rect, image );
|
CGContextDrawImage( context, rect, image );
|
||||||
|
|
||||||
CGContextRestoreGState(context);
|
CGContextRestoreGState(context);
|
||||||
|
|
||||||
return bmp;
|
return bmp;
|
||||||
}
|
#else
|
||||||
|
return wxNullBitmap;
|
||||||
#endif
|
#endif
|
||||||
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* wxClientDCImpl
|
* wxClientDCImpl
|
||||||
|
@@ -1,5 +1,5 @@
|
|||||||
/////////////////////////////////////////////////////////////////////////////
|
/////////////////////////////////////////////////////////////////////////////
|
||||||
// Name: src/mac/carbon/dcprint.cpp
|
// Name: src/osx/carbon/dcprint.cpp
|
||||||
// Purpose: wxPrinterDC class
|
// Purpose: wxPrinterDC class
|
||||||
// Author: Julian Smart
|
// Author: Julian Smart
|
||||||
// Modified by:
|
// Modified by:
|
||||||
@@ -25,7 +25,7 @@
|
|||||||
#include "wx/math.h"
|
#include "wx/math.h"
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#include "wx/osx/uma.h"
|
#include "wx/osx/private.h"
|
||||||
#include "wx/osx/private/print.h"
|
#include "wx/osx/private/print.h"
|
||||||
#include "wx/osx/carbon/dcprint.h"
|
#include "wx/osx/carbon/dcprint.h"
|
||||||
#include "wx/graphics.h"
|
#include "wx/graphics.h"
|
||||||
|
@@ -1,5 +1,5 @@
|
|||||||
/////////////////////////////////////////////////////////////////////////////
|
/////////////////////////////////////////////////////////////////////////////
|
||||||
// Name: src/mac/carbon/dcscreen.cpp
|
// Name: src/osx/carbon/dcscreen.cpp
|
||||||
// Purpose: wxScreenDC class
|
// Purpose: wxScreenDC class
|
||||||
// Author: Stefan Csomor
|
// Author: Stefan Csomor
|
||||||
// Modified by:
|
// Modified by:
|
||||||
|
@@ -1,5 +1,5 @@
|
|||||||
/////////////////////////////////////////////////////////////////////////////
|
/////////////////////////////////////////////////////////////////////////////
|
||||||
// Name: src/mac/carbon/dialog.cpp
|
// Name: src/osx/carbon/dialog.cpp
|
||||||
// Purpose: wxDialog class
|
// Purpose: wxDialog class
|
||||||
// Author: Stefan Csomor
|
// Author: Stefan Csomor
|
||||||
// Modified by:
|
// Modified by:
|
||||||
@@ -20,112 +20,10 @@
|
|||||||
#include "wx/settings.h"
|
#include "wx/settings.h"
|
||||||
#endif // WX_PRECOMP
|
#endif // WX_PRECOMP
|
||||||
|
|
||||||
#include "wx/osx/uma.h"
|
#include "wx/osx/private.h"
|
||||||
|
#include "wx/evtloop.h"
|
||||||
|
|
||||||
|
extern wxList wxModalDialogs;
|
||||||
// Lists to keep track of windows, so we can disable/enable them
|
|
||||||
// for modal dialogs
|
|
||||||
wxList wxModalDialogs;
|
|
||||||
|
|
||||||
IMPLEMENT_DYNAMIC_CLASS(wxDialog, wxTopLevelWindow)
|
|
||||||
|
|
||||||
void wxDialog::Init()
|
|
||||||
{
|
|
||||||
m_isModalStyle = false;
|
|
||||||
}
|
|
||||||
|
|
||||||
bool wxDialog::Create( wxWindow *parent,
|
|
||||||
wxWindowID id,
|
|
||||||
const wxString& title,
|
|
||||||
const wxPoint& pos,
|
|
||||||
const wxSize& size,
|
|
||||||
long style,
|
|
||||||
const wxString& name )
|
|
||||||
{
|
|
||||||
SetExtraStyle( GetExtraStyle() | wxTOPLEVEL_EX_DIALOG );
|
|
||||||
|
|
||||||
// All dialogs should really have this style...
|
|
||||||
style |= wxTAB_TRAVERSAL;
|
|
||||||
|
|
||||||
// ...but not these styles
|
|
||||||
style &= ~(wxYES | wxOK | wxNO); // | wxCANCEL
|
|
||||||
|
|
||||||
if ( !wxTopLevelWindow::Create( parent, id, title, pos, size, style, name ) )
|
|
||||||
return false;
|
|
||||||
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
|
|
||||||
void wxDialog::SetModal( bool flag )
|
|
||||||
{
|
|
||||||
if ( flag )
|
|
||||||
{
|
|
||||||
m_isModalStyle = true;
|
|
||||||
|
|
||||||
SetWindowModality( (WindowRef)GetWXWindow(), kWindowModalityAppModal, NULL ) ;
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
m_isModalStyle = false;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
wxDialog::~wxDialog()
|
|
||||||
{
|
|
||||||
m_isBeingDeleted = true;
|
|
||||||
|
|
||||||
// if the dialog is modal, this will end its event loop
|
|
||||||
Show(false);
|
|
||||||
}
|
|
||||||
|
|
||||||
// On mac command-stop does the same thing as Esc, let the base class know
|
|
||||||
// about it
|
|
||||||
bool wxDialog::IsEscapeKey(const wxKeyEvent& event)
|
|
||||||
{
|
|
||||||
if ( event.GetKeyCode() == '.' && event.GetModifiers() == wxMOD_CMD )
|
|
||||||
return true;
|
|
||||||
|
|
||||||
return wxDialogBase::IsEscapeKey(event);
|
|
||||||
}
|
|
||||||
|
|
||||||
bool wxDialog::IsModal() const
|
|
||||||
{
|
|
||||||
return wxModalDialogs.Find((wxDialog *)this) != NULL; // const_cast
|
|
||||||
// return m_isModalStyle;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
bool wxDialog::Show(bool show)
|
|
||||||
{
|
|
||||||
if ( !wxDialogBase::Show(show) )
|
|
||||||
// nothing to do
|
|
||||||
return false;
|
|
||||||
|
|
||||||
if (show && CanDoLayoutAdaptation())
|
|
||||||
DoLayoutAdaptation();
|
|
||||||
|
|
||||||
if ( show )
|
|
||||||
// usually will result in TransferDataToWindow() being called
|
|
||||||
InitDialog();
|
|
||||||
|
|
||||||
HiliteMenu(0);
|
|
||||||
|
|
||||||
if ( m_isModalStyle )
|
|
||||||
{
|
|
||||||
if ( show )
|
|
||||||
{
|
|
||||||
DoShowModal();
|
|
||||||
}
|
|
||||||
else // end of modal dialog
|
|
||||||
{
|
|
||||||
// this will cause IsModalShowing() return false and our local
|
|
||||||
// message loop will terminate
|
|
||||||
wxModalDialogs.DeleteObject(this);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
|
|
||||||
void wxDialog::DoShowModal()
|
void wxDialog::DoShowModal()
|
||||||
{
|
{
|
||||||
@@ -149,10 +47,16 @@ void wxDialog::DoShowModal()
|
|||||||
}
|
}
|
||||||
BeginAppModalStateForWindow(windowRef) ;
|
BeginAppModalStateForWindow(windowRef) ;
|
||||||
|
|
||||||
while ( IsModal() )
|
wxEventLoop * const
|
||||||
|
loop = wx_static_cast(wxEventLoop *, wxEventLoop::GetActive());
|
||||||
|
|
||||||
|
|
||||||
|
wxASSERT_MSG( loop , wxT("No Event Loop in place") );
|
||||||
|
|
||||||
|
if ( loop )
|
||||||
{
|
{
|
||||||
wxTheApp->MacDoOneEvent() ;
|
while ( IsModal() )
|
||||||
// calls process idle itself
|
loop->Dispatch();
|
||||||
}
|
}
|
||||||
|
|
||||||
EndAppModalStateForWindow(windowRef) ;
|
EndAppModalStateForWindow(windowRef) ;
|
||||||
@@ -161,28 +65,3 @@ void wxDialog::DoShowModal()
|
|||||||
SetWindowGroupParent( windowGroup , formerParentGroup );
|
SetWindowGroupParent( windowGroup , formerParentGroup );
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
// Replacement for Show(true) for modal dialogs - returns return code
|
|
||||||
int wxDialog::ShowModal()
|
|
||||||
{
|
|
||||||
if ( !m_isModalStyle )
|
|
||||||
SetModal(true);
|
|
||||||
|
|
||||||
if ( IsShown() )
|
|
||||||
DoShowModal();
|
|
||||||
else
|
|
||||||
Show(true);
|
|
||||||
|
|
||||||
return GetReturnCode();
|
|
||||||
}
|
|
||||||
|
|
||||||
// NB: this function (surprizingly) may be called for both modal and modeless
|
|
||||||
// dialogs and should work for both of them
|
|
||||||
void wxDialog::EndModal(int retCode)
|
|
||||||
{
|
|
||||||
SetReturnCode(retCode);
|
|
||||||
Show(false);
|
|
||||||
SetModal(false);
|
|
||||||
}
|
|
||||||
|
|
||||||
|
@@ -1,5 +1,5 @@
|
|||||||
/////////////////////////////////////////////////////////////////////////////
|
/////////////////////////////////////////////////////////////////////////////
|
||||||
// Name: src/mac/carbon/dirdlg.cpp
|
// Name: src/osx/carbon/dirdlg.cpp
|
||||||
// Purpose: wxDirDialog
|
// Purpose: wxDirDialog
|
||||||
// Author: Stefan Csomor
|
// Author: Stefan Csomor
|
||||||
// Modified by:
|
// Modified by:
|
||||||
@@ -25,12 +25,6 @@
|
|||||||
|
|
||||||
#include "wx/osx/private.h"
|
#include "wx/osx/private.h"
|
||||||
|
|
||||||
#ifdef __DARWIN__
|
|
||||||
#include <Carbon/Carbon.h>
|
|
||||||
#else
|
|
||||||
#include <Navigation.h>
|
|
||||||
#endif
|
|
||||||
|
|
||||||
IMPLEMENT_CLASS(wxDirDialog, wxDialog)
|
IMPLEMENT_CLASS(wxDirDialog, wxDialog)
|
||||||
|
|
||||||
static pascal void NavEventProc(
|
static pascal void NavEventProc(
|
||||||
@@ -64,15 +58,17 @@ static pascal void NavEventProc(
|
|||||||
wxDirDialog::wxDirDialog(wxWindow *parent,
|
wxDirDialog::wxDirDialog(wxWindow *parent,
|
||||||
const wxString& message,
|
const wxString& message,
|
||||||
const wxString& defaultPath,
|
const wxString& defaultPath,
|
||||||
long WXUNUSED(style),
|
long style,
|
||||||
const wxPoint& WXUNUSED(pos),
|
const wxPoint& WXUNUSED(pos),
|
||||||
const wxSize& WXUNUSED(size),
|
const wxSize& WXUNUSED(size),
|
||||||
const wxString& WXUNUSED(name))
|
const wxString& WXUNUSED(name))
|
||||||
{
|
{
|
||||||
wxASSERT_MSG( NavServicesAvailable() , wxT("Navigation Services are not running") ) ;
|
wxASSERT_MSG( NavServicesAvailable() , wxT("Navigation Services are not running") ) ;
|
||||||
m_message = message;
|
|
||||||
m_parent = parent;
|
m_parent = parent;
|
||||||
m_path = defaultPath;
|
|
||||||
|
SetMessage( message );
|
||||||
|
SetWindowStyle(style);
|
||||||
|
SetPath(defaultPath);
|
||||||
}
|
}
|
||||||
|
|
||||||
int wxDirDialog::ShowModal()
|
int wxDirDialog::ShowModal()
|
||||||
|
@@ -1,5 +1,5 @@
|
|||||||
///////////////////////////////////////////////////////////////////////////////
|
///////////////////////////////////////////////////////////////////////////////
|
||||||
// Name: src/mac/carbon/dnd.cpp
|
// Name: src/osx/carbon/dnd.cpp
|
||||||
// Purpose: wxDropTarget, wxDropSource implementations
|
// Purpose: wxDropTarget, wxDropSource implementations
|
||||||
// Author: Stefan Csomor
|
// Author: Stefan Csomor
|
||||||
// Modified by:
|
// Modified by:
|
||||||
|
@@ -1,5 +1,5 @@
|
|||||||
///////////////////////////////////////////////////////////////////////////////
|
///////////////////////////////////////////////////////////////////////////////
|
||||||
// Name: src/mac/carbon/evtloop.cpp
|
// Name: src/osx/carbon/evtloop.cpp
|
||||||
// Purpose: implementation of wxEventLoop for wxMac
|
// Purpose: implementation of wxEventLoop for wxMac
|
||||||
// Author: Vadim Zeitlin
|
// Author: Vadim Zeitlin
|
||||||
// Modified by:
|
// Modified by:
|
||||||
@@ -30,47 +30,17 @@
|
|||||||
#include "wx/app.h"
|
#include "wx/app.h"
|
||||||
#endif // WX_PRECOMP
|
#endif // WX_PRECOMP
|
||||||
|
|
||||||
#if wxOSX_USE_CARBON
|
#include "wx/osx/private.h"
|
||||||
#include <Carbon/Carbon.h>
|
|
||||||
#else
|
|
||||||
#include <CoreFoundation/CoreFoundation.h>
|
|
||||||
#endif
|
|
||||||
// ============================================================================
|
// ============================================================================
|
||||||
// wxEventLoop implementation
|
// wxEventLoop implementation
|
||||||
// ============================================================================
|
// ============================================================================
|
||||||
|
|
||||||
// ----------------------------------------------------------------------------
|
wxGUIEventLoop::wxGUIEventLoop()
|
||||||
// high level functions for RunApplicationEventLoop() case
|
|
||||||
// ----------------------------------------------------------------------------
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
#if wxOSX_USE_RUN_APP_EVENT_LOOP
|
|
||||||
|
|
||||||
int wxGUIEventLoop::Run()
|
|
||||||
{
|
{
|
||||||
wxEventLoopActivator activate(this);
|
m_sleepTime = kEventDurationNoWait;
|
||||||
|
|
||||||
RunApplicationEventLoop();
|
|
||||||
|
|
||||||
return m_exitcode;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void wxGUIEventLoop::Exit(int rc)
|
|
||||||
{
|
|
||||||
m_exitcode = rc;
|
|
||||||
|
|
||||||
QuitApplicationEventLoop();
|
|
||||||
|
|
||||||
OnExit();
|
|
||||||
}
|
|
||||||
|
|
||||||
#else // manual event loop
|
|
||||||
|
|
||||||
// ----------------------------------------------------------------------------
|
|
||||||
// functions only used by wxEventLoopManual-based implementation
|
|
||||||
// ----------------------------------------------------------------------------
|
|
||||||
|
|
||||||
void wxGUIEventLoop::WakeUp()
|
void wxGUIEventLoop::WakeUp()
|
||||||
{
|
{
|
||||||
extern void wxMacWakeUp();
|
extern void wxMacWakeUp();
|
||||||
@@ -78,15 +48,8 @@ void wxGUIEventLoop::WakeUp()
|
|||||||
wxMacWakeUp();
|
wxMacWakeUp();
|
||||||
}
|
}
|
||||||
|
|
||||||
#endif // high/low-level event loop
|
|
||||||
|
|
||||||
// ----------------------------------------------------------------------------
|
|
||||||
// low level functions used in both cases
|
|
||||||
// ----------------------------------------------------------------------------
|
|
||||||
|
|
||||||
bool wxGUIEventLoop::Pending() const
|
bool wxGUIEventLoop::Pending() const
|
||||||
{
|
{
|
||||||
#if wxOSX_USE_CARBON
|
|
||||||
EventRef theEvent;
|
EventRef theEvent;
|
||||||
|
|
||||||
return ReceiveNextEvent
|
return ReceiveNextEvent
|
||||||
@@ -97,9 +60,6 @@ bool wxGUIEventLoop::Pending() const
|
|||||||
false, // don't remove the event from queue
|
false, // don't remove the event from queue
|
||||||
&theEvent
|
&theEvent
|
||||||
) == noErr;
|
) == noErr;
|
||||||
#else
|
|
||||||
return true; // TODO
|
|
||||||
#endif
|
|
||||||
}
|
}
|
||||||
|
|
||||||
bool wxGUIEventLoop::Dispatch()
|
bool wxGUIEventLoop::Dispatch()
|
||||||
@@ -107,13 +67,45 @@ bool wxGUIEventLoop::Dispatch()
|
|||||||
if ( !wxTheApp )
|
if ( !wxTheApp )
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
#if wxOSX_USE_CARBON
|
wxMacAutoreleasePool autoreleasepool;
|
||||||
// TODO: we probably should do the dispatching directly from here but for
|
|
||||||
// now it's easier to forward to wxApp which has all the code to do
|
EventRef theEvent;
|
||||||
// it
|
|
||||||
wxTheApp->MacDoOneEvent();
|
OSStatus status = ReceiveNextEvent(0, NULL, m_sleepTime, true, &theEvent) ;
|
||||||
#else
|
|
||||||
CFRunLoopRunInMode(kCFRunLoopDefaultMode, 0, 0);
|
switch (status)
|
||||||
|
{
|
||||||
|
case eventLoopTimedOutErr :
|
||||||
|
if ( wxTheApp->ProcessIdle() )
|
||||||
|
m_sleepTime = kEventDurationNoWait ;
|
||||||
|
else
|
||||||
|
{
|
||||||
|
m_sleepTime = kEventDurationSecond;
|
||||||
|
#if wxUSE_THREADS
|
||||||
|
wxMutexGuiLeave();
|
||||||
|
wxMilliSleep(20);
|
||||||
|
wxMutexGuiEnter();
|
||||||
#endif
|
#endif
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
|
||||||
|
case eventLoopQuitErr :
|
||||||
|
// according to QA1061 this may also occur
|
||||||
|
// when a WakeUp Process is executed
|
||||||
|
break;
|
||||||
|
|
||||||
|
default:
|
||||||
|
if ( wxTheApp )
|
||||||
|
wxTheApp->MacSetCurrentEvent( theEvent, NULL );
|
||||||
|
|
||||||
|
OSStatus status = SendEventToEventTarget(theEvent, GetEventDispatcherTarget());
|
||||||
|
if (status == eventNotHandledErr && wxTheApp)
|
||||||
|
wxTheApp->MacHandleUnhandledEvent(theEvent);
|
||||||
|
|
||||||
|
ReleaseEvent( theEvent );
|
||||||
|
m_sleepTime = kEventDurationNoWait ;
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
@@ -1,5 +1,5 @@
|
|||||||
/////////////////////////////////////////////////////////////////////////////
|
/////////////////////////////////////////////////////////////////////////////
|
||||||
// Name: src/mac/carbon/filedlg.cpp
|
// Name: src/osx/carbon/filedlg.cpp
|
||||||
// Purpose: wxFileDialog
|
// Purpose: wxFileDialog
|
||||||
// Author: Stefan Csomor
|
// Author: Stefan Csomor
|
||||||
// Modified by:
|
// Modified by:
|
||||||
|
@@ -1,5 +1,5 @@
|
|||||||
/////////////////////////////////////////////////////////////////////////////
|
/////////////////////////////////////////////////////////////////////////////
|
||||||
// Name: src/mac/carbon/font.cpp
|
// Name: src/osx/carbon/font.cpp
|
||||||
// Purpose: wxFont class
|
// Purpose: wxFont class
|
||||||
// Author: Stefan Csomor
|
// Author: Stefan Csomor
|
||||||
// Modified by:
|
// Modified by:
|
||||||
@@ -31,10 +31,6 @@
|
|||||||
#include "wx/osx/private.h"
|
#include "wx/osx/private.h"
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#ifndef __DARWIN__
|
|
||||||
#include <ATSUnicode.h>
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#include <map>
|
#include <map>
|
||||||
#include <string>
|
#include <string>
|
||||||
|
|
||||||
@@ -739,6 +735,7 @@ bool wxFont::MacCreateFromCTFontDescriptor( const void * ctFontDescriptor , int
|
|||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
#if wxOSX_USE_CARBON
|
||||||
bool wxFont::MacCreateFromThemeFont(wxUint16 themeFontID)
|
bool wxFont::MacCreateFromThemeFont(wxUint16 themeFontID)
|
||||||
{
|
{
|
||||||
#if wxOSX_USE_CORE_TEXT
|
#if wxOSX_USE_CORE_TEXT
|
||||||
@@ -762,6 +759,7 @@ bool wxFont::MacCreateFromThemeFont(wxUint16 themeFontID)
|
|||||||
#endif
|
#endif
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
#endif
|
||||||
|
|
||||||
wxFont::~wxFont()
|
wxFont::~wxFont()
|
||||||
{
|
{
|
||||||
|
@@ -1,5 +1,5 @@
|
|||||||
/////////////////////////////////////////////////////////////////////////////
|
/////////////////////////////////////////////////////////////////////////////
|
||||||
// Name: src/mac/carbon/fontdlg.cpp
|
// Name: src/osx/carbon/fontdlg.cpp
|
||||||
// Purpose: wxFontDialog class for carbon 10.2+.
|
// Purpose: wxFontDialog class for carbon 10.2+.
|
||||||
// Author: Ryan Norton
|
// Author: Ryan Norton
|
||||||
// Modified by:
|
// Modified by:
|
||||||
@@ -46,12 +46,14 @@
|
|||||||
|
|
||||||
IMPLEMENT_DYNAMIC_CLASS(wxFontDialog, wxDialog)
|
IMPLEMENT_DYNAMIC_CLASS(wxFontDialog, wxDialog)
|
||||||
|
|
||||||
#include "wx/osx/uma.h"
|
#include "wx/osx/private.h"
|
||||||
|
|
||||||
// ---------------------------------------------------------------------------
|
// ---------------------------------------------------------------------------
|
||||||
// wxFontDialog
|
// wxFontDialog
|
||||||
// ---------------------------------------------------------------------------
|
// ---------------------------------------------------------------------------
|
||||||
|
|
||||||
|
#if wxOSX_USE_CARBON
|
||||||
|
|
||||||
static const EventTypeSpec eventList[] =
|
static const EventTypeSpec eventList[] =
|
||||||
{
|
{
|
||||||
{ kEventClassFont, kEventFontSelection } ,
|
{ kEventClassFont, kEventFontSelection } ,
|
||||||
@@ -191,6 +193,7 @@ wxMacCarbonFontPanelHandler(EventHandlerCallRef WXUNUSED(nextHandler),
|
|||||||
}
|
}
|
||||||
|
|
||||||
DEFINE_ONE_SHOT_HANDLER_GETTER( wxMacCarbonFontPanelHandler )
|
DEFINE_ONE_SHOT_HANDLER_GETTER( wxMacCarbonFontPanelHandler )
|
||||||
|
#endif
|
||||||
|
|
||||||
wxFontDialog::wxFontDialog()
|
wxFontDialog::wxFontDialog()
|
||||||
{
|
{
|
||||||
@@ -213,6 +216,8 @@ bool wxFontDialog::Create(wxWindow *WXUNUSED(parent), const wxFontData& data)
|
|||||||
|
|
||||||
int wxFontDialog::ShowModal()
|
int wxFontDialog::ShowModal()
|
||||||
{
|
{
|
||||||
|
#if wxOSX_USE_CARBON
|
||||||
|
|
||||||
OSStatus err ;
|
OSStatus err ;
|
||||||
wxFont font = *wxNORMAL_FONT ;
|
wxFont font = *wxNORMAL_FONT ;
|
||||||
if ( m_fontData.m_initialFont.Ok() )
|
if ( m_fontData.m_initialFont.Ok() )
|
||||||
@@ -247,10 +252,12 @@ int wxFontDialog::ShowModal()
|
|||||||
|
|
||||||
if ( !FPIsFontPanelVisible() )
|
if ( !FPIsFontPanelVisible() )
|
||||||
FPShowHideFontPanel();
|
FPShowHideFontPanel();
|
||||||
|
#endif
|
||||||
int retval = RunMixedFontDialog(this);
|
int retval = RunMixedFontDialog(this);
|
||||||
|
|
||||||
|
#if wxOSX_USE_CARBON
|
||||||
::RemoveEventHandler(handler);
|
::RemoveEventHandler(handler);
|
||||||
|
#endif
|
||||||
|
|
||||||
return retval ;
|
return retval ;
|
||||||
}
|
}
|
||||||
|
@@ -1,5 +1,5 @@
|
|||||||
/////////////////////////////////////////////////////////////////////////////
|
/////////////////////////////////////////////////////////////////////////////
|
||||||
// Name: src/mac/carbon/fontdlgosx.cpp
|
// Name: src/osx/carbon/fontdlgosx.cpp
|
||||||
// Purpose: wxFontDialog class.
|
// Purpose: wxFontDialog class.
|
||||||
// Author: Ryan Norton
|
// Author: Ryan Norton
|
||||||
// Modified by:
|
// Modified by:
|
||||||
@@ -42,7 +42,7 @@
|
|||||||
#import <Foundation/Foundation.h>
|
#import <Foundation/Foundation.h>
|
||||||
#import <AppKit/AppKit.h>
|
#import <AppKit/AppKit.h>
|
||||||
|
|
||||||
#include "wx/osx/uma.h"
|
#include "wx/osx/private.h"
|
||||||
|
|
||||||
@interface wxMacFontPanelAccView : NSView
|
@interface wxMacFontPanelAccView : NSView
|
||||||
{
|
{
|
||||||
@@ -152,9 +152,11 @@ int RunMixedFontDialog(wxFontDialog* WXUNUSED(dialog))
|
|||||||
NSFontPanel* fontPanel = [NSFontPanel sharedFontPanel] ;
|
NSFontPanel* fontPanel = [NSFontPanel sharedFontPanel] ;
|
||||||
|
|
||||||
// adjust modality for carbon environment
|
// adjust modality for carbon environment
|
||||||
|
#if wxOSX_USE_CARBON
|
||||||
WindowRef carbonWindowRef = (WindowRef)[fontPanel windowRef] ;
|
WindowRef carbonWindowRef = (WindowRef)[fontPanel windowRef] ;
|
||||||
SetWindowModality(carbonWindowRef, kWindowModalityAppModal , 0) ;
|
SetWindowModality(carbonWindowRef, kWindowModalityAppModal , 0) ;
|
||||||
SetWindowGroup(carbonWindowRef , GetWindowGroupOfClass(kMovableModalWindowClass));
|
SetWindowGroup(carbonWindowRef , GetWindowGroupOfClass(kMovableModalWindowClass));
|
||||||
|
#endif
|
||||||
|
|
||||||
[fontPanel setFloatingPanel:NO] ;
|
[fontPanel setFloatingPanel:NO] ;
|
||||||
[[fontPanel standardWindowButton:NSWindowCloseButton] setEnabled:NO] ;
|
[[fontPanel standardWindowButton:NSWindowCloseButton] setEnabled:NO] ;
|
||||||
@@ -179,8 +181,10 @@ int RunMixedFontDialog(wxFontDialog* WXUNUSED(dialog))
|
|||||||
|
|
||||||
// if we don't reenable it, FPShowHideFontPanel does not work
|
// if we don't reenable it, FPShowHideFontPanel does not work
|
||||||
[[fontPanel standardWindowButton:NSWindowCloseButton] setEnabled:YES] ;
|
[[fontPanel standardWindowButton:NSWindowCloseButton] setEnabled:YES] ;
|
||||||
|
#if wxOSX_USE_CARBON
|
||||||
if( FPIsFontPanelVisible())
|
if( FPIsFontPanelVisible())
|
||||||
FPShowHideFontPanel() ;
|
FPShowHideFontPanel() ;
|
||||||
|
#endif
|
||||||
|
|
||||||
if ( [accessoryView closedWithOk])
|
if ( [accessoryView closedWithOk])
|
||||||
{
|
{
|
||||||
|
@@ -1,5 +1,5 @@
|
|||||||
/////////////////////////////////////////////////////////////////////////////
|
/////////////////////////////////////////////////////////////////////////////
|
||||||
// Name: src/mac/carbon/frame.cpp
|
// Name: src/osx/carbon/frame.cpp
|
||||||
// Purpose: wxFrame
|
// Purpose: wxFrame
|
||||||
// Author: Stefan Csomor
|
// Author: Stefan Csomor
|
||||||
// Modified by:
|
// Modified by:
|
||||||
@@ -24,14 +24,11 @@
|
|||||||
#include "wx/menuitem.h"
|
#include "wx/menuitem.h"
|
||||||
#endif // WX_PRECOMP
|
#endif // WX_PRECOMP
|
||||||
|
|
||||||
#include "wx/osx/uma.h"
|
#include "wx/osx/private.h"
|
||||||
|
|
||||||
BEGIN_EVENT_TABLE(wxFrame, wxFrameBase)
|
BEGIN_EVENT_TABLE(wxFrame, wxFrameBase)
|
||||||
EVT_ACTIVATE(wxFrame::OnActivate)
|
EVT_ACTIVATE(wxFrame::OnActivate)
|
||||||
// EVT_MENU_HIGHLIGHT_ALL(wxFrame::OnMenuHighlight)
|
|
||||||
EVT_SYS_COLOUR_CHANGED(wxFrame::OnSysColourChanged)
|
EVT_SYS_COLOUR_CHANGED(wxFrame::OnSysColourChanged)
|
||||||
// EVT_IDLE(wxFrame::OnIdle)
|
|
||||||
// EVT_CLOSE(wxFrame::OnCloseWindow)
|
|
||||||
END_EVENT_TABLE()
|
END_EVENT_TABLE()
|
||||||
|
|
||||||
IMPLEMENT_DYNAMIC_CLASS(wxFrame, wxTopLevelWindow)
|
IMPLEMENT_DYNAMIC_CLASS(wxFrame, wxTopLevelWindow)
|
||||||
@@ -101,6 +98,7 @@ bool wxFrame::Enable(bool enable)
|
|||||||
if ( !wxWindow::Enable(enable) )
|
if ( !wxWindow::Enable(enable) )
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
|
#if wxUSE_MENUS
|
||||||
if ( m_frameMenuBar && m_frameMenuBar == wxMenuBar::MacGetInstalledMenuBar() )
|
if ( m_frameMenuBar && m_frameMenuBar == wxMenuBar::MacGetInstalledMenuBar() )
|
||||||
{
|
{
|
||||||
int iMaxMenu = m_frameMenuBar->GetMenuCount();
|
int iMaxMenu = m_frameMenuBar->GetMenuCount();
|
||||||
@@ -109,7 +107,7 @@ bool wxFrame::Enable(bool enable)
|
|||||||
m_frameMenuBar->EnableTop( i , enable ) ;
|
m_frameMenuBar->EnableTop( i , enable ) ;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
#endif
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -198,6 +196,7 @@ void wxFrame::OnActivate(wxActivateEvent& event)
|
|||||||
|
|
||||||
wxSetFocusToChild(parent, &m_winLastFocused);
|
wxSetFocusToChild(parent, &m_winLastFocused);
|
||||||
|
|
||||||
|
#if wxUSE_MENUS
|
||||||
if (m_frameMenuBar != NULL)
|
if (m_frameMenuBar != NULL)
|
||||||
{
|
{
|
||||||
m_frameMenuBar->MacInstallMenuBar();
|
m_frameMenuBar->MacInstallMenuBar();
|
||||||
@@ -212,9 +211,21 @@ void wxFrame::OnActivate(wxActivateEvent& event)
|
|||||||
tlf->GetMenuBar()->MacInstallMenuBar();
|
tlf->GetMenuBar()->MacInstallMenuBar();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
#endif
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void wxFrame::HandleResized( long timestamp )
|
||||||
|
{
|
||||||
|
// according to the other ports we handle this within the OS level
|
||||||
|
// resize event, not within a wxSizeEvent
|
||||||
|
|
||||||
|
PositionBars();
|
||||||
|
|
||||||
|
wxNonOwnedWindow::HandleResized( timestamp );
|
||||||
|
}
|
||||||
|
|
||||||
|
#if wxUSE_MENUS
|
||||||
void wxFrame::DetachMenuBar()
|
void wxFrame::DetachMenuBar()
|
||||||
{
|
{
|
||||||
if ( m_frameMenuBar )
|
if ( m_frameMenuBar )
|
||||||
@@ -225,7 +236,11 @@ void wxFrame::DetachMenuBar()
|
|||||||
|
|
||||||
void wxFrame::AttachMenuBar( wxMenuBar *menuBar )
|
void wxFrame::AttachMenuBar( wxMenuBar *menuBar )
|
||||||
{
|
{
|
||||||
|
#if wxOSX_USE_CARBON
|
||||||
wxFrame* tlf = wxDynamicCast( wxNonOwnedWindow::GetFromWXWindow( (WXWindow) FrontNonFloatingWindow() ) , wxFrame );
|
wxFrame* tlf = wxDynamicCast( wxNonOwnedWindow::GetFromWXWindow( (WXWindow) FrontNonFloatingWindow() ) , wxFrame );
|
||||||
|
#else
|
||||||
|
wxFrame* tlf = (wxFrame*) wxTheApp->GetTopWindow();
|
||||||
|
#endif
|
||||||
bool makeCurrent = false;
|
bool makeCurrent = false;
|
||||||
|
|
||||||
// if this is already the current menubar or we are the frontmost window
|
// if this is already the current menubar or we are the frontmost window
|
||||||
@@ -244,6 +259,7 @@ void wxFrame::AttachMenuBar( wxMenuBar *menuBar )
|
|||||||
m_frameMenuBar->MacInstallMenuBar();
|
m_frameMenuBar->MacInstallMenuBar();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
#endif
|
||||||
|
|
||||||
void wxFrame::DoGetClientSize(int *x, int *y) const
|
void wxFrame::DoGetClientSize(int *x, int *y) const
|
||||||
{
|
{
|
||||||
|
@@ -15,113 +15,81 @@
|
|||||||
|
|
||||||
#include "wx/gauge.h"
|
#include "wx/gauge.h"
|
||||||
|
|
||||||
IMPLEMENT_DYNAMIC_CLASS(wxGauge, wxControl)
|
#include "wx/osx/private.h"
|
||||||
|
|
||||||
#include "wx/osx/uma.h"
|
class wxMacGaugeCarbonControl : public wxMacControl
|
||||||
|
|
||||||
bool wxGauge::Create( wxWindow *parent,
|
|
||||||
wxWindowID id,
|
|
||||||
int range,
|
|
||||||
const wxPoint& pos,
|
|
||||||
const wxSize& s,
|
|
||||||
long style,
|
|
||||||
const wxValidator& validator,
|
|
||||||
const wxString& name )
|
|
||||||
{
|
{
|
||||||
m_macIsUserPane = false;
|
public :
|
||||||
|
wxMacGaugeCarbonControl( wxWindowMac* peer ) : wxMacControl( peer )
|
||||||
if ( !wxGaugeBase::Create( parent, id, range, pos, s, style & 0xE0FFFFFF, validator, name ) )
|
{
|
||||||
return false;
|
|
||||||
|
|
||||||
wxSize size = s;
|
|
||||||
|
|
||||||
#if 0
|
|
||||||
if (size.x == wxDefaultCoord && size.y == wxDefaultCoord)
|
|
||||||
size = wxSize( 200 , 16 );
|
|
||||||
#endif
|
|
||||||
|
|
||||||
Rect bounds = wxMacGetBoundsForControl( this, pos, size );
|
|
||||||
m_peer = new wxMacControl( this );
|
|
||||||
OSStatus err = CreateProgressBarControl(
|
|
||||||
MAC_WXHWND(parent->MacGetTopLevelWindowRef()), &bounds,
|
|
||||||
GetValue(), 0, GetRange(), false /* not indeterminate */, m_peer->GetControlRefAddr() );
|
|
||||||
verify_noerr( err );
|
|
||||||
|
|
||||||
if ( GetValue() == 0 )
|
|
||||||
m_peer->SetData<Boolean>( kControlEntireControl, kControlProgressBarAnimatingTag, (Boolean)false );
|
|
||||||
|
|
||||||
MacPostControlCreate( pos, size );
|
|
||||||
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
|
|
||||||
void wxGauge::SetRange(int r)
|
|
||||||
{
|
|
||||||
// we are going via the base class in case there is
|
|
||||||
// some change behind the values by it
|
|
||||||
wxGaugeBase::SetRange( r ) ;
|
|
||||||
if ( m_peer && m_peer->IsOk() ){
|
|
||||||
// switch back to determinate mode if not there already
|
|
||||||
if ( m_peer->GetData<Boolean>( kControlNoPart, kControlProgressBarIndeterminateTag ) != false )
|
|
||||||
{
|
|
||||||
m_peer->SetData<Boolean>( kControlNoPart, kControlProgressBarIndeterminateTag, (Boolean)false );
|
|
||||||
}
|
|
||||||
|
|
||||||
m_peer->SetMaximum( GetRange() ) ;
|
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
|
||||||
void wxGauge::SetValue(int pos)
|
void SetMaximum(wxInt32 v)
|
||||||
{
|
|
||||||
// we are going via the base class in case there is
|
|
||||||
// some change behind the values by it
|
|
||||||
wxGaugeBase::SetValue( pos ) ;
|
|
||||||
|
|
||||||
if ( m_peer && m_peer->IsOk() )
|
|
||||||
{
|
{
|
||||||
// switch back to determinate mode if not there already
|
// switch back to determinate mode if not there already
|
||||||
if ( m_peer->GetData<Boolean>( kControlNoPart, kControlProgressBarIndeterminateTag ) != false )
|
if ( GetData<Boolean>( kControlNoPart, kControlProgressBarIndeterminateTag ) != false )
|
||||||
{
|
{
|
||||||
m_peer->SetData<Boolean>( kControlNoPart, kControlProgressBarIndeterminateTag, (Boolean)false );
|
SetData<Boolean>( kControlNoPart, kControlProgressBarIndeterminateTag, (Boolean)false );
|
||||||
}
|
}
|
||||||
|
|
||||||
m_peer->SetValue( GetValue() ) ;
|
wxMacControl::SetMaximum( v ) ;
|
||||||
|
}
|
||||||
|
|
||||||
|
void SetValue(wxInt32 v)
|
||||||
|
{
|
||||||
|
// switch back to determinate mode if not there already
|
||||||
|
if ( GetData<Boolean>( kControlNoPart, kControlProgressBarIndeterminateTag ) != false )
|
||||||
|
{
|
||||||
|
SetData<Boolean>( kControlNoPart, kControlProgressBarIndeterminateTag, (Boolean)false );
|
||||||
|
}
|
||||||
|
|
||||||
|
wxMacControl::SetValue( v ) ;
|
||||||
|
|
||||||
// turn off animation in the unnecessary situations as this is consuming a lot of CPU otherwise
|
// turn off animation in the unnecessary situations as this is consuming a lot of CPU otherwise
|
||||||
Boolean shouldAnimate = ( GetValue() > 0 && GetValue() < GetRange() ) ;
|
Boolean shouldAnimate = ( v > 0 && v < GetMaximum() ) ;
|
||||||
if ( m_peer->GetData<Boolean>( kControlEntireControl, kControlProgressBarAnimatingTag ) != shouldAnimate )
|
if ( GetData<Boolean>( kControlEntireControl, kControlProgressBarAnimatingTag ) != shouldAnimate )
|
||||||
{
|
{
|
||||||
m_peer->SetData<Boolean>( kControlEntireControl, kControlProgressBarAnimatingTag, shouldAnimate ) ;
|
SetData<Boolean>( kControlEntireControl, kControlProgressBarAnimatingTag, shouldAnimate ) ;
|
||||||
if ( !shouldAnimate )
|
if ( !shouldAnimate )
|
||||||
Refresh() ;
|
SetNeedsDisplay(NULL) ;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
|
||||||
int wxGauge::GetValue() const
|
void PulseGauge()
|
||||||
{
|
|
||||||
#if 0
|
|
||||||
if ( m_peer && m_peer->Ok() )
|
|
||||||
return m_peer->GetValue() ;
|
|
||||||
#endif
|
|
||||||
|
|
||||||
return m_gaugePos ;
|
|
||||||
}
|
|
||||||
|
|
||||||
void wxGauge::Pulse()
|
|
||||||
{
|
|
||||||
if ( m_peer && m_peer->IsOk() )
|
|
||||||
{
|
{
|
||||||
if ( m_peer->GetData<Boolean>( kControlNoPart, kControlProgressBarIndeterminateTag ) != true )
|
if ( GetData<Boolean>( kControlNoPart, kControlProgressBarIndeterminateTag ) != true )
|
||||||
{
|
{
|
||||||
m_peer->SetData<Boolean>( kControlNoPart, kControlProgressBarIndeterminateTag, true);
|
SetData<Boolean>( kControlNoPart, kControlProgressBarIndeterminateTag, true);
|
||||||
}
|
}
|
||||||
|
|
||||||
if ( m_peer->GetData<Boolean>( kControlEntireControl, kControlProgressBarAnimatingTag ) != true )
|
if ( GetData<Boolean>( kControlEntireControl, kControlProgressBarAnimatingTag ) != true )
|
||||||
{
|
{
|
||||||
m_peer->SetData<Boolean>( kControlEntireControl, kControlProgressBarAnimatingTag, true ) ;
|
SetData<Boolean>( kControlEntireControl, kControlProgressBarAnimatingTag, true ) ;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
};
|
||||||
|
|
||||||
|
|
||||||
|
wxWidgetImplType* wxWidgetImpl::CreateGauge( wxWindowMac* wxpeer,
|
||||||
|
wxWindowMac* parent,
|
||||||
|
wxWindowID id,
|
||||||
|
wxInt32 value,
|
||||||
|
wxInt32 minimum,
|
||||||
|
wxInt32 maximum,
|
||||||
|
const wxPoint& pos,
|
||||||
|
const wxSize& size,
|
||||||
|
long style,
|
||||||
|
long extraStyle)
|
||||||
|
{
|
||||||
|
Rect bounds = wxMacGetBoundsForControl( wxpeer, pos, size );
|
||||||
|
wxMacGaugeCarbonControl* peer = new wxMacGaugeCarbonControl( wxpeer );
|
||||||
|
OSStatus err = CreateProgressBarControl(
|
||||||
|
MAC_WXHWND(parent->MacGetTopLevelWindowRef()), &bounds,
|
||||||
|
value, minimum, maximum, false /* not indeterminate */, peer->GetControlRefAddr() );
|
||||||
|
verify_noerr( err );
|
||||||
|
if ( value == 0 )
|
||||||
|
peer->SetData<Boolean>( kControlEntireControl, kControlProgressBarAnimatingTag, (Boolean)false );
|
||||||
|
return peer;
|
||||||
}
|
}
|
||||||
|
|
||||||
#endif // wxUSE_GAUGE
|
#endif // wxUSE_GAUGE
|
||||||
|
@@ -1,5 +1,5 @@
|
|||||||
/////////////////////////////////////////////////////////////////////////////
|
/////////////////////////////////////////////////////////////////////////////
|
||||||
// Name: src/mac/carbon/gdiobj.cpp
|
// Name: src/osx/carbon/gdiobj.cpp
|
||||||
// Purpose: wxGDIObject class
|
// Purpose: wxGDIObject class
|
||||||
// Author: Stefan Csomor
|
// Author: Stefan Csomor
|
||||||
// Modified by:
|
// Modified by:
|
||||||
@@ -64,11 +64,19 @@ const wxFont* wxStockGDIMac::GetFont(Item item)
|
|||||||
#if wxOSX_USE_COCOA_OR_CARBON
|
#if wxOSX_USE_COCOA_OR_CARBON
|
||||||
case FONT_NORMAL:
|
case FONT_NORMAL:
|
||||||
font = new wxFont;
|
font = new wxFont;
|
||||||
|
#if wxOSX_USE_CARBON
|
||||||
font->MacCreateFromThemeFont(kThemeSystemFont);
|
font->MacCreateFromThemeFont(kThemeSystemFont);
|
||||||
|
#else
|
||||||
|
font->MacCreateFromUIFont(kCTFontSystemFontType);
|
||||||
|
#endif
|
||||||
break;
|
break;
|
||||||
case FONT_SMALL:
|
case FONT_SMALL:
|
||||||
font = new wxFont;
|
font = new wxFont;
|
||||||
|
#if wxOSX_USE_CARBON
|
||||||
font->MacCreateFromThemeFont(kThemeSmallSystemFont);
|
font->MacCreateFromThemeFont(kThemeSmallSystemFont);
|
||||||
|
#else
|
||||||
|
font->MacCreateFromUIFont(kCTFontSmallSystemFontType);
|
||||||
|
#endif
|
||||||
break;
|
break;
|
||||||
#else
|
#else
|
||||||
case FONT_NORMAL:
|
case FONT_NORMAL:
|
||||||
|
@@ -36,6 +36,7 @@
|
|||||||
#include "wx/osx/uma.h"
|
#include "wx/osx/uma.h"
|
||||||
|
|
||||||
#include "wx/osx/private.h"
|
#include "wx/osx/private.h"
|
||||||
|
#include <AGL/agl.h>
|
||||||
|
|
||||||
// ----------------------------------------------------------------------------
|
// ----------------------------------------------------------------------------
|
||||||
// helper functions
|
// helper functions
|
||||||
@@ -54,146 +55,47 @@ static void wxLogAGLError(const char *func)
|
|||||||
// ============================================================================
|
// ============================================================================
|
||||||
|
|
||||||
// ----------------------------------------------------------------------------
|
// ----------------------------------------------------------------------------
|
||||||
// wxGLContext
|
// low level implementation routines
|
||||||
// ----------------------------------------------------------------------------
|
// ----------------------------------------------------------------------------
|
||||||
|
|
||||||
wxGLContext::wxGLContext(wxGLCanvas *win, const wxGLContext *other)
|
WXGLContext WXGLCreateContext( WXGLPixelFormat pixelFormat, WXGLContext shareContext )
|
||||||
{
|
{
|
||||||
m_aglContext = aglCreateContext(win->GetAGLPixelFormat(),
|
WXGLContext context = aglCreateContext(pixelFormat, shareContext);
|
||||||
other ? other->m_aglContext : NULL);
|
if ( !context )
|
||||||
if ( !m_aglContext )
|
|
||||||
wxLogAGLError("aglCreateContext");
|
wxLogAGLError("aglCreateContext");
|
||||||
|
return context ;
|
||||||
}
|
}
|
||||||
|
|
||||||
wxGLContext::~wxGLContext()
|
void WXGLDestroyContext( WXGLContext context )
|
||||||
{
|
{
|
||||||
if ( m_aglContext )
|
if ( context )
|
||||||
{
|
{
|
||||||
// it's ok to pass the current context to this function
|
if ( !aglDestroyContext(context) )
|
||||||
if ( !aglDestroyContext(m_aglContext) )
|
{
|
||||||
wxLogAGLError("aglDestroyContext");
|
wxLogAGLError("aglDestroyContext");
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
bool wxGLContext::SetCurrent(const wxGLCanvas& win) const
|
void WXGLSwapBuffers( WXGLContext context )
|
||||||
{
|
{
|
||||||
if ( !m_aglContext )
|
aglSwapBuffers(context);
|
||||||
return false;
|
}
|
||||||
|
|
||||||
AGLDrawable drawable = (AGLDrawable)GetWindowPort(
|
WXGLContext WXGLGetCurrentContext()
|
||||||
MAC_WXHWND(win.MacGetTopLevelWindowRef()));
|
{
|
||||||
if ( !aglSetDrawable(m_aglContext, drawable) )
|
return aglGetCurrentContext();
|
||||||
|
}
|
||||||
|
|
||||||
|
void WXGLDestroyPixelFormat( WXGLPixelFormat pixelFormat )
|
||||||
|
{
|
||||||
|
if ( pixelFormat )
|
||||||
{
|
{
|
||||||
wxLogAGLError("aglSetDrawable");
|
aglDestroyPixelFormat(pixelFormat);
|
||||||
return false;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
if ( !aglSetCurrentContext(m_aglContext) )
|
|
||||||
{
|
|
||||||
wxLogAGLError("aglSetCurrentContext");
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
|
|
||||||
wx_const_cast(wxGLCanvas&, win).SetViewport();
|
|
||||||
return true;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// ----------------------------------------------------------------------------
|
WXGLPixelFormat WXGLChoosePixelFormat(const int *attribList)
|
||||||
// wxGLCanvas
|
|
||||||
// ----------------------------------------------------------------------------
|
|
||||||
|
|
||||||
IMPLEMENT_CLASS(wxGLCanvas, wxWindow)
|
|
||||||
|
|
||||||
BEGIN_EVENT_TABLE(wxGLCanvas, wxWindow)
|
|
||||||
EVT_SIZE(wxGLCanvas::OnSize)
|
|
||||||
END_EVENT_TABLE()
|
|
||||||
|
|
||||||
wxGLCanvas::wxGLCanvas(wxWindow *parent,
|
|
||||||
wxWindowID id,
|
|
||||||
const int *attribList,
|
|
||||||
const wxPoint& pos,
|
|
||||||
const wxSize& size,
|
|
||||||
long style,
|
|
||||||
const wxString& name,
|
|
||||||
const wxPalette& palette)
|
|
||||||
{
|
|
||||||
Create(parent, id, pos, size, style, name, attribList, palette);
|
|
||||||
}
|
|
||||||
|
|
||||||
#if WXWIN_COMPATIBILITY_2_8
|
|
||||||
|
|
||||||
wxGLCanvas::wxGLCanvas(wxWindow *parent,
|
|
||||||
wxWindowID id,
|
|
||||||
const wxPoint& pos,
|
|
||||||
const wxSize& size,
|
|
||||||
long style,
|
|
||||||
const wxString& name,
|
|
||||||
const int *attribList,
|
|
||||||
const wxPalette& palette)
|
|
||||||
{
|
|
||||||
if ( Create(parent, id, pos, size, style, name, attribList, palette) )
|
|
||||||
m_glContext = new wxGLContext(this);
|
|
||||||
}
|
|
||||||
|
|
||||||
wxGLCanvas::wxGLCanvas(wxWindow *parent,
|
|
||||||
const wxGLContext *shared,
|
|
||||||
wxWindowID id,
|
|
||||||
const wxPoint& pos,
|
|
||||||
const wxSize& size,
|
|
||||||
long style,
|
|
||||||
const wxString& name,
|
|
||||||
const int *attribList,
|
|
||||||
const wxPalette& palette)
|
|
||||||
{
|
|
||||||
if ( Create(parent, id, pos, size, style, name, attribList, palette) )
|
|
||||||
m_glContext = new wxGLContext(this, shared);
|
|
||||||
}
|
|
||||||
|
|
||||||
wxGLCanvas::wxGLCanvas(wxWindow *parent,
|
|
||||||
const wxGLCanvas *shared,
|
|
||||||
wxWindowID id,
|
|
||||||
const wxPoint& pos,
|
|
||||||
const wxSize& size,
|
|
||||||
long style,
|
|
||||||
const wxString& name,
|
|
||||||
const int *attribList,
|
|
||||||
const wxPalette& palette)
|
|
||||||
{
|
|
||||||
if ( Create(parent, id, pos, size, style, name, attribList, palette) )
|
|
||||||
m_glContext = new wxGLContext(this, shared ? shared->m_glContext : NULL);
|
|
||||||
}
|
|
||||||
|
|
||||||
#endif // WXWIN_COMPATIBILITY_2_8
|
|
||||||
|
|
||||||
/* static */
|
|
||||||
bool wxGLCanvasBase::IsExtensionSupported(const char *extension)
|
|
||||||
{
|
|
||||||
// we need a valid context to query for extensions.
|
|
||||||
const GLint defaultAttribs[] = { AGL_RGBA, AGL_DOUBLEBUFFER, AGL_NONE };
|
|
||||||
AGLPixelFormat fmt = aglChoosePixelFormat(NULL, 0, defaultAttribs);
|
|
||||||
AGLContext ctx = aglCreateContext(fmt, NULL);
|
|
||||||
if ( !ctx )
|
|
||||||
return false;
|
|
||||||
|
|
||||||
wxString extensions = wxString::FromAscii(glGetString(GL_EXTENSIONS));
|
|
||||||
|
|
||||||
aglDestroyPixelFormat(fmt);
|
|
||||||
aglDestroyContext(ctx);
|
|
||||||
|
|
||||||
return IsExtensionInList(extensions, extension);
|
|
||||||
}
|
|
||||||
|
|
||||||
/* static */
|
|
||||||
bool wxGLCanvas::IsAGLMultiSampleAvailable()
|
|
||||||
{
|
|
||||||
static int s_isMultiSampleAvailable = -1;
|
|
||||||
if ( s_isMultiSampleAvailable == -1 )
|
|
||||||
s_isMultiSampleAvailable = IsExtensionSupported("GL_ARB_multisample");
|
|
||||||
|
|
||||||
return s_isMultiSampleAvailable != 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
static AGLPixelFormat ChoosePixelFormat(const int *attribList)
|
|
||||||
{
|
{
|
||||||
GLint data[512];
|
GLint data[512];
|
||||||
const GLint defaultAttribs[] =
|
const GLint defaultAttribs[] =
|
||||||
@@ -340,6 +242,83 @@ static AGLPixelFormat ChoosePixelFormat(const int *attribList)
|
|||||||
return aglChoosePixelFormat(NULL, 0, attribs);
|
return aglChoosePixelFormat(NULL, 0, attribs);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// ----------------------------------------------------------------------------
|
||||||
|
// wxGLContext
|
||||||
|
// ----------------------------------------------------------------------------
|
||||||
|
|
||||||
|
bool wxGLContext::SetCurrent(const wxGLCanvas& win) const
|
||||||
|
{
|
||||||
|
if ( !m_glContext )
|
||||||
|
return false;
|
||||||
|
|
||||||
|
AGLDrawable drawable = (AGLDrawable)GetWindowPort(
|
||||||
|
MAC_WXHWND(win.MacGetTopLevelWindowRef()));
|
||||||
|
|
||||||
|
GLint bufnummer = win.GetAglBufferName();
|
||||||
|
aglSetInteger(m_glContext, AGL_BUFFER_NAME, &bufnummer);
|
||||||
|
//win.SetLastContext(m_glContext);
|
||||||
|
|
||||||
|
wx_const_cast(wxGLCanvas&, win).SetViewport();
|
||||||
|
|
||||||
|
if ( !aglSetDrawable(m_glContext, drawable) )
|
||||||
|
{
|
||||||
|
wxLogAGLError("aglSetDrawable");
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
if ( !aglSetCurrentContext(m_glContext) )
|
||||||
|
{
|
||||||
|
wxLogAGLError("aglSetCurrentContext");
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
// ----------------------------------------------------------------------------
|
||||||
|
// wxGLCanvas
|
||||||
|
// ----------------------------------------------------------------------------
|
||||||
|
|
||||||
|
/*
|
||||||
|
|
||||||
|
sharing contexts under AGL is not straightforward, to quote from
|
||||||
|
|
||||||
|
http://lists.apple.com/archives/mac-opengl/2003/Jan/msg00402.html :
|
||||||
|
|
||||||
|
In Carbon OpenGL (AGL) you would use call aglSetInteger to setup a
|
||||||
|
buffer name and attached each context to that same name. From AGL
|
||||||
|
you can do:
|
||||||
|
|
||||||
|
GLint id = 1;
|
||||||
|
|
||||||
|
ctx1 = aglCreateContext...
|
||||||
|
aglSetInteger(ctx1, AGL_BUFFER_NAME, &id); // create name
|
||||||
|
aglAttachDrawable (ctx1,...); // create surface with associated with
|
||||||
|
name (first time)
|
||||||
|
ctx2 = aglCreateContext...
|
||||||
|
aglSetInteger(ctx2, AGL_BUFFER_NAME, &id); // uses previously created name
|
||||||
|
aglAttachDrawable (ctx2, ...); // uses existing surface with existing name
|
||||||
|
|
||||||
|
AGL Docs say:
|
||||||
|
AGL_BUFFER_NAME
|
||||||
|
params contains one value: a non-negative integer name of the surface to be
|
||||||
|
associated to be with the current context. If this value is non-zero, and a
|
||||||
|
surface of this name is not associated to this drawable, a new surface with
|
||||||
|
this name is created and associated with the context when
|
||||||
|
aglSetDrawable is called subsequently. If this is a previously allocated
|
||||||
|
buffer name within the namespace of the current window (e.g., drawable),
|
||||||
|
that previously allocated surface is associated with the context (e.g., no
|
||||||
|
new surface is created) and the subsequent call to aglSetDrawable will
|
||||||
|
attach that surface. This allows multiple contexts to be attached to a single
|
||||||
|
surface. Using the default buffer name zero, returns to one surface per
|
||||||
|
context behavior.
|
||||||
|
*/
|
||||||
|
|
||||||
|
/*
|
||||||
|
so what I'm doing is to have a dummy aglContext attached to a wxGLCanvas,
|
||||||
|
assign it a buffer number
|
||||||
|
*/
|
||||||
|
|
||||||
|
|
||||||
bool wxGLCanvas::Create(wxWindow *parent,
|
bool wxGLCanvas::Create(wxWindow *parent,
|
||||||
wxWindowID id,
|
wxWindowID id,
|
||||||
const wxPoint& pos,
|
const wxPoint& pos,
|
||||||
@@ -352,13 +331,22 @@ bool wxGLCanvas::Create(wxWindow *parent,
|
|||||||
m_needsUpdate = false;
|
m_needsUpdate = false;
|
||||||
m_macCanvasIsShown = false;
|
m_macCanvasIsShown = false;
|
||||||
|
|
||||||
m_aglFormat = ChoosePixelFormat(attribList);
|
m_glFormat = WXGLChoosePixelFormat(attribList);
|
||||||
if ( !m_aglFormat )
|
if ( !m_glFormat )
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
if ( !wxWindow::Create(parent, id, pos, size, style, name) )
|
if ( !wxWindow::Create(parent, id, pos, size, style, name) )
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
|
m_dummyContext = WXGLCreateContext(m_glFormat, NULL);
|
||||||
|
|
||||||
|
static GLint gCurrentBufferName = 1;
|
||||||
|
m_bufferName = gCurrentBufferName++;
|
||||||
|
aglSetInteger (m_dummyContext, AGL_BUFFER_NAME, &m_bufferName);
|
||||||
|
|
||||||
|
AGLDrawable drawable = (AGLDrawable)GetWindowPort(MAC_WXHWND(MacGetTopLevelWindowRef()));
|
||||||
|
aglSetDrawable(m_dummyContext, drawable);
|
||||||
|
|
||||||
m_macCanvasIsShown = true;
|
m_macCanvasIsShown = true;
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
@@ -366,30 +354,11 @@ bool wxGLCanvas::Create(wxWindow *parent,
|
|||||||
|
|
||||||
wxGLCanvas::~wxGLCanvas()
|
wxGLCanvas::~wxGLCanvas()
|
||||||
{
|
{
|
||||||
if ( m_aglFormat )
|
if ( m_glFormat )
|
||||||
aglDestroyPixelFormat(m_aglFormat);
|
WXGLDestroyPixelFormat(m_glFormat);
|
||||||
}
|
|
||||||
|
|
||||||
/* static */
|
if ( m_dummyContext )
|
||||||
bool wxGLCanvasBase::IsDisplaySupported(const int *attribList)
|
WXGLDestroyContext(m_dummyContext);
|
||||||
{
|
|
||||||
AGLPixelFormat aglFormat = ChoosePixelFormat(attribList);
|
|
||||||
|
|
||||||
if ( !aglFormat )
|
|
||||||
return false;
|
|
||||||
|
|
||||||
aglDestroyPixelFormat(aglFormat);
|
|
||||||
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
|
|
||||||
bool wxGLCanvas::SwapBuffers()
|
|
||||||
{
|
|
||||||
AGLContext context = aglGetCurrentContext();
|
|
||||||
wxCHECK_MSG(context, false, _T("should have current context"));
|
|
||||||
|
|
||||||
aglSwapBuffers(context);
|
|
||||||
return true;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void wxGLCanvas::SetViewport()
|
void wxGLCanvas::SetViewport()
|
||||||
@@ -399,9 +368,9 @@ void wxGLCanvas::SetViewport()
|
|||||||
|
|
||||||
m_needsUpdate = false;
|
m_needsUpdate = false;
|
||||||
|
|
||||||
AGLContext context = aglGetCurrentContext();
|
// AGLContext context = aglGetCurrentContext();
|
||||||
if ( !context )
|
// if ( !context )
|
||||||
return;
|
// return;
|
||||||
|
|
||||||
// viewport is initially set to entire port, adjust it to just this window
|
// viewport is initially set to entire port, adjust it to just this window
|
||||||
int x = 0,
|
int x = 0,
|
||||||
@@ -414,36 +383,23 @@ void wxGLCanvas::SetViewport()
|
|||||||
Rect bounds;
|
Rect bounds;
|
||||||
GetWindowPortBounds(MAC_WXHWND(MacGetTopLevelWindowRef()) , &bounds);
|
GetWindowPortBounds(MAC_WXHWND(MacGetTopLevelWindowRef()) , &bounds);
|
||||||
|
|
||||||
#if 0
|
|
||||||
// TODO in case we adopt point vs pixel coordinates, this will make the conversion
|
|
||||||
HIRect hiRect = CGRectMake( x, y, width, height );
|
|
||||||
HIRectConvert( &hiRect, kHICoordSpace72DPIGlobal, NULL, kHICoordSpaceScreenPixel, NULL);
|
|
||||||
HIRect hiBounds = CGRectMake( 0, 0, bounds.right - bounds.left , bounds.bottom - bounds.top );
|
|
||||||
HIRectConvert( &hiBounds, kHICoordSpace72DPIGlobal, NULL, kHICoordSpaceScreenPixel, NULL);
|
|
||||||
GLint parms[4];
|
|
||||||
parms[0] = hiRect.origin.x;
|
|
||||||
parms[1] = hiBounds.size.height - (hiRect.origin.y + hiRect.size.height);
|
|
||||||
parms[2] = hiRect.size.width;
|
|
||||||
parms[3] = hiRect.size.height;
|
|
||||||
#else
|
|
||||||
GLint parms[4];
|
GLint parms[4];
|
||||||
parms[0] = x;
|
parms[0] = x;
|
||||||
parms[1] = bounds.bottom - bounds.top - ( y + height );
|
parms[1] = bounds.bottom - bounds.top - ( y + height );
|
||||||
parms[2] = width;
|
parms[2] = width;
|
||||||
parms[3] = height;
|
parms[3] = height;
|
||||||
#endif
|
|
||||||
|
|
||||||
// move the buffer rect out of sight if we're hidden
|
// move the buffer rect out of sight if we're hidden
|
||||||
if ( !m_macCanvasIsShown )
|
if ( !m_macCanvasIsShown )
|
||||||
parms[0] += 20000;
|
parms[0] += 20000;
|
||||||
|
|
||||||
if ( !aglSetInteger(context, AGL_BUFFER_RECT, parms) )
|
if ( !aglSetInteger(m_dummyContext, AGL_BUFFER_RECT, parms) )
|
||||||
wxLogAGLError("aglSetInteger(AGL_BUFFER_RECT)");
|
wxLogAGLError("aglSetInteger(AGL_BUFFER_RECT)");
|
||||||
|
|
||||||
if ( !aglEnable(context, AGL_BUFFER_RECT) )
|
if ( !aglEnable(m_dummyContext, AGL_BUFFER_RECT) )
|
||||||
wxLogAGLError("aglEnable(AGL_BUFFER_RECT)");
|
wxLogAGLError("aglEnable(AGL_BUFFER_RECT)");
|
||||||
|
|
||||||
if ( !aglUpdateContext(context) )
|
if ( !aglUpdateContext(m_dummyContext) )
|
||||||
wxLogAGLError("aglUpdateContext");
|
wxLogAGLError("aglUpdateContext");
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -462,6 +418,7 @@ void wxGLCanvas::MacUpdateView()
|
|||||||
void wxGLCanvas::MacSuperChangedPosition()
|
void wxGLCanvas::MacSuperChangedPosition()
|
||||||
{
|
{
|
||||||
MacUpdateView();
|
MacUpdateView();
|
||||||
|
SetViewport();
|
||||||
wxWindow::MacSuperChangedPosition();
|
wxWindow::MacSuperChangedPosition();
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -482,18 +439,4 @@ void wxGLCanvas::MacVisibilityChanged()
|
|||||||
wxWindowMac::MacVisibilityChanged();
|
wxWindowMac::MacVisibilityChanged();
|
||||||
}
|
}
|
||||||
|
|
||||||
// ----------------------------------------------------------------------------
|
|
||||||
// wxGLApp
|
|
||||||
// ----------------------------------------------------------------------------
|
|
||||||
|
|
||||||
bool wxGLApp::InitGLVisual(const int *attribList)
|
|
||||||
{
|
|
||||||
AGLPixelFormat fmt = ChoosePixelFormat(attribList);
|
|
||||||
if ( !fmt )
|
|
||||||
return false;
|
|
||||||
|
|
||||||
aglDestroyPixelFormat(fmt);
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
|
|
||||||
#endif // wxUSE_GLCANVAS
|
#endif // wxUSE_GLCANVAS
|
||||||
|
@@ -1,5 +1,5 @@
|
|||||||
/////////////////////////////////////////////////////////////////////////////
|
/////////////////////////////////////////////////////////////////////////////
|
||||||
// Name: src/mac/carbon/dccg.cpp
|
// Name: src/osx/carbon/dccg.cpp
|
||||||
// Purpose: wxDC class
|
// Purpose: wxDC class
|
||||||
// Author: Stefan Csomor
|
// Author: Stefan Csomor
|
||||||
// Modified by:
|
// Modified by:
|
||||||
|
@@ -1,5 +1,5 @@
|
|||||||
/////////////////////////////////////////////////////////////////////////////
|
/////////////////////////////////////////////////////////////////////////////
|
||||||
// Name: src/mac/carbon/icon.cpp
|
// Name: src/osx/carbon/icon.cpp
|
||||||
// Purpose: wxIcon class
|
// Purpose: wxIcon class
|
||||||
// Author: Stefan Csomor
|
// Author: Stefan Csomor
|
||||||
// Modified by:
|
// Modified by:
|
||||||
@@ -53,7 +53,7 @@ private:
|
|||||||
|
|
||||||
wxIconRefData::wxIconRefData( WXHICON icon, int desiredWidth, int desiredHeight )
|
wxIconRefData::wxIconRefData( WXHICON icon, int desiredWidth, int desiredHeight )
|
||||||
{
|
{
|
||||||
m_iconRef = MAC_WXHICON( icon ) ;
|
m_iconRef = (IconRef)( icon ) ;
|
||||||
|
|
||||||
// Standard sizes
|
// Standard sizes
|
||||||
SetWidth( desiredWidth == -1 ? 32 : desiredWidth ) ;
|
SetWidth( desiredWidth == -1 ? 32 : desiredWidth ) ;
|
||||||
|
@@ -1,5 +1,5 @@
|
|||||||
///////////////////////////////////////////////////////////////////////////////
|
///////////////////////////////////////////////////////////////////////////////
|
||||||
// Name: src/mac/carbon/listbox.cpp
|
// Name: src/osx/carbon/listbox.cpp
|
||||||
// Purpose: wxListBox
|
// Purpose: wxListBox
|
||||||
// Author: Stefan Csomor
|
// Author: Stefan Csomor
|
||||||
// Modified by:
|
// Modified by:
|
||||||
@@ -24,271 +24,23 @@
|
|||||||
#include "wx/dcclient.h"
|
#include "wx/dcclient.h"
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
IMPLEMENT_DYNAMIC_CLASS(wxListBox, wxControlWithItems)
|
#include "wx/osx/private.h"
|
||||||
|
|
||||||
BEGIN_EVENT_TABLE(wxListBox, wxControl)
|
|
||||||
END_EVENT_TABLE()
|
|
||||||
|
|
||||||
#include "wx/osx/uma.h"
|
|
||||||
|
|
||||||
// ============================================================================
|
// ============================================================================
|
||||||
// list box control implementation
|
// list box control implementation
|
||||||
// ============================================================================
|
// ============================================================================
|
||||||
|
|
||||||
wxListBox::wxListBox()
|
wxWidgetImplType* wxWidgetImpl::CreateListBox( wxWindowMac* wxpeer,
|
||||||
|
wxWindowMac* parent,
|
||||||
|
wxWindowID id,
|
||||||
|
const wxPoint& pos,
|
||||||
|
const wxSize& size,
|
||||||
|
long style,
|
||||||
|
long extraStyle)
|
||||||
{
|
{
|
||||||
}
|
wxMacDataBrowserListControl* control = new wxMacDataBrowserListControl( wxpeer, pos, size, style );
|
||||||
|
|
||||||
bool wxListBox::Create(
|
|
||||||
wxWindow *parent,
|
|
||||||
wxWindowID id,
|
|
||||||
const wxPoint& pos,
|
|
||||||
const wxSize& size,
|
|
||||||
const wxArrayString& choices,
|
|
||||||
long style,
|
|
||||||
const wxValidator& validator,
|
|
||||||
const wxString& name )
|
|
||||||
{
|
|
||||||
wxCArrayString chs(choices);
|
|
||||||
|
|
||||||
return Create(
|
|
||||||
parent, id, pos, size, chs.GetCount(), chs.GetStrings(),
|
|
||||||
style, validator, name );
|
|
||||||
}
|
|
||||||
|
|
||||||
wxMacListControl* wxListBox::GetPeer() const
|
|
||||||
{
|
|
||||||
wxMacDataBrowserListControl *lb = wxDynamicCast(m_peer,wxMacDataBrowserListControl);
|
|
||||||
return lb ? wx_static_cast(wxMacListControl*,lb) : 0 ;
|
|
||||||
}
|
|
||||||
|
|
||||||
bool wxListBox::Create(
|
|
||||||
wxWindow *parent,
|
|
||||||
wxWindowID id,
|
|
||||||
const wxPoint& pos,
|
|
||||||
const wxSize& size,
|
|
||||||
int n,
|
|
||||||
const wxString choices[],
|
|
||||||
long style,
|
|
||||||
const wxValidator& validator,
|
|
||||||
const wxString& name )
|
|
||||||
{
|
|
||||||
m_blockEvents = false;
|
|
||||||
m_macIsUserPane = false;
|
|
||||||
|
|
||||||
wxASSERT_MSG( !(style & wxLB_MULTIPLE) || !(style & wxLB_EXTENDED),
|
|
||||||
wxT("only a single listbox selection mode can be specified") );
|
|
||||||
|
|
||||||
if ( !wxListBoxBase::Create( parent, id, pos, size, style & ~(wxHSCROLL | wxVSCROLL), validator, name ) )
|
|
||||||
return false;
|
|
||||||
|
|
||||||
wxMacDataBrowserListControl* control = new wxMacDataBrowserListControl( this, pos, size, style );
|
|
||||||
// TODO CHECK control->SetClientDataType( m_clientDataItemsType );
|
// TODO CHECK control->SetClientDataType( m_clientDataItemsType );
|
||||||
m_peer = control;
|
return control;
|
||||||
|
|
||||||
MacPostControlCreate( pos, size );
|
|
||||||
|
|
||||||
Append(n, choices);
|
|
||||||
|
|
||||||
// Needed because it is a wxControlWithItems
|
|
||||||
SetInitialSize( size );
|
|
||||||
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
|
|
||||||
wxListBox::~wxListBox()
|
|
||||||
{
|
|
||||||
FreeData();
|
|
||||||
m_peer->SetReference( 0 );
|
|
||||||
}
|
|
||||||
|
|
||||||
void wxListBox::FreeData()
|
|
||||||
{
|
|
||||||
GetPeer()->MacClear();
|
|
||||||
}
|
|
||||||
|
|
||||||
void wxListBox::DoSetFirstItem(int n)
|
|
||||||
{
|
|
||||||
GetPeer()->MacScrollTo( n );
|
|
||||||
}
|
|
||||||
|
|
||||||
void wxListBox::EnsureVisible(int n)
|
|
||||||
{
|
|
||||||
GetPeer()->MacScrollTo( n );
|
|
||||||
}
|
|
||||||
|
|
||||||
void wxListBox::DoDeleteOneItem(unsigned int n)
|
|
||||||
{
|
|
||||||
wxCHECK_RET( IsValid(n), wxT("invalid index in wxListBox::Delete") );
|
|
||||||
|
|
||||||
m_blockEvents = true;
|
|
||||||
GetPeer()->MacDelete( n );
|
|
||||||
m_blockEvents = false;
|
|
||||||
|
|
||||||
UpdateOldSelections();
|
|
||||||
}
|
|
||||||
|
|
||||||
int wxListBox::DoInsertItems(const wxArrayStringsAdapter& items,
|
|
||||||
unsigned int pos,
|
|
||||||
void **clientData,
|
|
||||||
wxClientDataType type)
|
|
||||||
{
|
|
||||||
InvalidateBestSize();
|
|
||||||
|
|
||||||
GetPeer()->MacInsert( pos, items );
|
|
||||||
const unsigned int count = items.GetCount();
|
|
||||||
if ( clientData )
|
|
||||||
{
|
|
||||||
for (unsigned int i = 0; i < count; ++i)
|
|
||||||
AssignNewItemClientData( pos + i, clientData, i, type );
|
|
||||||
}
|
|
||||||
|
|
||||||
return pos + count - 1;
|
|
||||||
|
|
||||||
UpdateOldSelections();
|
|
||||||
}
|
|
||||||
|
|
||||||
int wxListBox::FindString(const wxString& s, bool bCase) const
|
|
||||||
{
|
|
||||||
for ( size_t i = 0; i < GetCount(); ++ i )
|
|
||||||
{
|
|
||||||
if (s.IsSameAs( GetString( i ), bCase) )
|
|
||||||
return (int)i;
|
|
||||||
}
|
|
||||||
|
|
||||||
return wxNOT_FOUND;
|
|
||||||
}
|
|
||||||
|
|
||||||
void wxListBox::DoClear()
|
|
||||||
{
|
|
||||||
m_blockEvents = true;
|
|
||||||
FreeData();
|
|
||||||
m_blockEvents = false;
|
|
||||||
|
|
||||||
UpdateOldSelections();
|
|
||||||
}
|
|
||||||
|
|
||||||
void wxListBox::DoSetSelection(int n, bool select)
|
|
||||||
{
|
|
||||||
wxCHECK_RET( n == wxNOT_FOUND || IsValid(n),
|
|
||||||
wxT("invalid index in wxListBox::SetSelection") );
|
|
||||||
|
|
||||||
m_blockEvents = true;
|
|
||||||
|
|
||||||
if ( n == wxNOT_FOUND )
|
|
||||||
GetPeer()->MacDeselectAll();
|
|
||||||
else
|
|
||||||
GetPeer()->MacSetSelection( n, select, HasMultipleSelection() );
|
|
||||||
|
|
||||||
m_blockEvents = false;
|
|
||||||
|
|
||||||
UpdateOldSelections();
|
|
||||||
}
|
|
||||||
|
|
||||||
bool wxListBox::IsSelected(int n) const
|
|
||||||
{
|
|
||||||
wxCHECK_MSG( IsValid(n), false, wxT("invalid index in wxListBox::Selected") );
|
|
||||||
|
|
||||||
return GetPeer()->MacIsSelected( n );
|
|
||||||
}
|
|
||||||
|
|
||||||
void *wxListBox::DoGetItemClientData(unsigned int n) const
|
|
||||||
{
|
|
||||||
wxCHECK_MSG( IsValid(n), NULL, wxT("invalid index in wxListBox::GetClientData"));
|
|
||||||
return GetPeer()->MacGetClientData( n );
|
|
||||||
}
|
|
||||||
|
|
||||||
void wxListBox::DoSetItemClientData(unsigned int n, void *clientData)
|
|
||||||
{
|
|
||||||
wxCHECK_RET( IsValid(n), wxT("invalid index in wxListBox::SetClientData") );
|
|
||||||
GetPeer()->MacSetClientData( n , clientData);
|
|
||||||
}
|
|
||||||
|
|
||||||
// Return number of selections and an array of selected integers
|
|
||||||
int wxListBox::GetSelections(wxArrayInt& aSelections) const
|
|
||||||
{
|
|
||||||
return GetPeer()->MacGetSelections( aSelections );
|
|
||||||
}
|
|
||||||
|
|
||||||
// Get single selection, for single choice list items
|
|
||||||
int wxListBox::GetSelection() const
|
|
||||||
{
|
|
||||||
return GetPeer()->MacGetSelection();
|
|
||||||
}
|
|
||||||
|
|
||||||
// Find string for position
|
|
||||||
wxString wxListBox::GetString(unsigned int n) const
|
|
||||||
{
|
|
||||||
wxCHECK_MSG( IsValid(n), wxEmptyString, wxT("invalid index in wxListBox::GetString") );
|
|
||||||
return GetPeer()->MacGetString(n);
|
|
||||||
}
|
|
||||||
|
|
||||||
void wxListBox::SetString(unsigned int n, const wxString& s)
|
|
||||||
{
|
|
||||||
GetPeer()->MacSetString( n, s );
|
|
||||||
}
|
|
||||||
|
|
||||||
wxSize wxListBox::DoGetBestSize() const
|
|
||||||
{
|
|
||||||
int lbWidth = 100; // some defaults
|
|
||||||
int lbHeight = 110;
|
|
||||||
int wLine;
|
|
||||||
|
|
||||||
{
|
|
||||||
wxClientDC dc(const_cast<wxListBox*>(this));
|
|
||||||
dc.SetFont(GetFont());
|
|
||||||
|
|
||||||
// Find the widest line
|
|
||||||
for (unsigned int i = 0; i < GetCount(); i++)
|
|
||||||
{
|
|
||||||
wxString str( GetString( i ) );
|
|
||||||
|
|
||||||
wxCoord width, height ;
|
|
||||||
dc.GetTextExtent( str , &width, &height);
|
|
||||||
wLine = width ;
|
|
||||||
lbWidth = wxMax( lbWidth, wLine );
|
|
||||||
}
|
|
||||||
|
|
||||||
// Add room for the scrollbar
|
|
||||||
lbWidth += wxSystemSettings::GetMetric( wxSYS_VSCROLL_X );
|
|
||||||
|
|
||||||
// And just a bit more
|
|
||||||
int cy = 12;
|
|
||||||
|
|
||||||
wxCoord width, height ;
|
|
||||||
dc.GetTextExtent( wxT("XX") , &width, &height);
|
|
||||||
int cx = width ;
|
|
||||||
lbWidth += cx;
|
|
||||||
|
|
||||||
// don't make the listbox too tall (limit height to around 10 items)
|
|
||||||
// but don't make it too small neither
|
|
||||||
lbHeight = wxMax( (cy + 4) * wxMin( wxMax( GetCount(), 3 ), 10 ), 70 );
|
|
||||||
}
|
|
||||||
|
|
||||||
return wxSize( lbWidth, lbHeight );
|
|
||||||
}
|
|
||||||
|
|
||||||
unsigned int wxListBox::GetCount() const
|
|
||||||
{
|
|
||||||
return GetPeer()->MacGetCount();
|
|
||||||
}
|
|
||||||
|
|
||||||
void wxListBox::Refresh(bool eraseBack, const wxRect *rect)
|
|
||||||
{
|
|
||||||
wxControl::Refresh( eraseBack, rect );
|
|
||||||
}
|
|
||||||
|
|
||||||
// Some custom controls depend on this
|
|
||||||
/* static */ wxVisualAttributes
|
|
||||||
wxListBox::GetClassDefaultAttributes(wxWindowVariant WXUNUSED(variant))
|
|
||||||
{
|
|
||||||
wxVisualAttributes attr;
|
|
||||||
|
|
||||||
attr.colFg = wxSystemSettings::GetColour( wxSYS_COLOUR_WINDOWTEXT );
|
|
||||||
attr.colBg = wxSystemSettings::GetColour( wxSYS_COLOUR_LISTBOX );
|
|
||||||
attr.font.MacCreateFromThemeFont(kThemeViewsFont);
|
|
||||||
|
|
||||||
return attr;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
int wxListBox::DoListHitTest(const wxPoint& inpoint) const
|
int wxListBox::DoListHitTest(const wxPoint& inpoint) const
|
||||||
@@ -407,6 +159,77 @@ wxMacListBoxItem::~wxMacListBoxItem()
|
|||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
|
OSStatus wxMacListBoxItem::GetSetData(wxMacDataItemBrowserControl *owner ,
|
||||||
|
DataBrowserPropertyID property,
|
||||||
|
DataBrowserItemDataRef itemData,
|
||||||
|
bool changeValue )
|
||||||
|
{
|
||||||
|
wxMacDataBrowserListControl *lb = wxDynamicCast(owner,wxMacDataBrowserListControl);
|
||||||
|
OSStatus err = errDataBrowserPropertyNotSupported;
|
||||||
|
if ( !changeValue )
|
||||||
|
{
|
||||||
|
if ( property >= kMinColumnId )
|
||||||
|
{
|
||||||
|
wxMacDataBrowserColumn* col = lb->GetColumnFromProperty( property );
|
||||||
|
unsigned int n = owner->GetLineFromItem( this );
|
||||||
|
wxListBox *list = wxDynamicCast( owner->GetWXPeer() , wxListBox );
|
||||||
|
wxMacDataBrowserCellValue valueholder(itemData);
|
||||||
|
list->GetValueCallback( n , col, valueholder );
|
||||||
|
|
||||||
|
err = noErr;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
if ( property == kDataBrowserItemIsEditableProperty )
|
||||||
|
{
|
||||||
|
DataBrowserPropertyID propertyToEdit ;
|
||||||
|
GetDataBrowserItemDataProperty( itemData, &propertyToEdit );
|
||||||
|
wxMacDataBrowserColumn* col = lb->GetColumnFromProperty( propertyToEdit );
|
||||||
|
|
||||||
|
verify_noerr(SetDataBrowserItemDataBooleanValue( itemData, col->IsEditable() ));
|
||||||
|
err = noErr;
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
if ( property >= kMinColumnId )
|
||||||
|
{
|
||||||
|
wxMacDataBrowserColumn* col = lb->GetColumnFromProperty( property );
|
||||||
|
|
||||||
|
unsigned int n = owner->GetLineFromItem( this );
|
||||||
|
wxListBox *list = wxDynamicCast( owner->GetWXPeer() , wxListBox );
|
||||||
|
wxMacDataBrowserCellValue valueholder(itemData);
|
||||||
|
list->SetValueCallback( n , col, valueholder );
|
||||||
|
|
||||||
|
/*
|
||||||
|
// we have to change this behind the back, since Check() would be triggering another update round
|
||||||
|
bool newVal = !m_isChecked;
|
||||||
|
verify_noerr(SetDataBrowserItemDataButtonValue( itemData, newVal ? kThemeButtonOn : kThemeButtonOff ));
|
||||||
|
m_isChecked = newVal;
|
||||||
|
err = noErr;
|
||||||
|
|
||||||
|
wxCommandEvent event( wxEVT_COMMAND_CHECKLISTBOX_TOGGLED, checklist->GetId() );
|
||||||
|
event.SetInt( owner->GetLineFromItem( this ) );
|
||||||
|
event.SetEventObject( checklist );
|
||||||
|
checklist->HandleWindowEvent( event );
|
||||||
|
|
||||||
|
*/
|
||||||
|
err = noErr;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// call inherited if not ours
|
||||||
|
if ( err == errDataBrowserPropertyNotSupported )
|
||||||
|
{
|
||||||
|
err = wxMacDataItem::GetSetData(owner, property, itemData, changeValue);
|
||||||
|
}
|
||||||
|
|
||||||
|
return err;
|
||||||
|
}
|
||||||
|
|
||||||
void wxMacListBoxItem::Notification(wxMacDataItemBrowserControl *owner ,
|
void wxMacListBoxItem::Notification(wxMacDataItemBrowserControl *owner ,
|
||||||
DataBrowserItemNotification message,
|
DataBrowserItemNotification message,
|
||||||
DataBrowserItemDataRef WXUNUSED(itemData) ) const
|
DataBrowserItemDataRef WXUNUSED(itemData) ) const
|
||||||
@@ -417,28 +240,24 @@ void wxMacListBoxItem::Notification(wxMacDataItemBrowserControl *owner ,
|
|||||||
|
|
||||||
if ( message == kDataBrowserItemRemoved)
|
if ( message == kDataBrowserItemRemoved)
|
||||||
{
|
{
|
||||||
if ( lb != NULL && lb->GetClientDataType() == wxClientData_Object )
|
|
||||||
{
|
|
||||||
delete (wxClientData*) (m_data);
|
|
||||||
}
|
|
||||||
|
|
||||||
delete this;
|
delete this;
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
wxListBox *list = wxDynamicCast( owner->GetWXPeer() , wxListBox );
|
wxListBox *list = wxDynamicCast( lb->GetWXPeer() , wxListBox );
|
||||||
wxCHECK_RET( list != NULL , wxT("Listbox expected"));
|
wxCHECK_RET( list != NULL , wxT("Listbox expected"));
|
||||||
|
|
||||||
if (message == kDataBrowserItemDoubleClicked)
|
if (message == kDataBrowserItemDoubleClicked)
|
||||||
{
|
{
|
||||||
|
unsigned int n = owner->GetLineFromItem( this );
|
||||||
wxCommandEvent event( wxEVT_COMMAND_LISTBOX_DOUBLECLICKED, list->GetId() );
|
wxCommandEvent event( wxEVT_COMMAND_LISTBOX_DOUBLECLICKED, list->GetId() );
|
||||||
event.SetEventObject( list );
|
event.SetEventObject( list );
|
||||||
if ( list->HasClientObjectData() )
|
if ( list->HasClientObjectData() )
|
||||||
event.SetClientObject( (wxClientData*) m_data );
|
event.SetClientObject( list->GetClientObject(n) );
|
||||||
else if ( list->HasClientUntypedData() )
|
else if ( list->HasClientUntypedData() )
|
||||||
event.SetClientData( m_data );
|
event.SetClientData( list->GetClientData(n) );
|
||||||
event.SetString( m_label );
|
event.SetString( list->GetString(n) );
|
||||||
event.SetInt( owner->GetLineFromItem( this ) );
|
event.SetInt( n );
|
||||||
event.SetExtraLong( 1 );
|
event.SetExtraLong( 1 );
|
||||||
list->HandleWindowEvent(event);
|
list->HandleWindowEvent(event);
|
||||||
return;
|
return;
|
||||||
@@ -450,6 +269,8 @@ IMPLEMENT_DYNAMIC_CLASS( wxMacDataBrowserListControl , wxMacDataItemBrowserContr
|
|||||||
wxMacDataBrowserListControl::wxMacDataBrowserListControl( wxWindow *peer, const wxPoint& pos, const wxSize& size, long style)
|
wxMacDataBrowserListControl::wxMacDataBrowserListControl( wxWindow *peer, const wxPoint& pos, const wxSize& size, long style)
|
||||||
: wxMacDataItemBrowserControl( peer, pos, size, style )
|
: wxMacDataItemBrowserControl( peer, pos, size, style )
|
||||||
{
|
{
|
||||||
|
m_nextColumnId = 0 ;
|
||||||
|
|
||||||
OSStatus err = noErr;
|
OSStatus err = noErr;
|
||||||
m_clientDataItemsType = wxClientData_None;
|
m_clientDataItemsType = wxClientData_None;
|
||||||
if ( style & wxLB_SORT )
|
if ( style & wxLB_SORT )
|
||||||
@@ -483,7 +304,7 @@ wxMacDataBrowserListControl::wxMacDataBrowserListControl( wxWindow *peer, const
|
|||||||
columnDesc.headerBtnDesc.btnFontStyle.font = kControlFontViewSystemFont;
|
columnDesc.headerBtnDesc.btnFontStyle.font = kControlFontViewSystemFont;
|
||||||
columnDesc.headerBtnDesc.btnFontStyle.style = normal;
|
columnDesc.headerBtnDesc.btnFontStyle.style = normal;
|
||||||
columnDesc.headerBtnDesc.titleString = NULL;
|
columnDesc.headerBtnDesc.titleString = NULL;
|
||||||
|
/*
|
||||||
columnDesc.headerBtnDesc.minimumWidth = 0;
|
columnDesc.headerBtnDesc.minimumWidth = 0;
|
||||||
columnDesc.headerBtnDesc.maximumWidth = 10000;
|
columnDesc.headerBtnDesc.maximumWidth = 10000;
|
||||||
|
|
||||||
@@ -493,7 +314,7 @@ wxMacDataBrowserListControl::wxMacDataBrowserListControl( wxWindow *peer, const
|
|||||||
columnDesc.propertyDesc.propertyFlags |= kDataBrowserListViewTypeSelectColumn;
|
columnDesc.propertyDesc.propertyFlags |= kDataBrowserListViewTypeSelectColumn;
|
||||||
|
|
||||||
verify_noerr( AddColumn( &columnDesc, kDataBrowserListViewAppendColumn ) );
|
verify_noerr( AddColumn( &columnDesc, kDataBrowserListViewAppendColumn ) );
|
||||||
|
*/
|
||||||
columnDesc.headerBtnDesc.minimumWidth = 0;
|
columnDesc.headerBtnDesc.minimumWidth = 0;
|
||||||
columnDesc.headerBtnDesc.maximumWidth = 0;
|
columnDesc.headerBtnDesc.maximumWidth = 0;
|
||||||
columnDesc.propertyDesc.propertyID = kNumericOrderColumnId;
|
columnDesc.propertyDesc.propertyID = kNumericOrderColumnId;
|
||||||
@@ -503,6 +324,7 @@ wxMacDataBrowserListControl::wxMacDataBrowserListControl( wxWindow *peer, const
|
|||||||
|
|
||||||
verify_noerr( AddColumn( &columnDesc, kDataBrowserListViewAppendColumn ) );
|
verify_noerr( AddColumn( &columnDesc, kDataBrowserListViewAppendColumn ) );
|
||||||
|
|
||||||
|
/*
|
||||||
SetDataBrowserSortProperty( m_controlRef , kTextColumnId);
|
SetDataBrowserSortProperty( m_controlRef , kTextColumnId);
|
||||||
if ( m_sortOrder == SortOrder_Text_Ascending )
|
if ( m_sortOrder == SortOrder_Text_Ascending )
|
||||||
{
|
{
|
||||||
@@ -510,6 +332,7 @@ wxMacDataBrowserListControl::wxMacDataBrowserListControl( wxWindow *peer, const
|
|||||||
SetDataBrowserSortOrder( m_controlRef , kDataBrowserOrderIncreasing);
|
SetDataBrowserSortOrder( m_controlRef , kDataBrowserOrderIncreasing);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
|
*/
|
||||||
{
|
{
|
||||||
SetDataBrowserSortProperty( m_controlRef , kNumericOrderColumnId);
|
SetDataBrowserSortProperty( m_controlRef , kNumericOrderColumnId);
|
||||||
SetDataBrowserSortOrder( m_controlRef , kDataBrowserOrderIncreasing);
|
SetDataBrowserSortOrder( m_controlRef , kDataBrowserOrderIncreasing);
|
||||||
@@ -566,15 +389,260 @@ void wxMacDataBrowserListControl::ItemNotification(
|
|||||||
// call super for item level(wxMacDataItem->Notification) callback processing
|
// call super for item level(wxMacDataItem->Notification) callback processing
|
||||||
wxMacDataItemBrowserControl::ItemNotification( itemID, message, itemData);
|
wxMacDataItemBrowserControl::ItemNotification( itemID, message, itemData);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/*
|
/*
|
||||||
wxWindow * wxMacDataBrowserListControl::GetPeer() const
|
wxWindow * wxMacDataBrowserListControl::GetPeer() const
|
||||||
{
|
{
|
||||||
return wxDynamicCast( wxMacControl::GetWX() , wxWindow );
|
return wxDynamicCast( wxMacControl::GetWX() , wxWindow );
|
||||||
}
|
}
|
||||||
*/
|
*/
|
||||||
wxMacDataItem* wxMacDataBrowserListControl::CreateItem()
|
|
||||||
|
//
|
||||||
|
// List Methods
|
||||||
|
//
|
||||||
|
|
||||||
|
wxMacDataBrowserColumn* wxMacDataBrowserListControl::DoInsertColumn( unsigned int pos, DataBrowserPropertyID property,
|
||||||
|
const wxString& title, bool editable,
|
||||||
|
DataBrowserPropertyType colType, SInt16 just, int width )
|
||||||
{
|
{
|
||||||
return new wxMacListBoxItem();
|
DataBrowserListViewColumnDesc columnDesc;
|
||||||
|
columnDesc.headerBtnDesc.titleOffset = 0;
|
||||||
|
columnDesc.headerBtnDesc.version = kDataBrowserListViewLatestHeaderDesc;
|
||||||
|
|
||||||
|
columnDesc.headerBtnDesc.btnFontStyle.flags =
|
||||||
|
kControlUseFontMask | kControlUseJustMask;
|
||||||
|
|
||||||
|
columnDesc.headerBtnDesc.btnContentInfo.contentType = kControlContentTextOnly;
|
||||||
|
columnDesc.headerBtnDesc.btnFontStyle.just = just;
|
||||||
|
columnDesc.headerBtnDesc.btnFontStyle.font = kControlFontViewSystemFont;
|
||||||
|
columnDesc.headerBtnDesc.btnFontStyle.style = normal;
|
||||||
|
|
||||||
|
// TODO: Why is m_font not defined when we enter wxLC_LIST mode, but is
|
||||||
|
// defined for other modes?
|
||||||
|
wxFontEncoding enc;
|
||||||
|
if ( m_font.Ok() )
|
||||||
|
enc = m_font.GetEncoding();
|
||||||
|
else
|
||||||
|
enc = wxLocale::GetSystemEncoding();
|
||||||
|
wxCFStringRef cfTitle( title, enc );
|
||||||
|
columnDesc.headerBtnDesc.titleString = cfTitle;
|
||||||
|
|
||||||
|
columnDesc.headerBtnDesc.minimumWidth = 0;
|
||||||
|
columnDesc.headerBtnDesc.maximumWidth = 30000;
|
||||||
|
|
||||||
|
columnDesc.propertyDesc.propertyID = property;
|
||||||
|
columnDesc.propertyDesc.propertyType = colType;
|
||||||
|
columnDesc.propertyDesc.propertyFlags = kDataBrowserListViewSortableColumn;
|
||||||
|
columnDesc.propertyDesc.propertyFlags |= kDataBrowserListViewTypeSelectColumn;
|
||||||
|
columnDesc.propertyDesc.propertyFlags |= kDataBrowserListViewNoGapForIconInHeaderButton;
|
||||||
|
|
||||||
|
if ( editable )
|
||||||
|
columnDesc.propertyDesc.propertyFlags |= kDataBrowserPropertyIsMutable;
|
||||||
|
|
||||||
|
verify_noerr( AddColumn( &columnDesc, pos ) );
|
||||||
|
|
||||||
|
if (width > 0)
|
||||||
|
{
|
||||||
|
wxMacDataBrowserControl::SetColumnWidth(property, width);
|
||||||
|
}
|
||||||
|
|
||||||
|
wxMacDataBrowserColumn *col = new wxMacDataBrowserColumn( property, colType, editable );
|
||||||
|
|
||||||
|
m_columns.Insert( col, pos );
|
||||||
|
|
||||||
|
return col;
|
||||||
|
}
|
||||||
|
|
||||||
|
wxListWidgetColumn* wxMacDataBrowserListControl::InsertTextColumn( unsigned pos, const wxString& title, bool editable,
|
||||||
|
wxAlignment just, int defaultWidth)
|
||||||
|
{
|
||||||
|
DataBrowserPropertyID property = kMinColumnId + m_nextColumnId++;
|
||||||
|
|
||||||
|
SInt16 j = teFlushLeft;
|
||||||
|
if ( just & wxALIGN_RIGHT )
|
||||||
|
j = teFlushRight;
|
||||||
|
else if ( just & wxALIGN_CENTER_HORIZONTAL )
|
||||||
|
j = teCenter;
|
||||||
|
|
||||||
|
return DoInsertColumn( pos, property, title, editable, kDataBrowserTextType, just, defaultWidth );
|
||||||
|
}
|
||||||
|
|
||||||
|
wxListWidgetColumn* wxMacDataBrowserListControl::InsertCheckColumn( unsigned pos , const wxString& title, bool editable,
|
||||||
|
wxAlignment just, int defaultWidth )
|
||||||
|
{
|
||||||
|
DataBrowserPropertyID property = kMinColumnId + m_nextColumnId++;
|
||||||
|
|
||||||
|
SInt16 j = teFlushLeft;
|
||||||
|
if ( just & wxALIGN_RIGHT )
|
||||||
|
j = teFlushRight;
|
||||||
|
else if ( just & wxALIGN_CENTER_HORIZONTAL )
|
||||||
|
j = teCenter;
|
||||||
|
|
||||||
|
return DoInsertColumn( pos, property, title, editable, kDataBrowserCheckboxType, just, defaultWidth );
|
||||||
|
}
|
||||||
|
|
||||||
|
wxMacDataBrowserColumn* wxMacDataBrowserListControl::GetColumnFromProperty( DataBrowserPropertyID property)
|
||||||
|
{
|
||||||
|
for ( unsigned int i = 0; i < m_columns.size() ; ++ i )
|
||||||
|
if ( m_columns[i]->GetProperty() == property )
|
||||||
|
return m_columns[i];
|
||||||
|
|
||||||
|
return NULL;
|
||||||
|
}
|
||||||
|
|
||||||
|
/*
|
||||||
|
wxMacDataItem* wxMacDataBrowserListControl::ListGetLineItem( unsigned int n )
|
||||||
|
{
|
||||||
|
return (wxMacDataItem*) GetItemFromLine(n);
|
||||||
|
}
|
||||||
|
*/
|
||||||
|
|
||||||
|
unsigned int wxMacDataBrowserListControl::ListGetCount() const
|
||||||
|
{
|
||||||
|
return MacGetCount();
|
||||||
|
}
|
||||||
|
|
||||||
|
void wxMacDataBrowserListControl::ListDelete( unsigned int n )
|
||||||
|
{
|
||||||
|
MacDelete( n );
|
||||||
|
}
|
||||||
|
|
||||||
|
void wxMacDataBrowserListControl::ListInsert( unsigned int n )
|
||||||
|
{
|
||||||
|
MacInsert( n , new wxMacListBoxItem() );
|
||||||
|
}
|
||||||
|
|
||||||
|
void wxMacDataBrowserListControl::ListClear()
|
||||||
|
{
|
||||||
|
MacClear();
|
||||||
|
}
|
||||||
|
|
||||||
|
void wxMacDataBrowserListControl::ListDeselectAll()
|
||||||
|
{
|
||||||
|
wxMacDataItemBrowserSelectionSuppressor suppressor(this);
|
||||||
|
SetSelectedAllItems( kDataBrowserItemsRemove );
|
||||||
|
}
|
||||||
|
|
||||||
|
void wxMacDataBrowserListControl::ListSetSelection( unsigned int n, bool select, bool multi )
|
||||||
|
{
|
||||||
|
wxMacDataItem* item = (wxMacDataItem*) GetItemFromLine(n);
|
||||||
|
wxMacDataItemBrowserSelectionSuppressor suppressor(this);
|
||||||
|
|
||||||
|
if ( IsItemSelected( item ) != select )
|
||||||
|
{
|
||||||
|
if ( select )
|
||||||
|
SetSelectedItem( item, multi ? kDataBrowserItemsAdd : kDataBrowserItemsAssign );
|
||||||
|
else
|
||||||
|
SetSelectedItem( item, kDataBrowserItemsRemove );
|
||||||
|
}
|
||||||
|
|
||||||
|
ListScrollTo( n );
|
||||||
|
}
|
||||||
|
|
||||||
|
bool wxMacDataBrowserListControl::ListIsSelected( unsigned int n ) const
|
||||||
|
{
|
||||||
|
wxMacDataItem* item = (wxMacDataItem*) GetItemFromLine(n);
|
||||||
|
return IsItemSelected( item );
|
||||||
|
}
|
||||||
|
|
||||||
|
int wxMacDataBrowserListControl::ListGetSelection() const
|
||||||
|
{
|
||||||
|
wxMacDataItemPtr first, last;
|
||||||
|
GetSelectionAnchor( &first, &last );
|
||||||
|
|
||||||
|
if ( first != NULL )
|
||||||
|
{
|
||||||
|
return GetLineFromItem( first );
|
||||||
|
}
|
||||||
|
|
||||||
|
return -1;
|
||||||
|
}
|
||||||
|
|
||||||
|
int wxMacDataBrowserListControl::ListGetSelections( wxArrayInt& aSelections ) const
|
||||||
|
{
|
||||||
|
aSelections.Empty();
|
||||||
|
wxArrayMacDataItemPtr selectedItems;
|
||||||
|
GetItems( wxMacDataBrowserRootContainer, false , kDataBrowserItemIsSelected, selectedItems);
|
||||||
|
|
||||||
|
int count = selectedItems.GetCount();
|
||||||
|
|
||||||
|
for ( int i = 0; i < count; ++i)
|
||||||
|
{
|
||||||
|
aSelections.Add(GetLineFromItem(selectedItems[i]));
|
||||||
|
}
|
||||||
|
|
||||||
|
return count;
|
||||||
|
}
|
||||||
|
|
||||||
|
void wxMacDataBrowserListControl::ListScrollTo( unsigned int n )
|
||||||
|
{
|
||||||
|
UInt32 top , left ;
|
||||||
|
GetScrollPosition( &top , &left ) ;
|
||||||
|
wxMacDataItem * item = (wxMacDataItem*) GetItemFromLine( n );
|
||||||
|
|
||||||
|
// there is a bug in RevealItem that leads to situations
|
||||||
|
// in large lists, where the item does not get scrolled
|
||||||
|
// into sight, so we do a pre-scroll if necessary
|
||||||
|
UInt16 height ;
|
||||||
|
GetRowHeight( (DataBrowserItemID) item , &height ) ;
|
||||||
|
UInt32 linetop = n * ((UInt32) height );
|
||||||
|
UInt32 linebottom = linetop + height;
|
||||||
|
Rect rect ;
|
||||||
|
GetControlBounds( m_controlRef, &rect );
|
||||||
|
|
||||||
|
if ( linetop < top || linebottom > (top + rect.bottom - rect.top ) )
|
||||||
|
SetScrollPosition( wxMax( n-2, 0 ) * ((UInt32)height) , left ) ;
|
||||||
|
|
||||||
|
RevealItem( item , kDataBrowserRevealWithoutSelecting );
|
||||||
|
}
|
||||||
|
|
||||||
|
void wxMacDataBrowserListControl::UpdateLine( unsigned int n, wxListWidgetColumn* col )
|
||||||
|
{
|
||||||
|
wxMacDataBrowserColumn* dbcol = dynamic_cast<wxMacDataBrowserColumn*> (col);
|
||||||
|
wxMacDataItem * item = (wxMacDataItem*) GetItemFromLine( n );
|
||||||
|
UpdateItem(wxMacDataBrowserRootContainer, item, dbcol ? dbcol->GetProperty() : kDataBrowserNoItem );
|
||||||
|
}
|
||||||
|
|
||||||
|
void wxMacDataBrowserListControl::UpdateLineToEnd( unsigned int n)
|
||||||
|
{
|
||||||
|
// with databrowser inserting does not need updating the entire model, it's done by databrowser itself
|
||||||
|
wxMacDataItem * item = (wxMacDataItem*) GetItemFromLine( n );
|
||||||
|
UpdateItem(wxMacDataBrowserRootContainer, item, kDataBrowserNoItem );
|
||||||
|
}
|
||||||
|
|
||||||
|
// value setters
|
||||||
|
|
||||||
|
void wxMacDataBrowserCellValue::Set( CFStringRef value )
|
||||||
|
{
|
||||||
|
SetDataBrowserItemDataText( m_data, value );
|
||||||
|
}
|
||||||
|
|
||||||
|
void wxMacDataBrowserCellValue::Set( const wxString& value )
|
||||||
|
{
|
||||||
|
wxCFStringRef cf(value);
|
||||||
|
SetDataBrowserItemDataText( m_data, (CFStringRef) cf);
|
||||||
|
}
|
||||||
|
|
||||||
|
void wxMacDataBrowserCellValue::Set( int value )
|
||||||
|
{
|
||||||
|
SetDataBrowserItemDataValue( m_data, value );
|
||||||
|
// SetDataBrowserItemDataButtonValue( m_data, value ? kThemeButtonOn : kThemeButtonOff);
|
||||||
|
}
|
||||||
|
|
||||||
|
int wxMacDataBrowserCellValue::GetIntValue() const
|
||||||
|
{
|
||||||
|
SInt32 value;
|
||||||
|
GetDataBrowserItemDataValue( m_data, &value );
|
||||||
|
return value;
|
||||||
|
}
|
||||||
|
|
||||||
|
wxString wxMacDataBrowserCellValue::GetStringValue() const
|
||||||
|
{
|
||||||
|
CFStringRef value;
|
||||||
|
GetDataBrowserItemDataText ( m_data, &value );
|
||||||
|
wxCFStringRef cf(value);
|
||||||
|
return cf.AsString();
|
||||||
}
|
}
|
||||||
|
|
||||||
#if 0
|
#if 0
|
||||||
|
@@ -1,5 +1,5 @@
|
|||||||
/////////////////////////////////////////////////////////////////////////////
|
/////////////////////////////////////////////////////////////////////////////
|
||||||
// Name: src/mac/listctrl_mac.cpp
|
// Name: src/osx/listctrl_mac.cpp
|
||||||
// Purpose: wxListCtrl
|
// Purpose: wxListCtrl
|
||||||
// Author: Julian Smart
|
// Author: Julian Smart
|
||||||
// Modified by: Agron Selimaj
|
// Modified by: Agron Selimaj
|
||||||
@@ -176,7 +176,7 @@ static pascal OSStatus wxMacListCtrlEventHandler( EventHandlerCallRef handler ,
|
|||||||
|
|
||||||
DEFINE_ONE_SHOT_HANDLER_GETTER( wxMacListCtrlEventHandler )
|
DEFINE_ONE_SHOT_HANDLER_GETTER( wxMacListCtrlEventHandler )
|
||||||
|
|
||||||
class wxMacListCtrlItem : public wxMacListBoxItem
|
class wxMacListCtrlItem : public wxMacDataItem
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
wxMacListCtrlItem();
|
wxMacListCtrlItem();
|
||||||
@@ -214,8 +214,6 @@ public:
|
|||||||
|
|
||||||
// create a list item (can be a subclass of wxMacListBoxItem)
|
// create a list item (can be a subclass of wxMacListBoxItem)
|
||||||
|
|
||||||
virtual wxMacDataItem* CreateItem();
|
|
||||||
|
|
||||||
virtual void MacInsertItem( unsigned int n, wxListItem* item );
|
virtual void MacInsertItem( unsigned int n, wxListItem* item );
|
||||||
virtual void MacSetColumnInfo( unsigned int row, unsigned int column, wxListItem* item );
|
virtual void MacSetColumnInfo( unsigned int row, unsigned int column, wxListItem* item );
|
||||||
virtual void MacGetColumnInfo( unsigned int row, unsigned int column, wxListItem& item );
|
virtual void MacGetColumnInfo( unsigned int row, unsigned int column, wxListItem& item );
|
||||||
@@ -517,10 +515,9 @@ END_EVENT_TABLE()
|
|||||||
// implementation
|
// implementation
|
||||||
// ============================================================================
|
// ============================================================================
|
||||||
|
|
||||||
wxMacListControl* wxListCtrl::GetPeer() const
|
wxMacDataBrowserListCtrlControl* wxListCtrl::GetListPeer() const
|
||||||
{
|
{
|
||||||
wxMacDataBrowserListCtrlControl *lb = wxDynamicCast(m_peer,wxMacDataBrowserListCtrlControl);
|
return dynamic_cast<wxMacDataBrowserListCtrlControl*> ( GetPeer() );
|
||||||
return lb ? wx_static_cast(wxMacListControl*,lb) : 0 ;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// ----------------------------------------------------------------------------
|
// ----------------------------------------------------------------------------
|
||||||
@@ -2433,11 +2430,6 @@ void wxMacListCtrlItem::Notification(wxMacDataItemBrowserControl *owner ,
|
|||||||
// we want to depend on as little as possible to make sure tear-down of controls is safe
|
// we want to depend on as little as possible to make sure tear-down of controls is safe
|
||||||
if ( message == kDataBrowserItemRemoved)
|
if ( message == kDataBrowserItemRemoved)
|
||||||
{
|
{
|
||||||
if ( lb != NULL && lb->GetClientDataType() == wxClientData_Object )
|
|
||||||
{
|
|
||||||
delete (wxClientData*) (m_data);
|
|
||||||
}
|
|
||||||
|
|
||||||
delete this;
|
delete this;
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
@@ -3248,13 +3240,9 @@ void wxMacDataBrowserListCtrlControl::MacGetColumnInfo( unsigned int row, unsign
|
|||||||
|
|
||||||
void wxMacDataBrowserListCtrlControl::MacInsertItem( unsigned int n, wxListItem* item )
|
void wxMacDataBrowserListCtrlControl::MacInsertItem( unsigned int n, wxListItem* item )
|
||||||
{
|
{
|
||||||
wxMacDataItemBrowserControl::MacInsert(n, item->GetText());
|
|
||||||
MacSetColumnInfo(n, 0, item);
|
|
||||||
}
|
|
||||||
|
|
||||||
wxMacDataItem* wxMacDataBrowserListCtrlControl::CreateItem()
|
wxMacDataItemBrowserControl::MacInsert(n, new wxMacListCtrlItem() );
|
||||||
{
|
MacSetColumnInfo(n, 0, item);
|
||||||
return new wxMacListCtrlItem();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
wxMacListCtrlItem::wxMacListCtrlItem()
|
wxMacListCtrlItem::wxMacListCtrlItem()
|
||||||
@@ -3278,9 +3266,10 @@ void wxMacListCtrlItem::SetColumnImageValue( unsigned int column, int imageIndex
|
|||||||
|
|
||||||
wxString wxMacListCtrlItem::GetColumnTextValue( unsigned int column )
|
wxString wxMacListCtrlItem::GetColumnTextValue( unsigned int column )
|
||||||
{
|
{
|
||||||
|
/* TODO CHECK REMOVE
|
||||||
if ( column == 0 )
|
if ( column == 0 )
|
||||||
return GetLabel();
|
return GetLabel();
|
||||||
|
*/
|
||||||
if ( HasColumnInfo(column) )
|
if ( HasColumnInfo(column) )
|
||||||
return GetColumnInfo(column)->GetText();
|
return GetColumnInfo(column)->GetText();
|
||||||
|
|
||||||
@@ -3292,9 +3281,11 @@ void wxMacListCtrlItem::SetColumnTextValue( unsigned int column, const wxString&
|
|||||||
if ( HasColumnInfo(column) )
|
if ( HasColumnInfo(column) )
|
||||||
GetColumnInfo(column)->SetText(text);
|
GetColumnInfo(column)->SetText(text);
|
||||||
|
|
||||||
|
/* TODO CHECK REMOVE
|
||||||
// for compatibility with superclass APIs
|
// for compatibility with superclass APIs
|
||||||
if ( column == 0 )
|
if ( column == 0 )
|
||||||
SetLabel(text);
|
SetLabel(text);
|
||||||
|
*/
|
||||||
}
|
}
|
||||||
|
|
||||||
wxListItem* wxMacListCtrlItem::GetColumnInfo( unsigned int column )
|
wxListItem* wxMacListCtrlItem::GetColumnInfo( unsigned int column )
|
||||||
|
@@ -1,5 +1,5 @@
|
|||||||
/////////////////////////////////////////////////////////////////////////////
|
/////////////////////////////////////////////////////////////////////////////
|
||||||
// Name: src/mac/carbon/mdi.cpp
|
// Name: src/osx/carbon/mdi.cpp
|
||||||
// Purpose: MDI classes
|
// Purpose: MDI classes
|
||||||
// Author: Stefan Csomor
|
// Author: Stefan Csomor
|
||||||
// Modified by:
|
// Modified by:
|
||||||
|
@@ -1,5 +1,5 @@
|
|||||||
/////////////////////////////////////////////////////////////////////////////
|
/////////////////////////////////////////////////////////////////////////////
|
||||||
// Name: src/mac/carbon/mediactrl.cpp
|
// Name: src/osx/carbon/mediactrl.cpp
|
||||||
// Purpose: Built-in Media Backends for Mac
|
// Purpose: Built-in Media Backends for Mac
|
||||||
// Author: Ryan Norton <wxprojects@comcast.net>
|
// Author: Ryan Norton <wxprojects@comcast.net>
|
||||||
// Modified by:
|
// Modified by:
|
||||||
@@ -45,18 +45,6 @@
|
|||||||
#include "wx/timer.h"
|
#include "wx/timer.h"
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
// uma is for wxMacFSSpec
|
|
||||||
#include "wx/osx/uma.h"
|
|
||||||
|
|
||||||
// standard QT stuff
|
|
||||||
#ifndef __DARWIN__
|
|
||||||
#include <Movies.h>
|
|
||||||
#include <Gestalt.h>
|
|
||||||
#include <QuickTimeComponents.h>
|
|
||||||
#else
|
|
||||||
#include <QuickTime/QuickTimeComponents.h>
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#if wxOSX_USE_CARBON
|
#if wxOSX_USE_CARBON
|
||||||
#define USE_QUICKTIME 1
|
#define USE_QUICKTIME 1
|
||||||
#else
|
#else
|
||||||
@@ -65,6 +53,9 @@
|
|||||||
|
|
||||||
#if USE_QUICKTIME
|
#if USE_QUICKTIME
|
||||||
|
|
||||||
|
#include "wx/osx/private.h"
|
||||||
|
#include <QuickTime/QuickTimeComponents.h>
|
||||||
|
|
||||||
//---------------------------------------------------------------------------
|
//---------------------------------------------------------------------------
|
||||||
// Height and Width of movie controller in the movie control (apple samples)
|
// Height and Width of movie controller in the movie control (apple samples)
|
||||||
//---------------------------------------------------------------------------
|
//---------------------------------------------------------------------------
|
||||||
|
File diff suppressed because it is too large
Load Diff
@@ -1,5 +1,5 @@
|
|||||||
///////////////////////////////////////////////////////////////////////////////
|
///////////////////////////////////////////////////////////////////////////////
|
||||||
// Name: src/mac/carbon/menuitem.cpp
|
// Name: src/osx/carbon/menuitem.cpp
|
||||||
// Purpose: wxMenuItem implementation
|
// Purpose: wxMenuItem implementation
|
||||||
// Author: Stefan Csomor
|
// Author: Stefan Csomor
|
||||||
// Modified by:
|
// Modified by:
|
||||||
@@ -19,271 +19,7 @@
|
|||||||
#include "wx/menu.h"
|
#include "wx/menu.h"
|
||||||
#endif // WX_PRECOMP
|
#endif // WX_PRECOMP
|
||||||
|
|
||||||
#include "wx/osx/uma.h"
|
#include "wx/osx/private.h"
|
||||||
|
|
||||||
IMPLEMENT_DYNAMIC_CLASS(wxMenuItem, wxObject)
|
// because on mac carbon everything is done through MenuRef APIs both implementation
|
||||||
|
// classes are in menu.cpp
|
||||||
|
|
||||||
wxMenuItem::wxMenuItem(wxMenu *pParentMenu,
|
|
||||||
int id,
|
|
||||||
const wxString& text,
|
|
||||||
const wxString& strHelp,
|
|
||||||
wxItemKind kind,
|
|
||||||
wxMenu *pSubMenu)
|
|
||||||
:wxMenuItemBase(pParentMenu, id, text, strHelp, kind, pSubMenu)
|
|
||||||
{
|
|
||||||
wxASSERT_MSG( id != 0 || pSubMenu != NULL , wxT("A MenuItem ID of Zero does not work under Mac") ) ;
|
|
||||||
|
|
||||||
// In other languages there is no difference in naming the Exit/Quit menu item between MacOS and Windows guidelines
|
|
||||||
// therefore these item must not be translated
|
|
||||||
if ( wxStripMenuCodes(m_text).Upper() == wxT("EXIT") )
|
|
||||||
m_text = wxT("Quit\tCtrl+Q") ;
|
|
||||||
|
|
||||||
m_radioGroup.start = -1;
|
|
||||||
m_isRadioGroupStart = false;
|
|
||||||
}
|
|
||||||
|
|
||||||
wxMenuItem::~wxMenuItem()
|
|
||||||
{
|
|
||||||
}
|
|
||||||
|
|
||||||
// change item state
|
|
||||||
// -----------------
|
|
||||||
|
|
||||||
void wxMenuItem::SetBitmap(const wxBitmap& bitmap)
|
|
||||||
{
|
|
||||||
m_bitmap = bitmap;
|
|
||||||
UpdateItemBitmap();
|
|
||||||
}
|
|
||||||
|
|
||||||
void wxMenuItem::UpdateItemBitmap()
|
|
||||||
{
|
|
||||||
if ( !m_parentMenu )
|
|
||||||
return ;
|
|
||||||
|
|
||||||
MenuHandle mhandle = MAC_WXHMENU(m_parentMenu->GetHMenu()) ;
|
|
||||||
MenuItemIndex index = m_parentMenu->MacGetIndexFromItem( this ) ;
|
|
||||||
DoUpdateItemBitmap( mhandle, index );
|
|
||||||
}
|
|
||||||
|
|
||||||
void wxMenuItem::DoUpdateItemBitmap( WXHMENU menu, wxUint16 index)
|
|
||||||
{
|
|
||||||
MenuHandle mhandle = (MenuHandle) menu;
|
|
||||||
|
|
||||||
if ( mhandle == NULL || index == 0)
|
|
||||||
return ;
|
|
||||||
|
|
||||||
if ( m_bitmap.Ok() )
|
|
||||||
{
|
|
||||||
#if wxUSE_BMPBUTTON
|
|
||||||
ControlButtonContentInfo info ;
|
|
||||||
wxMacCreateBitmapButton( &info , m_bitmap ) ;
|
|
||||||
if ( info.contentType != kControlNoContent )
|
|
||||||
{
|
|
||||||
if ( info.contentType == kControlContentIconRef )
|
|
||||||
SetMenuItemIconHandle( mhandle , index ,
|
|
||||||
kMenuIconRefType , (Handle) info.u.iconRef ) ;
|
|
||||||
else if ( info.contentType == kControlContentCGImageRef )
|
|
||||||
SetMenuItemIconHandle( mhandle , index ,
|
|
||||||
kMenuCGImageRefType , (Handle) info.u.imageRef ) ;
|
|
||||||
}
|
|
||||||
wxMacReleaseBitmapButton( &info ) ;
|
|
||||||
#endif
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
void wxMenuItem::UpdateItemStatus()
|
|
||||||
{
|
|
||||||
if ( !m_parentMenu )
|
|
||||||
return ;
|
|
||||||
|
|
||||||
if ( IsSeparator() )
|
|
||||||
return ;
|
|
||||||
|
|
||||||
if ( GetId() == wxApp::s_macPreferencesMenuItemId)
|
|
||||||
{
|
|
||||||
if ( !IsEnabled() )
|
|
||||||
DisableMenuCommand( NULL , kHICommandPreferences ) ;
|
|
||||||
else
|
|
||||||
EnableMenuCommand( NULL , kHICommandPreferences ) ;
|
|
||||||
}
|
|
||||||
|
|
||||||
if ( GetId() == wxApp::s_macExitMenuItemId)
|
|
||||||
{
|
|
||||||
if ( !IsEnabled() )
|
|
||||||
DisableMenuCommand( NULL , kHICommandQuit ) ;
|
|
||||||
else
|
|
||||||
EnableMenuCommand( NULL , kHICommandQuit ) ;
|
|
||||||
}
|
|
||||||
|
|
||||||
{
|
|
||||||
MenuHandle mhandle = MAC_WXHMENU(m_parentMenu->GetHMenu()) ;
|
|
||||||
MenuItemIndex index = m_parentMenu->MacGetIndexFromItem( this ) ;
|
|
||||||
if ( mhandle == NULL || index == 0)
|
|
||||||
return ;
|
|
||||||
|
|
||||||
UMAEnableMenuItem( mhandle , index , m_isEnabled ) ;
|
|
||||||
if ( IsCheckable() && IsChecked() )
|
|
||||||
::SetItemMark( mhandle , index , 0x12 ) ; // checkmark
|
|
||||||
else
|
|
||||||
::SetItemMark( mhandle , index , 0 ) ; // no mark
|
|
||||||
|
|
||||||
UMASetMenuItemText( mhandle , index , wxStripMenuCodes(m_text) , wxFont::GetDefaultEncoding() ) ;
|
|
||||||
wxAcceleratorEntry *entry = wxAcceleratorEntry::Create( m_text ) ;
|
|
||||||
UMASetMenuItemShortcut( mhandle , index , entry ) ;
|
|
||||||
delete entry ;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
void wxMenuItem::UpdateItemText()
|
|
||||||
{
|
|
||||||
if ( !m_parentMenu )
|
|
||||||
return ;
|
|
||||||
|
|
||||||
MenuHandle mhandle = MAC_WXHMENU(m_parentMenu->GetHMenu()) ;
|
|
||||||
MenuItemIndex index = m_parentMenu->MacGetIndexFromItem( this ) ;
|
|
||||||
if (mhandle == NULL || index == 0)
|
|
||||||
return ;
|
|
||||||
|
|
||||||
wxString text = m_text;
|
|
||||||
if (text.IsEmpty() && !IsSeparator())
|
|
||||||
{
|
|
||||||
wxASSERT_MSG(wxIsStockID(GetId()), wxT("A non-stock menu item with an empty label?"));
|
|
||||||
text = wxGetStockLabel(GetId(), wxSTOCK_WITH_ACCELERATOR|wxSTOCK_WITH_MNEMONIC);
|
|
||||||
}
|
|
||||||
|
|
||||||
UMASetMenuItemText( mhandle , index , wxStripMenuCodes(text) , wxFont::GetDefaultEncoding() ) ;
|
|
||||||
wxAcceleratorEntry *entry = wxAcceleratorEntry::Create( text ) ;
|
|
||||||
UMASetMenuItemShortcut( mhandle , index , entry ) ;
|
|
||||||
delete entry ;
|
|
||||||
}
|
|
||||||
|
|
||||||
void wxMenuItem::Enable(bool bDoEnable)
|
|
||||||
{
|
|
||||||
if (( m_isEnabled != bDoEnable
|
|
||||||
// avoid changing menuitem state when menu is disabled
|
|
||||||
// eg. BeginAppModalStateForWindow() will disable menus and ignore this change
|
|
||||||
// which in turn causes m_isEnabled to become out of sync with real menuitem state
|
|
||||||
&& !(m_parentMenu && !IsMenuItemEnabled(MAC_WXHMENU(m_parentMenu->GetHMenu()), 0)) )
|
|
||||||
// always update builtin menuitems
|
|
||||||
|| ( GetId() == wxApp::s_macPreferencesMenuItemId
|
|
||||||
|| GetId() == wxApp::s_macExitMenuItemId
|
|
||||||
|| GetId() == wxApp::s_macAboutMenuItemId
|
|
||||||
))
|
|
||||||
{
|
|
||||||
wxMenuItemBase::Enable( bDoEnable ) ;
|
|
||||||
UpdateItemStatus() ;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
void wxMenuItem::UncheckRadio()
|
|
||||||
{
|
|
||||||
if ( m_isChecked )
|
|
||||||
{
|
|
||||||
wxMenuItemBase::Check( false ) ;
|
|
||||||
UpdateItemStatus() ;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
void wxMenuItem::Check(bool bDoCheck)
|
|
||||||
{
|
|
||||||
wxCHECK_RET( IsCheckable() && !IsSeparator(), wxT("only checkable items may be checked") );
|
|
||||||
|
|
||||||
if ( m_isChecked != bDoCheck )
|
|
||||||
{
|
|
||||||
if ( GetKind() == wxITEM_RADIO )
|
|
||||||
{
|
|
||||||
if ( bDoCheck )
|
|
||||||
{
|
|
||||||
wxMenuItemBase::Check( bDoCheck ) ;
|
|
||||||
UpdateItemStatus() ;
|
|
||||||
|
|
||||||
// get the index of this item in the menu
|
|
||||||
const wxMenuItemList& items = m_parentMenu->GetMenuItems();
|
|
||||||
int pos = items.IndexOf(this);
|
|
||||||
wxCHECK_RET( pos != wxNOT_FOUND,
|
|
||||||
_T("menuitem not found in the menu items list?") );
|
|
||||||
|
|
||||||
// get the radio group range
|
|
||||||
int start, end;
|
|
||||||
|
|
||||||
if ( m_isRadioGroupStart )
|
|
||||||
{
|
|
||||||
// we already have all information we need
|
|
||||||
start = pos;
|
|
||||||
end = m_radioGroup.end;
|
|
||||||
}
|
|
||||||
else // next radio group item
|
|
||||||
{
|
|
||||||
// get the radio group end from the start item
|
|
||||||
start = m_radioGroup.start;
|
|
||||||
end = items.Item(start)->GetData()->m_radioGroup.end;
|
|
||||||
}
|
|
||||||
|
|
||||||
// also uncheck all the other items in this radio group
|
|
||||||
wxMenuItemList::compatibility_iterator node = items.Item(start);
|
|
||||||
for ( int n = start; n <= end && node; n++ )
|
|
||||||
{
|
|
||||||
if ( n != pos )
|
|
||||||
((wxMenuItem*)node->GetData())->UncheckRadio();
|
|
||||||
|
|
||||||
node = node->GetNext();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
wxMenuItemBase::Check( bDoCheck ) ;
|
|
||||||
UpdateItemStatus() ;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
void wxMenuItem::SetItemLabel(const wxString& text)
|
|
||||||
{
|
|
||||||
// don't do anything if label didn't change
|
|
||||||
if ( m_text == text )
|
|
||||||
return;
|
|
||||||
|
|
||||||
wxMenuItemBase::SetItemLabel(text);
|
|
||||||
|
|
||||||
UpdateItemText() ;
|
|
||||||
}
|
|
||||||
|
|
||||||
// radio group stuff
|
|
||||||
// -----------------
|
|
||||||
|
|
||||||
void wxMenuItem::SetAsRadioGroupStart()
|
|
||||||
{
|
|
||||||
m_isRadioGroupStart = true;
|
|
||||||
}
|
|
||||||
|
|
||||||
void wxMenuItem::SetRadioGroupStart(int start)
|
|
||||||
{
|
|
||||||
wxASSERT_MSG( !m_isRadioGroupStart,
|
|
||||||
wxT("should only be called for the next radio items") );
|
|
||||||
|
|
||||||
m_radioGroup.start = start;
|
|
||||||
}
|
|
||||||
|
|
||||||
void wxMenuItem::SetRadioGroupEnd(int end)
|
|
||||||
{
|
|
||||||
wxASSERT_MSG( m_isRadioGroupStart,
|
|
||||||
wxT("should only be called for the first radio item") );
|
|
||||||
|
|
||||||
m_radioGroup.end = end;
|
|
||||||
}
|
|
||||||
|
|
||||||
// ----------------------------------------------------------------------------
|
|
||||||
// wxMenuItemBase
|
|
||||||
// ----------------------------------------------------------------------------
|
|
||||||
|
|
||||||
wxMenuItem *wxMenuItemBase::New(wxMenu *parentMenu,
|
|
||||||
int id,
|
|
||||||
const wxString& name,
|
|
||||||
const wxString& help,
|
|
||||||
wxItemKind kind,
|
|
||||||
wxMenu *subMenu)
|
|
||||||
{
|
|
||||||
return new wxMenuItem(parentMenu, id, name, help, kind, subMenu);
|
|
||||||
}
|
|
||||||
|
@@ -1,5 +1,5 @@
|
|||||||
/////////////////////////////////////////////////////////////////////////////
|
/////////////////////////////////////////////////////////////////////////////
|
||||||
// Name: src/mac/carbon/metafile.cpp
|
// Name: src/osx/carbon/metafile.cpp
|
||||||
// Purpose: wxMetaFile, wxMetaFileDC etc. These classes are optional.
|
// Purpose: wxMetaFile, wxMetaFileDC etc. These classes are optional.
|
||||||
// Author: Stefan Csomor
|
// Author: Stefan Csomor
|
||||||
// Modified by:
|
// Modified by:
|
||||||
@@ -24,7 +24,7 @@
|
|||||||
|
|
||||||
#include "wx/metafile.h"
|
#include "wx/metafile.h"
|
||||||
#include "wx/clipbrd.h"
|
#include "wx/clipbrd.h"
|
||||||
#include "wx/osx/uma.h"
|
#include "wx/osx/private.h"
|
||||||
#include "wx/graphics.h"
|
#include "wx/graphics.h"
|
||||||
#include "wx/osx/carbon/metafile.h"
|
#include "wx/osx/carbon/metafile.h"
|
||||||
|
|
||||||
|
@@ -1,5 +1,5 @@
|
|||||||
/////////////////////////////////////////////////////////////////////////////
|
/////////////////////////////////////////////////////////////////////////////
|
||||||
// Name: src/mac/carbon/mimetype.cpp
|
// Name: src/osx/carbon/mimetype.cpp
|
||||||
// Purpose: Mac Carbon implementation for wx MIME-related classes
|
// Purpose: Mac Carbon implementation for wx MIME-related classes
|
||||||
// Author: Ryan Norton
|
// Author: Ryan Norton
|
||||||
// Modified by:
|
// Modified by:
|
||||||
|
@@ -1,5 +1,5 @@
|
|||||||
/////////////////////////////////////////////////////////////////////////////
|
/////////////////////////////////////////////////////////////////////////////
|
||||||
// Name: src/mac/carbon/msgdlg.cpp
|
// Name: src/osx/carbon/msgdlg.cpp
|
||||||
// Purpose: wxMessageDialog
|
// Purpose: wxMessageDialog
|
||||||
// Author: Stefan Csomor
|
// Author: Stefan Csomor
|
||||||
// Modified by:
|
// Modified by:
|
||||||
|
@@ -1,5 +1,5 @@
|
|||||||
/////////////////////////////////////////////////////////////////////////////
|
/////////////////////////////////////////////////////////////////////////////
|
||||||
// Name: src/mac/carbon/nonownedwnd.cpp
|
// Name: src/osx/carbon/nonownedwnd.cpp
|
||||||
// Purpose: implementation of wxNonOwnedWindow
|
// Purpose: implementation of wxNonOwnedWindow
|
||||||
// Author: Stefan Csomor
|
// Author: Stefan Csomor
|
||||||
// Created: 2008-03-24
|
// Created: 2008-03-24
|
||||||
@@ -28,374 +28,15 @@
|
|||||||
#include "wx/sysopt.h"
|
#include "wx/sysopt.h"
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
//
|
// ============================================================================
|
||||||
// TODO BEGIN move to nonowned_osx.cpp
|
// wxNonOwnedWindow implementation
|
||||||
//
|
// ============================================================================
|
||||||
|
|
||||||
// ----------------------------------------------------------------------------
|
|
||||||
// constants
|
|
||||||
// ----------------------------------------------------------------------------
|
|
||||||
|
|
||||||
// trace mask for activation tracing messages
|
|
||||||
#define TRACE_ACTIVATE "activation"
|
|
||||||
|
|
||||||
wxWindow* g_MacLastWindow = NULL ;
|
|
||||||
|
|
||||||
// unified title and toolbar constant - not in Tiger headers, so we duplicate it here
|
// unified title and toolbar constant - not in Tiger headers, so we duplicate it here
|
||||||
#define kWindowUnifiedTitleAndToolbarAttribute (1 << 7)
|
#define kWindowUnifiedTitleAndToolbarAttribute (1 << 7)
|
||||||
|
|
||||||
// ---------------------------------------------------------------------------
|
|
||||||
// wxWindowMac utility functions
|
|
||||||
// ---------------------------------------------------------------------------
|
|
||||||
|
|
||||||
// Find an item given the Macintosh Window Reference
|
|
||||||
|
|
||||||
WX_DECLARE_HASH_MAP(WXWindow, wxNonOwnedWindow*, wxPointerHash, wxPointerEqual, MacWindowMap);
|
|
||||||
|
|
||||||
static MacWindowMap wxWinMacWindowList;
|
|
||||||
|
|
||||||
wxNonOwnedWindow *wxFindWindowFromWXWindow(WXWindow inWindowRef)
|
|
||||||
{
|
|
||||||
MacWindowMap::iterator node = wxWinMacWindowList.find(inWindowRef);
|
|
||||||
|
|
||||||
return (node == wxWinMacWindowList.end()) ? NULL : node->second;
|
|
||||||
}
|
|
||||||
|
|
||||||
void wxAssociateWindowWithWXWindow(WXWindow inWindowRef, wxNonOwnedWindow *win) ;
|
|
||||||
void wxAssociateWindowWithWXWindow(WXWindow inWindowRef, wxNonOwnedWindow *win)
|
|
||||||
{
|
|
||||||
// adding NULL WindowRef is (first) surely a result of an error and
|
|
||||||
// nothing else :-)
|
|
||||||
wxCHECK_RET( inWindowRef != (WXWindow) NULL, wxT("attempt to add a NULL WindowRef to window list") );
|
|
||||||
|
|
||||||
wxWinMacWindowList[inWindowRef] = win;
|
|
||||||
}
|
|
||||||
|
|
||||||
void wxRemoveWXWindowAssociation(wxNonOwnedWindow *win) ;
|
|
||||||
void wxRemoveWXWindowAssociation(wxNonOwnedWindow *win)
|
|
||||||
{
|
|
||||||
MacWindowMap::iterator it;
|
|
||||||
for ( it = wxWinMacWindowList.begin(); it != wxWinMacWindowList.end(); ++it )
|
|
||||||
{
|
|
||||||
if ( it->second == win )
|
|
||||||
{
|
|
||||||
wxWinMacWindowList.erase(it);
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
wxNonOwnedWindow* wxNonOwnedWindow::GetFromWXWindow( WXWindow win )
|
|
||||||
{
|
|
||||||
return wxFindWindowFromWXWindow( win );
|
|
||||||
}
|
|
||||||
|
|
||||||
// ----------------------------------------------------------------------------
|
|
||||||
// wxNonOwnedWindow creation
|
|
||||||
// ----------------------------------------------------------------------------
|
|
||||||
|
|
||||||
IMPLEMENT_ABSTRACT_CLASS( wxNonOwnedWindowImpl , wxObject )
|
|
||||||
|
|
||||||
wxNonOwnedWindow *wxNonOwnedWindow::s_macDeactivateWindow = NULL;
|
|
||||||
|
|
||||||
void wxNonOwnedWindow::Init()
|
|
||||||
{
|
|
||||||
m_nowpeer = NULL;
|
|
||||||
}
|
|
||||||
|
|
||||||
bool wxNonOwnedWindow::Create(wxWindow *parent,
|
|
||||||
wxWindowID id,
|
|
||||||
const wxPoint& pos,
|
|
||||||
const wxSize& size,
|
|
||||||
long style,
|
|
||||||
const wxString& name)
|
|
||||||
{
|
|
||||||
// init our fields
|
|
||||||
Init();
|
|
||||||
|
|
||||||
m_windowStyle = style;
|
|
||||||
|
|
||||||
SetName( name );
|
|
||||||
|
|
||||||
m_windowId = id == -1 ? NewControlId() : id;
|
|
||||||
m_windowStyle = style;
|
|
||||||
m_isShown = false;
|
|
||||||
|
|
||||||
// create frame.
|
|
||||||
int x = (int)pos.x;
|
|
||||||
int y = (int)pos.y;
|
|
||||||
|
|
||||||
wxRect display = wxGetClientDisplayRect() ;
|
|
||||||
|
|
||||||
if ( x == wxDefaultPosition.x )
|
|
||||||
x = display.x ;
|
|
||||||
|
|
||||||
if ( y == wxDefaultPosition.y )
|
|
||||||
y = display.y ;
|
|
||||||
|
|
||||||
int w = WidthDefault(size.x);
|
|
||||||
int h = HeightDefault(size.y);
|
|
||||||
|
|
||||||
// temporary define, TODO
|
|
||||||
#if wxOSX_USE_CARBON
|
|
||||||
m_nowpeer = new wxNonOwnedWindowCarbonImpl( this );
|
|
||||||
#elif wxOSX_USE_COCOA
|
|
||||||
m_nowpeer = new wxNonOwnedWindowCocoaImpl( this );
|
|
||||||
#elif wxOSX_USE_IPHONE
|
|
||||||
m_nowpeer = new wxNonOwnedWindowIPhoneImpl( this );
|
|
||||||
#endif
|
|
||||||
|
|
||||||
m_nowpeer->Create( parent, wxPoint(x,y) , wxSize(w,h) , style , GetExtraStyle(), name ) ;
|
|
||||||
wxAssociateWindowWithWXWindow( m_nowpeer->GetWXWindow() , this ) ;
|
|
||||||
#if wxOSX_USE_CARBON
|
|
||||||
// temporary cast, TODO
|
|
||||||
m_peer = (wxMacControl*) wxWidgetImpl::CreateContentView(this);
|
|
||||||
#else
|
|
||||||
m_peer = wxWidgetImpl::CreateContentView(this);
|
|
||||||
#endif
|
|
||||||
|
|
||||||
DoSetWindowVariant( m_windowVariant ) ;
|
|
||||||
|
|
||||||
wxWindowCreateEvent event(this);
|
|
||||||
HandleWindowEvent(event);
|
|
||||||
|
|
||||||
SetBackgroundColour(wxSystemSettings::GetColour( wxSYS_COLOUR_3DFACE ));
|
|
||||||
|
|
||||||
if ( parent )
|
|
||||||
parent->AddChild(this);
|
|
||||||
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
|
|
||||||
wxNonOwnedWindow::~wxNonOwnedWindow()
|
|
||||||
{
|
|
||||||
wxRemoveWXWindowAssociation( this ) ;
|
|
||||||
if ( m_nowpeer )
|
|
||||||
m_nowpeer->Destroy();
|
|
||||||
|
|
||||||
// avoid dangling refs
|
|
||||||
if ( s_macDeactivateWindow == this )
|
|
||||||
s_macDeactivateWindow = NULL;
|
|
||||||
}
|
|
||||||
|
|
||||||
// ----------------------------------------------------------------------------
|
|
||||||
// wxNonOwnedWindow misc
|
|
||||||
// ----------------------------------------------------------------------------
|
|
||||||
|
|
||||||
bool wxNonOwnedWindow::ShowWithEffect(wxShowEffect effect,
|
|
||||||
unsigned timeout )
|
|
||||||
{
|
|
||||||
if ( !wxWindow::Show(true) )
|
|
||||||
return false;
|
|
||||||
|
|
||||||
// because apps expect a size event to occur at this moment
|
|
||||||
wxSizeEvent event(GetSize() , m_windowId);
|
|
||||||
event.SetEventObject(this);
|
|
||||||
HandleWindowEvent(event);
|
|
||||||
|
|
||||||
|
|
||||||
return m_nowpeer->ShowWithEffect(true, effect, timeout);
|
|
||||||
}
|
|
||||||
|
|
||||||
bool wxNonOwnedWindow::HideWithEffect(wxShowEffect effect,
|
|
||||||
unsigned timeout )
|
|
||||||
{
|
|
||||||
if ( !wxWindow::Show(false) )
|
|
||||||
return false;
|
|
||||||
|
|
||||||
return m_nowpeer->ShowWithEffect(false, effect, timeout);
|
|
||||||
}
|
|
||||||
|
|
||||||
wxPoint wxNonOwnedWindow::GetClientAreaOrigin() const
|
|
||||||
{
|
|
||||||
int left, top, width, height;
|
|
||||||
m_nowpeer->GetContentArea(left, top, width, height);
|
|
||||||
return wxPoint(left, top);
|
|
||||||
}
|
|
||||||
|
|
||||||
bool wxNonOwnedWindow::SetBackgroundColour(const wxColour& c )
|
|
||||||
{
|
|
||||||
if ( !wxWindow::SetBackgroundColour(c) && m_hasBgCol )
|
|
||||||
return false ;
|
|
||||||
|
|
||||||
if ( GetBackgroundStyle() != wxBG_STYLE_CUSTOM )
|
|
||||||
{
|
|
||||||
return m_nowpeer->SetBackgroundColour(c);
|
|
||||||
}
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
|
|
||||||
// Raise the window to the top of the Z order
|
|
||||||
void wxNonOwnedWindow::Raise()
|
|
||||||
{
|
|
||||||
m_nowpeer->Raise();
|
|
||||||
}
|
|
||||||
|
|
||||||
// Lower the window to the bottom of the Z order
|
|
||||||
void wxNonOwnedWindow::Lower()
|
|
||||||
{
|
|
||||||
m_nowpeer->Lower();
|
|
||||||
}
|
|
||||||
|
|
||||||
void wxNonOwnedWindow::MacDelayedDeactivation(long timestamp)
|
|
||||||
{
|
|
||||||
if (s_macDeactivateWindow)
|
|
||||||
{
|
|
||||||
wxLogTrace(TRACE_ACTIVATE,
|
|
||||||
wxT("Doing delayed deactivation of %p"),
|
|
||||||
s_macDeactivateWindow);
|
|
||||||
|
|
||||||
s_macDeactivateWindow->MacActivate(timestamp, false);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
void wxNonOwnedWindow::MacActivate( long timestamp , bool WXUNUSED(inIsActivating) )
|
|
||||||
{
|
|
||||||
wxLogTrace(TRACE_ACTIVATE, wxT("TopLevel=%p::MacActivate"), this);
|
|
||||||
|
|
||||||
if (s_macDeactivateWindow == this)
|
|
||||||
s_macDeactivateWindow = NULL;
|
|
||||||
|
|
||||||
MacDelayedDeactivation(timestamp);
|
|
||||||
}
|
|
||||||
|
|
||||||
bool wxNonOwnedWindow::Show(bool show)
|
|
||||||
{
|
|
||||||
if ( !wxWindow::Show(show) )
|
|
||||||
return false;
|
|
||||||
|
|
||||||
if ( m_nowpeer )
|
|
||||||
m_nowpeer->Show(show);
|
|
||||||
|
|
||||||
if ( show )
|
|
||||||
{
|
|
||||||
// because apps expect a size event to occur at this moment
|
|
||||||
wxSizeEvent event(GetSize() , m_windowId);
|
|
||||||
event.SetEventObject(this);
|
|
||||||
HandleWindowEvent(event);
|
|
||||||
}
|
|
||||||
|
|
||||||
return true ;
|
|
||||||
}
|
|
||||||
|
|
||||||
bool wxNonOwnedWindow::SetTransparent(wxByte alpha)
|
|
||||||
{
|
|
||||||
return m_nowpeer->SetTransparent(alpha);
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
bool wxNonOwnedWindow::CanSetTransparent()
|
|
||||||
{
|
|
||||||
return m_nowpeer->CanSetTransparent();
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
void wxNonOwnedWindow::SetExtraStyle(long exStyle)
|
|
||||||
{
|
|
||||||
if ( GetExtraStyle() == exStyle )
|
|
||||||
return ;
|
|
||||||
|
|
||||||
wxWindow::SetExtraStyle( exStyle ) ;
|
|
||||||
|
|
||||||
if ( m_nowpeer )
|
|
||||||
m_nowpeer->SetExtraStyle(exStyle);
|
|
||||||
}
|
|
||||||
|
|
||||||
bool wxNonOwnedWindow::SetBackgroundStyle(wxBackgroundStyle style)
|
|
||||||
{
|
|
||||||
if ( !wxWindow::SetBackgroundStyle(style) )
|
|
||||||
return false ;
|
|
||||||
|
|
||||||
return m_nowpeer->SetBackgroundStyle(style);
|
|
||||||
}
|
|
||||||
|
|
||||||
void wxNonOwnedWindow::DoMoveWindow(int x, int y, int width, int height)
|
|
||||||
{
|
|
||||||
m_cachedClippedRectValid = false ;
|
|
||||||
|
|
||||||
m_nowpeer->MoveWindow(x, y, width, height);
|
|
||||||
wxWindowMac::MacSuperChangedPosition() ; // like this only children will be notified
|
|
||||||
}
|
|
||||||
|
|
||||||
void wxNonOwnedWindow::DoGetPosition( int *x, int *y ) const
|
|
||||||
{
|
|
||||||
int x1,y1 ;
|
|
||||||
m_nowpeer->GetPosition(x1, y1);
|
|
||||||
|
|
||||||
if (x)
|
|
||||||
*x = x1 ;
|
|
||||||
if (y)
|
|
||||||
*y = y1 ;
|
|
||||||
}
|
|
||||||
|
|
||||||
void wxNonOwnedWindow::DoGetSize( int *width, int *height ) const
|
|
||||||
{
|
|
||||||
int w,h;
|
|
||||||
|
|
||||||
m_nowpeer->GetSize(w, h);
|
|
||||||
|
|
||||||
if (width)
|
|
||||||
*width = w ;
|
|
||||||
if (height)
|
|
||||||
*height = h ;
|
|
||||||
}
|
|
||||||
|
|
||||||
void wxNonOwnedWindow::DoGetClientSize( int *width, int *height ) const
|
|
||||||
{
|
|
||||||
int left, top, w, h;
|
|
||||||
m_nowpeer->GetContentArea(left, top, w, h);
|
|
||||||
|
|
||||||
if (width)
|
|
||||||
*width = w ;
|
|
||||||
if (height)
|
|
||||||
*height = h ;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
void wxNonOwnedWindow::Update()
|
|
||||||
{
|
|
||||||
m_nowpeer->Update();
|
|
||||||
}
|
|
||||||
|
|
||||||
WXWindow wxNonOwnedWindow::GetWXWindow() const
|
|
||||||
{
|
|
||||||
return m_nowpeer ? m_nowpeer->GetWXWindow() : NULL;
|
|
||||||
}
|
|
||||||
|
|
||||||
// ---------------------------------------------------------------------------
|
|
||||||
// Shape implementation
|
|
||||||
// ---------------------------------------------------------------------------
|
|
||||||
|
|
||||||
|
|
||||||
bool wxNonOwnedWindow::SetShape(const wxRegion& region)
|
|
||||||
{
|
|
||||||
wxCHECK_MSG( HasFlag(wxFRAME_SHAPED), false,
|
|
||||||
_T("Shaped windows must be created with the wxFRAME_SHAPED style."));
|
|
||||||
|
|
||||||
// The empty region signifies that the shape
|
|
||||||
// should be removed from the window.
|
|
||||||
if ( region.IsEmpty() )
|
|
||||||
{
|
|
||||||
wxSize sz = GetClientSize();
|
|
||||||
wxRegion rgn(0, 0, sz.x, sz.y);
|
|
||||||
if ( rgn.IsEmpty() )
|
|
||||||
return false ;
|
|
||||||
else
|
|
||||||
return SetShape(rgn);
|
|
||||||
}
|
|
||||||
|
|
||||||
return m_nowpeer->SetShape(region);
|
|
||||||
}
|
|
||||||
|
|
||||||
//
|
|
||||||
// TODO END move to nonowned_osx.cpp
|
|
||||||
//
|
|
||||||
|
|
||||||
#if wxOSX_USE_CARBON
|
|
||||||
|
|
||||||
IMPLEMENT_DYNAMIC_CLASS( wxNonOwnedWindowCarbonImpl , wxNonOwnedWindowImpl )
|
IMPLEMENT_DYNAMIC_CLASS( wxNonOwnedWindowCarbonImpl , wxNonOwnedWindowImpl )
|
||||||
|
|
||||||
|
|
||||||
WXWindow wxNonOwnedWindowCarbonImpl::GetWXWindow() const
|
WXWindow wxNonOwnedWindowCarbonImpl::GetWXWindow() const
|
||||||
{
|
{
|
||||||
return (WXWindow) m_macWindow;
|
return (WXWindow) m_macWindow;
|
||||||
@@ -585,7 +226,10 @@ void wxNonOwnedWindowCarbonImpl::MacSetUnifiedAppearance( bool set )
|
|||||||
// for wx.
|
// for wx.
|
||||||
// TODO: Determine if we need this on Leopard as well. (should be harmless either way,
|
// TODO: Determine if we need this on Leopard as well. (should be harmless either way,
|
||||||
// though)
|
// though)
|
||||||
|
// since when creating the peering is not yet completely set-up we call both setters
|
||||||
|
// explicitely
|
||||||
m_wxPeer->SetBackgroundColour( wxSystemSettings::GetColour(wxSYS_COLOUR_WINDOW) ) ;
|
m_wxPeer->SetBackgroundColour( wxSystemSettings::GetColour(wxSYS_COLOUR_WINDOW) ) ;
|
||||||
|
SetBackgroundColour( wxSystemSettings::GetColour(wxSYS_COLOUR_WINDOW) ) ;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@@ -595,12 +239,6 @@ void wxNonOwnedWindowCarbonImpl::MacSetUnifiedAppearance( bool set )
|
|||||||
|
|
||||||
static pascal long wxShapedMacWindowDef(short varCode, WindowRef window, SInt16 message, SInt32 param);
|
static pascal long wxShapedMacWindowDef(short varCode, WindowRef window, SInt16 message, SInt32 param);
|
||||||
|
|
||||||
// ============================================================================
|
|
||||||
// wxNonOwnedWindow implementation
|
|
||||||
// ============================================================================
|
|
||||||
|
|
||||||
// unified title and toolbar constant - not in Tiger headers, so we duplicate it here
|
|
||||||
#define kWindowUnifiedTitleAndToolbarAttribute (1 << 7)
|
|
||||||
|
|
||||||
// ---------------------------------------------------------------------------
|
// ---------------------------------------------------------------------------
|
||||||
// Carbon Events
|
// Carbon Events
|
||||||
@@ -1037,6 +675,18 @@ wxMacTopLevelMouseEventHandler(EventHandlerCallRef WXUNUSED(handler),
|
|||||||
result = noErr ;
|
result = noErr ;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
else if ( window && windowPart == inProxyIcon )
|
||||||
|
{
|
||||||
|
// special case proxy icon bar, as we are having a low-level runloop we must do it ourselves
|
||||||
|
if ( cEvent.GetKind() == kEventMouseDown )
|
||||||
|
{
|
||||||
|
if ( ::TrackWindowProxyDrag( window, screenMouseLocation ) != errUserWantsToDragWindow )
|
||||||
|
{
|
||||||
|
// TODO Track change of file path and report back
|
||||||
|
result = noErr ;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
else if ( currentMouseWindow )
|
else if ( currentMouseWindow )
|
||||||
{
|
{
|
||||||
wxWindow *currentMouseWindowParent = currentMouseWindow->GetParent();
|
wxWindow *currentMouseWindowParent = currentMouseWindow->GetParent();
|
||||||
@@ -1138,22 +788,14 @@ wxNonOwnedWindowEventHandler(EventHandlerCallRef WXUNUSED(handler),
|
|||||||
{
|
{
|
||||||
case kEventWindowActivated :
|
case kEventWindowActivated :
|
||||||
{
|
{
|
||||||
toplevelWindow->MacActivate( cEvent.GetTicks() , true) ;
|
toplevelWindow->HandleActivated( cEvent.GetTicks() , true) ;
|
||||||
wxActivateEvent wxevent(wxEVT_ACTIVATE, true , toplevelWindow->GetId());
|
|
||||||
wxevent.SetTimestamp( cEvent.GetTicks() ) ;
|
|
||||||
wxevent.SetEventObject(toplevelWindow);
|
|
||||||
toplevelWindow->HandleWindowEvent(wxevent);
|
|
||||||
// we still sending an eventNotHandledErr in order to allow for default processing
|
// we still sending an eventNotHandledErr in order to allow for default processing
|
||||||
}
|
}
|
||||||
break ;
|
break ;
|
||||||
|
|
||||||
case kEventWindowDeactivated :
|
case kEventWindowDeactivated :
|
||||||
{
|
{
|
||||||
toplevelWindow->MacActivate(cEvent.GetTicks() , false) ;
|
toplevelWindow->HandleActivated( cEvent.GetTicks() , false) ;
|
||||||
wxActivateEvent wxevent(wxEVT_ACTIVATE, false , toplevelWindow->GetId());
|
|
||||||
wxevent.SetTimestamp( cEvent.GetTicks() ) ;
|
|
||||||
wxevent.SetEventObject(toplevelWindow);
|
|
||||||
toplevelWindow->HandleWindowEvent(wxevent);
|
|
||||||
// we still sending an eventNotHandledErr in order to allow for default processing
|
// we still sending an eventNotHandledErr in order to allow for default processing
|
||||||
}
|
}
|
||||||
break ;
|
break ;
|
||||||
@@ -1175,27 +817,12 @@ wxNonOwnedWindowEventHandler(EventHandlerCallRef WXUNUSED(handler),
|
|||||||
wxRect r( newRect.left , newRect.top , newRect.right - newRect.left , newRect.bottom - newRect.top ) ;
|
wxRect r( newRect.left , newRect.top , newRect.right - newRect.left , newRect.bottom - newRect.top ) ;
|
||||||
if ( attributes & kWindowBoundsChangeSizeChanged )
|
if ( attributes & kWindowBoundsChangeSizeChanged )
|
||||||
{
|
{
|
||||||
#ifndef __WXUNIVERSAL__
|
toplevelWindow->HandleResized(cEvent.GetTicks() ) ;
|
||||||
// according to the other ports we handle this within the OS level
|
|
||||||
// resize event, not within a wxSizeEvent
|
|
||||||
wxFrame *frame = wxDynamicCast( toplevelWindow , wxFrame ) ;
|
|
||||||
if ( frame )
|
|
||||||
{
|
|
||||||
frame->PositionBars();
|
|
||||||
}
|
|
||||||
#endif
|
|
||||||
wxSizeEvent event( r.GetSize() , toplevelWindow->GetId() ) ;
|
|
||||||
event.SetEventObject( toplevelWindow ) ;
|
|
||||||
|
|
||||||
toplevelWindow->HandleWindowEvent(event) ;
|
|
||||||
toplevelWindow->wxWindowMac::MacSuperChangedPosition() ; // like this only children will be notified
|
|
||||||
}
|
}
|
||||||
|
|
||||||
if ( attributes & kWindowBoundsChangeOriginChanged )
|
if ( attributes & kWindowBoundsChangeOriginChanged )
|
||||||
{
|
{
|
||||||
wxMoveEvent event( r.GetLeftTop() , toplevelWindow->GetId() ) ;
|
toplevelWindow->HandleMoved(cEvent.GetTicks() ) ;
|
||||||
event.SetEventObject( toplevelWindow ) ;
|
|
||||||
toplevelWindow->HandleWindowEvent(event) ;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
result = noErr ;
|
result = noErr ;
|
||||||
@@ -1214,31 +841,17 @@ wxNonOwnedWindowEventHandler(EventHandlerCallRef WXUNUSED(handler),
|
|||||||
|
|
||||||
toplevelWindow->GetNonOwnedPeer()->GetContentArea(left, top, right, bottom);
|
toplevelWindow->GetNonOwnedPeer()->GetContentArea(left, top, right, bottom);
|
||||||
|
|
||||||
wxRect r(
|
wxRect adjustR(
|
||||||
newRect.left - left,
|
newRect.left - left,
|
||||||
newRect.top - top,
|
newRect.top - top,
|
||||||
newRect.right - newRect.left + left + right,
|
newRect.right - newRect.left + left + right,
|
||||||
newRect.bottom - newRect.top + top + bottom ) ;
|
newRect.bottom - newRect.top + top + bottom ) ;
|
||||||
|
|
||||||
// this is a EVT_SIZING not a EVT_SIZE type !
|
toplevelWindow->HandleResizing( cEvent.GetTicks(), &adjustR );
|
||||||
wxSizeEvent wxevent( r , toplevelWindow->GetId() ) ;
|
|
||||||
wxevent.SetEventObject( toplevelWindow ) ;
|
|
||||||
wxRect adjustR = r ;
|
|
||||||
if ( toplevelWindow->HandleWindowEvent(wxevent) )
|
|
||||||
adjustR = wxevent.GetRect() ;
|
|
||||||
|
|
||||||
if ( toplevelWindow->GetMaxWidth() != -1 && adjustR.GetWidth() > toplevelWindow->GetMaxWidth() )
|
|
||||||
adjustR.SetWidth( toplevelWindow->GetMaxWidth() ) ;
|
|
||||||
if ( toplevelWindow->GetMaxHeight() != -1 && adjustR.GetHeight() > toplevelWindow->GetMaxHeight() )
|
|
||||||
adjustR.SetHeight( toplevelWindow->GetMaxHeight() ) ;
|
|
||||||
if ( toplevelWindow->GetMinWidth() != -1 && adjustR.GetWidth() < toplevelWindow->GetMinWidth() )
|
|
||||||
adjustR.SetWidth( toplevelWindow->GetMinWidth() ) ;
|
|
||||||
if ( toplevelWindow->GetMinHeight() != -1 && adjustR.GetHeight() < toplevelWindow->GetMinHeight() )
|
|
||||||
adjustR.SetHeight( toplevelWindow->GetMinHeight() ) ;
|
|
||||||
const Rect adjustedRect = { adjustR.y + top , adjustR.x + left , adjustR.y + adjustR.height - bottom , adjustR.x + adjustR.width - right } ;
|
const Rect adjustedRect = { adjustR.y + top , adjustR.x + left , adjustR.y + adjustR.height - bottom , adjustR.x + adjustR.width - right } ;
|
||||||
if ( !EqualRect( &newRect , &adjustedRect ) )
|
if ( !EqualRect( &newRect , &adjustedRect ) )
|
||||||
cEvent.SetParameter<Rect>( kEventParamCurrentBounds , &adjustedRect ) ;
|
cEvent.SetParameter<Rect>( kEventParamCurrentBounds , &adjustedRect ) ;
|
||||||
toplevelWindow->wxWindowMac::MacSuperChangedPosition() ; // like this only children will be notified
|
|
||||||
}
|
}
|
||||||
|
|
||||||
result = noErr ;
|
result = noErr ;
|
||||||
@@ -1292,7 +905,12 @@ pascal OSStatus wxNonOwnedEventHandler( EventHandlerCallRef handler , EventRef e
|
|||||||
switch ( GetEventClass( event ) )
|
switch ( GetEventClass( event ) )
|
||||||
{
|
{
|
||||||
case kEventClassTextInput :
|
case kEventClassTextInput :
|
||||||
result = wxMacUnicodeTextEventHandler( handler, event , data ) ;
|
{
|
||||||
|
// TODO remove as soon as all events are on implementation classes only
|
||||||
|
wxNonOwnedWindow* toplevelWindow = data ? ((wxNonOwnedWindowImpl*) data)->GetWXPeer() : NULL;
|
||||||
|
|
||||||
|
result = wxMacUnicodeTextEventHandler( handler, event , toplevelWindow ) ;
|
||||||
|
}
|
||||||
break ;
|
break ;
|
||||||
|
|
||||||
case kEventClassKeyboard :
|
case kEventClassKeyboard :
|
||||||
@@ -1498,6 +1116,12 @@ wxNonOwnedWindowCarbonImpl::~wxNonOwnedWindowCarbonImpl()
|
|||||||
|
|
||||||
void wxNonOwnedWindowCarbonImpl::Destroy()
|
void wxNonOwnedWindowCarbonImpl::Destroy()
|
||||||
{
|
{
|
||||||
|
if ( m_macEventHandler )
|
||||||
|
{
|
||||||
|
::RemoveEventHandler((EventHandlerRef) m_macEventHandler);
|
||||||
|
m_macEventHandler = NULL ;
|
||||||
|
}
|
||||||
|
|
||||||
wxPendingDelete.Append( new wxDeferredObjectDeleter( this ) ) ;
|
wxPendingDelete.Append( new wxDeferredObjectDeleter( this ) ) ;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -2014,4 +1638,11 @@ void wxNonOwnedWindowCarbonImpl::WindowToScreen( int *x, int *y )
|
|||||||
if ( y )
|
if ( y )
|
||||||
*y = p.y;
|
*y = p.y;
|
||||||
}
|
}
|
||||||
#endif // wxOSX_USE_CARBON
|
|
||||||
|
wxNonOwnedWindowImpl* wxNonOwnedWindowImpl::CreateNonOwnedWindow( wxNonOwnedWindow* wxpeer, wxWindow* parent, const wxPoint& pos, const wxSize& size,
|
||||||
|
long style, long extraStyle, const wxString& name )
|
||||||
|
{
|
||||||
|
wxNonOwnedWindowImpl* now = new wxNonOwnedWindowCarbonImpl( wxpeer );
|
||||||
|
now->Create( parent, pos, size, style , extraStyle, name );
|
||||||
|
return now;
|
||||||
|
}
|
||||||
|
@@ -1,5 +1,5 @@
|
|||||||
///////////////////////////////////////////////////////////////////////////////
|
///////////////////////////////////////////////////////////////////////////////
|
||||||
// Name: src/mac/carbon/notebmac.cpp
|
// Name: src/osx/carbon/notebmac.cpp
|
||||||
// Purpose: implementation of wxNotebook
|
// Purpose: implementation of wxNotebook
|
||||||
// Author: Stefan Csomor
|
// Author: Stefan Csomor
|
||||||
// Modified by:
|
// Modified by:
|
||||||
@@ -24,64 +24,21 @@
|
|||||||
|
|
||||||
#include "wx/string.h"
|
#include "wx/string.h"
|
||||||
#include "wx/imaglist.h"
|
#include "wx/imaglist.h"
|
||||||
#include "wx/osx/uma.h"
|
#include "wx/osx/private.h"
|
||||||
|
|
||||||
|
|
||||||
// check that the page index is valid
|
// check that the page index is valid
|
||||||
#define IS_VALID_PAGE(nPage) ((nPage) < GetPageCount())
|
#define IS_VALID_PAGE(nPage) ((nPage) < GetPageCount())
|
||||||
|
|
||||||
BEGIN_EVENT_TABLE(wxNotebook, wxBookCtrlBase)
|
wxWidgetImplType* wxWidgetImpl::CreateTabView( wxWindowMac* wxpeer,
|
||||||
EVT_NOTEBOOK_PAGE_CHANGED(wxID_ANY, wxNotebook::OnSelChange)
|
wxWindowMac* parent,
|
||||||
|
wxWindowID id,
|
||||||
EVT_SIZE(wxNotebook::OnSize)
|
const wxPoint& pos,
|
||||||
EVT_SET_FOCUS(wxNotebook::OnSetFocus)
|
const wxSize& size,
|
||||||
EVT_NAVIGATION_KEY(wxNotebook::OnNavigationKey)
|
long style,
|
||||||
END_EVENT_TABLE()
|
long extraStyle)
|
||||||
|
|
||||||
IMPLEMENT_DYNAMIC_CLASS(wxNotebook, wxBookCtrlBase)
|
|
||||||
|
|
||||||
|
|
||||||
// common part of all ctors
|
|
||||||
void wxNotebook::Init()
|
|
||||||
{
|
{
|
||||||
m_nSelection = -1;
|
Rect bounds = wxMacGetBoundsForControl( wxpeer, pos, size );
|
||||||
}
|
|
||||||
|
|
||||||
// default for dynamic class
|
|
||||||
wxNotebook::wxNotebook()
|
|
||||||
{
|
|
||||||
Init();
|
|
||||||
}
|
|
||||||
|
|
||||||
// the same arguments as for wxControl
|
|
||||||
wxNotebook::wxNotebook( wxWindow *parent,
|
|
||||||
wxWindowID id,
|
|
||||||
const wxPoint& pos,
|
|
||||||
const wxSize& size,
|
|
||||||
long style,
|
|
||||||
const wxString& name )
|
|
||||||
{
|
|
||||||
Init();
|
|
||||||
|
|
||||||
Create( parent, id, pos, size, style, name );
|
|
||||||
}
|
|
||||||
|
|
||||||
bool wxNotebook::Create( wxWindow *parent,
|
|
||||||
wxWindowID id,
|
|
||||||
const wxPoint& pos,
|
|
||||||
const wxSize& size,
|
|
||||||
long style,
|
|
||||||
const wxString& name )
|
|
||||||
{
|
|
||||||
m_macIsUserPane = false ;
|
|
||||||
|
|
||||||
if (! (style & wxBK_ALIGN_MASK))
|
|
||||||
style |= wxBK_TOP;
|
|
||||||
|
|
||||||
if ( !wxNotebookBase::Create( parent, id, pos, size, style, name ) )
|
|
||||||
return false;
|
|
||||||
|
|
||||||
Rect bounds = wxMacGetBoundsForControl( this, pos, size );
|
|
||||||
|
|
||||||
if ( bounds.right <= bounds.left )
|
if ( bounds.right <= bounds.left )
|
||||||
bounds.right = bounds.left + 100;
|
bounds.right = bounds.left + 100;
|
||||||
@@ -89,15 +46,15 @@ bool wxNotebook::Create( wxWindow *parent,
|
|||||||
bounds.bottom = bounds.top + 100;
|
bounds.bottom = bounds.top + 100;
|
||||||
|
|
||||||
UInt16 tabstyle = kControlTabDirectionNorth;
|
UInt16 tabstyle = kControlTabDirectionNorth;
|
||||||
if ( HasFlag(wxBK_LEFT) )
|
if ( style & wxBK_LEFT )
|
||||||
tabstyle = kControlTabDirectionWest;
|
tabstyle = kControlTabDirectionWest;
|
||||||
else if ( HasFlag( wxBK_RIGHT ) )
|
else if ( style & wxBK_RIGHT )
|
||||||
tabstyle = kControlTabDirectionEast;
|
tabstyle = kControlTabDirectionEast;
|
||||||
else if ( HasFlag( wxBK_BOTTOM ) )
|
else if ( style & wxBK_BOTTOM )
|
||||||
tabstyle = kControlTabDirectionSouth;
|
tabstyle = kControlTabDirectionSouth;
|
||||||
|
|
||||||
ControlTabSize tabsize;
|
ControlTabSize tabsize;
|
||||||
switch (GetWindowVariant())
|
switch (wxpeer->GetWindowVariant())
|
||||||
{
|
{
|
||||||
case wxWINDOW_VARIANT_MINI:
|
case wxWINDOW_VARIANT_MINI:
|
||||||
tabsize = 3 ;
|
tabsize = 3 ;
|
||||||
@@ -112,211 +69,20 @@ bool wxNotebook::Create( wxWindow *parent,
|
|||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
m_peer = new wxMacControl( this );
|
wxMacControl* peer = new wxMacControl( wxpeer );
|
||||||
OSStatus err = CreateTabsControl(
|
OSStatus err = CreateTabsControl(
|
||||||
MAC_WXHWND(parent->MacGetTopLevelWindowRef()), &bounds,
|
MAC_WXHWND(parent->MacGetTopLevelWindowRef()), &bounds,
|
||||||
tabsize, tabstyle, 0, NULL, m_peer->GetControlRefAddr() );
|
tabsize, tabstyle, 0, NULL, peer->GetControlRefAddr() );
|
||||||
verify_noerr( err );
|
verify_noerr( err );
|
||||||
|
|
||||||
MacPostControlCreate( pos, size );
|
return peer;
|
||||||
|
|
||||||
return true ;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// dtor
|
|
||||||
wxNotebook::~wxNotebook()
|
|
||||||
{
|
|
||||||
}
|
|
||||||
|
|
||||||
// ----------------------------------------------------------------------------
|
|
||||||
// wxNotebook accessors
|
|
||||||
// ----------------------------------------------------------------------------
|
|
||||||
|
|
||||||
void wxNotebook::SetPadding(const wxSize& WXUNUSED(padding))
|
|
||||||
{
|
|
||||||
// unsupported by OS
|
|
||||||
}
|
|
||||||
|
|
||||||
void wxNotebook::SetTabSize(const wxSize& WXUNUSED(sz))
|
|
||||||
{
|
|
||||||
// unsupported by OS
|
|
||||||
}
|
|
||||||
|
|
||||||
void wxNotebook::SetPageSize(const wxSize& size)
|
|
||||||
{
|
|
||||||
SetSize( CalcSizeFromPage( size ) );
|
|
||||||
}
|
|
||||||
|
|
||||||
wxSize wxNotebook::CalcSizeFromPage(const wxSize& sizePage) const
|
|
||||||
{
|
|
||||||
return DoGetSizeFromClientSize( sizePage );
|
|
||||||
}
|
|
||||||
|
|
||||||
int wxNotebook::DoSetSelection(size_t nPage, int flags)
|
|
||||||
{
|
|
||||||
wxCHECK_MSG( IS_VALID_PAGE(nPage), wxNOT_FOUND, wxT("DoSetSelection: invalid notebook page") );
|
|
||||||
|
|
||||||
if ( m_nSelection == wxNOT_FOUND || nPage != (size_t)m_nSelection )
|
|
||||||
{
|
|
||||||
if ( flags & SetSelection_SendEvent )
|
|
||||||
{
|
|
||||||
if ( !SendPageChangingEvent(nPage) )
|
|
||||||
{
|
|
||||||
// vetoed by program
|
|
||||||
return m_nSelection;
|
|
||||||
}
|
|
||||||
//else: program allows the page change
|
|
||||||
|
|
||||||
SendPageChangedEvent(m_nSelection, nPage);
|
|
||||||
}
|
|
||||||
|
|
||||||
ChangePage(m_nSelection, nPage);
|
|
||||||
}
|
|
||||||
//else: no change
|
|
||||||
|
|
||||||
return m_nSelection;
|
|
||||||
}
|
|
||||||
|
|
||||||
bool wxNotebook::SetPageText(size_t nPage, const wxString& strText)
|
|
||||||
{
|
|
||||||
wxCHECK_MSG( IS_VALID_PAGE(nPage), false, wxT("SetPageText: invalid notebook page") );
|
|
||||||
|
|
||||||
wxNotebookPage *page = m_pages[nPage];
|
|
||||||
page->SetLabel(wxStripMenuCodes(strText));
|
|
||||||
MacSetupTabs();
|
|
||||||
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
|
|
||||||
wxString wxNotebook::GetPageText(size_t nPage) const
|
|
||||||
{
|
|
||||||
wxCHECK_MSG( IS_VALID_PAGE(nPage), wxEmptyString, wxT("GetPageText: invalid notebook page") );
|
|
||||||
|
|
||||||
wxNotebookPage *page = m_pages[nPage];
|
|
||||||
|
|
||||||
return page->GetLabel();
|
|
||||||
}
|
|
||||||
|
|
||||||
int wxNotebook::GetPageImage(size_t nPage) const
|
|
||||||
{
|
|
||||||
wxCHECK_MSG( IS_VALID_PAGE(nPage), wxNOT_FOUND, wxT("GetPageImage: invalid notebook page") );
|
|
||||||
|
|
||||||
return m_images[nPage];
|
|
||||||
}
|
|
||||||
|
|
||||||
bool wxNotebook::SetPageImage(size_t nPage, int nImage)
|
|
||||||
{
|
|
||||||
wxCHECK_MSG( IS_VALID_PAGE(nPage), false,
|
|
||||||
wxT("SetPageImage: invalid notebook page") );
|
|
||||||
wxCHECK_MSG( m_imageList && nImage < m_imageList->GetImageCount(), false,
|
|
||||||
wxT("SetPageImage: invalid image index") );
|
|
||||||
|
|
||||||
if ( nImage != m_images[nPage] )
|
|
||||||
{
|
|
||||||
// if the item didn't have an icon before or, on the contrary, did have
|
|
||||||
// it but has lost it now, its size will change - but if the icon just
|
|
||||||
// changes, it won't
|
|
||||||
m_images[nPage] = nImage;
|
|
||||||
|
|
||||||
MacSetupTabs() ;
|
|
||||||
}
|
|
||||||
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
|
|
||||||
// ----------------------------------------------------------------------------
|
|
||||||
// wxNotebook operations
|
|
||||||
// ----------------------------------------------------------------------------
|
|
||||||
|
|
||||||
// remove one page from the notebook, without deleting the window
|
|
||||||
wxNotebookPage* wxNotebook::DoRemovePage(size_t nPage)
|
|
||||||
{
|
|
||||||
wxCHECK_MSG( IS_VALID_PAGE(nPage), NULL,
|
|
||||||
wxT("DoRemovePage: invalid notebook page") );
|
|
||||||
|
|
||||||
wxNotebookPage* page = m_pages[nPage] ;
|
|
||||||
m_pages.RemoveAt(nPage);
|
|
||||||
|
|
||||||
MacSetupTabs();
|
|
||||||
|
|
||||||
if (m_nSelection >= (int)GetPageCount())
|
|
||||||
m_nSelection = GetPageCount() - 1;
|
|
||||||
|
|
||||||
if (m_nSelection >= 0)
|
|
||||||
m_pages[m_nSelection]->Show(true);
|
|
||||||
|
|
||||||
InvalidateBestSize();
|
|
||||||
|
|
||||||
return page;
|
|
||||||
}
|
|
||||||
|
|
||||||
// remove all pages
|
|
||||||
bool wxNotebook::DeleteAllPages()
|
|
||||||
{
|
|
||||||
WX_CLEAR_ARRAY(m_pages) ;
|
|
||||||
MacSetupTabs();
|
|
||||||
m_nSelection = -1 ;
|
|
||||||
InvalidateBestSize();
|
|
||||||
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
|
|
||||||
// same as AddPage() but does it at given position
|
|
||||||
bool wxNotebook::InsertPage(size_t nPage,
|
|
||||||
wxNotebookPage *pPage,
|
|
||||||
const wxString& strText,
|
|
||||||
bool bSelect,
|
|
||||||
int imageId )
|
|
||||||
{
|
|
||||||
if ( !wxNotebookBase::InsertPage( nPage, pPage, strText, bSelect, imageId ) )
|
|
||||||
return false;
|
|
||||||
|
|
||||||
wxASSERT_MSG( pPage->GetParent() == this, wxT("notebook pages must have notebook as parent") );
|
|
||||||
|
|
||||||
// don't show pages by default (we'll need to adjust their size first)
|
|
||||||
pPage->Show( false ) ;
|
|
||||||
|
|
||||||
pPage->SetLabel( wxStripMenuCodes(strText) );
|
|
||||||
|
|
||||||
m_images.Insert( imageId, nPage );
|
|
||||||
|
|
||||||
MacSetupTabs();
|
|
||||||
|
|
||||||
wxRect rect = GetPageRect() ;
|
|
||||||
pPage->SetSize( rect );
|
|
||||||
if ( pPage->GetAutoLayout() )
|
|
||||||
pPage->Layout();
|
|
||||||
|
|
||||||
// now deal with the selection
|
|
||||||
// ---------------------------
|
|
||||||
|
|
||||||
// if the inserted page is before the selected one, we must update the
|
|
||||||
// index of the selected page
|
|
||||||
|
|
||||||
if ( int(nPage) <= m_nSelection )
|
|
||||||
{
|
|
||||||
m_nSelection++;
|
|
||||||
|
|
||||||
// while this still is the same page showing, we need to update the tabs
|
|
||||||
m_peer->SetValue( m_nSelection + 1 ) ;
|
|
||||||
}
|
|
||||||
|
|
||||||
// some page should be selected: either this one or the first one if there
|
|
||||||
// is still no selection
|
|
||||||
int selNew = -1;
|
|
||||||
if ( bSelect )
|
|
||||||
selNew = nPage;
|
|
||||||
else if ( m_nSelection == -1 )
|
|
||||||
selNew = 0;
|
|
||||||
|
|
||||||
if ( selNew != -1 )
|
|
||||||
SetSelection( selNew );
|
|
||||||
|
|
||||||
InvalidateBestSize();
|
|
||||||
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
/*
|
||||||
int wxNotebook::HitTest(const wxPoint& pt, long * flags) const
|
int wxNotebook::HitTest(const wxPoint& pt, long * flags) const
|
||||||
{
|
{
|
||||||
int resultV = wxNOT_FOUND;
|
int resultV = wxNOT_FOUND;
|
||||||
@@ -375,39 +141,41 @@ int wxNotebook::HitTest(const wxPoint& pt, long * flags) const
|
|||||||
|
|
||||||
return resultV;
|
return resultV;
|
||||||
}
|
}
|
||||||
|
*/
|
||||||
|
|
||||||
// Added by Mark Newsam
|
// Added by Mark Newsam
|
||||||
// When a page is added or deleted to the notebook this function updates
|
// When a page is added or deleted to the notebook this function updates
|
||||||
// information held in the control so that it matches the order
|
// information held in the control so that it matches the order
|
||||||
// the user would expect.
|
// the user would expect.
|
||||||
//
|
//
|
||||||
void wxNotebook::MacSetupTabs()
|
|
||||||
|
void wxMacControl::SetupTabs( const wxNotebook& notebook)
|
||||||
{
|
{
|
||||||
m_peer->SetMaximum( GetPageCount() ) ;
|
const size_t countPages = notebook.GetPageCount();
|
||||||
|
SetMaximum( countPages ) ;
|
||||||
|
|
||||||
wxNotebookPage *page;
|
wxNotebookPage *page;
|
||||||
ControlTabInfoRecV1 info;
|
ControlTabInfoRecV1 info;
|
||||||
|
|
||||||
const size_t countPages = GetPageCount();
|
|
||||||
for (size_t ii = 0; ii < countPages; ii++)
|
for (size_t ii = 0; ii < countPages; ii++)
|
||||||
{
|
{
|
||||||
page = m_pages[ii];
|
page = (wxNotebookPage*) notebook.GetPage(ii);
|
||||||
info.version = kControlTabInfoVersionOne;
|
info.version = kControlTabInfoVersionOne;
|
||||||
info.iconSuiteID = 0;
|
info.iconSuiteID = 0;
|
||||||
wxCFStringRef cflabel( page->GetLabel(), GetFont().GetEncoding() ) ;
|
wxCFStringRef cflabel( page->GetLabel(), page->GetFont().GetEncoding() ) ;
|
||||||
info.name = cflabel ;
|
info.name = cflabel ;
|
||||||
m_peer->SetData<ControlTabInfoRecV1>( ii + 1, kControlTabInfoTag, &info ) ;
|
SetData<ControlTabInfoRecV1>( ii + 1, kControlTabInfoTag, &info ) ;
|
||||||
|
|
||||||
if ( GetImageList() && GetPageImage(ii) >= 0 )
|
if ( notebook.GetImageList() && notebook.GetPageImage(ii) >= 0 )
|
||||||
{
|
{
|
||||||
const wxBitmap bmap = GetImageList()->GetBitmap( GetPageImage( ii ) ) ;
|
const wxBitmap bmap = notebook.GetImageList()->GetBitmap( notebook.GetPageImage( ii ) ) ;
|
||||||
if ( bmap.Ok() )
|
if ( bmap.Ok() )
|
||||||
{
|
{
|
||||||
ControlButtonContentInfo info ;
|
ControlButtonContentInfo info ;
|
||||||
|
|
||||||
wxMacCreateBitmapButton( &info, bmap ) ;
|
wxMacCreateBitmapButton( &info, bmap ) ;
|
||||||
|
|
||||||
OSStatus err = m_peer->SetData<ControlButtonContentInfo>( ii + 1, kControlTabImageContentTag, &info );
|
OSStatus err = SetData<ControlButtonContentInfo>( ii + 1, kControlTabImageContentTag, &info );
|
||||||
if ( err != noErr )
|
if ( err != noErr )
|
||||||
{
|
{
|
||||||
wxFAIL_MSG("Error when setting icon on tab");
|
wxFAIL_MSG("Error when setting icon on tab");
|
||||||
@@ -416,201 +184,8 @@ void wxNotebook::MacSetupTabs()
|
|||||||
wxMacReleaseBitmapButton( &info ) ;
|
wxMacReleaseBitmapButton( &info ) ;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
SetTabEnabled( ii + 1, true ) ;
|
||||||
m_peer->SetTabEnabled( ii + 1, true ) ;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
Refresh();
|
|
||||||
}
|
|
||||||
|
|
||||||
wxRect wxNotebook::GetPageRect() const
|
|
||||||
{
|
|
||||||
wxSize size = GetClientSize() ;
|
|
||||||
|
|
||||||
return wxRect( 0 , 0 , size.x , size.y ) ;
|
|
||||||
}
|
|
||||||
|
|
||||||
// ----------------------------------------------------------------------------
|
|
||||||
// wxNotebook callbacks
|
|
||||||
// ----------------------------------------------------------------------------
|
|
||||||
|
|
||||||
// @@@ OnSize() is used for setting the font when it's called for the first
|
|
||||||
// time because doing it in ::Create() doesn't work (for unknown reasons)
|
|
||||||
void wxNotebook::OnSize(wxSizeEvent& event)
|
|
||||||
{
|
|
||||||
unsigned int nCount = m_pages.Count();
|
|
||||||
wxRect rect = GetPageRect() ;
|
|
||||||
|
|
||||||
for ( unsigned int nPage = 0; nPage < nCount; nPage++ )
|
|
||||||
{
|
|
||||||
wxNotebookPage *pPage = m_pages[nPage];
|
|
||||||
pPage->SetSize(rect);
|
|
||||||
if ( pPage->GetAutoLayout() )
|
|
||||||
pPage->Layout();
|
|
||||||
}
|
|
||||||
|
|
||||||
// Processing continues to next OnSize
|
|
||||||
event.Skip();
|
|
||||||
}
|
|
||||||
|
|
||||||
void wxNotebook::OnSelChange(wxBookCtrlEvent& event)
|
|
||||||
{
|
|
||||||
// is it our tab control?
|
|
||||||
if ( event.GetEventObject() == this )
|
|
||||||
ChangePage(event.GetOldSelection(), event.GetSelection());
|
|
||||||
|
|
||||||
// we want to give others a chance to process this message as well
|
|
||||||
event.Skip();
|
|
||||||
}
|
|
||||||
|
|
||||||
void wxNotebook::OnSetFocus(wxFocusEvent& event)
|
|
||||||
{
|
|
||||||
// set focus to the currently selected page if any
|
|
||||||
if ( m_nSelection != -1 )
|
|
||||||
m_pages[m_nSelection]->SetFocus();
|
|
||||||
|
|
||||||
event.Skip();
|
|
||||||
}
|
|
||||||
|
|
||||||
void wxNotebook::OnNavigationKey(wxNavigationKeyEvent& event)
|
|
||||||
{
|
|
||||||
if ( event.IsWindowChange() )
|
|
||||||
{
|
|
||||||
// change pages
|
|
||||||
AdvanceSelection( event.GetDirection() );
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
// we get this event in 2 cases
|
|
||||||
//
|
|
||||||
// a) one of our pages might have generated it because the user TABbed
|
|
||||||
// out from it in which case we should propagate the event upwards and
|
|
||||||
// our parent will take care of setting the focus to prev/next sibling
|
|
||||||
//
|
|
||||||
// or
|
|
||||||
//
|
|
||||||
// b) the parent panel wants to give the focus to us so that we
|
|
||||||
// forward it to our selected page. We can't deal with this in
|
|
||||||
// OnSetFocus() because we don't know which direction the focus came
|
|
||||||
// from in this case and so can't choose between setting the focus to
|
|
||||||
// first or last panel child
|
|
||||||
wxWindow *parent = GetParent();
|
|
||||||
|
|
||||||
// the cast is here to fix a GCC ICE
|
|
||||||
if ( ((wxWindow*)event.GetEventObject()) == parent )
|
|
||||||
{
|
|
||||||
// no, it doesn't come from child, case (b): forward to a page
|
|
||||||
if ( m_nSelection != -1 )
|
|
||||||
{
|
|
||||||
// so that the page knows that the event comes from it's parent
|
|
||||||
// and is being propagated downwards
|
|
||||||
event.SetEventObject( this );
|
|
||||||
|
|
||||||
wxWindow *page = m_pages[m_nSelection];
|
|
||||||
if ( !page->HandleWindowEvent( event ) )
|
|
||||||
{
|
|
||||||
page->SetFocus();
|
|
||||||
}
|
|
||||||
//else: page manages focus inside it itself
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
// we have no pages - still have to give focus to _something_
|
|
||||||
SetFocus();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
// it comes from our child, case (a), pass to the parent
|
|
||||||
if ( parent )
|
|
||||||
{
|
|
||||||
event.SetCurrentFocus( this );
|
|
||||||
parent->HandleWindowEvent( event );
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
// ----------------------------------------------------------------------------
|
|
||||||
// wxNotebook base class virtuals
|
|
||||||
// ----------------------------------------------------------------------------
|
|
||||||
|
|
||||||
#if wxUSE_CONSTRAINTS
|
|
||||||
|
|
||||||
// override these 2 functions to do nothing: everything is done in OnSize
|
|
||||||
|
|
||||||
void wxNotebook::SetConstraintSizes(bool WXUNUSED(recurse))
|
|
||||||
{
|
|
||||||
// don't set the sizes of the pages - their correct size is not yet known
|
|
||||||
wxControl::SetConstraintSizes( false );
|
|
||||||
}
|
|
||||||
|
|
||||||
bool wxNotebook::DoPhase(int WXUNUSED(nPhase))
|
|
||||||
{
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
|
|
||||||
#endif // wxUSE_CONSTRAINTS
|
|
||||||
|
|
||||||
void wxNotebook::Command(wxCommandEvent& WXUNUSED(event))
|
|
||||||
{
|
|
||||||
wxFAIL_MSG(wxT("wxNotebook::Command not implemented"));
|
|
||||||
}
|
|
||||||
|
|
||||||
// ----------------------------------------------------------------------------
|
|
||||||
// wxNotebook helper functions
|
|
||||||
// ----------------------------------------------------------------------------
|
|
||||||
|
|
||||||
// hide the currently active panel and show the new one
|
|
||||||
void wxNotebook::ChangePage(int nOldSel, int nSel)
|
|
||||||
{
|
|
||||||
if (nOldSel == nSel)
|
|
||||||
return;
|
|
||||||
|
|
||||||
if ( nOldSel != -1 )
|
|
||||||
m_pages[nOldSel]->Show( false );
|
|
||||||
|
|
||||||
if ( nSel != -1 )
|
|
||||||
{
|
|
||||||
wxNotebookPage *pPage = m_pages[nSel];
|
|
||||||
pPage->Show( true );
|
|
||||||
pPage->SetFocus();
|
|
||||||
}
|
|
||||||
|
|
||||||
m_nSelection = nSel;
|
|
||||||
m_peer->SetValue( m_nSelection + 1 ) ;
|
|
||||||
}
|
|
||||||
|
|
||||||
wxInt32 wxNotebook::MacControlHit(WXEVENTHANDLERREF WXUNUSED(handler) , WXEVENTREF WXUNUSED(event) )
|
|
||||||
{
|
|
||||||
OSStatus status = eventNotHandledErr ;
|
|
||||||
|
|
||||||
SInt32 newSel = m_peer->GetValue() - 1 ;
|
|
||||||
if ( newSel != m_nSelection )
|
|
||||||
{
|
|
||||||
wxBookCtrlEvent changing(
|
|
||||||
wxEVT_COMMAND_NOTEBOOK_PAGE_CHANGING, m_windowId,
|
|
||||||
newSel , m_nSelection );
|
|
||||||
changing.SetEventObject( this );
|
|
||||||
HandleWindowEvent( changing );
|
|
||||||
|
|
||||||
if ( changing.IsAllowed() )
|
|
||||||
{
|
|
||||||
wxBookCtrlEvent event(
|
|
||||||
wxEVT_COMMAND_NOTEBOOK_PAGE_CHANGED, m_windowId,
|
|
||||||
newSel, m_nSelection );
|
|
||||||
event.SetEventObject( this );
|
|
||||||
HandleWindowEvent( event );
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
m_peer->SetValue( m_nSelection + 1 ) ;
|
|
||||||
}
|
|
||||||
|
|
||||||
status = noErr ;
|
|
||||||
}
|
|
||||||
|
|
||||||
return (wxInt32)status ;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
@@ -1,5 +1,5 @@
|
|||||||
/////////////////////////////////////////////////////////////////////////////
|
/////////////////////////////////////////////////////////////////////////////
|
||||||
// Name: src/mac/carbon/overlay.cpp
|
// Name: src/osx/carbon/overlay.cpp
|
||||||
// Purpose: common wxOverlay code
|
// Purpose: common wxOverlay code
|
||||||
// Author: Stefan Csomor
|
// Author: Stefan Csomor
|
||||||
// Modified by:
|
// Modified by:
|
||||||
|
@@ -1,5 +1,5 @@
|
|||||||
///////////////////////////////////////////////////////////////////////////////
|
///////////////////////////////////////////////////////////////////////////////
|
||||||
// Name: src/mac/popupwin.cpp
|
// Name: src/osx/popupwin.cpp
|
||||||
// Purpose: implements wxPopupWindow for wxMac
|
// Purpose: implements wxPopupWindow for wxMac
|
||||||
// Author: Stefan Csomor
|
// Author: Stefan Csomor
|
||||||
// Modified by:
|
// Modified by:
|
||||||
|
@@ -1,5 +1,5 @@
|
|||||||
/////////////////////////////////////////////////////////////////////////////
|
/////////////////////////////////////////////////////////////////////////////
|
||||||
// Name: src/mac/carbon/printdlg.cpp
|
// Name: src/osx/carbon/printdlg.cpp
|
||||||
// Purpose: wxPrintDialog, wxPageSetupDialog
|
// Purpose: wxPrintDialog, wxPageSetupDialog
|
||||||
// Author: Stefan Csomor
|
// Author: Stefan Csomor
|
||||||
// Modified by:
|
// Modified by:
|
||||||
@@ -84,9 +84,7 @@ int wxMacPrintDialog::ShowModal()
|
|||||||
|
|
||||||
int result = wxID_CANCEL;
|
int result = wxID_CANCEL;
|
||||||
|
|
||||||
#ifdef __LP64__
|
#if wxOSX_USE_CARBON
|
||||||
// TODO use NSPrintPanel
|
|
||||||
#else
|
|
||||||
OSErr err = noErr;
|
OSErr err = noErr;
|
||||||
Boolean accepted;
|
Boolean accepted;
|
||||||
err = PMSessionPrintDialog(
|
err = PMSessionPrintDialog(
|
||||||
@@ -120,6 +118,8 @@ int wxMacPrintDialog::ShowModal()
|
|||||||
m_printDialogData.GetPrintData().ConvertFromNative();
|
m_printDialogData.GetPrintData().ConvertFromNative();
|
||||||
((wxMacCarbonPrintData*)m_printDialogData.GetPrintData().GetNativeData())->TransferTo( &m_printDialogData );
|
((wxMacCarbonPrintData*)m_printDialogData.GetPrintData().GetNativeData())->TransferTo( &m_printDialogData );
|
||||||
}
|
}
|
||||||
|
#else
|
||||||
|
// TODO use NSPrintPanel
|
||||||
#endif
|
#endif
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
@@ -162,8 +162,7 @@ int wxMacPageSetupDialog::ShowModal()
|
|||||||
((wxMacCarbonPrintData*)m_pageSetupData.GetPrintData().GetNativeData())->TransferFrom( &m_pageSetupData );
|
((wxMacCarbonPrintData*)m_pageSetupData.GetPrintData().GetNativeData())->TransferFrom( &m_pageSetupData );
|
||||||
|
|
||||||
int result = wxID_CANCEL;
|
int result = wxID_CANCEL;
|
||||||
#ifdef __LP64__
|
#if wxOSX_USE_CARBON
|
||||||
#else
|
|
||||||
OSErr err = noErr;
|
OSErr err = noErr;
|
||||||
Boolean accepted;
|
Boolean accepted;
|
||||||
|
|
||||||
@@ -200,6 +199,8 @@ int wxMacPageSetupDialog::ShowModal()
|
|||||||
m_pageSetupData.SetPaperSize( m_pageSetupData.GetPrintData().GetPaperSize() );
|
m_pageSetupData.SetPaperSize( m_pageSetupData.GetPrintData().GetPaperSize() );
|
||||||
((wxMacCarbonPrintData*)m_pageSetupData.GetPrintData().GetNativeData())->TransferTo( &m_pageSetupData );
|
((wxMacCarbonPrintData*)m_pageSetupData.GetPrintData().GetNativeData())->TransferTo( &m_pageSetupData );
|
||||||
}
|
}
|
||||||
|
#else
|
||||||
|
// TODO
|
||||||
#endif
|
#endif
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
|
@@ -1,11 +1,11 @@
|
|||||||
/////////////////////////////////////////////////////////////////////////////
|
/////////////////////////////////////////////////////////////////////////////
|
||||||
// Name: radiobut.cpp
|
// Name: src/osx/carbon/radiobut.cpp
|
||||||
// Purpose: wxRadioButton
|
// Purpose: wxRadioButton
|
||||||
// Author: AUTHOR
|
// Author: Stefan Csomor
|
||||||
// Modified by: JS Lair (99/11/15) adding the cyclic group notion for radiobox
|
// Modified by: JS Lair (99/11/15) adding the cyclic group notion for radiobox
|
||||||
// Created: ??/??/98
|
// Created: 01/01/98
|
||||||
// RCS-ID: $Id$
|
// RCS-ID: $Id$
|
||||||
// Copyright: (c) AUTHOR
|
// Copyright: (c) Stefan Csomor
|
||||||
// Licence: wxWindows licence
|
// Licence: wxWindows licence
|
||||||
/////////////////////////////////////////////////////////////////////////////
|
/////////////////////////////////////////////////////////////////////////////
|
||||||
|
|
||||||
@@ -14,165 +14,25 @@
|
|||||||
#if wxUSE_RADIOBTN
|
#if wxUSE_RADIOBTN
|
||||||
|
|
||||||
#include "wx/radiobut.h"
|
#include "wx/radiobut.h"
|
||||||
#include "wx/osx/uma.h"
|
#include "wx/osx/private.h"
|
||||||
|
|
||||||
IMPLEMENT_DYNAMIC_CLASS(wxRadioButton, wxControl)
|
wxWidgetImplType* wxWidgetImpl::CreateRadioButton( wxWindowMac* wxpeer,
|
||||||
|
wxWindowMac* parent,
|
||||||
|
wxWindowID id,
|
||||||
bool wxRadioButton::Create( wxWindow *parent,
|
const wxString& label,
|
||||||
wxWindowID id,
|
const wxPoint& pos,
|
||||||
const wxString& label,
|
const wxSize& size,
|
||||||
const wxPoint& pos,
|
long style,
|
||||||
const wxSize& size,
|
long extraStyle)
|
||||||
long style,
|
|
||||||
const wxValidator& validator,
|
|
||||||
const wxString& name )
|
|
||||||
{
|
{
|
||||||
m_macIsUserPane = false;
|
Rect bounds = wxMacGetBoundsForControl( wxpeer , pos , size ) ;
|
||||||
|
wxMacControl* peer = new wxMacControl(wxpeer) ;
|
||||||
if ( !wxControl::Create( parent, id, pos, size, style, validator, name ) )
|
|
||||||
return false;
|
|
||||||
|
|
||||||
m_labelOrig = m_label = label;
|
|
||||||
|
|
||||||
Rect bounds = wxMacGetBoundsForControl( this, pos, size );
|
|
||||||
|
|
||||||
m_peer = new wxMacControl( this );
|
|
||||||
OSStatus err = CreateRadioButtonControl(
|
OSStatus err = CreateRadioButtonControl(
|
||||||
MAC_WXHWND(parent->MacGetTopLevelWindowRef()), &bounds, CFSTR(""),
|
MAC_WXHWND(parent->MacGetTopLevelWindowRef()), &bounds, CFSTR(""),
|
||||||
0, false /* no autotoggle */, m_peer->GetControlRefAddr() );
|
0, false /* no autotoggle */, peer->GetControlRefAddr() );
|
||||||
verify_noerr( err );
|
verify_noerr( err );
|
||||||
|
|
||||||
MacPostControlCreate( pos, size );
|
return peer;
|
||||||
|
|
||||||
m_cycle = this;
|
|
||||||
|
|
||||||
if (HasFlag( wxRB_GROUP ))
|
|
||||||
{
|
|
||||||
AddInCycle( NULL );
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
// search backward for last group start
|
|
||||||
wxRadioButton *chief = NULL;
|
|
||||||
wxWindowList::compatibility_iterator node = parent->GetChildren().GetLast();
|
|
||||||
while (node)
|
|
||||||
{
|
|
||||||
wxWindow *child = node->GetData();
|
|
||||||
if (child->IsKindOf( CLASSINFO( wxRadioButton ) ))
|
|
||||||
{
|
|
||||||
chief = (wxRadioButton*)child;
|
|
||||||
if (child->HasFlag( wxRB_GROUP ))
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
|
|
||||||
node = node->GetPrevious();
|
|
||||||
}
|
|
||||||
|
|
||||||
AddInCycle( chief );
|
|
||||||
}
|
|
||||||
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
|
|
||||||
wxRadioButton::~wxRadioButton()
|
|
||||||
{
|
|
||||||
RemoveFromCycle();
|
|
||||||
}
|
|
||||||
|
|
||||||
void wxRadioButton::SetValue(bool val)
|
|
||||||
{
|
|
||||||
wxRadioButton *cycle;
|
|
||||||
if (m_peer->GetValue() == val)
|
|
||||||
return;
|
|
||||||
|
|
||||||
m_peer->SetValue( val );
|
|
||||||
if (val)
|
|
||||||
{
|
|
||||||
cycle = this->NextInCycle();
|
|
||||||
if (cycle != NULL)
|
|
||||||
{
|
|
||||||
while (cycle != this)
|
|
||||||
{
|
|
||||||
cycle->SetValue( false );
|
|
||||||
cycle = cycle->NextInCycle();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
bool wxRadioButton::GetValue() const
|
|
||||||
{
|
|
||||||
return m_peer->GetValue();
|
|
||||||
}
|
|
||||||
|
|
||||||
void wxRadioButton::Command(wxCommandEvent& event)
|
|
||||||
{
|
|
||||||
SetValue( (event.GetInt() != 0) );
|
|
||||||
ProcessCommand( event );
|
|
||||||
}
|
|
||||||
|
|
||||||
wxInt32 wxRadioButton::MacControlHit( WXEVENTHANDLERREF WXUNUSED(handler), WXEVENTREF WXUNUSED(event) )
|
|
||||||
{
|
|
||||||
// if already set -> no action
|
|
||||||
if (GetValue())
|
|
||||||
return noErr;
|
|
||||||
|
|
||||||
wxRadioButton *cycle;
|
|
||||||
cycle = this->NextInCycle();
|
|
||||||
if (cycle != NULL)
|
|
||||||
{
|
|
||||||
while (cycle != this)
|
|
||||||
{
|
|
||||||
if (cycle->GetValue())
|
|
||||||
cycle->SetValue( false );
|
|
||||||
|
|
||||||
cycle = cycle->NextInCycle();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
SetValue( true );
|
|
||||||
|
|
||||||
wxCommandEvent event2( wxEVT_COMMAND_RADIOBUTTON_SELECTED, m_windowId );
|
|
||||||
event2.SetEventObject( this );
|
|
||||||
event2.SetInt( true );
|
|
||||||
ProcessCommand( event2 );
|
|
||||||
|
|
||||||
return noErr;
|
|
||||||
}
|
|
||||||
|
|
||||||
wxRadioButton *wxRadioButton::AddInCycle(wxRadioButton *cycle)
|
|
||||||
{
|
|
||||||
wxRadioButton *current;
|
|
||||||
|
|
||||||
if (cycle == NULL)
|
|
||||||
{
|
|
||||||
m_cycle = this;
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
current = cycle;
|
|
||||||
while (current->m_cycle != cycle)
|
|
||||||
current = current->m_cycle;
|
|
||||||
|
|
||||||
m_cycle = cycle;
|
|
||||||
current->m_cycle = this;
|
|
||||||
}
|
|
||||||
|
|
||||||
return m_cycle;
|
|
||||||
}
|
|
||||||
|
|
||||||
void wxRadioButton::RemoveFromCycle()
|
|
||||||
{
|
|
||||||
if ((m_cycle == NULL) || (m_cycle == this))
|
|
||||||
return;
|
|
||||||
|
|
||||||
// Find the previous one and make it point to the next one
|
|
||||||
wxRadioButton* prev = this;
|
|
||||||
while (prev->m_cycle != this)
|
|
||||||
prev = prev->m_cycle;
|
|
||||||
|
|
||||||
prev->m_cycle = m_cycle;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
@@ -1,5 +1,5 @@
|
|||||||
///////////////////////////////////////////////////////////////////////////////
|
///////////////////////////////////////////////////////////////////////////////
|
||||||
// Name: src/mac/carbon/renderer.cpp
|
// Name: src/osx/carbon/renderer.cpp
|
||||||
// Purpose: implementation of wxRendererNative for Mac
|
// Purpose: implementation of wxRendererNative for Mac
|
||||||
// Author: Vadim Zeitlin
|
// Author: Vadim Zeitlin
|
||||||
// Modified by:
|
// Modified by:
|
||||||
@@ -27,8 +27,13 @@
|
|||||||
|
|
||||||
#include "wx/renderer.h"
|
#include "wx/renderer.h"
|
||||||
#include "wx/graphics.h"
|
#include "wx/graphics.h"
|
||||||
|
#include "wx/dcgraph.h"
|
||||||
#include "wx/osx/private.h"
|
#include "wx/osx/private.h"
|
||||||
|
|
||||||
|
#if wxOSX_USE_COCOA
|
||||||
|
// bring in the theme headers
|
||||||
|
#include <Carbon/Carbon.h>
|
||||||
|
#endif
|
||||||
|
|
||||||
class WXDLLEXPORT wxRendererMac : public wxDelegateRendererNative
|
class WXDLLEXPORT wxRendererMac : public wxDelegateRendererNative
|
||||||
{
|
{
|
||||||
|
@@ -1,5 +1,5 @@
|
|||||||
/////////////////////////////////////////////////////////////////////////////
|
/////////////////////////////////////////////////////////////////////////////
|
||||||
// Name: src/mac/carbon/scrolbar.cpp
|
// Name: src/osx/carbon/scrolbar.cpp
|
||||||
// Purpose: wxScrollBar
|
// Purpose: wxScrollBar
|
||||||
// Author: Stefan Csomor
|
// Author: Stefan Csomor
|
||||||
// Modified by:
|
// Modified by:
|
||||||
@@ -19,84 +19,49 @@
|
|||||||
#include "wx/settings.h"
|
#include "wx/settings.h"
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#include "wx/osx/uma.h"
|
#include "wx/osx/private.h"
|
||||||
|
|
||||||
IMPLEMENT_DYNAMIC_CLASS(wxScrollBar, wxControl)
|
class wxOSXScrollBarCarbonImpl : public wxMacControl
|
||||||
|
|
||||||
BEGIN_EVENT_TABLE(wxScrollBar, wxControl)
|
|
||||||
END_EVENT_TABLE()
|
|
||||||
|
|
||||||
|
|
||||||
bool wxScrollBar::Create( wxWindow *parent,
|
|
||||||
wxWindowID id,
|
|
||||||
const wxPoint& pos,
|
|
||||||
const wxSize& size,
|
|
||||||
long style,
|
|
||||||
const wxValidator& validator,
|
|
||||||
const wxString& name )
|
|
||||||
{
|
{
|
||||||
m_macIsUserPane = false;
|
public :
|
||||||
|
wxOSXScrollBarCarbonImpl( wxWindowMac* peer) : wxMacControl( peer )
|
||||||
|
{
|
||||||
|
}
|
||||||
|
|
||||||
if ( !wxControl::Create( parent, id, pos, size, style, validator, name ) )
|
void SetScrollThumb( wxInt32 value, wxInt32 thumbSize )
|
||||||
return false;
|
{
|
||||||
|
SetValue( value );
|
||||||
|
SetControlViewSize(m_controlRef , thumbSize );
|
||||||
|
}
|
||||||
|
protected:
|
||||||
|
};
|
||||||
|
|
||||||
Rect bounds = wxMacGetBoundsForControl( this, pos, size );
|
wxWidgetImplType* wxWidgetImpl::CreateScrollBar( wxWindowMac* wxpeer,
|
||||||
|
wxWindowMac* parent,
|
||||||
|
wxWindowID id,
|
||||||
|
const wxPoint& pos,
|
||||||
|
const wxSize& size,
|
||||||
|
long style,
|
||||||
|
long extraStyle)
|
||||||
|
{
|
||||||
|
Rect bounds = wxMacGetBoundsForControl( wxpeer, pos, size );
|
||||||
|
|
||||||
m_peer = new wxMacControl( this );
|
wxMacControl* peer = new wxOSXScrollBarCarbonImpl( wxpeer );
|
||||||
OSStatus err = CreateScrollBarControl(
|
OSStatus err = CreateScrollBarControl(
|
||||||
MAC_WXHWND(parent->MacGetTopLevelWindowRef()), &bounds,
|
MAC_WXHWND(parent->MacGetTopLevelWindowRef()), &bounds,
|
||||||
0, 0, 100, 1, true /* liveTracking */,
|
0, 0, 100, 1, true /* liveTracking */,
|
||||||
GetwxMacLiveScrollbarActionProc(),
|
GetwxMacLiveScrollbarActionProc(),
|
||||||
m_peer->GetControlRefAddr() );
|
peer->GetControlRefAddr() );
|
||||||
verify_noerr( err );
|
verify_noerr( err );
|
||||||
|
return peer;
|
||||||
MacPostControlCreate( pos, size );
|
|
||||||
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
|
|
||||||
wxScrollBar::~wxScrollBar()
|
|
||||||
{
|
|
||||||
}
|
|
||||||
|
|
||||||
void wxScrollBar::SetThumbPosition( int viewStart )
|
|
||||||
{
|
|
||||||
m_peer->SetValue( viewStart );
|
|
||||||
}
|
|
||||||
|
|
||||||
int wxScrollBar::GetThumbPosition() const
|
|
||||||
{
|
|
||||||
return m_peer->GetValue();
|
|
||||||
}
|
|
||||||
|
|
||||||
void wxScrollBar::SetScrollbar( int position,
|
|
||||||
int thumbSize,
|
|
||||||
int range,
|
|
||||||
int pageSize,
|
|
||||||
bool WXUNUSED(refresh) )
|
|
||||||
{
|
|
||||||
m_pageSize = pageSize;
|
|
||||||
m_viewSize = thumbSize;
|
|
||||||
m_objectSize = range;
|
|
||||||
|
|
||||||
int range1 = wxMax( (m_objectSize - m_viewSize), 0 );
|
|
||||||
|
|
||||||
m_peer->SetMinimum( 0 );
|
|
||||||
m_peer->SetMaximum( range1 );
|
|
||||||
m_peer->SetValue( position );
|
|
||||||
m_peer->SetViewSize( m_viewSize );
|
|
||||||
}
|
|
||||||
|
|
||||||
void wxScrollBar::Command( wxCommandEvent& event )
|
|
||||||
{
|
|
||||||
SetThumbPosition( event.GetInt() );
|
|
||||||
ProcessCommand( event );
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void wxScrollBar::MacHandleControlClick( WXWidget WXUNUSED(control), wxInt16 controlpart, bool mouseStillDown )
|
void wxScrollBar::MacHandleControlClick( WXWidget WXUNUSED(control), wxInt16 controlpart, bool mouseStillDown )
|
||||||
{
|
{
|
||||||
|
#if wxOSX_USE_CARBON
|
||||||
|
|
||||||
int position = m_peer->GetValue();
|
int position = m_peer->GetValue();
|
||||||
int minPos = m_peer->GetMinimum();
|
int minPos = 0 ;
|
||||||
int maxPos = m_peer->GetMaximum();
|
int maxPos = m_peer->GetMaximum();
|
||||||
|
|
||||||
wxEventType scrollEvent = wxEVT_NULL;
|
wxEventType scrollEvent = wxEVT_NULL;
|
||||||
@@ -166,82 +131,5 @@ void wxScrollBar::MacHandleControlClick( WXWidget WXUNUSED(control), wxInt16 con
|
|||||||
window->MacOnScroll( event );
|
window->MacOnScroll( event );
|
||||||
else
|
else
|
||||||
HandleWindowEvent( event );
|
HandleWindowEvent( event );
|
||||||
}
|
#endif
|
||||||
|
|
||||||
wxInt32 wxScrollBar::MacControlHit( WXEVENTHANDLERREF WXUNUSED(handler), WXEVENTREF mevent )
|
|
||||||
{
|
|
||||||
int position = m_peer->GetValue();
|
|
||||||
int minPos = m_peer->GetMinimum();
|
|
||||||
int maxPos = m_peer->GetMaximum();
|
|
||||||
|
|
||||||
wxEventType scrollEvent = wxEVT_NULL;
|
|
||||||
int nScrollInc = 0;
|
|
||||||
|
|
||||||
wxMacCarbonEvent cEvent( (EventRef)mevent );
|
|
||||||
ControlPartCode controlpart = cEvent.GetParameter<ControlPartCode>(kEventParamControlPart, typeControlPartCode);
|
|
||||||
|
|
||||||
// all events have already been reported during mouse down, except for THUMBRELEASE
|
|
||||||
// NB: this may need to be reviewed in light of the fact that scroll wheel events
|
|
||||||
// aren't being handled properly
|
|
||||||
if ( controlpart != kControlIndicatorPart )
|
|
||||||
return eventNotHandledErr;
|
|
||||||
|
|
||||||
switch ( controlpart )
|
|
||||||
{
|
|
||||||
case kControlIndicatorPart:
|
|
||||||
nScrollInc = 0;
|
|
||||||
scrollEvent = wxEVT_SCROLL_THUMBRELEASE;
|
|
||||||
break;
|
|
||||||
|
|
||||||
default:
|
|
||||||
wxFAIL_MSG(wxT("unknown scrollbar selector"));
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
|
|
||||||
int new_pos = position + nScrollInc;
|
|
||||||
|
|
||||||
if (new_pos < minPos)
|
|
||||||
new_pos = minPos;
|
|
||||||
else if (new_pos > maxPos)
|
|
||||||
new_pos = maxPos;
|
|
||||||
|
|
||||||
if ( nScrollInc )
|
|
||||||
SetThumbPosition( new_pos );
|
|
||||||
|
|
||||||
wxScrollEvent event( scrollEvent, m_windowId );
|
|
||||||
if ( m_windowStyle & wxHORIZONTAL )
|
|
||||||
event.SetOrientation( wxHORIZONTAL );
|
|
||||||
else
|
|
||||||
event.SetOrientation( wxVERTICAL );
|
|
||||||
|
|
||||||
event.SetPosition( new_pos );
|
|
||||||
event.SetEventObject( this );
|
|
||||||
wxWindow* window = GetParent();
|
|
||||||
if (window && window->MacIsWindowScrollbar( this ))
|
|
||||||
// this is hardcoded
|
|
||||||
window->MacOnScroll( event );
|
|
||||||
else
|
|
||||||
HandleWindowEvent( event );
|
|
||||||
|
|
||||||
return noErr;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
wxSize wxScrollBar::DoGetBestSize() const
|
|
||||||
{
|
|
||||||
int w = 100;
|
|
||||||
int h = 100;
|
|
||||||
|
|
||||||
if ( IsVertical() )
|
|
||||||
{
|
|
||||||
w = wxSystemSettings::GetMetric(wxSYS_VSCROLL_X);
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
h = wxSystemSettings::GetMetric(wxSYS_HSCROLL_Y);
|
|
||||||
}
|
|
||||||
|
|
||||||
wxSize best(w, h);
|
|
||||||
CacheBestSize(best);
|
|
||||||
return best;
|
|
||||||
}
|
}
|
@@ -1,5 +1,5 @@
|
|||||||
/////////////////////////////////////////////////////////////////////////////
|
/////////////////////////////////////////////////////////////////////////////
|
||||||
// Name: src/mac/carbon/settings.cpp
|
// Name: src/osx/carbon/settings.cpp
|
||||||
// Purpose: wxSettings
|
// Purpose: wxSettings
|
||||||
// Author: Stefan Csomor
|
// Author: Stefan Csomor
|
||||||
// Modified by:
|
// Modified by:
|
||||||
@@ -39,7 +39,7 @@ wxColour wxSystemSettingsNative::GetColour(wxSystemColour index)
|
|||||||
{
|
{
|
||||||
case wxSYS_COLOUR_WINDOW:
|
case wxSYS_COLOUR_WINDOW:
|
||||||
#if wxOSX_USE_COCOA_OR_CARBON
|
#if wxOSX_USE_COCOA_OR_CARBON
|
||||||
resultColor = wxColour(wxMacCreateCGColorFromHITheme( kThemeBrushDocumentWindowBackground )) ;
|
resultColor = wxColour(wxMacCreateCGColorFromHITheme( 15 /* kThemeBrushDocumentWindowBackground */ )) ;
|
||||||
#else
|
#else
|
||||||
resultColor = *wxWHITE;
|
resultColor = *wxWHITE;
|
||||||
#endif
|
#endif
|
||||||
@@ -55,7 +55,7 @@ wxColour wxSystemSettingsNative::GetColour(wxSystemColour index)
|
|||||||
case wxSYS_COLOUR_BTNFACE:
|
case wxSYS_COLOUR_BTNFACE:
|
||||||
case wxSYS_COLOUR_MENUBAR:
|
case wxSYS_COLOUR_MENUBAR:
|
||||||
#if wxOSX_USE_COCOA_OR_CARBON
|
#if wxOSX_USE_COCOA_OR_CARBON
|
||||||
resultColor = wxColour(wxMacCreateCGColorFromHITheme(kThemeBrushDialogBackgroundActive));
|
resultColor = wxColour(wxMacCreateCGColorFromHITheme( 3 /* kThemeBrushDialogBackgroundActive */));
|
||||||
#else
|
#else
|
||||||
resultColor = wxColour( 0xBE, 0xBE, 0xBE ) ;
|
resultColor = wxColour( 0xBE, 0xBE, 0xBE ) ;
|
||||||
#endif
|
#endif
|
||||||
@@ -85,7 +85,7 @@ wxColour wxSystemSettingsNative::GetColour(wxSystemColour index)
|
|||||||
// NB: enable this case as desired
|
// NB: enable this case as desired
|
||||||
colorBrushID = kThemeBrushAlternatePrimaryHighlightColor;
|
colorBrushID = kThemeBrushAlternatePrimaryHighlightColor;
|
||||||
#else
|
#else
|
||||||
colorBrushID = kThemeBrushPrimaryHighlightColor;
|
colorBrushID = -3 /* kThemeBrushPrimaryHighlightColor */;
|
||||||
#endif
|
#endif
|
||||||
resultColor = wxColour( wxMacCreateCGColorFromHITheme(colorBrushID) );
|
resultColor = wxColour( wxMacCreateCGColorFromHITheme(colorBrushID) );
|
||||||
#else
|
#else
|
||||||
@@ -110,7 +110,7 @@ wxColour wxSystemSettingsNative::GetColour(wxSystemColour index)
|
|||||||
case wxSYS_COLOUR_HIGHLIGHTTEXT :
|
case wxSYS_COLOUR_HIGHLIGHTTEXT :
|
||||||
#if wxOSX_USE_COCOA_OR_CARBON
|
#if wxOSX_USE_COCOA_OR_CARBON
|
||||||
{
|
{
|
||||||
wxColour highlightcolor( wxMacCreateCGColorFromHITheme(kThemeBrushPrimaryHighlightColor) );
|
wxColour highlightcolor( wxMacCreateCGColorFromHITheme(-3 /* kThemeBrushPrimaryHighlightColor */) );
|
||||||
if ((highlightcolor.Red() + highlightcolor.Green() + highlightcolor.Blue() ) == 0)
|
if ((highlightcolor.Red() + highlightcolor.Green() + highlightcolor.Blue() ) == 0)
|
||||||
resultColor = *wxWHITE ;
|
resultColor = *wxWHITE ;
|
||||||
else
|
else
|
||||||
|
@@ -14,544 +14,41 @@
|
|||||||
#if wxUSE_SLIDER
|
#if wxUSE_SLIDER
|
||||||
|
|
||||||
#include "wx/slider.h"
|
#include "wx/slider.h"
|
||||||
#include "wx/osx/uma.h"
|
#include "wx/osx/private.h"
|
||||||
|
|
||||||
IMPLEMENT_DYNAMIC_CLASS(wxSlider, wxControl)
|
wxWidgetImplType* wxWidgetImpl::CreateSlider( wxWindowMac* wxpeer,
|
||||||
|
wxWindowMac* parent,
|
||||||
BEGIN_EVENT_TABLE(wxSlider, wxControl)
|
wxWindowID id,
|
||||||
END_EVENT_TABLE()
|
wxInt32 value,
|
||||||
|
wxInt32 minimum,
|
||||||
// The dimensions of the different styles of sliders (from Aqua document)
|
wxInt32 maximum,
|
||||||
#define wxSLIDER_DIMENSIONACROSS_WITHTICKMARKS 24
|
const wxPoint& pos,
|
||||||
#define wxSLIDER_DIMENSIONACROSS_ARROW 18
|
const wxSize& size,
|
||||||
|
long style,
|
||||||
// Distance between slider and text
|
long extraStyle)
|
||||||
#define wxSLIDER_BORDERTEXT 5
|
|
||||||
|
|
||||||
// NB: The default orientation for a slider is horizontal; however, if the user specifies
|
|
||||||
// some slider styles but doesn't specify the orientation we have to assume he wants a
|
|
||||||
// horizontal one. Therefore in this file when testing for the slider's orientation
|
|
||||||
// vertical is tested for if this is not set then we use the horizontal one
|
|
||||||
// e.g., if (GetWindowStyle() & wxSL_VERTICAL) {} else { horizontal case }.
|
|
||||||
|
|
||||||
wxSlider::wxSlider()
|
|
||||||
{
|
{
|
||||||
m_pageSize = 1;
|
Rect bounds = wxMacGetBoundsForControl( wxpeer, pos, size );
|
||||||
m_lineSize = 1;
|
|
||||||
m_rangeMax = 0;
|
|
||||||
m_rangeMin = 0;
|
|
||||||
m_tickFreq = 0;
|
|
||||||
|
|
||||||
m_macMinimumStatic = NULL;
|
|
||||||
m_macMaximumStatic = NULL;
|
|
||||||
m_macValueStatic = NULL;
|
|
||||||
}
|
|
||||||
|
|
||||||
bool wxSlider::Create(wxWindow *parent,
|
|
||||||
wxWindowID id,
|
|
||||||
int value, int minValue, int maxValue,
|
|
||||||
const wxPoint& pos,
|
|
||||||
const wxSize& size, long style,
|
|
||||||
const wxValidator& validator,
|
|
||||||
const wxString& name)
|
|
||||||
{
|
|
||||||
m_macIsUserPane = false;
|
|
||||||
|
|
||||||
m_macMinimumStatic = NULL;
|
|
||||||
m_macMaximumStatic = NULL;
|
|
||||||
m_macValueStatic = NULL;
|
|
||||||
|
|
||||||
m_lineSize = 1;
|
|
||||||
m_tickFreq = 0;
|
|
||||||
|
|
||||||
m_rangeMax = maxValue;
|
|
||||||
m_rangeMin = minValue;
|
|
||||||
|
|
||||||
m_pageSize = (int)((maxValue - minValue) / 10);
|
|
||||||
|
|
||||||
// our styles are redundant: wxSL_LEFT/RIGHT imply wxSL_VERTICAL and
|
|
||||||
// wxSL_TOP/BOTTOM imply wxSL_HORIZONTAL, but for backwards compatibility
|
|
||||||
// reasons we can't really change it, instead try to infer the orientation
|
|
||||||
// from the flags given to us here
|
|
||||||
switch ( style & (wxSL_LEFT | wxSL_RIGHT | wxSL_TOP | wxSL_BOTTOM) )
|
|
||||||
{
|
|
||||||
case wxSL_LEFT:
|
|
||||||
case wxSL_RIGHT:
|
|
||||||
style |= wxSL_VERTICAL;
|
|
||||||
break;
|
|
||||||
|
|
||||||
case wxSL_TOP:
|
|
||||||
case wxSL_BOTTOM:
|
|
||||||
style |= wxSL_HORIZONTAL;
|
|
||||||
break;
|
|
||||||
|
|
||||||
case 0:
|
|
||||||
default:
|
|
||||||
// no specific direction, do we have at least the orientation?
|
|
||||||
if ( !(style & (wxSL_HORIZONTAL | wxSL_VERTICAL)) )
|
|
||||||
// no: choose default
|
|
||||||
style |= wxSL_BOTTOM | wxSL_HORIZONTAL;
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
|
|
||||||
wxASSERT_MSG( !(style & wxSL_VERTICAL) || !(style & wxSL_HORIZONTAL),
|
|
||||||
wxT("incompatible slider direction and orientation") );
|
|
||||||
|
|
||||||
if ( !wxControl::Create(parent, id, pos, size, style, validator, name) )
|
|
||||||
return false;
|
|
||||||
|
|
||||||
Rect bounds = wxMacGetBoundsForControl( this , pos , size );
|
|
||||||
|
|
||||||
// NB: (RN) Ticks here are sometimes off in the GUI if there
|
|
||||||
// are not as many tick marks as there are values
|
|
||||||
//
|
|
||||||
int tickMarks = 0;
|
int tickMarks = 0;
|
||||||
if ( style & wxSL_AUTOTICKS )
|
if ( style & wxSL_AUTOTICKS )
|
||||||
tickMarks = (maxValue - minValue) + 1; // +1 for the 0 value
|
tickMarks = (maximum - minimum) + 1; // +1 for the 0 value
|
||||||
|
|
||||||
// keep the number of tickmarks from becoming unwieldly, therefore below it is ok to cast
|
// keep the number of tickmarks from becoming unwieldly, therefore below it is ok to cast
|
||||||
// it to a UInt16
|
// it to a UInt16
|
||||||
while (tickMarks > 20)
|
while (tickMarks > 20)
|
||||||
tickMarks /= 5;
|
tickMarks /= 5;
|
||||||
|
|
||||||
m_peer = new wxMacControl( this );
|
|
||||||
|
wxMacControl* peer = new wxMacControl( wxpeer );
|
||||||
OSStatus err = CreateSliderControl(
|
OSStatus err = CreateSliderControl(
|
||||||
MAC_WXHWND(parent->MacGetTopLevelWindowRef()), &bounds,
|
MAC_WXHWND(parent->MacGetTopLevelWindowRef()), &bounds,
|
||||||
value, minValue, maxValue,
|
value, minimum, maximum,
|
||||||
kControlSliderPointsDownOrRight,
|
kControlSliderPointsDownOrRight,
|
||||||
(UInt16) tickMarks, true /* liveTracking */,
|
(UInt16) tickMarks, true /* liveTracking */,
|
||||||
GetwxMacLiveScrollbarActionProc(),
|
GetwxMacLiveScrollbarActionProc(),
|
||||||
m_peer->GetControlRefAddr() );
|
peer->GetControlRefAddr() );
|
||||||
verify_noerr( err );
|
verify_noerr( err );
|
||||||
|
|
||||||
if (style & wxSL_VERTICAL)
|
return peer;
|
||||||
// Forces SetSize to use the proper width
|
|
||||||
SetSizeHints(10, -1, 10, -1);
|
|
||||||
else
|
|
||||||
// Forces SetSize to use the proper height
|
|
||||||
SetSizeHints(-1, 10, -1, 10);
|
|
||||||
|
|
||||||
// NB: SetSizeHints is overloaded by wxSlider and will substitute 10 with the
|
|
||||||
// proper dimensions, it also means other people cannot bugger the slider with
|
|
||||||
// other values
|
|
||||||
|
|
||||||
if (style & wxSL_LABELS)
|
|
||||||
{
|
|
||||||
m_macMinimumStatic = new wxStaticText( parent, wxID_ANY, wxEmptyString );
|
|
||||||
m_macMaximumStatic = new wxStaticText( parent, wxID_ANY, wxEmptyString );
|
|
||||||
m_macValueStatic = new wxStaticText( parent, wxID_ANY, wxEmptyString );
|
|
||||||
}
|
|
||||||
|
|
||||||
SetRange(minValue, maxValue);
|
|
||||||
SetValue(value);
|
|
||||||
|
|
||||||
MacPostControlCreate(pos, size);
|
|
||||||
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
|
|
||||||
wxSlider::~wxSlider()
|
|
||||||
{
|
|
||||||
// this is a special case, as we had to add windows as siblings we are
|
|
||||||
// responsible for their disposal, but only if we are not part of a DestroyAllChildren
|
|
||||||
if ( m_parent && !m_parent->IsBeingDeleted() )
|
|
||||||
{
|
|
||||||
delete m_macMinimumStatic;
|
|
||||||
delete m_macMaximumStatic;
|
|
||||||
delete m_macValueStatic;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
int wxSlider::GetValue() const
|
|
||||||
{
|
|
||||||
// We may need to invert the value returned by the widget
|
|
||||||
return ValueInvertOrNot( m_peer->GetValue() ) ;
|
|
||||||
}
|
|
||||||
|
|
||||||
void wxSlider::SetValue(int value)
|
|
||||||
{
|
|
||||||
if ( m_macValueStatic )
|
|
||||||
{
|
|
||||||
wxString valuestring;
|
|
||||||
valuestring.Printf( wxT("%d"), value );
|
|
||||||
m_macValueStatic->SetLabel( valuestring );
|
|
||||||
}
|
|
||||||
|
|
||||||
// We only invert for the setting of the actual native widget
|
|
||||||
m_peer->SetValue( ValueInvertOrNot( value ) );
|
|
||||||
}
|
|
||||||
|
|
||||||
void wxSlider::SetRange(int minValue, int maxValue)
|
|
||||||
{
|
|
||||||
wxString value;
|
|
||||||
|
|
||||||
m_rangeMin = minValue;
|
|
||||||
m_rangeMax = maxValue;
|
|
||||||
|
|
||||||
m_peer->SetMinimum( m_rangeMin );
|
|
||||||
m_peer->SetMaximum( m_rangeMax );
|
|
||||||
|
|
||||||
if (m_macMinimumStatic)
|
|
||||||
{
|
|
||||||
value.Printf( wxT("%d"), ValueInvertOrNot( m_rangeMin ) );
|
|
||||||
m_macMinimumStatic->SetLabel( value );
|
|
||||||
}
|
|
||||||
|
|
||||||
if (m_macMaximumStatic)
|
|
||||||
{
|
|
||||||
value.Printf( wxT("%d"), ValueInvertOrNot( m_rangeMax ) );
|
|
||||||
m_macMaximumStatic->SetLabel( value );
|
|
||||||
}
|
|
||||||
|
|
||||||
// If the range is out of bounds, set it to a
|
|
||||||
// value that is within bounds
|
|
||||||
// RN: Testing reveals OSX does its own
|
|
||||||
// bounding, perhaps this isn't needed?
|
|
||||||
int currentValue = GetValue();
|
|
||||||
|
|
||||||
if(currentValue < m_rangeMin)
|
|
||||||
SetValue(m_rangeMin);
|
|
||||||
else if(currentValue > m_rangeMax)
|
|
||||||
SetValue(m_rangeMax);
|
|
||||||
}
|
|
||||||
|
|
||||||
// For trackbars only
|
|
||||||
void wxSlider::SetTickFreq(int n, int WXUNUSED(pos))
|
|
||||||
{
|
|
||||||
// TODO
|
|
||||||
m_tickFreq = n;
|
|
||||||
}
|
|
||||||
|
|
||||||
void wxSlider::SetPageSize(int pageSize)
|
|
||||||
{
|
|
||||||
// TODO
|
|
||||||
m_pageSize = pageSize;
|
|
||||||
}
|
|
||||||
|
|
||||||
int wxSlider::GetPageSize() const
|
|
||||||
{
|
|
||||||
return m_pageSize;
|
|
||||||
}
|
|
||||||
|
|
||||||
void wxSlider::ClearSel()
|
|
||||||
{
|
|
||||||
// TODO
|
|
||||||
}
|
|
||||||
|
|
||||||
void wxSlider::ClearTicks()
|
|
||||||
{
|
|
||||||
// TODO
|
|
||||||
}
|
|
||||||
|
|
||||||
void wxSlider::SetLineSize(int lineSize)
|
|
||||||
{
|
|
||||||
m_lineSize = lineSize;
|
|
||||||
// TODO
|
|
||||||
}
|
|
||||||
|
|
||||||
int wxSlider::GetLineSize() const
|
|
||||||
{
|
|
||||||
// TODO
|
|
||||||
return m_lineSize;
|
|
||||||
}
|
|
||||||
|
|
||||||
int wxSlider::GetSelEnd() const
|
|
||||||
{
|
|
||||||
// TODO
|
|
||||||
return 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
int wxSlider::GetSelStart() const
|
|
||||||
{
|
|
||||||
// TODO
|
|
||||||
return 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
void wxSlider::SetSelection(int WXUNUSED(minPos), int WXUNUSED(maxPos))
|
|
||||||
{
|
|
||||||
// TODO
|
|
||||||
}
|
|
||||||
|
|
||||||
void wxSlider::SetThumbLength(int WXUNUSED(len))
|
|
||||||
{
|
|
||||||
// TODO
|
|
||||||
}
|
|
||||||
|
|
||||||
int wxSlider::GetThumbLength() const
|
|
||||||
{
|
|
||||||
// TODO
|
|
||||||
return 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
void wxSlider::SetTick(int WXUNUSED(tickPos))
|
|
||||||
{
|
|
||||||
// TODO
|
|
||||||
}
|
|
||||||
|
|
||||||
void wxSlider::Command(wxCommandEvent &event)
|
|
||||||
{
|
|
||||||
SetValue(event.GetInt());
|
|
||||||
ProcessCommand(event);
|
|
||||||
}
|
|
||||||
|
|
||||||
void wxSlider::MacHandleControlClick(WXWidget WXUNUSED(control),
|
|
||||||
wxInt16 WXUNUSED(controlpart),
|
|
||||||
bool WXUNUSED(mouseStillDown))
|
|
||||||
{
|
|
||||||
// Whatever the native value is, we may need to invert it for calling
|
|
||||||
// SetValue and putting the possibly inverted value in the event
|
|
||||||
int value = ValueInvertOrNot( m_peer->GetValue() );
|
|
||||||
|
|
||||||
SetValue( value );
|
|
||||||
|
|
||||||
wxScrollEvent event( wxEVT_SCROLL_THUMBTRACK, m_windowId );
|
|
||||||
event.SetPosition( value );
|
|
||||||
event.SetEventObject( this );
|
|
||||||
HandleWindowEvent( event );
|
|
||||||
|
|
||||||
wxCommandEvent cevent( wxEVT_COMMAND_SLIDER_UPDATED, m_windowId );
|
|
||||||
cevent.SetInt( value );
|
|
||||||
cevent.SetEventObject( this );
|
|
||||||
HandleWindowEvent( cevent );
|
|
||||||
}
|
|
||||||
|
|
||||||
wxInt32 wxSlider::MacControlHit(WXEVENTHANDLERREF WXUNUSED(handler),
|
|
||||||
WXEVENTREF WXUNUSED(mevent))
|
|
||||||
{
|
|
||||||
// Whatever the native value is, we may need to invert it for calling
|
|
||||||
// SetValue and putting the possibly inverted value in the event
|
|
||||||
int value = ValueInvertOrNot( m_peer->GetValue() ) ;
|
|
||||||
|
|
||||||
SetValue( value ) ;
|
|
||||||
|
|
||||||
wxScrollEvent event( wxEVT_SCROLL_THUMBRELEASE, m_windowId );
|
|
||||||
event.SetPosition( value );
|
|
||||||
event.SetEventObject( this );
|
|
||||||
HandleWindowEvent( event );
|
|
||||||
|
|
||||||
wxCommandEvent cevent( wxEVT_COMMAND_SLIDER_UPDATED, m_windowId );
|
|
||||||
cevent.SetInt( value );
|
|
||||||
cevent.SetEventObject( this );
|
|
||||||
|
|
||||||
HandleWindowEvent( cevent );
|
|
||||||
|
|
||||||
return noErr;
|
|
||||||
}
|
|
||||||
|
|
||||||
// This is overloaded in wxSlider so that the proper width/height will always be used
|
|
||||||
// for the slider different values would cause redrawing and mouse detection problems
|
|
||||||
//
|
|
||||||
void wxSlider::DoSetSizeHints( int minW, int minH,
|
|
||||||
int maxW, int maxH,
|
|
||||||
int WXUNUSED(incW), int WXUNUSED(incH) )
|
|
||||||
{
|
|
||||||
wxSize size = GetBestSize();
|
|
||||||
|
|
||||||
if (GetWindowStyle() & wxSL_VERTICAL)
|
|
||||||
{
|
|
||||||
SetMinSize( wxSize(size.x,minH) );
|
|
||||||
SetMaxSize( wxSize(size.x,maxH) );
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
SetMinSize( wxSize(minW,size.y) );
|
|
||||||
SetMaxSize( wxSize(maxW,size.y) );
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
wxSize wxSlider::DoGetBestSize() const
|
|
||||||
{
|
|
||||||
wxSize size;
|
|
||||||
int textwidth, textheight;
|
|
||||||
int mintwidth, mintheight;
|
|
||||||
int maxtwidth, maxtheight;
|
|
||||||
|
|
||||||
textwidth = textheight = 0;
|
|
||||||
mintwidth = mintheight = 0;
|
|
||||||
maxtwidth = maxtheight = 0;
|
|
||||||
|
|
||||||
if (GetWindowStyle() & wxSL_LABELS)
|
|
||||||
{
|
|
||||||
wxString text;
|
|
||||||
|
|
||||||
// Get maximum text label width and height
|
|
||||||
text.Printf( wxT("%d"), ValueInvertOrNot( m_rangeMin ) );
|
|
||||||
GetTextExtent(text, &mintwidth, &mintheight);
|
|
||||||
text.Printf( wxT("%d"), ValueInvertOrNot( m_rangeMax ) );
|
|
||||||
GetTextExtent(text, &maxtwidth, &maxtheight);
|
|
||||||
|
|
||||||
if (maxtheight > mintheight)
|
|
||||||
textheight = maxtheight;
|
|
||||||
else
|
|
||||||
textheight = mintheight;
|
|
||||||
|
|
||||||
if (maxtwidth > mintwidth)
|
|
||||||
textwidth = maxtwidth;
|
|
||||||
else
|
|
||||||
textwidth = mintwidth;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (GetWindowStyle() & wxSL_VERTICAL)
|
|
||||||
{
|
|
||||||
size.y = 150;
|
|
||||||
|
|
||||||
if (GetWindowStyle() & wxSL_AUTOTICKS)
|
|
||||||
size.x = wxSLIDER_DIMENSIONACROSS_WITHTICKMARKS;
|
|
||||||
else
|
|
||||||
size.x = wxSLIDER_DIMENSIONACROSS_ARROW;
|
|
||||||
|
|
||||||
if (GetWindowStyle() & wxSL_LABELS)
|
|
||||||
size.x += textwidth + wxSLIDER_BORDERTEXT;
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
size.x = 150;
|
|
||||||
|
|
||||||
if (GetWindowStyle() & wxSL_AUTOTICKS)
|
|
||||||
size.y = wxSLIDER_DIMENSIONACROSS_WITHTICKMARKS;
|
|
||||||
else
|
|
||||||
size.y = wxSLIDER_DIMENSIONACROSS_ARROW;
|
|
||||||
|
|
||||||
if (GetWindowStyle() & wxSL_LABELS)
|
|
||||||
{
|
|
||||||
size.y += textheight + wxSLIDER_BORDERTEXT;
|
|
||||||
size.x += (mintwidth / 2) + (maxtwidth / 2);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
return size;
|
|
||||||
}
|
|
||||||
|
|
||||||
void wxSlider::DoSetSize(int x, int y, int w, int h, int sizeFlags)
|
|
||||||
{
|
|
||||||
int yborder = 0;
|
|
||||||
int minValWidth, maxValWidth, textheight;
|
|
||||||
int sliderBreadth;
|
|
||||||
int width = w;
|
|
||||||
|
|
||||||
if (GetWindowStyle() & wxSL_LABELS)
|
|
||||||
{
|
|
||||||
wxString text;
|
|
||||||
int ht, valValWidth;
|
|
||||||
|
|
||||||
// Get maximum text label width and height
|
|
||||||
text.Printf(wxT("%d"), ValueInvertOrNot( m_rangeMin ) );
|
|
||||||
GetTextExtent(text, &minValWidth, &textheight);
|
|
||||||
text.Printf(wxT("%d"), ValueInvertOrNot( m_rangeMax ) );
|
|
||||||
GetTextExtent(text, &maxValWidth, &ht);
|
|
||||||
|
|
||||||
if (ht > textheight)
|
|
||||||
textheight = ht;
|
|
||||||
|
|
||||||
if (GetWindowStyle() & wxSL_HORIZONTAL)
|
|
||||||
{
|
|
||||||
if ( m_macMinimumStatic )
|
|
||||||
{
|
|
||||||
w -= minValWidth / 2;
|
|
||||||
x += minValWidth / 2;
|
|
||||||
}
|
|
||||||
|
|
||||||
if ( m_macMaximumStatic )
|
|
||||||
w -= maxValWidth / 2;
|
|
||||||
}
|
|
||||||
|
|
||||||
// Labels have this control's parent as their parent
|
|
||||||
// so if this control is not at 0,0 relative to the parent
|
|
||||||
// the labels need to know the position of this control
|
|
||||||
// relative to its parent in order to size properly, so
|
|
||||||
// move the control first so we can use GetPosition()
|
|
||||||
wxControl::DoSetSize( x, y, w, h, sizeFlags );
|
|
||||||
|
|
||||||
if (GetWindowStyle() & wxSL_VERTICAL)
|
|
||||||
// If vertical, use current value
|
|
||||||
text.Printf(wxT("%d"), (int)m_peer->GetValue());
|
|
||||||
else
|
|
||||||
// Use max so that the current value doesn't drift as centering would need to change
|
|
||||||
text.Printf(wxT("%d"), m_rangeMax);
|
|
||||||
|
|
||||||
GetTextExtent(text, &valValWidth, &ht);
|
|
||||||
|
|
||||||
yborder = textheight + wxSLIDER_BORDERTEXT;
|
|
||||||
|
|
||||||
// Get slider breadth
|
|
||||||
if (GetWindowStyle() & wxSL_AUTOTICKS)
|
|
||||||
sliderBreadth = wxSLIDER_DIMENSIONACROSS_WITHTICKMARKS;
|
|
||||||
else
|
|
||||||
sliderBreadth = wxSLIDER_DIMENSIONACROSS_ARROW;
|
|
||||||
|
|
||||||
if (GetWindowStyle() & wxSL_VERTICAL)
|
|
||||||
{
|
|
||||||
h = h - yborder;
|
|
||||||
|
|
||||||
if ( m_macMinimumStatic )
|
|
||||||
m_macMinimumStatic->Move(GetPosition().x + sliderBreadth + wxSLIDER_BORDERTEXT, GetPosition().y + h - yborder);
|
|
||||||
if ( m_macMaximumStatic )
|
|
||||||
m_macMaximumStatic->Move(GetPosition().x + sliderBreadth + wxSLIDER_BORDERTEXT, GetPosition().y + 0);
|
|
||||||
if ( m_macValueStatic )
|
|
||||||
m_macValueStatic->Move(GetPosition().x + sliderBreadth + wxSLIDER_BORDERTEXT, GetPosition().y + (h / 2) - (ht / 2));
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
if ( m_macMinimumStatic )
|
|
||||||
m_macMinimumStatic->Move(GetPosition().x, GetPosition().y + sliderBreadth + wxSLIDER_BORDERTEXT);
|
|
||||||
if ( m_macMaximumStatic )
|
|
||||||
m_macMaximumStatic->Move(GetPosition().x + w - maxValWidth, GetPosition().y + sliderBreadth + wxSLIDER_BORDERTEXT);
|
|
||||||
if ( m_macValueStatic )
|
|
||||||
m_macValueStatic->Move(GetPosition().x + (w / 2) - (valValWidth / 2), GetPosition().y + sliderBreadth + wxSLIDER_BORDERTEXT);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
// yet another hack since this is a composite control
|
|
||||||
// when wxSlider has it's size hardcoded, we're not allowed to
|
|
||||||
// change the size. But when the control has labels, we DO need
|
|
||||||
// to resize the internal Mac control to accommodate the text labels.
|
|
||||||
// We need to trick the wxWidgets resize mechanism so that we can
|
|
||||||
// resize the slider part of the control ONLY.
|
|
||||||
|
|
||||||
// TODO: Can all of this code go in the conditional wxSL_LABELS block?
|
|
||||||
|
|
||||||
int minWidth = m_minWidth;
|
|
||||||
|
|
||||||
if (GetWindowStyle() & wxSL_LABELS)
|
|
||||||
{
|
|
||||||
// make sure we don't allow the entire control to be resized accidently
|
|
||||||
if (width == GetSize().x)
|
|
||||||
m_minWidth = -1;
|
|
||||||
}
|
|
||||||
|
|
||||||
// If the control has labels, we still need to call this again because
|
|
||||||
// the labels alter the control's w and h values.
|
|
||||||
wxControl::DoSetSize( x, y, w, h, sizeFlags );
|
|
||||||
|
|
||||||
m_minWidth = minWidth;
|
|
||||||
}
|
|
||||||
|
|
||||||
void wxSlider::DoMoveWindow(int x, int y, int width, int height)
|
|
||||||
{
|
|
||||||
wxControl::DoMoveWindow( x, y, width, height );
|
|
||||||
}
|
|
||||||
|
|
||||||
// Common processing to invert slider values based on wxSL_INVERSE
|
|
||||||
int wxSlider::ValueInvertOrNot(int value) const
|
|
||||||
{
|
|
||||||
int result = 0;
|
|
||||||
|
|
||||||
if (m_windowStyle & wxSL_VERTICAL)
|
|
||||||
{
|
|
||||||
// The reason for the backwards logic is that Mac's vertical sliders are
|
|
||||||
// inverted compared to Windows and GTK, hence we want inversion to be the
|
|
||||||
// default, and if wxSL_INVERSE is set, then we do not invert (use native)
|
|
||||||
if (m_windowStyle & wxSL_INVERSE)
|
|
||||||
result = value;
|
|
||||||
else
|
|
||||||
result = (m_rangeMax + m_rangeMin) - value;
|
|
||||||
}
|
|
||||||
else // normal logic applies to HORIZONTAL sliders
|
|
||||||
{
|
|
||||||
result = wxSliderBase::ValueInvertOrNot(value);
|
|
||||||
}
|
|
||||||
|
|
||||||
return result;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
#endif // wxUSE_SLIDER
|
#endif // wxUSE_SLIDER
|
||||||
|
@@ -1,5 +1,5 @@
|
|||||||
/////////////////////////////////////////////////////////////////////////////
|
/////////////////////////////////////////////////////////////////////////////
|
||||||
// Name: src/mac/carbon/sound.cpp
|
// Name: src/osx/carbon/sound.cpp
|
||||||
// Purpose: wxSound class implementation: optional
|
// Purpose: wxSound class implementation: optional
|
||||||
// Author: Ryan Norton
|
// Author: Ryan Norton
|
||||||
// Modified by: Stefan Csomor
|
// Modified by: Stefan Csomor
|
||||||
|
@@ -14,195 +14,101 @@
|
|||||||
#if wxUSE_SPINBTN
|
#if wxUSE_SPINBTN
|
||||||
|
|
||||||
#include "wx/spinbutt.h"
|
#include "wx/spinbutt.h"
|
||||||
#include "wx/osx/uma.h"
|
#include "wx/osx/private.h"
|
||||||
|
|
||||||
|
|
||||||
IMPLEMENT_DYNAMIC_CLASS(wxSpinButton, wxControl)
|
wxWidgetImplType* wxWidgetImpl::CreateSpinButton( wxWindowMac* wxpeer,
|
||||||
IMPLEMENT_DYNAMIC_CLASS(wxSpinEvent, wxScrollEvent)
|
wxWindowMac* parent,
|
||||||
|
wxWindowID id,
|
||||||
|
wxInt32 value,
|
||||||
wxSpinButton::wxSpinButton()
|
wxInt32 minimum,
|
||||||
: wxSpinButtonBase()
|
wxInt32 maximum,
|
||||||
|
const wxPoint& pos,
|
||||||
|
const wxSize& size,
|
||||||
|
long style,
|
||||||
|
long extraStyle)
|
||||||
{
|
{
|
||||||
}
|
Rect bounds = wxMacGetBoundsForControl( wxpeer , pos , size );
|
||||||
|
|
||||||
bool wxSpinButton::Create( wxWindow *parent,
|
wxMacControl* peer = new wxMacControl( wxpeer );
|
||||||
wxWindowID id, const wxPoint& pos, const wxSize& size,
|
|
||||||
long style, const wxString& name )
|
|
||||||
{
|
|
||||||
m_macIsUserPane = false;
|
|
||||||
|
|
||||||
if ( !wxSpinButtonBase::Create( parent, id, pos, size, style, wxDefaultValidator, name ) )
|
|
||||||
return false;
|
|
||||||
|
|
||||||
m_min = 0;
|
|
||||||
m_max = 100;
|
|
||||||
|
|
||||||
if (!parent)
|
|
||||||
return false;
|
|
||||||
|
|
||||||
Rect bounds = wxMacGetBoundsForControl( this , pos , size );
|
|
||||||
|
|
||||||
m_peer = new wxMacControl( this );
|
|
||||||
OSStatus err = CreateLittleArrowsControl(
|
OSStatus err = CreateLittleArrowsControl(
|
||||||
MAC_WXHWND(parent->MacGetTopLevelWindowRef()), &bounds, 0, m_min, m_max, 1,
|
MAC_WXHWND(parent->MacGetTopLevelWindowRef()), &bounds, value,
|
||||||
m_peer->GetControlRefAddr() );
|
minimum, maximum, 1, peer->GetControlRefAddr() );
|
||||||
verify_noerr( err );
|
verify_noerr( err );
|
||||||
|
|
||||||
m_peer->SetActionProc( GetwxMacLiveScrollbarActionProc() );
|
peer->SetActionProc( GetwxMacLiveScrollbarActionProc() );
|
||||||
MacPostControlCreate( pos, size );
|
return peer ;
|
||||||
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
|
|
||||||
wxSpinButton::~wxSpinButton()
|
|
||||||
{
|
|
||||||
}
|
|
||||||
|
|
||||||
int wxSpinButton::GetMin() const
|
|
||||||
{
|
|
||||||
return m_min;
|
|
||||||
}
|
|
||||||
|
|
||||||
int wxSpinButton::GetMax() const
|
|
||||||
{
|
|
||||||
return m_max;
|
|
||||||
}
|
|
||||||
|
|
||||||
int wxSpinButton::GetValue() const
|
|
||||||
{
|
|
||||||
int n = m_value;
|
|
||||||
|
|
||||||
if (n < m_min)
|
|
||||||
n = m_min;
|
|
||||||
else if (n > m_max)
|
|
||||||
n = m_max;
|
|
||||||
|
|
||||||
return n;
|
|
||||||
}
|
|
||||||
|
|
||||||
void wxSpinButton::SetValue(int val)
|
|
||||||
{
|
|
||||||
m_value = val;
|
|
||||||
}
|
|
||||||
|
|
||||||
void wxSpinButton::SetRange(int minVal, int maxVal)
|
|
||||||
{
|
|
||||||
m_min = minVal;
|
|
||||||
m_max = maxVal;
|
|
||||||
m_peer->SetMaximum( maxVal );
|
|
||||||
m_peer->SetMinimum( minVal );
|
|
||||||
}
|
|
||||||
|
|
||||||
void wxSpinButton::MacHandleValueChanged( int inc )
|
|
||||||
{
|
|
||||||
wxEventType scrollEvent = wxEVT_NULL;
|
|
||||||
int oldValue = m_value;
|
|
||||||
|
|
||||||
m_value = oldValue + inc;
|
|
||||||
|
|
||||||
if (m_value < m_min)
|
|
||||||
{
|
|
||||||
if ( m_windowStyle & wxSP_WRAP )
|
|
||||||
m_value = m_max;
|
|
||||||
else
|
|
||||||
m_value = m_min;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (m_value > m_max)
|
|
||||||
{
|
|
||||||
if ( m_windowStyle & wxSP_WRAP )
|
|
||||||
m_value = m_min;
|
|
||||||
else
|
|
||||||
m_value = m_max;
|
|
||||||
}
|
|
||||||
|
|
||||||
if ( m_value - oldValue == -1 )
|
|
||||||
scrollEvent = wxEVT_SCROLL_LINEDOWN;
|
|
||||||
else if ( m_value - oldValue == 1 )
|
|
||||||
scrollEvent = wxEVT_SCROLL_LINEUP;
|
|
||||||
else
|
|
||||||
scrollEvent = wxEVT_SCROLL_THUMBTRACK;
|
|
||||||
|
|
||||||
// Do not send an event if the value has not actually changed
|
|
||||||
// (Also works for wxSpinCtrl)
|
|
||||||
if ( m_value == oldValue )
|
|
||||||
return;
|
|
||||||
|
|
||||||
wxSpinEvent event( scrollEvent, m_windowId );
|
|
||||||
|
|
||||||
event.SetPosition( m_value );
|
|
||||||
event.SetEventObject( this );
|
|
||||||
if ((HandleWindowEvent( event )) && !event.IsAllowed())
|
|
||||||
m_value = oldValue;
|
|
||||||
|
|
||||||
m_peer->SetValue( m_value );
|
|
||||||
|
|
||||||
// always send a thumbtrack event
|
|
||||||
if (scrollEvent != wxEVT_SCROLL_THUMBTRACK)
|
|
||||||
{
|
|
||||||
scrollEvent = wxEVT_SCROLL_THUMBTRACK;
|
|
||||||
wxSpinEvent event2( scrollEvent, GetId() );
|
|
||||||
event2.SetPosition( m_value );
|
|
||||||
event2.SetEventObject( this );
|
|
||||||
HandleWindowEvent( event2 );
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void wxSpinButton::MacHandleControlClick(WXWidget WXUNUSED(control),
|
void wxSpinButton::MacHandleControlClick(WXWidget WXUNUSED(control),
|
||||||
wxInt16 controlpart,
|
wxInt16 controlpart,
|
||||||
bool WXUNUSED(mouseStillDown))
|
bool WXUNUSED(mouseStillDown))
|
||||||
{
|
{
|
||||||
int nScrollInc = 0;
|
int inc = 0;
|
||||||
|
|
||||||
switch ( controlpart )
|
switch ( controlpart )
|
||||||
{
|
{
|
||||||
case kControlUpButtonPart :
|
case kControlUpButtonPart :
|
||||||
nScrollInc = 1;
|
inc = 1;
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case kControlDownButtonPart :
|
case kControlDownButtonPart :
|
||||||
nScrollInc = -1;
|
inc = -1;
|
||||||
break;
|
break;
|
||||||
|
|
||||||
default:
|
default:
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
MacHandleValueChanged( nScrollInc ) ;
|
// trigger scroll events
|
||||||
}
|
|
||||||
|
|
||||||
wxInt32 wxSpinButton::MacControlHit(WXEVENTHANDLERREF WXUNUSED(handler),
|
wxEventType scrollEvent = wxEVT_NULL;
|
||||||
WXEVENTREF WXUNUSED(event))
|
int oldValue = GetValue() ;
|
||||||
{
|
|
||||||
#if 0
|
|
||||||
// these have been handled by the live action proc already
|
|
||||||
int nScrollInc = 0;
|
|
||||||
wxMacCarbonEvent cEvent( (EventRef)event );
|
|
||||||
|
|
||||||
switch ( cEvent.GetParameter<ControlPartCode>(kEventParamControlPart, typeControlPartCode) )
|
int newValue = oldValue + inc;
|
||||||
|
|
||||||
|
if (newValue < m_min)
|
||||||
{
|
{
|
||||||
case kControlUpButtonPart :
|
if ( m_windowStyle & wxSP_WRAP )
|
||||||
nScrollInc = 1;
|
newValue = m_max;
|
||||||
break;
|
else
|
||||||
|
newValue = m_min;
|
||||||
case kControlDownButtonPart :
|
|
||||||
nScrollInc = -1;
|
|
||||||
break;
|
|
||||||
|
|
||||||
default :
|
|
||||||
break;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
MacHandleValueChanged( nScrollInc ) ;
|
if (newValue > m_max)
|
||||||
#endif
|
{
|
||||||
|
if ( m_windowStyle & wxSP_WRAP )
|
||||||
|
newValue = m_min;
|
||||||
|
else
|
||||||
|
newValue = m_max;
|
||||||
|
}
|
||||||
|
|
||||||
return noErr;
|
if ( newValue - oldValue == -1 )
|
||||||
}
|
scrollEvent = wxEVT_SCROLL_LINEDOWN;
|
||||||
|
else if ( newValue - oldValue == 1 )
|
||||||
|
scrollEvent = wxEVT_SCROLL_LINEUP;
|
||||||
|
else
|
||||||
|
scrollEvent = wxEVT_SCROLL_THUMBTRACK;
|
||||||
|
|
||||||
wxSize wxSpinButton::DoGetBestSize() const
|
// Do not send an event if the value has not actually changed
|
||||||
{
|
// (Also works for wxSpinCtrl)
|
||||||
return wxSize( 16, 24 );
|
if ( newValue == oldValue )
|
||||||
|
return;
|
||||||
|
|
||||||
|
if ( scrollEvent != wxEVT_SCROLL_THUMBTRACK )
|
||||||
|
{
|
||||||
|
wxSpinEvent event( scrollEvent, m_windowId );
|
||||||
|
|
||||||
|
event.SetPosition( newValue );
|
||||||
|
event.SetEventObject( this );
|
||||||
|
if ((HandleWindowEvent( event )) && !event.IsAllowed())
|
||||||
|
newValue = oldValue;
|
||||||
|
}
|
||||||
|
|
||||||
|
m_peer->SetValue( newValue );
|
||||||
|
|
||||||
|
// always send a thumbtrack event
|
||||||
|
SendThumbTrackEvent() ;
|
||||||
}
|
}
|
||||||
|
|
||||||
#endif // wxUSE_SPINBTN
|
#endif // wxUSE_SPINBTN
|
||||||
|
@@ -1,5 +1,5 @@
|
|||||||
///////////////////////////////////////////////////////////////////////////////
|
///////////////////////////////////////////////////////////////////////////////
|
||||||
// Name: src/mac/carbon/srchctrl.cpp
|
// Name: src/osx/carbon/srchctrl.cpp
|
||||||
// Purpose: implements mac carbon wxSearchCtrl
|
// Purpose: implements mac carbon wxSearchCtrl
|
||||||
// Author: Vince Harron
|
// Author: Vince Harron
|
||||||
// Created: 2006-02-19
|
// Created: 2006-02-19
|
||||||
|
@@ -1,5 +1,5 @@
|
|||||||
/////////////////////////////////////////////////////////////////////////////
|
/////////////////////////////////////////////////////////////////////////////
|
||||||
// Name: src/mac/carbon/statbmp.cpp
|
// Name: src/osx/carbon/statbmp.cpp
|
||||||
// Purpose: wxStaticBitmap
|
// Purpose: wxStaticBitmap
|
||||||
// Author: Stefan Csomor
|
// Author: Stefan Csomor
|
||||||
// Modified by:
|
// Modified by:
|
||||||
|
@@ -1,5 +1,5 @@
|
|||||||
/////////////////////////////////////////////////////////////////////////////
|
/////////////////////////////////////////////////////////////////////////////
|
||||||
// Name: statbox.cpp
|
// Name: src/osx/carbon/statbox.cpp
|
||||||
// Purpose: wxStaticBox
|
// Purpose: wxStaticBox
|
||||||
// Author: Stefan Csomor
|
// Author: Stefan Csomor
|
||||||
// Modified by:
|
// Modified by:
|
||||||
@@ -14,63 +14,25 @@
|
|||||||
#if wxUSE_STATBOX
|
#if wxUSE_STATBOX
|
||||||
|
|
||||||
#include "wx/statbox.h"
|
#include "wx/statbox.h"
|
||||||
#include "wx/osx/uma.h"
|
#include "wx/osx/private.h"
|
||||||
|
|
||||||
IMPLEMENT_DYNAMIC_CLASS(wxStaticBox, wxControl)
|
wxWidgetImplType* wxWidgetImpl::CreateGroupBox( wxWindowMac* wxpeer,
|
||||||
|
wxWindowMac* parent,
|
||||||
|
wxWindowID id,
|
||||||
bool wxStaticBox::Create( wxWindow *parent,
|
const wxString& label,
|
||||||
wxWindowID id,
|
const wxPoint& pos,
|
||||||
const wxString& label,
|
const wxSize& size,
|
||||||
const wxPoint& pos,
|
long style,
|
||||||
const wxSize& size,
|
long extraStyle)
|
||||||
long style,
|
|
||||||
const wxString& name )
|
|
||||||
{
|
{
|
||||||
m_macIsUserPane = false;
|
Rect bounds = wxMacGetBoundsForControl( wxpeer, pos, size );
|
||||||
|
|
||||||
if ( !wxControl::Create( parent, id, pos, size, style, wxDefaultValidator, name ) )
|
wxMacControl* peer = new wxMacControl( wxpeer );
|
||||||
return false;
|
|
||||||
|
|
||||||
m_labelOrig = m_label = label;
|
|
||||||
|
|
||||||
Rect bounds = wxMacGetBoundsForControl( this, pos, size );
|
|
||||||
|
|
||||||
m_peer = new wxMacControl( this );
|
|
||||||
OSStatus err = CreateGroupBoxControl(
|
OSStatus err = CreateGroupBoxControl(
|
||||||
MAC_WXHWND(parent->MacGetTopLevelWindowRef()), &bounds, CFSTR(""),
|
MAC_WXHWND(parent->MacGetTopLevelWindowRef()), &bounds, CFSTR(""),
|
||||||
true /*primary*/, m_peer->GetControlRefAddr() );
|
true /*primary*/, peer->GetControlRefAddr() );
|
||||||
verify_noerr( err );
|
verify_noerr( err );
|
||||||
|
return peer;
|
||||||
MacPostControlCreate( pos, size );
|
|
||||||
|
|
||||||
return true;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void wxStaticBox::GetBordersForSizer(int *borderTop, int *borderOther) const
|
|
||||||
{
|
|
||||||
static int extraTop = -1; // Uninitted
|
|
||||||
static int other = 5;
|
|
||||||
|
|
||||||
if ( extraTop == -1 )
|
|
||||||
{
|
|
||||||
// The minimal border used for the top.
|
|
||||||
// Later on, the staticbox's font height is added to this.
|
|
||||||
extraTop = 0;
|
|
||||||
|
|
||||||
// As indicated by the HIG, Panther needs an extra border of 11
|
|
||||||
// pixels (otherwise overlapping occurs at the top). The "other"
|
|
||||||
// border has to be 11.
|
|
||||||
extraTop = 11;
|
|
||||||
other = 11;
|
|
||||||
}
|
|
||||||
|
|
||||||
*borderTop = extraTop;
|
|
||||||
if ( !m_label.empty() )
|
|
||||||
*borderTop += GetCharHeight();
|
|
||||||
|
|
||||||
*borderOther = other;
|
|
||||||
}
|
|
||||||
|
|
||||||
#endif // wxUSE_STATBOX
|
#endif // wxUSE_STATBOX
|
||||||
|
|
||||||
|
@@ -1,5 +1,5 @@
|
|||||||
///////////////////////////////////////////////////////////////////////////////
|
///////////////////////////////////////////////////////////////////////////////
|
||||||
// Name: src/mac/carbon/statbarma.cpp
|
// Name: src/osx/carbon/statbarma.cpp
|
||||||
// Purpose: native implementation of wxStatusBar (optional)
|
// Purpose: native implementation of wxStatusBar (optional)
|
||||||
// Author: Stefan Csomor
|
// Author: Stefan Csomor
|
||||||
// Modified by:
|
// Modified by:
|
||||||
|
@@ -1,5 +1,5 @@
|
|||||||
/////////////////////////////////////////////////////////////////////////////
|
/////////////////////////////////////////////////////////////////////////////
|
||||||
// Name: src/mac/carbon/statlmac.cpp
|
// Name: src/osx/carbon/statlmac.cpp
|
||||||
// Purpose: a generic wxStaticLine class
|
// Purpose: a generic wxStaticLine class
|
||||||
// Author: Vadim Zeitlin
|
// Author: Vadim Zeitlin
|
||||||
// Created: 28.06.99
|
// Created: 28.06.99
|
||||||
@@ -31,38 +31,24 @@
|
|||||||
#include "wx/statbox.h"
|
#include "wx/statbox.h"
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#include "wx/osx/uma.h"
|
#include "wx/osx/private.h"
|
||||||
|
|
||||||
// ============================================================================
|
// ============================================================================
|
||||||
// implementation
|
// implementation
|
||||||
// ============================================================================
|
// ============================================================================
|
||||||
|
|
||||||
IMPLEMENT_DYNAMIC_CLASS(wxStaticLine, wxControl)
|
wxWidgetImplType* wxWidgetImpl::CreateStaticLine( wxWindowMac* wxpeer,
|
||||||
|
wxWindowMac* parent,
|
||||||
// ----------------------------------------------------------------------------
|
wxWindowID id,
|
||||||
// wxStaticLine
|
const wxPoint& pos,
|
||||||
// ----------------------------------------------------------------------------
|
const wxSize& size,
|
||||||
|
long style,
|
||||||
bool wxStaticLine::Create( wxWindow *parent,
|
long extraStyle)
|
||||||
wxWindowID id,
|
|
||||||
const wxPoint &pos,
|
|
||||||
const wxSize &size,
|
|
||||||
long style,
|
|
||||||
const wxString &name)
|
|
||||||
{
|
{
|
||||||
m_macIsUserPane = false ;
|
Rect bounds = wxMacGetBoundsForControl( wxpeer , pos , size ) ;
|
||||||
|
wxMacControl* peer = new wxMacControl(wxpeer) ;
|
||||||
if ( !wxStaticLineBase::Create(parent, id, pos, size,
|
verify_noerr(CreateSeparatorControl(MAC_WXHWND(parent->MacGetTopLevelWindowRef()),&bounds, peer->GetControlRefAddr() ) ) ;
|
||||||
style, wxDefaultValidator, name) )
|
return peer;
|
||||||
return false;
|
|
||||||
|
|
||||||
Rect bounds = wxMacGetBoundsForControl( this , pos , size ) ;
|
|
||||||
m_peer = new wxMacControl(this) ;
|
|
||||||
verify_noerr(CreateSeparatorControl(MAC_WXHWND(parent->MacGetTopLevelWindowRef()),&bounds, m_peer->GetControlRefAddr() ) ) ;
|
|
||||||
|
|
||||||
MacPostControlCreate(pos,size) ;
|
|
||||||
|
|
||||||
return true;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
#endif //wxUSE_STATLINE
|
#endif //wxUSE_STATLINE
|
||||||
|
@@ -1,5 +1,5 @@
|
|||||||
/////////////////////////////////////////////////////////////////////////////
|
/////////////////////////////////////////////////////////////////////////////
|
||||||
// Name: src/mac/carbon/stattext.cpp
|
// Name: src/osx/carbon/stattext.cpp
|
||||||
// Purpose: wxStaticText
|
// Purpose: wxStaticText
|
||||||
// Author: Stefan Csomor
|
// Author: Stefan Csomor
|
||||||
// Modified by:
|
// Modified by:
|
||||||
@@ -26,55 +26,29 @@
|
|||||||
#include "wx/notebook.h"
|
#include "wx/notebook.h"
|
||||||
#include "wx/tabctrl.h"
|
#include "wx/tabctrl.h"
|
||||||
|
|
||||||
#include "wx/osx/uma.h"
|
#include "wx/osx/private.h"
|
||||||
|
|
||||||
#include <stdio.h>
|
#include <stdio.h>
|
||||||
|
|
||||||
IMPLEMENT_DYNAMIC_CLASS(wxStaticText, wxControl)
|
class wxMacStaticText : public wxMacControl
|
||||||
|
|
||||||
|
|
||||||
bool wxStaticText::Create( wxWindow *parent,
|
|
||||||
wxWindowID id,
|
|
||||||
const wxString& label,
|
|
||||||
const wxPoint& pos,
|
|
||||||
const wxSize& size,
|
|
||||||
long style,
|
|
||||||
const wxString& name )
|
|
||||||
{
|
{
|
||||||
m_macIsUserPane = false;
|
public:
|
||||||
|
wxMacStaticText( wxWindowMac* peer ) : wxMacControl(peer)
|
||||||
if ( !wxControl::Create( parent, id, pos, size, style, wxDefaultValidator, name ) )
|
|
||||||
return false;
|
|
||||||
|
|
||||||
Rect bounds = wxMacGetBoundsForControl( this, pos, size );
|
|
||||||
|
|
||||||
m_peer = new wxMacControl( this );
|
|
||||||
OSStatus err = CreateStaticTextControl(
|
|
||||||
MAC_WXHWND(parent->MacGetTopLevelWindowRef()),
|
|
||||||
&bounds, NULL, NULL, m_peer->GetControlRefAddr() );
|
|
||||||
verify_noerr( err );
|
|
||||||
|
|
||||||
if ( ( style & wxST_ELLIPSIZE_END ) || ( style & wxST_ELLIPSIZE_MIDDLE ) )
|
|
||||||
{
|
{
|
||||||
TruncCode tCode = truncEnd;
|
|
||||||
if ( style & wxST_ELLIPSIZE_MIDDLE )
|
|
||||||
tCode = truncMiddle;
|
|
||||||
|
|
||||||
err = m_peer->SetData( kControlStaticTextTruncTag, tCode );
|
|
||||||
err = m_peer->SetData( kControlStaticTextIsMultilineTag, (Boolean)0 );
|
|
||||||
}
|
}
|
||||||
|
void SetLabel(const wxString& title, wxFontEncoding encoding)
|
||||||
MacPostControlCreate( pos, size );
|
{
|
||||||
|
wxCFStringRef str( title, encoding );
|
||||||
SetLabel(label);
|
OSStatus err = SetData<CFStringRef>(kControlEntireControl, kControlStaticTextCFStringTag, str);
|
||||||
|
verify_noerr( err );
|
||||||
return true;
|
}
|
||||||
}
|
};
|
||||||
|
|
||||||
wxSize wxStaticText::DoGetBestSize() const
|
wxSize wxStaticText::DoGetBestSize() const
|
||||||
{
|
{
|
||||||
Rect bestsize = { 0 , 0 , 0 , 0 } ;
|
|
||||||
Point bounds;
|
Point bounds;
|
||||||
|
#if wxOSX_USE_CARBON
|
||||||
|
Rect bestsize = { 0 , 0 , 0 , 0 } ;
|
||||||
|
|
||||||
// try the built-in best size if available
|
// try the built-in best size if available
|
||||||
Boolean former = m_peer->GetData<Boolean>( kControlStaticTextIsMultilineTag);
|
Boolean former = m_peer->GetData<Boolean>( kControlStaticTextIsMultilineTag);
|
||||||
@@ -87,7 +61,9 @@ wxSize wxStaticText::DoGetBestSize() const
|
|||||||
bounds.v = bestsize.bottom - bestsize.top ;
|
bounds.v = bestsize.bottom - bestsize.top ;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
|
#endif
|
||||||
{
|
{
|
||||||
|
#if wxOSX_USE_CARBON
|
||||||
ControlFontStyleRec controlFont;
|
ControlFontStyleRec controlFont;
|
||||||
OSStatus err = m_peer->GetData<ControlFontStyleRec>( kControlEntireControl, kControlFontStyleTag, &controlFont );
|
OSStatus err = m_peer->GetData<ControlFontStyleRec>( kControlEntireControl, kControlFontStyleTag, &controlFont );
|
||||||
verify_noerr( err );
|
verify_noerr( err );
|
||||||
@@ -104,6 +80,7 @@ wxSize wxStaticText::DoGetBestSize() const
|
|||||||
verify_noerr( err );
|
verify_noerr( err );
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
|
#endif
|
||||||
#endif
|
#endif
|
||||||
{
|
{
|
||||||
wxClientDC dc(const_cast<wxStaticText*>(this));
|
wxClientDC dc(const_cast<wxStaticText*>(this));
|
||||||
@@ -122,76 +99,38 @@ wxSize wxStaticText::DoGetBestSize() const
|
|||||||
return wxSize( bounds.h, bounds.v );
|
return wxSize( bounds.h, bounds.v );
|
||||||
}
|
}
|
||||||
|
|
||||||
void wxStaticText::SetLabel(const wxString& label)
|
|
||||||
{
|
|
||||||
m_labelOrig = label;
|
|
||||||
|
|
||||||
// middle/end ellipsization is handled by the OS:
|
|
||||||
if ( HasFlag(wxST_ELLIPSIZE_END) || HasFlag(wxST_ELLIPSIZE_MIDDLE) )
|
|
||||||
{
|
|
||||||
// remove markup
|
|
||||||
wxString str(label);
|
|
||||||
if (HasFlag(wxST_MARKUP))
|
|
||||||
str = RemoveMarkup(label);
|
|
||||||
|
|
||||||
// and leave ellipsization to the OS
|
|
||||||
DoSetLabel(str);
|
|
||||||
}
|
|
||||||
else // not supported natively
|
|
||||||
{
|
|
||||||
DoSetLabel(GetEllipsizedLabelWithoutMarkup());
|
|
||||||
}
|
|
||||||
|
|
||||||
if ( !(GetWindowStyle() & wxST_NO_AUTORESIZE) &&
|
|
||||||
!IsEllipsized() ) // don't resize if we adjust to current size
|
|
||||||
{
|
|
||||||
InvalidateBestSize();
|
|
||||||
SetSize( GetBestSize() );
|
|
||||||
}
|
|
||||||
|
|
||||||
Refresh();
|
|
||||||
|
|
||||||
// we shouldn't need forced updates
|
|
||||||
// Update();
|
|
||||||
}
|
|
||||||
|
|
||||||
bool wxStaticText::SetFont(const wxFont& font)
|
|
||||||
{
|
|
||||||
bool ret = wxControl::SetFont( font );
|
|
||||||
|
|
||||||
if ( ret )
|
|
||||||
{
|
|
||||||
if ( !(GetWindowStyle() & wxST_NO_AUTORESIZE) )
|
|
||||||
{
|
|
||||||
InvalidateBestSize();
|
|
||||||
SetSize( GetBestSize() );
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
return ret;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
// for wxST_ELLIPSIZE_* support:
|
|
||||||
|
|
||||||
void wxStaticText::DoSetLabel(const wxString& label)
|
|
||||||
{
|
|
||||||
m_labelOrig = label;
|
|
||||||
m_label = RemoveMnemonics(label);
|
|
||||||
|
|
||||||
wxCFStringRef str( m_label, GetFont().GetEncoding() );
|
|
||||||
OSStatus err = m_peer->SetData<CFStringRef>(kControlEntireControl, kControlStaticTextCFStringTag, str);
|
|
||||||
verify_noerr( err );
|
|
||||||
}
|
|
||||||
|
|
||||||
wxString wxStaticText::DoGetLabel() const
|
|
||||||
{
|
|
||||||
return m_label;
|
|
||||||
}
|
|
||||||
|
|
||||||
/*
|
/*
|
||||||
FIXME: UpdateLabel() should be called on size events when wxST_ELLIPSIZE_START is set
|
FIXME: UpdateLabel() should be called on size events when wxST_ELLIPSIZE_START is set
|
||||||
to allow correct dynamic ellipsizing of the label
|
to allow correct dynamic ellipsizing of the label
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
wxWidgetImplType* wxWidgetImpl::CreateStaticText( wxWindowMac* wxpeer,
|
||||||
|
wxWindowMac* parent,
|
||||||
|
wxWindowID id,
|
||||||
|
const wxString& label,
|
||||||
|
const wxPoint& pos,
|
||||||
|
const wxSize& size,
|
||||||
|
long style,
|
||||||
|
long extraStyle)
|
||||||
|
{
|
||||||
|
Rect bounds = wxMacGetBoundsForControl( wxpeer, pos, size );
|
||||||
|
|
||||||
|
wxMacControl* peer = new wxMacStaticText( wxpeer );
|
||||||
|
OSStatus err = CreateStaticTextControl(
|
||||||
|
MAC_WXHWND(parent->MacGetTopLevelWindowRef()),
|
||||||
|
&bounds, NULL, NULL, peer->GetControlRefAddr() );
|
||||||
|
verify_noerr( err );
|
||||||
|
|
||||||
|
if ( ( style & wxST_ELLIPSIZE_END ) || ( style & wxST_ELLIPSIZE_MIDDLE ) )
|
||||||
|
{
|
||||||
|
TruncCode tCode = truncEnd;
|
||||||
|
if ( style & wxST_ELLIPSIZE_MIDDLE )
|
||||||
|
tCode = truncMiddle;
|
||||||
|
|
||||||
|
err = peer->SetData( kControlStaticTextTruncTag, tCode );
|
||||||
|
err = peer->SetData( kControlStaticTextIsMultilineTag, (Boolean)0 );
|
||||||
|
}
|
||||||
|
return peer;
|
||||||
|
}
|
||||||
|
|
||||||
#endif //if wxUSE_STATTEXT
|
#endif //if wxUSE_STATTEXT
|
||||||
|
@@ -1,5 +1,5 @@
|
|||||||
/////////////////////////////////////////////////////////////////////////////
|
/////////////////////////////////////////////////////////////////////////////
|
||||||
// Name: src/mac/carbon/tabctrl.cpp
|
// Name: src/osx/carbon/tabctrl.cpp
|
||||||
// Purpose: wxTabCtrl
|
// Purpose: wxTabCtrl
|
||||||
// Author: Stefan Csomor
|
// Author: Stefan Csomor
|
||||||
// Modified by:
|
// Modified by:
|
||||||
@@ -13,190 +13,6 @@
|
|||||||
|
|
||||||
#if wxUSE_TAB_DIALOG
|
#if wxUSE_TAB_DIALOG
|
||||||
|
|
||||||
#include "wx/tabctrl.h"
|
// superseeded by wxNotebook implementation, skeleton moved to src/osx/
|
||||||
|
|
||||||
#ifndef WX_PRECOMP
|
|
||||||
#include "wx/control.h"
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#include "wx/osx/uma.h"
|
|
||||||
|
|
||||||
IMPLEMENT_DYNAMIC_CLASS(wxTabCtrl, wxControl)
|
|
||||||
IMPLEMENT_DYNAMIC_CLASS(wxTabEvent, wxNotifyEvent)
|
|
||||||
|
|
||||||
DEFINE_EVENT_TYPE(wxEVT_COMMAND_TAB_SEL_CHANGED)
|
|
||||||
DEFINE_EVENT_TYPE(wxEVT_COMMAND_TAB_SEL_CHANGING)
|
|
||||||
|
|
||||||
|
|
||||||
BEGIN_EVENT_TABLE(wxTabCtrl, wxControl)
|
|
||||||
END_EVENT_TABLE()
|
|
||||||
|
|
||||||
|
|
||||||
wxTabCtrl::wxTabCtrl()
|
|
||||||
{
|
|
||||||
m_macIsUserPane = false;
|
|
||||||
m_imageList = NULL;
|
|
||||||
}
|
|
||||||
|
|
||||||
bool wxTabCtrl::Create( wxWindow *parent,
|
|
||||||
wxWindowID id, const wxPoint& pos, const wxSize& size,
|
|
||||||
long style, const wxString& name )
|
|
||||||
{
|
|
||||||
m_macIsUserPane = false;
|
|
||||||
m_imageList = NULL;
|
|
||||||
|
|
||||||
if ( !wxControl::Create( parent, id, pos, size, style, wxDefaultValidator, name ) )
|
|
||||||
return false;
|
|
||||||
|
|
||||||
Rect bounds = wxMacGetBoundsForControl( this, pos, size );
|
|
||||||
|
|
||||||
UInt16 tabstyle = kControlTabDirectionNorth;
|
|
||||||
ControlTabSize tabsize = kControlTabSizeLarge;
|
|
||||||
if ( GetWindowVariant() == wxWINDOW_VARIANT_SMALL )
|
|
||||||
tabsize = kControlTabSizeSmall ;
|
|
||||||
else if ( GetWindowVariant() == wxWINDOW_VARIANT_MINI )
|
|
||||||
{
|
|
||||||
tabsize = 3 ;
|
|
||||||
}
|
|
||||||
|
|
||||||
m_peer = new wxMacControl( this );
|
|
||||||
OSStatus err = CreateTabsControl(
|
|
||||||
MAC_WXHWND(parent->MacGetTopLevelWindowRef()), &bounds,
|
|
||||||
tabsize, tabstyle, 0, NULL, m_peer->GetControlRefAddr() );
|
|
||||||
verify_noerr( err );
|
|
||||||
|
|
||||||
MacPostControlCreate( pos, size );
|
|
||||||
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
|
|
||||||
wxTabCtrl::~wxTabCtrl()
|
|
||||||
{
|
|
||||||
}
|
|
||||||
|
|
||||||
void wxTabCtrl::Command(wxCommandEvent& event)
|
|
||||||
{
|
|
||||||
}
|
|
||||||
|
|
||||||
bool wxTabCtrl::DeleteAllItems()
|
|
||||||
{
|
|
||||||
// TODO:
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
|
|
||||||
bool wxTabCtrl::DeleteItem(int item)
|
|
||||||
{
|
|
||||||
// TODO:
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
|
|
||||||
int wxTabCtrl::GetSelection() const
|
|
||||||
{
|
|
||||||
// TODO:
|
|
||||||
return 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
// Get the tab with the current keyboard focus
|
|
||||||
//
|
|
||||||
int wxTabCtrl::GetCurFocus() const
|
|
||||||
{
|
|
||||||
// TODO:
|
|
||||||
return 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
wxImageList * wxTabCtrl::GetImageList() const
|
|
||||||
{
|
|
||||||
return m_imageList;
|
|
||||||
}
|
|
||||||
|
|
||||||
int wxTabCtrl::GetItemCount() const
|
|
||||||
{
|
|
||||||
// TODO:
|
|
||||||
return 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
// Get the rect corresponding to the tab
|
|
||||||
bool wxTabCtrl::GetItemRect(int item, wxRect& wxrect) const
|
|
||||||
{
|
|
||||||
// TODO:
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
|
|
||||||
int wxTabCtrl::GetRowCount() const
|
|
||||||
{
|
|
||||||
// TODO:
|
|
||||||
return 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
wxString wxTabCtrl::GetItemText(int item) const
|
|
||||||
{
|
|
||||||
// TODO:
|
|
||||||
return wxEmptyString;
|
|
||||||
}
|
|
||||||
|
|
||||||
int wxTabCtrl::GetItemImage(int item) const
|
|
||||||
{
|
|
||||||
// TODO:
|
|
||||||
return 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
void* wxTabCtrl::GetItemData(int item) const
|
|
||||||
{
|
|
||||||
// TODO:
|
|
||||||
return NULL;
|
|
||||||
}
|
|
||||||
|
|
||||||
int wxTabCtrl::HitTest(const wxPoint& pt, long& flags)
|
|
||||||
{
|
|
||||||
// TODO:
|
|
||||||
return 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
bool wxTabCtrl::InsertItem(int item, const wxString& text, int imageId, void* data)
|
|
||||||
{
|
|
||||||
// TODO:
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
|
|
||||||
int wxTabCtrl::SetSelection(int item)
|
|
||||||
{
|
|
||||||
// TODO:
|
|
||||||
return 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
void wxTabCtrl::SetImageList(wxImageList* imageList)
|
|
||||||
{
|
|
||||||
// TODO:
|
|
||||||
}
|
|
||||||
|
|
||||||
bool wxTabCtrl::SetItemText(int item, const wxString& text)
|
|
||||||
{
|
|
||||||
// TODO:
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
|
|
||||||
bool wxTabCtrl::SetItemImage(int item, int image)
|
|
||||||
{
|
|
||||||
// TODO:
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
|
|
||||||
bool wxTabCtrl::SetItemData(int item, void* data)
|
|
||||||
{
|
|
||||||
// TODO:
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
|
|
||||||
// Set the size for a fixed-width tab control
|
|
||||||
void wxTabCtrl::SetItemSize(const wxSize& size)
|
|
||||||
{
|
|
||||||
// TODO:
|
|
||||||
}
|
|
||||||
|
|
||||||
// Set the padding between tabs
|
|
||||||
void wxTabCtrl::SetPadding(const wxSize& padding)
|
|
||||||
{
|
|
||||||
// TODO:
|
|
||||||
}
|
|
||||||
|
|
||||||
#endif // wxUSE_TAB_DIALOG
|
#endif // wxUSE_TAB_DIALOG
|
||||||
|
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user