diff options
| author | scaraveo <unknown> | 2007-06-01 00:57:26 +0000 | 
|---|---|---|
| committer | scaraveo <unknown> | 2007-06-01 00:57:26 +0000 | 
| commit | 710f716e96f6e9ee9eb410b343b78b3c4d95bc46 (patch) | |
| tree | 55e5547869daa67b6a639c89825058baf75545c7 /macosx/TCarbonEvent.cxx | |
| parent | cac98b923422b91839f7c285a9b78ea282cd6f0a (diff) | |
| download | scintilla-mirror-710f716e96f6e9ee9eb410b343b78b3c4d95bc46.tar.gz | |
integrate OS X support for scintilla.  a big patch with a little commit message :)
- now uses namespaces (optionally for non-os x) to avoid conflicts with OS X libraries
- several fixes in the OS X layer since the branch was commited in 2005
- used in Komodo since 2005, so pretty stable
Diffstat (limited to 'macosx/TCarbonEvent.cxx')
| -rw-r--r-- | macosx/TCarbonEvent.cxx | 519 | 
1 files changed, 519 insertions, 0 deletions
| diff --git a/macosx/TCarbonEvent.cxx b/macosx/TCarbonEvent.cxx new file mode 100644 index 000000000..eca31e569 --- /dev/null +++ b/macosx/TCarbonEvent.cxx @@ -0,0 +1,519 @@ +/* +    File:		TCarbonEvent.cp +     +    Version:	1.0 + +	Disclaimer:	IMPORTANT:  This Apple software is supplied to you by Apple Computer, Inc. +				("Apple") in consideration of your agreement to the following terms, and your +				use, installation, modification or redistribution of this Apple software +				constitutes acceptance of these terms.  If you do not agree with these terms, +				please do not use, install, modify or redistribute this Apple software. + +				In consideration of your agreement to abide by the following terms, and subject +				to these terms, Apple grants you a personal, non-exclusive license, under AppleÕs +				copyrights in this original Apple software (the "Apple Software"), to use, +				reproduce, modify and redistribute the Apple Software, with or without +				modifications, in source and/or binary forms; provided that if you redistribute +				the Apple Software in its entirety and without modifications, you must retain +				this notice and the following text and disclaimers in all such redistributions of +				the Apple Software.  Neither the name, trademarks, service marks or logos of +				Apple Computer, Inc. may be used to endorse or promote products derived from the +				Apple Software without specific prior written permission from Apple.  Except as +				expressly stated in this notice, no other rights or licenses, express or implied, +				are granted by Apple herein, including but not limited to any patent rights that +				may be infringed by your derivative works or by other works in which the Apple +				Software may be incorporated. + +				The Apple Software is provided by Apple on an "AS IS" basis.  APPLE MAKES NO +				WARRANTIES, EXPRESS OR IMPLIED, INCLUDING WITHOUT LIMITATION THE IMPLIED +				WARRANTIES OF NON-INFRINGEMENT, MERCHANTABILITY AND FITNESS FOR A PARTICULAR +				PURPOSE, REGARDING THE APPLE SOFTWARE OR ITS USE AND OPERATION ALONE OR IN +				COMBINATION WITH YOUR PRODUCTS. + +				IN NO EVENT SHALL APPLE BE LIABLE FOR ANY SPECIAL, INDIRECT, INCIDENTAL OR +				CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE +				GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) +				ARISING IN ANY WAY OUT OF THE USE, REPRODUCTION, MODIFICATION AND/OR DISTRIBUTION +				OF THE APPLE SOFTWARE, HOWEVER CAUSED AND WHETHER UNDER THEORY OF CONTRACT, TORT +				(INCLUDING NEGLIGENCE), STRICT LIABILITY OR OTHERWISE, EVEN IF APPLE HAS BEEN +				ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + +	Copyright © 2002 Apple Computer, Inc., All Rights Reserved +*/ + +#include "TCarbonEvent.h" + +//----------------------------------------------------------------------------------- +//	TCarbonEvent constructor +//----------------------------------------------------------------------------------- +// +TCarbonEvent::TCarbonEvent( +	UInt32				inClass, +	UInt32				inKind ) +{ +	CreateEvent( NULL, inClass, inKind, GetCurrentEventTime(), 0, &fEvent ); +} + +//----------------------------------------------------------------------------------- +//	TCarbonEvent constructor +//----------------------------------------------------------------------------------- +// +TCarbonEvent::TCarbonEvent( +	EventRef			inEvent ) +{ +	fEvent = inEvent; +	RetainEvent( fEvent ); +} + +//----------------------------------------------------------------------------------- +//	TCarbonEvent destructor +//----------------------------------------------------------------------------------- +// +TCarbonEvent::~TCarbonEvent() +{ +	ReleaseEvent( fEvent ); +} + +//----------------------------------------------------------------------------------- +//	GetClass +//----------------------------------------------------------------------------------- +// +UInt32 TCarbonEvent::GetClass() const +{ +	return GetEventClass( fEvent ); +} + +//----------------------------------------------------------------------------------- +//	GetKind +//----------------------------------------------------------------------------------- +// +UInt32 TCarbonEvent::GetKind() const +{ +	return GetEventKind( fEvent ); +} + +//----------------------------------------------------------------------------------- +//	SetTime +//----------------------------------------------------------------------------------- +// +void TCarbonEvent::SetTime( +	EventTime			inTime ) +{ +	SetEventTime( fEvent, inTime ); +} + +//----------------------------------------------------------------------------------- +//	GetTime +//----------------------------------------------------------------------------------- +// +EventTime TCarbonEvent::GetTime() const +{ +	return GetEventTime( fEvent ); +} + +//----------------------------------------------------------------------------------- +//	Retain +//----------------------------------------------------------------------------------- +// +void TCarbonEvent::Retain() +{ +	RetainEvent( fEvent ); +} + +//----------------------------------------------------------------------------------- +//	Release +//----------------------------------------------------------------------------------- +// +void TCarbonEvent::Release() +{ +	ReleaseEvent( fEvent ); +} + +//----------------------------------------------------------------------------------- +//	PostToQueue +//----------------------------------------------------------------------------------- +// +OSStatus TCarbonEvent::PostToQueue( +	EventQueueRef		inQueue, +	EventPriority		inPriority ) +{ +	return PostEventToQueue( inQueue, fEvent, inPriority ); +} + +//----------------------------------------------------------------------------------- +//	SetParameter +//----------------------------------------------------------------------------------- +// +OSStatus TCarbonEvent::SetParameter( +	EventParamName		inName, +	EventParamType		inType, +	UInt32				inSize, +	const void*			inData ) +{ +	return SetEventParameter( fEvent, inName, inType, inSize, inData ); +} + +//----------------------------------------------------------------------------------- +//	GetParameter +//----------------------------------------------------------------------------------- +// +OSStatus TCarbonEvent::GetParameter( +	EventParamName		inName, +	EventParamType		inType, +	UInt32				inBufferSize, +	void*				outData ) +{ +	return GetEventParameter( fEvent, inName, inType, NULL, inBufferSize, NULL, outData ); +} + +//----------------------------------------------------------------------------------- +//	GetParameterType +//----------------------------------------------------------------------------------- +// +OSStatus TCarbonEvent::GetParameterType( +	EventParamName		inName, +	EventParamType*		outType ) +{ +	return GetEventParameter( fEvent, inName, typeWildCard, outType, 0, NULL, NULL ); +} + +//----------------------------------------------------------------------------------- +//	GetParameterSize +//----------------------------------------------------------------------------------- +// +OSStatus TCarbonEvent::GetParameterSize( +	EventParamName		inName, +	UInt32*				outSize ) +{ +	return GetEventParameter( fEvent, inName, typeWildCard, NULL, 0, outSize, NULL ); +} + +//----------------------------------------------------------------------------------- +//	SetParameter +//----------------------------------------------------------------------------------- +// +OSStatus TCarbonEvent::SetParameter( +	EventParamName		inName, +	Boolean				inValue ) +{ +	return SetParameter<Boolean>( inName, typeBoolean, inValue ); +} + +//----------------------------------------------------------------------------------- +//	GetParameter +//----------------------------------------------------------------------------------- +// +OSStatus TCarbonEvent::GetParameter( +	EventParamName		inName, +	Boolean*			outValue ) +{ +	return GetParameter<Boolean>( inName, typeBoolean, outValue ); +} + +//----------------------------------------------------------------------------------- +//	SetParameter +//----------------------------------------------------------------------------------- +// +OSStatus TCarbonEvent::SetParameter( +	EventParamName		inName, +	bool				inValue ) +{ +	return SetParameter<Boolean>( inName, typeBoolean, (Boolean) inValue ); +} + +//----------------------------------------------------------------------------------- +//	GetParameter +//----------------------------------------------------------------------------------- +// +OSStatus TCarbonEvent::GetParameter( +	EventParamName		inName, +	bool*				outValue ) +{ +	return GetParameter<Boolean>( inName, sizeof( Boolean ), (Boolean*) outValue ); +} + +//----------------------------------------------------------------------------------- +//	SetParameter +//----------------------------------------------------------------------------------- +// +OSStatus TCarbonEvent::SetParameter( +	EventParamName		inName, +	Point				inPt ) +{ +	return SetParameter<Point>( inName, typeQDPoint, inPt ); +} + +//----------------------------------------------------------------------------------- +//	GetParameter +//----------------------------------------------------------------------------------- +// +OSStatus TCarbonEvent::GetParameter( +	EventParamName		inName, +	Point*				outPt ) +{ +	return GetParameter<Point>( inName, typeQDPoint, outPt ); +} + +//----------------------------------------------------------------------------------- +//	SetParameter +//----------------------------------------------------------------------------------- +// +OSStatus TCarbonEvent::SetParameter( +	EventParamName		inName, +	const HIPoint&		inPt ) +{ +	return SetParameter<HIPoint>( inName, typeHIPoint, inPt ); +} + +//----------------------------------------------------------------------------------- +//	GetParameter +//----------------------------------------------------------------------------------- +// +OSStatus TCarbonEvent::GetParameter( +	EventParamName		inName, +	HIPoint*			outPt ) +{ +	return GetParameter<HIPoint>( inName, typeHIPoint, outPt ); +} + +//----------------------------------------------------------------------------------- +//	SetParameter +//----------------------------------------------------------------------------------- +// +OSStatus TCarbonEvent::SetParameter( +	EventParamName		inName, +	const Rect&			inRect ) +{ +	return SetParameter<Rect>( inName, typeQDRectangle, inRect ); +} + +//----------------------------------------------------------------------------------- +//	GetParameter +//----------------------------------------------------------------------------------- +// +OSStatus TCarbonEvent::GetParameter( +	EventParamName		inName, +	Rect*				outRect ) +{ +	return GetParameter<Rect>( inName, typeQDRectangle, outRect ); +} + +//----------------------------------------------------------------------------------- +//	SetParameter +//----------------------------------------------------------------------------------- +// +OSStatus TCarbonEvent::SetParameter( +	EventParamName		inName, +	const HIRect&		inRect ) +{ +	return SetParameter<HIRect>( inName, typeHIRect, inRect ); +} + +//----------------------------------------------------------------------------------- +//	GetParameter +//----------------------------------------------------------------------------------- +// +OSStatus TCarbonEvent::GetParameter( +	EventParamName		inName, +	HIRect*				outRect ) +{ +	return GetParameter<HIRect>( inName, typeHIRect, outRect ); +} + +//----------------------------------------------------------------------------------- +//	SetParameter +//----------------------------------------------------------------------------------- +// +OSStatus TCarbonEvent::SetParameter( +	EventParamName		inName, +	const HISize&		inSize ) +{ +	return SetParameter<HISize>( inName, typeHISize, inSize ); +} + +//----------------------------------------------------------------------------------- +//	GetParameter +//----------------------------------------------------------------------------------- +// +OSStatus TCarbonEvent::GetParameter( +	EventParamName		inName, +	HISize*				outSize ) +{ +	return GetParameter<HISize>( inName, typeHISize, outSize ); +} + +//----------------------------------------------------------------------------------- +//	SetParameter +//----------------------------------------------------------------------------------- +// +OSStatus TCarbonEvent::SetParameter( +	EventParamName		inName, +	RgnHandle			inRegion ) +{ +	return SetParameter<RgnHandle>( inName, typeQDRgnHandle, inRegion ); +} + +//----------------------------------------------------------------------------------- +//	GetParameter +//----------------------------------------------------------------------------------- +// +OSStatus TCarbonEvent::GetParameter( +	EventParamName		inName, +	RgnHandle*			outRegion ) +{ +	return GetParameter<RgnHandle>( inName, typeQDRgnHandle, outRegion ); +} + +//----------------------------------------------------------------------------------- +//	SetParameter +//----------------------------------------------------------------------------------- +// +OSStatus TCarbonEvent::SetParameter( +	EventParamName		inName, +	WindowRef			inWindow ) +{ +	return SetParameter<WindowRef>( inName, typeWindowRef, inWindow ); +} + +//----------------------------------------------------------------------------------- +//	GetParameter +//----------------------------------------------------------------------------------- +// +OSStatus TCarbonEvent::GetParameter( +	EventParamName		inName, +	WindowRef*			outWindow ) +{ +	return GetParameter<WindowRef>( inName, typeWindowRef, outWindow ); +} + +//----------------------------------------------------------------------------------- +//	SetParameter +//----------------------------------------------------------------------------------- +// +OSStatus TCarbonEvent::SetParameter( +	EventParamName		inName, +	ControlRef			inControl ) +{ +	return SetParameter<ControlRef>( inName, typeControlRef, inControl ); +} + +//----------------------------------------------------------------------------------- +//	GetParameter +//----------------------------------------------------------------------------------- +// +OSStatus TCarbonEvent::GetParameter( +	EventParamName		inName, +	ControlRef* outControl ) +{ +	return GetParameter<ControlRef>( inName, typeControlRef, outControl ); +} + +//----------------------------------------------------------------------------------- +//	SetParameter +//----------------------------------------------------------------------------------- +// +OSStatus TCarbonEvent::SetParameter( +	EventParamName		inName, +	MenuRef				inMenu ) +{ +	return SetParameter<MenuRef>( inName, typeMenuRef, inMenu ); +} + +//----------------------------------------------------------------------------------- +//	GetParameter +//----------------------------------------------------------------------------------- +// +OSStatus TCarbonEvent::GetParameter( +	EventParamName		inName, +	MenuRef*			outMenu ) +{ +	return GetParameter<MenuRef>( inName, typeMenuRef, outMenu ); +} + +//----------------------------------------------------------------------------------- +//	SetParameter +//----------------------------------------------------------------------------------- +// +OSStatus TCarbonEvent::SetParameter( +	EventParamName		inName, +	DragRef				inDrag ) +{ +	return SetParameter<DragRef>( inName, typeDragRef, inDrag ); +} + +//----------------------------------------------------------------------------------- +//	GetParameter +//----------------------------------------------------------------------------------- +// +OSStatus TCarbonEvent::GetParameter( +	EventParamName		inName, +	DragRef*			outDrag ) +{ +	return GetParameter<DragRef>( inName, typeDragRef, outDrag ); +} + +//----------------------------------------------------------------------------------- +//	SetParameter +//----------------------------------------------------------------------------------- +// +OSStatus TCarbonEvent::SetParameter( +	EventParamName		inName, +	UInt32				inValue ) +{ +	return SetParameter<UInt32>( inName, typeUInt32, inValue ); +} + +//----------------------------------------------------------------------------------- +//	GetParameter +//----------------------------------------------------------------------------------- +// +OSStatus TCarbonEvent::GetParameter( +	EventParamName		inName, +	UInt32*				outValue ) +{ +	return GetParameter<UInt32>( inName, typeUInt32, outValue ); +} + +//----------------------------------------------------------------------------------- +//	SetParameter +//----------------------------------------------------------------------------------- +// +OSStatus TCarbonEvent::SetParameter( +	EventParamName		inName, +	const HICommand&	inValue ) +{ +	return SetParameter<HICommand>( inName, typeHICommand, inValue ); +} + +//----------------------------------------------------------------------------------- +//	GetParameter +//----------------------------------------------------------------------------------- +// +OSStatus TCarbonEvent::GetParameter( +	EventParamName		inName, +	HICommand*			outValue ) +{ +	return GetParameter<HICommand>( inName, typeHICommand, outValue ); +} + +//----------------------------------------------------------------------------------- +//	SetParameter +//----------------------------------------------------------------------------------- +// +OSStatus TCarbonEvent::SetParameter( +	EventParamName			inName, +	const ControlPartCode&	inValue ) +{ +	return SetParameter<ControlPartCode>( inName, typeControlPartCode, inValue ); +} + +//----------------------------------------------------------------------------------- +//	GetParameter +//----------------------------------------------------------------------------------- +// +OSStatus TCarbonEvent::GetParameter( +	EventParamName		inName, +	ControlPartCode*	outValue ) +{ +	return GetParameter<ControlPartCode>( inName, typeControlPartCode, outValue ); +} | 
