removing 'old' cocoa port
git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@76735 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
This commit is contained in:
@@ -1,67 +0,0 @@
|
||||
///////////////////////////////////////////////////////////////////////////////
|
||||
// Name: wx/cocoa/NSApplication.h
|
||||
// Purpose: wxNSApplicationDelegate definition
|
||||
// Author: David Elliott
|
||||
// Modified by:
|
||||
// Created: 2004/01/26
|
||||
// Copyright: (c) 2003,2004 David Elliott
|
||||
// Licence: wxWindows licence
|
||||
///////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
#ifndef _WX_COCOA_NSAPPLICATION_H__
|
||||
#define _WX_COCOA_NSAPPLICATION_H__
|
||||
|
||||
#include "wx/cocoa/objc/objc_uniquifying.h"
|
||||
|
||||
// ========================================================================
|
||||
// wxNSApplicationDelegate
|
||||
// ========================================================================
|
||||
/*!
|
||||
@class wxNSApplicationDelegate
|
||||
@discussion Implements an NSApplication delegate which can respond to messages sent by Cocoa to change Cocoa's behaviour.
|
||||
|
||||
wxCocoa will set a singleton instance of this class as the NSApplication delegate upon startup unless wxWidgets is running
|
||||
in a "plugin" manner in which case it would not be appropriate to do this.
|
||||
|
||||
Although Cocoa will send notifications to the delegate it is also possible to register a different object to listen for
|
||||
them. Because we want to support the plugin case, we use a separate notification observer object when we can.
|
||||
*/
|
||||
@interface wxNSApplicationDelegate : NSObject
|
||||
{
|
||||
}
|
||||
|
||||
// Delegate methods
|
||||
- (BOOL)applicationShouldTerminateAfterLastWindowClosed:(NSApplication *)theApplication;
|
||||
@end // interface wxNSApplicationDelegate : NSObject
|
||||
WX_DECLARE_GET_OBJC_CLASS(wxNSApplicationDelegate,NSObject)
|
||||
|
||||
// ========================================================================
|
||||
// wxNSApplicationObserver
|
||||
// ========================================================================
|
||||
/*!
|
||||
@class wxNSApplicationObserver
|
||||
@discussion Observes most notifications sent by the NSApplication singleton.
|
||||
|
||||
wxCocoa will create a singleton instance of this class upon startup and register it with the default notification center to
|
||||
listen for several events sent by the NSApplication singleton.
|
||||
|
||||
Because there can be any number of notification observers, this method allows wxCocoa to function properly even when it is
|
||||
running as a plugin of some other (most likely not wxWidgets) application.
|
||||
*/
|
||||
@interface wxNSApplicationObserver : NSObject
|
||||
{
|
||||
}
|
||||
|
||||
// Methods defined as (but not used here) as NSApplication delegate methods.
|
||||
- (void)applicationWillBecomeActive:(NSNotification *)notification;
|
||||
- (void)applicationDidBecomeActive:(NSNotification *)notification;
|
||||
- (void)applicationWillResignActive:(NSNotification *)notification;
|
||||
- (void)applicationDidResignActive:(NSNotification *)notification;
|
||||
- (void)applicationWillUpdate:(NSNotification *)notification;
|
||||
|
||||
// Other notifications
|
||||
- (void)controlTintChanged:(NSNotification *)notification;
|
||||
@end // interface wxNSApplicationObserver : NSObject
|
||||
WX_DECLARE_GET_OBJC_CLASS(wxNSApplicationObserver,NSObject)
|
||||
|
||||
#endif //ndef _WX_COCOA_NSAPPLICATION_H__
|
@@ -1,25 +0,0 @@
|
||||
///////////////////////////////////////////////////////////////////////////////
|
||||
// Name: wx/cocoa/NSBox.h
|
||||
// Purpose: wxCocoaNSBox class
|
||||
// Author: David Elliott
|
||||
// Modified by:
|
||||
// Created: 2003/03/19
|
||||
// Copyright: (c) 2003 David Elliott
|
||||
// Licence: wxWindows licence
|
||||
///////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
#ifndef __WX_COCOA_NSBOX_H__
|
||||
#define __WX_COCOA_NSBOX_H__
|
||||
|
||||
#include "wx/hashmap.h"
|
||||
#include "wx/cocoa/ObjcAssociate.h"
|
||||
|
||||
WX_DECLARE_OBJC_HASHMAP(NSBox);
|
||||
class wxCocoaNSBox
|
||||
{
|
||||
WX_DECLARE_OBJC_INTERFACE(NSBox)
|
||||
protected:
|
||||
// virtual void Cocoa_didChangeText(void) = 0;
|
||||
};
|
||||
|
||||
#endif // _WX_COCOA_NSBOX_H_
|
@@ -1,38 +0,0 @@
|
||||
///////////////////////////////////////////////////////////////////////////////
|
||||
// Name: wx/cocoa/NSButton.h
|
||||
// Purpose: wxCocoaNSButton class
|
||||
// Author: David Elliott
|
||||
// Modified by:
|
||||
// Created: 2002/12/09
|
||||
// Copyright: (c) 2002-2004 David Elliott
|
||||
// Licence: wxWindows licence
|
||||
///////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
#ifndef _WX_COCOA_NSBUTTON_H__
|
||||
#define _WX_COCOA_NSBUTTON_H__
|
||||
|
||||
#include "wx/hashmap.h"
|
||||
#include "wx/cocoa/ObjcAssociate.h"
|
||||
#include "wx/cocoa/ObjcRef.h"
|
||||
|
||||
WX_DECLARE_OBJC_HASHMAP(NSButton);
|
||||
|
||||
class wxCocoaNSButton
|
||||
{
|
||||
WX_DECLARE_OBJC_INTERFACE_HASHMAP(NSButton);
|
||||
public:
|
||||
void AssociateNSButton(WX_NSButton cocoaNSButton);
|
||||
void DisassociateNSButton(WX_NSButton cocoaNSButton)
|
||||
{
|
||||
if(cocoaNSButton)
|
||||
sm_cocoaHash.erase(cocoaNSButton);
|
||||
}
|
||||
|
||||
virtual void Cocoa_wxNSButtonAction(void) = 0;
|
||||
virtual ~wxCocoaNSButton() { }
|
||||
|
||||
protected:
|
||||
static const wxObjcAutoRefFromAlloc<struct objc_object*> sm_cocoaTarget;
|
||||
};
|
||||
|
||||
#endif // _WX_COCOA_NSBUTTON_H__
|
@@ -1,31 +0,0 @@
|
||||
///////////////////////////////////////////////////////////////////////////////
|
||||
// Name: wx/cocoa/NSControl.h
|
||||
// Purpose: wxCocoaNSControl class
|
||||
// Author: David Elliott
|
||||
// Modified by:
|
||||
// Created: 2003/02/15
|
||||
// Copyright: (c) 2003 David Elliott
|
||||
// Licence: wxWindows licence
|
||||
///////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
#ifndef __WX_COCOA_NSCONTROL_H__
|
||||
#define __WX_COCOA_NSCONTROL_H__
|
||||
|
||||
#include "wx/hashmap.h"
|
||||
#include "wx/cocoa/ObjcAssociate.h"
|
||||
|
||||
WX_DECLARE_OBJC_HASHMAP(NSControl);
|
||||
class wxCocoaNSControl
|
||||
{
|
||||
WX_DECLARE_OBJC_INTERFACE(NSControl)
|
||||
public:
|
||||
virtual void CocoaTarget_action() {}
|
||||
// virtual void Cocoa_didChangeText(void) = 0;
|
||||
|
||||
virtual ~wxCocoaNSControl() { }
|
||||
|
||||
protected:
|
||||
static struct objc_object *sm_cocoaTarget;
|
||||
};
|
||||
|
||||
#endif // _WX_COCOA_NSCONTROL_H_
|
@@ -1,48 +0,0 @@
|
||||
///////////////////////////////////////////////////////////////////////////////
|
||||
// Name: wx/cocoa/NSMenu.h
|
||||
// Purpose: wxCocoaNSMenu class
|
||||
// Author: David Elliott
|
||||
// Modified by:
|
||||
// Created: 2002/12/09
|
||||
// Copyright: (c) 2002 David Elliott
|
||||
// Licence: wxWindows licence
|
||||
///////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
#ifndef __WX_COCOA_NSMENU_H__
|
||||
#define __WX_COCOA_NSMENU_H__
|
||||
|
||||
#include "wx/hashmap.h"
|
||||
#include "wx/cocoa/ObjcAssociate.h"
|
||||
|
||||
WX_DECLARE_OBJC_HASHMAP(NSMenu);
|
||||
|
||||
// ========================================================================
|
||||
// wxCocoaNSMenu
|
||||
// ========================================================================
|
||||
|
||||
class wxCocoaNSMenu
|
||||
{
|
||||
WX_DECLARE_OBJC_INTERFACE_HASHMAP(NSMenu)
|
||||
public:
|
||||
void AssociateNSMenu(WX_NSMenu cocoaNSMenu, unsigned int flags = 0);
|
||||
void DisassociateNSMenu(WX_NSMenu cocoaNSMenu);
|
||||
enum
|
||||
{ OBSERVE_DidAddItem = 0x01
|
||||
, OBSERVE_DidChangeItem = 0x02
|
||||
, OBSERVE_DidRemoveItem = 0x04
|
||||
, OBSERVE_DidSendAction = 0x08
|
||||
, OBSERVE_WillSendAction = 0x10
|
||||
};
|
||||
virtual void Cocoa_dealloc() {}
|
||||
virtual void CocoaNotification_menuDidAddItem(WX_NSNotification WXUNUSED(notification)) {}
|
||||
virtual void CocoaNotification_menuDidChangeItem(WX_NSNotification WXUNUSED(notification)) {}
|
||||
virtual void CocoaNotification_menuDidRemoveItem(WX_NSNotification WXUNUSED(notification)) {}
|
||||
virtual void CocoaNotification_menuDidSendAction(WX_NSNotification WXUNUSED(notification)) {}
|
||||
virtual void CocoaNotification_menuWillSendAction(WX_NSNotification WXUNUSED(notification)) {}
|
||||
virtual ~wxCocoaNSMenu() { }
|
||||
|
||||
protected:
|
||||
static struct objc_object *sm_cocoaObserver;
|
||||
};
|
||||
|
||||
#endif // _WX_COCOA_NSMENU_H_
|
@@ -1,24 +0,0 @@
|
||||
///////////////////////////////////////////////////////////////////////////////
|
||||
// Name: wx/cocoa/NSPanel.h
|
||||
// Purpose: wxCocoaNSPanel class
|
||||
// Author: David Elliott
|
||||
// Modified by:
|
||||
// Created: 2003/03/16
|
||||
// Copyright: (c) 2003 David Elliott
|
||||
// Licence: wxWindows licence
|
||||
///////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
#ifndef __WX_COCOA_NSPANEL_H__
|
||||
#define __WX_COCOA_NSPANEL_H__
|
||||
|
||||
#include "wx/hashmap.h"
|
||||
#include "wx/cocoa/ObjcAssociate.h"
|
||||
|
||||
WX_DECLARE_OBJC_HASHMAP(NSPanel);
|
||||
|
||||
class wxCocoaNSPanel
|
||||
{
|
||||
WX_DECLARE_OBJC_INTERFACE(NSPanel)
|
||||
};
|
||||
|
||||
#endif // _WX_COCOA_NSPANEL_H_
|
@@ -1,40 +0,0 @@
|
||||
///////////////////////////////////////////////////////////////////////////////
|
||||
// Name: wx/cocoa/NSScroller.h
|
||||
// Purpose: wxCocoaNSScroller class
|
||||
// Author: David Elliott
|
||||
// Modified by:
|
||||
// Created: 2004/04/27
|
||||
// Copyright: (c) 2004 David Elliott
|
||||
// Licence: wxWindows licence
|
||||
///////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
#ifndef _WX_COCOA_NSSCROLLER_H__
|
||||
#define _WX_COCOA_NSSCROLLER_H__
|
||||
|
||||
#include "wx/hashmap.h"
|
||||
#include "wx/cocoa/ObjcAssociate.h"
|
||||
#include "wx/cocoa/ObjcRef.h"
|
||||
|
||||
DECLARE_WXCOCOA_OBJC_CLASS(NSScroller);
|
||||
|
||||
WX_DECLARE_OBJC_HASHMAP(NSScroller);
|
||||
|
||||
class wxCocoaNSScroller
|
||||
{
|
||||
WX_DECLARE_OBJC_INTERFACE_HASHMAP(NSScroller);
|
||||
public:
|
||||
void AssociateNSScroller(WX_NSScroller cocoaNSScroller);
|
||||
void DisassociateNSScroller(WX_NSScroller cocoaNSScroller)
|
||||
{
|
||||
if(cocoaNSScroller)
|
||||
sm_cocoaHash.erase(cocoaNSScroller);
|
||||
}
|
||||
|
||||
virtual void Cocoa_wxNSScrollerAction(void) = 0;
|
||||
virtual ~wxCocoaNSScroller() { }
|
||||
|
||||
protected:
|
||||
static const wxObjcAutoRefFromAlloc<struct objc_object*> sm_cocoaTarget;
|
||||
};
|
||||
|
||||
#endif // _WX_COCOA_NSSCROLLER_H__
|
@@ -1,46 +0,0 @@
|
||||
/////////////////////////////////////////////////////////////////////////////
|
||||
// Name: wx/cocoa/NSSlider.h
|
||||
// Purpose: wxCocoaNSSlider class
|
||||
// Author: Mark Oxenham
|
||||
// Modified by: David Elliott
|
||||
// Created: 2007/08/10
|
||||
// Copyright: (c) 2007 Software 2000 Ltd. All rights reserved.
|
||||
// Licence: wxWindows licence
|
||||
/////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
#ifndef _WXNSSLIDER_H_
|
||||
#define _WXNSSLIDER_H_
|
||||
|
||||
#include "wx/hashmap.h"
|
||||
#include "wx/cocoa/ObjcAssociate.h"
|
||||
#include "wx/cocoa/ObjcRef.h"
|
||||
|
||||
DECLARE_WXCOCOA_OBJC_CLASS(NSSlider);
|
||||
|
||||
WX_DECLARE_OBJC_HASHMAP(NSSlider);
|
||||
|
||||
// For when we're not in Objective-C mode:
|
||||
typedef struct objc_selector *SEL;
|
||||
|
||||
class wxCocoaNSSliderLastSelectorChanger;
|
||||
|
||||
class wxCocoaNSSlider
|
||||
{
|
||||
friend class wxCocoaNSSliderLastSelectorChanger;
|
||||
WX_DECLARE_OBJC_INTERFACE_HASHMAP(NSSlider);
|
||||
public:
|
||||
void AssociateNSSlider(WX_NSSlider cocoaNSSlider);
|
||||
void DisassociateNSSlider(WX_NSSlider cocoaNSSlider);
|
||||
|
||||
virtual void CocoaNotification_startTracking(WX_NSNotification notification) = 0;
|
||||
virtual void CocoaNotification_continueTracking(WX_NSNotification notification) = 0;
|
||||
virtual void CocoaNotification_stopTracking(WX_NSNotification notification) = 0;
|
||||
|
||||
static SEL GetLastResponderSelector()
|
||||
{ return sm_lastResponderSelector; }
|
||||
protected:
|
||||
virtual ~wxCocoaNSSlider() { }
|
||||
static SEL sm_lastResponderSelector;
|
||||
};
|
||||
|
||||
#endif
|
@@ -1,35 +0,0 @@
|
||||
///////////////////////////////////////////////////////////////////////////////
|
||||
// Name: wx/cocoa/NSTabView.h
|
||||
// Purpose: wxCocoaNSTabView class
|
||||
// Author: David Elliott
|
||||
// Modified by:
|
||||
// Created: 2004/04/08
|
||||
// Copyright: (c) 2004 David Elliott
|
||||
// Licence: wxWindows licence
|
||||
///////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
#ifndef _WX_COCOA_NSTABVIEW_H__
|
||||
#define _WX_COCOA_NSTABVIEW_H__
|
||||
|
||||
#include "wx/hashmap.h"
|
||||
#include "wx/cocoa/ObjcAssociate.h"
|
||||
#include "wx/cocoa/ObjcRef.h"
|
||||
|
||||
DECLARE_WXCOCOA_OBJC_CLASS(NSTabView);
|
||||
DECLARE_WXCOCOA_OBJC_CLASS(NSTabViewItem);
|
||||
WX_DECLARE_OBJC_HASHMAP(NSTabView);
|
||||
class wxCocoaNSTabView
|
||||
{
|
||||
WX_DECLARE_OBJC_INTERFACE_HASHMAP(NSTabView)
|
||||
public:
|
||||
void AssociateNSTabView(WX_NSTabView cocoaNSTabView);
|
||||
void DisassociateNSTabView(WX_NSTabView ocoaNSTabView);
|
||||
virtual void CocoaDelegate_tabView_didSelectTabViewItem(WX_NSTabViewItem tabviewItem) = 0;
|
||||
virtual bool CocoaDelegate_tabView_shouldSelectTabViewItem(WX_NSTabViewItem tabviewItem) = 0;
|
||||
virtual ~wxCocoaNSTabView() { }
|
||||
|
||||
protected:
|
||||
static wxObjcAutoRefFromAlloc<struct objc_object*> sm_cocoaDelegate;
|
||||
};
|
||||
|
||||
#endif // _WX_COCOA_NSTABVIEW_H__
|
@@ -1,34 +0,0 @@
|
||||
///////////////////////////////////////////////////////////////////////////////
|
||||
// Name: wx/cocoa/NSTableDataSource.h
|
||||
// Purpose: wxCocoaNSTableDataSource Objective-C class
|
||||
// Author: David Elliott
|
||||
// Modified by:
|
||||
// Created: 2003/08/05
|
||||
// Copyright: (c) 2003 David Elliott
|
||||
// Licence: wxWindows licence
|
||||
///////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
#ifndef __WX_COCOA_NSTABLEDATASOURCE_H__
|
||||
#define __WX_COCOA_NSTABLEDATASOURCE_H__
|
||||
|
||||
#include "wx/cocoa/objc/objc_uniquifying.h"
|
||||
|
||||
#import <Foundation/NSObject.h>
|
||||
|
||||
// ============================================================================
|
||||
// @class wxCocoaNSTableDataSource
|
||||
// ============================================================================
|
||||
@interface wxCocoaNSTableDataSource : NSObject
|
||||
{
|
||||
}
|
||||
|
||||
// NSTableDataSource is a loosely defined protocol consisting of the
|
||||
// following two message implementations
|
||||
- (int)numberOfRowsInTableView: (NSTableView *)tableView;
|
||||
- (id)tableView:(NSTableView *)tableView
|
||||
objectValueForTableColumn: (NSTableColumn *)tableColumn
|
||||
row: (int)rowIndex;
|
||||
@end // wxCocoaNSTableDataSource
|
||||
WX_DECLARE_GET_OBJC_CLASS(wxCocoaNSTableDataSource,NSObject)
|
||||
|
||||
#endif // _WX_COCOA_NSTABLEDATASOURCE_H_
|
@@ -1,29 +0,0 @@
|
||||
///////////////////////////////////////////////////////////////////////////////
|
||||
// Name: wx/cocoa/NSTableView.h
|
||||
// Purpose: wxCocoaNSTableView class
|
||||
// Author: David Elliott
|
||||
// Modified by:
|
||||
// Created: 2003/08/05
|
||||
// Copyright: (c) 2003 David Elliott
|
||||
// Licence: wxWindows licence
|
||||
///////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
#ifndef __WX_COCOA_NSTABLEVIEW_H__
|
||||
#define __WX_COCOA_NSTABLEVIEW_H__
|
||||
|
||||
#include "wx/hashmap.h"
|
||||
#include "wx/cocoa/ObjcAssociate.h"
|
||||
|
||||
WX_DECLARE_OBJC_HASHMAP(NSTableView);
|
||||
|
||||
class wxCocoaNSTableView
|
||||
{
|
||||
WX_DECLARE_OBJC_INTERFACE(NSTableView)
|
||||
public:
|
||||
virtual int CocoaDataSource_numberOfRows() = 0;
|
||||
virtual struct objc_object* CocoaDataSource_objectForTableColumn(
|
||||
WX_NSTableColumn tableColumn, int rowIndex) = 0;
|
||||
virtual ~wxCocoaNSTableView() { }
|
||||
};
|
||||
|
||||
#endif // _WX_COCOA_NSTABLEVIEW_H_
|
@@ -1,26 +0,0 @@
|
||||
///////////////////////////////////////////////////////////////////////////////
|
||||
// Name: wx/cocoa/NSTextField.h
|
||||
// Purpose: wxCocoaNSTextField class
|
||||
// Author: David Elliott
|
||||
// Modified by:
|
||||
// Created: 2002/12/09
|
||||
// Copyright: (c) 2002 David Elliott
|
||||
// Licence: wxWindows licence
|
||||
///////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
#ifndef __WX_COCOA_NSTEXTFIELD_H__
|
||||
#define __WX_COCOA_NSTEXTFIELD_H__
|
||||
|
||||
#include "wx/hashmap.h"
|
||||
#include "wx/cocoa/ObjcAssociate.h"
|
||||
|
||||
WX_DECLARE_OBJC_HASHMAP(NSTextField);
|
||||
class wxCocoaNSTextField
|
||||
{
|
||||
WX_DECLARE_OBJC_INTERFACE(NSTextField)
|
||||
protected:
|
||||
virtual void Cocoa_didChangeText(void) = 0;
|
||||
virtual ~wxCocoaNSTextField() { }
|
||||
};
|
||||
|
||||
#endif // _WX_COCOA_NSTEXTFIELD_H_
|
@@ -1,80 +0,0 @@
|
||||
///////////////////////////////////////////////////////////////////////////////
|
||||
// Name: wx/cocoa/NSView.h
|
||||
// Purpose: wxCocoaNSView class
|
||||
// Author: David Elliott
|
||||
// Modified by:
|
||||
// Created: 2003/02/15
|
||||
// Copyright: (c) 2003 David Elliott
|
||||
// Licence: wxWindows licence
|
||||
///////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
#ifndef __WX_COCOA_NSVIEW_H__
|
||||
#define __WX_COCOA_NSVIEW_H__
|
||||
|
||||
#include "wx/hashmap.h"
|
||||
#include "wx/cocoa/ObjcAssociate.h"
|
||||
|
||||
#if defined(__LP64__) || defined(NS_BUILD_32_LIKE_64)
|
||||
typedef struct CGRect NSRect;
|
||||
#else
|
||||
typedef struct _NSRect NSRect;
|
||||
#endif
|
||||
|
||||
struct objc_object;
|
||||
|
||||
class wxWindow;
|
||||
|
||||
WX_DECLARE_OBJC_HASHMAP(NSView);
|
||||
class wxCocoaNSView
|
||||
{
|
||||
/* NSView is a rather special case and requires some extra attention */
|
||||
WX_DECLARE_OBJC_INTERFACE_HASHMAP(NSView)
|
||||
public:
|
||||
void AssociateNSView(WX_NSView cocoaNSView);
|
||||
void DisassociateNSView(WX_NSView cocoaNSView);
|
||||
protected:
|
||||
static struct objc_object *sm_cocoaObserver;
|
||||
public:
|
||||
virtual wxWindow* GetWxWindow() const
|
||||
{ return NULL; }
|
||||
virtual void Cocoa_FrameChanged(void) = 0;
|
||||
virtual void Cocoa_synthesizeMouseMoved(void) = 0;
|
||||
virtual bool Cocoa_acceptsFirstMouse(bool &WXUNUSED(acceptsFirstMouse), WX_NSEvent WXUNUSED(theEvent))
|
||||
{ return false; }
|
||||
virtual bool Cocoa_drawRect(const NSRect &WXUNUSED(rect))
|
||||
{ return false; }
|
||||
virtual bool Cocoa_mouseDown(WX_NSEvent WXUNUSED(theEvent))
|
||||
{ return false; }
|
||||
virtual bool Cocoa_mouseDragged(WX_NSEvent WXUNUSED(theEvent))
|
||||
{ return false; }
|
||||
virtual bool Cocoa_mouseUp(WX_NSEvent WXUNUSED(theEvent))
|
||||
{ return false; }
|
||||
virtual bool Cocoa_mouseMoved(WX_NSEvent WXUNUSED(theEvent))
|
||||
{ return false; }
|
||||
virtual bool Cocoa_mouseEntered(WX_NSEvent WXUNUSED(theEvent))
|
||||
{ return false; }
|
||||
virtual bool Cocoa_mouseExited(WX_NSEvent WXUNUSED(theEvent))
|
||||
{ return false; }
|
||||
virtual bool Cocoa_rightMouseDown(WX_NSEvent WXUNUSED(theEvent))
|
||||
{ return false; }
|
||||
virtual bool Cocoa_rightMouseDragged(WX_NSEvent WXUNUSED(theEvent))
|
||||
{ return false; }
|
||||
virtual bool Cocoa_rightMouseUp(WX_NSEvent WXUNUSED(theEvent))
|
||||
{ return false; }
|
||||
virtual bool Cocoa_otherMouseDown(WX_NSEvent WXUNUSED(theEvent))
|
||||
{ return false; }
|
||||
virtual bool Cocoa_otherMouseDragged(WX_NSEvent WXUNUSED(theEvent))
|
||||
{ return false; }
|
||||
virtual bool Cocoa_otherMouseUp(WX_NSEvent WXUNUSED(theEvent))
|
||||
{ return false; }
|
||||
virtual bool Cocoa_resetCursorRects()
|
||||
{ return false; }
|
||||
virtual bool Cocoa_viewDidMoveToWindow()
|
||||
{ return false; }
|
||||
virtual bool Cocoa_viewWillMoveToWindow(WX_NSWindow WXUNUSED(newWindow))
|
||||
{ return false; }
|
||||
virtual ~wxCocoaNSView() { }
|
||||
};
|
||||
|
||||
#endif
|
||||
// __WX_COCOA_NSVIEW_H__
|
@@ -1,54 +0,0 @@
|
||||
///////////////////////////////////////////////////////////////////////////////
|
||||
// Name: wx/cocoa/NSWindow.h
|
||||
// Purpose: wxCocoaNSWindow class
|
||||
// Author: David Elliott
|
||||
// Modified by:
|
||||
// Created: 2003/03/16
|
||||
// Copyright: (c) 2003 David Elliott
|
||||
// Licence: wxWindows licence
|
||||
///////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
#ifndef __WX_COCOA_NSWINDOW_H__
|
||||
#define __WX_COCOA_NSWINDOW_H__
|
||||
|
||||
#include "wx/hashmap.h"
|
||||
#include "wx/cocoa/ObjcAssociate.h"
|
||||
|
||||
WX_DECLARE_OBJC_HASHMAP(NSWindow);
|
||||
|
||||
class WXDLLIMPEXP_FWD_CORE wxMenuBar;
|
||||
class WXDLLIMPEXP_FWD_CORE wxTopLevelWindowCocoa;
|
||||
|
||||
DECLARE_WXCOCOA_OBJC_CLASS(NSMenuItem);
|
||||
DECLARE_WXCOCOA_OBJC_CLASS(wxNSWindowDelegate);
|
||||
|
||||
class WXDLLIMPEXP_CORE wxCocoaNSWindow
|
||||
{
|
||||
/* NSWindow is a rather special case and requires some extra attention */
|
||||
WX_DECLARE_OBJC_INTERFACE_HASHMAP(NSWindow)
|
||||
public:
|
||||
void AssociateNSWindow(WX_NSWindow cocoaNSWindow);
|
||||
void DisassociateNSWindow(WX_NSWindow cocoaNSWindow);
|
||||
virtual bool Cocoa_canBecomeKeyWindow(bool &WXUNUSED(canBecome))
|
||||
{ return false; }
|
||||
virtual bool Cocoa_canBecomeMainWindow(bool &WXUNUSED(canBecome))
|
||||
{ return false; }
|
||||
virtual bool CocoaDelegate_windowShouldClose(void) = 0;
|
||||
virtual void CocoaDelegate_windowWillClose(void) = 0;
|
||||
virtual void CocoaDelegate_windowDidBecomeKey(void) { }
|
||||
virtual void CocoaDelegate_windowDidResignKey(void) { }
|
||||
virtual void CocoaDelegate_windowDidBecomeMain(void) { }
|
||||
virtual void CocoaDelegate_windowDidResignMain(void) { }
|
||||
virtual void CocoaDelegate_wxMenuItemAction(WX_NSMenuItem menuItem) = 0;
|
||||
virtual bool CocoaDelegate_validateMenuItem(WX_NSMenuItem menuItem) = 0;
|
||||
virtual wxMenuBar* GetAppMenuBar(wxCocoaNSWindow *win);
|
||||
inline wxTopLevelWindowCocoa* GetWxTopLevelWindowCocoa()
|
||||
{ return m_wxTopLevelWindowCocoa; }
|
||||
protected:
|
||||
wxCocoaNSWindow(wxTopLevelWindowCocoa *tlw = NULL);
|
||||
virtual ~wxCocoaNSWindow();
|
||||
WX_wxNSWindowDelegate m_cocoaDelegate;
|
||||
wxTopLevelWindowCocoa *m_wxTopLevelWindowCocoa;
|
||||
};
|
||||
|
||||
#endif // _WX_COCOA_NSWINDOW_H_
|
@@ -1,77 +0,0 @@
|
||||
/////////////////////////////////////////////////////////////////////////////
|
||||
// Name: wx/cocoa/ObjcAssociate.h
|
||||
// Purpose: Associates an Objective-C class with a C++ class
|
||||
// Author: David Elliott
|
||||
// Modified by:
|
||||
// Created: 2002/12/03
|
||||
// Copyright: (c) 2002 David Elliott <dfe@cox.net>
|
||||
// Licence: wxWindows licence
|
||||
/////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
#ifndef __WX_COCOA_OBJC_ASSOCIATE_H__
|
||||
#define __WX_COCOA_OBJC_ASSOCIATE_H__
|
||||
|
||||
/*-------------------------------------------------------------------------
|
||||
Basic hashmap stuff, used by everything
|
||||
-------------------------------------------------------------------------*/
|
||||
#define WX_DECLARE_OBJC_HASHMAP(ObjcClass) \
|
||||
class wxCocoa##ObjcClass; \
|
||||
WX_DECLARE_HASH_MAP(WX_##ObjcClass,wxCocoa##ObjcClass*,wxPointerHash,wxPointerEqual,wxCocoa##ObjcClass##Hash)
|
||||
|
||||
#define WX_DECLARE_OBJC_INTERFACE_HASHMAP(ObjcClass) \
|
||||
public: \
|
||||
static inline wxCocoa##ObjcClass* GetFromCocoa(WX_##ObjcClass cocoaObjcClass) \
|
||||
{ \
|
||||
wxCocoa##ObjcClass##Hash::iterator iter = sm_cocoaHash.find(cocoaObjcClass); \
|
||||
if(iter!=sm_cocoaHash.end()) \
|
||||
{ \
|
||||
return iter->second; \
|
||||
} \
|
||||
return NULL; \
|
||||
} \
|
||||
protected: \
|
||||
static wxCocoa##ObjcClass##Hash sm_cocoaHash;
|
||||
|
||||
#define WX_IMPLEMENT_OBJC_INTERFACE_HASHMAP(ObjcClass) \
|
||||
wxCocoa##ObjcClass##Hash wxCocoa##ObjcClass::sm_cocoaHash;
|
||||
|
||||
|
||||
/*-------------------------------------------------------------------------
|
||||
The entire interface, including some boilerplate stuff
|
||||
-------------------------------------------------------------------------*/
|
||||
#define WX_DECLARE_OBJC_INTERFACE(ObjcClass) \
|
||||
WX_DECLARE_OBJC_INTERFACE_HASHMAP(ObjcClass) \
|
||||
public: \
|
||||
inline void Associate##ObjcClass(WX_##ObjcClass cocoaObjcClass) \
|
||||
{ \
|
||||
if(cocoaObjcClass) \
|
||||
sm_cocoaHash.insert(wxCocoa##ObjcClass##Hash::value_type(cocoaObjcClass,this)); \
|
||||
} \
|
||||
inline void Disassociate##ObjcClass(WX_##ObjcClass cocoaObjcClass) \
|
||||
{ \
|
||||
if(cocoaObjcClass) \
|
||||
sm_cocoaHash.erase(cocoaObjcClass); \
|
||||
}
|
||||
|
||||
#define WX_IMPLEMENT_OBJC_INTERFACE(ObjcClass) \
|
||||
WX_IMPLEMENT_OBJC_INTERFACE_HASHMAP(ObjcClass)
|
||||
|
||||
/*-------------------------------------------------------------------------
|
||||
Stuff to be used by the wxWidgets class (not the Cocoa interface)
|
||||
-------------------------------------------------------------------------*/
|
||||
#define WX_DECLARE_COCOA_OWNER(ObjcClass,ObjcBase,ObjcRoot) \
|
||||
public: \
|
||||
inline WX_##ObjcClass Get##ObjcClass() { return (WX_##ObjcClass)m_cocoa##ObjcRoot; } \
|
||||
inline const WX_##ObjcClass Get##ObjcClass() const { return (WX_##ObjcClass)m_cocoa##ObjcRoot; } \
|
||||
protected: \
|
||||
void Set##ObjcClass(WX_##ObjcClass cocoaObjcClass);
|
||||
|
||||
#define WX_IMPLEMENT_COCOA_OWNER(wxClass,ObjcClass,ObjcBase,ObjcRoot) \
|
||||
void wxClass::Set##ObjcClass(WX_##ObjcClass cocoaObjcClass) \
|
||||
{ \
|
||||
Disassociate##ObjcClass((WX_##ObjcClass)m_cocoa##ObjcRoot); \
|
||||
Set##ObjcBase(cocoaObjcClass); \
|
||||
Associate##ObjcClass((WX_##ObjcClass)m_cocoa##ObjcRoot); \
|
||||
}
|
||||
|
||||
#endif // __WX_COCOA_OBJC_ASSOCIATE_H__
|
@@ -1,235 +0,0 @@
|
||||
/////////////////////////////////////////////////////////////////////////////
|
||||
// Name: wx/cocoa/ObjcRef.h
|
||||
// Purpose: wxObjcAutoRef template class
|
||||
// Author: David Elliott
|
||||
// Modified by:
|
||||
// Created: 2004/03/28
|
||||
// Copyright: (c) 2004 David Elliott <dfe@cox.net>
|
||||
// Licence: wxWindows licence
|
||||
/////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
#ifndef _WX_COCOA_OBJCREF_H__
|
||||
#define _WX_COCOA_OBJCREF_H__
|
||||
|
||||
// Reuse wxCFRef-related code (e.g. wxCFRetain/wxCFRelease)
|
||||
#include "wx/osx/core/cfref.h"
|
||||
|
||||
// NOTE WELL: We can only know whether or not GC can be used when compiling Objective-C.
|
||||
// Therefore we cannot implement these functions except when compiling Objective-C.
|
||||
#ifdef __OBJC__
|
||||
/*! @function wxGCSafeRetain
|
||||
@templatefield Type (implicit) An Objective-C class type
|
||||
@arg r Pointer to Objective-C object. May be null.
|
||||
@abstract Retains the Objective-C object, even when using Apple's garbage collector
|
||||
@discussion
|
||||
When Apple's garbage collector is enabled, the usual [obj retain] and [obj release] messages
|
||||
are ignored. Instead the collector with help from compiler-generated write-barriers tracks
|
||||
reachable objects. The write-barriers are generated when setting i-vars of C++ classes but
|
||||
they are ignored by the garbage collector unless the C++ object is in GC-managed memory.
|
||||
|
||||
The simple solution is to use CFRetain on the Objective-C object which has been enhanced in
|
||||
GC mode to forcibly retain the object. In Retain/Release (RR) mode the CFRetain function has
|
||||
the same effect as [obj retain]. Note that GC vs. RR is selected at runtime.
|
||||
|
||||
Take care that wxGCSafeRetain must be balanced with wxGCSafeRelease and that conversely
|
||||
wxGCSafeRelease must only be called on objects to balance wxGCSafeRetain. In particular when
|
||||
receiving an Objective-C object from an alloc or copy method take care that you must retain
|
||||
it with wxGCSafeRetain and balance the initial alloc with a standard release.
|
||||
|
||||
Example:
|
||||
wxGCSafeRelease(m_obj); // release current object (if any)
|
||||
NSObject *obj = [[NSObject alloc] init];
|
||||
m_obj = wxGCSafeRetain(obj);
|
||||
[obj release];
|
||||
|
||||
Alternatively (same effect, perhaps less clear):
|
||||
wxGCSafeRelease(m_obj); // release current object (if any)
|
||||
m_obj = wxGCSafeRetain([[NSObject alloc] init]);
|
||||
[m_obj release]; // balance alloc
|
||||
|
||||
Consider the effect on the retain count from each statement (alloc, CFRetain, release)
|
||||
In RR mode: retainCount = 1, +1, -1
|
||||
In GC mode: strongRetainCount = 0, +1, -0
|
||||
|
||||
This is a template function to ensure it is used on raw pointers and never on pointer-holder
|
||||
objects via implicit conversion operators.
|
||||
*/
|
||||
template <class Type>
|
||||
inline Type * wxGCSafeRetain(Type *r)
|
||||
{
|
||||
#ifdef __OBJC_GC__
|
||||
return static_cast<Type*>(wxCFRetain(r));
|
||||
#else
|
||||
return [r retain];
|
||||
#endif
|
||||
}
|
||||
|
||||
/*! @function wxGCSafeRelease
|
||||
@templatefield Type (implicit) An Objective-C class type
|
||||
@arg r Pointer to Objective-C object. May be null.
|
||||
@abstract Balances wxGCSafeRetain. Particularly useful with the Apple Garbage Collector.
|
||||
@discussion
|
||||
See the wxGCSafeRetain documentation for more details.
|
||||
|
||||
Example (from wxGCSafeRetain documentation):
|
||||
wxGCSafeRelease(m_obj); // release current object (if any)
|
||||
m_obj = wxGCSafeRetain([[NSObject alloc] init]);
|
||||
[m_obj release]; // balance alloc
|
||||
|
||||
When viewed from the start, m_obj ought to start as nil. However, the second time through
|
||||
the wxGCSafeRelease call becomes critical as it releases the retain from the first time
|
||||
through.
|
||||
|
||||
In the destructor for this C++ object with the m_obj i-var you ought to do the following:
|
||||
wxGCSafeRelease(m_obj);
|
||||
m_obj = nil; // Not strictly needed, but safer.
|
||||
|
||||
Under no circumstances should you balance an alloc or copy with a wxGCSafeRelease.
|
||||
*/
|
||||
template <class Type>
|
||||
inline void wxGCSafeRelease(Type *r)
|
||||
{
|
||||
#ifdef __OBJC_GC__
|
||||
wxCFRelease(r);
|
||||
#else
|
||||
[r release];
|
||||
#endif
|
||||
}
|
||||
#else
|
||||
// NOTE: When not compiling Objective-C, declare these functions such that they can be
|
||||
// used by other inline-implemented methods. Since those methods in turn will not actually
|
||||
// be used from non-ObjC code the compiler ought not emit them. If it emits an out of
|
||||
// line copy of those methods then presumably it will have also emitted at least one
|
||||
// out of line copy of these functions from at least one Objective-C++ translation unit.
|
||||
// That means the out of line implementation will be available at link time.
|
||||
|
||||
template <class Type>
|
||||
inline Type * wxGCSafeRetain(Type *r);
|
||||
|
||||
template <class Type>
|
||||
inline void wxGCSafeRelease(Type *r);
|
||||
|
||||
#endif //def __OBJC__
|
||||
|
||||
/*
|
||||
wxObjcAutoRefFromAlloc: construct a reference to an object that was
|
||||
[NSObject -alloc]'ed and thus does not need a retain
|
||||
wxObjcAutoRef: construct a reference to an object that was
|
||||
either autoreleased or is retained by something else.
|
||||
*/
|
||||
|
||||
struct objc_object;
|
||||
|
||||
// We must do any calls to Objective-C from an Objective-C++ source file
|
||||
class wxObjcAutoRefBase
|
||||
{
|
||||
protected:
|
||||
/*! @function ObjcRetain
|
||||
@abstract Simply does [p retain].
|
||||
*/
|
||||
static struct objc_object* ObjcRetain(struct objc_object*);
|
||||
|
||||
/*! @function ObjcRelease
|
||||
@abstract Simply does [p release].
|
||||
*/
|
||||
static void ObjcRelease(struct objc_object*);
|
||||
};
|
||||
|
||||
/*! @class wxObjcAutoRefFromAlloc
|
||||
@templatefield T The type of _pointer_ (e.g. NSString*, NSRunLoop*)
|
||||
@abstract Pointer-holder for Objective-C objects
|
||||
@discussion
|
||||
When constructing this object from a raw pointer, the pointer is assumed to have
|
||||
come from an alloc-style method. That is, once you construct this object from
|
||||
the pointer you must not balance your alloc with a call to release.
|
||||
|
||||
This class has been carefully designed to work with both the traditional Retain/Release
|
||||
and the new Garbage Collected modes. In RR-mode it will prevent the object from being
|
||||
released by managing the reference count using the retain/release semantics. In GC-mode
|
||||
it will use a method (currently CFRetain/CFRelease) to ensure the object will never be
|
||||
finalized until this object is destroyed.
|
||||
*/
|
||||
|
||||
template <class T>
|
||||
class wxObjcAutoRefFromAlloc: wxObjcAutoRefBase
|
||||
{
|
||||
public:
|
||||
wxObjcAutoRefFromAlloc(T p = 0)
|
||||
: m_ptr(p)
|
||||
// NOTE: this is from alloc. Do NOT retain
|
||||
{
|
||||
// CFRetain
|
||||
// GC: Object is strongly retained and prevented from being collected
|
||||
// non-GC: Simply realizes it's an Objective-C object and calls [p retain]
|
||||
wxGCSafeRetain(p);
|
||||
// ObjcRelease (e.g. [p release])
|
||||
// GC: Objective-C retain/release mean nothing in GC mode
|
||||
// non-GC: This is a normal release call, balancing the retain
|
||||
ObjcRelease(static_cast<T>(p));
|
||||
// The overall result:
|
||||
// GC: Object is strongly retained
|
||||
// non-GC: Retain count is the same as it was (retain then release)
|
||||
}
|
||||
wxObjcAutoRefFromAlloc(const wxObjcAutoRefFromAlloc& otherRef)
|
||||
: m_ptr(otherRef.m_ptr)
|
||||
{ wxGCSafeRetain(m_ptr); }
|
||||
~wxObjcAutoRefFromAlloc()
|
||||
{ wxGCSafeRelease(m_ptr); }
|
||||
wxObjcAutoRefFromAlloc& operator=(const wxObjcAutoRefFromAlloc& otherRef)
|
||||
{ wxGCSafeRetain(otherRef.m_ptr);
|
||||
wxGCSafeRelease(m_ptr);
|
||||
m_ptr = otherRef.m_ptr;
|
||||
return *this;
|
||||
}
|
||||
operator T() const
|
||||
{ return static_cast<T>(m_ptr); }
|
||||
T operator->() const
|
||||
{ return static_cast<T>(m_ptr); }
|
||||
protected:
|
||||
/*! @field m_ptr The pointer to the Objective-C object
|
||||
@discussion
|
||||
The pointer to the Objective-C object is typed as void* to avoid compiler-generated write
|
||||
barriers as would be used for implicitly __strong object pointers and to avoid the similar
|
||||
read barriers as would be used for an explicitly __weak object pointer. The write barriers
|
||||
are useless unless this object is located in GC-managed heap which is highly unlikely.
|
||||
|
||||
Since we guarantee strong reference via CFRetain/CFRelease the write-barriers are not needed
|
||||
at all, even if this object does happen to be allocated in GC-managed heap.
|
||||
*/
|
||||
void *m_ptr;
|
||||
};
|
||||
|
||||
/*!
|
||||
@class wxObjcAutoRef
|
||||
@description
|
||||
A pointer holder that does retain its argument.
|
||||
NOTE: It is suggest that you instead use wxObjcAutoRefFromAlloc<T> foo([aRawPointer retain])
|
||||
*/
|
||||
template <class T>
|
||||
class wxObjcAutoRef: public wxObjcAutoRefFromAlloc<T>
|
||||
{
|
||||
public:
|
||||
/*! @method wxObjcAutoRef
|
||||
@description
|
||||
Uses the underlying wxObjcAutoRefFromAlloc and simply does a typical [p retain] such that
|
||||
in RR-mode the object is in effectively the same retain-count state as it would have been
|
||||
coming straight from an alloc method.
|
||||
*/
|
||||
wxObjcAutoRef(T p = 0)
|
||||
: wxObjcAutoRefFromAlloc<T>(p)
|
||||
{ // NOTE: ObjcRetain is correct because in GC-mode it balances ObjcRelease in our superclass constructor
|
||||
// In RR mode it does retain and the superclass does retain/release thus resulting in an overall retain.
|
||||
ObjcRetain(static_cast<T>(wxObjcAutoRefFromAlloc<T>::m_ptr));
|
||||
}
|
||||
~wxObjcAutoRef() {}
|
||||
wxObjcAutoRef(const wxObjcAutoRef& otherRef)
|
||||
: wxObjcAutoRefFromAlloc<T>(otherRef)
|
||||
{}
|
||||
wxObjcAutoRef(const wxObjcAutoRefFromAlloc<T>& otherRef)
|
||||
: wxObjcAutoRefFromAlloc<T>(otherRef)
|
||||
{}
|
||||
wxObjcAutoRef& operator=(const wxObjcAutoRef& otherRef)
|
||||
{ return wxObjcAutoRefFromAlloc<T>::operator=(otherRef); }
|
||||
};
|
||||
|
||||
#endif //ndef _WX_COCOA_OBJCREF_H__
|
@@ -1,73 +0,0 @@
|
||||
/////////////////////////////////////////////////////////////////////////////
|
||||
// Name: wx/cocoa/app.h
|
||||
// Purpose: wxApp class
|
||||
// Author: David Elliott
|
||||
// Modified by:
|
||||
// Created: 2002/11/27
|
||||
// Copyright: (c) 2002 David Elliott
|
||||
// Licence: wxWindows licence
|
||||
/////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
#ifndef _WX_COCOA_APP_H_
|
||||
#define _WX_COCOA_APP_H_
|
||||
|
||||
typedef struct __CFRunLoopObserver * CFRunLoopObserverRef;
|
||||
typedef const struct __CFString * CFStringRef;
|
||||
|
||||
#include "wx/osx/core/cfref.h"
|
||||
|
||||
// ========================================================================
|
||||
// wxApp
|
||||
// ========================================================================
|
||||
// Represents the application. Derive OnInit and declare
|
||||
// a new App object to start application
|
||||
class WXDLLIMPEXP_CORE wxApp: public wxAppBase
|
||||
{
|
||||
DECLARE_DYNAMIC_CLASS(wxApp)
|
||||
// ------------------------------------------------------------------------
|
||||
// initialization
|
||||
// ------------------------------------------------------------------------
|
||||
public:
|
||||
wxApp();
|
||||
virtual ~wxApp();
|
||||
|
||||
// ------------------------------------------------------------------------
|
||||
// Cocoa specifics
|
||||
// ------------------------------------------------------------------------
|
||||
public:
|
||||
inline WX_NSApplication GetNSApplication() { return m_cocoaApp; }
|
||||
virtual void CocoaDelegate_applicationWillBecomeActive();
|
||||
virtual void CocoaDelegate_applicationDidBecomeActive();
|
||||
virtual void CocoaDelegate_applicationWillResignActive();
|
||||
virtual void CocoaDelegate_applicationDidResignActive();
|
||||
virtual void CocoaDelegate_applicationWillUpdate();
|
||||
virtual void CF_ObserveMainRunLoopBeforeWaiting(CFRunLoopObserverRef observer, int activity);
|
||||
protected:
|
||||
WX_NSApplication m_cocoaApp;
|
||||
struct objc_object *m_cocoaAppDelegate;
|
||||
WX_NSThread m_cocoaMainThread;
|
||||
wxCFRef<CFRunLoopObserverRef> m_cfRunLoopIdleObserver;
|
||||
wxCFRef<CFStringRef> m_cfObservedRunLoopMode;
|
||||
|
||||
// ------------------------------------------------------------------------
|
||||
// Implementation
|
||||
// ------------------------------------------------------------------------
|
||||
public:
|
||||
// Implement wxAppBase pure virtuals
|
||||
virtual void Exit();
|
||||
|
||||
virtual void WakeUpIdle();
|
||||
|
||||
virtual bool Initialize(int& argc, wxChar **argv);
|
||||
virtual void CleanUp();
|
||||
virtual bool CallOnInit();
|
||||
|
||||
|
||||
virtual bool OnInit();
|
||||
virtual bool OnInitGui();
|
||||
|
||||
// Set true _before_ initializing wx to force embedded mode (no app delegate, etc.)
|
||||
static bool sm_isEmbedded;
|
||||
};
|
||||
|
||||
#endif // _WX_COCOA_APP_H_
|
@@ -1,31 +0,0 @@
|
||||
/////////////////////////////////////////////////////////////////////////////
|
||||
// Name: wx/cocoa/autorelease.h
|
||||
// Purpose: Automatic NSAutoreleasePool functionality
|
||||
// Author: David Elliott
|
||||
// Modified by:
|
||||
// Created: 2003/07/11
|
||||
// Copyright: (c) 2003 David Elliott <dfe@cox.net>
|
||||
// Licence: wxWindows licence
|
||||
/////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
#ifndef __WX_COCOA_AUTORELEASE_H__
|
||||
#define __WX_COCOA_AUTORELEASE_H__
|
||||
|
||||
#import <Foundation/NSAutoreleasePool.h>
|
||||
|
||||
class wxAutoNSAutoreleasePool
|
||||
{
|
||||
public:
|
||||
wxAutoNSAutoreleasePool()
|
||||
{
|
||||
m_pool = [[NSAutoreleasePool alloc] init];
|
||||
}
|
||||
~wxAutoNSAutoreleasePool()
|
||||
{
|
||||
[m_pool release];
|
||||
}
|
||||
protected:
|
||||
NSAutoreleasePool *m_pool;
|
||||
};
|
||||
|
||||
#endif //__WX_COCOA_AUTORELEASE_H__
|
@@ -1,164 +0,0 @@
|
||||
/////////////////////////////////////////////////////////////////////////////
|
||||
// Name: wx/cocoa/bitmap.h
|
||||
// Purpose: wxBitmap class
|
||||
// Author: David Elliott
|
||||
// Modified by:
|
||||
// Created: 2003/07/19
|
||||
// Copyright: (c) 2003 David Elliott
|
||||
// Licence: wxWindows licence
|
||||
/////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
#ifndef __WX_COCOA_BITMAP_H__
|
||||
#define __WX_COCOA_BITMAP_H__
|
||||
|
||||
#include "wx/palette.h"
|
||||
|
||||
// Bitmap
|
||||
class WXDLLIMPEXP_FWD_CORE wxBitmap;
|
||||
class WXDLLIMPEXP_FWD_CORE wxIcon;
|
||||
class WXDLLIMPEXP_FWD_CORE wxCursor;
|
||||
class WXDLLIMPEXP_FWD_CORE wxImage;
|
||||
class WXDLLIMPEXP_FWD_CORE wxPixelDataBase;
|
||||
|
||||
// ========================================================================
|
||||
// wxMask
|
||||
// ========================================================================
|
||||
|
||||
// A mask is a 1-bit alpha bitmap used for drawing bitmaps transparently.
|
||||
class WXDLLIMPEXP_CORE wxMask: public wxObject
|
||||
{
|
||||
DECLARE_DYNAMIC_CLASS(wxMask)
|
||||
public:
|
||||
wxMask();
|
||||
|
||||
// Construct a mask from a bitmap and a colour indicating
|
||||
// the transparent area
|
||||
wxMask(const wxBitmap& bitmap, const wxColour& colour);
|
||||
|
||||
// Construct a mask from a bitmap and a palette index indicating
|
||||
// the transparent area
|
||||
wxMask(const wxBitmap& bitmap, int paletteIndex);
|
||||
|
||||
// Construct a mask from a mono bitmap (copies the bitmap).
|
||||
wxMask(const wxBitmap& bitmap);
|
||||
|
||||
// Copy constructor
|
||||
wxMask(const wxMask& src);
|
||||
|
||||
virtual ~wxMask();
|
||||
|
||||
bool Create(const wxBitmap& bitmap, const wxColour& colour);
|
||||
bool Create(const wxBitmap& bitmap, int paletteIndex);
|
||||
bool Create(const wxBitmap& bitmap);
|
||||
|
||||
// wxCocoa
|
||||
inline WX_NSBitmapImageRep GetNSBitmapImageRep()
|
||||
{ return m_cocoaNSBitmapImageRep; }
|
||||
protected:
|
||||
WX_NSBitmapImageRep m_cocoaNSBitmapImageRep;
|
||||
};
|
||||
|
||||
|
||||
// ========================================================================
|
||||
// wxBitmap
|
||||
// ========================================================================
|
||||
|
||||
class WXDLLIMPEXP_CORE wxBitmap: public wxGDIObject,
|
||||
public wxBitmapHelpers
|
||||
{
|
||||
// ------------------------------------------------------------------------
|
||||
// initialization
|
||||
// ------------------------------------------------------------------------
|
||||
public:
|
||||
// Platform-specific default constructor
|
||||
wxBitmap();
|
||||
// Initialize with raw data.
|
||||
wxBitmap(const char bits[], int width, int height, int depth = 1);
|
||||
// Initialize with XPM data
|
||||
wxBitmap(const char* const* bits);
|
||||
// Load a file or resource
|
||||
wxBitmap(const wxString& name, wxBitmapType type = wxBITMAP_DEFAULT_TYPE);
|
||||
// Construct from Cocoa's NSImage
|
||||
wxBitmap(NSImage* cocoaNSImage);
|
||||
// Construct from Cocoa's NSBitmapImageRep
|
||||
wxBitmap(NSBitmapImageRep* cocoaNSBitmapImageRep);
|
||||
// Constructor for generalised creation from data
|
||||
wxBitmap(const void* data, wxBitmapType type, int width, int height, int depth = 1);
|
||||
// If depth is omitted, will create a bitmap compatible with the display
|
||||
wxBitmap(int width, int height, int depth = -1)
|
||||
{ (void)Create(width, height, depth); }
|
||||
wxBitmap(const wxSize& sz, int depth = -1)
|
||||
{ (void)Create(sz, depth); }
|
||||
// Convert from wxImage:
|
||||
wxBitmap(const wxImage& image, int depth = -1)
|
||||
{ CreateFromImage(image, depth); }
|
||||
// Convert from wxIcon
|
||||
wxBitmap(const wxIcon& icon) { CopyFromIcon(icon); }
|
||||
|
||||
// destructor
|
||||
virtual ~wxBitmap();
|
||||
|
||||
// ------------------------------------------------------------------------
|
||||
// Implementation
|
||||
// ------------------------------------------------------------------------
|
||||
public:
|
||||
// Initialize from wxImage
|
||||
bool CreateFromImage(const wxImage& image, int depth=-1);
|
||||
|
||||
virtual bool Create(int width, int height, int depth = wxBITMAP_SCREEN_DEPTH);
|
||||
virtual bool Create(const wxSize& sz, int depth = wxBITMAP_SCREEN_DEPTH)
|
||||
{ return Create(sz.GetWidth(), sz.GetHeight(), depth); }
|
||||
|
||||
bool Create(NSImage* cocoaNSImage);
|
||||
bool Create(NSBitmapImageRep* cocoaNSBitmapImageRep);
|
||||
virtual bool Create(const void* data, wxBitmapType type, int width, int height, int depth = 1);
|
||||
virtual bool LoadFile(const wxString& name, wxBitmapType type = wxBITMAP_DEFAULT_TYPE);
|
||||
virtual bool SaveFile(const wxString& name, wxBitmapType type, const wxPalette *cmap = NULL) const;
|
||||
|
||||
// copies the contents and mask of the given (colour) icon to the bitmap
|
||||
virtual bool CopyFromIcon(const wxIcon& icon);
|
||||
|
||||
wxImage ConvertToImage() const;
|
||||
|
||||
// get the given part of bitmap
|
||||
wxBitmap GetSubBitmap( const wxRect& rect ) const;
|
||||
|
||||
int GetWidth() const;
|
||||
int GetHeight() const;
|
||||
int GetDepth() const;
|
||||
int GetQuality() const;
|
||||
void SetWidth(int w);
|
||||
void SetHeight(int h);
|
||||
void SetDepth(int d);
|
||||
void SetQuality(int q);
|
||||
void SetOk(bool isOk);
|
||||
|
||||
// raw bitmap access support functions
|
||||
void *GetRawData(wxPixelDataBase& data, int bpp);
|
||||
void UngetRawData(wxPixelDataBase& data);
|
||||
|
||||
wxPalette* GetPalette() const;
|
||||
void SetPalette(const wxPalette& palette);
|
||||
|
||||
wxMask *GetMask() const;
|
||||
void SetMask(wxMask *mask) ;
|
||||
|
||||
wxBitmapType GetBitmapType() const;
|
||||
|
||||
// wxCocoa
|
||||
WX_NSBitmapImageRep GetNSBitmapImageRep();
|
||||
void SetNSBitmapImageRep(WX_NSBitmapImageRep bitmapImageRep);
|
||||
WX_NSImage GetNSImage(bool useMask) const;
|
||||
|
||||
static void InitStandardHandlers() { }
|
||||
static void CleanUpHandlers() { }
|
||||
|
||||
protected:
|
||||
wxGDIRefData *CreateGDIRefData() const;
|
||||
wxGDIRefData *CloneGDIRefData(const wxGDIRefData *data) const;
|
||||
|
||||
DECLARE_DYNAMIC_CLASS(wxBitmap)
|
||||
};
|
||||
|
||||
|
||||
#endif // __WX_COCOA_BITMAP_H__
|
@@ -1,61 +0,0 @@
|
||||
/////////////////////////////////////////////////////////////////////////////
|
||||
// Name: wx/cocoa/bmpbuttn.h
|
||||
// Purpose: wxBitmapButton class
|
||||
// Author: David Elliott
|
||||
// Modified by:
|
||||
// Created: 2003/03/16
|
||||
// Copyright: (c) 2003 David Elliott
|
||||
// Licence: wxWindows licence
|
||||
/////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
#ifndef __WX_COCOA_BMPBUTTN_H__
|
||||
#define __WX_COCOA_BMPBUTTN_H__
|
||||
|
||||
#include "wx/cocoa/NSButton.h"
|
||||
|
||||
// ========================================================================
|
||||
// wxBitmapButton
|
||||
// ========================================================================
|
||||
class WXDLLIMPEXP_CORE wxBitmapButton : public wxBitmapButtonBase
|
||||
{
|
||||
DECLARE_DYNAMIC_CLASS(wxBitmapButton)
|
||||
DECLARE_EVENT_TABLE()
|
||||
WX_DECLARE_COCOA_OWNER(NSButton,NSControl,NSView)
|
||||
// ------------------------------------------------------------------------
|
||||
// initialization
|
||||
// ------------------------------------------------------------------------
|
||||
public:
|
||||
wxBitmapButton() { }
|
||||
wxBitmapButton(wxWindow *parent, wxWindowID winid,
|
||||
const wxBitmap& bitmap,
|
||||
const wxPoint& pos = wxDefaultPosition,
|
||||
const wxSize& size = wxDefaultSize, long style = 0,
|
||||
const wxValidator& validator = wxDefaultValidator,
|
||||
const wxString& name = wxButtonNameStr)
|
||||
{
|
||||
Create(parent, winid, bitmap, pos, size, style, validator, name);
|
||||
}
|
||||
|
||||
bool Create(wxWindow *parent, wxWindowID winid,
|
||||
const wxBitmap& bitmap,
|
||||
const wxPoint& pos = wxDefaultPosition,
|
||||
const wxSize& size = wxDefaultSize, long style = 0,
|
||||
const wxValidator& validator = wxDefaultValidator,
|
||||
const wxString& name = wxButtonNameStr);
|
||||
virtual ~wxBitmapButton();
|
||||
|
||||
// ------------------------------------------------------------------------
|
||||
// Cocoa callbacks
|
||||
// ------------------------------------------------------------------------
|
||||
protected:
|
||||
virtual void Cocoa_wxNSButtonAction(void);
|
||||
// ------------------------------------------------------------------------
|
||||
// Implementation
|
||||
// ------------------------------------------------------------------------
|
||||
public:
|
||||
// The wxButton::DoGetBestSize is not correct for bitmap buttons
|
||||
wxSize DoGetBestSize() const
|
||||
{ return wxButtonBase::DoGetBestSize(); }
|
||||
};
|
||||
|
||||
#endif // __WX_COCOA_BMPBUTTN_H__
|
@@ -1,69 +0,0 @@
|
||||
/////////////////////////////////////////////////////////////////////////////
|
||||
// Name: wx/cocoa/brush.h
|
||||
// Purpose: wxBrush class
|
||||
// Author: David Elliott <dfe@cox.net>
|
||||
// Modified by:
|
||||
// Created: 2003/07/03
|
||||
// Copyright: (c) 2003 David Elliott
|
||||
// Licence: wxWindows licence
|
||||
/////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
#ifndef __WX_COCOA_BRUSH_H__
|
||||
#define __WX_COCOA_BRUSH_H__
|
||||
|
||||
#include "wx/gdicmn.h"
|
||||
#include "wx/gdiobj.h"
|
||||
#include "wx/bitmap.h"
|
||||
|
||||
class WXDLLIMPEXP_FWD_CORE wxBrush;
|
||||
|
||||
// ========================================================================
|
||||
// wxBrush
|
||||
// ========================================================================
|
||||
class WXDLLIMPEXP_CORE wxBrush: public wxBrushBase
|
||||
{
|
||||
DECLARE_DYNAMIC_CLASS(wxBrush)
|
||||
// ------------------------------------------------------------------------
|
||||
// initialization
|
||||
// ------------------------------------------------------------------------
|
||||
public:
|
||||
wxBrush();
|
||||
wxBrush(const wxColour& col, wxBrushStyle style = wxBRUSHSTYLE_SOLID);
|
||||
wxBrush(const wxBitmap& stipple);
|
||||
virtual ~wxBrush();
|
||||
|
||||
// ------------------------------------------------------------------------
|
||||
// Implementation
|
||||
// ------------------------------------------------------------------------
|
||||
virtual void SetColour(const wxColour& col) ;
|
||||
virtual void SetColour(unsigned char r, unsigned char g, unsigned char b) ;
|
||||
virtual void SetStyle(wxBrushStyle style) ;
|
||||
virtual void SetStipple(const wxBitmap& stipple) ;
|
||||
|
||||
// comparison
|
||||
bool operator == (const wxBrush& brush) const
|
||||
{ return m_refData == brush.m_refData; }
|
||||
bool operator != (const wxBrush& brush) const
|
||||
{ return m_refData != brush.m_refData; }
|
||||
|
||||
// accessors
|
||||
wxColour GetColour() const;
|
||||
virtual wxBrushStyle GetStyle() const;
|
||||
wxBitmap *GetStipple() const;
|
||||
|
||||
|
||||
wxDEPRECATED_MSG("use wxBRUSHSTYLE_XXX constants")
|
||||
wxBrush(const wxColour& col, int style);
|
||||
|
||||
wxDEPRECATED_MSG("use wxBRUSHSTYLE_XXX constants")
|
||||
void SetStyle(int style) { SetStyle((wxBrushStyle)style); }
|
||||
|
||||
// wxCocoa
|
||||
WX_NSColor GetNSColor();
|
||||
|
||||
protected:
|
||||
wxGDIRefData *CreateGDIRefData() const;
|
||||
wxGDIRefData *CloneGDIRefData(const wxGDIRefData *data) const;
|
||||
};
|
||||
|
||||
#endif // __WX_COCOA_BRUSH_H__
|
@@ -1,64 +0,0 @@
|
||||
/////////////////////////////////////////////////////////////////////////////
|
||||
// Name: wx/cocoa/button.h
|
||||
// Purpose: wxButton class
|
||||
// Author: David Elliott
|
||||
// Modified by:
|
||||
// Created: 2002/12/29
|
||||
// Copyright: (c) 2002 David Elliott
|
||||
// Licence: wxWindows licence
|
||||
/////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
#ifndef __WX_COCOA_BUTTON_H__
|
||||
#define __WX_COCOA_BUTTON_H__
|
||||
|
||||
#include "wx/cocoa/NSButton.h"
|
||||
|
||||
// ========================================================================
|
||||
// wxButton
|
||||
// ========================================================================
|
||||
class WXDLLIMPEXP_CORE wxButton : public wxButtonBase, protected wxCocoaNSButton
|
||||
{
|
||||
DECLARE_DYNAMIC_CLASS(wxButton)
|
||||
DECLARE_EVENT_TABLE()
|
||||
WX_DECLARE_COCOA_OWNER(NSButton,NSControl,NSView)
|
||||
// ------------------------------------------------------------------------
|
||||
// initialization
|
||||
// ------------------------------------------------------------------------
|
||||
public:
|
||||
wxButton() { }
|
||||
wxButton(wxWindow *parent, wxWindowID winid,
|
||||
const wxString& label = wxEmptyString,
|
||||
const wxPoint& pos = wxDefaultPosition,
|
||||
const wxSize& size = wxDefaultSize, long style = 0,
|
||||
const wxValidator& validator = wxDefaultValidator,
|
||||
const wxString& name = wxButtonNameStr)
|
||||
{
|
||||
Create(parent, winid, label, pos, size, style, validator, name);
|
||||
}
|
||||
|
||||
|
||||
bool Create(wxWindow *parent, wxWindowID winid,
|
||||
const wxString& label = wxEmptyString,
|
||||
const wxPoint& pos = wxDefaultPosition,
|
||||
const wxSize& size = wxDefaultSize, long style = 0,
|
||||
const wxValidator& validator = wxDefaultValidator,
|
||||
const wxString& name = wxButtonNameStr);
|
||||
|
||||
virtual ~wxButton();
|
||||
|
||||
// ------------------------------------------------------------------------
|
||||
// Cocoa callbacks
|
||||
// ------------------------------------------------------------------------
|
||||
protected:
|
||||
virtual void Cocoa_wxNSButtonAction(void);
|
||||
// ------------------------------------------------------------------------
|
||||
// Implementation
|
||||
// ------------------------------------------------------------------------
|
||||
public:
|
||||
wxString GetLabel() const;
|
||||
void SetLabel(const wxString& label);
|
||||
wxSize DoGetBestSize() const;
|
||||
};
|
||||
|
||||
#endif
|
||||
// __WX_COCOA_BUTTON_H__
|
@@ -1,68 +0,0 @@
|
||||
/////////////////////////////////////////////////////////////////////////////
|
||||
// Name: wx/cocoa/checkbox.h
|
||||
// Purpose: wxCheckBox class
|
||||
// Author: David Elliott
|
||||
// Modified by:
|
||||
// Created: 2003/03/16
|
||||
// Copyright: (c) 2003 David Elliott
|
||||
// Licence: wxWindows licence
|
||||
/////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
#ifndef __WX_COCOA_CHECKBOX_H__
|
||||
#define __WX_COCOA_CHECKBOX_H__
|
||||
|
||||
#include "wx/cocoa/NSButton.h"
|
||||
|
||||
// ========================================================================
|
||||
// wxCheckBox
|
||||
// ========================================================================
|
||||
class WXDLLIMPEXP_CORE wxCheckBox: public wxCheckBoxBase , protected wxCocoaNSButton
|
||||
{
|
||||
DECLARE_DYNAMIC_CLASS(wxCheckBox)
|
||||
DECLARE_EVENT_TABLE()
|
||||
WX_DECLARE_COCOA_OWNER(NSButton,NSControl,NSView)
|
||||
// ------------------------------------------------------------------------
|
||||
// initialization
|
||||
// ------------------------------------------------------------------------
|
||||
public:
|
||||
wxCheckBox() { }
|
||||
wxCheckBox(wxWindow *parent, wxWindowID winid,
|
||||
const wxString& label,
|
||||
const wxPoint& pos = wxDefaultPosition,
|
||||
const wxSize& size = wxDefaultSize,
|
||||
long style = 0,
|
||||
const wxValidator& validator = wxDefaultValidator,
|
||||
const wxString& name = wxCheckBoxNameStr)
|
||||
{
|
||||
Create(parent, winid, label, pos, size, style, validator, name);
|
||||
}
|
||||
|
||||
bool Create(wxWindow *parent, wxWindowID winid,
|
||||
const wxString& label,
|
||||
const wxPoint& pos = wxDefaultPosition,
|
||||
const wxSize& size = wxDefaultSize,
|
||||
long style = 0,
|
||||
const wxValidator& validator = wxDefaultValidator,
|
||||
const wxString& name = wxCheckBoxNameStr);
|
||||
virtual ~wxCheckBox();
|
||||
|
||||
// ------------------------------------------------------------------------
|
||||
// Cocoa callbacks
|
||||
// ------------------------------------------------------------------------
|
||||
protected:
|
||||
virtual void Cocoa_wxNSButtonAction(void);
|
||||
// ------------------------------------------------------------------------
|
||||
// Implementation
|
||||
// ------------------------------------------------------------------------
|
||||
public:
|
||||
virtual void SetValue(bool);
|
||||
virtual bool GetValue() const;
|
||||
virtual void SetLabel(const wxString& label);
|
||||
virtual wxString GetLabel() const;
|
||||
|
||||
protected:
|
||||
virtual void DoSet3StateValue(wxCheckBoxState state);
|
||||
virtual wxCheckBoxState DoGet3StateValue() const;
|
||||
};
|
||||
|
||||
#endif // __WX_COCOA_CHECKBOX_H__
|
@@ -1,79 +0,0 @@
|
||||
/////////////////////////////////////////////////////////////////////////////
|
||||
// Name: wx/cocoa/checklst.h
|
||||
// Purpose: wxCheckListBox class
|
||||
// Author: David Elliott
|
||||
// Modified by:
|
||||
// Created: 2003/03/16
|
||||
// Copyright: (c) 2003 David Elliott
|
||||
// Licence: wxWindows licence
|
||||
/////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
#ifndef __WX_COCOA_CHECKLST_H__
|
||||
#define __WX_COCOA_CHECKLST_H__
|
||||
|
||||
//#include "wx/cocoa/NSTableView.h"
|
||||
|
||||
// ========================================================================
|
||||
// wxCheckListBox
|
||||
// ========================================================================
|
||||
class WXDLLIMPEXP_CORE wxCheckListBox: public wxCheckListBoxBase //, protected wxCocoaNSTableView
|
||||
{
|
||||
DECLARE_DYNAMIC_CLASS(wxCheckListBox)
|
||||
DECLARE_EVENT_TABLE()
|
||||
WX_DECLARE_COCOA_OWNER(NSTableView,NSControl,NSView)
|
||||
// ------------------------------------------------------------------------
|
||||
// initialization
|
||||
// ------------------------------------------------------------------------
|
||||
public:
|
||||
wxCheckListBox() { }
|
||||
wxCheckListBox(wxWindow *parent, wxWindowID winid,
|
||||
const wxPoint& pos = wxDefaultPosition,
|
||||
const wxSize& size = wxDefaultSize,
|
||||
int n = 0, const wxString choices[] = NULL,
|
||||
long style = 0,
|
||||
const wxValidator& validator = wxDefaultValidator,
|
||||
const wxString& name = wxListBoxNameStr)
|
||||
{
|
||||
Create(parent, winid, pos, size, n, choices, style, validator, name);
|
||||
}
|
||||
wxCheckListBox(wxWindow *parent, wxWindowID winid,
|
||||
const wxPoint& pos,
|
||||
const wxSize& size,
|
||||
const wxArrayString& choices,
|
||||
long style = 0,
|
||||
const wxValidator& validator = wxDefaultValidator,
|
||||
const wxString& name = wxListBoxNameStr)
|
||||
{
|
||||
Create(parent, winid, pos, size, choices, style, validator, name);
|
||||
}
|
||||
|
||||
bool Create(wxWindow *parent, wxWindowID winid,
|
||||
const wxPoint& pos = wxDefaultPosition,
|
||||
const wxSize& size = wxDefaultSize,
|
||||
int n = 0, const wxString choices[] = NULL,
|
||||
long style = 0,
|
||||
const wxValidator& validator = wxDefaultValidator,
|
||||
const wxString& name = wxListBoxNameStr);
|
||||
bool Create(wxWindow *parent, wxWindowID winid,
|
||||
const wxPoint& pos,
|
||||
const wxSize& size,
|
||||
const wxArrayString& choices,
|
||||
long style = 0,
|
||||
const wxValidator& validator = wxDefaultValidator,
|
||||
const wxString& name = wxListBoxNameStr);
|
||||
virtual ~wxCheckListBox();
|
||||
|
||||
// ------------------------------------------------------------------------
|
||||
// Cocoa callbacks
|
||||
// ------------------------------------------------------------------------
|
||||
protected:
|
||||
// ------------------------------------------------------------------------
|
||||
// Implementation
|
||||
// ------------------------------------------------------------------------
|
||||
public:
|
||||
// check list box specific methods
|
||||
virtual bool IsChecked(unsigned int item) const;
|
||||
virtual void Check(unsigned int item, bool check = true);
|
||||
};
|
||||
|
||||
#endif // __WX_COCOA_CHECKLST_H__
|
@@ -1,21 +0,0 @@
|
||||
/*
|
||||
* Name: wx/cocoa/chkconf.h
|
||||
* Purpose: wxCocoa-specific config settings checks
|
||||
* Author: Vadim Zeitlin
|
||||
* Created: 2008-09-11
|
||||
* Copyright: (c) 2008 Vadim Zeitlin <vadim@wxwidgets.org>
|
||||
* Licence: wxWindows licence
|
||||
*/
|
||||
|
||||
/* THIS IS A C FILE, DON'T USE C++ FEATURES (IN PARTICULAR COMMENTS) IN IT */
|
||||
|
||||
#ifndef _WX_COCOA_CHKCONF_H_
|
||||
#define _WX_COCOA_CHKCONF_H_
|
||||
|
||||
/*
|
||||
wxLogDialog doesn't currently work correctly in wxCocoa.
|
||||
*/
|
||||
#undef wxUSE_LOG_DIALOG
|
||||
#define wxUSE_LOG_DIALOG 0
|
||||
|
||||
#endif /* _WX_COCOA_CHKCONF_H_ */
|
@@ -1,100 +0,0 @@
|
||||
/////////////////////////////////////////////////////////////////////////////
|
||||
// Name: wx/cocoa/choice.h
|
||||
// Purpose: wxChoice class
|
||||
// Author: David Elliott
|
||||
// Modified by:
|
||||
// Created: 2003/03/16
|
||||
// Copyright: (c) 2003 David Elliott
|
||||
// Licence: wxWindows licence
|
||||
/////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
#ifndef __WX_COCOA_CHOICE_H__
|
||||
#define __WX_COCOA_CHOICE_H__
|
||||
|
||||
//#include "wx/cocoa/NSPopUpButton.h"
|
||||
#include "wx/cocoa/NSMenu.h"
|
||||
|
||||
class WXDLLIMPEXP_FWD_BASE wxSortedArrayString;
|
||||
|
||||
// ========================================================================
|
||||
// wxChoice
|
||||
// ========================================================================
|
||||
class WXDLLIMPEXP_CORE wxChoice: public wxChoiceBase /*, protected wxCocoaNSPopUpButton */, protected wxCocoaNSMenu
|
||||
{
|
||||
DECLARE_DYNAMIC_CLASS(wxChoice)
|
||||
DECLARE_EVENT_TABLE()
|
||||
// WX_DECLARE_COCOA_OWNER(NSTableView,NSControl,NSView)
|
||||
// ------------------------------------------------------------------------
|
||||
// initialization
|
||||
// ------------------------------------------------------------------------
|
||||
public:
|
||||
wxChoice() { Init(); }
|
||||
wxChoice(wxWindow *parent, wxWindowID winid,
|
||||
const wxPoint& pos = wxDefaultPosition,
|
||||
const wxSize& size = wxDefaultSize,
|
||||
int n = 0, const wxString choices[] = NULL,
|
||||
long style = 0,
|
||||
const wxValidator& validator = wxDefaultValidator,
|
||||
const wxString& name = wxChoiceNameStr)
|
||||
{
|
||||
Init();
|
||||
Create(parent, winid, pos, size, n, choices, style, validator, name);
|
||||
}
|
||||
wxChoice(wxWindow *parent, wxWindowID winid,
|
||||
const wxPoint& pos,
|
||||
const wxSize& size,
|
||||
const wxArrayString& choices,
|
||||
long style = 0,
|
||||
const wxValidator& validator = wxDefaultValidator,
|
||||
const wxString& name = wxChoiceNameStr)
|
||||
{
|
||||
Init();
|
||||
Create(parent, winid, pos, size, choices, style, validator, name);
|
||||
}
|
||||
|
||||
bool Create(wxWindow *parent, wxWindowID winid,
|
||||
const wxPoint& pos = wxDefaultPosition,
|
||||
const wxSize& size = wxDefaultSize,
|
||||
int n = 0, const wxString choices[] = NULL,
|
||||
long style = 0,
|
||||
const wxValidator& validator = wxDefaultValidator,
|
||||
const wxString& name = wxChoiceNameStr);
|
||||
bool Create(wxWindow *parent, wxWindowID winid,
|
||||
const wxPoint& pos,
|
||||
const wxSize& size,
|
||||
const wxArrayString& choices,
|
||||
long style = 0,
|
||||
const wxValidator& validator = wxDefaultValidator,
|
||||
const wxString& name = wxChoiceNameStr);
|
||||
virtual ~wxChoice();
|
||||
protected:
|
||||
void Init();
|
||||
|
||||
// ------------------------------------------------------------------------
|
||||
// Cocoa callbacks
|
||||
// ------------------------------------------------------------------------
|
||||
protected:
|
||||
void CocoaNotification_menuDidSendAction(WX_NSNotification notification);
|
||||
// ------------------------------------------------------------------------
|
||||
// Implementation
|
||||
// ------------------------------------------------------------------------
|
||||
public:
|
||||
virtual void DoClear();
|
||||
virtual unsigned int GetCount() const;
|
||||
virtual wxString GetString(unsigned int) const;
|
||||
virtual void SetString(unsigned int pos, const wxString&);
|
||||
virtual int FindString(const wxString& s, bool bCase = false) const;
|
||||
virtual int GetSelection() const;
|
||||
virtual int DoInsertItems(const wxArrayStringsAdapter& items,
|
||||
unsigned int pos,
|
||||
void **clientData, wxClientDataType type);
|
||||
virtual void DoDeleteOneItem(unsigned int pos);
|
||||
virtual void DoSetItemClientData(unsigned int, void*);
|
||||
virtual void* DoGetItemClientData(unsigned int) const;
|
||||
virtual void SetSelection(int pos);
|
||||
protected:
|
||||
wxSortedArrayString *m_sortedStrings;
|
||||
wxArrayPtrVoid m_itemsClientData;
|
||||
};
|
||||
|
||||
#endif // __WX_COCOA_CHOICE_H__
|
@@ -1,51 +0,0 @@
|
||||
/////////////////////////////////////////////////////////////////////////////
|
||||
// Name: wx/cocoa/clipbrd.h
|
||||
// Purpose: wxClipboard
|
||||
// Author: David Elliott <dfe@cox.net>
|
||||
// Modified by:
|
||||
// Created: 2003/07/23
|
||||
// Copyright: (c) 2003 David Elliott
|
||||
// Licence: wxWindows licence
|
||||
/////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
#ifndef __WX_COCOA_CLIPBRD_H__
|
||||
#define __WX_COCOA_CLIPBRD_H__
|
||||
|
||||
#include "wx/dataobj.h"
|
||||
|
||||
//=========================================================================
|
||||
// wxClipboard
|
||||
//=========================================================================
|
||||
class wxClipboard : public wxClipboardBase
|
||||
{
|
||||
DECLARE_DYNAMIC_CLASS(wxClipboard)
|
||||
public:
|
||||
wxClipboard();
|
||||
virtual ~wxClipboard();
|
||||
|
||||
// open the clipboard before SetData() and GetData()
|
||||
virtual bool Open();
|
||||
|
||||
// close the clipboard after SetData() and GetData()
|
||||
virtual void Close();
|
||||
|
||||
// query whether the clipboard is opened
|
||||
virtual bool IsOpened() const;
|
||||
|
||||
// set the clipboard data. all other formats will be deleted.
|
||||
virtual bool SetData( wxDataObject *data );
|
||||
|
||||
// add to the clipboard data.
|
||||
virtual bool AddData( wxDataObject *data );
|
||||
|
||||
// ask if data in correct format is available
|
||||
virtual bool IsSupported( const wxDataFormat& format );
|
||||
|
||||
// fill data with data on the clipboard (if available)
|
||||
virtual bool GetData( wxDataObject& data );
|
||||
|
||||
// clears wxTheClipboard and the system's clipboard if possible
|
||||
virtual void Clear();
|
||||
};
|
||||
|
||||
#endif //__WX_COCOA_CLIPBRD_H__
|
@@ -1 +0,0 @@
|
||||
|
@@ -1,92 +0,0 @@
|
||||
/////////////////////////////////////////////////////////////////////////////
|
||||
// Name: wx/cocoa/colour.h
|
||||
// Purpose: wxColour class
|
||||
// Author: David Elliott
|
||||
// Modified by:
|
||||
// Created: 2003/06/17
|
||||
// Copyright: (c) 2003 David Elliott
|
||||
// Licence: wxWindows licence
|
||||
/////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
#ifndef __WX_COCOA_COLOUR_H__
|
||||
#define __WX_COCOA_COLOUR_H__
|
||||
|
||||
#include "wx/object.h"
|
||||
#include "wx/string.h"
|
||||
|
||||
// ========================================================================
|
||||
// wxColour
|
||||
// ========================================================================
|
||||
|
||||
class WXDLLIMPEXP_CORE wxColour : public wxColourBase
|
||||
{
|
||||
public:
|
||||
// constructors
|
||||
// ------------
|
||||
DEFINE_STD_WXCOLOUR_CONSTRUCTORS
|
||||
|
||||
// initialization using existing NSColor
|
||||
wxColour( WX_NSColor aColor );
|
||||
|
||||
// copy ctors and assignment operators
|
||||
wxColour( const wxColour& col );
|
||||
wxColour& operator = ( const wxColour& col );
|
||||
|
||||
virtual ~wxColour();
|
||||
|
||||
// accessors
|
||||
virtual bool IsOk() const { return m_cocoaNSColor; }
|
||||
WX_NSColor GetNSColor() { return m_cocoaNSColor; }
|
||||
WX_NSColor GetNSColor() const { return m_cocoaNSColor; }
|
||||
|
||||
unsigned char Red() const { return m_red; }
|
||||
unsigned char Green() const { return m_green; }
|
||||
unsigned char Blue() const { return m_blue; }
|
||||
unsigned char Alpha() const { return m_alpha; }
|
||||
|
||||
// comparison
|
||||
bool operator == (const wxColour& colour) const
|
||||
{
|
||||
return m_cocoaNSColor == colour.m_cocoaNSColor ||
|
||||
(m_red == colour.m_red &&
|
||||
m_green == colour.m_green &&
|
||||
m_blue == colour.m_blue &&
|
||||
m_alpha == colour.m_alpha);
|
||||
}
|
||||
bool operator != (const wxColour& colour) const
|
||||
{ return !(*this == colour); }
|
||||
|
||||
// Set() functions
|
||||
void Set( WX_NSColor aColor );
|
||||
|
||||
// reroute the inherited ones
|
||||
void Set(unsigned char red,
|
||||
unsigned char green,
|
||||
unsigned char blue,
|
||||
unsigned char alpha = wxALPHA_OPAQUE)
|
||||
{ wxColourBase::Set(red, green, blue, alpha); }
|
||||
|
||||
bool Set(const wxString &str)
|
||||
{ return wxColourBase::Set(str); }
|
||||
|
||||
void Set(unsigned long colRGB)
|
||||
{ wxColourBase::Set(colRGB); }
|
||||
|
||||
protected:
|
||||
// puts the object in an invalid, uninitialized state
|
||||
void Init();
|
||||
|
||||
virtual void
|
||||
InitRGBA(unsigned char r, unsigned char g, unsigned char b, unsigned char a);
|
||||
|
||||
private:
|
||||
WX_NSColor m_cocoaNSColor;
|
||||
unsigned char m_red;
|
||||
unsigned char m_green;
|
||||
unsigned char m_blue;
|
||||
unsigned char m_alpha;
|
||||
|
||||
DECLARE_DYNAMIC_CLASS(wxColour)
|
||||
};
|
||||
|
||||
#endif // __WX_COCOA_COLOUR_H__
|
@@ -1,157 +0,0 @@
|
||||
/////////////////////////////////////////////////////////////////////////////
|
||||
// Name: wx/cocoa/combobox.h
|
||||
// Purpose: wxComboBox class
|
||||
// Author: Ryan Norton
|
||||
// Modified by:
|
||||
// Created: 2005/02/16
|
||||
// Copyright: (c) 2003 David Elliott
|
||||
// Licence: wxWindows licence
|
||||
/////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
#ifndef __WX_COCOA_COMBOBOX_H__
|
||||
#define __WX_COCOA_COMBOBOX_H__
|
||||
|
||||
//Begin NSComboBox.h
|
||||
|
||||
#include "wx/hashmap.h"
|
||||
#include "wx/cocoa/ObjcAssociate.h"
|
||||
|
||||
#include "wx/textctrl.h"
|
||||
|
||||
DECLARE_WXCOCOA_OBJC_CLASS(NSComboBox);
|
||||
|
||||
WX_DECLARE_OBJC_HASHMAP(NSComboBox);
|
||||
class wxCocoaNSComboBox
|
||||
{
|
||||
WX_DECLARE_OBJC_INTERFACE_HASHMAP(NSComboBox)
|
||||
public:
|
||||
void AssociateNSComboBox(WX_NSComboBox cocoaNSComboBox);
|
||||
void DisassociateNSComboBox(WX_NSComboBox cocoaNSComboBox);
|
||||
|
||||
virtual void doWxEvent(int nEvent) = 0;
|
||||
virtual ~wxCocoaNSComboBox() { }
|
||||
};
|
||||
|
||||
//begin combobox.h
|
||||
|
||||
#include "wx/dynarray.h"
|
||||
|
||||
// ========================================================================
|
||||
// wxComboBox
|
||||
// ========================================================================
|
||||
class WXDLLIMPEXP_CORE wxComboBox : public wxControl, public wxComboBoxBase, protected wxCocoaNSComboBox, protected wxCocoaNSTextField
|
||||
{
|
||||
DECLARE_DYNAMIC_CLASS(wxComboBox)
|
||||
DECLARE_EVENT_TABLE()
|
||||
WX_DECLARE_COCOA_OWNER(NSComboBox,NSTextField,NSView)
|
||||
WX_DECLARE_COCOA_OWNER(NSTextField,NSControl,NSView)
|
||||
// ------------------------------------------------------------------------
|
||||
// initialization
|
||||
// ------------------------------------------------------------------------
|
||||
public:
|
||||
wxComboBox() { }
|
||||
wxComboBox(wxWindow *parent, wxWindowID winid,
|
||||
const wxString& value = wxEmptyString,
|
||||
const wxPoint& pos = wxDefaultPosition,
|
||||
const wxSize& size = wxDefaultSize,
|
||||
int n = 0, const wxString choices[] = NULL,
|
||||
long style = 0,
|
||||
const wxValidator& validator = wxDefaultValidator,
|
||||
const wxString& name = wxComboBoxNameStr)
|
||||
{
|
||||
Create(parent, winid, value, pos, size, n, choices, style, validator, name);
|
||||
}
|
||||
wxComboBox(wxWindow *parent, wxWindowID winid,
|
||||
const wxString& value,
|
||||
const wxPoint& pos,
|
||||
const wxSize& size,
|
||||
const wxArrayString& choices,
|
||||
long style = 0,
|
||||
const wxValidator& validator = wxDefaultValidator,
|
||||
const wxString& name = wxComboBoxNameStr)
|
||||
{
|
||||
Create(parent, winid, value, pos, size, choices, style,
|
||||
validator, name);
|
||||
}
|
||||
|
||||
bool Create(wxWindow *parent, wxWindowID winid,
|
||||
const wxString& value = wxEmptyString,
|
||||
const wxPoint& pos = wxDefaultPosition,
|
||||
const wxSize& size = wxDefaultSize,
|
||||
int n = 0, const wxString choices[] = NULL,
|
||||
long style = 0,
|
||||
const wxValidator& validator = wxDefaultValidator,
|
||||
const wxString& name = wxComboBoxNameStr);
|
||||
bool Create(wxWindow *parent, wxWindowID winid,
|
||||
const wxString& value,
|
||||
const wxPoint& pos,
|
||||
const wxSize& size,
|
||||
const wxArrayString& choices,
|
||||
long style = 0,
|
||||
const wxValidator& validator = wxDefaultValidator,
|
||||
const wxString& name = wxComboBoxNameStr);
|
||||
virtual ~wxComboBox();
|
||||
|
||||
// ------------------------------------------------------------------------
|
||||
// Cocoa callbacks
|
||||
// ------------------------------------------------------------------------
|
||||
protected:
|
||||
wxArrayPtrVoid m_Datas;
|
||||
virtual void doWxEvent(int nEvent);
|
||||
|
||||
virtual void Cocoa_didChangeText()
|
||||
{}
|
||||
// ------------------------------------------------------------------------
|
||||
// Implementation
|
||||
// ------------------------------------------------------------------------
|
||||
public:
|
||||
void Clear() // HACK
|
||||
{ wxComboBoxBase::Clear(); }
|
||||
|
||||
// wxCombobox methods
|
||||
virtual void SetSelection(int pos);
|
||||
// Overlapping methods
|
||||
virtual wxString GetStringSelection();
|
||||
// wxItemContainer
|
||||
virtual void DoClear();
|
||||
virtual void DoDeleteOneItem(unsigned int n);
|
||||
virtual unsigned int GetCount() const;
|
||||
virtual wxString GetString(unsigned int) const;
|
||||
virtual void SetString(unsigned int pos, const wxString&);
|
||||
virtual int FindString(const wxString& s, bool bCase = false) const;
|
||||
virtual int GetSelection() const;
|
||||
virtual int DoInsertItems(const wxArrayStringsAdapter& items,
|
||||
unsigned int pos,
|
||||
void **clientData, wxClientDataType type);
|
||||
virtual void DoSetItemClientData(unsigned int, void*);
|
||||
virtual void* DoGetItemClientData(unsigned int) const;
|
||||
virtual bool IsSorted() const { return HasFlag(wxCB_SORT); }
|
||||
|
||||
// ------------------------------------------------------------------------
|
||||
// wxTextEntryBase virtual implementations:
|
||||
// ------------------------------------------------------------------------
|
||||
// FIXME: This needs to be moved to some sort of common code.
|
||||
virtual void WriteText(const wxString&);
|
||||
virtual wxString GetValue() const;
|
||||
virtual void Remove(long, long);
|
||||
virtual void Cut();
|
||||
virtual void Copy();
|
||||
virtual void Paste();
|
||||
virtual void Undo();
|
||||
virtual void Redo();
|
||||
virtual bool CanUndo() const;
|
||||
virtual bool CanRedo() const;
|
||||
virtual void SetInsertionPoint(long pos);
|
||||
virtual long GetInsertionPoint() const;
|
||||
virtual wxTextPos GetLastPosition() const;
|
||||
virtual void SetSelection(long from, long to);
|
||||
virtual void GetSelection(long *from, long *to) const;
|
||||
virtual bool IsEditable() const;
|
||||
virtual void SetEditable(bool editable);
|
||||
|
||||
private:
|
||||
// implement wxTextEntry pure virtual method
|
||||
virtual wxWindow *GetEditableWindow() { return this; }
|
||||
};
|
||||
|
||||
#endif // __WX_COCOA_COMBOBOX_H__
|
@@ -1,77 +0,0 @@
|
||||
/////////////////////////////////////////////////////////////////////////////
|
||||
// Name: wx/cocoa/control.h
|
||||
// Purpose: wxControl class
|
||||
// Author: David Elliott
|
||||
// Modified by:
|
||||
// Created: 2003/02/15
|
||||
// Copyright: (c) 2003 David Elliott
|
||||
// Licence: wxWindows licence
|
||||
/////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
#ifndef __WX_COCOA_CONTROL_H__
|
||||
#define __WX_COCOA_CONTROL_H__
|
||||
|
||||
#include "wx/cocoa/NSControl.h"
|
||||
|
||||
// ========================================================================
|
||||
// wxControl
|
||||
// ========================================================================
|
||||
|
||||
class WXDLLIMPEXP_CORE wxControl : public wxControlBase, public wxCocoaNSControl
|
||||
{
|
||||
DECLARE_ABSTRACT_CLASS(wxControl)
|
||||
WX_DECLARE_COCOA_OWNER(NSControl,NSView,NSView)
|
||||
DECLARE_EVENT_TABLE()
|
||||
// ------------------------------------------------------------------------
|
||||
// initialization
|
||||
// ------------------------------------------------------------------------
|
||||
public:
|
||||
wxControl() {}
|
||||
wxControl(wxWindow *parent, wxWindowID winid,
|
||||
const wxPoint& pos = wxDefaultPosition,
|
||||
const wxSize& size = wxDefaultSize, long style = 0,
|
||||
const wxValidator& validator = wxDefaultValidator,
|
||||
const wxString& name = wxControlNameStr)
|
||||
{
|
||||
Create(parent, winid, pos, size, style, validator, name);
|
||||
}
|
||||
|
||||
bool Create(wxWindow *parent, wxWindowID winid,
|
||||
const wxPoint& pos = wxDefaultPosition,
|
||||
const wxSize& size = wxDefaultSize, long style = 0,
|
||||
const wxValidator& validator = wxDefaultValidator,
|
||||
const wxString& name = wxControlNameStr);
|
||||
virtual ~wxControl();
|
||||
|
||||
// ------------------------------------------------------------------------
|
||||
// Implementation
|
||||
// ------------------------------------------------------------------------
|
||||
public:
|
||||
|
||||
// implementation from now on
|
||||
// --------------------------
|
||||
|
||||
void OnEraseBackground(wxEraseEvent& event);
|
||||
|
||||
virtual void Command(wxCommandEvent& event) { ProcessCommand(event); }
|
||||
|
||||
// Calls the callback and appropriate event handlers
|
||||
bool ProcessCommand(wxCommandEvent& event);
|
||||
|
||||
// Enables the control
|
||||
virtual void CocoaSetEnabled(bool enable);
|
||||
protected:
|
||||
virtual wxSize DoGetBestSize() const;
|
||||
|
||||
// Provides a common implementation of title setting which strips mnemonics
|
||||
// and then calls setTitle: with the stripped string. May be implemented
|
||||
// to call setTitleWithMnemonic: on OpenStep-compatible systems. Only
|
||||
// intended for use by views or cells which implement at least setTitle:
|
||||
// and possibly setTitleWithMnemonic: such as NSBox and NSButton or NSCell
|
||||
// classes, for example as used by wxRadioBox. Not usable with classes like
|
||||
// NSTextField which expect setStringValue:.
|
||||
static void CocoaSetLabelForObject(const wxString& labelWithWxMnemonic, struct objc_object *anObject);
|
||||
};
|
||||
|
||||
#endif
|
||||
// __WX_COCOA_CONTROL_H__
|
@@ -1,64 +0,0 @@
|
||||
/////////////////////////////////////////////////////////////////////////////
|
||||
// Name: wx/cocoa/cursor.h
|
||||
// Purpose: wxCursor class
|
||||
// Author: David Elliott <dfe@cox.net>
|
||||
// Modified by:
|
||||
// Created: 2002/11/27
|
||||
// Copyright: (c) David Elliott
|
||||
// Licence: wxWindows licence
|
||||
/////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
#ifndef _WX_COCOA_CURSOR_H_
|
||||
#define _WX_COCOA_CURSOR_H_
|
||||
|
||||
#include "wx/bitmap.h"
|
||||
|
||||
class WXDLLIMPEXP_CORE wxCursorRefData : public wxGDIRefData
|
||||
{
|
||||
public:
|
||||
wxCursorRefData();
|
||||
virtual ~wxCursorRefData();
|
||||
|
||||
protected:
|
||||
int m_width, m_height;
|
||||
WX_NSCursor m_hCursor;
|
||||
|
||||
friend class WXDLLIMPEXP_FWD_CORE wxBitmap;
|
||||
friend class WXDLLIMPEXP_FWD_CORE wxCursor;
|
||||
|
||||
wxDECLARE_NO_COPY_CLASS(wxCursorRefData);
|
||||
};
|
||||
|
||||
#define M_CURSORDATA ((wxCursorRefData *)m_refData)
|
||||
#define M_CURSORHANDLERDATA ((wxCursorRefData *)bitmap->m_refData)
|
||||
|
||||
// Cursor
|
||||
class WXDLLIMPEXP_CORE wxCursor: public wxBitmap
|
||||
{
|
||||
public:
|
||||
wxCursor();
|
||||
|
||||
wxCursor(const wxString& name, wxBitmapType type = wxCURSOR_DEFAULT_TYPE,
|
||||
int hotSpotX = 0, int hotSpotY = 0);
|
||||
|
||||
wxCursor(wxStockCursor id) { InitFromStock(id); }
|
||||
#if WXWIN_COMPATIBILITY_2_8
|
||||
wxCursor(int id) { InitFromStock((wxStockCursor)id); }
|
||||
#endif
|
||||
virtual ~wxCursor();
|
||||
|
||||
// FIXME: operator==() is wrong!
|
||||
bool operator==(const wxCursor& cursor) const { return m_refData == cursor.m_refData; }
|
||||
bool operator!=(const wxCursor& cursor) const { return !(*this == cursor); }
|
||||
|
||||
WX_NSCursor GetNSCursor() const { return M_CURSORDATA ? M_CURSORDATA->m_hCursor : 0; }
|
||||
|
||||
private:
|
||||
void InitFromStock(wxStockCursor);
|
||||
DECLARE_DYNAMIC_CLASS(wxCursor)
|
||||
};
|
||||
|
||||
extern WXDLLIMPEXP_CORE void wxSetCursor(const wxCursor& cursor);
|
||||
|
||||
#endif
|
||||
// _WX_COCOA_CURSOR_H_
|
@@ -1,50 +0,0 @@
|
||||
///////////////////////////////////////////////////////////////////////////////
|
||||
// Name: wx/cocoa/dataform.h
|
||||
// Purpose: declaration of the wxDataFormat class
|
||||
// Author: David Elliott <dfe@cox.net>
|
||||
// Modified by:
|
||||
// Created: 2003/07/23
|
||||
// Copyright: (c) 2003 David Elliott
|
||||
// Licence: wxWindows licence
|
||||
///////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
#ifndef __WX_COCOA_DATAFORM_H__
|
||||
#define __WX_COCOA_DATAFORM_H__
|
||||
|
||||
class wxDataFormat
|
||||
{
|
||||
public:
|
||||
wxDataFormat(unsigned int uFormat = wxDF_INVALID) { m_uFormat = uFormat; }
|
||||
wxDataFormat(const wxString& zFormat) { SetId(zFormat); }
|
||||
|
||||
wxDataFormat& operator=(unsigned int uFormat) { m_uFormat = uFormat; return(*this); }
|
||||
wxDataFormat& operator=(const wxDataFormat& rFormat) {m_uFormat = rFormat.m_uFormat; return(*this); }
|
||||
|
||||
//
|
||||
// Comparison (must have both versions)
|
||||
//
|
||||
bool operator==(wxDataFormatId eFormat) const { return (m_uFormat == (unsigned int)eFormat); }
|
||||
bool operator!=(wxDataFormatId eFormat) const { return (m_uFormat != (unsigned int)eFormat); }
|
||||
bool operator==(const wxDataFormat& rFormat) const { return (m_uFormat == rFormat.m_uFormat); }
|
||||
bool operator!=(const wxDataFormat& rFormat) const { return (m_uFormat != rFormat.m_uFormat); }
|
||||
operator unsigned int(void) const { return m_uFormat; }
|
||||
|
||||
unsigned int GetFormatId(void) const { return (unsigned int)m_uFormat; }
|
||||
unsigned int GetType(void) const { return (unsigned int)m_uFormat; }
|
||||
|
||||
bool IsStandard(void) const;
|
||||
|
||||
void SetType(unsigned int uType){ m_uFormat = uType; }
|
||||
|
||||
//
|
||||
// String ids are used for custom types - this SetId() must be used for
|
||||
// application-specific formats
|
||||
//
|
||||
wxString GetId(void) const;
|
||||
void SetId(const wxString& WXUNUSED(pId)) { /* TODO */ }
|
||||
|
||||
private:
|
||||
unsigned int m_uFormat;
|
||||
}; // end of CLASS wxDataFormat
|
||||
|
||||
#endif // __WX_COCOA_DATAFORM_H__
|
@@ -1,23 +0,0 @@
|
||||
///////////////////////////////////////////////////////////////////////////////
|
||||
// Name: wx/cocoa/dataobj.h
|
||||
// Purpose: declaration of the wxDataObject
|
||||
// Author: David Elliott <dfe@cox.net>
|
||||
// Modified by:
|
||||
// Created: 2003/07/23
|
||||
// Copyright: (c) 2003 David Elliott
|
||||
// Licence: wxWindows licence
|
||||
///////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
#ifndef __WX_COCOA_DATAOBJ_H__
|
||||
#define __WX_COCOA_DATAOBJ_H__
|
||||
|
||||
class WXDLLIMPEXP_CORE wxDataObject : public wxDataObjectBase
|
||||
{
|
||||
public:
|
||||
wxDataObject();
|
||||
virtual ~wxDataObject();
|
||||
virtual bool IsSupportedFormat(const wxDataFormat& format,
|
||||
Direction dir = Get) const;
|
||||
};
|
||||
|
||||
#endif // __WX_COCOA_DATAOBJ_H__
|
@@ -1,83 +0,0 @@
|
||||
///////////////////////////////////////////////////////////////////////////////
|
||||
// Name: wx/cocoa/dataobj2.h
|
||||
// Purpose: declaration of standard wxDataObjectSimple-derived classes
|
||||
// Author: David Elliott <dfe@cox.net>
|
||||
// Modified by:
|
||||
// Created: 2003/07/23
|
||||
// Copyright: (c) 2003 David Elliott
|
||||
// Licence: wxWindows licence
|
||||
///////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
#ifndef __WX_COCOA_DATAOBJ2_H__
|
||||
#define __WX_COCOA_DATAOBJ2_H__
|
||||
|
||||
//=========================================================================
|
||||
// wxBitmapDataObject is a specialization of wxDataObject for bitmaps
|
||||
//=========================================================================
|
||||
class WXDLLIMPEXP_CORE wxBitmapDataObject : public wxBitmapDataObjectBase
|
||||
{
|
||||
public:
|
||||
// ctors
|
||||
wxBitmapDataObject();
|
||||
wxBitmapDataObject(const wxBitmap& bitmap);
|
||||
|
||||
// destr
|
||||
virtual ~wxBitmapDataObject();
|
||||
|
||||
// override base class virtual to update PNG data too
|
||||
virtual void SetBitmap(const wxBitmap& bitmap);
|
||||
|
||||
// implement base class pure virtuals
|
||||
// ----------------------------------
|
||||
|
||||
virtual size_t GetDataSize() const { return m_pngSize; }
|
||||
virtual bool GetDataHere(void *buf) const;
|
||||
virtual bool SetData(size_t len, const void *buf);
|
||||
|
||||
protected:
|
||||
void Init() { m_pngData = NULL; m_pngSize = 0; }
|
||||
void Clear() { free(m_pngData); }
|
||||
void ClearAll() { Clear(); Init(); }
|
||||
|
||||
size_t m_pngSize;
|
||||
void *m_pngData;
|
||||
|
||||
void DoConvertToPng();
|
||||
|
||||
private:
|
||||
// virtual function hiding supression
|
||||
size_t GetDataSize(const wxDataFormat& format) const
|
||||
{ return(wxDataObjectSimple::GetDataSize(format)); }
|
||||
bool GetDataHere(const wxDataFormat& format, void* pBuf) const
|
||||
{ return(wxDataObjectSimple::GetDataHere(format, pBuf)); }
|
||||
bool SetData(const wxDataFormat& format, size_t nLen, const void* pBuf)
|
||||
{ return(wxDataObjectSimple::SetData(format, nLen, pBuf)); }
|
||||
};
|
||||
|
||||
//=========================================================================
|
||||
// wxFileDataObject is a specialization of wxDataObject for file names
|
||||
//=========================================================================
|
||||
|
||||
class WXDLLIMPEXP_CORE wxFileDataObject : public wxFileDataObjectBase
|
||||
{
|
||||
public:
|
||||
// implement base class pure virtuals
|
||||
// ----------------------------------
|
||||
|
||||
void AddFile( const wxString &filename );
|
||||
|
||||
virtual size_t GetDataSize() const;
|
||||
virtual bool GetDataHere(void *buf) const;
|
||||
virtual bool SetData(size_t len, const void *buf);
|
||||
|
||||
private:
|
||||
// virtual function hiding supression
|
||||
size_t GetDataSize(const wxDataFormat& format) const
|
||||
{ return(wxDataObjectSimple::GetDataSize(format)); }
|
||||
bool GetDataHere(const wxDataFormat& format, void* pBuf) const
|
||||
{ return(wxDataObjectSimple::GetDataHere(format, pBuf)); }
|
||||
bool SetData(const wxDataFormat& format, size_t nLen, const void* pBuf)
|
||||
{ return(wxDataObjectSimple::SetData(format, nLen, pBuf)); }
|
||||
};
|
||||
|
||||
#endif //__WX_COCOA_DATAOBJ2_H__
|
@@ -1,174 +0,0 @@
|
||||
/////////////////////////////////////////////////////////////////////////////
|
||||
// Name: wx/cocoa/dc.h
|
||||
// Purpose: wxDC
|
||||
// Author: David Elliott
|
||||
// Modified by:
|
||||
// Created: 2003/04/01
|
||||
// Copyright: (c) 2003 David Elliott
|
||||
// Licence: wxWindows licence
|
||||
/////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
#ifndef __WX_COCOA_DC_H__
|
||||
#define __WX_COCOA_DC_H__
|
||||
|
||||
DECLARE_WXCOCOA_OBJC_CLASS(NSAffineTransform);
|
||||
|
||||
#include "wx/dc.h"
|
||||
|
||||
class WXDLLIMPEXP_FWD_CORE wxCocoaDCImpl;
|
||||
WX_DECLARE_LIST(wxCocoaDCImpl, wxCocoaDCStack);
|
||||
|
||||
//=========================================================================
|
||||
// wxDC
|
||||
//=========================================================================
|
||||
class WXDLLIMPEXP_CORE wxCocoaDCImpl: public wxDCImpl
|
||||
{
|
||||
DECLARE_ABSTRACT_CLASS(wxCocoaDCImpl)
|
||||
wxDECLARE_NO_COPY_CLASS(wxCocoaDCImpl);
|
||||
//-------------------------------------------------------------------------
|
||||
// Initialization
|
||||
//-------------------------------------------------------------------------
|
||||
public:
|
||||
wxCocoaDCImpl(wxDC *owner);
|
||||
virtual ~wxCocoaDCImpl();
|
||||
|
||||
//-------------------------------------------------------------------------
|
||||
// wxCocoa specifics
|
||||
//-------------------------------------------------------------------------
|
||||
public:
|
||||
static void CocoaInitializeTextSystem();
|
||||
static void CocoaShutdownTextSystem();
|
||||
static WX_NSTextStorage sm_cocoaNSTextStorage;
|
||||
static WX_NSLayoutManager sm_cocoaNSLayoutManager;
|
||||
static WX_NSTextContainer sm_cocoaNSTextContainer;
|
||||
// Create a simple Wx to Bounds transform (just flip the coordinate system)
|
||||
static WX_NSAffineTransform CocoaGetWxToBoundsTransform(bool isFlipped, float height);
|
||||
protected:
|
||||
// DC stack
|
||||
static wxCocoaDCStack sm_cocoaDCStack;
|
||||
virtual bool CocoaLockFocus();
|
||||
virtual bool CocoaUnlockFocus();
|
||||
bool CocoaUnwindStackAndTakeFocus();
|
||||
inline bool CocoaTakeFocus()
|
||||
{
|
||||
wxCocoaDCStack::compatibility_iterator node = sm_cocoaDCStack.GetFirst();
|
||||
if(node && (node->GetData() == this))
|
||||
return true;
|
||||
return CocoaUnwindStackAndTakeFocus();
|
||||
}
|
||||
void CocoaUnwindStackAndLoseFocus();
|
||||
// DC flipping/transformation
|
||||
void CocoaApplyTransformations();
|
||||
void CocoaUnapplyTransformations();
|
||||
WX_NSAffineTransform m_cocoaWxToBoundsTransform;
|
||||
// Get bounds rect (for Clear())
|
||||
// note: we use void * to mean NSRect * so that we can avoid
|
||||
// putting NSRect in the headers.
|
||||
virtual bool CocoaGetBounds(void *rectData);
|
||||
// Blitting
|
||||
virtual bool CocoaDoBlitOnFocusedDC(wxCoord xdest, wxCoord ydest,
|
||||
wxCoord width, wxCoord height, wxCoord xsrc, wxCoord ysrc,
|
||||
wxRasterOperationMode logicalFunc, bool useMask, wxCoord xsrcMask, wxCoord ysrcMask);
|
||||
//-------------------------------------------------------------------------
|
||||
// Implementation
|
||||
//-------------------------------------------------------------------------
|
||||
public:
|
||||
// implement base class pure virtuals
|
||||
// ----------------------------------
|
||||
|
||||
virtual void Clear();
|
||||
|
||||
virtual bool StartDoc( const wxString& WXUNUSED(message) ) { return true; }
|
||||
virtual void EndDoc(void) {}
|
||||
|
||||
virtual void StartPage(void) {}
|
||||
virtual void EndPage(void) {}
|
||||
|
||||
virtual void SetFont(const wxFont& font);
|
||||
virtual void SetPen(const wxPen& pen);
|
||||
virtual void SetBrush(const wxBrush& brush);
|
||||
virtual void SetBackground(const wxBrush& brush);
|
||||
virtual void SetBackgroundMode(int mode) { m_backgroundMode = mode; }
|
||||
virtual void SetPalette(const wxPalette& palette);
|
||||
|
||||
virtual void DestroyClippingRegion();
|
||||
|
||||
virtual wxCoord GetCharHeight() const;
|
||||
virtual wxCoord GetCharWidth() const;
|
||||
virtual void DoGetTextExtent(const wxString& string,
|
||||
wxCoord *x, wxCoord *y,
|
||||
wxCoord *descent = NULL,
|
||||
wxCoord *externalLeading = NULL,
|
||||
const wxFont *theFont = NULL) const;
|
||||
|
||||
virtual bool CanDrawBitmap() const;
|
||||
virtual bool CanGetTextExtent() const;
|
||||
virtual int GetDepth() const;
|
||||
virtual wxSize GetPPI() const;
|
||||
|
||||
virtual void SetMapMode(wxMappingMode mode);
|
||||
virtual void SetUserScale(double x, double y);
|
||||
|
||||
virtual void SetLogicalScale(double x, double y);
|
||||
virtual void SetLogicalOrigin(wxCoord x, wxCoord y);
|
||||
virtual void SetDeviceOrigin(wxCoord x, wxCoord y);
|
||||
virtual void SetAxisOrientation(bool xLeftRight, bool yBottomUp);
|
||||
virtual void SetLogicalFunction(wxRasterOperationMode function);
|
||||
|
||||
virtual void SetTextForeground(const wxColour& colour) ;
|
||||
virtual void SetTextBackground(const wxColour& colour) ;
|
||||
|
||||
virtual void ComputeScaleAndOrigin();
|
||||
protected:
|
||||
virtual bool DoFloodFill(wxCoord x, wxCoord y, const wxColour& col,
|
||||
wxFloodFillStyle style = wxFLOOD_SURFACE);
|
||||
|
||||
virtual bool DoGetPixel(wxCoord x, wxCoord y, wxColour *col) const;
|
||||
|
||||
virtual void DoDrawPoint(wxCoord x, wxCoord y);
|
||||
virtual void DoDrawLine(wxCoord x1, wxCoord y1, wxCoord x2, wxCoord y2);
|
||||
|
||||
virtual void DoDrawArc(wxCoord x1, wxCoord y1,
|
||||
wxCoord x2, wxCoord y2,
|
||||
wxCoord xc, wxCoord yc);
|
||||
|
||||
virtual void DoDrawEllipticArc(wxCoord x, wxCoord y, wxCoord w, wxCoord h,
|
||||
double sa, double ea);
|
||||
|
||||
virtual void DoDrawRectangle(wxCoord x, wxCoord y, wxCoord width, wxCoord height);
|
||||
virtual void DoDrawRoundedRectangle(wxCoord x, wxCoord y,
|
||||
wxCoord width, wxCoord height,
|
||||
double radius);
|
||||
virtual void DoDrawEllipse(wxCoord x, wxCoord y, wxCoord width, wxCoord height);
|
||||
|
||||
virtual void DoCrossHair(wxCoord x, wxCoord y);
|
||||
|
||||
virtual void DoDrawIcon(const wxIcon& icon, wxCoord x, wxCoord y);
|
||||
virtual void DoDrawBitmap(const wxBitmap &bmp, wxCoord x, wxCoord y,
|
||||
bool useMask = false);
|
||||
|
||||
virtual void DoDrawText(const wxString& text, wxCoord x, wxCoord y);
|
||||
virtual void DoDrawRotatedText(const wxString& text, wxCoord x, wxCoord y,
|
||||
double angle);
|
||||
|
||||
virtual bool DoBlit(wxCoord xdest, wxCoord ydest, wxCoord width, wxCoord height,
|
||||
wxDC *source, wxCoord xsrc, wxCoord ysrc,
|
||||
int rop = wxCOPY, bool useMask = false, wxCoord xsrcMask = -1, wxCoord ysrcMask = -1);
|
||||
|
||||
// this is gnarly - we can't even call this function DoSetClippingRegion()
|
||||
// because of virtual function hiding
|
||||
virtual void DoSetDeviceClippingRegion(const wxRegion& region);
|
||||
virtual void DoSetClippingRegion(wxCoord x, wxCoord y,
|
||||
wxCoord width, wxCoord height);
|
||||
|
||||
virtual void DoGetSize(int *width, int *height) const;
|
||||
virtual void DoGetSizeMM(int* width, int* height) const;
|
||||
|
||||
virtual void DoDrawLines(int n, const wxPoint points[],
|
||||
wxCoord xoffset, wxCoord yoffset);
|
||||
virtual void DoDrawPolygon(int n, const wxPoint points[],
|
||||
wxCoord xoffset, wxCoord yoffset,
|
||||
wxPolygonFillMode fillStyle = wxODDEVEN_RULE);
|
||||
};
|
||||
|
||||
#endif // __WX_COCOA_DC_H__
|
@@ -1,69 +0,0 @@
|
||||
/////////////////////////////////////////////////////////////////////////////
|
||||
// Name: wx/cocoa/dcclient.h
|
||||
// Purpose: wxClientDCImpl, wxPaintDCImpl and wxWindowDCImpl classes
|
||||
// Author: David Elliott
|
||||
// Modified by:
|
||||
// Created: 2003/04/01
|
||||
// Copyright: (c) 2003 David Elliott
|
||||
// Licence: wxWindows licence
|
||||
/////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
#ifndef __WX_COCOA_DCCLIENT_H__
|
||||
#define __WX_COCOA_DCCLIENT_H__
|
||||
|
||||
#include "wx/cocoa/dc.h"
|
||||
|
||||
// DFE: A while ago I stumbled upon the fact that retrieving the parent
|
||||
// NSView of the content view seems to return the entire window rectangle
|
||||
// (including decorations). Of course, that is not at all part of the
|
||||
// Cocoa or OpenStep APIs, but it might be a neat hack.
|
||||
class WXDLLIMPEXP_CORE wxWindowDCImpl: public wxCocoaDCImpl
|
||||
{
|
||||
DECLARE_DYNAMIC_CLASS(wxWindowDCImpl)
|
||||
public:
|
||||
wxWindowDCImpl(wxDC *owner);
|
||||
// Create a DC corresponding to a window
|
||||
wxWindowDCImpl(wxDC *owner, wxWindow *win);
|
||||
virtual ~wxWindowDCImpl(void);
|
||||
|
||||
protected:
|
||||
wxWindow *m_window;
|
||||
WX_NSView m_lockedNSView;
|
||||
// DC stack
|
||||
virtual bool CocoaLockFocus();
|
||||
virtual bool CocoaUnlockFocus();
|
||||
bool CocoaLockFocusOnNSView(WX_NSView nsview);
|
||||
bool CocoaUnlockFocusOnNSView();
|
||||
virtual bool CocoaGetBounds(void *rectData);
|
||||
};
|
||||
|
||||
class WXDLLIMPEXP_CORE wxClientDCImpl: public wxWindowDCImpl
|
||||
{
|
||||
DECLARE_DYNAMIC_CLASS(wxClientDCImpl)
|
||||
public:
|
||||
wxClientDCImpl(wxDC *owner);
|
||||
// Create a DC corresponding to a window
|
||||
wxClientDCImpl(wxDC *owner, wxWindow *win);
|
||||
virtual ~wxClientDCImpl(void);
|
||||
protected:
|
||||
// DC stack
|
||||
virtual bool CocoaLockFocus();
|
||||
virtual bool CocoaUnlockFocus();
|
||||
};
|
||||
|
||||
class WXDLLIMPEXP_CORE wxPaintDCImpl: public wxWindowDCImpl
|
||||
{
|
||||
DECLARE_DYNAMIC_CLASS(wxPaintDCImpl)
|
||||
public:
|
||||
wxPaintDCImpl(wxDC *owner);
|
||||
// Create a DC corresponding to a window
|
||||
wxPaintDCImpl(wxDC *owner, wxWindow *win);
|
||||
virtual ~wxPaintDCImpl(void);
|
||||
protected:
|
||||
// DC stack
|
||||
virtual bool CocoaLockFocus();
|
||||
virtual bool CocoaUnlockFocus();
|
||||
};
|
||||
|
||||
#endif
|
||||
// __WX_COCOA_DCCLIENT_H__
|
@@ -1,54 +0,0 @@
|
||||
/////////////////////////////////////////////////////////////////////////////
|
||||
// Name: wx/cocoa/dcmemory.h
|
||||
// Purpose: wxMemoryDCImpl class
|
||||
// Author: David Elliott
|
||||
// Modified by:
|
||||
// Created: 2003/03/16
|
||||
// Copyright: (c) 2003 David Elliott
|
||||
// Licence: wxWindows licence
|
||||
/////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
#ifndef __WX_COCOA_DCMEMORY_H__
|
||||
#define __WX_COCOA_DCMEMORY_H__
|
||||
|
||||
#include "wx/cocoa/dc.h"
|
||||
|
||||
#include "wx/dcmemory.h"
|
||||
|
||||
class WXDLLIMPEXP_CORE wxMemoryDCImpl: public wxCocoaDCImpl
|
||||
{
|
||||
DECLARE_DYNAMIC_CLASS(wxMemoryDCImpl)
|
||||
|
||||
public:
|
||||
wxMemoryDCImpl(wxMemoryDC *owner)
|
||||
: wxCocoaDCImpl(owner)
|
||||
{ Init(); }
|
||||
wxMemoryDCImpl(wxMemoryDC *owner, wxBitmap& bitmap)
|
||||
: wxCocoaDCImpl(owner)
|
||||
{ Init();
|
||||
owner->SelectObject(bitmap);
|
||||
}
|
||||
wxMemoryDCImpl(wxMemoryDC *owner, wxDC *dc ); // Create compatible DC
|
||||
virtual ~wxMemoryDCImpl(void);
|
||||
|
||||
virtual void DoGetSize(int *width, int *height) const;
|
||||
virtual void DoSelect(const wxBitmap& bitmap);
|
||||
|
||||
protected:
|
||||
wxBitmap m_selectedBitmap;
|
||||
WX_NSImage m_cocoaNSImage;
|
||||
// DC stack
|
||||
virtual bool CocoaLockFocus();
|
||||
virtual bool CocoaUnlockFocus();
|
||||
virtual bool CocoaGetBounds(void *rectData);
|
||||
// Blitting
|
||||
virtual bool CocoaDoBlitOnFocusedDC(wxCoord xdest, wxCoord ydest,
|
||||
wxCoord width, wxCoord height, wxCoord xsrc, wxCoord ysrc,
|
||||
wxRasterOperationMode logicalFunc, bool useMask, wxCoord xsrcMask, wxCoord ysrcMask);
|
||||
|
||||
private:
|
||||
void Init();
|
||||
};
|
||||
|
||||
#endif
|
||||
// __WX_COCOA_DCMEMORY_H__
|
@@ -1,31 +0,0 @@
|
||||
/////////////////////////////////////////////////////////////////////////////
|
||||
// Name: wx/cocoa/dcscreen.h
|
||||
// Purpose: wxScreenDCImpl class
|
||||
// Author: David Elliott
|
||||
// Modified by:
|
||||
// Created: 2003/03/16
|
||||
// Copyright: (c) 2003 David Elliott
|
||||
// Licence: wxWindows licence
|
||||
/////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
#ifndef __WX_COCOA_DCSCREEN_H__
|
||||
#define __WX_COCOA_DCSCREEN_H__
|
||||
|
||||
#include "wx/dcscreen.h"
|
||||
#include "wx/cocoa/dc.h"
|
||||
|
||||
class WXDLLIMPEXP_CORE wxScreenDCImpl: public wxCocoaDCImpl
|
||||
{
|
||||
DECLARE_DYNAMIC_CLASS(wxScreenDCImpl)
|
||||
public:
|
||||
wxScreenDCImpl(wxScreenDC *owner);
|
||||
wxScreenDCImpl(wxScreenDC *owner, wxDC *dc ); // Create compatible DC
|
||||
virtual ~wxScreenDCImpl(void);
|
||||
|
||||
// Compatibility with X's requirements for drawing on top of all windows
|
||||
static bool StartDrawingOnTop(wxWindow* WXUNUSED(window)) { return true; }
|
||||
static bool StartDrawingOnTop(wxRect* WXUNUSED(rect) = NULL) { return true; }
|
||||
static bool EndDrawingOnTop() { return true; }
|
||||
};
|
||||
|
||||
#endif // __WX_COCOA_DCSCREEN_H__
|
@@ -1,80 +0,0 @@
|
||||
/////////////////////////////////////////////////////////////////////////////
|
||||
// Name: wx/cocoa/dialog.h
|
||||
// Purpose: wxDialog class
|
||||
// Author: David Elliott
|
||||
// Modified by:
|
||||
// Created: 2002/12/15
|
||||
// Copyright: David Elliott
|
||||
// Licence: wxWindows licence
|
||||
/////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
#ifndef _WX_COCOA_DIALOG_H_
|
||||
#define _WX_COCOA_DIALOG_H_
|
||||
|
||||
#include "wx/defs.h"
|
||||
// NOTE: we don't need panel.h, but other things expect it to be included
|
||||
#include "wx/panel.h"
|
||||
#include "wx/cocoa/NSPanel.h"
|
||||
|
||||
// ========================================================================
|
||||
// wxDialog
|
||||
// ========================================================================
|
||||
class WXDLLIMPEXP_CORE wxDialog : public wxDialogBase, protected wxCocoaNSPanel
|
||||
{
|
||||
DECLARE_DYNAMIC_CLASS(wxDialog)
|
||||
WX_DECLARE_COCOA_OWNER(NSPanel,NSWindow,NSWindow)
|
||||
// ------------------------------------------------------------------------
|
||||
// initialization
|
||||
// ------------------------------------------------------------------------
|
||||
public:
|
||||
wxDialog() { Init(); }
|
||||
|
||||
// Constructor with no modal flag - the new convention.
|
||||
wxDialog(wxWindow *parent, wxWindowID winid,
|
||||
const wxString& title,
|
||||
const wxPoint& pos = wxDefaultPosition,
|
||||
const wxSize& size = wxDefaultSize,
|
||||
long style = wxDEFAULT_DIALOG_STYLE,
|
||||
const wxString& name = wxDialogNameStr)
|
||||
{
|
||||
Init();
|
||||
Create(parent, winid, title, pos, size, style, name);
|
||||
}
|
||||
|
||||
bool Create(wxWindow *parent, wxWindowID winid,
|
||||
const wxString& title,
|
||||
const wxPoint& pos = wxDefaultPosition,
|
||||
const wxSize& size = wxDefaultSize,
|
||||
long style = wxDEFAULT_DIALOG_STYLE,
|
||||
const wxString& name = wxDialogNameStr);
|
||||
|
||||
virtual ~wxDialog();
|
||||
protected:
|
||||
void Init();
|
||||
|
||||
// ------------------------------------------------------------------------
|
||||
// Cocoa specifics
|
||||
// ------------------------------------------------------------------------
|
||||
protected:
|
||||
virtual void CocoaDelegate_windowWillClose(void);
|
||||
virtual bool Cocoa_canBecomeMainWindow(bool &canBecome)
|
||||
{ canBecome = true; return true; }
|
||||
|
||||
// ------------------------------------------------------------------------
|
||||
// Implementation
|
||||
// ------------------------------------------------------------------------
|
||||
public:
|
||||
virtual bool Show(bool show = true);
|
||||
|
||||
void SetModal(bool flag);
|
||||
virtual bool IsModal() const { return m_isModal; }
|
||||
bool m_isModal;
|
||||
|
||||
// For now, same as Show(true) but returns return code
|
||||
virtual int ShowModal();
|
||||
|
||||
// may be called to terminate the dialog with the given return code
|
||||
virtual void EndModal(int retCode);
|
||||
};
|
||||
|
||||
#endif // _WX_COCOA_DIALOG_H_
|
@@ -1,50 +0,0 @@
|
||||
/////////////////////////////////////////////////////////////////////////////
|
||||
// Name: wx/cocoa/dirdlg.h
|
||||
// Purpose: wxDirDialog class
|
||||
// Author: Ryan Norton
|
||||
// Modified by: Hiroyuki Nakamura(maloninc)
|
||||
// Created: 2006-01-10
|
||||
// Copyright: (c) Ryan Norton
|
||||
// Licence: wxWindows licence
|
||||
/////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
#ifndef _WX_COCOA_DIRDLG_H_
|
||||
#define _WX_COCOA_DIRDLG_H_
|
||||
|
||||
DECLARE_WXCOCOA_OBJC_CLASS(NSSavePanel);
|
||||
|
||||
#define wxDirDialog wxCocoaDirDialog
|
||||
//-------------------------------------------------------------------------
|
||||
// wxDirDialog
|
||||
//-------------------------------------------------------------------------
|
||||
|
||||
class WXDLLIMPEXP_CORE wxDirDialog: public wxDirDialogBase
|
||||
{
|
||||
DECLARE_DYNAMIC_CLASS(wxDirDialog)
|
||||
wxDECLARE_NO_COPY_CLASS(wxDirDialog);
|
||||
public:
|
||||
wxDirDialog(wxWindow *parent,
|
||||
const wxString& message = wxDirSelectorPromptStr,
|
||||
const wxString& defaultPath = wxT(""),
|
||||
long style = wxDD_DEFAULT_STYLE,
|
||||
const wxPoint& pos = wxDefaultPosition,
|
||||
const wxSize& size = wxDefaultSize,
|
||||
const wxString& name = wxDirDialogNameStr);
|
||||
virtual ~wxDirDialog();
|
||||
|
||||
virtual int ShowModal();
|
||||
|
||||
inline WX_NSSavePanel GetNSSavePanel()
|
||||
{ return (WX_NSSavePanel)m_cocoaNSWindow; }
|
||||
|
||||
protected:
|
||||
wxString m_dir;
|
||||
wxWindow * m_parent;
|
||||
wxString m_fileName;
|
||||
|
||||
private:
|
||||
wxArrayString m_fileNames;
|
||||
};
|
||||
|
||||
#endif // _WX_DIRDLG_H_
|
||||
|
@@ -1 +0,0 @@
|
||||
|
@@ -1,38 +0,0 @@
|
||||
///////////////////////////////////////////////////////////////////////////////
|
||||
// Name: wx/cocoa/evtloop.h
|
||||
// Purpose: declaration of wxGUIEventLoop for wxCocoa
|
||||
// Author: Vadim Zeitlin
|
||||
// Created: 2008-12-28
|
||||
// Copyright: (c) 2008 Vadim Zeitlin <vadim@wxwidgets.org>
|
||||
// Licence: wxWindows licence
|
||||
///////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
#ifndef _WX_COCOA_EVTLOOP_H_
|
||||
#define _WX_COCOA_EVTLOOP_H_
|
||||
|
||||
// ----------------------------------------------------------------------------
|
||||
// wxGUIEventLoop for wxCocoa
|
||||
// ----------------------------------------------------------------------------
|
||||
|
||||
class WXDLLIMPEXP_CORE wxGUIEventLoop : public wxEventLoopBase
|
||||
{
|
||||
public:
|
||||
wxGUIEventLoop() { m_exitcode = 0; }
|
||||
|
||||
virtual void ScheduleExit(int rc = 0);
|
||||
virtual bool Pending() const;
|
||||
virtual bool Dispatch();
|
||||
virtual int DispatchTimeout(unsigned long timeout);
|
||||
virtual void WakeUp() { }
|
||||
|
||||
protected:
|
||||
virtual int DoRun();
|
||||
virtual void DoYieldFor(long eventsToProcess);
|
||||
|
||||
int m_exitcode;
|
||||
|
||||
wxDECLARE_NO_COPY_CLASS(wxGUIEventLoop);
|
||||
};
|
||||
|
||||
#endif // _WX_COCOA_EVTLOOP_H_
|
||||
|
@@ -1,52 +0,0 @@
|
||||
/////////////////////////////////////////////////////////////////////////////
|
||||
// Name: wx/cocoa/filedlg.h
|
||||
// Purpose: wxFileDialog class
|
||||
// Author: Ryan Norton
|
||||
// Modified by:
|
||||
// Created: 2004-10-02
|
||||
// Copyright: (c) Ryan Norton
|
||||
// Licence: wxWindows licence
|
||||
/////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
#ifndef _WX_COCOA_FILEDLG_H_
|
||||
#define _WX_COCOA_FILEDLG_H_
|
||||
|
||||
DECLARE_WXCOCOA_OBJC_CLASS(NSSavePanel);
|
||||
|
||||
#define wxFileDialog wxCocoaFileDialog
|
||||
//-------------------------------------------------------------------------
|
||||
// wxFileDialog
|
||||
//-------------------------------------------------------------------------
|
||||
|
||||
class WXDLLIMPEXP_CORE wxFileDialog: public wxFileDialogBase
|
||||
{
|
||||
DECLARE_DYNAMIC_CLASS(wxFileDialog)
|
||||
wxDECLARE_NO_COPY_CLASS(wxFileDialog);
|
||||
public:
|
||||
wxFileDialog(wxWindow *parent,
|
||||
const wxString& message = wxFileSelectorPromptStr,
|
||||
const wxString& defaultDir = wxEmptyString,
|
||||
const wxString& defaultFile = wxEmptyString,
|
||||
const wxString& wildCard = wxFileSelectorDefaultWildcardStr,
|
||||
long style = wxFD_DEFAULT_STYLE,
|
||||
const wxPoint& pos = wxDefaultPosition,
|
||||
const wxSize& sz = wxDefaultSize,
|
||||
const wxString& name = wxFileDialogNameStr);
|
||||
virtual ~wxFileDialog();
|
||||
|
||||
virtual void SetPath(const wxString& path);
|
||||
virtual void GetPaths(wxArrayString& paths) const;
|
||||
virtual void GetFilenames(wxArrayString& files) const;
|
||||
|
||||
virtual int ShowModal();
|
||||
|
||||
inline WX_NSSavePanel GetNSSavePanel()
|
||||
{ return (WX_NSSavePanel)m_cocoaNSWindow; }
|
||||
|
||||
private:
|
||||
WX_NSMutableArray m_wildcards;
|
||||
wxArrayString m_fileNames;
|
||||
};
|
||||
|
||||
#endif // _WX_FILEDLG_H_
|
||||
|
@@ -1,172 +0,0 @@
|
||||
/////////////////////////////////////////////////////////////////////////////
|
||||
// Name: wx/cocoa/font.h
|
||||
// Purpose: wxFont class
|
||||
// Author: Julian Smart
|
||||
// Modified by:
|
||||
// Created: 01/02/97
|
||||
// Copyright: (c) Julian Smart
|
||||
// Licence: wxWindows licence
|
||||
/////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
#ifndef _WX_FONT_H_
|
||||
#define _WX_FONT_H_
|
||||
|
||||
// ----------------------------------------------------------------------------
|
||||
// wxFont
|
||||
// ----------------------------------------------------------------------------
|
||||
|
||||
DECLARE_WXCOCOA_OBJC_CLASS(NSFont);
|
||||
|
||||
// Internal class that bridges us with code like wxSystemSettings
|
||||
class wxCocoaFontFactory;
|
||||
// We have c-tors/methods taking pointers of these
|
||||
class wxFontRefData;
|
||||
|
||||
/*! @discussion
|
||||
wxCocoa's implementation of wxFont is very incomplete. In particular,
|
||||
a lot of work needs to be done on wxNativeFontInfo which is currently
|
||||
using the totally generic implementation.
|
||||
|
||||
See the documentation in src/cocoa/font.mm for more implementatoin details.
|
||||
*/
|
||||
class WXDLLIMPEXP_CORE wxFont : public wxFontBase
|
||||
{
|
||||
friend class wxCocoaFontFactory;
|
||||
public:
|
||||
/*! @abstract Default construction of invalid font for 2-step construct then Create process.
|
||||
*/
|
||||
wxFont() { }
|
||||
|
||||
wxFont(const wxFontInfo& info)
|
||||
{
|
||||
Create(info.GetPointSize(),
|
||||
info.GetFamily(),
|
||||
info.GetStyle(),
|
||||
info.GetWeight(),
|
||||
info.IsUnderlined(),
|
||||
info.GetFaceName(),
|
||||
info.GetEncoding());
|
||||
|
||||
if ( info.IsUsingSizeInPixels() )
|
||||
SetPixelSize(info.GetPixelSize());
|
||||
}
|
||||
|
||||
/*! @abstract Platform-independent construction with individual properties
|
||||
*/
|
||||
wxFont(int size,
|
||||
wxFontFamily family,
|
||||
wxFontStyle style,
|
||||
wxFontWeight weight,
|
||||
bool underlined = FALSE,
|
||||
const wxString& face = wxEmptyString,
|
||||
wxFontEncoding encoding = wxFONTENCODING_DEFAULT)
|
||||
{
|
||||
(void)Create(size, family, style, weight, underlined, face, encoding);
|
||||
}
|
||||
|
||||
wxFont(const wxSize& pixelSize,
|
||||
wxFontFamily family,
|
||||
wxFontStyle style,
|
||||
wxFontWeight weight,
|
||||
bool underlined = false,
|
||||
const wxString& face = wxEmptyString,
|
||||
wxFontEncoding encoding = wxFONTENCODING_DEFAULT)
|
||||
{
|
||||
Create(10, family, style, weight, underlined, face, encoding);
|
||||
SetPixelSize(pixelSize);
|
||||
}
|
||||
|
||||
/*! @abstract Construction with opaque wxNativeFontInfo
|
||||
*/
|
||||
wxFont(const wxNativeFontInfo& info)
|
||||
{
|
||||
(void)Create(info);
|
||||
}
|
||||
|
||||
/*! @abstract Construction with platform-dependent font descriptor string.
|
||||
@param fontDesc Usually the result of wxNativeFontInfo::ToUserString()
|
||||
*/
|
||||
wxFont(const wxString& fontDesc);
|
||||
|
||||
// NOTE: Copy c-tor and assignment from wxObject is fine
|
||||
|
||||
bool Create(int size,
|
||||
wxFontFamily family,
|
||||
wxFontStyle style,
|
||||
wxFontWeight weight,
|
||||
bool underlined = FALSE,
|
||||
const wxString& face = wxEmptyString,
|
||||
wxFontEncoding encoding = wxFONTENCODING_DEFAULT);
|
||||
|
||||
bool Create(const wxNativeFontInfo& info);
|
||||
|
||||
virtual ~wxFont();
|
||||
|
||||
// implement base class pure virtuals
|
||||
virtual int GetPointSize() const;
|
||||
virtual wxFontStyle GetStyle() const;
|
||||
virtual wxFontWeight GetWeight() const;
|
||||
virtual bool GetUnderlined() const;
|
||||
virtual wxString GetFaceName() const;
|
||||
virtual wxFontEncoding GetEncoding() const;
|
||||
virtual const wxNativeFontInfo *GetNativeFontInfo() const;
|
||||
|
||||
virtual void SetPointSize(int pointSize);
|
||||
virtual void SetFamily(wxFontFamily family);
|
||||
virtual void SetStyle(wxFontStyle style);
|
||||
virtual void SetWeight(wxFontWeight weight);
|
||||
virtual bool SetFaceName(const wxString& faceName);
|
||||
virtual void SetUnderlined(bool underlined);
|
||||
virtual void SetEncoding(wxFontEncoding encoding);
|
||||
|
||||
wxDECLARE_COMMON_FONT_METHODS();
|
||||
|
||||
|
||||
wxDEPRECATED_MSG("use wxFONT{FAMILY,STYLE,WEIGHT}_XXX constants")
|
||||
wxFont(int size,
|
||||
int family,
|
||||
int style,
|
||||
int weight,
|
||||
bool underlined = FALSE,
|
||||
const wxString& face = wxEmptyString,
|
||||
wxFontEncoding encoding = wxFONTENCODING_DEFAULT)
|
||||
{
|
||||
(void)Create(size, (wxFontFamily)family, (wxFontStyle)style, (wxFontWeight)weight, underlined, face, encoding);
|
||||
}
|
||||
|
||||
// implementation only from now on
|
||||
// -------------------------------
|
||||
|
||||
/*! @abstract Defined on some ports (not including this one) in wxGDIObject
|
||||
@discussion
|
||||
The intention here I suppose is to allow one to create a wxFont without yet
|
||||
creating the underlying native object. There's no point not to create the
|
||||
NSFont immediately in wxCocoa so this is useless.
|
||||
This method came from the stub code copied in the early days of wxCocoa.
|
||||
FIXME(1): Remove this in trunk. FIXME(2): Is it really a good idea for this to
|
||||
be part of the public API for wxGDIObject?
|
||||
*/
|
||||
virtual bool RealizeResource();
|
||||
|
||||
protected:
|
||||
/*! @abstract Internal constructor with ref data
|
||||
@discussion
|
||||
Takes ownership of @a refData. That is, it is assumed that refData has either just been
|
||||
created using new (which initializes its m_refCount to 1) or if you are sharing a ref that
|
||||
you have called IncRef on it before passing it to this method.
|
||||
*/
|
||||
explicit wxFont(wxFontRefData *refData)
|
||||
{ Create(refData); }
|
||||
bool Create(wxFontRefData *refData);
|
||||
|
||||
virtual wxGDIRefData *CreateGDIRefData() const;
|
||||
virtual wxGDIRefData *CloneGDIRefData(const wxGDIRefData *data) const;
|
||||
|
||||
virtual wxFontFamily DoGetFamily() const;
|
||||
|
||||
private:
|
||||
DECLARE_DYNAMIC_CLASS(wxFont)
|
||||
};
|
||||
|
||||
#endif
|
||||
// _WX_FONT_H_
|
@@ -1 +0,0 @@
|
||||
|
@@ -1,106 +0,0 @@
|
||||
/////////////////////////////////////////////////////////////////////////////
|
||||
// Name: wx/cocoa/frame.h
|
||||
// Purpose: wxFrame class
|
||||
// Author: David Elliott
|
||||
// Modified by:
|
||||
// Created: 2003/03/16
|
||||
// Copyright: (c) 2003 David Elliott
|
||||
// Licence: wxWindows licence
|
||||
/////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
#ifndef _WX_COCOA_FRAME_H_
|
||||
#define _WX_COCOA_FRAME_H_
|
||||
|
||||
class WXDLLIMPEXP_FWD_CORE wxMenuBar;
|
||||
class WXDLLIMPEXP_FWD_CORE wxStatusBar;
|
||||
|
||||
class WXDLLIMPEXP_CORE wxFrame: public wxFrameBase
|
||||
{
|
||||
DECLARE_EVENT_TABLE()
|
||||
DECLARE_DYNAMIC_CLASS(wxFrame)
|
||||
// ------------------------------------------------------------------------
|
||||
// initialization
|
||||
// ------------------------------------------------------------------------
|
||||
public:
|
||||
wxFrame() { Init(); }
|
||||
wxFrame(wxWindow *parent,
|
||||
wxWindowID winid,
|
||||
const wxString& title,
|
||||
const wxPoint& pos = wxDefaultPosition,
|
||||
const wxSize& size = wxDefaultSize,
|
||||
long style = wxDEFAULT_FRAME_STYLE,
|
||||
const wxString& name = wxFrameNameStr)
|
||||
{
|
||||
Init();
|
||||
Create(parent, winid, title, pos, size, style, name);
|
||||
}
|
||||
|
||||
virtual ~wxFrame();
|
||||
|
||||
bool Create(wxWindow *parent,
|
||||
wxWindowID winid,
|
||||
const wxString& title,
|
||||
const wxPoint& pos = wxDefaultPosition,
|
||||
const wxSize& size = wxDefaultSize,
|
||||
long style = wxDEFAULT_FRAME_STYLE,
|
||||
const wxString& name = wxFrameNameStr);
|
||||
protected:
|
||||
void Init();
|
||||
// ------------------------------------------------------------------------
|
||||
// Cocoa specifics
|
||||
// ------------------------------------------------------------------------
|
||||
public:
|
||||
virtual wxMenuBar* GetAppMenuBar(wxCocoaNSWindow *win);
|
||||
// Returns the NSView for non-client drawing
|
||||
virtual WX_NSView GetNonClientNSView();
|
||||
|
||||
// Helper function to position status/tool bars
|
||||
// Also called by native toolbar to force a size update
|
||||
void UpdateFrameNSView();
|
||||
|
||||
virtual void CocoaDelegate_wxMenuItemAction(WX_NSMenuItem menuItem);
|
||||
virtual bool CocoaDelegate_validateMenuItem(WX_NSMenuItem menuItem);
|
||||
protected:
|
||||
virtual void CocoaSetWxWindowSize(int width, int height);
|
||||
|
||||
virtual void CocoaReplaceView(WX_NSView oldView, WX_NSView newView);
|
||||
// frameNSView is used whenever a statusbar/generic toolbar are present
|
||||
WX_NSView m_frameNSView;
|
||||
// ------------------------------------------------------------------------
|
||||
// Implementation
|
||||
// ------------------------------------------------------------------------
|
||||
public:
|
||||
virtual void AttachMenuBar(wxMenuBar *mbar);
|
||||
virtual void DetachMenuBar();
|
||||
virtual void SetMenuBar(wxMenuBar *menubar);
|
||||
|
||||
// implementation only from now on
|
||||
// -------------------------------
|
||||
|
||||
// override some more virtuals
|
||||
|
||||
// get the origin of the client area (which may be different from (0, 0)
|
||||
// if the frame has a toolbar) in client coordinates
|
||||
virtual wxPoint GetClientAreaOrigin() const;
|
||||
|
||||
// create the main status bar by calling OnCreateStatusBar()
|
||||
virtual wxStatusBar* CreateStatusBar(int number = 1,
|
||||
long style = wxSTB_DEFAULT_STYLE,
|
||||
wxWindowID winid = 0,
|
||||
const wxString& name =
|
||||
wxStatusLineNameStr);
|
||||
// sets the main status bar
|
||||
void SetStatusBar(wxStatusBar *statBar);
|
||||
#if wxUSE_TOOLBAR
|
||||
// create main toolbar bycalling OnCreateToolBar()
|
||||
virtual wxToolBar* CreateToolBar(long style = -1,
|
||||
wxWindowID winid = wxID_ANY,
|
||||
const wxString& name = wxToolBarNameStr);
|
||||
// sets the main tool bar
|
||||
virtual void SetToolBar(wxToolBar *toolbar);
|
||||
#endif //wxUSE_TOOLBAR
|
||||
protected:
|
||||
void PositionStatusBar();
|
||||
};
|
||||
|
||||
#endif // _WX_COCOA_FRAME_H_
|
@@ -1,73 +0,0 @@
|
||||
/////////////////////////////////////////////////////////////////////////////
|
||||
// Name: wx/cocoa/gauge.h
|
||||
// Purpose: wxGauge class
|
||||
// Author: David Elliott
|
||||
// Modified by:
|
||||
// Created: 2003/07/15
|
||||
// Copyright: (c) 2003 David Elliott
|
||||
// Licence: wxWindows licence
|
||||
/////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
#ifndef __WX_COCOA_GAUGE_H__
|
||||
#define __WX_COCOA_GAUGE_H__
|
||||
|
||||
// #include "wx/cocoa/NSProgressIndicator.h"
|
||||
|
||||
DECLARE_WXCOCOA_OBJC_CLASS(NSProgressIndicator);
|
||||
|
||||
// ========================================================================
|
||||
// wxGauge
|
||||
// ========================================================================
|
||||
class WXDLLIMPEXP_CORE wxGauge: public wxGaugeBase// , protected wxCocoaNSProgressIndicator
|
||||
{
|
||||
DECLARE_DYNAMIC_CLASS(wxGauge)
|
||||
DECLARE_EVENT_TABLE()
|
||||
// WX_DECLARE_COCOA_OWNER(NSProgressIndicator,NSView,NSView)
|
||||
// ------------------------------------------------------------------------
|
||||
// initialization
|
||||
// ------------------------------------------------------------------------
|
||||
public:
|
||||
wxGauge() { }
|
||||
wxGauge(wxWindow *parent, wxWindowID winid, int range,
|
||||
const wxPoint& pos = wxDefaultPosition,
|
||||
const wxSize& size = wxDefaultSize,
|
||||
long style = wxGA_HORIZONTAL,
|
||||
const wxValidator& validator = wxDefaultValidator,
|
||||
const wxString& name = wxGaugeNameStr)
|
||||
{
|
||||
Create(parent, winid, range, pos, size, style, validator, name);
|
||||
}
|
||||
|
||||
bool Create(wxWindow *parent, wxWindowID winid, int range,
|
||||
const wxPoint& pos = wxDefaultPosition,
|
||||
const wxSize& size = wxDefaultSize,
|
||||
long style = wxGA_HORIZONTAL,
|
||||
const wxValidator& validator = wxDefaultValidator,
|
||||
const wxString& name = wxGaugeNameStr);
|
||||
virtual ~wxGauge();
|
||||
|
||||
// ------------------------------------------------------------------------
|
||||
// Cocoa callbacks
|
||||
// ------------------------------------------------------------------------
|
||||
public:
|
||||
inline WX_NSProgressIndicator GetNSProgressIndicator() const { return (WX_NSProgressIndicator)m_cocoaNSView; }
|
||||
protected:
|
||||
// NSProgressIndicator cannot be enabled/disabled
|
||||
virtual void CocoaSetEnabled(bool WXUNUSED(enable)) { }
|
||||
// ------------------------------------------------------------------------
|
||||
// Implementation
|
||||
// ------------------------------------------------------------------------
|
||||
public:
|
||||
// Pure Virtuals
|
||||
virtual int GetValue() const;
|
||||
virtual void SetValue(int value);
|
||||
|
||||
// retrieve/change the range
|
||||
virtual void SetRange(int maxValue);
|
||||
int GetRange(void) const;
|
||||
protected:
|
||||
virtual wxSize DoGetBestSize() const;
|
||||
};
|
||||
|
||||
#endif
|
||||
// __WX_COCOA_GAUGE_H__
|
@@ -1,97 +0,0 @@
|
||||
/////////////////////////////////////////////////////////////////////////////
|
||||
// Name: wx/cocoa/glcanvas.h
|
||||
// Purpose: wxGLCanvas class
|
||||
// Author: David Elliott
|
||||
// Modified by:
|
||||
// Created: 2004/09/29
|
||||
// Copyright: (c) 2004 David Elliott
|
||||
// Licence: wxWindows licence
|
||||
/////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
#ifndef _WX_COCOA_GLCANVAS_H__
|
||||
#define _WX_COCOA_GLCANVAS_H__
|
||||
|
||||
#include "wx/window.h"
|
||||
|
||||
// #include "wx/cocoa/NSOpenGLView.h"
|
||||
// Include gl.h from the OpenGL framework
|
||||
#include <OpenGL/gl.h>
|
||||
|
||||
class WXDLLIMPEXP_FWD_GL wxGLCanvas;
|
||||
DECLARE_WXCOCOA_OBJC_CLASS(NSOpenGLContext);
|
||||
DECLARE_WXCOCOA_OBJC_CLASS(NSOpenGLView);
|
||||
|
||||
// ========================================================================
|
||||
// wxGLContext
|
||||
// ========================================================================
|
||||
|
||||
class WXDLLIMPEXP_GL wxGLContext : public wxGLContextBase
|
||||
{
|
||||
public:
|
||||
wxGLContext(wxGLCanvas *win, const wxGLContext *other = NULL);
|
||||
|
||||
virtual ~wxGLContext();
|
||||
|
||||
virtual void SetCurrent(const wxGLCanvas& win) const;
|
||||
|
||||
WX_NSOpenGLContext GetNSOpenGLContext() const
|
||||
{ return m_cocoaNSOpenGLContext; }
|
||||
|
||||
private:
|
||||
WX_NSOpenGLContext m_cocoaNSOpenGLContext;
|
||||
};
|
||||
|
||||
// ========================================================================
|
||||
// wxGLCanvas
|
||||
// ========================================================================
|
||||
|
||||
class WXDLLIMPEXP_GL wxGLCanvas : public wxGLCanvasBase
|
||||
// , protected wxCocoaNSOpenGLView
|
||||
{
|
||||
DECLARE_DYNAMIC_CLASS(wxGLCanvas)
|
||||
// WX_DECLARE_COCOA_OWNER(NSOpenGLView,NSView,NSView)
|
||||
// ------------------------------------------------------------------------
|
||||
// initialization
|
||||
// ------------------------------------------------------------------------
|
||||
public:
|
||||
wxGLCanvas(wxWindow *parent,
|
||||
wxWindowID id = wxID_ANY,
|
||||
const int *attribList = NULL,
|
||||
const wxPoint& pos = wxDefaultPosition,
|
||||
const wxSize& size = wxDefaultSize,
|
||||
long style = 0,
|
||||
const wxString& name = wxGLCanvasName,
|
||||
const wxPalette& palette = wxNullPalette)
|
||||
{
|
||||
Create(parent, id, pos, size, style, name, attribList, palette);
|
||||
}
|
||||
|
||||
bool Create(wxWindow *parent,
|
||||
wxWindowID id = wxID_ANY,
|
||||
const wxPoint& pos = wxDefaultPosition,
|
||||
const wxSize& size = wxDefaultSize,
|
||||
long style = 0,
|
||||
const wxString& name = wxGLCanvasName,
|
||||
const int *attribList = NULL,
|
||||
const wxPalette& palette = wxNullPalette);
|
||||
|
||||
virtual ~wxGLCanvas();
|
||||
|
||||
// ------------------------------------------------------------------------
|
||||
// Cocoa callbacks
|
||||
// ------------------------------------------------------------------------
|
||||
protected:
|
||||
// NSOpenGLView cannot be enabled/disabled
|
||||
virtual void CocoaSetEnabled(bool enable) { }
|
||||
// ------------------------------------------------------------------------
|
||||
// Implementation
|
||||
// ------------------------------------------------------------------------
|
||||
public:
|
||||
virtual void SwapBuffers();
|
||||
|
||||
|
||||
NSOpenGLView *GetNSOpenGLView() const
|
||||
{ return (NSOpenGLView *)m_cocoaNSView; }
|
||||
};
|
||||
|
||||
#endif //ndef _WX_COCOA_GLCANVAS_H__
|
@@ -1,63 +0,0 @@
|
||||
/////////////////////////////////////////////////////////////////////////////
|
||||
// Name: wx/cocoa/icon.h
|
||||
// Purpose: wxIcon class
|
||||
// Author: David Elliott
|
||||
// Modified by:
|
||||
// Created: 2003/08/11
|
||||
// Copyright: (c) 2003 David Elliott
|
||||
// Licence: wxWindows licence
|
||||
/////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
#ifndef _WX_COCOA_ICON_H__
|
||||
#define _WX_COCOA_ICON_H__
|
||||
|
||||
#include "wx/gdicmn.h"
|
||||
#include "wx/gdiobj.h"
|
||||
|
||||
// ========================================================================
|
||||
// wxIcon
|
||||
// ========================================================================
|
||||
class WXDLLIMPEXP_CORE wxIcon : public wxGDIObject
|
||||
{
|
||||
public:
|
||||
wxIcon();
|
||||
|
||||
wxIcon(const char* const* data) { CreateFromXpm(data); }
|
||||
wxIcon(const char bits[], int width , int height );
|
||||
wxIcon(const wxString& name, int flags = wxICON_DEFAULT_TYPE,
|
||||
int desiredWidth = -1, int desiredHeight = -1);
|
||||
wxIcon(const wxIconLocation& loc)
|
||||
{
|
||||
LoadFile(loc.GetFileName(), wxBITMAP_TYPE_ICON);
|
||||
}
|
||||
virtual ~wxIcon();
|
||||
|
||||
bool LoadFile(const wxString& name, wxBitmapType flags = wxICON_DEFAULT_TYPE,
|
||||
int desiredWidth=-1, int desiredHeight=-1);
|
||||
|
||||
bool operator==(const wxIcon& icon) const
|
||||
{ return m_refData == icon.m_refData; }
|
||||
bool operator!=(const wxIcon& icon) const { return !(*this == icon); }
|
||||
|
||||
// create from bitmap (which should have a mask unless it's monochrome):
|
||||
// there shouldn't be any implicit bitmap -> icon conversion (i.e. no
|
||||
// ctors, assignment operators...), but it's ok to have such function
|
||||
void CopyFromBitmap(const wxBitmap& bmp);
|
||||
|
||||
int GetWidth() const;
|
||||
int GetHeight() const;
|
||||
|
||||
wxSize GetSize() const { return wxSize(GetWidth(), GetHeight()); }
|
||||
|
||||
WX_NSImage GetNSImage() const;
|
||||
bool CreateFromXpm(const char* const* bits);
|
||||
|
||||
protected:
|
||||
virtual wxGDIRefData *CreateGDIRefData() const;
|
||||
virtual wxGDIRefData *CloneGDIRefData(const wxGDIRefData *data) const;
|
||||
|
||||
private:
|
||||
DECLARE_DYNAMIC_CLASS(wxIcon)
|
||||
};
|
||||
|
||||
#endif // _WX_COCOA_ICON_H__
|
@@ -1,114 +0,0 @@
|
||||
/////////////////////////////////////////////////////////////////////////////
|
||||
// Name: wx/cocoa/listbox.h
|
||||
// Purpose: wxListBox class
|
||||
// Author: David Elliott
|
||||
// Modified by:
|
||||
// Created: 2003/03/16
|
||||
// Copyright: (c) 2003 David Elliott
|
||||
// Licence: wxWindows licence
|
||||
/////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
#ifndef __WX_COCOA_LISTBOX_H__
|
||||
#define __WX_COCOA_LISTBOX_H__
|
||||
|
||||
#include "wx/cocoa/NSTableView.h"
|
||||
|
||||
#include "wx/dynarray.h"
|
||||
|
||||
// ========================================================================
|
||||
// wxListBox
|
||||
// ========================================================================
|
||||
class WXDLLIMPEXP_CORE wxListBox: public wxListBoxBase, protected wxCocoaNSTableView
|
||||
{
|
||||
DECLARE_DYNAMIC_CLASS(wxListBox)
|
||||
DECLARE_EVENT_TABLE()
|
||||
WX_DECLARE_COCOA_OWNER(NSTableView,NSControl,NSView)
|
||||
// ------------------------------------------------------------------------
|
||||
// initialization
|
||||
// ------------------------------------------------------------------------
|
||||
public:
|
||||
wxListBox() { m_cocoaItems = NULL; m_cocoaDataSource = NULL; }
|
||||
wxListBox(wxWindow *parent, wxWindowID winid,
|
||||
const wxPoint& pos = wxDefaultPosition,
|
||||
const wxSize& size = wxDefaultSize,
|
||||
int n = 0, const wxString choices[] = NULL,
|
||||
long style = 0,
|
||||
const wxValidator& validator = wxDefaultValidator,
|
||||
const wxString& name = wxListBoxNameStr)
|
||||
{
|
||||
Create(parent, winid, pos, size, n, choices, style, validator, name);
|
||||
}
|
||||
wxListBox(wxWindow *parent, wxWindowID winid,
|
||||
const wxPoint& pos,
|
||||
const wxSize& size,
|
||||
const wxArrayString& choices,
|
||||
long style = 0,
|
||||
const wxValidator& validator = wxDefaultValidator,
|
||||
const wxString& name = wxListBoxNameStr)
|
||||
{
|
||||
Create(parent, winid, pos, size, choices, style, validator, name);
|
||||
}
|
||||
|
||||
bool Create(wxWindow *parent, wxWindowID winid,
|
||||
const wxPoint& pos = wxDefaultPosition,
|
||||
const wxSize& size = wxDefaultSize,
|
||||
int n = 0, const wxString choices[] = NULL,
|
||||
long style = 0,
|
||||
const wxValidator& validator = wxDefaultValidator,
|
||||
const wxString& name = wxListBoxNameStr);
|
||||
bool Create(wxWindow *parent, wxWindowID winid,
|
||||
const wxPoint& pos,
|
||||
const wxSize& size,
|
||||
const wxArrayString& choices,
|
||||
long style = 0,
|
||||
const wxValidator& validator = wxDefaultValidator,
|
||||
const wxString& name = wxListBoxNameStr);
|
||||
virtual ~wxListBox();
|
||||
|
||||
// ------------------------------------------------------------------------
|
||||
// Cocoa callbacks
|
||||
// ------------------------------------------------------------------------
|
||||
protected:
|
||||
virtual int CocoaDataSource_numberOfRows();
|
||||
virtual struct objc_object* CocoaDataSource_objectForTableColumn(
|
||||
WX_NSTableColumn tableColumn, int rowIndex);
|
||||
WX_NSMutableArray m_cocoaItems;
|
||||
wxArrayPtrVoid m_itemClientData;
|
||||
struct objc_object *m_cocoaDataSource;
|
||||
bool m_needsUpdate;
|
||||
inline bool _WxCocoa_GetNeedsUpdate();
|
||||
inline void _WxCocoa_SetNeedsUpdate(bool needsUpdate);
|
||||
virtual void OnInternalIdle();
|
||||
// ------------------------------------------------------------------------
|
||||
// Implementation
|
||||
// ------------------------------------------------------------------------
|
||||
public:
|
||||
virtual wxSize DoGetBestSize() const;
|
||||
// pure virtuals from wxListBoxBase
|
||||
virtual bool IsSelected(int n) const;
|
||||
virtual int GetSelections(wxArrayInt& aSelections) const;
|
||||
protected:
|
||||
virtual void DoSetFirstItem(int n);
|
||||
virtual void DoSetSelection(int n, bool select);
|
||||
|
||||
// pure virtuals from wxItemContainer
|
||||
public:
|
||||
// deleting items
|
||||
virtual void DoClear();
|
||||
virtual void DoDeleteOneItem(unsigned int n);
|
||||
// accessing strings
|
||||
virtual unsigned int GetCount() const;
|
||||
virtual wxString GetString(unsigned int n) const;
|
||||
virtual void SetString(unsigned int n, const wxString& s);
|
||||
virtual int FindString(const wxString& s, bool bCase = false) const;
|
||||
// selection
|
||||
virtual int GetSelection() const;
|
||||
protected:
|
||||
virtual int DoInsertItems(const wxArrayStringsAdapter& items,
|
||||
unsigned int pos,
|
||||
void **clientData, wxClientDataType type);
|
||||
virtual void DoSetItemClientData(unsigned int n, void* clientData);
|
||||
virtual void* DoGetItemClientData(unsigned int n) const;
|
||||
};
|
||||
|
||||
#endif // __WX_COCOA_LISTBOX_H__
|
@@ -1,21 +0,0 @@
|
||||
///////////////////////////////////////////////////////////////////////////////
|
||||
// Name: wx/cocoa/log.h
|
||||
// Purpose: Declare wxCocoa-specific trace masks
|
||||
// Author: David Elliott
|
||||
// Modified by:
|
||||
// Created: 2004/02/07
|
||||
// Copyright: (c) 2004 David Elliott
|
||||
// Licence: wxWindows licence
|
||||
///////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
#ifndef _WX_COCOA_LOG_H__
|
||||
#define _WX_COCOA_LOG_H__
|
||||
|
||||
// General tracing (in lieu of wxLogDebug)
|
||||
#define wxTRACE_COCOA wxT("COCOA")
|
||||
// Specific tracing
|
||||
#define wxTRACE_COCOA_RetainRelease wxT("COCOA_RetainRelease")
|
||||
#define wxTRACE_COCOA_TopLevelWindow_Size wxT("COCOA_TopLevelWindow_Size")
|
||||
#define wxTRACE_COCOA_Window_Size wxT("COCOA_Window_Size")
|
||||
|
||||
#endif //ndef _WX_COCOA_LOG_H__
|
@@ -1,70 +0,0 @@
|
||||
///////////////////////////////////////////////////////////////////////////////
|
||||
// Name: wx/cocoa/mbarman.h
|
||||
// Purpose: wxMenuBarManager class
|
||||
// Author: David Elliott
|
||||
// Modified by:
|
||||
// Created: 2003/09/04
|
||||
// Copyright: (c) 2003 David Elliott
|
||||
// Licence: wxWindows licence
|
||||
///////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
#ifndef __WX_COCOA_MBARMAN_H__
|
||||
#define __WX_COCOA_MBARMAN_H__
|
||||
|
||||
#if wxUSE_MENUS
|
||||
|
||||
#include "wx/toplevel.h"
|
||||
|
||||
DECLARE_WXCOCOA_OBJC_CLASS(wxMenuBarManagerObserver);
|
||||
|
||||
// ========================================================================
|
||||
// wxMenuBarManager
|
||||
// ========================================================================
|
||||
class WXDLLIMPEXP_CORE wxMenuBarManager : public wxObject
|
||||
{
|
||||
// ------------------------------------------------------------------------
|
||||
// initialization/destruction
|
||||
// ------------------------------------------------------------------------
|
||||
public:
|
||||
wxMenuBarManager();
|
||||
virtual ~wxMenuBarManager();
|
||||
// ------------------------------------------------------------------------
|
||||
// Single instance
|
||||
// ------------------------------------------------------------------------
|
||||
public:
|
||||
static wxMenuBarManager *GetInstance() { return sm_mbarmanInstance; }
|
||||
static void CreateInstance();
|
||||
static void DestroyInstance();
|
||||
protected:
|
||||
static wxMenuBarManager *sm_mbarmanInstance;
|
||||
// ------------------------------------------------------------------------
|
||||
// Implementation
|
||||
// ------------------------------------------------------------------------
|
||||
public:
|
||||
void SetMainMenuBar(wxMenuBar* menubar);
|
||||
void WindowDidBecomeKey(NSNotification *notification);
|
||||
#if 0
|
||||
void WindowDidResignKey(NSNotification *notification);
|
||||
void WindowDidBecomeMain(NSNotification *notification);
|
||||
void WindowDidResignMain(NSNotification *notification);
|
||||
void WindowWillClose(NSNotification *notification);
|
||||
#endif // 0
|
||||
void UpdateMenuBar();
|
||||
protected:
|
||||
void SetMenuBar(wxMenuBar* menubar);
|
||||
void InstallMenuBarForWindow(wxCocoaNSWindow *win);
|
||||
void InstallMainMenu();
|
||||
WX_NSMenu m_menuApp;
|
||||
WX_NSMenu m_menuServices;
|
||||
WX_NSMenu m_menuWindows;
|
||||
WX_NSMenu m_menuMain;
|
||||
// Is main menu bar the current one
|
||||
bool m_mainMenuBarInstalled;
|
||||
// Main menu (if app provides one)
|
||||
wxMenuBar *m_mainMenuBar;
|
||||
wxMenuBarManagerObserver *m_observer;
|
||||
WX_NSWindow m_currentNSWindow;
|
||||
};
|
||||
|
||||
#endif // wxUSE_MENUS
|
||||
#endif // _WX_COCOA_MBARMAN_H_
|
@@ -1,163 +0,0 @@
|
||||
/////////////////////////////////////////////////////////////////////////////
|
||||
// Name: wx/cocoa/mdi.h
|
||||
// Purpose: wxMDIParentFrame, wxMDIChildFrame, wxMDIClientWindow
|
||||
// Author: David Elliott
|
||||
// Modified by: 2008-10-31 Vadim Zeitlin: derive from the base classes
|
||||
// Created: 2003/09/08
|
||||
// Copyright: (c) 2003 David Elliott
|
||||
// (c) 2008 Vadim Zeitlin
|
||||
// Licence: wxWindows licence
|
||||
/////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
#ifndef __WX_COCOA_MDI_H__
|
||||
#define __WX_COCOA_MDI_H__
|
||||
|
||||
#include "wx/frame.h"
|
||||
|
||||
DECLARE_WXCOCOA_OBJC_CLASS(wxMDIParentFrameObserver);
|
||||
|
||||
class WXDLLIMPEXP_FWD_CORE wxMDIChildFrame;
|
||||
class WXDLLIMPEXP_FWD_CORE wxMDIClientWindow;
|
||||
|
||||
WX_DECLARE_EXPORTED_LIST(wxMDIChildFrame, wxCocoaMDIChildFrameList);
|
||||
|
||||
// ========================================================================
|
||||
// wxMDIParentFrame
|
||||
// ========================================================================
|
||||
class WXDLLIMPEXP_CORE wxMDIParentFrame : public wxMDIParentFrameBase
|
||||
{
|
||||
friend class WXDLLIMPEXP_FWD_CORE wxMDIChildFrame;
|
||||
DECLARE_EVENT_TABLE()
|
||||
DECLARE_DYNAMIC_CLASS(wxMDIParentFrame)
|
||||
// ------------------------------------------------------------------------
|
||||
// initialization
|
||||
// ------------------------------------------------------------------------
|
||||
public:
|
||||
wxMDIParentFrame() { Init(); }
|
||||
wxMDIParentFrame(wxWindow *parent,
|
||||
wxWindowID winid,
|
||||
const wxString& title,
|
||||
const wxPoint& pos = wxDefaultPosition,
|
||||
const wxSize& size = wxDefaultSize,
|
||||
long style = wxDEFAULT_FRAME_STYLE,
|
||||
const wxString& name = wxFrameNameStr)
|
||||
{
|
||||
Init();
|
||||
Create(parent, winid, title, pos, size, style, name);
|
||||
}
|
||||
|
||||
virtual ~wxMDIParentFrame();
|
||||
|
||||
bool Create(wxWindow *parent,
|
||||
wxWindowID winid,
|
||||
const wxString& title,
|
||||
const wxPoint& pos = wxDefaultPosition,
|
||||
const wxSize& size = wxDefaultSize,
|
||||
long style = wxDEFAULT_FRAME_STYLE,
|
||||
const wxString& name = wxFrameNameStr);
|
||||
protected:
|
||||
void Init();
|
||||
// ------------------------------------------------------------------------
|
||||
// Cocoa specifics
|
||||
// ------------------------------------------------------------------------
|
||||
public:
|
||||
void WindowDidBecomeMain(NSNotification *notification);
|
||||
protected:
|
||||
virtual void CocoaDelegate_windowDidBecomeKey(void);
|
||||
virtual void CocoaDelegate_windowDidResignKey(void);
|
||||
virtual bool Cocoa_canBecomeMainWindow(bool &canBecome);
|
||||
virtual wxMenuBar* GetAppMenuBar(wxCocoaNSWindow *win);
|
||||
|
||||
void AddMDIChild(wxMDIChildFrame *child);
|
||||
void RemoveMDIChild(wxMDIChildFrame *child);
|
||||
|
||||
wxMDIParentFrameObserver *m_observer;
|
||||
// ------------------------------------------------------------------------
|
||||
// Implementation
|
||||
// ------------------------------------------------------------------------
|
||||
public:
|
||||
void SetActiveChild(wxMDIChildFrame *child);
|
||||
|
||||
// implement base class pure virtuals
|
||||
// ----------------------------------
|
||||
|
||||
static bool IsTDI() { return false; }
|
||||
|
||||
virtual void ActivateNext() { /* TODO */ }
|
||||
virtual void ActivatePrevious() { /* TODO */ }
|
||||
|
||||
protected:
|
||||
wxMDIClientWindow *m_clientWindow;
|
||||
wxMDIChildFrame *m_currentChild;
|
||||
wxCocoaMDIChildFrameList m_mdiChildren;
|
||||
};
|
||||
|
||||
// ========================================================================
|
||||
// wxMDIChildFrame
|
||||
// ========================================================================
|
||||
class WXDLLIMPEXP_CORE wxMDIChildFrame: public wxFrame
|
||||
{
|
||||
friend class WXDLLIMPEXP_FWD_CORE wxMDIParentFrame;
|
||||
DECLARE_EVENT_TABLE()
|
||||
DECLARE_DYNAMIC_CLASS(wxMDIChildFrame)
|
||||
// ------------------------------------------------------------------------
|
||||
// initialization
|
||||
// ------------------------------------------------------------------------
|
||||
public:
|
||||
wxMDIChildFrame() { Init(); }
|
||||
wxMDIChildFrame(wxMDIParentFrame *parent,
|
||||
wxWindowID winid,
|
||||
const wxString& title,
|
||||
const wxPoint& pos = wxDefaultPosition,
|
||||
const wxSize& size = wxDefaultSize,
|
||||
long style = wxDEFAULT_FRAME_STYLE,
|
||||
const wxString& name = wxFrameNameStr)
|
||||
{
|
||||
Init();
|
||||
Create(parent, winid, title, pos, size, style, name);
|
||||
}
|
||||
|
||||
virtual ~wxMDIChildFrame();
|
||||
|
||||
bool Create(wxMDIParentFrame *parent,
|
||||
wxWindowID winid,
|
||||
const wxString& title,
|
||||
const wxPoint& pos = wxDefaultPosition,
|
||||
const wxSize& size = wxDefaultSize,
|
||||
long style = wxDEFAULT_FRAME_STYLE,
|
||||
const wxString& name = wxFrameNameStr);
|
||||
protected:
|
||||
void Init();
|
||||
// ------------------------------------------------------------------------
|
||||
// Cocoa specifics
|
||||
// ------------------------------------------------------------------------
|
||||
public:
|
||||
protected:
|
||||
virtual void CocoaDelegate_windowDidBecomeKey(void);
|
||||
virtual void CocoaDelegate_windowDidBecomeMain(void);
|
||||
virtual void CocoaDelegate_windowDidResignKey(void);
|
||||
// ------------------------------------------------------------------------
|
||||
// Implementation
|
||||
// ------------------------------------------------------------------------
|
||||
public:
|
||||
virtual void Activate();
|
||||
virtual bool Destroy();
|
||||
protected:
|
||||
wxMDIParentFrame *m_mdiParent;
|
||||
};
|
||||
|
||||
// ========================================================================
|
||||
// wxMDIClientWindow
|
||||
// ========================================================================
|
||||
class wxMDIClientWindow : public wxMDIClientWindowBase
|
||||
{
|
||||
public:
|
||||
wxMDIClientWindow() { }
|
||||
|
||||
virtual bool CreateClient(wxMDIParentFrame *parent,
|
||||
long style = wxHSCROLL | wxVSCROLL);
|
||||
|
||||
DECLARE_DYNAMIC_CLASS(wxMDIClientWindow)
|
||||
};
|
||||
|
||||
#endif // __WX_COCOA_MDI_H__
|
@@ -1,185 +0,0 @@
|
||||
///////////////////////////////////////////////////////////////////////////////
|
||||
// Name: wx/cocoa/menu.h
|
||||
// Purpose: wxMenu and wxMenuBar classes
|
||||
// Author: David Elliott
|
||||
// Modified by:
|
||||
// Created: 2002/12/09
|
||||
// Copyright: (c) 2002 David Elliott
|
||||
// Licence: wxWindows licence
|
||||
///////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
#ifndef __WX_COCOA_MENU_H__
|
||||
#define __WX_COCOA_MENU_H__
|
||||
|
||||
#include "wx/cocoa/NSMenu.h"
|
||||
|
||||
#if wxUSE_ACCEL
|
||||
#include "wx/accel.h"
|
||||
#endif // wxUSE_ACCEL
|
||||
|
||||
// ========================================================================
|
||||
// wxMenu
|
||||
// ========================================================================
|
||||
|
||||
class WXDLLIMPEXP_CORE wxMenu : public wxMenuBase, public wxCocoaNSMenu
|
||||
{
|
||||
public:
|
||||
// ctors and dtor
|
||||
wxMenu(const wxString& title, long style = 0)
|
||||
: wxMenuBase(title, style)
|
||||
, m_cocoaDeletes(false)
|
||||
{ Create(title,style); }
|
||||
bool Create(const wxString& title, long style = 0);
|
||||
|
||||
wxMenu(long style = 0) : wxMenuBase(style) { Create(wxEmptyString, style); }
|
||||
|
||||
virtual ~wxMenu();
|
||||
|
||||
// ------------------------------------------------------------------------
|
||||
// Cocoa specifics
|
||||
// ------------------------------------------------------------------------
|
||||
public:
|
||||
inline WX_NSMenu GetNSMenu() { return m_cocoaNSMenu; }
|
||||
void SetCocoaDeletes(bool cocoaDeletes);
|
||||
virtual void Cocoa_dealloc();
|
||||
protected:
|
||||
WX_NSMenu m_cocoaNSMenu;
|
||||
bool m_cocoaDeletes;
|
||||
// ------------------------------------------------------------------------
|
||||
// Implementation
|
||||
// ------------------------------------------------------------------------
|
||||
protected:
|
||||
// implement base class virtuals
|
||||
virtual wxMenuItem* DoAppend(wxMenuItem *item);
|
||||
virtual wxMenuItem* DoInsert(size_t pos, wxMenuItem *item);
|
||||
virtual wxMenuItem* DoRemove(wxMenuItem *item);
|
||||
|
||||
#if wxUSE_ACCEL
|
||||
// add/remove accel for the given menu item
|
||||
void AddAccelFor(wxMenuItem *item);
|
||||
void RemoveAccelFor(wxMenuItem *item);
|
||||
#endif // wxUSE_ACCEL
|
||||
|
||||
private:
|
||||
#if wxUSE_ACCEL
|
||||
// the accel table for this menu
|
||||
wxAcceleratorTable m_accelTable;
|
||||
#endif // wxUSE_ACCEL
|
||||
|
||||
DECLARE_DYNAMIC_CLASS(wxMenu)
|
||||
};
|
||||
|
||||
// ========================================================================
|
||||
// wxMenuBar
|
||||
// ========================================================================
|
||||
class WXDLLIMPEXP_CORE wxMenuBar : public wxMenuBarBase
|
||||
{
|
||||
public:
|
||||
// ctors and dtor
|
||||
wxMenuBar(long style = 0) { Create(style); }
|
||||
wxMenuBar(size_t n, wxMenu *menus[], const wxString titles[], long style = 0);
|
||||
bool Create(long style = 0);
|
||||
virtual ~wxMenuBar();
|
||||
|
||||
// ------------------------------------------------------------------------
|
||||
// Cocoa specifics
|
||||
// ------------------------------------------------------------------------
|
||||
public:
|
||||
inline WX_NSMenu GetNSMenu() { return m_cocoaNSMenu; }
|
||||
protected:
|
||||
WX_NSMenu m_cocoaNSMenu;
|
||||
// ------------------------------------------------------------------------
|
||||
// Implementation
|
||||
// ------------------------------------------------------------------------
|
||||
public:
|
||||
// implement base class virtuals
|
||||
virtual bool Append(wxMenu *menu, const wxString &title);
|
||||
virtual bool Insert(size_t pos, wxMenu *menu, const wxString& title);
|
||||
virtual wxMenu *Replace(size_t pos, wxMenu *menu, const wxString& title);
|
||||
virtual wxMenu *Remove(size_t pos);
|
||||
|
||||
virtual void EnableTop(size_t pos, bool enable);
|
||||
virtual bool IsEnabledTop(size_t pos) const;
|
||||
|
||||
virtual void SetMenuLabel(size_t pos, const wxString& label);
|
||||
virtual wxString GetMenuLabel(size_t pos) const;
|
||||
|
||||
virtual void Attach(wxFrame *frame);
|
||||
virtual void Detach();
|
||||
|
||||
// get the next item for the givan accel letter (used by wxFrame), return
|
||||
// -1 if none
|
||||
//
|
||||
// if unique is not NULL, filled with TRUE if there is only one item with
|
||||
// this accel, FALSE if two or more
|
||||
int FindNextItemForAccel(int idxStart,
|
||||
int keycode,
|
||||
bool *unique = NULL) const;
|
||||
|
||||
// called by wxFrame to set focus to or open the given menu
|
||||
void SelectMenu(size_t pos);
|
||||
|
||||
#if wxUSE_ACCEL
|
||||
// find the item for the given accel and generate an event if found
|
||||
bool ProcessAccelEvent(const wxKeyEvent& event);
|
||||
#endif // wxUSE_ACCEL
|
||||
|
||||
protected:
|
||||
// event handlers
|
||||
void OnLeftDown(wxMouseEvent& event);
|
||||
void OnMouseMove(wxMouseEvent& event);
|
||||
void OnKeyDown(wxKeyEvent& event);
|
||||
void OnKillFocus(wxFocusEvent& event);
|
||||
|
||||
// process the mouse move event, return TRUE if we did, FALSE to continue
|
||||
// processing as usual
|
||||
//
|
||||
// the coordinates are client coordinates of menubar, convert if necessary
|
||||
bool ProcessMouseEvent(const wxPoint& pt);
|
||||
|
||||
// menubar geometry
|
||||
virtual wxSize DoGetBestClientSize() const;
|
||||
|
||||
// has the menubar been created already?
|
||||
bool IsCreated() const { return m_frameLast != NULL; }
|
||||
|
||||
// get the (total) width of the specified menu
|
||||
wxCoord GetItemWidth(size_t pos) const;
|
||||
|
||||
// get the rect of the item
|
||||
wxRect GetItemRect(size_t pos) const;
|
||||
|
||||
// get the menu from the given point or -1 if none
|
||||
int GetMenuFromPoint(const wxPoint& pos) const;
|
||||
|
||||
// refresh the given item
|
||||
void RefreshItem(size_t pos);
|
||||
|
||||
// refresh all items after this one (including it)
|
||||
void RefreshAllItemsAfter(size_t pos);
|
||||
|
||||
// do we show a menu currently?
|
||||
bool IsShowingMenu() const { return m_menuShown != 0; }
|
||||
|
||||
// we don't want to have focus except while selecting from menu
|
||||
void GiveAwayFocus();
|
||||
|
||||
// the current item (only used when menubar has focus)
|
||||
int m_current;
|
||||
|
||||
private:
|
||||
// the last frame to which we were attached, NULL initially
|
||||
wxFrame *m_frameLast;
|
||||
|
||||
// the currently shown menu or NULL
|
||||
wxMenu *m_menuShown;
|
||||
|
||||
// should be showing the menu? this is subtly different from m_menuShown !=
|
||||
// NULL as the menu which should be shown may be disabled in which case we
|
||||
// don't show it - but will do as soon as the focus shifts to another menu
|
||||
bool m_shouldShowMenu;
|
||||
|
||||
DECLARE_DYNAMIC_CLASS(wxMenuBar)
|
||||
};
|
||||
|
||||
#endif // _WX_COCOA_MENU_H_
|
@@ -1,99 +0,0 @@
|
||||
///////////////////////////////////////////////////////////////////////////////
|
||||
// Name: wx/cocoa/menuitem.h
|
||||
// Purpose: wxMenuItem class
|
||||
// Author: David Elliott
|
||||
// Modified by:
|
||||
// Created: 2002/12/13
|
||||
// Copyright: (c) 2002 David Elliott
|
||||
// Licence: wxWindows licence
|
||||
///////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
#ifndef _WX_COCOA_MENUITEM_H_
|
||||
#define _WX_COCOA_MENUITEM_H_
|
||||
|
||||
#include "wx/hashmap.h"
|
||||
#include "wx/bitmap.h"
|
||||
|
||||
#include "wx/cocoa/ObjcRef.h"
|
||||
|
||||
// ========================================================================
|
||||
// wxMenuItem
|
||||
// ========================================================================
|
||||
|
||||
#define wxMenuItemCocoa wxMenuItem
|
||||
class wxMenuItemCocoa;
|
||||
WX_DECLARE_HASH_MAP(WX_NSMenuItem,wxMenuItem*,wxPointerHash,wxPointerEqual,wxMenuItemCocoaHash);
|
||||
|
||||
class WXDLLIMPEXP_CORE wxMenuItemCocoa : public wxMenuItemBase
|
||||
{
|
||||
public:
|
||||
// ------------------------------------------------------------------------
|
||||
// initialization
|
||||
// ------------------------------------------------------------------------
|
||||
wxMenuItemCocoa(wxMenu *parentMenu = NULL,
|
||||
int id = wxID_SEPARATOR,
|
||||
const wxString& name = wxEmptyString,
|
||||
const wxString& help = wxEmptyString,
|
||||
wxItemKind kind = wxITEM_NORMAL,
|
||||
wxMenu *subMenu = NULL);
|
||||
virtual ~wxMenuItemCocoa();
|
||||
|
||||
// ------------------------------------------------------------------------
|
||||
// Cocoa specifics
|
||||
// ------------------------------------------------------------------------
|
||||
public:
|
||||
inline WX_NSMenuItem GetNSMenuItem() { return m_cocoaNSMenuItem; }
|
||||
static inline wxMenuItem* GetFromCocoa(WX_NSMenuItem cocoaNSMenuItem)
|
||||
{
|
||||
wxMenuItemCocoaHash::iterator iter=sm_cocoaHash.find(cocoaNSMenuItem);
|
||||
if(iter!=sm_cocoaHash.end())
|
||||
return iter->second;
|
||||
return NULL;
|
||||
}
|
||||
void CocoaItemSelected();
|
||||
bool Cocoa_validateMenuItem();
|
||||
protected:
|
||||
void CocoaSetKeyEquivalent();
|
||||
WX_NSMenuItem m_cocoaNSMenuItem;
|
||||
static wxMenuItemCocoaHash sm_cocoaHash;
|
||||
static wxObjcAutoRefFromAlloc<struct objc_object *> sm_cocoaTarget;
|
||||
// ------------------------------------------------------------------------
|
||||
// Implementation
|
||||
// ------------------------------------------------------------------------
|
||||
public:
|
||||
// override base class virtuals to update the item appearance on screen
|
||||
virtual void SetItemLabel(const wxString& text);
|
||||
virtual void SetCheckable(bool checkable);
|
||||
|
||||
virtual void Enable(bool enable = TRUE);
|
||||
virtual void Check(bool check = TRUE);
|
||||
|
||||
// we add some extra functions which are also available under MSW from
|
||||
// wxOwnerDrawn class - they will be moved to wxMenuItemBase later
|
||||
// hopefully
|
||||
void SetBitmaps(const wxBitmap& bmpChecked,
|
||||
const wxBitmap& bmpUnchecked = wxNullBitmap);
|
||||
void SetBitmap(const wxBitmap& bmp) { SetBitmaps(bmp); }
|
||||
const wxBitmap& GetBitmap(bool checked = TRUE) const
|
||||
{ return checked ? m_bmpChecked : m_bmpUnchecked; }
|
||||
|
||||
protected:
|
||||
// notify the menu about the change in this item
|
||||
inline void NotifyMenu();
|
||||
|
||||
// set the accel index and string from text
|
||||
void UpdateAccelInfo();
|
||||
|
||||
// the bitmaps (may be invalid, then they're not used)
|
||||
wxBitmap m_bmpChecked,
|
||||
m_bmpUnchecked;
|
||||
|
||||
// the accel string (i.e. "Ctrl-Q" or "Alt-F1")
|
||||
wxString m_strAccel;
|
||||
|
||||
private:
|
||||
DECLARE_DYNAMIC_CLASS(wxMenuItem)
|
||||
};
|
||||
|
||||
#endif // _WX_COCOA_MENUITEM_H_
|
||||
|
@@ -1,70 +0,0 @@
|
||||
/////////////////////////////////////////////////////////////////////////////
|
||||
// Name: wx/cocoa/msgdlg.h
|
||||
// Purpose: wxMessageDialog class
|
||||
// Author: Gareth Simpson
|
||||
// Created: 2007-10-29
|
||||
// Licence: wxWindows licence
|
||||
/////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
#ifndef _WX_COCOA_MSGDLG_H_
|
||||
#define _WX_COCOA_MSGDLG_H_
|
||||
|
||||
#include "wx/msgdlg.h"
|
||||
|
||||
DECLARE_WXCOCOA_OBJC_CLASS(NSAlert);
|
||||
|
||||
#ifndef wxUSE_COCOA_NATIVE_MSGDLG
|
||||
// trunk: Always use Cocoa dialog
|
||||
// 2.8: Only use Cocoa dialog if ABI incompatible features is on
|
||||
// Build both on both branches (there was no wxCocoaMessageDialog class so it's not an ABI issue)
|
||||
#if 1/* wxUSE_ABI_INCOMPATIBLE_FEATURES */
|
||||
#define wxUSE_COCOA_NATIVE_MSGDLG 1
|
||||
#else
|
||||
#define wxUSE_COCOA_NATIVE_MSGDLG 0
|
||||
#endif
|
||||
#endif
|
||||
|
||||
#if wxUSE_COCOA_NATIVE_MSGDLG
|
||||
#define wxMessageDialog wxCocoaMessageDialog
|
||||
#else
|
||||
#include "wx/generic/msgdlgg.h"
|
||||
|
||||
#define wxMessageDialog wxGenericMessageDialog
|
||||
#endif
|
||||
|
||||
// ----------------------------------------------------------------------------
|
||||
// wxCocoaMessageDialog
|
||||
// ----------------------------------------------------------------------------
|
||||
|
||||
|
||||
class WXDLLIMPEXP_CORE wxCocoaMessageDialog
|
||||
: public wxMessageDialogWithCustomLabels
|
||||
{
|
||||
public:
|
||||
wxCocoaMessageDialog(wxWindow *parent,
|
||||
const wxString& message,
|
||||
const wxString& caption = wxMessageBoxCaptionStr,
|
||||
long style = wxOK|wxCENTRE,
|
||||
const wxPoint& pos = wxDefaultPosition);
|
||||
|
||||
virtual int ShowModal();
|
||||
|
||||
protected:
|
||||
// not supported for message dialog
|
||||
virtual void DoSetSize(int WXUNUSED(x), int WXUNUSED(y),
|
||||
int WXUNUSED(width), int WXUNUSED(height),
|
||||
int WXUNUSED(sizeFlags) = wxSIZE_AUTO) {}
|
||||
|
||||
// override wxMessageDialogWithCustomLabels method to get rid of
|
||||
// accelerators in the custom label strings
|
||||
//
|
||||
// VZ: I have no idea _why_ do we do this but the old version did and
|
||||
// I didn't want to change the existing behaviour
|
||||
virtual void DoSetCustomLabel(wxString& var, const ButtonLabel& label);
|
||||
|
||||
DECLARE_DYNAMIC_CLASS(wxCocoaMessageDialog)
|
||||
wxDECLARE_NO_COPY_CLASS(wxCocoaMessageDialog);
|
||||
};
|
||||
|
||||
#endif // _WX_MSGDLG_H_
|
||||
|
@@ -1,104 +0,0 @@
|
||||
/////////////////////////////////////////////////////////////////////////////
|
||||
// Name: wx/cocoa/notebook.h
|
||||
// Purpose: wxNotebook class
|
||||
// Author: David Elliott
|
||||
// Modified by:
|
||||
// Created: 2004/04/08
|
||||
// Copyright: (c) 2004 David Elliott
|
||||
// Licence: wxWindows licence
|
||||
/////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
#ifndef _WX_COCOA_NOTEBOOK_H__
|
||||
#define _WX_COCOA_NOTEBOOK_H__
|
||||
|
||||
#include "wx/cocoa/NSTabView.h"
|
||||
|
||||
// ========================================================================
|
||||
// wxNotebook
|
||||
// ========================================================================
|
||||
class WXDLLIMPEXP_CORE wxNotebook: public wxNotebookBase, protected wxCocoaNSTabView
|
||||
{
|
||||
DECLARE_DYNAMIC_CLASS(wxNotebook)
|
||||
DECLARE_EVENT_TABLE()
|
||||
WX_DECLARE_COCOA_OWNER(NSTabView,NSView,NSView)
|
||||
// ------------------------------------------------------------------------
|
||||
// initialization
|
||||
// ------------------------------------------------------------------------
|
||||
public:
|
||||
wxNotebook() { }
|
||||
wxNotebook(wxWindow *parent, wxWindowID winid,
|
||||
const wxPoint& pos = wxDefaultPosition,
|
||||
const wxSize& size = wxDefaultSize,
|
||||
long style = 0,
|
||||
const wxString& name = wxNotebookNameStr)
|
||||
{
|
||||
Create(parent, winid, pos, size, style, name);
|
||||
}
|
||||
|
||||
bool Create(wxWindow *parent, wxWindowID winid,
|
||||
const wxPoint& pos = wxDefaultPosition,
|
||||
const wxSize& size = wxDefaultSize,
|
||||
long style = 0,
|
||||
const wxString& name = wxNotebookNameStr);
|
||||
virtual ~wxNotebook();
|
||||
|
||||
// ------------------------------------------------------------------------
|
||||
// Cocoa callbacks
|
||||
// ------------------------------------------------------------------------
|
||||
protected:
|
||||
// Notebooks cannot be enabled/disabled
|
||||
virtual void CocoaSetEnabled(bool WXUNUSED(enable)) { }
|
||||
virtual void CocoaDelegate_tabView_didSelectTabViewItem(WX_NSTabViewItem tabviewItem);
|
||||
virtual bool CocoaDelegate_tabView_shouldSelectTabViewItem(WX_NSTabViewItem tabviewItem);
|
||||
// ------------------------------------------------------------------------
|
||||
// Implementation
|
||||
// ------------------------------------------------------------------------
|
||||
public:
|
||||
// set the currently selected page, return the index of the previously
|
||||
// selected one (or wxNOT_FOUND on error)
|
||||
int SetSelection(size_t nPage);
|
||||
// get the currently selected page
|
||||
int GetSelection() const;
|
||||
|
||||
// changes selected page without sending events
|
||||
int ChangeSelection(size_t nPage);
|
||||
|
||||
// set/get the title of a page
|
||||
bool SetPageText(size_t nPage, const wxString& strText);
|
||||
wxString GetPageText(size_t nPage) const;
|
||||
|
||||
// sets/returns item's image index in the current image list
|
||||
int GetPageImage(size_t nPage) const;
|
||||
bool SetPageImage(size_t nPage, int nImage);
|
||||
|
||||
// set the size (the same for all pages)
|
||||
void SetPageSize(const wxSize& size);
|
||||
|
||||
// SetPadding and SetTabSize aren't possible to implement
|
||||
void SetPadding(const wxSize& padding);
|
||||
void SetTabSize(const wxSize& sz);
|
||||
|
||||
//-----------------------
|
||||
// adding/removing pages
|
||||
|
||||
// remove one page from the notebook, without deleting
|
||||
virtual wxNotebookPage *DoRemovePage(size_t nPage);
|
||||
|
||||
// remove one page from the notebook
|
||||
bool DeletePage(size_t nPage);
|
||||
// remove all pages
|
||||
bool DeleteAllPages();
|
||||
|
||||
// adds a new page to the notebook (it will be deleted ny the notebook,
|
||||
// don't delete it yourself). If bSelect, this page becomes active.
|
||||
// the same as AddPage(), but adds it at the specified position
|
||||
bool InsertPage( size_t position,
|
||||
wxNotebookPage *win,
|
||||
const wxString& strText,
|
||||
bool bSelect = false,
|
||||
int imageId = NO_IMAGE );
|
||||
|
||||
protected:
|
||||
};
|
||||
|
||||
#endif //ndef _WX_COCOA_NOTEBOOK_H__
|
@@ -1,30 +0,0 @@
|
||||
///////////////////////////////////////////////////////////////////////////////
|
||||
// Name: wx/cocoa/objc/NSMenu.h
|
||||
// Purpose: WXNSMenu class
|
||||
// Author: David Elliott
|
||||
// Modified by:
|
||||
// Created: 2007/04/20 (move from NSMenu.mm)
|
||||
// Copyright: (c) 2002 David Elliott
|
||||
// Licence: wxWindows licence
|
||||
///////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
#ifndef __WX_COCOA_OBJC_NSMENU_H__
|
||||
#define __WX_COCOA_OBJC_NSMENU_H__
|
||||
|
||||
#include "wx/cocoa/objc/objc_uniquifying.h"
|
||||
|
||||
#import <AppKit/NSMenu.h>
|
||||
|
||||
// ============================================================================
|
||||
// @class WXNSMenu
|
||||
// ============================================================================
|
||||
@interface WXNSMenu : NSMenu
|
||||
{
|
||||
}
|
||||
|
||||
- (void)dealloc;
|
||||
|
||||
@end // WXNSMenu
|
||||
WX_DECLARE_GET_OBJC_CLASS(WXNSMenu,NSMenu)
|
||||
|
||||
#endif //ndef __WX_COCOA_OBJC_NSMENU_H__
|
@@ -1,36 +0,0 @@
|
||||
///////////////////////////////////////////////////////////////////////////////
|
||||
// Name: wx/cocoa/objc/NSSlider.h
|
||||
// Purpose: WXNSSlider class
|
||||
// Author: David Elliott
|
||||
// Modified by:
|
||||
// Created: 2007/08/10 (move from NSSlider.mm)
|
||||
// Copyright: (c) 2007 Software 2000 Ltd.
|
||||
// Licence: wxWindows licence
|
||||
///////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
#ifndef __WX_COCOA_OBJC_NSSLIDER_H__
|
||||
#define __WX_COCOA_OBJC_NSSLIDER_H__
|
||||
|
||||
#include "wx/cocoa/objc/objc_uniquifying.h"
|
||||
|
||||
#import <AppKit/NSSlider.h>
|
||||
|
||||
// ============================================================================
|
||||
// @class WXNSSlider
|
||||
// ============================================================================
|
||||
|
||||
@interface WXNSSlider : NSSlider
|
||||
@end
|
||||
|
||||
WX_DECLARE_GET_OBJC_CLASS(WXNSSlider,NSSlider)
|
||||
|
||||
// ============================================================================
|
||||
// @class WXNSSliderCell
|
||||
// ============================================================================
|
||||
|
||||
@interface WXNSSliderCell : NSSliderCell
|
||||
@end
|
||||
|
||||
WX_DECLARE_GET_OBJC_CLASS(WXNSSliderCell,NSSliderCell)
|
||||
|
||||
#endif //ndef __WX_COCOA_OBJC_NSSLIDER_H__
|
@@ -1,44 +0,0 @@
|
||||
///////////////////////////////////////////////////////////////////////////////
|
||||
// Name: wx/cocoa/objc/NSView.h
|
||||
// Purpose: WXNSView class
|
||||
// Author: David Elliott
|
||||
// Modified by:
|
||||
// Created: 2007/04/20 (move from NSView.mm)
|
||||
// Copyright: (c) 2003 David Elliott
|
||||
// Licence: wxWindows licence
|
||||
///////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
#ifndef __WX_COCOA_OBJC_NSVIEW_H__
|
||||
#define __WX_COCOA_OBJC_NSVIEW_H__
|
||||
|
||||
#include "wx/cocoa/objc/objc_uniquifying.h"
|
||||
|
||||
#import <AppKit/NSView.h>
|
||||
|
||||
// ============================================================================
|
||||
// @class WXNSView
|
||||
// ============================================================================
|
||||
@interface WXNSView : NSView
|
||||
{
|
||||
}
|
||||
|
||||
- (void)drawRect: (NSRect)rect;
|
||||
- (void)mouseDown:(NSEvent *)theEvent;
|
||||
- (void)mouseDragged:(NSEvent *)theEvent;
|
||||
- (void)mouseUp:(NSEvent *)theEvent;
|
||||
- (void)mouseMoved:(NSEvent *)theEvent;
|
||||
- (void)mouseEntered:(NSEvent *)theEvent;
|
||||
- (void)mouseExited:(NSEvent *)theEvent;
|
||||
- (void)rightMouseDown:(NSEvent *)theEvent;
|
||||
- (void)rightMouseDragged:(NSEvent *)theEvent;
|
||||
- (void)rightMouseUp:(NSEvent *)theEvent;
|
||||
- (void)otherMouseDown:(NSEvent *)theEvent;
|
||||
- (void)otherMouseDragged:(NSEvent *)theEvent;
|
||||
- (void)otherMouseUp:(NSEvent *)theEvent;
|
||||
- (void)resetCursorRects;
|
||||
- (void)viewDidMoveToWindow;
|
||||
- (void)viewWillMoveToWindow:(NSWindow *)newWindow;
|
||||
@end // WXNSView
|
||||
WX_DECLARE_GET_OBJC_CLASS(WXNSView,NSView)
|
||||
|
||||
#endif //ndef __WX_COCOA_OBJC_NSVIEW_H__
|
@@ -1,39 +0,0 @@
|
||||
///////////////////////////////////////////////////////////////////////////////
|
||||
// Name: wx/cocoa/objc/NSWindow.h
|
||||
// Purpose: WXNSWindow class
|
||||
// Author: David Elliott
|
||||
// Modified by:
|
||||
// Created: 2007/04/20 (move from NSWindow.mm)
|
||||
// Copyright: (c) 2003 David Elliott
|
||||
// Licence: wxWindows licence
|
||||
///////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
#import <AppKit/NSWindow.h>
|
||||
#import <AppKit/NSPanel.h>
|
||||
|
||||
#include "wx/cocoa/objc/objc_uniquifying.h"
|
||||
|
||||
// ============================================================================
|
||||
// @class WXNSWindow
|
||||
// ============================================================================
|
||||
@interface WXNSWindow : NSWindow
|
||||
{
|
||||
}
|
||||
|
||||
- (BOOL)canBecomeKeyWindow;
|
||||
- (BOOL)canBecomeMainWindow;
|
||||
@end // WXNSWindow
|
||||
WX_DECLARE_GET_OBJC_CLASS(WXNSWindow,NSWindow)
|
||||
|
||||
// ============================================================================
|
||||
// @class WXNSPanel
|
||||
// ============================================================================
|
||||
@interface WXNSPanel : NSPanel
|
||||
{
|
||||
}
|
||||
|
||||
- (BOOL)canBecomeKeyWindow;
|
||||
- (BOOL)canBecomeMainWindow;
|
||||
@end // WXNSPanel
|
||||
WX_DECLARE_GET_OBJC_CLASS(WXNSPanel,NSPanel)
|
||||
|
@@ -1,364 +0,0 @@
|
||||
/////////////////////////////////////////////////////////////////////////////
|
||||
// Name: wx/cocoa/objc/objc_uniquifying.h
|
||||
// Purpose: Allows wxWidgets code to get a direct pointer to a compiled
|
||||
// Objective-C class and provides a method to fix up the
|
||||
// name to include a unique identifier (currently the address
|
||||
// of the objc_class structure).
|
||||
// Author: David Elliott <dfe@cox.net>
|
||||
// Modified by:
|
||||
// Created: 2007/05/15
|
||||
// Copyright: (c) 2007 Software 2000 Ltd.
|
||||
// Licence: wxWindows licence
|
||||
/////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
#ifndef __WX_COCOA_OBJC_CLASS_H__
|
||||
#define __WX_COCOA_OBJC_CLASS_H__
|
||||
|
||||
/* A note about this header:
|
||||
Nothing in here is guaranteed to exist in future versions of wxCocoa. There
|
||||
are other ways of adding Objective-C classes at runtime and a future wxCocoa
|
||||
might use these instead of this ugly hack. You may use this header file in
|
||||
your own wxCocoa code if you need your own Objective-C classes to be
|
||||
unqiuified.
|
||||
|
||||
You cannot turn this on for 64-bit mode. It will not compile due to opaque
|
||||
Objective-C data structures and it is not needed because it is a workaround
|
||||
for a bug that does not exist in the 64-bit runtime.
|
||||
|
||||
You should not use this when wxCocoa is built as a dynamic library. This has
|
||||
only been tested for the case when wxCocoa is built as a static library and
|
||||
statically linked to user code to form a loadable bundle (e.g. a Cocoa plugin).
|
||||
It forces each plugin (when multiple wxCocoa-using plugins are used) to use
|
||||
its own internal Objective-C classes which is desirable when wxCocoa is
|
||||
statically linked to the rest of the code.
|
||||
|
||||
Do not use uniquifying on your principal class. That one should be named
|
||||
differently for different bundles.
|
||||
*/
|
||||
|
||||
#if wxUSE_OBJC_UNIQUIFYING
|
||||
|
||||
// objc_getClass and stuff
|
||||
#include <objc/objc-runtime.h>
|
||||
|
||||
////////////// Objective-C uniquifying implementation //////////////
|
||||
|
||||
template <typename ObjcType>
|
||||
class wxObjcClassInitializer;
|
||||
|
||||
template <typename ObjcType>
|
||||
class UniquifiedName;
|
||||
|
||||
template <typename ObjcType>
|
||||
class wxObjcCompilerInformation
|
||||
{
|
||||
friend class wxObjcClassInitializer<ObjcType>;
|
||||
friend class UniquifiedName<ObjcType>;
|
||||
private:
|
||||
// GetCompiledClass must be partially specialized for an ObjcType
|
||||
// If you're not using it, implement an inline returning NULL
|
||||
inline static struct objc_class * GetCompiledClass();
|
||||
|
||||
// sm_theClassName must be partially specialized for each type
|
||||
static const char sm_theClassName[];
|
||||
|
||||
// GetSuperclass must be specialized. Typically one of two ways:
|
||||
// 1. objc_getClass("SomeRealClassName")
|
||||
// 2. wxGetObjcClass_SomeWxClassName();
|
||||
inline static struct objc_class *GetSuperclass();
|
||||
};
|
||||
|
||||
|
||||
template <typename ObjcType>
|
||||
struct UniquifiedName
|
||||
{
|
||||
// We're going for OriginalClassName@ClassStructureAddress
|
||||
// Therefore our size is the sizeof the original class name constant string (which includes the terminating NULL)
|
||||
// plus the sizeof a pointer to struct objc_class times two (two hex digits for each byte) plus 3 for "@0x"
|
||||
typedef char Type[sizeof(wxObjcCompilerInformation<ObjcType>::sm_theClassName) + (sizeof(struct objc_class*)<<1) + 3];
|
||||
static void Init(Type m_theString, const objc_class *aClass)
|
||||
{
|
||||
snprintf(const_cast<char*>(m_theString), sizeof(Type), "%s@%p", wxObjcCompilerInformation<ObjcType>::sm_theClassName, aClass);
|
||||
}
|
||||
};
|
||||
|
||||
/*! @function HidePointerFromGC
|
||||
@abstract Returns an l-value whose location the compiler cannot know.
|
||||
@discussion
|
||||
The compiler-generated Objective-C class structures are located in the static data area.
|
||||
They are by design Objective-C objects in their own right which makes the compiler issue
|
||||
write barriers as if they were located in the GC-managed heap as most Objective-C objects.
|
||||
|
||||
By accepting and returning a reference to any pointer type we can set any i-var of an
|
||||
Objective-C object that is a pointer to another Objective-C object without the compiler
|
||||
generating an objc_assign_ivar write barrier. It will instad generate an
|
||||
objc_assign_strongCast write barrier which is the appropriate write-barrier when assigning
|
||||
pointers to Objective-C objects located in unknown memory.
|
||||
|
||||
For instance:
|
||||
Class *someClass = ...;
|
||||
HidePointerFromGC(someClass->isa) = ...;
|
||||
*/
|
||||
template <typename ObjcType>
|
||||
inline ObjcType * & HidePointerFromGC(ObjcType * &p) __attribute__((always_inline));
|
||||
|
||||
template <typename ObjcType>
|
||||
inline ObjcType * & HidePointerFromGC(ObjcType * &p)
|
||||
{
|
||||
return p;
|
||||
}
|
||||
|
||||
template <typename ObjcType>
|
||||
class wxObjcClassInitializer
|
||||
{
|
||||
public:
|
||||
static struct objc_class* Get()
|
||||
{
|
||||
static wxObjcClassInitializer<ObjcType> s_theInstance;
|
||||
s_theInstance.noop(); // Make the compiler think we need this instance
|
||||
return wxObjcCompilerInformation<ObjcType>::GetCompiledClass();
|
||||
}
|
||||
private:
|
||||
void noop()
|
||||
{}
|
||||
// This "constructor" operates solely on static data
|
||||
// It exists so that we can take advantage of a function-static
|
||||
// "instance" of this class to do the static data initialization.
|
||||
wxObjcClassInitializer()
|
||||
{
|
||||
// Objective-C class initialization occurs before C++ static initialization because the
|
||||
// libobjc.dylib gets notified directly by dyld on Tiger.
|
||||
// Therefore, even though we change the name, the class is still registered with the
|
||||
// original name. We unfortunately can't change that.
|
||||
|
||||
// The first time the class is loaded, Objective-C will already have fixed up the super_class
|
||||
// and isa->isa and isa->super_class variables so much of this won't do anything. But
|
||||
// the next time the class is loaded, Objective-C will ignore it and thus we need to
|
||||
// initialize the data structures appropriately.
|
||||
|
||||
// Ideally we'd have some sort of lock here, but we depend on the fact that we get called
|
||||
// just before the first time someone wants to send a class message so it should be
|
||||
// reasonably safe to do this without any locks.
|
||||
|
||||
struct objc_class &theClassData = *wxObjcCompilerInformation<ObjcType>::GetCompiledClass();
|
||||
// Initialize the uniquified class name
|
||||
UniquifiedName<ObjcType>::Init(sm_theUniquifiedClassName, &theClassData);
|
||||
|
||||
//////// Class Initialization ////////
|
||||
// Use objc_getClass to fix up the superclass pointer
|
||||
theClassData.super_class = wxObjcCompilerInformation<ObjcType>::GetSuperclass();
|
||||
// Fix up the compiler generated class struct to use the new name
|
||||
theClassData.name = sm_theUniquifiedClassName;
|
||||
|
||||
//////// Meta-Class Initialization ////////
|
||||
// theClassData.isa is the metaclass pointer
|
||||
// Globals on Darwin use PC-relative access (slow) so it's quicker to use theClassData.isa
|
||||
|
||||
// In any object hierarchy a metaclass's metaclass is always the root class's metaclass
|
||||
// Therefore, our superclass's metaclass's metaclass should already be the root class's metaclass
|
||||
HidePointerFromGC(theClassData.isa->isa) = theClassData.super_class->isa->isa;
|
||||
// A metaclass's superclass is always the superclass's metaclass.
|
||||
HidePointerFromGC(theClassData.isa->super_class) = theClassData.super_class->isa;
|
||||
// Fix up the compiler generated metaclass struct to use the new name
|
||||
theClassData.isa->name = sm_theUniquifiedClassName;
|
||||
|
||||
// We need to set the initialized flag because after we change the name, Objective-C can't
|
||||
// look us up by name because we're only registered with the original name.
|
||||
theClassData.isa->info |= CLS_INITIALIZED;
|
||||
}
|
||||
wxObjcClassInitializer(const wxObjcClassInitializer&); // NO COPY
|
||||
wxObjcClassInitializer& operator =(const wxObjcClassInitializer&); // NO ASSIGN
|
||||
static typename UniquifiedName<ObjcType>::Type sm_theUniquifiedClassName;
|
||||
};
|
||||
|
||||
template<typename ObjcType>
|
||||
typename UniquifiedName<ObjcType>::Type wxObjcClassInitializer<ObjcType>::sm_theUniquifiedClassName;
|
||||
|
||||
// WX_DECLARE_GET_OBJC_CLASS
|
||||
// Declares a function to get a direct pointer to an objective-C class.
|
||||
// The class is guaranteed to be usable.
|
||||
// When wxCocoa is built into a Mach-O bundle this function allows the wxCocoa
|
||||
// code to get a reference to the Objective-C class structure located in the
|
||||
// same bundle. This allows a static wxCocoa library to be built into
|
||||
// two different Mach-O bundles without having one bundle's Objective-C
|
||||
// classes trample on the other's.
|
||||
// Right now we toss the ObjcSuperClass parameter, but we might use it later.
|
||||
#define WX_DECLARE_GET_OBJC_CLASS(ObjcClass,ObjcSuperClass) \
|
||||
struct objc_class* wx_GetObjcClass_ ## ObjcClass();
|
||||
|
||||
// WX_IMPLEMENT_OBJC_GET_COMPILED_CLASS(ObjcClass)
|
||||
// Provides an architecture-dependent way to get the direct pointer to the
|
||||
// objc_class structure in the __OBJC segment.
|
||||
// This takes advantage of the fact that the Objective-C compiler uses guessable
|
||||
// local assembler labels for the class structures.
|
||||
// Those class structures are only available on the Objective-C file containing the
|
||||
// @implementation block.
|
||||
|
||||
#if 1
|
||||
// Generic implementation - Tested on i386 and PPC. Should work in all cases.
|
||||
// This is a hack that depends on GCC asm symbol names.
|
||||
// The static variable winds up being initialized with a direct reference to the appropriate
|
||||
// L_OBJC_CLASS and no global symbol reference is generated because nothing uses the global symbol
|
||||
// except for the static initializer which does it directly.
|
||||
// The generated assembler for s_objc_class_ptr is basically like this:
|
||||
// _s_objc_class_ptr_ObjcClass:
|
||||
// .long L_OBJC_CLASS_ObjcClass
|
||||
// Once that static symbol is defined, the function implementation is easy for GCC to generate.
|
||||
// Do note that return &s_objc_class_data_ObjcClass won't work. The code is wrong in this case.
|
||||
#define WX_IMPLEMENT_OBJC_GET_COMPILED_CLASS(ObjcClass) \
|
||||
extern "C" objc_class s_objc_class_data_ ## ObjcClass asm("L_OBJC_CLASS_" #ObjcClass); \
|
||||
static objc_class * s_objc_class_ptr_ ## ObjcClass = &s_objc_class_data_ ## ObjcClass; \
|
||||
template<> \
|
||||
inline objc_class * wxObjcCompilerInformation<ObjcClass>::GetCompiledClass() \
|
||||
{ \
|
||||
return s_objc_class_ptr_## ObjcClass; \
|
||||
}
|
||||
|
||||
#elif defined(__i386__)
|
||||
// Not used because the generic implementation seems to work fine.
|
||||
// But this is here since it was written beforehand and it also works.
|
||||
|
||||
// This is based on the code GCC generates for accessing file-static data on i386.
|
||||
// The i386 PC-relative addressing happens in this manner
|
||||
// 1. The program counter is placed into ecx using the code that GCC should have
|
||||
// already generated.
|
||||
// 2. A label is placed directly after the call to get the program counter.
|
||||
// 3. The Load Effective Address instruction is used to add the offset of the
|
||||
// local assembler label we're interested in minus the local assembler label
|
||||
// from step 2 to the program counter register in ecx and place the result
|
||||
// into the result register (typically eax if not inlined).
|
||||
#define WX_IMPLEMENT_OBJC_GET_COMPILED_CLASS(ObjcClass) \
|
||||
template<> \
|
||||
inline objc_class * wxObjcCompilerInformation<ObjcClass>::GetCompiledClass() \
|
||||
{ \
|
||||
register struct objc_class *retval; \
|
||||
asm \
|
||||
( "call ___i686.get_pc_thunk.cx\n" \
|
||||
"\"LPC_FOR_GET_CLASS_" #ObjcClass "\":\n\t" \
|
||||
"leal L_OBJC_CLASS_" #ObjcClass "-\"LPC_FOR_GET_CLASS_" #ObjcClass "\"(%%ecx), %0" \
|
||||
: "=r"(retval) \
|
||||
: \
|
||||
: "ecx" \
|
||||
); \
|
||||
return retval; \
|
||||
}
|
||||
|
||||
#elif defined(__ppc__)
|
||||
// Not used because the generic implementation seems to work fine.
|
||||
// But this is here since it was written beforehand and it also works.
|
||||
|
||||
// This is based on the code GCC generates for accessing file-static data on PPC.
|
||||
// The PowerPC PC-relative addressing happens in this manner
|
||||
// 1. The link register is saved (mflr) to a temporary (we re-use the output register for this)
|
||||
// 2. An unconditional branch instruction (bcl) "branches" to the following address (labeled)
|
||||
// 3. The link register (filled in by bcl) is saved to r10 (a temporary)
|
||||
// 4. The previous link register is restored (mtlr) (from the output register we were using as a temporary)
|
||||
// 5. The address of the LPC label as executed is added to the high 16 bits of the offset between that label and the static data we want
|
||||
// and stored in a temporary register (r2)
|
||||
// 6. That temporary register plus the low 16 bits of the offset are stored into the result register.
|
||||
#define WX_IMPLEMENT_OBJC_GET_COMPILED_CLASS(ObjcClass) \
|
||||
template<> \
|
||||
inline objc_class * wxObjcCompilerInformation<ObjcClass>::GetCompiledClass() \
|
||||
{ \
|
||||
register struct objc_class *retval; \
|
||||
asm \
|
||||
( "mflr %0" \
|
||||
"\n\tbcl 20, 31, \"LPC_FOR_GET_CLASS_" #ObjcClass "\"" \
|
||||
"\n\"LPC_FOR_GET_CLASS_" #ObjcClass "\":" \
|
||||
"\n\tmflr r10" \
|
||||
"\n\tmtlr %0" \
|
||||
"\n\taddis r2,r10,ha16(L_OBJC_CLASS_" #ObjcClass "-\"LPC_FOR_GET_CLASS_" #ObjcClass "\")" \
|
||||
"\n\tla %0,lo16(L_OBJC_CLASS_" #ObjcClass "-\"LPC_FOR_GET_CLASS_" #ObjcClass "\")(r2)" \
|
||||
: "=r" (retval) \
|
||||
: \
|
||||
: "r10","r2" \
|
||||
); \
|
||||
return retval; \
|
||||
}
|
||||
|
||||
// TODO: __x86_64__, __ppc64__
|
||||
#else // Can't write inline asm to bust into __OBJC segment
|
||||
// This won't be used since the generic implementation takes precedence.
|
||||
|
||||
#warning "Don't know how to implement wxObjcCompilerInformation<ObjcClass>::GetCompiledClass on this platform"
|
||||
|
||||
#endif // platforms
|
||||
|
||||
// The WX_IMPLEMENT_OBJC_GET_SUPERCLASS macro implements the template specialization
|
||||
// to get the superclass. This only works if it's a real superclass. If you are
|
||||
// deriving from a class that's already being uniquified then you'd need to
|
||||
// implement the specialization to call the appropriate get method instead.
|
||||
#define WX_IMPLEMENT_OBJC_GET_SUPERCLASS(ObjcClass,ObjcSuperClass) \
|
||||
template <> \
|
||||
inline objc_class* wxObjcCompilerInformation<ObjcClass>::GetSuperclass() \
|
||||
{ \
|
||||
return objc_getClass(#ObjcSuperClass); \
|
||||
}
|
||||
|
||||
// The WX_IMPLEMENT_OBJC_GET_UNIQUIFIED_SUPERCLASS macro implements the template
|
||||
// specialization to get the superclass when the superclass is another uniquified
|
||||
// Objective-C class.
|
||||
#define WX_IMPLEMENT_OBJC_GET_UNIQUIFIED_SUPERCLASS(ObjcClass,ObjcSuperClass) \
|
||||
template <> \
|
||||
inline objc_class* wxObjcCompilerInformation<ObjcClass>::GetSuperclass() \
|
||||
{ \
|
||||
return wx_GetObjcClass_ ## ObjcSuperClass(); \
|
||||
}
|
||||
|
||||
// The WX_IMPLEMENT_OBJC_CLASS_NAME macro implements the template specialization
|
||||
// of the sm_theClassName constant. As soon as this specialization is in place
|
||||
// sizeof(sm_theClassName) will return the number of bytes at compile time.
|
||||
#define WX_IMPLEMENT_OBJC_CLASS_NAME(ObjcClass) \
|
||||
template <> \
|
||||
const char wxObjcCompilerInformation<ObjcClass>::sm_theClassName[] = #ObjcClass;
|
||||
|
||||
// The WX_IMPLEMENT_OBJC_GET_OBJC_CLASS macro is the final one that actually provides
|
||||
// the wx_GetObjcClass_XXX function that will be called in lieu of asking the Objective-C
|
||||
// runtime for the class. All the others are really machinery to make this happen.
|
||||
#define WX_IMPLEMENT_OBJC_GET_OBJC_CLASS(ObjcClass) \
|
||||
objc_class* wx_GetObjcClass_ ## ObjcClass() \
|
||||
{ \
|
||||
return wxObjcClassInitializer<ObjcClass>::Get(); \
|
||||
}
|
||||
|
||||
// The WX_IMPLEMENT_GET_OBJC_CLASS macro combines all of these together
|
||||
// for the case when the superclass is a non-uniquified class.
|
||||
#define WX_IMPLEMENT_GET_OBJC_CLASS(ObjcClass,ObjcSuperClass) \
|
||||
WX_IMPLEMENT_OBJC_GET_COMPILED_CLASS(ObjcClass) \
|
||||
WX_IMPLEMENT_OBJC_GET_SUPERCLASS(ObjcClass,ObjcSuperClass) \
|
||||
WX_IMPLEMENT_OBJC_CLASS_NAME(ObjcClass) \
|
||||
WX_IMPLEMENT_OBJC_GET_OBJC_CLASS(ObjcClass)
|
||||
|
||||
// The WX_IMPLEMENT_GET_OBJC_CLASS_WITH_UNIQUIFIED_SUPERCLASS macro combines all
|
||||
// of these together for the case when the superclass is another uniquified class.
|
||||
#define WX_IMPLEMENT_GET_OBJC_CLASS_WITH_UNIQUIFIED_SUPERCLASS(ObjcClass,ObjcSuperClass) \
|
||||
WX_IMPLEMENT_OBJC_GET_COMPILED_CLASS(ObjcClass) \
|
||||
WX_IMPLEMENT_OBJC_GET_UNIQUIFIED_SUPERCLASS(ObjcClass,ObjcSuperClass) \
|
||||
WX_IMPLEMENT_OBJC_CLASS_NAME(ObjcClass) \
|
||||
WX_IMPLEMENT_OBJC_GET_OBJC_CLASS(ObjcClass)
|
||||
|
||||
// The WX_GET_OBJC_CLASS macro is intended to wrap the class name when the class
|
||||
// is used as a message receiver (e.g. for calling class methods). When
|
||||
// class name uniquifying is used, this calls the global function implemented
|
||||
// in the Objective-C file containing the class @implementation.
|
||||
#define WX_GET_OBJC_CLASS(ObjcClass) wx_GetObjcClass_ ## ObjcClass()
|
||||
|
||||
#else // wxUSE_OBJC_UNIQUIFYING
|
||||
|
||||
// Define WX_DECLARE_GET_OBJC_CLASS as nothing
|
||||
#define WX_DECLARE_GET_OBJC_CLASS(ObjcClass,ObjcSuperClass)
|
||||
// Define WX_IMPLEMENT_GET_OBJC_CLASS as nothing
|
||||
#define WX_IMPLEMENT_GET_OBJC_CLASS(ObjcClass,ObjcSuperClass)
|
||||
// Define WX_IMPLEMENT_GET_OBJC_CLASS_WITH_UNIQUIFIED_SUPERCLASS as nothing
|
||||
#define WX_IMPLEMENT_GET_OBJC_CLASS_WITH_UNIQUIFIED_SUPERCLASS(ObjcClass,ObjcSuperClass)
|
||||
|
||||
// Define WX_GET_OBJC_CLASS macro to output the class name and let the compiler do the normal thing
|
||||
// The WX_GET_OBJC_CLASS macro is intended to wrap the class name when the class
|
||||
// is used as a message receiver (e.g. for calling class methods). When
|
||||
// class name uniquifying is not used, this is simply defined to be the class
|
||||
// name which will allow the compiler to do the normal thing.
|
||||
#define WX_GET_OBJC_CLASS(ObjcClass) ObjcClass
|
||||
|
||||
#endif // wxUSE_OBJC_UNIQUIFYING
|
||||
|
||||
#endif //ndef __WX_COCOA_OBJC_CLASS_H__
|
@@ -1,71 +0,0 @@
|
||||
/////////////////////////////////////////////////////////////////////////////
|
||||
// Name: wx/cocoa/pen.h
|
||||
// Purpose: wxPen class
|
||||
// Author: David Elliott
|
||||
// Modified by:
|
||||
// Created: 2003/08/02 (stubs from 22.03.2003)
|
||||
// Copyright: (c) 2003 David Elliott
|
||||
// Licence: wxWindows licence
|
||||
/////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
#ifndef __WX_COCOA_PEN_H__
|
||||
#define __WX_COCOA_PEN_H__
|
||||
|
||||
#include "wx/gdiobj.h"
|
||||
#include "wx/gdicmn.h"
|
||||
|
||||
class WXDLLIMPEXP_FWD_CORE wxColour;
|
||||
class WXDLLIMPEXP_FWD_CORE wxBitmap;
|
||||
|
||||
// ========================================================================
|
||||
// wxPen
|
||||
// ========================================================================
|
||||
class WXDLLIMPEXP_CORE wxPen: public wxGDIObject
|
||||
{
|
||||
public:
|
||||
wxPen();
|
||||
wxPen(const wxColour& col, int width = 1, wxPenStyle style = wxPENSTYLE_SOLID);
|
||||
wxPen(const wxBitmap& stipple, int width);
|
||||
virtual ~wxPen();
|
||||
|
||||
// FIXME: operator==() is wrong
|
||||
bool operator==(const wxPen& pen) const { return m_refData == pen.m_refData; }
|
||||
bool operator!=(const wxPen& pen) const { return !(*this == pen); }
|
||||
|
||||
void SetColour(const wxColour& col) ;
|
||||
void SetColour(unsigned char r, unsigned char g, unsigned char b) ;
|
||||
|
||||
void SetWidth(int width);
|
||||
void SetStyle(wxPenStyle style);
|
||||
void SetStipple(const wxBitmap& stipple);
|
||||
void SetDashes(int nb_dashes, const wxDash *dash);
|
||||
void SetJoin(wxPenJoin join);
|
||||
void SetCap(wxPenCap cap);
|
||||
|
||||
wxColour GetColour() const;
|
||||
int GetWidth() const;
|
||||
wxPenStyle GetStyle() const;
|
||||
wxPenJoin GetJoin() const;
|
||||
wxPenCap GetCap() const;
|
||||
int GetDashes(wxDash **ptr) const;
|
||||
wxBitmap *GetStipple() const;
|
||||
|
||||
|
||||
wxDEPRECATED_MSG("use wxPENSTYLE_XXX constants")
|
||||
wxPen(const wxColour& col, int width, int style);
|
||||
|
||||
wxDEPRECATED_MSG("use wxPENSTYLE_XXX constants")
|
||||
void SetStyle(int style) { SetStyle((wxPenStyle)style); }
|
||||
|
||||
// Cocoa-specific
|
||||
WX_NSColor GetNSColor();
|
||||
int GetCocoaLineDash(const CGFloat **pattern);
|
||||
|
||||
protected:
|
||||
wxGDIRefData *CreateGDIRefData() const;
|
||||
wxGDIRefData *CloneGDIRefData(const wxGDIRefData *data) const;
|
||||
|
||||
DECLARE_DYNAMIC_CLASS(wxPen)
|
||||
};
|
||||
|
||||
#endif // __WX_COCOA_PEN_H__
|
@@ -1,27 +0,0 @@
|
||||
/////////////////////////////////////////////////////////////////////////////
|
||||
// Name: wx/cocoa/private/fontfactory.h
|
||||
// Purpose: wxFontFactory class
|
||||
// Author: David Elliott
|
||||
// Modified by:
|
||||
// Created: 2007-10-13
|
||||
// Copyright: 2007 David Elliott
|
||||
// Licence: wxWindows licence
|
||||
/////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
#ifndef _WX_COCOA_FONTFACTORY_H_
|
||||
#define _WX_COCOA_FONTFACTORY_H_
|
||||
|
||||
/*! @discussion
|
||||
This class exists so that wxFont need not know about wxSettings
|
||||
The implementation, however, is in the font.mm file because the
|
||||
implementation needs to have knowledge of wxFontRefData.
|
||||
*/
|
||||
class wxCocoaFontFactory
|
||||
{
|
||||
public:
|
||||
/*! @abstract Create an instance with the specified NSFont and underline flag.
|
||||
*/
|
||||
static wxFont InstanceForNSFont(WX_NSFont cocoaFont, bool underlined = false);
|
||||
};
|
||||
|
||||
#endif //_WX_COCOA_FONTFACTORY_H_
|
@@ -1,128 +0,0 @@
|
||||
/////////////////////////////////////////////////////////////////////////////
|
||||
// Name: wx/cocoa/private/scrollview.h
|
||||
// Purpose: wxWindowCocoaScrollView
|
||||
// Author: David Elliott
|
||||
// Modified by:
|
||||
// Created: 2008/02/14
|
||||
// Copyright: (c) 2003- David Elliott
|
||||
// Licence: wxWindows licence
|
||||
/////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
#ifndef _WX_COCOA_SCROLLVIEW_H__
|
||||
#define _WX_COCOA_SCROLLVIEW_H__
|
||||
|
||||
@class NSScroller;
|
||||
|
||||
// ========================================================================
|
||||
// wxWindowCocoaScrollView
|
||||
// ========================================================================
|
||||
class wxWindowCocoaScrollView: protected wxCocoaNSView
|
||||
{
|
||||
wxDECLARE_NO_COPY_CLASS(wxWindowCocoaScrollView);
|
||||
public:
|
||||
wxWindowCocoaScrollView(wxWindow *owner);
|
||||
virtual ~wxWindowCocoaScrollView();
|
||||
inline WX_NSScrollView GetNSScrollView() { return m_cocoaNSScrollView; }
|
||||
void ClientSizeToSize(int &width, int &height);
|
||||
void DoGetClientSize(int *x, int *y) const;
|
||||
void Encapsulate();
|
||||
void Unencapsulate();
|
||||
|
||||
// wxWindow calls this to do the work. Note that we don't have the refresh parameter
|
||||
// because wxWindow handles that itself.
|
||||
void SetScrollbar(int orientation, int position, int thumbSize, int range);
|
||||
int GetScrollPos(wxOrientation orient);
|
||||
void SetScrollPos(wxOrientation orient, int position);
|
||||
int GetScrollRange(wxOrientation orient);
|
||||
int GetScrollThumb(wxOrientation orient);
|
||||
void ScrollWindow(int dx, int dy, const wxRect*);
|
||||
void UpdateSizes();
|
||||
|
||||
void _wx_doScroller(NSScroller *sender);
|
||||
|
||||
protected:
|
||||
wxWindowCocoa *m_owner;
|
||||
WX_NSScrollView m_cocoaNSScrollView;
|
||||
virtual void Cocoa_FrameChanged(void);
|
||||
virtual void Cocoa_synthesizeMouseMoved(void) {}
|
||||
/*!
|
||||
Flag as to whether we're scrolling for a native view or a custom
|
||||
wxWindow. This controls the scrolling behaviour. When providing
|
||||
scrolling for a native view we don't catch scroller action messages
|
||||
and thus don't send scroll events and we don't actually scroll the
|
||||
window when the application calls ScrollWindow.
|
||||
|
||||
When providing scrolling for a custom wxWindow, we make the NSScroller
|
||||
send their action messages to us which we in turn package as wx window
|
||||
scrolling events. At this point, the window will not physically be
|
||||
scrolled. The application will most likely handle the event by calling
|
||||
ScrollWindow which will do the real scrolling. On the other hand,
|
||||
the application may instead not call ScrollWindow until some threshold
|
||||
is reached. This causes the window to only scroll in steps which is
|
||||
what, for instance, wxScrolledWindow does.
|
||||
*/
|
||||
bool m_isNativeView;
|
||||
/*!
|
||||
The range as the application code wishes to see it. That is, the
|
||||
range from the last SetScrollbar call for the appropriate dimension.
|
||||
The horizontal dimension is the first [0] element and the vertical
|
||||
dimension the second [1] element.
|
||||
|
||||
In wxMSW, a SCROLLINFO with nMin=0 and nMax=range-1 is used which
|
||||
gives exactly range possible positions so long as nPage (which is
|
||||
the thumb size) is less than or equal to 1.
|
||||
*/
|
||||
int m_scrollRange[2];
|
||||
/*!
|
||||
The thumb size is intended to reflect the size of the visible portion
|
||||
of the scrolled document. As the document size increases, the thumb
|
||||
visible thumb size decreases. As document size decreases, the visible
|
||||
thumb size increases. However, the thumb size on wx is defined in
|
||||
terms of scroll units (which are effectively defined by the scroll
|
||||
range) and so increasing the number of scroll units to reflect increased
|
||||
document size will have the effect of decreasing the visible thumb
|
||||
size even though the number doesn't change.
|
||||
|
||||
It's also important to note that subtracting the thumb size from the
|
||||
full range gives you the real range that can be used. Microsoft
|
||||
defines nPos (the current scrolling position) to be within the range
|
||||
from nMin to nMax - max(nPage - 1, 0). We know that wxMSW code always
|
||||
sets nMin = 0 and nMax = range -1. So let's algebraically reduce the
|
||||
definition of the maximum allowed position:
|
||||
|
||||
Begin:
|
||||
= nMax - max(nPage - 1, 0)
|
||||
Substitute (range - 1) for nMax and thumbSize for nPage:
|
||||
= range - 1 - max(thumbSize - 1, 0)
|
||||
Add one inside the max conditional and subtract one outside of it:
|
||||
= range - 1 - (max(thumbSize - 1 + 1, 1) - 1)
|
||||
Reduce some constants:
|
||||
= range - 1 - (max(thumbSize, 1) - 1)
|
||||
Distribute the negative across the parenthesis:
|
||||
= range - 1 - max(thumbSize, 1) + 1
|
||||
Reduce the constants:
|
||||
= range - max(thumbSize, 1)
|
||||
|
||||
Also keep in mind that thumbSize may never be greater than range but
|
||||
can be equal to it. Thus for the smallest possible thumbSize there
|
||||
are exactly range possible scroll positions (numbered from 0 to
|
||||
range - 1) and for the largest possible thumbSize there is exactly
|
||||
one possible scroll position (numbered 0).
|
||||
*/
|
||||
int m_scrollThumb[2];
|
||||
|
||||
/*!
|
||||
The origin of the virtual coordinate space expressed in terms of client
|
||||
coordinates. Starts at (0,0) and each call to ScrollWindow accumulates
|
||||
into it. Thus if the user scrolls the window right (thus causing the
|
||||
contents to move left with respect to the client origin, the
|
||||
application code (typically wxScrolledWindow) will be called with
|
||||
dx of -something, for example -20. This is added to m_virtualOrigin
|
||||
and thus m_virtualOrigin will be (-20,0) in this example.
|
||||
*/
|
||||
wxPoint m_virtualOrigin;
|
||||
private:
|
||||
wxWindowCocoaScrollView();
|
||||
};
|
||||
|
||||
#endif //ndef _WX_COCOA_SCROLLVIEW_H__
|
@@ -1,42 +0,0 @@
|
||||
/////////////////////////////////////////////////////////////////////////////
|
||||
// Name: wx/cocoa/private/timer.h
|
||||
// Purpose: Cocoa wxTimer class
|
||||
// Author: Ryan Norton
|
||||
// Copyright: (c) Ryan Norton
|
||||
// Licence: wxWindows licence
|
||||
/////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
#ifndef _WX_COCOA_PRIVATE_TIMER_H_
|
||||
#define _WX_COCOA_PRIVATE_TIMER_H_
|
||||
|
||||
#include "wx/private/timer.h"
|
||||
|
||||
#include "wx/cocoa/ObjcRef.h"
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
// wxTimer
|
||||
//-----------------------------------------------------------------------------
|
||||
|
||||
DECLARE_WXCOCOA_OBJC_CLASS(NSTimer);
|
||||
|
||||
class WXDLLIMPEXP_CORE wxCocoaTimerImpl : public wxTimerImpl
|
||||
{
|
||||
public:
|
||||
wxCocoaTimerImpl(wxTimer* timer) : wxTimerImpl(timer) { Init(); }
|
||||
virtual ~wxCocoaTimerImpl();
|
||||
|
||||
virtual bool Start(int millisecs = -1, bool oneShot = false);
|
||||
virtual void Stop();
|
||||
|
||||
virtual bool IsRunning() const;
|
||||
|
||||
WX_NSTimer GetNSTimer() { return m_cocoaNSTimer; }
|
||||
|
||||
protected:
|
||||
void Init();
|
||||
|
||||
private:
|
||||
WX_NSTimer m_cocoaNSTimer;
|
||||
};
|
||||
|
||||
#endif // _WX_COCOA_PRIVATE_TIMER_H_
|
@@ -1,137 +0,0 @@
|
||||
/////////////////////////////////////////////////////////////////////////////
|
||||
// Name: wx/cocoa/radiobox.h
|
||||
// Purpose: wxRadioBox class
|
||||
// Author: David Elliott
|
||||
// Modified by:
|
||||
// Created: 2003/03/18
|
||||
// Copyright: (c) 2003 David Elliott
|
||||
// Licence: wxWindows licence
|
||||
/////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
#ifndef __WX_COCOA_RADIOBOX_H__
|
||||
#define __WX_COCOA_RADIOBOX_H__
|
||||
|
||||
// #include "wx/cocoa/NSButton.h"
|
||||
DECLARE_WXCOCOA_OBJC_CLASS(NSMatrix);
|
||||
|
||||
// ========================================================================
|
||||
// wxRadioBox
|
||||
// ========================================================================
|
||||
class WXDLLIMPEXP_CORE wxRadioBox: public wxControl, public wxRadioBoxBase// , protected wxCocoaNSButton
|
||||
{
|
||||
DECLARE_DYNAMIC_CLASS(wxRadioBox)
|
||||
DECLARE_EVENT_TABLE()
|
||||
// NOTE: We explicitly skip NSControl because our primary cocoa view is
|
||||
// the NSBox but we want to receive action messages from the NSMatrix.
|
||||
WX_DECLARE_COCOA_OWNER(NSBox,NSView,NSView)
|
||||
// ------------------------------------------------------------------------
|
||||
// initialization
|
||||
// ------------------------------------------------------------------------
|
||||
public:
|
||||
wxRadioBox() { }
|
||||
wxRadioBox(wxWindow *parent, wxWindowID winid,
|
||||
const wxString& title,
|
||||
const wxPoint& pos = wxDefaultPosition,
|
||||
const wxSize& size = wxDefaultSize,
|
||||
int n = 0, const wxString choices[] = NULL,
|
||||
int majorDim = 0,
|
||||
long style = 0, const wxValidator& validator = wxDefaultValidator,
|
||||
const wxString& name = wxRadioBoxNameStr)
|
||||
{
|
||||
Create(parent, winid, title, pos, size, n, choices, majorDim, style, validator, name);
|
||||
}
|
||||
wxRadioBox(wxWindow *parent, wxWindowID winid,
|
||||
const wxString& title,
|
||||
const wxPoint& pos,
|
||||
const wxSize& size,
|
||||
const wxArrayString& choices,
|
||||
int majorDim = 0,
|
||||
long style = 0, const wxValidator& validator = wxDefaultValidator,
|
||||
const wxString& name = wxRadioBoxNameStr)
|
||||
{
|
||||
Create(parent, winid, title, pos, size, choices, majorDim, style, validator, name);
|
||||
}
|
||||
|
||||
bool Create(wxWindow *parent, wxWindowID winid,
|
||||
const wxString& title,
|
||||
const wxPoint& pos = wxDefaultPosition,
|
||||
const wxSize& size = wxDefaultSize,
|
||||
int n = 0, const wxString choices[] = NULL,
|
||||
int majorDim = 0,
|
||||
long style = 0,
|
||||
const wxValidator& validator = wxDefaultValidator,
|
||||
const wxString& name = wxRadioBoxNameStr);
|
||||
bool Create(wxWindow *parent, wxWindowID winid,
|
||||
const wxString& title,
|
||||
const wxPoint& pos,
|
||||
const wxSize& size,
|
||||
const wxArrayString& choices,
|
||||
int majorDim = 0,
|
||||
long style = 0,
|
||||
const wxValidator& validator = wxDefaultValidator,
|
||||
const wxString& name = wxRadioBoxNameStr);
|
||||
virtual ~wxRadioBox();
|
||||
|
||||
// Enabling
|
||||
virtual bool Enable(unsigned int n, bool enable = true);
|
||||
virtual bool IsItemEnabled(unsigned int WXUNUSED(n)) const
|
||||
{
|
||||
/* TODO */
|
||||
return true;
|
||||
}
|
||||
|
||||
// Showing
|
||||
virtual bool Show(unsigned int n, bool show = true);
|
||||
virtual bool IsItemShown(unsigned int WXUNUSED(n)) const
|
||||
{
|
||||
/* TODO */
|
||||
return true;
|
||||
}
|
||||
|
||||
// ------------------------------------------------------------------------
|
||||
// Cocoa callbacks
|
||||
// ------------------------------------------------------------------------
|
||||
protected:
|
||||
// Radio boxes cannot be enabled/disabled
|
||||
virtual void CocoaSetEnabled(bool WXUNUSED(enable)) { }
|
||||
virtual void CocoaTarget_action(void);
|
||||
// ------------------------------------------------------------------------
|
||||
// Implementation
|
||||
// ------------------------------------------------------------------------
|
||||
public:
|
||||
// Pure virtuals
|
||||
// selection
|
||||
virtual void SetSelection(int n);
|
||||
virtual int GetSelection() const;
|
||||
// string access
|
||||
virtual unsigned int GetCount() const;
|
||||
virtual wxString GetString(unsigned int n) const;
|
||||
virtual void SetString(unsigned int n, const wxString& label);
|
||||
// change the individual radio button state
|
||||
protected:
|
||||
// We don't want the typical wxCocoaNSBox behaviour because our real
|
||||
// implementation is by using an NSMatrix as the NSBox's contentView.
|
||||
WX_NSMatrix GetNSMatrix() const;
|
||||
void AssociateNSBox(WX_NSBox theBox);
|
||||
void DisassociateNSBox(WX_NSBox theBox);
|
||||
|
||||
virtual wxSize DoGetBestSize() const;
|
||||
|
||||
int GetRowForIndex(int n) const
|
||||
{
|
||||
if(m_windowStyle & wxRA_SPECIFY_COLS)
|
||||
return n / GetMajorDim();
|
||||
else
|
||||
return n % GetMajorDim();
|
||||
}
|
||||
|
||||
int GetColumnForIndex(int n) const
|
||||
{
|
||||
if(m_windowStyle & wxRA_SPECIFY_COLS)
|
||||
return n % GetMajorDim();
|
||||
else
|
||||
return n / GetMajorDim();
|
||||
}
|
||||
};
|
||||
|
||||
#endif // __WX_COCOA_RADIOBOX_H__
|
@@ -1,73 +0,0 @@
|
||||
/////////////////////////////////////////////////////////////////////////////
|
||||
// Name: wx/cocoa/radiobut.h
|
||||
// Purpose: wxRadioButton class
|
||||
// Author: David Elliott
|
||||
// Modified by:
|
||||
// Created: 2003/03/18
|
||||
// Copyright: (c) 2003 David Elliott
|
||||
// Licence: wxWindows licence
|
||||
/////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
#ifndef __WX_COCOA_RADIOBUT_H__
|
||||
#define __WX_COCOA_RADIOBUT_H__
|
||||
|
||||
#include "wx/cocoa/NSButton.h"
|
||||
|
||||
class WXDLLIMPEXP_FWD_CORE wxRadioButton;
|
||||
|
||||
WX_DECLARE_EXPORTED_LIST(wxRadioButton, wxRadioButtonList);
|
||||
|
||||
// ========================================================================
|
||||
// wxRadioButton
|
||||
// ========================================================================
|
||||
class WXDLLIMPEXP_CORE wxRadioButton: public wxControl, protected wxCocoaNSButton
|
||||
{
|
||||
DECLARE_DYNAMIC_CLASS(wxRadioButton)
|
||||
DECLARE_EVENT_TABLE()
|
||||
WX_DECLARE_COCOA_OWNER(NSButton,NSControl,NSView)
|
||||
// ------------------------------------------------------------------------
|
||||
// initialization
|
||||
// ------------------------------------------------------------------------
|
||||
public:
|
||||
wxRadioButton() { m_radioMaster = NULL; }
|
||||
wxRadioButton(wxWindow *parent, wxWindowID winid,
|
||||
const wxString& label,
|
||||
const wxPoint& pos = wxDefaultPosition,
|
||||
const wxSize& size = wxDefaultSize,
|
||||
long style = 0,
|
||||
const wxValidator& validator = wxDefaultValidator,
|
||||
const wxString& name = wxRadioButtonNameStr)
|
||||
{
|
||||
Create(parent, winid, label, pos, size, style, validator, name);
|
||||
}
|
||||
|
||||
bool Create(wxWindow *parent, wxWindowID winid,
|
||||
const wxString& label,
|
||||
const wxPoint& pos = wxDefaultPosition,
|
||||
const wxSize& size = wxDefaultSize,
|
||||
long style = 0,
|
||||
const wxValidator& validator = wxDefaultValidator,
|
||||
const wxString& name = wxRadioButtonNameStr);
|
||||
virtual ~wxRadioButton();
|
||||
|
||||
// ------------------------------------------------------------------------
|
||||
// Cocoa callbacks
|
||||
// ------------------------------------------------------------------------
|
||||
protected:
|
||||
virtual void Cocoa_wxNSButtonAction(void);
|
||||
private:
|
||||
void Cocoa_DeselectOtherButtonsInTheGroup(void);
|
||||
// ------------------------------------------------------------------------
|
||||
// Implementation
|
||||
// ------------------------------------------------------------------------
|
||||
public:
|
||||
virtual void SetValue(bool);
|
||||
virtual bool GetValue() const;
|
||||
virtual void SetLabel(const wxString& label);
|
||||
virtual wxString GetLabel() const;
|
||||
protected:
|
||||
wxRadioButtonList m_radioSlaves;
|
||||
wxRadioButton *m_radioMaster;
|
||||
};
|
||||
|
||||
#endif // __WX_COCOA_RADIOBUT_H__
|
@@ -1,75 +0,0 @@
|
||||
/////////////////////////////////////////////////////////////////////////////
|
||||
// Name: wx/cocoa/region.h
|
||||
// Purpose: wxRegion class
|
||||
// Author: David Elliott
|
||||
// Modified by:
|
||||
// Created: 2004/04/12
|
||||
// Copyright: (c) 2004 David Elliott
|
||||
// Licence: wxWindows licence
|
||||
/////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
#ifndef _WX_COCOA_REGION_H__
|
||||
#define _WX_COCOA_REGION_H__
|
||||
|
||||
#include "wx/generic/region.h"
|
||||
|
||||
#if defined(__LP64__) || defined(NS_BUILD_32_LIKE_64)
|
||||
typedef struct CGRect NSRect;
|
||||
#else
|
||||
typedef struct _NSRect NSRect;
|
||||
#endif
|
||||
|
||||
class WXDLLIMPEXP_CORE wxRegion : public wxRegionGeneric
|
||||
{
|
||||
public:
|
||||
wxRegion(wxCoord x, wxCoord y, wxCoord w, wxCoord h)
|
||||
: wxRegionGeneric(x,y,w,h)
|
||||
{}
|
||||
wxRegion(const wxPoint& topLeft, const wxPoint& bottomRight)
|
||||
: wxRegionGeneric(topLeft, bottomRight)
|
||||
{}
|
||||
wxRegion(const wxRect& rect)
|
||||
: wxRegionGeneric(rect)
|
||||
{}
|
||||
wxRegion() {}
|
||||
wxRegion(const wxBitmap& bmp)
|
||||
: wxRegionGeneric()
|
||||
{ Union(bmp); }
|
||||
wxRegion(const wxBitmap& bmp,
|
||||
const wxColour& transColour, int tolerance = 0)
|
||||
: wxRegionGeneric()
|
||||
{ Union(bmp, transColour, tolerance); }
|
||||
virtual ~wxRegion() {}
|
||||
wxRegion(const wxRegion& r)
|
||||
: wxRegionGeneric(r)
|
||||
{}
|
||||
wxRegion& operator= (const wxRegion& r)
|
||||
{ return *(wxRegion*)&(this->wxRegionGeneric::operator=(r)); }
|
||||
|
||||
// Cocoa-specific creation
|
||||
wxRegion(const NSRect& rect);
|
||||
wxRegion(const NSRect *rects, int count);
|
||||
|
||||
private:
|
||||
DECLARE_DYNAMIC_CLASS(wxRegion);
|
||||
};
|
||||
|
||||
class WXDLLIMPEXP_CORE wxRegionIterator : public wxRegionIteratorGeneric
|
||||
{
|
||||
// DECLARE_DYNAMIC_CLASS(wxRegionIteratorGeneric);
|
||||
public:
|
||||
wxRegionIterator() {}
|
||||
wxRegionIterator(const wxRegion& region)
|
||||
: wxRegionIteratorGeneric(region)
|
||||
{}
|
||||
wxRegionIterator(const wxRegionIterator& iterator)
|
||||
: wxRegionIteratorGeneric(iterator)
|
||||
{}
|
||||
virtual ~wxRegionIterator() {}
|
||||
|
||||
wxRegionIterator& operator=(const wxRegionIterator& iter)
|
||||
{ return *(wxRegionIterator*)&(this->wxRegionIteratorGeneric::operator=(iter)); }
|
||||
};
|
||||
|
||||
#endif
|
||||
//ndef _WX_COCOA_REGION_H__
|
@@ -1,74 +0,0 @@
|
||||
/////////////////////////////////////////////////////////////////////////////
|
||||
// Name: wx/cocoa/scrolbar.h
|
||||
// Purpose: wxScrollBar class
|
||||
// Author: David Elliott
|
||||
// Modified by:
|
||||
// Created: 2004/04/25
|
||||
// Copyright: (c) 2004 David Elliott
|
||||
// Licence: wxWindows licence
|
||||
/////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
#ifndef _WX_COCOA_SCROLBAR_H__
|
||||
#define _WX_COCOA_SCROLBAR_H__
|
||||
|
||||
#include "wx/cocoa/NSScroller.h"
|
||||
|
||||
// ========================================================================
|
||||
// wxScrollBar
|
||||
// ========================================================================
|
||||
class WXDLLIMPEXP_CORE wxScrollBar: public wxScrollBarBase, protected wxCocoaNSScroller
|
||||
{
|
||||
DECLARE_DYNAMIC_CLASS(wxScrollBar)
|
||||
DECLARE_EVENT_TABLE()
|
||||
WX_DECLARE_COCOA_OWNER(NSScroller,NSControl,NSView)
|
||||
// ------------------------------------------------------------------------
|
||||
// initialization
|
||||
// ------------------------------------------------------------------------
|
||||
public:
|
||||
wxScrollBar() { }
|
||||
wxScrollBar(wxWindow *parent, wxWindowID winid,
|
||||
const wxPoint& pos = wxDefaultPosition,
|
||||
const wxSize& size = wxDefaultSize,
|
||||
long style = wxSB_HORIZONTAL,
|
||||
const wxValidator& validator = wxDefaultValidator,
|
||||
const wxString& name = wxScrollBarNameStr)
|
||||
{
|
||||
Create(parent, winid, pos, size, style, validator, name);
|
||||
}
|
||||
|
||||
bool Create(wxWindow *parent, wxWindowID winid,
|
||||
const wxPoint& pos = wxDefaultPosition,
|
||||
const wxSize& size = wxDefaultSize,
|
||||
long style = wxSB_HORIZONTAL,
|
||||
const wxValidator& validator = wxDefaultValidator,
|
||||
const wxString& name = wxScrollBarNameStr);
|
||||
virtual ~wxScrollBar();
|
||||
|
||||
// ------------------------------------------------------------------------
|
||||
// Cocoa callbacks
|
||||
// ------------------------------------------------------------------------
|
||||
protected:
|
||||
virtual void Cocoa_wxNSScrollerAction(void);
|
||||
// ------------------------------------------------------------------------
|
||||
// Implementation
|
||||
// ------------------------------------------------------------------------
|
||||
public:
|
||||
// accessors
|
||||
virtual int GetThumbPosition() const;
|
||||
virtual int GetThumbSize() const { return m_thumbSize; }
|
||||
virtual int GetPageSize() const { return m_pageSize; }
|
||||
virtual int GetRange() const { return m_range; }
|
||||
|
||||
// operations
|
||||
virtual void SetThumbPosition(int viewStart);
|
||||
virtual void SetScrollbar(int position, int thumbSize,
|
||||
int range, int pageSize,
|
||||
bool refresh = TRUE);
|
||||
protected:
|
||||
int m_range;
|
||||
int m_thumbSize;
|
||||
int m_pageSize;
|
||||
};
|
||||
|
||||
#endif
|
||||
// _WX_COCOA_SCROLBAR_H__
|
@@ -1,107 +0,0 @@
|
||||
/////////////////////////////////////////////////////////////////////////////
|
||||
// Name: wx/cocoa/slider.h
|
||||
// Purpose: wxSlider class
|
||||
// Author: David Elliott
|
||||
// Mark Oxenham
|
||||
// Modified by:
|
||||
// Created: 2003/06/19
|
||||
// Copyright: (c) 2003 David Elliott
|
||||
// (c) 2007 Software 2000 Ltd.
|
||||
// Licence: wxWindows licence
|
||||
/////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
#ifndef __WX_COCOA_SLIDER_H__
|
||||
#define __WX_COCOA_SLIDER_H__
|
||||
|
||||
#include "wx/cocoa/NSSlider.h"
|
||||
|
||||
// ========================================================================
|
||||
// wxSlider
|
||||
// ========================================================================
|
||||
class WXDLLIMPEXP_CORE wxSlider: public wxSliderBase, protected wxCocoaNSSlider
|
||||
{
|
||||
DECLARE_DYNAMIC_CLASS(wxSlider)
|
||||
DECLARE_EVENT_TABLE()
|
||||
WX_DECLARE_COCOA_OWNER(NSSlider,NSControl,NSView)
|
||||
// ------------------------------------------------------------------------
|
||||
// initialization
|
||||
// ------------------------------------------------------------------------
|
||||
public:
|
||||
wxSlider() { }
|
||||
wxSlider(wxWindow *parent, wxWindowID winid,
|
||||
int value, int minValue, int maxValue,
|
||||
const wxPoint& pos = wxDefaultPosition,
|
||||
const wxSize& size = wxDefaultSize,
|
||||
long style = wxSL_HORIZONTAL,
|
||||
const wxValidator& validator = wxDefaultValidator,
|
||||
const wxString& name = wxSliderNameStr)
|
||||
{
|
||||
Create(parent, winid, value, minValue, maxValue,
|
||||
pos, size, style, validator, name);
|
||||
}
|
||||
|
||||
bool Create(wxWindow *parent, wxWindowID winid,
|
||||
int value, int minValue, int maxValue,
|
||||
const wxPoint& pos = wxDefaultPosition,
|
||||
const wxSize& size = wxDefaultSize,
|
||||
long style = wxSL_HORIZONTAL,
|
||||
const wxValidator& validator = wxDefaultValidator,
|
||||
const wxString& name = wxSliderNameStr);
|
||||
virtual ~wxSlider();
|
||||
|
||||
// ------------------------------------------------------------------------
|
||||
// Cocoa callbacks
|
||||
// ------------------------------------------------------------------------
|
||||
protected:
|
||||
// Override this so we can use wxCocoaNSControl's target
|
||||
void AssociateNSSlider(WX_NSSlider theSlider);
|
||||
|
||||
// Helper method to do the real work
|
||||
virtual void ProcessEventType(wxEventType commandType);
|
||||
|
||||
// from wxCocoaNSControl:
|
||||
virtual void CocoaTarget_action();
|
||||
|
||||
// from wxCocoaNSSlider:
|
||||
virtual void CocoaNotification_startTracking(WX_NSNotification notification);
|
||||
virtual void CocoaNotification_continueTracking(WX_NSNotification notification);
|
||||
virtual void CocoaNotification_stopTracking(WX_NSNotification notification);
|
||||
|
||||
// ------------------------------------------------------------------------
|
||||
// Implementation
|
||||
// ------------------------------------------------------------------------
|
||||
public:
|
||||
// Pure Virtuals
|
||||
virtual int GetValue() const;
|
||||
virtual void SetValue(int value);
|
||||
|
||||
// retrieve/change the range
|
||||
virtual void SetRange(int minValue, int maxValue);
|
||||
virtual int GetMin() const;
|
||||
virtual int GetMax() const;
|
||||
|
||||
// the line/page size is the increment by which the slider moves when
|
||||
// cursor arrow key/page up or down are pressed (clicking the mouse is like
|
||||
// pressing PageUp/Down) and are by default set to 1 and 1/10 of the range
|
||||
virtual void SetLineSize(int lineSize);
|
||||
virtual void SetPageSize(int pageSize);
|
||||
virtual int GetLineSize() const;
|
||||
virtual int GetPageSize() const;
|
||||
|
||||
// these methods get/set the length of the slider pointer in pixels
|
||||
virtual void SetThumbLength(int lenPixels);
|
||||
virtual int GetThumbLength() const;
|
||||
|
||||
// copied from (wxSliderCocoa.h)
|
||||
virtual int GetTickFreq() const;
|
||||
virtual void ClearTicks() { SetTickFreq(0); }
|
||||
|
||||
virtual void SetTickPos(int pos);
|
||||
|
||||
protected:
|
||||
// Platform-specific implementation of SetTickFreq
|
||||
virtual void DoSetTickFreq(int freq);
|
||||
};
|
||||
|
||||
#endif
|
||||
// __WX_COCOA_SLIDER_H__
|
@@ -1,51 +0,0 @@
|
||||
/////////////////////////////////////////////////////////////////////////////
|
||||
// Name: wx/cocoa/sound.h
|
||||
// Purpose: wxSound class (loads and plays short Windows .wav files).
|
||||
// Optional on non-Windows platforms.
|
||||
// Authors: David Elliott, Ryan Norton
|
||||
// Modified by:
|
||||
// Created: 2004-10-02
|
||||
// Copyright: (c) 2004 David Elliott, Ryan Norton
|
||||
// Licence: wxWindows licence
|
||||
/////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
#ifndef _WX_COCOA_SOUND_H_
|
||||
#define _WX_COCOA_SOUND_H_
|
||||
|
||||
#include "wx/object.h"
|
||||
#include "wx/cocoa/ObjcRef.h"
|
||||
|
||||
class WXDLLIMPEXP_ADV wxSound : public wxSoundBase
|
||||
{
|
||||
public:
|
||||
wxSound()
|
||||
: m_cocoaNSSound(NULL)
|
||||
{}
|
||||
wxSound(const wxString& fileName, bool isResource = false)
|
||||
: m_cocoaNSSound(NULL)
|
||||
{ Create(fileName, isResource); }
|
||||
wxSound(size_t size, const void* data)
|
||||
: m_cocoaNSSound(NULL)
|
||||
{ LoadWAV(data,size,true); }
|
||||
wxSound(const wxSound& sound); // why not?
|
||||
virtual ~wxSound();
|
||||
|
||||
public:
|
||||
bool Create(const wxString& fileName, bool isResource = false);
|
||||
bool IsOk() const
|
||||
{ return m_cocoaNSSound; }
|
||||
static void Stop();
|
||||
static bool IsPlaying();
|
||||
|
||||
void SetNSSound(WX_NSSound cocoaNSSound);
|
||||
inline WX_NSSound GetNSSound()
|
||||
{ return m_cocoaNSSound; }
|
||||
protected:
|
||||
bool DoPlay(unsigned flags) const;
|
||||
bool LoadWAV(const void* data, size_t length, bool copyData);
|
||||
private:
|
||||
WX_NSSound m_cocoaNSSound;
|
||||
static const wxObjcAutoRefFromAlloc<struct objc_object *> sm_cocoaDelegate;
|
||||
};
|
||||
|
||||
#endif //ndef _WX_COCOA_SOUND_H_
|
@@ -1,63 +0,0 @@
|
||||
/////////////////////////////////////////////////////////////////////////////
|
||||
// Name: wx/cocoa/spinbutt.h
|
||||
// Purpose: wxSpinButton class
|
||||
// Author: David Elliott
|
||||
// Modified by:
|
||||
// Created: 2003/07/14
|
||||
// Copyright: (c) 2003 David Elliott
|
||||
// Licence: wxWindows licence
|
||||
/////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
#ifndef __WX_COCOA_SPINBUTT_H__
|
||||
#define __WX_COCOA_SPINBUTT_H__
|
||||
|
||||
// #include "wx/cocoa/NSStepper.h"
|
||||
|
||||
// ========================================================================
|
||||
// wxSpinButton
|
||||
// ========================================================================
|
||||
class WXDLLIMPEXP_CORE wxSpinButton: public wxSpinButtonBase// , protected wxCocoaNSStepper
|
||||
{
|
||||
DECLARE_DYNAMIC_CLASS(wxSpinButton)
|
||||
DECLARE_EVENT_TABLE()
|
||||
// WX_DECLARE_COCOA_OWNER(NSStepper,NSControl,NSView)
|
||||
// ------------------------------------------------------------------------
|
||||
// initialization
|
||||
// ------------------------------------------------------------------------
|
||||
public:
|
||||
wxSpinButton() { }
|
||||
wxSpinButton(wxWindow *parent, wxWindowID winid = wxID_ANY,
|
||||
const wxPoint& pos = wxDefaultPosition,
|
||||
const wxSize& size = wxDefaultSize,
|
||||
long style = wxSP_VERTICAL | wxSP_ARROW_KEYS,
|
||||
const wxString& name = wxSPIN_BUTTON_NAME)
|
||||
{
|
||||
Create(parent, winid, pos, size, style, name);
|
||||
}
|
||||
|
||||
bool Create(wxWindow *parent, wxWindowID winid = wxID_ANY,
|
||||
const wxPoint& pos = wxDefaultPosition,
|
||||
const wxSize& size = wxDefaultSize,
|
||||
long style = wxSP_HORIZONTAL,
|
||||
const wxString& name = wxSPIN_BUTTON_NAME);
|
||||
virtual ~wxSpinButton();
|
||||
|
||||
// ------------------------------------------------------------------------
|
||||
// Cocoa callbacks
|
||||
// ------------------------------------------------------------------------
|
||||
protected:
|
||||
virtual void CocoaTarget_action();
|
||||
// ------------------------------------------------------------------------
|
||||
// Implementation
|
||||
// ------------------------------------------------------------------------
|
||||
public:
|
||||
// Pure Virtuals
|
||||
virtual int GetValue() const;
|
||||
virtual void SetValue(int value);
|
||||
|
||||
// retrieve/change the range
|
||||
virtual void SetRange(int minValue, int maxValue);
|
||||
};
|
||||
|
||||
#endif
|
||||
// __WX_COCOA_SPINBUTT_H__
|
@@ -1,59 +0,0 @@
|
||||
/////////////////////////////////////////////////////////////////////////////
|
||||
// Name: wx/cocoa/statbmp.h
|
||||
// Purpose: wxStaticBitmap class
|
||||
// Author: David Elliott
|
||||
// Modified by:
|
||||
// Created: 2003/03/16
|
||||
// Copyright: (c) 2003 David Elliott
|
||||
// Licence: wxWindows licence
|
||||
/////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
#ifndef __WX_COCOA_STATBMP_H__
|
||||
#define __WX_COCOA_STATBMP_H__
|
||||
|
||||
DECLARE_WXCOCOA_OBJC_CLASS(NSImageView);
|
||||
|
||||
// ========================================================================
|
||||
// wxStaticBitmap
|
||||
// ========================================================================
|
||||
class WXDLLIMPEXP_CORE wxStaticBitmap : public wxStaticBitmapBase //, protected wxCocoaNSxxx
|
||||
{
|
||||
DECLARE_DYNAMIC_CLASS(wxStaticBitmap)
|
||||
DECLARE_EVENT_TABLE()
|
||||
// WX_DECLARE_COCOA_OWNER(NSxxx,NSControl,NSView)
|
||||
// ------------------------------------------------------------------------
|
||||
// initialization
|
||||
// ------------------------------------------------------------------------
|
||||
public:
|
||||
wxStaticBitmap() {}
|
||||
wxStaticBitmap(wxWindow *parent, wxWindowID winid,
|
||||
const wxBitmap& bitmap,
|
||||
const wxPoint& pos = wxDefaultPosition,
|
||||
const wxSize& size = wxDefaultSize, long style = 0,
|
||||
const wxString& name = wxStaticBitmapNameStr)
|
||||
{
|
||||
Create(parent, winid, bitmap, pos, size, style, name);
|
||||
}
|
||||
|
||||
bool Create(wxWindow *parent, wxWindowID winid,
|
||||
const wxBitmap& bitmap,
|
||||
const wxPoint& pos = wxDefaultPosition,
|
||||
const wxSize& size = wxDefaultSize, long style = 0,
|
||||
const wxString& name = wxStaticBitmapNameStr);
|
||||
virtual ~wxStaticBitmap();
|
||||
|
||||
// ------------------------------------------------------------------------
|
||||
// Cocoa specifics
|
||||
// ------------------------------------------------------------------------
|
||||
WX_NSImageView GetNSImageView() { return (WX_NSImageView)m_cocoaNSView; }
|
||||
wxBitmap m_bitmap;
|
||||
|
||||
// ------------------------------------------------------------------------
|
||||
// Implementation
|
||||
// ------------------------------------------------------------------------
|
||||
virtual void SetIcon(const wxIcon& icon);
|
||||
virtual void SetBitmap(const wxBitmap& bitmap);
|
||||
virtual wxBitmap GetBitmap() const;
|
||||
};
|
||||
|
||||
#endif // __WX_COCOA_STATBMP_H__
|
@@ -1,60 +0,0 @@
|
||||
/////////////////////////////////////////////////////////////////////////////
|
||||
// Name: wx/cocoa/statbox.h
|
||||
// Purpose: wxStaticBox class
|
||||
// Author: David Elliott
|
||||
// Modified by:
|
||||
// Created: 2003/03/18
|
||||
// Copyright: (c) 2003 David Elliott
|
||||
// Licence: wxWindows licence
|
||||
/////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
#ifndef __WX_COCOA_STATBOX_H__
|
||||
#define __WX_COCOA_STATBOX_H__
|
||||
|
||||
#include "wx/cocoa/NSBox.h"
|
||||
|
||||
// ========================================================================
|
||||
// wxStaticBox
|
||||
// ========================================================================
|
||||
class WXDLLIMPEXP_CORE wxStaticBox: public wxStaticBoxBase, protected wxCocoaNSBox
|
||||
{
|
||||
DECLARE_DYNAMIC_CLASS(wxStaticBox)
|
||||
DECLARE_EVENT_TABLE()
|
||||
WX_DECLARE_COCOA_OWNER(NSBox,NSView,NSView)
|
||||
// ------------------------------------------------------------------------
|
||||
// initialization
|
||||
// ------------------------------------------------------------------------
|
||||
public:
|
||||
wxStaticBox() { }
|
||||
wxStaticBox(wxWindow *parent, wxWindowID winid, const wxString& title,
|
||||
const wxPoint& pos = wxDefaultPosition,
|
||||
const wxSize& size = wxDefaultSize,
|
||||
long style = 0, const wxString& name = wxStaticBoxNameStr)
|
||||
{
|
||||
Create(parent, winid, title, pos, size, style, name);
|
||||
}
|
||||
|
||||
bool Create(wxWindow *parent, wxWindowID winid, const wxString& title,
|
||||
const wxPoint& pos = wxDefaultPosition,
|
||||
const wxSize& size = wxDefaultSize,
|
||||
long style = 0, const wxString& name = wxStaticBoxNameStr);
|
||||
virtual ~wxStaticBox();
|
||||
|
||||
virtual void SetLabel(const wxString& label);
|
||||
virtual wxString GetLabel() const;
|
||||
|
||||
// ------------------------------------------------------------------------
|
||||
// Cocoa callbacks
|
||||
// ------------------------------------------------------------------------
|
||||
protected:
|
||||
// Static boxes cannot be enabled/disabled
|
||||
virtual void CocoaSetEnabled(bool WXUNUSED(enable)) { }
|
||||
// ------------------------------------------------------------------------
|
||||
// Implementation
|
||||
// ------------------------------------------------------------------------
|
||||
public:
|
||||
virtual void GetBordersForSizer(int *borderTop, int *borderOther) const;
|
||||
protected:
|
||||
};
|
||||
|
||||
#endif // __WX_COCOA_STATBOX_H__
|
@@ -1,55 +0,0 @@
|
||||
/////////////////////////////////////////////////////////////////////////////
|
||||
// Name: wx/cocoa/statline.h
|
||||
// Purpose: wxStaticLine class
|
||||
// Author: David Elliott
|
||||
// Modified by:
|
||||
// Created: 2003/03/18
|
||||
// Copyright: (c) 2003 David Elliott
|
||||
// Licence: wxWindows licence
|
||||
/////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
#ifndef __WX_COCOA_STATLINE_H__
|
||||
#define __WX_COCOA_STATLINE_H__
|
||||
|
||||
// #include "wx/cocoa/NSButton.h"
|
||||
|
||||
// ========================================================================
|
||||
// wxStaticLine
|
||||
// ========================================================================
|
||||
class WXDLLIMPEXP_CORE wxStaticLine: public wxStaticLineBase// , protected wxCocoaNSButton
|
||||
{
|
||||
DECLARE_DYNAMIC_CLASS(wxStaticLine)
|
||||
DECLARE_EVENT_TABLE()
|
||||
// WX_DECLARE_COCOA_OWNER(NSButton,NSControl,NSView)
|
||||
// ------------------------------------------------------------------------
|
||||
// initialization
|
||||
// ------------------------------------------------------------------------
|
||||
public:
|
||||
wxStaticLine() { }
|
||||
wxStaticLine(wxWindow *parent, wxWindowID winid = wxID_ANY,
|
||||
const wxPoint& pos = wxDefaultPosition,
|
||||
const wxSize& size = wxDefaultSize,
|
||||
long style = 0, const wxString& name = wxStaticLineNameStr)
|
||||
{
|
||||
Create(parent, winid, pos, size, style, name);
|
||||
}
|
||||
|
||||
bool Create(wxWindow *parent, wxWindowID winid = wxID_ANY,
|
||||
const wxPoint& pos = wxDefaultPosition,
|
||||
const wxSize& size = wxDefaultSize,
|
||||
long style = 0, const wxString& name = wxStaticLineNameStr);
|
||||
virtual ~wxStaticLine();
|
||||
|
||||
// ------------------------------------------------------------------------
|
||||
// Cocoa callbacks
|
||||
// ------------------------------------------------------------------------
|
||||
protected:
|
||||
// Static lines cannot be enabled/disabled
|
||||
virtual void CocoaSetEnabled(bool WXUNUSED(enable)) { }
|
||||
// ------------------------------------------------------------------------
|
||||
// Implementation
|
||||
// ------------------------------------------------------------------------
|
||||
public:
|
||||
};
|
||||
|
||||
#endif // __WX_COCOA_STATLINE_H__
|
@@ -1,58 +0,0 @@
|
||||
/////////////////////////////////////////////////////////////////////////////
|
||||
// Name: wx/cocoa/stattext.h
|
||||
// Purpose: wxStaticText class
|
||||
// Author: David Elliott
|
||||
// Modified by:
|
||||
// Created: 2003/02/15
|
||||
// Copyright: (c) 2003 David Elliott
|
||||
// Licence: wxWindows licence
|
||||
/////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
#ifndef __WX_COCOA_STATTEXT_H__
|
||||
#define __WX_COCOA_STATTEXT_H__
|
||||
|
||||
#include "wx/cocoa/NSTextField.h"
|
||||
|
||||
// ========================================================================
|
||||
// wxStaticText
|
||||
// ========================================================================
|
||||
class WXDLLIMPEXP_CORE wxStaticText : public wxStaticTextBase, protected wxCocoaNSTextField
|
||||
{
|
||||
DECLARE_DYNAMIC_CLASS(wxStaticText)
|
||||
DECLARE_EVENT_TABLE()
|
||||
WX_DECLARE_COCOA_OWNER(NSTextField,NSControl,NSView)
|
||||
// ------------------------------------------------------------------------
|
||||
// initialization
|
||||
// ------------------------------------------------------------------------
|
||||
public:
|
||||
wxStaticText() {}
|
||||
wxStaticText(wxWindow *parent, wxWindowID winid,
|
||||
const wxString& label,
|
||||
const wxPoint& pos = wxDefaultPosition,
|
||||
const wxSize& size = wxDefaultSize, long style = 0,
|
||||
const wxString& name = wxStaticTextNameStr)
|
||||
{
|
||||
Create(parent, winid, label, pos, size, style, name);
|
||||
}
|
||||
|
||||
bool Create(wxWindow *parent, wxWindowID winid,
|
||||
const wxString& label,
|
||||
const wxPoint& pos = wxDefaultPosition,
|
||||
const wxSize& size = wxDefaultSize, long style = 0,
|
||||
const wxString& name = wxStaticTextNameStr);
|
||||
virtual ~wxStaticText();
|
||||
|
||||
// ------------------------------------------------------------------------
|
||||
// Cocoa specifics
|
||||
// ------------------------------------------------------------------------
|
||||
protected:
|
||||
virtual void Cocoa_didChangeText(void);
|
||||
// ------------------------------------------------------------------------
|
||||
// Implementation
|
||||
// ------------------------------------------------------------------------
|
||||
public:
|
||||
virtual void SetLabel(const wxString& label);
|
||||
virtual wxString GetLabel() const;
|
||||
};
|
||||
|
||||
#endif // __WX_COCOA_STATTEXT_H__
|
@@ -1,52 +0,0 @@
|
||||
///////////////////////////////////////////////////////////////////////////////
|
||||
// Name: wx/cocoa/string.h
|
||||
// Purpose: String conversion methods
|
||||
// Author: David Elliott
|
||||
// Modified by:
|
||||
// Created: 2003/04/13
|
||||
// Copyright: (c) 2003 David Elliott
|
||||
// Licence: wxWindows licence
|
||||
///////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
#ifndef __WX_COCOA_STRING_H__
|
||||
#define __WX_COCOA_STRING_H__
|
||||
|
||||
#import <Foundation/NSString.h>
|
||||
#include "wx/string.h"
|
||||
|
||||
// FIXME: In unicode mode we are doing the conversion twice. wxString
|
||||
// converts to UTF-8 and NSString converts from UTF-8.
|
||||
// One possible optimization is to convert to the wxString internal
|
||||
// representation which is an unsigned short (unichar) but unfortunately
|
||||
// there is little documentation on which encoding it uses by default.
|
||||
|
||||
// Return an autoreleased NSString
|
||||
inline NSString* wxNSStringWithWxString(const wxString &wxstring)
|
||||
{
|
||||
#if wxUSE_UNICODE
|
||||
return [NSString stringWithUTF8String: wxstring.utf8_str()];
|
||||
#else
|
||||
return [NSString stringWithCString: wxstring.c_str() length:wxstring.Len()];
|
||||
#endif // wxUSE_UNICODE
|
||||
}
|
||||
|
||||
// Intialize an NSString which has already been allocated
|
||||
inline NSString* wxInitNSStringWithWxString(NSString *nsstring, const wxString &wxstring)
|
||||
{
|
||||
#if wxUSE_UNICODE
|
||||
return [nsstring initWithUTF8String: wxstring.utf8_str()];
|
||||
#else
|
||||
return [nsstring initWithCString: wxstring.c_str() length:wxstring.Len()];
|
||||
#endif // wxUSE_UNICODE
|
||||
}
|
||||
|
||||
inline wxString wxStringWithNSString(NSString *nsstring)
|
||||
{
|
||||
#if wxUSE_UNICODE
|
||||
return wxString::FromUTF8Unchecked([nsstring UTF8String]);
|
||||
#else
|
||||
return wxString([nsstring lossyCString]);
|
||||
#endif // wxUSE_UNICODE
|
||||
}
|
||||
|
||||
#endif // __WX_COCOA_STRING_H__
|
@@ -1,47 +0,0 @@
|
||||
/////////////////////////////////////////////////////////////////////////
|
||||
// File: wx/cocoa/taskbar.h
|
||||
// Purpose: Defines wxTaskBarIcon class
|
||||
// Author: David Elliott
|
||||
// Modified by:
|
||||
// Created: 2004/01/24
|
||||
// Copyright: (c) 2004 David Elliott
|
||||
// Licence: wxWindows licence
|
||||
/////////////////////////////////////////////////////////////////////////
|
||||
|
||||
#ifndef _WX_COCOA_TASKBAR_H__
|
||||
#define _WX_COCOA_TASKBAR_H__
|
||||
|
||||
#include "wx/icon.h"
|
||||
|
||||
class WXDLLIMPEXP_FWD_CORE wxIcon;
|
||||
class WXDLLIMPEXP_FWD_CORE wxMenu;
|
||||
|
||||
class wxTaskBarIconCocoaImpl;
|
||||
|
||||
class WXDLLIMPEXP_ADV wxTaskBarIcon : public wxTaskBarIconBase
|
||||
{
|
||||
friend class wxTaskBarIconCocoaImpl;
|
||||
DECLARE_DYNAMIC_CLASS_NO_COPY(wxTaskBarIcon)
|
||||
public:
|
||||
//type of taskbar item to create (currently only DOCK is implemented)
|
||||
enum wxTaskBarIconType
|
||||
{ DOCK
|
||||
, CUSTOM_STATUSITEM
|
||||
// , STATUSITEM // TODO: Implement using NSStatusItem w/o custom NSView
|
||||
// , MENUEXTRA // Menu extras require undocumented hacks
|
||||
, DEFAULT_TYPE = CUSTOM_STATUSITEM
|
||||
};
|
||||
|
||||
// Only one wxTaskBarIcon can be of the Dock type so by default
|
||||
// create NSStatusItem for maximum source compatibility.
|
||||
wxTaskBarIcon(wxTaskBarIconType iconType = DEFAULT_TYPE);
|
||||
virtual ~wxTaskBarIcon();
|
||||
|
||||
bool SetIcon(const wxIcon& icon, const wxString& tooltip = wxEmptyString);
|
||||
bool RemoveIcon();
|
||||
bool PopupMenu(wxMenu *menu); //, int x, int y);
|
||||
protected:
|
||||
wxTaskBarIconCocoaImpl *m_impl;
|
||||
};
|
||||
|
||||
#endif // _WX_COCOA_TASKBAR_H__
|
@@ -1,122 +0,0 @@
|
||||
/////////////////////////////////////////////////////////////////////////////
|
||||
// Name: wx/cocoa/textctrl.h
|
||||
// Purpose: wxTextCtrl class
|
||||
// Author: David Elliott
|
||||
// Modified by:
|
||||
// Created: 2003/03/16
|
||||
// Copyright: (c) 2003 David Elliott
|
||||
// Licence: wxWindows licence
|
||||
/////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
#ifndef __WX_COCOA_TEXTCTRL_H__
|
||||
#define __WX_COCOA_TEXTCTRL_H__
|
||||
|
||||
#include "wx/cocoa/NSTextField.h"
|
||||
|
||||
// ========================================================================
|
||||
// wxTextCtrl
|
||||
// ========================================================================
|
||||
class WXDLLIMPEXP_CORE wxTextCtrl : public wxTextCtrlBase, protected wxCocoaNSTextField
|
||||
{
|
||||
DECLARE_DYNAMIC_CLASS(wxTextCtrl)
|
||||
DECLARE_EVENT_TABLE()
|
||||
WX_DECLARE_COCOA_OWNER(NSTextField,NSControl,NSView)
|
||||
// ------------------------------------------------------------------------
|
||||
// initialization
|
||||
// ------------------------------------------------------------------------
|
||||
public:
|
||||
wxTextCtrl() {}
|
||||
wxTextCtrl(wxWindow *parent, wxWindowID winid,
|
||||
const wxString& value = wxEmptyString,
|
||||
const wxPoint& pos = wxDefaultPosition,
|
||||
const wxSize& size = wxDefaultSize, long style = 0,
|
||||
const wxValidator& validator = wxDefaultValidator,
|
||||
const wxString& name = wxTextCtrlNameStr)
|
||||
{
|
||||
Create(parent, winid, value, pos, size, style, validator, name);
|
||||
}
|
||||
|
||||
bool Create(wxWindow *parent, wxWindowID winid,
|
||||
const wxString& value = wxEmptyString,
|
||||
const wxPoint& pos = wxDefaultPosition,
|
||||
const wxSize& size = wxDefaultSize, long style = 0,
|
||||
const wxValidator& validator = wxDefaultValidator,
|
||||
const wxString& name = wxTextCtrlNameStr);
|
||||
virtual ~wxTextCtrl();
|
||||
|
||||
// ------------------------------------------------------------------------
|
||||
// Cocoa specifics
|
||||
// ------------------------------------------------------------------------
|
||||
protected:
|
||||
virtual void Cocoa_didChangeText(void);
|
||||
virtual void CocoaTarget_action(void);
|
||||
// ------------------------------------------------------------------------
|
||||
// Implementation
|
||||
// ------------------------------------------------------------------------
|
||||
public:
|
||||
virtual wxString GetValue() const;
|
||||
|
||||
virtual int GetLineLength(long lineNo) const;
|
||||
virtual wxString GetLineText(long lineNo) const;
|
||||
virtual int GetNumberOfLines() const;
|
||||
|
||||
virtual bool IsModified() const;
|
||||
virtual bool IsEditable() const;
|
||||
|
||||
// If the return values from and to are the same, there is no selection.
|
||||
virtual void GetSelection(long* from, long* to) const;
|
||||
|
||||
// operations
|
||||
// ----------
|
||||
|
||||
// editing
|
||||
virtual void Clear();
|
||||
virtual void Replace(long from, long to, const wxString& value);
|
||||
virtual void Remove(long from, long to);
|
||||
|
||||
// clears the dirty flag
|
||||
virtual void MarkDirty();
|
||||
virtual void DiscardEdits();
|
||||
|
||||
// writing text inserts it at the current position, appending always
|
||||
// inserts it at the end
|
||||
virtual void WriteText(const wxString& text);
|
||||
virtual void AppendText(const wxString& text);
|
||||
|
||||
// translate between the position (which is just an index in the text ctrl
|
||||
// considering all its contents as a single strings) and (x, y) coordinates
|
||||
// which represent column and line.
|
||||
virtual long XYToPosition(long x, long y) const;
|
||||
virtual bool PositionToXY(long pos, long *x, long *y) const;
|
||||
|
||||
virtual void ShowPosition(long pos);
|
||||
|
||||
// Clipboard operations
|
||||
virtual void Copy();
|
||||
virtual void Cut();
|
||||
virtual void Paste();
|
||||
|
||||
// Undo/redo
|
||||
virtual void Undo();
|
||||
virtual void Redo();
|
||||
|
||||
virtual bool CanUndo() const;
|
||||
virtual bool CanRedo() const;
|
||||
|
||||
// Insertion point
|
||||
virtual void SetInsertionPoint(long pos);
|
||||
virtual void SetInsertionPointEnd();
|
||||
virtual long GetInsertionPoint() const;
|
||||
virtual wxTextPos GetLastPosition() const;
|
||||
|
||||
virtual void SetSelection(long from, long to);
|
||||
// virtual void SelectAll();
|
||||
virtual void SetEditable(bool editable);
|
||||
|
||||
protected:
|
||||
virtual wxSize DoGetBestSize() const;
|
||||
|
||||
virtual void DoSetValue(const wxString& value, int flags = 0);
|
||||
};
|
||||
|
||||
#endif // __WX_COCOA_TEXTCTRL_H__
|
@@ -1,120 +0,0 @@
|
||||
/////////////////////////////////////////////////////////////////////////////
|
||||
// Name: wx/cocoa/toolbar.h
|
||||
// Purpose: wxToolBar
|
||||
// Author: David Elliott
|
||||
// Modified by:
|
||||
// Created: 2003/08/17
|
||||
// Copyright: (c) 2003 David Elliott
|
||||
// Licence: wxWindows licence
|
||||
/////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
#ifndef __WX_COCOA_TOOLBAR_H__
|
||||
#define __WX_COCOA_TOOLBAR_H__
|
||||
|
||||
#if wxUSE_TOOLBAR
|
||||
|
||||
// ========================================================================
|
||||
// wxToolBar
|
||||
// ========================================================================
|
||||
#if defined(__LP64__) || defined(NS_BUILD_32_LIKE_64)
|
||||
typedef struct CGPoint NSPoint;
|
||||
#else
|
||||
typedef struct _NSPoint NSPoint;
|
||||
#endif
|
||||
|
||||
class wxToolBarTool;
|
||||
|
||||
class WXDLLIMPEXP_CORE wxToolBar : public wxToolBarBase
|
||||
{
|
||||
DECLARE_DYNAMIC_CLASS(wxToolBar)
|
||||
// ------------------------------------------------------------------------
|
||||
// initialization
|
||||
// ------------------------------------------------------------------------
|
||||
public:
|
||||
wxToolBar() { Init(); }
|
||||
wxToolBar( wxWindow *parent,
|
||||
wxWindowID toolid,
|
||||
const wxPoint& pos = wxDefaultPosition,
|
||||
const wxSize& size = wxDefaultSize,
|
||||
long style = 0,
|
||||
const wxString& name = wxToolBarNameStr )
|
||||
{
|
||||
Init();
|
||||
|
||||
Create(parent, toolid, pos, size, style, name);
|
||||
}
|
||||
|
||||
bool Create( wxWindow *parent,
|
||||
wxWindowID toolid,
|
||||
const wxPoint& pos = wxDefaultPosition,
|
||||
const wxSize& size = wxDefaultSize,
|
||||
long style = 0,
|
||||
const wxString& name = wxToolBarNameStr );
|
||||
|
||||
virtual ~wxToolBar();
|
||||
|
||||
protected:
|
||||
// common part of all ctors
|
||||
void Init();
|
||||
|
||||
// ------------------------------------------------------------------------
|
||||
// Cocoa
|
||||
// ------------------------------------------------------------------------
|
||||
protected:
|
||||
virtual bool Cocoa_acceptsFirstMouse(bool &acceptsFirstMouse, WX_NSEvent theEvent);
|
||||
virtual bool Cocoa_drawRect(const NSRect &rect);
|
||||
virtual bool Cocoa_mouseDown(WX_NSEvent theEvent);
|
||||
virtual bool Cocoa_mouseDragged(WX_NSEvent theEvent);
|
||||
wxToolBarTool *CocoaFindToolForPosition(const NSPoint& pos) const;
|
||||
void CocoaToolClickEnded();
|
||||
// ------------------------------------------------------------------------
|
||||
// Implementation
|
||||
// ------------------------------------------------------------------------
|
||||
public:
|
||||
// override base class virtuals
|
||||
virtual void SetMargins(int x, int y);
|
||||
virtual void SetToolSeparation(int separation);
|
||||
|
||||
virtual wxToolBarToolBase *FindToolForPosition(wxCoord x, wxCoord y) const;
|
||||
|
||||
virtual void SetToolShortHelp(int toolid, const wxString& helpString);
|
||||
|
||||
virtual void SetWindowStyleFlag( long style );
|
||||
|
||||
// implementation from now on
|
||||
// --------------------------
|
||||
|
||||
void OnInternalIdle();
|
||||
virtual bool Realize();
|
||||
virtual wxSize DoGetBestSize() const;
|
||||
|
||||
void SetOwningFrame(wxFrame *owningFrame)
|
||||
{ m_owningFrame = owningFrame; }
|
||||
protected:
|
||||
// implement base class pure virtuals
|
||||
virtual bool DoInsertTool(size_t pos, wxToolBarToolBase *tool);
|
||||
virtual bool DoDeleteTool(size_t pos, wxToolBarToolBase *tool);
|
||||
|
||||
virtual void DoEnableTool(wxToolBarToolBase *tool, bool enable);
|
||||
virtual void DoToggleTool(wxToolBarToolBase *tool, bool toggle);
|
||||
virtual void DoSetToggle(wxToolBarToolBase *tool, bool toggle);
|
||||
|
||||
virtual wxToolBarToolBase *CreateTool(int toolid,
|
||||
const wxString& label,
|
||||
const wxBitmap& bitmap1,
|
||||
const wxBitmap& bitmap2,
|
||||
wxItemKind kind,
|
||||
wxObject *clientData,
|
||||
const wxString& shortHelpString,
|
||||
const wxString& longHelpString);
|
||||
virtual wxToolBarToolBase *CreateTool(wxControl *control,
|
||||
const wxString& label);
|
||||
|
||||
wxSize m_bestSize;
|
||||
wxFrame *m_owningFrame;
|
||||
wxToolBarTool *m_mouseDownTool;
|
||||
};
|
||||
|
||||
#endif // wxUSE_TOOLBAR
|
||||
|
||||
#endif // __WX_COCOA_TOOLBAR_H__
|
@@ -1,54 +0,0 @@
|
||||
///////////////////////////////////////////////////////////////////////////////
|
||||
// Name: wx/cocoa/tooltip.h
|
||||
// Purpose: wxToolTip class - tooltip control
|
||||
// Author: Ryan Norton
|
||||
// Modified by:
|
||||
// Created: 31.01.99
|
||||
// Copyright: (c) Ryan Norton
|
||||
// Licence: wxWindows licence
|
||||
///////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
#ifndef _WX_COCOA_TOOLTIP_H_
|
||||
#define _WX_COCOA_TOOLTIP_H_
|
||||
|
||||
#include "wx/object.h"
|
||||
|
||||
class wxWindow;
|
||||
|
||||
class wxToolTip : public wxObject
|
||||
{
|
||||
public:
|
||||
// ctor & dtor
|
||||
wxToolTip(const wxString &tip);
|
||||
virtual ~wxToolTip();
|
||||
|
||||
// accessors
|
||||
// tip text
|
||||
void SetTip(const wxString& tip);
|
||||
const wxString& GetTip() const;
|
||||
|
||||
// the window we're associated with
|
||||
wxWindow *GetWindow() const;
|
||||
|
||||
// controlling tooltip behaviour: globally change tooltip parameters
|
||||
// enable or disable the tooltips globally
|
||||
static void Enable(bool flag);
|
||||
// set the delay after which the tooltip appears
|
||||
static void SetDelay(long milliseconds);
|
||||
// set the delay after which the tooltip disappears or how long the tooltip remains visible
|
||||
static void SetAutoPop(long milliseconds);
|
||||
// set the delay between subsequent tooltips to appear
|
||||
static void SetReshow(long milliseconds);
|
||||
|
||||
private:
|
||||
void SetWindow(wxWindow* window);
|
||||
|
||||
friend class wxWindow;
|
||||
|
||||
wxString m_text; // tooltip text
|
||||
wxWindow *m_window; // window we're associated with
|
||||
|
||||
DECLARE_ABSTRACT_CLASS(wxToolTip)
|
||||
};
|
||||
|
||||
#endif // _WX_COCOA_TOOLTIP_H_
|
@@ -1,130 +0,0 @@
|
||||
///////////////////////////////////////////////////////////////////////////////
|
||||
// Name: wx/cocoa/toplevel.h
|
||||
// Purpose: wxTopLevelWindowCocoa is the Cocoa implementation of wxTLW
|
||||
// Author: David Elliott
|
||||
// Modified by:
|
||||
// Created: 2002/12/08
|
||||
// Copyright: (c) 2002 David Elliott
|
||||
// Licence: wxWindows licence
|
||||
///////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
#ifndef __WX_COCOA_TOPLEVEL_H__
|
||||
#define __WX_COCOA_TOPLEVEL_H__
|
||||
|
||||
#include "wx/hashmap.h"
|
||||
#include "wx/cocoa/NSWindow.h"
|
||||
|
||||
class WXDLLIMPEXP_FWD_CORE wxMenuBar;
|
||||
|
||||
// ========================================================================
|
||||
// wxTopLevelWindowCocoa
|
||||
// ========================================================================
|
||||
class WXDLLIMPEXP_CORE wxTopLevelWindowCocoa : public wxTopLevelWindowBase, protected wxCocoaNSWindow
|
||||
{
|
||||
DECLARE_EVENT_TABLE();
|
||||
DECLARE_NO_COPY_CLASS(wxTopLevelWindowCocoa);
|
||||
// ------------------------------------------------------------------------
|
||||
// initialization
|
||||
// ------------------------------------------------------------------------
|
||||
public:
|
||||
inline wxTopLevelWindowCocoa()
|
||||
: wxCocoaNSWindow(this)
|
||||
{ Init(); }
|
||||
|
||||
inline wxTopLevelWindowCocoa(wxWindow *parent,
|
||||
wxWindowID winid,
|
||||
const wxString& title,
|
||||
const wxPoint& pos = wxDefaultPosition,
|
||||
const wxSize& size = wxDefaultSize,
|
||||
long style = wxDEFAULT_FRAME_STYLE,
|
||||
const wxString& name = wxFrameNameStr)
|
||||
: wxCocoaNSWindow(this)
|
||||
{
|
||||
Init();
|
||||
Create(parent, winid, title, pos, size, style, name);
|
||||
}
|
||||
|
||||
bool Create(wxWindow *parent,
|
||||
wxWindowID winid,
|
||||
const wxString& title,
|
||||
const wxPoint& pos = wxDefaultPosition,
|
||||
const wxSize& size = wxDefaultSize,
|
||||
long style = wxDEFAULT_FRAME_STYLE,
|
||||
const wxString& name = wxFrameNameStr);
|
||||
|
||||
virtual ~wxTopLevelWindowCocoa();
|
||||
|
||||
protected:
|
||||
// common part of all ctors
|
||||
void Init();
|
||||
|
||||
// ------------------------------------------------------------------------
|
||||
// Cocoa specifics
|
||||
// ------------------------------------------------------------------------
|
||||
public:
|
||||
inline WX_NSWindow GetNSWindow() { return m_cocoaNSWindow; }
|
||||
virtual void CocoaDelegate_windowWillClose(void);
|
||||
virtual bool CocoaDelegate_windowShouldClose(void);
|
||||
virtual void CocoaDelegate_windowDidBecomeKey(void);
|
||||
virtual void CocoaDelegate_windowDidResignKey(void);
|
||||
virtual void CocoaDelegate_windowDidBecomeMain(void);
|
||||
virtual void CocoaDelegate_windowDidResignMain(void);
|
||||
virtual void CocoaDelegate_wxMenuItemAction(WX_NSMenuItem sender);
|
||||
virtual bool CocoaDelegate_validateMenuItem(WX_NSMenuItem sender);
|
||||
virtual wxMenuBar* GetAppMenuBar(wxCocoaNSWindow *win);
|
||||
static void DeactivatePendingWindow();
|
||||
protected:
|
||||
void SetNSWindow(WX_NSWindow cocoaNSWindow);
|
||||
WX_NSWindow m_cocoaNSWindow;
|
||||
static wxCocoaNSWindowHash sm_cocoaHash;
|
||||
virtual void CocoaReplaceView(WX_NSView oldView, WX_NSView newView);
|
||||
static unsigned int NSWindowStyleForWxStyle(long style);
|
||||
static NSRect MakeInitialNSWindowContentRect(const wxPoint& pos, const wxSize& size, unsigned int cocoaStyleMask);
|
||||
|
||||
static wxTopLevelWindowCocoa *sm_cocoaDeactivateWindow;
|
||||
// ------------------------------------------------------------------------
|
||||
// Implementation
|
||||
// ------------------------------------------------------------------------
|
||||
public:
|
||||
virtual bool Destroy();
|
||||
// Pure virtuals
|
||||
virtual void Maximize(bool maximize = true);
|
||||
virtual bool IsMaximized() const;
|
||||
virtual void Iconize(bool iconize = true);
|
||||
virtual bool IsIconized() const;
|
||||
virtual void Restore();
|
||||
virtual bool ShowFullScreen(bool show, long style = wxFULLSCREEN_ALL);
|
||||
virtual bool IsFullScreen() const;
|
||||
// other
|
||||
virtual bool Show( bool show = true );
|
||||
virtual bool Close( bool force = false );
|
||||
virtual void OnCloseWindow(wxCloseEvent& event);
|
||||
virtual void CocoaSetWxWindowSize(int width, int height);
|
||||
virtual void DoMoveWindow(int x, int y, int width, int height);
|
||||
virtual void DoGetSize(int *width, int *height) const;
|
||||
virtual void DoGetPosition(int *x, int *y) const;
|
||||
virtual void SetTitle( const wxString& title);
|
||||
virtual wxString GetTitle() const;
|
||||
|
||||
// Default button (item)
|
||||
wxWindow *SetDefaultItem(wxWindow *win);
|
||||
|
||||
// Things I may/may not do
|
||||
// virtual void SetIcons(const wxIconBundle& icons);
|
||||
// virtual void Clear() ;
|
||||
// virtual void Raise();
|
||||
// virtual void Lower();
|
||||
protected:
|
||||
// is the frame currently iconized?
|
||||
bool m_iconized;
|
||||
// has the frame been closed
|
||||
bool m_closed;
|
||||
// should the frame be maximized when it will be shown? set by Maximize()
|
||||
// when it is called while the frame is hidden
|
||||
bool m_maximizeOnShow;
|
||||
};
|
||||
|
||||
// list of all frames and modeless dialogs
|
||||
extern WXDLLIMPEXP_DATA_CORE(wxWindowList) wxModelessWindows;
|
||||
|
||||
#endif // __WX_COCOA_TOPLEVEL_H__
|
@@ -1,40 +0,0 @@
|
||||
/////////////////////////////////////////////////////////////////////////////
|
||||
// Name: wx/cocoa/trackingrectmanager.h
|
||||
// Purpose: wxCocoaTrackingRectManager
|
||||
// Notes: Source in window.mm
|
||||
// Author: David Elliott <dfe@cox.net>
|
||||
// Modified by:
|
||||
// Created: 2007/05/02
|
||||
// Copyright: (c) 2007 Software 2000 Ltd.
|
||||
// Licence: wxWindows licence
|
||||
/////////////////////////////////////////////////////////////////////////////
|
||||
#ifndef __WX_COCOA_TRACKINGRECTMANAGER_H__
|
||||
#define __WX_COCOA_TRACKINGRECTMANAGER_H__
|
||||
|
||||
#include <CoreFoundation/CFRunLoop.h>
|
||||
|
||||
#define wxTRACE_COCOA_TrackingRect wxT("COCOA_TrackingRect")
|
||||
|
||||
class wxCocoaTrackingRectManager
|
||||
{
|
||||
wxDECLARE_NO_COPY_CLASS(wxCocoaTrackingRectManager);
|
||||
public:
|
||||
wxCocoaTrackingRectManager(wxWindow *window);
|
||||
void ClearTrackingRect();
|
||||
void BuildTrackingRect();
|
||||
void RebuildTrackingRectIfNeeded();
|
||||
void RebuildTrackingRect();
|
||||
bool IsOwnerOfEvent(NSEvent *anEvent);
|
||||
~wxCocoaTrackingRectManager();
|
||||
void BeginSynthesizingEvents();
|
||||
void StopSynthesizingEvents();
|
||||
protected:
|
||||
wxWindow *m_window;
|
||||
bool m_isTrackingRectActive;
|
||||
NSInteger m_trackingRectTag;
|
||||
NSRect m_trackingRectInWindowCoordinates;
|
||||
private:
|
||||
wxCocoaTrackingRectManager();
|
||||
};
|
||||
|
||||
#endif // ndef __WX_COCOA_TRACKINGRECTMANAGER_H__
|
@@ -1,226 +0,0 @@
|
||||
/////////////////////////////////////////////////////////////////////////////
|
||||
// Name: wx/cocoa/window.h
|
||||
// Purpose: wxWindowCocoa
|
||||
// Author: David Elliott
|
||||
// Modified by:
|
||||
// Created: 2002/12/26
|
||||
// Copyright: (c) 2002 David Elliott
|
||||
// Licence: wxWindows licence
|
||||
/////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
#ifndef __WX_COCOA_WINDOW_H__
|
||||
#define __WX_COCOA_WINDOW_H__
|
||||
|
||||
#include "wx/cocoa/NSView.h"
|
||||
|
||||
#ifdef __OBJC__
|
||||
#import <Foundation/NSGeometry.h>
|
||||
#endif //def __OBJC__
|
||||
|
||||
// We can only import Foundation/NSGeometry.h from Objective-C code but it's
|
||||
// nice to be able to use NSPoint and NSRect in the declarations of helper
|
||||
// methods so we must define them as opaque structs identically to the way
|
||||
// they are defined by the real header.
|
||||
// NOTE: We specifically use these regardless of C++ or Objective-C++ mode so
|
||||
// the compiler will complain if we got the definitions wrong. In regular
|
||||
// C++ mode there is no way to know if we got the definitons right so
|
||||
// we depend on at least one Objective-C++ file including this header.
|
||||
#if defined(__LP64__) || defined(NS_BUILD_32_LIKE_64)
|
||||
typedef struct CGPoint NSPoint;
|
||||
typedef struct CGRect NSRect;
|
||||
#else
|
||||
typedef struct _NSPoint NSPoint;
|
||||
typedef struct _NSRect NSRect;
|
||||
#endif
|
||||
|
||||
DECLARE_WXCOCOA_OBJC_CLASS(NSAffineTransform);
|
||||
|
||||
class wxWindowCocoaHider;
|
||||
class wxWindowCocoaScrollView;
|
||||
class wxCocoaTrackingRectManager;
|
||||
|
||||
// ========================================================================
|
||||
// wxWindowCocoa
|
||||
// ========================================================================
|
||||
class WXDLLIMPEXP_CORE wxWindowCocoa: public wxWindowBase, protected wxCocoaNSView
|
||||
{
|
||||
DECLARE_DYNAMIC_CLASS(wxWindowCocoa)
|
||||
wxDECLARE_NO_COPY_CLASS(wxWindowCocoa);
|
||||
DECLARE_EVENT_TABLE()
|
||||
friend wxWindow *wxWindowBase::GetCapture();
|
||||
friend class wxWindowCocoaScrollView;
|
||||
friend class wxCocoaTrackingRectManager;
|
||||
// ------------------------------------------------------------------------
|
||||
// initialization
|
||||
// ------------------------------------------------------------------------
|
||||
public:
|
||||
wxWindowCocoa() { Init(); }
|
||||
inline wxWindowCocoa(wxWindow *parent, wxWindowID winid,
|
||||
const wxPoint& pos = wxDefaultPosition,
|
||||
const wxSize& size = wxDefaultSize,
|
||||
long style = 0,
|
||||
const wxString& name = wxPanelNameStr)
|
||||
{
|
||||
Init();
|
||||
Create(parent, winid, pos, size, style, name);
|
||||
}
|
||||
|
||||
virtual ~wxWindowCocoa();
|
||||
|
||||
bool Create(wxWindow *parent, wxWindowID winid,
|
||||
const wxPoint& pos = wxDefaultPosition,
|
||||
const wxSize& size = wxDefaultSize,
|
||||
long style = 0,
|
||||
const wxString& name = wxPanelNameStr);
|
||||
protected:
|
||||
void Init();
|
||||
// ------------------------------------------------------------------------
|
||||
// Cocoa specifics
|
||||
// ------------------------------------------------------------------------
|
||||
public:
|
||||
// Returns the content NSView (where children are added, drawing performed)
|
||||
inline WX_NSView GetNSView() { return m_cocoaNSView; }
|
||||
// Returns the NSView suitable for use as a subview
|
||||
WX_NSView GetNSViewForSuperview() const;
|
||||
// Returns the NSView that may be hidden/is being hidden
|
||||
WX_NSView GetNSViewForHiding() const;
|
||||
// Returns the NSView for non-client drawing
|
||||
virtual WX_NSView GetNonClientNSView() { return GetNSViewForSuperview(); }
|
||||
// Add/remove children
|
||||
void CocoaAddChild(wxWindowCocoa *child);
|
||||
void CocoaRemoveFromParent(void);
|
||||
#ifdef __OBJC__
|
||||
// Returns an autoreleased NSAffineTransform which can be applied
|
||||
// to a graphics context currently using the view's coordinate system
|
||||
// (such as the one locked when drawRect is called or after a call
|
||||
// to [NSView lockFocus]) such that further drawing is done using
|
||||
// the wxWidgets coordinate system.
|
||||
WX_NSAffineTransform CocoaGetWxToBoundsTransform();
|
||||
#endif //def __OBJC__
|
||||
protected:
|
||||
// actually enable/disable the cocoa control, overridden by subclasses
|
||||
virtual void CocoaSetEnabled(bool WXUNUSED(enable)) { }
|
||||
|
||||
void CocoaCreateNSScrollView();
|
||||
void InitMouseEvent(wxMouseEvent &event, WX_NSEvent cocoaEvent);
|
||||
virtual wxWindow* GetWxWindow() const;
|
||||
virtual void Cocoa_FrameChanged(void);
|
||||
virtual void Cocoa_synthesizeMouseMoved(void);
|
||||
virtual bool Cocoa_drawRect(const NSRect &rect);
|
||||
virtual bool Cocoa_mouseDown(WX_NSEvent theEvent);
|
||||
virtual bool Cocoa_mouseDragged(WX_NSEvent theEvent);
|
||||
virtual bool Cocoa_mouseUp(WX_NSEvent theEvent);
|
||||
virtual bool Cocoa_mouseMoved(WX_NSEvent theEvent);
|
||||
virtual bool Cocoa_mouseEntered(WX_NSEvent theEvent);
|
||||
virtual bool Cocoa_mouseExited(WX_NSEvent theEvent);
|
||||
virtual bool Cocoa_rightMouseDown(WX_NSEvent theEvent);
|
||||
virtual bool Cocoa_rightMouseDragged(WX_NSEvent theEvent);
|
||||
virtual bool Cocoa_rightMouseUp(WX_NSEvent theEvent);
|
||||
virtual bool Cocoa_otherMouseDown(WX_NSEvent theEvent);
|
||||
virtual bool Cocoa_otherMouseDragged(WX_NSEvent theEvent);
|
||||
virtual bool Cocoa_otherMouseUp(WX_NSEvent theEvent);
|
||||
virtual bool Cocoa_resetCursorRects();
|
||||
virtual bool Cocoa_viewDidMoveToWindow();
|
||||
virtual bool Cocoa_viewWillMoveToWindow(WX_NSWindow newWindow);
|
||||
void SetNSView(WX_NSView cocoaNSView);
|
||||
WX_NSView m_cocoaNSView;
|
||||
wxWindowCocoaHider *m_cocoaHider;
|
||||
wxWindowCocoaScrollView *m_wxCocoaScrollView;
|
||||
bool m_isInPaint;
|
||||
wxCocoaTrackingRectManager *m_visibleTrackingRectManager;
|
||||
static wxWindow *sm_capturedWindow;
|
||||
virtual void CocoaReplaceView(WX_NSView oldView, WX_NSView newView);
|
||||
void SetInitialFrameRect(const wxPoint& pos, const wxSize& size);
|
||||
#ifdef __OBJC__
|
||||
inline NSRect MakeDefaultNSRect(const wxSize& size)
|
||||
{
|
||||
// NOTE: position is 10,10 to make it "obvious" that it's out of place
|
||||
return NSMakeRect(10.0,10.0,WidthDefault(size.x),HeightDefault(size.y));
|
||||
}
|
||||
// These functions translate NSPoint or NSRect between the coordinate
|
||||
// system of Cocoa's boudns rect and wx's coordinate system.
|
||||
NSPoint CocoaTransformBoundsToWx(NSPoint pointBounds);
|
||||
NSRect CocoaTransformBoundsToWx(NSRect rectBounds);
|
||||
NSPoint CocoaTransformWxToBounds(NSPoint pointWx);
|
||||
NSRect CocoaTransformWxToBounds(NSRect rectWx);
|
||||
#endif //def __OBJC__
|
||||
static wxPoint OriginInWxDisplayCoordinatesForRectInCocoaScreenCoordinates(NSRect windowFrame);
|
||||
static NSPoint OriginInCocoaScreenCoordinatesForRectInWxDisplayCoordinates(wxCoord x, wxCoord y, wxCoord width, wxCoord height, bool keepOriginVisible);
|
||||
// ------------------------------------------------------------------------
|
||||
// Implementation
|
||||
// ------------------------------------------------------------------------
|
||||
public:
|
||||
/* Pure Virtuals */
|
||||
// Raise the window to the top of the Z order
|
||||
virtual void Raise();
|
||||
// Lower the window to the bottom of the Z order
|
||||
virtual void Lower();
|
||||
// Set the focus to this window
|
||||
virtual void SetFocus();
|
||||
// Warp the pointer the given position
|
||||
virtual void WarpPointer(int x_pos, int y_pos) ;
|
||||
// Change the window's cursor
|
||||
virtual bool SetCursor( const wxCursor &cursor );
|
||||
// Send the window a refresh event
|
||||
virtual void Refresh(bool eraseBack = true, const wxRect *rect = NULL);
|
||||
// Set/get the window's font
|
||||
virtual bool SetFont(const wxFont& f);
|
||||
// inline virtual wxFont& GetFont() const;
|
||||
virtual void SetLabel(const wxString& label);
|
||||
virtual wxString GetLabel() const;
|
||||
// label handling
|
||||
// Get character size
|
||||
virtual int GetCharHeight() const;
|
||||
virtual int GetCharWidth() const;
|
||||
virtual void DoGetTextExtent(const wxString& string, int *x, int *y,
|
||||
int *descent = NULL,
|
||||
int *externalLeading = NULL,
|
||||
const wxFont *theFont = NULL) const;
|
||||
// Scroll stuff
|
||||
virtual void SetScrollbar(int orient, int pos, int thumbVisible,
|
||||
int range, bool refresh = true);
|
||||
virtual void SetScrollPos(int orient, int pos, bool refresh = true);
|
||||
virtual int GetScrollPos(int orient) const;
|
||||
virtual int GetScrollThumb(int orient) const;
|
||||
virtual int GetScrollRange(int orient) const;
|
||||
virtual void ScrollWindow(int dx, int dy, const wxRect *rect = NULL);
|
||||
virtual void DoSetVirtualSize(int x, int y);
|
||||
// Get the private handle (platform-dependent)
|
||||
virtual WXWidget GetHandle() const;
|
||||
// Convert client to screen coordinates
|
||||
virtual void DoClientToScreen(int *x, int *y) const;
|
||||
// Convert screen to client coordinates
|
||||
virtual void DoScreenToClient(int *x, int *y) const;
|
||||
// Capture/release mouse
|
||||
virtual void DoCaptureMouse();
|
||||
virtual void DoReleaseMouse();
|
||||
// Get window position, relative to parent (or screen if no parent)
|
||||
virtual void DoGetPosition(int *x, int *y) const;
|
||||
// Get overall window size
|
||||
virtual void DoGetSize(int *width, int *height) const;
|
||||
// Get/set client (application-useable) size
|
||||
virtual void DoGetClientSize(int *width, int *height) const;
|
||||
virtual void DoSetClientSize(int width, int size);
|
||||
// Set this window's tooltip
|
||||
virtual void DoSetToolTip( wxToolTip *tip );
|
||||
// Set the size of the wxWindow (the contentView of an NSWindow)
|
||||
// wxTopLevelWindow will override this and set the NSWindow size
|
||||
// such that the contentView will be this size
|
||||
virtual void CocoaSetWxWindowSize(int width, int height);
|
||||
// Set overall size and position
|
||||
virtual void DoSetSize(int x, int y, int width, int height, int sizeFlags = wxSIZE_AUTO);
|
||||
virtual void DoMoveWindow(int x, int y, int width, int height);
|
||||
// Popup a menu
|
||||
virtual bool DoPopupMenu(wxMenu *menu, int x, int y);
|
||||
|
||||
/* Other implementation */
|
||||
|
||||
// NOTE: typically Close() is not virtual, but we want this for Cocoa
|
||||
virtual bool Close( bool force = false );
|
||||
virtual bool Show( bool show = true );
|
||||
virtual void DoEnable( bool enable );
|
||||
|
||||
virtual bool IsDoubleBuffered() const { return true; }
|
||||
};
|
||||
|
||||
#endif // __WX_COCOA_WINDOW_H__
|
@@ -1,29 +0,0 @@
|
||||
/////////////////////////////////////////////////////////////////////////////
|
||||
// Name: src/cocoa/NSBox.mm
|
||||
// Purpose: wxCocoaNSBox
|
||||
// Author: David Elliott
|
||||
// Modified by:
|
||||
// Created: 2003/03/19
|
||||
// Copyright: (c) 2003 David Elliott
|
||||
// Licence: wxWindows licence
|
||||
/////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
// ============================================================================
|
||||
// declarations
|
||||
// ============================================================================
|
||||
|
||||
// ----------------------------------------------------------------------------
|
||||
// headers
|
||||
// ----------------------------------------------------------------------------
|
||||
|
||||
#include "wx/wxprec.h"
|
||||
#ifndef WX_PRECOMP
|
||||
#endif // WX_PRECOMP
|
||||
|
||||
#include "wx/cocoa/NSBox.h"
|
||||
|
||||
// ----------------------------------------------------------------------------
|
||||
// globals
|
||||
// ----------------------------------------------------------------------------
|
||||
WX_IMPLEMENT_OBJC_INTERFACE(NSBox)
|
||||
|
@@ -1,69 +0,0 @@
|
||||
/////////////////////////////////////////////////////////////////////////////
|
||||
// Name: src/cocoa/NSButton.mm
|
||||
// Purpose: wxCocoaNSButton
|
||||
// Author: David Elliott
|
||||
// Modified by:
|
||||
// Created: 2003/01/31
|
||||
// Copyright: (c) 2003-2004 David Elliott
|
||||
// Licence: wxWindows licence
|
||||
/////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
// ============================================================================
|
||||
// declarations
|
||||
// ============================================================================
|
||||
|
||||
// ----------------------------------------------------------------------------
|
||||
// headers
|
||||
// ----------------------------------------------------------------------------
|
||||
|
||||
#include "wx/wxprec.h"
|
||||
#ifndef WX_PRECOMP
|
||||
#include "wx/log.h"
|
||||
#endif // WX_PRECOMP
|
||||
|
||||
#include "wx/cocoa/objc/objc_uniquifying.h"
|
||||
#include "wx/cocoa/NSButton.h"
|
||||
#import <AppKit/NSButton.h>
|
||||
|
||||
// ----------------------------------------------------------------------------
|
||||
// globals
|
||||
// ----------------------------------------------------------------------------
|
||||
WX_IMPLEMENT_OBJC_INTERFACE_HASHMAP(NSButton)
|
||||
|
||||
// ============================================================================
|
||||
// @class wxNSButtonTarget
|
||||
// ============================================================================
|
||||
@interface wxNSButtonTarget : NSObject
|
||||
{
|
||||
}
|
||||
|
||||
- (void)wxNSButtonAction: (id)sender;
|
||||
@end // wxNSButtonTarget
|
||||
WX_DECLARE_GET_OBJC_CLASS(wxNSButtonTarget,NSObject)
|
||||
|
||||
@implementation wxNSButtonTarget : NSObject
|
||||
- (void)wxNSButtonAction: (id)sender
|
||||
{
|
||||
wxCocoaNSButton *button = wxCocoaNSButton::GetFromCocoa(sender);
|
||||
wxCHECK_RET(button,wxT("wxNSButtonAction received without associated wx object"));
|
||||
button->Cocoa_wxNSButtonAction();
|
||||
}
|
||||
|
||||
@end // implementation wxNSButtonTarget
|
||||
WX_IMPLEMENT_GET_OBJC_CLASS(wxNSButtonTarget,NSObject)
|
||||
|
||||
// ============================================================================
|
||||
// class wxCocoaNSButton
|
||||
// ============================================================================
|
||||
const wxObjcAutoRefFromAlloc<struct objc_object*> wxCocoaNSButton::sm_cocoaTarget = [[WX_GET_OBJC_CLASS(wxNSButtonTarget) alloc] init];
|
||||
|
||||
void wxCocoaNSButton::AssociateNSButton(WX_NSButton cocoaNSButton)
|
||||
{
|
||||
if(cocoaNSButton)
|
||||
{
|
||||
sm_cocoaHash.insert(wxCocoaNSButtonHash::value_type(cocoaNSButton,this));
|
||||
[cocoaNSButton setTarget: sm_cocoaTarget];
|
||||
[cocoaNSButton setAction: @selector(wxNSButtonAction:)];
|
||||
}
|
||||
}
|
||||
|
@@ -1,63 +0,0 @@
|
||||
/////////////////////////////////////////////////////////////////////////////
|
||||
// Name: src/cocoa/NSControl.mm
|
||||
// Purpose: wxCocoaNSControl
|
||||
// Author: David Elliott
|
||||
// Modified by:
|
||||
// Created: 2003/02/15
|
||||
// Copyright: (c) 2003 David Elliott
|
||||
// Licence: wxWindows licence
|
||||
/////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
// ============================================================================
|
||||
// declarations
|
||||
// ============================================================================
|
||||
|
||||
// ----------------------------------------------------------------------------
|
||||
// headers
|
||||
// ----------------------------------------------------------------------------
|
||||
|
||||
#include "wx/wxprec.h"
|
||||
#ifndef WX_PRECOMP
|
||||
#include "wx/log.h"
|
||||
#endif // WX_PRECOMP
|
||||
|
||||
#include "wx/cocoa/objc/objc_uniquifying.h"
|
||||
#include "wx/cocoa/ObjcRef.h"
|
||||
#include "wx/cocoa/NSControl.h"
|
||||
|
||||
#import <Foundation/NSObject.h>
|
||||
|
||||
// ============================================================================
|
||||
// @class wxNSControlTarget
|
||||
// ============================================================================
|
||||
@interface wxNSControlTarget : NSObject
|
||||
{
|
||||
}
|
||||
|
||||
- (void)wxNSControlAction: (id)sender;
|
||||
@end //interface wxNSControlTarget
|
||||
WX_DECLARE_GET_OBJC_CLASS(wxNSControlTarget,NSObject)
|
||||
|
||||
@implementation wxNSControlTarget : NSObject
|
||||
|
||||
- (void)wxNSControlAction: (id)sender
|
||||
{
|
||||
wxLogTrace(wxTRACE_COCOA,wxT("wxNSControlAction"));
|
||||
wxCocoaNSControl *wxcontrol = wxCocoaNSControl::GetFromCocoa(sender);
|
||||
wxCHECK_RET(wxcontrol,wxT("wxNSControlAction received but no wxCocoaNSControl exists!"));
|
||||
wxcontrol->CocoaTarget_action();
|
||||
}
|
||||
|
||||
@end //implementation wxNSControlTarget
|
||||
WX_IMPLEMENT_GET_OBJC_CLASS(wxNSControlTarget,NSObject)
|
||||
|
||||
// ============================================================================
|
||||
// wxNSControl
|
||||
// ============================================================================
|
||||
WX_IMPLEMENT_OBJC_INTERFACE(NSControl)
|
||||
|
||||
// New CF-retained observer (this should have been using wxObjcAutoRefFromAlloc to begin with)
|
||||
wxObjcAutoRefFromAlloc<wxNSControlTarget*> s_cocoaNSControlTarget = [[WX_GET_OBJC_CLASS(wxNSControlTarget) alloc] init];
|
||||
// For compatibility with old code
|
||||
struct objc_object *wxCocoaNSControl::sm_cocoaTarget = s_cocoaNSControlTarget;
|
||||
|
@@ -1,136 +0,0 @@
|
||||
/////////////////////////////////////////////////////////////////////////////
|
||||
// Name: src/cocoa/NSMenu.mm
|
||||
// Purpose: wxCocoaNSMenu implementation
|
||||
// Author: David Elliott
|
||||
// Modified by:
|
||||
// Created: 2002/12/09
|
||||
// Copyright: (c) 2002 David Elliott
|
||||
// Licence: wxWindows licence
|
||||
/////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
#include "wx/wxprec.h"
|
||||
#if wxUSE_MENUS
|
||||
#ifndef WX_PRECOMP
|
||||
#include "wx/log.h"
|
||||
#endif // WX_PRECOMP
|
||||
|
||||
#include "wx/cocoa/ObjcRef.h"
|
||||
#include "wx/cocoa/NSMenu.h"
|
||||
|
||||
#import <Foundation/NSNotification.h>
|
||||
#include "wx/cocoa/objc/NSMenu.h"
|
||||
|
||||
// ============================================================================
|
||||
// @class WXNSMenu
|
||||
// ============================================================================
|
||||
|
||||
@implementation WXNSMenu : NSMenu
|
||||
|
||||
- (void)dealloc
|
||||
{
|
||||
wxCocoaNSMenu *menu = wxCocoaNSMenu::GetFromCocoa(self);
|
||||
if(menu)
|
||||
menu->Cocoa_dealloc();
|
||||
[super dealloc];
|
||||
}
|
||||
|
||||
@end // WXNSMenu
|
||||
WX_IMPLEMENT_GET_OBJC_CLASS(WXNSMenu,NSMenu)
|
||||
|
||||
// ============================================================================
|
||||
// @class wxNSMenuNotificationObserver
|
||||
// ============================================================================
|
||||
@interface wxNSMenuNotificationObserver : NSObject
|
||||
{
|
||||
}
|
||||
|
||||
- (void)menuDidAddItem: (NSNotification *)notification;
|
||||
- (void)menuDidChangeItem: (NSNotification *)notification;
|
||||
- (void)menuDidRemoveItem: (NSNotification *)notification;
|
||||
- (void)menuDidSendAction: (NSNotification *)notification;
|
||||
- (void)menuWillSendAction: (NSNotification *)notification;
|
||||
@end // interface wxNSMenuNotificationObserver
|
||||
WX_DECLARE_GET_OBJC_CLASS(wxNSMenuNotificationObserver,NSObject)
|
||||
|
||||
@implementation wxNSMenuNotificationObserver : NSObject
|
||||
|
||||
- (void)menuDidAddItem: (NSNotification *)notification
|
||||
{
|
||||
wxCocoaNSMenu *menu = wxCocoaNSMenu::GetFromCocoa([notification object]);
|
||||
wxCHECK_RET(menu,wxT("menuDidAddItem received but no wxMenu exists"));
|
||||
menu->CocoaNotification_menuDidAddItem(notification);
|
||||
}
|
||||
|
||||
- (void)menuDidChangeItem: (NSNotification *)notification
|
||||
{
|
||||
wxCocoaNSMenu *menu = wxCocoaNSMenu::GetFromCocoa([notification object]);
|
||||
wxCHECK_RET(menu,wxT("menuDidChangeItem received but no wxMenu exists"));
|
||||
menu->CocoaNotification_menuDidChangeItem(notification);
|
||||
}
|
||||
|
||||
- (void)menuDidRemoveItem: (NSNotification *)notification
|
||||
{
|
||||
wxCocoaNSMenu *menu = wxCocoaNSMenu::GetFromCocoa([notification object]);
|
||||
wxCHECK_RET(menu,wxT("menuDidRemoveItem received but no wxMenu exists"));
|
||||
menu->CocoaNotification_menuDidRemoveItem(notification);
|
||||
}
|
||||
|
||||
- (void)menuDidSendAction: (NSNotification *)notification
|
||||
{
|
||||
wxCocoaNSMenu *menu = wxCocoaNSMenu::GetFromCocoa([notification object]);
|
||||
wxCHECK_RET(menu,wxT("menuDidSendAction received but no wxMenu exists"));
|
||||
menu->CocoaNotification_menuDidSendAction(notification);
|
||||
}
|
||||
|
||||
- (void)menuWillSendAction: (NSNotification *)notification
|
||||
{
|
||||
wxCocoaNSMenu *menu = wxCocoaNSMenu::GetFromCocoa([notification object]);
|
||||
wxCHECK_RET(menu,wxT("menuWillSendAction received but no wxMenu exists"));
|
||||
menu->CocoaNotification_menuWillSendAction(notification);
|
||||
}
|
||||
|
||||
@end // implementation wxNSMenuNotificationObserver
|
||||
WX_IMPLEMENT_GET_OBJC_CLASS(wxNSMenuNotificationObserver,NSObject)
|
||||
|
||||
// ========================================================================
|
||||
// wxCocoaNSMenu
|
||||
// ========================================================================
|
||||
WX_IMPLEMENT_OBJC_INTERFACE_HASHMAP(NSMenu)
|
||||
|
||||
// New CF-retained observer (this should have been using wxObjcAutoRefFromAlloc to begin with)
|
||||
static wxObjcAutoRefFromAlloc<wxNSMenuNotificationObserver*> s_cocoaNSMenuObserver([[WX_GET_OBJC_CLASS(wxNSMenuNotificationObserver) alloc] init]);
|
||||
// For compatibility with old code
|
||||
struct objc_object *wxCocoaNSMenu::sm_cocoaObserver = s_cocoaNSMenuObserver;
|
||||
|
||||
void wxCocoaNSMenu::AssociateNSMenu(WX_NSMenu cocoaNSMenu, unsigned int flags)
|
||||
{
|
||||
if(cocoaNSMenu)
|
||||
{
|
||||
sm_cocoaHash.insert(wxCocoaNSMenuHash::value_type(cocoaNSMenu,this));
|
||||
if(flags&OBSERVE_DidAddItem)
|
||||
[[NSNotificationCenter defaultCenter] addObserver:(id)sm_cocoaObserver selector:@selector(menuDidAddItem:) name:NSMenuDidAddItemNotification object:cocoaNSMenu];
|
||||
if(flags&OBSERVE_DidChangeItem)
|
||||
[[NSNotificationCenter defaultCenter] addObserver:(id)sm_cocoaObserver selector:@selector(menuDidChangeItem:) name:NSMenuDidChangeItemNotification object:cocoaNSMenu];
|
||||
if(flags&OBSERVE_DidRemoveItem)
|
||||
[[NSNotificationCenter defaultCenter] addObserver:(id)sm_cocoaObserver selector:@selector(menuDidRemoveItem:) name:NSMenuDidRemoveItemNotification object:cocoaNSMenu];
|
||||
if(flags&OBSERVE_DidSendAction)
|
||||
[[NSNotificationCenter defaultCenter] addObserver:(id)sm_cocoaObserver selector:@selector(menuDidSendAction:) name:NSMenuDidSendActionNotification object:cocoaNSMenu];
|
||||
if(flags&OBSERVE_WillSendAction)
|
||||
[[NSNotificationCenter defaultCenter] addObserver:(id)sm_cocoaObserver selector:@selector(menuWillSendAction:) name:NSMenuWillSendActionNotification object:cocoaNSMenu];
|
||||
}
|
||||
}
|
||||
|
||||
void wxCocoaNSMenu::DisassociateNSMenu(WX_NSMenu cocoaNSMenu)
|
||||
{
|
||||
if(cocoaNSMenu)
|
||||
{
|
||||
sm_cocoaHash.erase(cocoaNSMenu);
|
||||
[[NSNotificationCenter defaultCenter] removeObserver:(id)sm_cocoaObserver name:NSMenuDidAddItemNotification object:cocoaNSMenu];
|
||||
[[NSNotificationCenter defaultCenter] removeObserver:(id)sm_cocoaObserver name:NSMenuDidChangeItemNotification object:cocoaNSMenu];
|
||||
[[NSNotificationCenter defaultCenter] removeObserver:(id)sm_cocoaObserver name:NSMenuDidRemoveItemNotification object:cocoaNSMenu];
|
||||
[[NSNotificationCenter defaultCenter] removeObserver:(id)sm_cocoaObserver name:NSMenuDidSendActionNotification object:cocoaNSMenu];
|
||||
[[NSNotificationCenter defaultCenter] removeObserver:(id)sm_cocoaObserver name:NSMenuWillSendActionNotification object:cocoaNSMenu];
|
||||
}
|
||||
}
|
||||
|
||||
#endif // wxUSE_MENUS
|
@@ -1,31 +0,0 @@
|
||||
/////////////////////////////////////////////////////////////////////////////
|
||||
// Name: src/cocoa/NSPanel.mm
|
||||
// Purpose: wxCocoaNSPanel
|
||||
// Author: David Elliott
|
||||
// Modified by:
|
||||
// Created: 2003/03/16
|
||||
// Copyright: (c) 2003 David Elliott
|
||||
// Licence: wxWindows licence
|
||||
/////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
// ============================================================================
|
||||
// declarations
|
||||
// ============================================================================
|
||||
|
||||
// ----------------------------------------------------------------------------
|
||||
// headers
|
||||
// ----------------------------------------------------------------------------
|
||||
|
||||
#include "wx/wxprec.h"
|
||||
#ifndef WX_PRECOMP
|
||||
#include "wx/log.h"
|
||||
#endif // WX_PRECOMP
|
||||
|
||||
#include "wx/cocoa/NSPanel.h"
|
||||
|
||||
#import <AppKit/NSPanel.h>
|
||||
|
||||
// ----------------------------------------------------------------------------
|
||||
// globals
|
||||
// ----------------------------------------------------------------------------
|
||||
WX_IMPLEMENT_OBJC_INTERFACE_HASHMAP(NSPanel)
|
@@ -1,59 +0,0 @@
|
||||
/////////////////////////////////////////////////////////////////////////////
|
||||
// Name: src/cocoa/NSScroller.mm
|
||||
// Purpose: wxCocoaNSScroller
|
||||
// Author: David Elliott
|
||||
// Modified by:
|
||||
// Created: 2004/04/27
|
||||
// Copyright: (c) 2004 David Elliott
|
||||
// Licence: wxWindows licence
|
||||
/////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
#include "wx/wxprec.h"
|
||||
#ifndef WX_PRECOMP
|
||||
#include "wx/log.h"
|
||||
#endif // WX_PRECOMP
|
||||
|
||||
#include "wx/cocoa/objc/objc_uniquifying.h"
|
||||
|
||||
#include "wx/cocoa/NSScroller.h"
|
||||
#import <AppKit/NSScroller.h>
|
||||
|
||||
WX_IMPLEMENT_OBJC_INTERFACE_HASHMAP(NSScroller)
|
||||
|
||||
// ============================================================================
|
||||
// @class wxNSScrollerTarget
|
||||
// ============================================================================
|
||||
@interface wxNSScrollerTarget : NSObject
|
||||
{
|
||||
}
|
||||
|
||||
- (void)wxNSScrollerAction: (id)sender;
|
||||
@end // wxNSScrollerTarget
|
||||
WX_DECLARE_GET_OBJC_CLASS(wxNSScrollerTarget,NSObject)
|
||||
|
||||
@implementation wxNSScrollerTarget : NSObject
|
||||
- (void)wxNSScrollerAction: (id)sender
|
||||
{
|
||||
wxCocoaNSScroller *scroller = wxCocoaNSScroller::GetFromCocoa(sender);
|
||||
wxCHECK_RET(scroller,wxT("wxNSScrollerAction received without associated wx object"));
|
||||
scroller->Cocoa_wxNSScrollerAction();
|
||||
}
|
||||
|
||||
@end // implementation wxNSScrollerTarget
|
||||
WX_IMPLEMENT_GET_OBJC_CLASS(wxNSScrollerTarget,NSObject)
|
||||
|
||||
// ============================================================================
|
||||
// class wxCocoaNSScroller
|
||||
// ============================================================================
|
||||
const wxObjcAutoRefFromAlloc<struct objc_object*> wxCocoaNSScroller::sm_cocoaTarget = [[WX_GET_OBJC_CLASS(wxNSScrollerTarget) alloc] init];
|
||||
|
||||
void wxCocoaNSScroller::AssociateNSScroller(WX_NSScroller cocoaNSScroller)
|
||||
{
|
||||
if(cocoaNSScroller)
|
||||
{
|
||||
sm_cocoaHash.insert(wxCocoaNSScrollerHash::value_type(cocoaNSScroller,this));
|
||||
[cocoaNSScroller setTarget: sm_cocoaTarget];
|
||||
[cocoaNSScroller setAction: @selector(wxNSScrollerAction:)];
|
||||
}
|
||||
}
|
||||
|
@@ -1,168 +0,0 @@
|
||||
/////////////////////////////////////////////////////////////////////////////
|
||||
// Name: src/cocoa/NSSlider.mm
|
||||
// Purpose: wxCocoaNSSlider class
|
||||
// Author: Mark Oxenham
|
||||
// Modified by: David Elliott
|
||||
// Created: 2007/08/10
|
||||
// Copyright: (c) 2007 Software 2000 Ltd. All rights reserved.
|
||||
// Licence: wxWindows licence
|
||||
/////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
#include "wx/wxprec.h"
|
||||
|
||||
#ifndef WX_PRECOMP
|
||||
#include "wx/log.h"
|
||||
#endif // WX_PRECOMP
|
||||
|
||||
#include "wx/cocoa/NSSlider.h"
|
||||
|
||||
#import <Foundation/NSNotification.h>
|
||||
#import <Foundation/NSString.h>
|
||||
#import <AppKit/NSEvent.h>
|
||||
#include "wx/cocoa/objc/NSSlider.h"
|
||||
|
||||
WX_IMPLEMENT_OBJC_INTERFACE_HASHMAP(NSSlider)
|
||||
|
||||
class wxCocoaNSSliderLastSelectorChanger
|
||||
{
|
||||
public:
|
||||
wxCocoaNSSliderLastSelectorChanger(SEL newSelector)
|
||||
{
|
||||
m_savedResponderSelector = wxCocoaNSSlider::sm_lastResponderSelector;
|
||||
wxCocoaNSSlider::sm_lastResponderSelector = newSelector;
|
||||
}
|
||||
~wxCocoaNSSliderLastSelectorChanger()
|
||||
{
|
||||
wxCocoaNSSlider::sm_lastResponderSelector = m_savedResponderSelector;
|
||||
}
|
||||
private:
|
||||
SEL m_savedResponderSelector;
|
||||
// Don't allow any default or copy construction
|
||||
wxCocoaNSSliderLastSelectorChanger();
|
||||
wxCocoaNSSliderLastSelectorChanger(const wxCocoaNSSliderLastSelectorChanger&);
|
||||
void operator=(const wxCocoaNSSliderLastSelectorChanger&);
|
||||
};
|
||||
|
||||
// ============================================================================
|
||||
// @class WXNSSlider
|
||||
// ============================================================================
|
||||
|
||||
@implementation WXNSSlider : NSSlider
|
||||
|
||||
// Override to ensure that WXNSSlider gets created with a WXNSSliderCell
|
||||
+ (Class)cellClass
|
||||
{
|
||||
return [WX_GET_OBJC_CLASS(WXNSSliderCell) class];
|
||||
}
|
||||
|
||||
// The following methods are all NSResponder methods which NSSlider responds
|
||||
// to in order to change its state and send the action message. We override
|
||||
// them simply to record which one was called. This allows code listening
|
||||
// only for the action message to determine what caused the action.
|
||||
// Note that this is perfectly fine being a global because Cocoa processes
|
||||
// events synchronously and only in the main thread.
|
||||
|
||||
- (void)keyDown:(NSEvent *)theEvent
|
||||
{
|
||||
wxCocoaNSSliderLastSelectorChanger savedSelector(_cmd);
|
||||
[super keyDown:theEvent];
|
||||
}
|
||||
|
||||
- (void)moveUp:(id)sender
|
||||
{
|
||||
wxCocoaNSSliderLastSelectorChanger savedSelector(_cmd);
|
||||
[super moveUp:sender];
|
||||
}
|
||||
|
||||
- (void)moveDown:(id)sender
|
||||
{
|
||||
wxCocoaNSSliderLastSelectorChanger savedSelector(_cmd);
|
||||
[super moveDown:sender];
|
||||
}
|
||||
|
||||
- (void)moveLeft:(id)sender
|
||||
{
|
||||
wxCocoaNSSliderLastSelectorChanger savedSelector(_cmd);
|
||||
[super moveLeft:sender];
|
||||
}
|
||||
|
||||
- (void)moveRight:(id)sender
|
||||
{
|
||||
wxCocoaNSSliderLastSelectorChanger savedSelector(_cmd);
|
||||
[super moveRight:sender];
|
||||
}
|
||||
|
||||
- (void)pageUp:(id)sender
|
||||
{
|
||||
wxCocoaNSSliderLastSelectorChanger savedSelector(_cmd);
|
||||
[super pageUp:sender];
|
||||
}
|
||||
|
||||
- (void)pageDown:(id)sender
|
||||
{
|
||||
wxCocoaNSSliderLastSelectorChanger savedSelector(_cmd);
|
||||
[super pageDown:sender];
|
||||
}
|
||||
|
||||
@end
|
||||
WX_IMPLEMENT_GET_OBJC_CLASS(WXNSSlider,NSSlider)
|
||||
|
||||
// ============================================================================
|
||||
// @class WXNSSliderCell
|
||||
// ============================================================================
|
||||
|
||||
@implementation WXNSSliderCell : NSSliderCell
|
||||
- (BOOL)startTrackingAt:(NSPoint)startPoint inView:(NSView *)controlView
|
||||
{
|
||||
BOOL result = [super startTrackingAt:startPoint inView:controlView];
|
||||
|
||||
wxCocoaNSSlider *slider = wxCocoaNSSlider::GetFromCocoa(controlView);
|
||||
if(slider)
|
||||
slider->CocoaNotification_startTracking(NULL);
|
||||
|
||||
return result;
|
||||
}
|
||||
|
||||
- (BOOL)continueTracking:(NSPoint)lastPoint at:(NSPoint)currentPoint inView:(NSView *)controlView
|
||||
{
|
||||
BOOL result = [super continueTracking:lastPoint at:currentPoint inView:controlView];
|
||||
|
||||
wxCocoaNSSlider *slider = wxCocoaNSSlider::GetFromCocoa(controlView);
|
||||
if(slider)
|
||||
slider->CocoaNotification_continueTracking(NULL);
|
||||
|
||||
return result;
|
||||
}
|
||||
|
||||
- (void)stopTracking:(NSPoint)lastPoint at:(NSPoint)stopPoint inView:(NSView *)controlView mouseIsUp:(BOOL)flag
|
||||
{
|
||||
[super stopTracking:lastPoint at:stopPoint inView:controlView mouseIsUp:flag];
|
||||
|
||||
wxCocoaNSSlider *slider = wxCocoaNSSlider::GetFromCocoa(controlView);
|
||||
if(slider)
|
||||
slider->CocoaNotification_stopTracking(NULL);
|
||||
}
|
||||
@end
|
||||
WX_IMPLEMENT_GET_OBJC_CLASS(WXNSSliderCell,NSSliderCell)
|
||||
|
||||
// ============================================================================
|
||||
// class wxCocoaNSSlider
|
||||
// ============================================================================
|
||||
|
||||
SEL wxCocoaNSSlider::sm_lastResponderSelector;
|
||||
|
||||
void wxCocoaNSSlider::AssociateNSSlider(WX_NSSlider cocoaNSSlider)
|
||||
{
|
||||
if(cocoaNSSlider)
|
||||
{
|
||||
sm_cocoaHash.insert(wxCocoaNSSliderHash::value_type(cocoaNSSlider,this));
|
||||
}
|
||||
}
|
||||
|
||||
void wxCocoaNSSlider::DisassociateNSSlider(WX_NSSlider cocoaNSSlider)
|
||||
{
|
||||
if(cocoaNSSlider)
|
||||
{
|
||||
sm_cocoaHash.erase(cocoaNSSlider);
|
||||
}
|
||||
}
|
@@ -1,76 +0,0 @@
|
||||
/////////////////////////////////////////////////////////////////////////////
|
||||
// Name: src/cocoa/NSTabView.mm
|
||||
// Purpose: wxCocoaNSTabView
|
||||
// Author: David Elliott
|
||||
// Modified by:
|
||||
// Created: 2004/04/08
|
||||
// Copyright: (c) 2004 David Elliott
|
||||
// Licence: wxWindows licence
|
||||
/////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
#include "wx/wxprec.h"
|
||||
#ifndef WX_PRECOMP
|
||||
#endif // WX_PRECOMP
|
||||
|
||||
#include "wx/cocoa/NSTabView.h"
|
||||
|
||||
#include "wx/cocoa/objc/objc_uniquifying.h"
|
||||
|
||||
#include <AppKit/NSTabView.h>
|
||||
|
||||
// ============================================================================
|
||||
// @class wxNSTabViewDelegate
|
||||
// ============================================================================
|
||||
@interface wxNSTabViewDelegate : NSObject
|
||||
{
|
||||
}
|
||||
|
||||
- (void)tabView:(NSTabView*)tabView didSelectTabViewItem:(NSTabViewItem*)tabViewItem;
|
||||
- (BOOL)tabView:(NSTabView*)tabView shouldSelectTabViewItem:(NSTabViewItem*)tabViewItem;
|
||||
@end // interface wxNSTabViewDelegate : NSObject
|
||||
WX_DECLARE_GET_OBJC_CLASS(wxNSTabViewDelegate,NSObject)
|
||||
|
||||
@implementation wxNSTabViewDelegate : NSObject
|
||||
- (void)tabView:(NSTabView*)tabView didSelectTabViewItem:(NSTabViewItem*)tabViewItem
|
||||
{
|
||||
wxCocoaNSTabView *notebook = wxCocoaNSTabView::GetFromCocoa(tabView);
|
||||
wxCHECK_RET(notebook, wxT("This delegate is for use only with wxCocoa NSTabViews"));
|
||||
notebook->CocoaDelegate_tabView_didSelectTabViewItem(tabViewItem);
|
||||
|
||||
}
|
||||
|
||||
- (BOOL)tabView:(NSTabView*)tabView shouldSelectTabViewItem:(NSTabViewItem*)tabViewItem
|
||||
{
|
||||
wxCocoaNSTabView *notebook = wxCocoaNSTabView::GetFromCocoa(tabView);
|
||||
wxCHECK_MSG(notebook, true, wxT("This delegate is for use only with wxCocoa NSTabViews"));
|
||||
return notebook->CocoaDelegate_tabView_shouldSelectTabViewItem(tabViewItem);
|
||||
}
|
||||
|
||||
@end // implementation wxNSTabViewDelegate : NSObject
|
||||
WX_IMPLEMENT_GET_OBJC_CLASS(wxNSTabViewDelegate,NSObject)
|
||||
|
||||
// ============================================================================
|
||||
// class wxCocoaNSTabView
|
||||
// ============================================================================
|
||||
WX_IMPLEMENT_OBJC_INTERFACE_HASHMAP(NSTabView)
|
||||
|
||||
wxObjcAutoRefFromAlloc<struct objc_object*> wxCocoaNSTabView::sm_cocoaDelegate = [[WX_GET_OBJC_CLASS(wxNSTabViewDelegate) alloc] init];
|
||||
|
||||
void wxCocoaNSTabView::AssociateNSTabView(WX_NSTabView cocoaNSTabView)
|
||||
{
|
||||
if(cocoaNSTabView)
|
||||
{
|
||||
sm_cocoaHash.insert(wxCocoaNSTabViewHash::value_type(cocoaNSTabView,this));
|
||||
[cocoaNSTabView setDelegate: sm_cocoaDelegate];
|
||||
}
|
||||
}
|
||||
|
||||
void wxCocoaNSTabView::DisassociateNSTabView(WX_NSTabView cocoaNSTabView)
|
||||
{
|
||||
if(cocoaNSTabView)
|
||||
{
|
||||
[cocoaNSTabView setDelegate: nil];
|
||||
sm_cocoaHash.erase(cocoaNSTabView);
|
||||
}
|
||||
}
|
||||
|
@@ -1,56 +0,0 @@
|
||||
/////////////////////////////////////////////////////////////////////////////
|
||||
// Name: src/cocoa/NSTableView.mm
|
||||
// Purpose: wxCocoaNSTableView / wxCocoaNSTableDataSource
|
||||
// Author: David Elliott
|
||||
// Modified by:
|
||||
// Created: 2003/08/05
|
||||
// Copyright: (c) 2003 David Elliott
|
||||
// Licence: wxWindows licence
|
||||
/////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
// ============================================================================
|
||||
// declarations
|
||||
// ============================================================================
|
||||
|
||||
// ----------------------------------------------------------------------------
|
||||
// headers
|
||||
// ----------------------------------------------------------------------------
|
||||
|
||||
#include "wx/wxprec.h"
|
||||
#ifndef WX_PRECOMP
|
||||
#include "wx/log.h"
|
||||
#endif // WX_PRECOMP
|
||||
|
||||
#include "wx/cocoa/NSTableDataSource.h"
|
||||
#include "wx/cocoa/NSTableView.h"
|
||||
#import <AppKit/NSTableView.h>
|
||||
|
||||
// ----------------------------------------------------------------------------
|
||||
// globals
|
||||
// ----------------------------------------------------------------------------
|
||||
WX_IMPLEMENT_OBJC_INTERFACE_HASHMAP(NSTableView)
|
||||
|
||||
// ============================================================================
|
||||
// @class wxCocoaNSTableDataSource
|
||||
// ============================================================================
|
||||
@implementation wxCocoaNSTableDataSource : NSObject
|
||||
|
||||
- (int)numberOfRowsInTableView: (NSTableView *)tableView
|
||||
{
|
||||
wxCocoaNSTableView *wxView = wxCocoaNSTableView::GetFromCocoa(tableView);
|
||||
wxCHECK_MSG(wxView, 0, wxT("No associated wx object"));
|
||||
return wxView->CocoaDataSource_numberOfRows();
|
||||
}
|
||||
|
||||
- (id)tableView:(NSTableView *)tableView
|
||||
objectValueForTableColumn: (NSTableColumn *)tableColumn
|
||||
row: (int)rowIndex
|
||||
{
|
||||
wxCocoaNSTableView *wxView = wxCocoaNSTableView::GetFromCocoa(tableView);
|
||||
wxCHECK_MSG(wxView, nil, wxT("No associated wx object"));
|
||||
return wxView->CocoaDataSource_objectForTableColumn(tableColumn,rowIndex);
|
||||
}
|
||||
|
||||
@end // implementation wxCocoaNSTableDataSource
|
||||
WX_IMPLEMENT_GET_OBJC_CLASS(wxCocoaNSTableDataSource,NSObject)
|
||||
|
@@ -1,26 +0,0 @@
|
||||
/////////////////////////////////////////////////////////////////////////////
|
||||
// Name: src/cocoa/NSTextField.mm
|
||||
// Purpose: wxCocoaNSTextField
|
||||
// Author: David Elliott
|
||||
// Modified by:
|
||||
// Created: 2003/01/31
|
||||
// Copyright: (c) 2003 David Elliott
|
||||
// Licence: wxWindows licence
|
||||
/////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
// ============================================================================
|
||||
// declarations
|
||||
// ============================================================================
|
||||
|
||||
// ----------------------------------------------------------------------------
|
||||
// headers
|
||||
// ----------------------------------------------------------------------------
|
||||
|
||||
#include "wx/wxprec.h"
|
||||
#ifndef WX_PRECOMP
|
||||
#endif // WX_PRECOMP
|
||||
|
||||
#include "wx/cocoa/NSTextField.h"
|
||||
|
||||
WX_IMPLEMENT_OBJC_INTERFACE(NSTextField)
|
||||
|
@@ -1,221 +0,0 @@
|
||||
/////////////////////////////////////////////////////////////////////////////
|
||||
// Name: src/cocoa/NSView.mm
|
||||
// Purpose: wxCocoaNSView
|
||||
// Author: David Elliott
|
||||
// Modified by:
|
||||
// Created: 2003/02/15
|
||||
// Copyright: (c) 2003 David Elliott
|
||||
// Licence: wxWindows licence
|
||||
/////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
// ============================================================================
|
||||
// declarations
|
||||
// ============================================================================
|
||||
|
||||
// ----------------------------------------------------------------------------
|
||||
// headers
|
||||
// ----------------------------------------------------------------------------
|
||||
|
||||
#include "wx/wxprec.h"
|
||||
#ifndef WX_PRECOMP
|
||||
#include "wx/window.h"
|
||||
#endif // WX_PRECOMP
|
||||
|
||||
#include "wx/cocoa/objc/objc_uniquifying.h"
|
||||
#include "wx/cocoa/NSView.h"
|
||||
|
||||
#import <Foundation/NSNotification.h>
|
||||
#import <Foundation/NSString.h>
|
||||
#include "wx/cocoa/objc/NSView.h"
|
||||
#include "wx/cocoa/ObjcRef.h"
|
||||
|
||||
// ----------------------------------------------------------------------------
|
||||
// globals
|
||||
// ----------------------------------------------------------------------------
|
||||
WX_IMPLEMENT_OBJC_INTERFACE_HASHMAP(NSView)
|
||||
|
||||
void wxCocoaNSView::AssociateNSView(WX_NSView cocoaNSView)
|
||||
{
|
||||
if(cocoaNSView)
|
||||
{
|
||||
sm_cocoaHash.insert(wxCocoaNSViewHash::value_type(cocoaNSView,this));
|
||||
[[NSNotificationCenter defaultCenter] addObserver:(id)sm_cocoaObserver selector:@selector(notificationFrameChanged:) name:@"NSViewFrameDidChangeNotification" object:cocoaNSView];
|
||||
[cocoaNSView setPostsFrameChangedNotifications: YES];
|
||||
}
|
||||
}
|
||||
|
||||
void wxCocoaNSView::DisassociateNSView(WX_NSView cocoaNSView)
|
||||
{
|
||||
if(cocoaNSView)
|
||||
{
|
||||
sm_cocoaHash.erase(cocoaNSView);
|
||||
[[NSNotificationCenter defaultCenter] removeObserver:(id)sm_cocoaObserver name:@"NSViewFrameDidChangeNotification" object:cocoaNSView];
|
||||
}
|
||||
}
|
||||
|
||||
// ============================================================================
|
||||
// @class WXNSView
|
||||
// ============================================================================
|
||||
|
||||
@implementation WXNSView : NSView
|
||||
|
||||
- (BOOL)acceptsFirstMouse:(NSEvent *)theEvent
|
||||
{
|
||||
bool acceptsFirstMouse = false;
|
||||
wxCocoaNSView *win = wxCocoaNSView::GetFromCocoa(self);
|
||||
if(!win || !win->Cocoa_acceptsFirstMouse(acceptsFirstMouse, theEvent))
|
||||
acceptsFirstMouse = [super acceptsFirstMouse:theEvent];
|
||||
return acceptsFirstMouse;
|
||||
}
|
||||
|
||||
- (void)drawRect: (NSRect)rect
|
||||
{
|
||||
wxCocoaNSView *win = wxCocoaNSView::GetFromCocoa(self);
|
||||
if( !win || !win->Cocoa_drawRect(rect) )
|
||||
[super drawRect:rect];
|
||||
}
|
||||
|
||||
- (void)mouseDown:(NSEvent *)theEvent
|
||||
{
|
||||
wxCocoaNSView *win = wxCocoaNSView::GetFromCocoa(self);
|
||||
if( !win || !win->Cocoa_mouseDown(theEvent) )
|
||||
[super mouseDown:theEvent];
|
||||
}
|
||||
|
||||
- (void)mouseDragged:(NSEvent *)theEvent
|
||||
{
|
||||
wxCocoaNSView *win = wxCocoaNSView::GetFromCocoa(self);
|
||||
if( !win || !win->Cocoa_mouseDragged(theEvent) )
|
||||
[super mouseDragged:theEvent];
|
||||
}
|
||||
|
||||
- (void)mouseUp:(NSEvent *)theEvent
|
||||
{
|
||||
wxCocoaNSView *win = wxCocoaNSView::GetFromCocoa(self);
|
||||
if( !win || !win->Cocoa_mouseUp(theEvent) )
|
||||
[super mouseUp:theEvent];
|
||||
}
|
||||
|
||||
- (void)mouseMoved:(NSEvent *)theEvent
|
||||
{
|
||||
wxCocoaNSView *win = wxCocoaNSView::GetFromCocoa(self);
|
||||
if( !win || !win->Cocoa_mouseMoved(theEvent) )
|
||||
[super mouseMoved:theEvent];
|
||||
}
|
||||
|
||||
- (void)mouseEntered:(NSEvent *)theEvent
|
||||
{
|
||||
wxCocoaNSView *win = wxCocoaNSView::GetFromCocoa(self);
|
||||
if( !win || !win->Cocoa_mouseEntered(theEvent) )
|
||||
[super mouseEntered:theEvent];
|
||||
}
|
||||
|
||||
- (void)mouseExited:(NSEvent *)theEvent
|
||||
{
|
||||
wxCocoaNSView *win = wxCocoaNSView::GetFromCocoa(self);
|
||||
if( !win || !win->Cocoa_mouseExited(theEvent) )
|
||||
[super mouseExited:theEvent];
|
||||
}
|
||||
|
||||
- (void)rightMouseDown:(NSEvent *)theEvent
|
||||
{
|
||||
wxCocoaNSView *win = wxCocoaNSView::GetFromCocoa(self);
|
||||
if( !win || !win->Cocoa_rightMouseDown(theEvent) )
|
||||
[super rightMouseDown:theEvent];
|
||||
}
|
||||
|
||||
- (void)rightMouseDragged:(NSEvent *)theEvent
|
||||
{
|
||||
wxCocoaNSView *win = wxCocoaNSView::GetFromCocoa(self);
|
||||
if( !win || !win->Cocoa_rightMouseDragged(theEvent) )
|
||||
[super rightMouseDragged:theEvent];
|
||||
}
|
||||
|
||||
- (void)rightMouseUp:(NSEvent *)theEvent
|
||||
{
|
||||
wxCocoaNSView *win = wxCocoaNSView::GetFromCocoa(self);
|
||||
if( !win || !win->Cocoa_rightMouseUp(theEvent) )
|
||||
[super rightMouseUp:theEvent];
|
||||
}
|
||||
|
||||
- (void)otherMouseDown:(NSEvent *)theEvent
|
||||
{
|
||||
wxCocoaNSView *win = wxCocoaNSView::GetFromCocoa(self);
|
||||
if( !win || !win->Cocoa_otherMouseDown(theEvent) )
|
||||
[super otherMouseDown:theEvent];
|
||||
}
|
||||
|
||||
- (void)otherMouseDragged:(NSEvent *)theEvent
|
||||
{
|
||||
wxCocoaNSView *win = wxCocoaNSView::GetFromCocoa(self);
|
||||
if( !win || !win->Cocoa_otherMouseDragged(theEvent) )
|
||||
[super otherMouseDragged:theEvent];
|
||||
}
|
||||
|
||||
- (void)otherMouseUp:(NSEvent *)theEvent
|
||||
{
|
||||
wxCocoaNSView *win = wxCocoaNSView::GetFromCocoa(self);
|
||||
if( !win || !win->Cocoa_otherMouseUp(theEvent) )
|
||||
[super otherMouseUp:theEvent];
|
||||
}
|
||||
|
||||
- (void)resetCursorRects
|
||||
{
|
||||
wxCocoaNSView *win = wxCocoaNSView::GetFromCocoa(self);
|
||||
if( !win || !win->Cocoa_resetCursorRects() )
|
||||
[super resetCursorRects];
|
||||
}
|
||||
|
||||
- (void)viewDidMoveToWindow
|
||||
{
|
||||
wxCocoaNSView *win = wxCocoaNSView::GetFromCocoa(self);
|
||||
if( !win || !win->Cocoa_viewDidMoveToWindow() )
|
||||
[super viewDidMoveToWindow];
|
||||
}
|
||||
|
||||
- (void)viewWillMoveToWindow:(NSWindow *)newWindow
|
||||
{
|
||||
wxCocoaNSView *win = wxCocoaNSView::GetFromCocoa(self);
|
||||
if( !win || !win->Cocoa_viewWillMoveToWindow(newWindow) )
|
||||
[super viewWillMoveToWindow:newWindow];
|
||||
}
|
||||
|
||||
@end // implementation WXNSView
|
||||
WX_IMPLEMENT_GET_OBJC_CLASS(WXNSView,NSView)
|
||||
|
||||
// ============================================================================
|
||||
// @class wxNSViewNotificationObserver
|
||||
// ============================================================================
|
||||
|
||||
@interface wxNSViewNotificationObserver : NSObject
|
||||
{
|
||||
}
|
||||
|
||||
- (void)notificationFrameChanged: (NSNotification *)notification;
|
||||
- (void)synthesizeMouseMovedForView: (NSView *)theView;
|
||||
@end // interface wxNSViewNotificationObserver
|
||||
WX_DECLARE_GET_OBJC_CLASS(wxNSViewNotificationObserver,NSObject)
|
||||
|
||||
@implementation wxNSViewNotificationObserver : NSObject
|
||||
|
||||
- (void)notificationFrameChanged: (NSNotification *)notification;
|
||||
{
|
||||
wxCocoaNSView *win = wxCocoaNSView::GetFromCocoa([notification object]);
|
||||
wxCHECK_RET(win,wxT("notificationFrameChanged received but no wxWindow exists"));
|
||||
win->Cocoa_FrameChanged();
|
||||
}
|
||||
|
||||
- (void)synthesizeMouseMovedForView: (NSView *)theView
|
||||
{
|
||||
wxCocoaNSView *win = wxCocoaNSView::GetFromCocoa(theView);
|
||||
wxCHECK_RET(win,wxT("synthesizeMouseMovedForView received but no wxWindow exists"));
|
||||
win->Cocoa_synthesizeMouseMoved();
|
||||
}
|
||||
|
||||
@end // implementation wxNSViewNotificationObserver
|
||||
WX_IMPLEMENT_GET_OBJC_CLASS(wxNSViewNotificationObserver,NSObject)
|
||||
|
||||
// New CF-retained observer (this should have been using wxObjcAutoRefFromAlloc to begin with)
|
||||
wxObjcAutoRefFromAlloc<wxNSViewNotificationObserver*> s_cocoaNSViewObserver([[WX_GET_OBJC_CLASS(wxNSViewNotificationObserver) alloc] init]);
|
||||
// For compatibility with old code
|
||||
id wxCocoaNSView::sm_cocoaObserver = s_cocoaNSViewObserver;
|
@@ -1,241 +0,0 @@
|
||||
/////////////////////////////////////////////////////////////////////////////
|
||||
// Name: src/cocoa/NSWindow.mm
|
||||
// Purpose: wxCocoaNSWindow
|
||||
// Author: David Elliott
|
||||
// Modified by:
|
||||
// Created: 2003/03/16
|
||||
// Copyright: (c) 2003 David Elliott
|
||||
// Licence: wxWindows licence
|
||||
/////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
// ============================================================================
|
||||
// declarations
|
||||
// ============================================================================
|
||||
|
||||
// ----------------------------------------------------------------------------
|
||||
// headers
|
||||
// ----------------------------------------------------------------------------
|
||||
|
||||
#include "wx/wxprec.h"
|
||||
#ifndef WX_PRECOMP
|
||||
#include "wx/log.h"
|
||||
#include "wx/menuitem.h"
|
||||
#endif // WX_PRECOMP
|
||||
|
||||
#include "wx/cocoa/NSWindow.h"
|
||||
|
||||
#include "wx/cocoa/objc/objc_uniquifying.h"
|
||||
|
||||
#import <Foundation/NSNotification.h>
|
||||
#import <Foundation/NSString.h>
|
||||
#include "wx/cocoa/objc/NSWindow.h"
|
||||
|
||||
// ============================================================================
|
||||
// @class wxNSWindowDelegate
|
||||
// ============================================================================
|
||||
@interface wxNSWindowDelegate : NSObject
|
||||
{
|
||||
wxCocoaNSWindow *m_wxCocoaInterface;
|
||||
}
|
||||
|
||||
- (id)init;
|
||||
- (void)setWxCocoaInterface: (wxCocoaNSWindow *)wxCocoaInterface;
|
||||
- (wxCocoaNSWindow *)wxCocoaInterface;
|
||||
|
||||
// Delegate message handlers
|
||||
- (void)windowDidBecomeKey: (NSNotification *)notification;
|
||||
- (void)windowDidResignKey: (NSNotification *)notification;
|
||||
- (void)windowDidBecomeMain: (NSNotification *)notification;
|
||||
- (void)windowDidResignMain: (NSNotification *)notification;
|
||||
- (BOOL)windowShouldClose: (id)sender;
|
||||
- (void)windowWillClose: (NSNotification *)notification;
|
||||
|
||||
// Menu item handlers
|
||||
- (void)wxMenuItemAction: (NSMenuItem *)menuItem;
|
||||
- (BOOL)validateMenuItem: (NSMenuItem *)menuItem;
|
||||
@end //interface wxNSWindowDelegate
|
||||
WX_DECLARE_GET_OBJC_CLASS(wxNSWindowDelegate,NSObject)
|
||||
|
||||
@implementation wxNSWindowDelegate : NSObject
|
||||
|
||||
- (id)init
|
||||
{
|
||||
m_wxCocoaInterface = NULL;
|
||||
return [super init];
|
||||
}
|
||||
|
||||
- (void)setWxCocoaInterface: (wxCocoaNSWindow *)wxCocoaInterface
|
||||
{
|
||||
m_wxCocoaInterface = wxCocoaInterface;
|
||||
}
|
||||
|
||||
- (wxCocoaNSWindow *)wxCocoaInterface
|
||||
{
|
||||
return m_wxCocoaInterface;
|
||||
}
|
||||
|
||||
// Delegate message handlers
|
||||
- (void)windowDidBecomeKey: (NSNotification *)notification
|
||||
{
|
||||
wxCocoaNSWindow *win = wxCocoaNSWindow::GetFromCocoa([notification object]);
|
||||
wxASSERT(win==m_wxCocoaInterface);
|
||||
wxCHECK_RET(win,wxT("notificationDidBecomeKey received but no wxWindow exists"));
|
||||
win->CocoaDelegate_windowDidBecomeKey();
|
||||
}
|
||||
|
||||
- (void)windowDidResignKey: (NSNotification *)notification
|
||||
{
|
||||
wxCocoaNSWindow *win = wxCocoaNSWindow::GetFromCocoa([notification object]);
|
||||
wxASSERT(win==m_wxCocoaInterface);
|
||||
wxCHECK_RET(win,wxT("notificationDidResignKey received but no wxWindow exists"));
|
||||
win->CocoaDelegate_windowDidResignKey();
|
||||
}
|
||||
|
||||
- (void)windowDidBecomeMain: (NSNotification *)notification
|
||||
{
|
||||
wxCocoaNSWindow *win = wxCocoaNSWindow::GetFromCocoa([notification object]);
|
||||
wxASSERT(win==m_wxCocoaInterface);
|
||||
wxCHECK_RET(win,wxT("notificationDidBecomeMain received but no wxWindow exists"));
|
||||
win->CocoaDelegate_windowDidBecomeMain();
|
||||
}
|
||||
|
||||
- (void)windowDidResignMain: (NSNotification *)notification
|
||||
{
|
||||
wxCocoaNSWindow *win = wxCocoaNSWindow::GetFromCocoa([notification object]);
|
||||
wxASSERT(win==m_wxCocoaInterface);
|
||||
wxCHECK_RET(win,wxT("notificationDidResignMain received but no wxWindow exists"));
|
||||
win->CocoaDelegate_windowDidResignMain();
|
||||
}
|
||||
|
||||
- (BOOL)windowShouldClose: (id)sender
|
||||
{
|
||||
wxLogTrace(wxTRACE_COCOA,wxT("windowShouldClose"));
|
||||
wxCocoaNSWindow *tlw = wxCocoaNSWindow::GetFromCocoa(sender);
|
||||
wxASSERT(tlw==m_wxCocoaInterface);
|
||||
if(tlw && !tlw->CocoaDelegate_windowShouldClose())
|
||||
{
|
||||
wxLogTrace(wxTRACE_COCOA,wxT("Window will not be closed"));
|
||||
return NO;
|
||||
}
|
||||
wxLogTrace(wxTRACE_COCOA,wxT("Window will be closed"));
|
||||
return YES;
|
||||
}
|
||||
|
||||
- (void)windowWillClose: (NSNotification *)notification
|
||||
{
|
||||
wxCocoaNSWindow *win = wxCocoaNSWindow::GetFromCocoa([notification object]);
|
||||
wxASSERT(win==m_wxCocoaInterface);
|
||||
wxCHECK_RET(win,wxT("windowWillClose received but no wxWindow exists"));
|
||||
win->CocoaDelegate_windowWillClose();
|
||||
}
|
||||
|
||||
// Menu item handlers
|
||||
- (void)wxMenuItemAction: (NSMenuItem *)sender
|
||||
{
|
||||
wxASSERT(m_wxCocoaInterface);
|
||||
m_wxCocoaInterface->CocoaDelegate_wxMenuItemAction(sender);
|
||||
}
|
||||
|
||||
- (BOOL)validateMenuItem: (NSMenuItem *)sender
|
||||
{
|
||||
wxASSERT(m_wxCocoaInterface);
|
||||
return m_wxCocoaInterface->CocoaDelegate_validateMenuItem(sender);
|
||||
}
|
||||
|
||||
@end //implementation wxNSWindowDelegate
|
||||
WX_IMPLEMENT_GET_OBJC_CLASS(wxNSWindowDelegate,NSObject)
|
||||
|
||||
// ============================================================================
|
||||
// class wxCocoaNSWindow
|
||||
// ============================================================================
|
||||
|
||||
WX_IMPLEMENT_OBJC_INTERFACE_HASHMAP(NSWindow)
|
||||
|
||||
wxCocoaNSWindow::wxCocoaNSWindow(wxTopLevelWindowCocoa *tlw)
|
||||
: m_wxTopLevelWindowCocoa(tlw)
|
||||
{
|
||||
m_cocoaDelegate = [[WX_GET_OBJC_CLASS(wxNSWindowDelegate) alloc] init];
|
||||
[m_cocoaDelegate setWxCocoaInterface: this];
|
||||
}
|
||||
|
||||
wxCocoaNSWindow::~wxCocoaNSWindow()
|
||||
{
|
||||
[m_cocoaDelegate setWxCocoaInterface: NULL];
|
||||
[m_cocoaDelegate release];
|
||||
}
|
||||
|
||||
void wxCocoaNSWindow::AssociateNSWindow(WX_NSWindow cocoaNSWindow)
|
||||
{
|
||||
if(cocoaNSWindow)
|
||||
{
|
||||
[cocoaNSWindow setReleasedWhenClosed: NO];
|
||||
sm_cocoaHash.insert(wxCocoaNSWindowHash::value_type(cocoaNSWindow,this));
|
||||
[cocoaNSWindow setDelegate: m_cocoaDelegate];
|
||||
}
|
||||
}
|
||||
|
||||
void wxCocoaNSWindow::DisassociateNSWindow(WX_NSWindow cocoaNSWindow)
|
||||
{
|
||||
if(cocoaNSWindow)
|
||||
{
|
||||
[cocoaNSWindow setDelegate: nil];
|
||||
sm_cocoaHash.erase(cocoaNSWindow);
|
||||
}
|
||||
}
|
||||
|
||||
wxMenuBar* wxCocoaNSWindow::GetAppMenuBar(wxCocoaNSWindow *win)
|
||||
{
|
||||
return NULL;
|
||||
}
|
||||
|
||||
// ============================================================================
|
||||
// @class WXNSWindow
|
||||
// ============================================================================
|
||||
@implementation WXNSWindow : NSWindow
|
||||
|
||||
- (BOOL)canBecomeKeyWindow
|
||||
{
|
||||
bool canBecome = false;
|
||||
wxCocoaNSWindow *tlw = wxCocoaNSWindow::GetFromCocoa(self);
|
||||
if(!tlw || !tlw->Cocoa_canBecomeKeyWindow(canBecome))
|
||||
canBecome = [super canBecomeKeyWindow];
|
||||
return canBecome;
|
||||
}
|
||||
|
||||
- (BOOL)canBecomeMainWindow
|
||||
{
|
||||
bool canBecome = false;
|
||||
wxCocoaNSWindow *tlw = wxCocoaNSWindow::GetFromCocoa(self);
|
||||
if(!tlw || !tlw->Cocoa_canBecomeMainWindow(canBecome))
|
||||
canBecome = [super canBecomeMainWindow];
|
||||
return canBecome;
|
||||
}
|
||||
|
||||
@end // implementation WXNSWindow
|
||||
WX_IMPLEMENT_GET_OBJC_CLASS(WXNSWindow,NSWindow)
|
||||
|
||||
// ============================================================================
|
||||
// @class WXNSPanel
|
||||
// ============================================================================
|
||||
@implementation WXNSPanel : NSPanel
|
||||
|
||||
- (BOOL)canBecomeKeyWindow
|
||||
{
|
||||
bool canBecome = false;
|
||||
wxCocoaNSWindow *tlw = wxCocoaNSWindow::GetFromCocoa(self);
|
||||
if(!tlw || !tlw->Cocoa_canBecomeKeyWindow(canBecome))
|
||||
canBecome = [super canBecomeKeyWindow];
|
||||
return canBecome;
|
||||
}
|
||||
|
||||
- (BOOL)canBecomeMainWindow
|
||||
{
|
||||
bool canBecome = false;
|
||||
wxCocoaNSWindow *tlw = wxCocoaNSWindow::GetFromCocoa(self);
|
||||
if(!tlw || !tlw->Cocoa_canBecomeMainWindow(canBecome))
|
||||
canBecome = [super canBecomeMainWindow];
|
||||
return canBecome;
|
||||
}
|
||||
|
||||
@end // implementation WXNSPanel
|
||||
WX_IMPLEMENT_GET_OBJC_CLASS(WXNSPanel,NSPanel)
|
@@ -1,24 +0,0 @@
|
||||
/////////////////////////////////////////////////////////////////////////////
|
||||
// Name: src/cocoa/ObjcRef.mm
|
||||
// Purpose: wxObjcAutoRefBase implementation
|
||||
// Author: David Elliott
|
||||
// Modified by:
|
||||
// Created: 2004/03/28
|
||||
// Copyright: (c) 2004 David Elliott <dfe@cox.net>
|
||||
// Licence: wxWindows licence
|
||||
/////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
#include "wx/cocoa/ObjcRef.h"
|
||||
|
||||
#include <Foundation/NSObject.h>
|
||||
|
||||
/*static*/ struct objc_object* wxObjcAutoRefBase::ObjcRetain(struct objc_object* obj)
|
||||
{
|
||||
return [obj retain];
|
||||
}
|
||||
|
||||
/*static*/ void wxObjcAutoRefBase::ObjcRelease(struct objc_object* obj)
|
||||
{
|
||||
[obj release];
|
||||
}
|
||||
|
511
src/cocoa/app.mm
511
src/cocoa/app.mm
@@ -1,511 +0,0 @@
|
||||
/////////////////////////////////////////////////////////////////////////////
|
||||
// Name: src/cocoa/app.mm
|
||||
// Purpose: wxApp
|
||||
// Author: David Elliott
|
||||
// Modified by:
|
||||
// Created: 2002/11/27
|
||||
// Copyright: (c) David Elliott
|
||||
// Software 2000 Ltd.
|
||||
// Licence: wxWindows licence
|
||||
/////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
#include "wx/wxprec.h"
|
||||
|
||||
#include "wx/app.h"
|
||||
|
||||
#ifndef WX_PRECOMP
|
||||
#include "wx/intl.h"
|
||||
#include "wx/log.h"
|
||||
#include "wx/module.h"
|
||||
#endif
|
||||
|
||||
#include "wx/cocoa/ObjcRef.h"
|
||||
#include "wx/cocoa/autorelease.h"
|
||||
#include "wx/cocoa/mbarman.h"
|
||||
#include "wx/cocoa/NSApplication.h"
|
||||
|
||||
#include "wx/cocoa/dc.h"
|
||||
|
||||
#import <AppKit/NSApplication.h>
|
||||
#import <Foundation/NSRunLoop.h>
|
||||
#import <Foundation/NSThread.h>
|
||||
#import <AppKit/NSEvent.h>
|
||||
#import <Foundation/NSString.h>
|
||||
#import <Foundation/NSNotification.h>
|
||||
#import <AppKit/NSCell.h>
|
||||
|
||||
bool wxApp::sm_isEmbedded = false; // Normally we're not a plugin
|
||||
|
||||
// wxNSApplicationObserver singleton.
|
||||
static wxObjcAutoRefFromAlloc<wxNSApplicationObserver*> sg_cocoaAppObserver = [[WX_GET_OBJC_CLASS(wxNSApplicationObserver) alloc] init];
|
||||
|
||||
// ========================================================================
|
||||
// wxNSApplicationDelegate
|
||||
// ========================================================================
|
||||
@implementation wxNSApplicationDelegate : NSObject
|
||||
|
||||
// NOTE: Terminate means that the event loop does NOT return and thus
|
||||
// cleanup code doesn't properly execute. Furthermore, wxWidgets has its
|
||||
// own exit on frame delete mechanism.
|
||||
- (BOOL)applicationShouldTerminateAfterLastWindowClosed:(NSApplication *)theApplication
|
||||
{
|
||||
return NO;
|
||||
}
|
||||
|
||||
@end // implementation wxNSApplicationDelegate : NSObject
|
||||
WX_IMPLEMENT_GET_OBJC_CLASS(wxNSApplicationDelegate,NSObject)
|
||||
|
||||
// ========================================================================
|
||||
// wxNSApplicationObserver
|
||||
// ========================================================================
|
||||
@implementation wxNSApplicationObserver : NSObject
|
||||
|
||||
- (void)applicationWillBecomeActive:(NSNotification *)notification
|
||||
{
|
||||
wxTheApp->CocoaDelegate_applicationWillBecomeActive();
|
||||
}
|
||||
|
||||
- (void)applicationDidBecomeActive:(NSNotification *)notification
|
||||
{
|
||||
wxTheApp->CocoaDelegate_applicationDidBecomeActive();
|
||||
}
|
||||
|
||||
- (void)applicationWillResignActive:(NSNotification *)notification
|
||||
{
|
||||
wxTheApp->CocoaDelegate_applicationWillResignActive();
|
||||
}
|
||||
|
||||
- (void)applicationDidResignActive:(NSNotification *)notification
|
||||
{
|
||||
wxTheApp->CocoaDelegate_applicationDidResignActive();
|
||||
}
|
||||
|
||||
- (void)applicationWillUpdate:(NSNotification *)notification;
|
||||
{
|
||||
wxTheApp->CocoaDelegate_applicationWillUpdate();
|
||||
}
|
||||
|
||||
- (void)controlTintChanged:(NSNotification *)notification
|
||||
{
|
||||
wxLogDebug(wxT("TODO: send EVT_SYS_COLOUR_CHANGED as appropriate"));
|
||||
}
|
||||
|
||||
@end // implementation wxNSApplicationObserver : NSObject
|
||||
WX_IMPLEMENT_GET_OBJC_CLASS(wxNSApplicationObserver,NSObject)
|
||||
|
||||
// ========================================================================
|
||||
// wxApp
|
||||
// ========================================================================
|
||||
|
||||
// ----------------------------------------------------------------------------
|
||||
// wxApp Static member initialization
|
||||
// ----------------------------------------------------------------------------
|
||||
IMPLEMENT_DYNAMIC_CLASS(wxApp, wxEvtHandler)
|
||||
|
||||
// ----------------------------------------------------------------------------
|
||||
// wxApp initialization/cleanup
|
||||
// ----------------------------------------------------------------------------
|
||||
bool wxApp::Initialize(int& argc, wxChar **argv)
|
||||
{
|
||||
wxAutoNSAutoreleasePool pool;
|
||||
m_cocoaMainThread = [NSThread currentThread];
|
||||
// Mac OS X passes a process serial number command line argument when
|
||||
// the application is launched from the Finder. This argument must be
|
||||
// removed from the command line arguments before being handled by the
|
||||
// application (otherwise applications would need to handle it)
|
||||
if ( argc > 1 )
|
||||
{
|
||||
static const wxChar *ARG_PSN = wxT("-psn_");
|
||||
if ( wxStrncmp(argv[1], ARG_PSN, wxStrlen(ARG_PSN)) == 0 )
|
||||
{
|
||||
// remove this argument
|
||||
--argc;
|
||||
memmove(argv + 1, argv + 2, argc * sizeof(wxChar *));
|
||||
}
|
||||
}
|
||||
|
||||
/*
|
||||
Cocoa supports -Key value options which set the user defaults key "Key"
|
||||
to the value "value" Some of them are very handy for debugging like
|
||||
-NSShowAllViews YES. Cocoa picks these up from the real argv so
|
||||
our removal of them from the wx copy of it does not affect Cocoa's
|
||||
ability to see them.
|
||||
|
||||
We basically just assume that any "-NS" option and its following
|
||||
argument needs to be removed from argv. We hope that user code does
|
||||
not expect to see -NS options and indeed it's probably a safe bet
|
||||
since most user code accepting options is probably using the
|
||||
double-dash GNU-style syntax.
|
||||
*/
|
||||
for(int i=1; i < argc; ++i)
|
||||
{
|
||||
static const wxChar *ARG_NS = wxT("-NS");
|
||||
static const int ARG_NS_LEN = wxStrlen(ARG_NS);
|
||||
if( wxStrncmp(argv[i], ARG_NS, ARG_NS_LEN) == 0 )
|
||||
{
|
||||
// Only eat this option if it has an argument
|
||||
if( (i + 1) < argc )
|
||||
{
|
||||
argc -= 2;
|
||||
memmove(argv + i, argv + i + 2, argc * sizeof(wxChar*));
|
||||
// drop back one position so the next run through the loop
|
||||
// reprocesses the argument at our current index.
|
||||
--i;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return wxAppBase::Initialize(argc, argv);
|
||||
}
|
||||
|
||||
void wxApp::CleanUp()
|
||||
{
|
||||
wxAutoNSAutoreleasePool pool;
|
||||
|
||||
wxCocoaDCImpl::CocoaShutdownTextSystem();
|
||||
wxMenuBarManager::DestroyInstance();
|
||||
|
||||
[[NSNotificationCenter defaultCenter] removeObserver:sg_cocoaAppObserver];
|
||||
if(!sm_isEmbedded)
|
||||
{
|
||||
[m_cocoaApp setDelegate:nil];
|
||||
[m_cocoaAppDelegate release];
|
||||
m_cocoaAppDelegate = NULL;
|
||||
}
|
||||
|
||||
wxAppBase::CleanUp();
|
||||
}
|
||||
|
||||
// ----------------------------------------------------------------------------
|
||||
// wxApp creation
|
||||
// ----------------------------------------------------------------------------
|
||||
wxApp::wxApp()
|
||||
{
|
||||
m_topWindow = NULL;
|
||||
|
||||
argc = 0;
|
||||
#if !wxUSE_UNICODE
|
||||
argv = NULL;
|
||||
#endif
|
||||
m_cocoaApp = NULL;
|
||||
m_cocoaAppDelegate = NULL;
|
||||
}
|
||||
|
||||
void wxApp::CocoaDelegate_applicationWillBecomeActive()
|
||||
{
|
||||
}
|
||||
|
||||
void wxApp::CocoaDelegate_applicationDidBecomeActive()
|
||||
{
|
||||
}
|
||||
|
||||
void wxApp::CocoaDelegate_applicationWillResignActive()
|
||||
{
|
||||
wxTopLevelWindowCocoa::DeactivatePendingWindow();
|
||||
}
|
||||
|
||||
void wxApp::CocoaDelegate_applicationDidResignActive()
|
||||
{
|
||||
}
|
||||
|
||||
bool wxApp::OnInitGui()
|
||||
{
|
||||
wxAutoNSAutoreleasePool pool;
|
||||
if(!wxAppBase::OnInitGui())
|
||||
return false;
|
||||
|
||||
// Create the app using the sharedApplication method
|
||||
m_cocoaApp = [NSApplication sharedApplication];
|
||||
|
||||
if(!sm_isEmbedded)
|
||||
{
|
||||
// Enable response to application delegate messages
|
||||
m_cocoaAppDelegate = [[WX_GET_OBJC_CLASS(wxNSApplicationDelegate) alloc] init];
|
||||
[m_cocoaApp setDelegate:m_cocoaAppDelegate];
|
||||
}
|
||||
|
||||
// Enable response to "delegate" messages on the notification observer
|
||||
[[NSNotificationCenter defaultCenter] addObserver:sg_cocoaAppObserver
|
||||
selector:@selector(applicationWillBecomeActive:)
|
||||
name:NSApplicationWillBecomeActiveNotification object:nil];
|
||||
|
||||
[[NSNotificationCenter defaultCenter] addObserver:sg_cocoaAppObserver
|
||||
selector:@selector(applicationDidBecomeActive:)
|
||||
name:NSApplicationDidBecomeActiveNotification object:nil];
|
||||
|
||||
[[NSNotificationCenter defaultCenter] addObserver:sg_cocoaAppObserver
|
||||
selector:@selector(applicationWillResignActive:)
|
||||
name:NSApplicationWillResignActiveNotification object:nil];
|
||||
|
||||
[[NSNotificationCenter defaultCenter] addObserver:sg_cocoaAppObserver
|
||||
selector:@selector(applicationDidResignActive:)
|
||||
name:NSApplicationDidResignActiveNotification object:nil];
|
||||
|
||||
[[NSNotificationCenter defaultCenter] addObserver:sg_cocoaAppObserver
|
||||
selector:@selector(applicationWillUpdate:)
|
||||
name:NSApplicationWillUpdateNotification object:nil];
|
||||
|
||||
// Enable response to system notifications
|
||||
[[NSNotificationCenter defaultCenter] addObserver:sg_cocoaAppObserver
|
||||
selector:@selector(controlTintChanged:)
|
||||
name:NSControlTintDidChangeNotification object:nil];
|
||||
|
||||
if(!sm_isEmbedded)
|
||||
wxMenuBarManager::CreateInstance();
|
||||
|
||||
wxCocoaDCImpl::CocoaInitializeTextSystem();
|
||||
return true;
|
||||
}
|
||||
|
||||
wxApp::~wxApp()
|
||||
{
|
||||
if(m_cfRunLoopIdleObserver != NULL)
|
||||
{
|
||||
// Invalidate the observer which also removes it from the run loop.
|
||||
CFRunLoopObserverInvalidate(m_cfRunLoopIdleObserver);
|
||||
// Release the ref as we don't need it anymore.
|
||||
m_cfRunLoopIdleObserver.reset();
|
||||
}
|
||||
}
|
||||
|
||||
bool wxApp::CallOnInit()
|
||||
{
|
||||
// wxAutoNSAutoreleasePool pool;
|
||||
return OnInit();
|
||||
}
|
||||
|
||||
bool wxApp::OnInit()
|
||||
{
|
||||
if(!wxAppBase::OnInit())
|
||||
return false;
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
void wxApp::Exit()
|
||||
{
|
||||
wxApp::CleanUp();
|
||||
|
||||
wxAppConsole::Exit();
|
||||
}
|
||||
|
||||
void wxApp::WakeUpIdle()
|
||||
{
|
||||
/* When called from the main thread the NSAutoreleasePool managed by
|
||||
the [NSApplication run] method would ordinarily be in place and so
|
||||
one would think a pool here would be unnecessary.
|
||||
|
||||
However, when called from a different thread there is usually no
|
||||
NSAutoreleasePool in place because wxThread has no knowledge of
|
||||
wxCocoa. The pool here is generally only ever going to contain
|
||||
the NSEvent we create with the factory method. As soon as we add
|
||||
it to the main event queue with postEvent:atStart: it is retained
|
||||
and so safe for our pool to release.
|
||||
*/
|
||||
wxAutoNSAutoreleasePool pool;
|
||||
/* NOTE: This is a little heavy handed. What this does is cause an
|
||||
AppKit NSEvent to be added to NSApplication's queue (which is always
|
||||
on the main thread). This will cause the main thread runloop to
|
||||
exit which returns control to nextEventMatchingMask which returns
|
||||
the event which is then sent with sendEvent: and essentially dropped
|
||||
since it's not for a window (windowNumber 0) and NSApplication
|
||||
certainly doesn't understand it.
|
||||
|
||||
With the exception of wxEventLoop::Exit which uses us to cause the
|
||||
runloop to exit and return to the NSApplication event loop, most
|
||||
callers only need wx idle to happen, or more specifically only really
|
||||
need to ensure that ProcessPendingEvents is called which is currently
|
||||
done without exiting the runloop.
|
||||
|
||||
Be careful if you decide to change the implementation of this method
|
||||
as wxEventLoop::Exit depends on the current behaviour.
|
||||
*/
|
||||
[m_cocoaApp postEvent:[NSEvent otherEventWithType:NSApplicationDefined
|
||||
location:NSZeroPoint modifierFlags:NSAnyEventMask
|
||||
timestamp:0 windowNumber:0 context:nil
|
||||
subtype:0 data1:0 data2:0] atStart:NO];
|
||||
}
|
||||
|
||||
extern "C" static void ObserveMainRunLoopBeforeWaiting(CFRunLoopObserverRef observer, CFRunLoopActivity activity, void *info);
|
||||
extern "C" static void ObserveMainRunLoopBeforeWaiting(CFRunLoopObserverRef observer, CFRunLoopActivity activity, void *info)
|
||||
{
|
||||
static_cast<wxApp*>(info)->CF_ObserveMainRunLoopBeforeWaiting(observer, activity);
|
||||
}
|
||||
|
||||
#if 0
|
||||
static int sg_cApplicationWillUpdate = 0;
|
||||
#endif
|
||||
|
||||
/*!
|
||||
Invoked from the applicationWillUpdate notification observer. See the
|
||||
NSApplication documentation for the official statement on when this
|
||||
will be called. Since it can be hard to understand for a Cocoa newbie
|
||||
I'll try to explain it here as it relates to wxCocoa.
|
||||
|
||||
Basically, we get called from within nextEventMatchingMask if and only
|
||||
if any user code told the application to send the update notification
|
||||
(sort of like a request for idle events). However, unlike wx idle events,
|
||||
this notification is sent quite often, nearly every time through the loop
|
||||
because nearly every control tells the application to send it.
|
||||
|
||||
Because wx idle events are only supposed to be sent when the event loop
|
||||
is about to block we instead schedule a function to be called just
|
||||
before the run loop waits and send the idle events from there.
|
||||
|
||||
It also has the desirable effect of only sending the wx idle events when
|
||||
the event loop is actually going to block. If the event loop is being
|
||||
pumped manualy (e.g. like a PeekMessage) then the kCFRunLoopBeforeWaiting
|
||||
observer never fires. Our Yield() method depends on this because sending
|
||||
idle events from within Yield would be bad.
|
||||
|
||||
Normally you might think that we could just set the observer up once and
|
||||
leave it attached. However, this is problematic because our run loop
|
||||
observer calls user code (the idle handlers) which can actually display
|
||||
modal dialogs. Displaying a modal dialog causes reentry of the event
|
||||
loop, usually in a different run loop mode than the main loop (e.g. in
|
||||
modal-dialog mode instead of default mode). Because we only register the
|
||||
observer with the run loop mode at the time of this call, it won't be
|
||||
called from a modal loop.
|
||||
|
||||
We want it to be called and thus we need a new observer.
|
||||
*/
|
||||
void wxApp::CocoaDelegate_applicationWillUpdate()
|
||||
{
|
||||
wxLogTrace(wxTRACE_COCOA,wxT("applicationWillUpdate"));
|
||||
|
||||
// CFRunLoopRef cfRunLoop = [[NSRunLoop currentRunLoop] getCFRunLoop];
|
||||
CFRunLoopRef cfRunLoop = CFRunLoopGetCurrent();
|
||||
wxCFRef<CFStringRef> cfRunLoopMode(CFRunLoopCopyCurrentMode(cfRunLoop));
|
||||
|
||||
/* If we have an observer and that observer is for the wrong run loop
|
||||
mode then invalidate it and release it.
|
||||
*/
|
||||
if(m_cfRunLoopIdleObserver != NULL && m_cfObservedRunLoopMode != cfRunLoopMode)
|
||||
{
|
||||
CFRunLoopObserverInvalidate(m_cfRunLoopIdleObserver);
|
||||
m_cfRunLoopIdleObserver.reset();
|
||||
}
|
||||
#if 0
|
||||
++sg_cApplicationWillUpdate;
|
||||
#endif
|
||||
/* This will be true either on the first call or when the above code has
|
||||
invalidated and released the exisiting observer.
|
||||
*/
|
||||
if(m_cfRunLoopIdleObserver == NULL)
|
||||
{
|
||||
// Enable idle event handling
|
||||
CFRunLoopObserverContext observerContext =
|
||||
{ 0
|
||||
, this
|
||||
, NULL
|
||||
, NULL
|
||||
, NULL
|
||||
};
|
||||
/* NOTE: I can't recall why we don't just let the observer repeat
|
||||
instead of invalidating itself each time it fires thus requiring
|
||||
it to be recreated for each shot but there was if I remember
|
||||
some good (but very obscure) reason for it.
|
||||
|
||||
On the other hand, I could be wrong so don't take that as gospel.
|
||||
*/
|
||||
m_cfRunLoopIdleObserver.reset(CFRunLoopObserverCreate(kCFAllocatorDefault, kCFRunLoopBeforeWaiting, /*repeats*/FALSE, /*priority*/0, ObserveMainRunLoopBeforeWaiting, &observerContext));
|
||||
m_cfObservedRunLoopMode = cfRunLoopMode;
|
||||
CFRunLoopAddObserver(cfRunLoop, m_cfRunLoopIdleObserver, m_cfObservedRunLoopMode);
|
||||
}
|
||||
}
|
||||
|
||||
static inline bool FakeNeedMoreIdle()
|
||||
{
|
||||
#if 0
|
||||
// Return true on every 10th call.
|
||||
static int idleCount = 0;
|
||||
return ++idleCount % 10;
|
||||
#else
|
||||
return false;
|
||||
#endif
|
||||
}
|
||||
|
||||
/*!
|
||||
Called by CFRunLoop just before waiting. This is the appropriate time to
|
||||
send idle events. Unlike other ports, we don't peek the queue for events
|
||||
and stop idling if there is one. Instead, if the user requests more idle
|
||||
events we tell Cocoa to send us an applicationWillUpdate notification
|
||||
which will cause our observer of that notification to tell CFRunLoop to
|
||||
call us before waiting which will cause us to be fired again but only
|
||||
after exhausting the event queue.
|
||||
|
||||
The reason we do it this way is that peeking for an event causes CFRunLoop
|
||||
to reenter and fire off its timers, observers, and sources which we're
|
||||
better off avoiding. Doing it this way, we basically let CFRunLoop do the
|
||||
work of peeking for the next event which is much nicer.
|
||||
*/
|
||||
void wxApp::CF_ObserveMainRunLoopBeforeWaiting(CFRunLoopObserverRef observer, int activity)
|
||||
{
|
||||
// Ensure that CocoaDelegate_applicationWillUpdate will recreate us.
|
||||
// We've already been invalidated by CFRunLoop because we are one-shot.
|
||||
m_cfRunLoopIdleObserver.reset();
|
||||
#if 0
|
||||
wxLogTrace(wxTRACE_COCOA,wxT("Idle BEGIN (%d)"), sg_cApplicationWillUpdate);
|
||||
sg_cApplicationWillUpdate = 0;
|
||||
#else
|
||||
wxLogTrace(wxTRACE_COCOA,wxT("Idle BEGIN"));
|
||||
#endif
|
||||
if( ProcessIdle() || FakeNeedMoreIdle() )
|
||||
{
|
||||
wxLogTrace(wxTRACE_COCOA, wxT("Idle REQUEST MORE"));
|
||||
[NSApp setWindowsNeedUpdate:YES];
|
||||
}
|
||||
else
|
||||
{
|
||||
wxLogTrace(wxTRACE_COCOA, wxT("Idle END"));
|
||||
}
|
||||
}
|
||||
|
||||
/* A note about Cocoa's event loops vs. run loops:
|
||||
|
||||
It's important to understand that Cocoa has a two-level event loop. The
|
||||
outer level is run by NSApplication and can only ever happen on the main
|
||||
thread. The nextEventMatchingMask:untilDate:inMode:dequeue: method returns
|
||||
the next event which is then given to sendEvent: to send it. These
|
||||
methods are defined in NSApplication and are thus part of AppKit.
|
||||
|
||||
Events (NSEvent) are only sent due to actual user actions like clicking
|
||||
the mouse or moving the mouse or pressing a key and so on. There are no
|
||||
paint events; there are no timer events; there are no socket events; there
|
||||
are no idle events.
|
||||
|
||||
All of those types of "events" have nothing to do with the GUI at all.
|
||||
That is why Cocoa's AppKit doesn't implement them. Instead, they are
|
||||
implemented in Foundation's NSRunLoop which on OS X uses CFRunLoop
|
||||
to do the actual work.
|
||||
|
||||
How NSApplication uses NSRunLoop is rather interesting. Basically, it
|
||||
interacts with NSRunLoop only from within the nextEventMatchingMask
|
||||
method. It passes its inMode: argument almost directly to NSRunLoop
|
||||
and thus CFRunLoop. The run loop then runs (e.g. loops) until it
|
||||
is told to exit. The run loop calls the callout functions directly.
|
||||
From within those callout functions the run loop is considered to
|
||||
be running. Presumably, the AppKit installs a run loop source to
|
||||
receive messages from the window server over the mach port (like a
|
||||
socket). For some messages (e.g. need to paint) the AppKit will
|
||||
call application code like drawRect: without exiting the run loop.
|
||||
For other messages (ones that can be encapsulated in an NSEvent)
|
||||
the AppKit tells the run loop to exit which returns control to
|
||||
the nextEventMatchingMask method which then returns the NSEvent
|
||||
object. It's important to note that once the runloop has exited
|
||||
it is no longer considered running and thus if you ask it which
|
||||
mode it is running in it will return nil.
|
||||
|
||||
When manually pumping the event loop care should be taken to
|
||||
tell it to run in the correct mode. For instance, if you are
|
||||
using it to run a modal dialog then you want to run it in
|
||||
the modal panel run loop mode. AppKit presumably has sources
|
||||
or timers or observers that specifically don't listen on this
|
||||
mode. Another interesting mode is the connection reply mode.
|
||||
This allows Cocoa to wait for a response from a distributed
|
||||
objects message without firing off user code that may result
|
||||
in a DO call being made thus recursing. So basically, the
|
||||
mode is a way for Cocoa to attempt to avoid run loop recursion
|
||||
but to allow it under certain circumstances.
|
||||
*/
|
||||
|
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user