SCView

Inherits From:
SCOpenGLView : NSView : NSResponder : NSObject

Conforms To:
NSCoding
SCDrawable

Declared In:
Sc21/SCView.h

Class Description

SCView and SCDrawable

SCView conforms to the SCDrawable protocol, which means it can be used by an SCController to display a Coin scenegraph.

Note that when connecting SCView's controller outlet, the controller's drawable will automatically be set to the SCView.

Event handling

Instead of handling events directly, SCView forwards them to its SCController's handleEvent: method. Refer to the SCEventHandler documentation for more information.


Global Variables

Synopsis:

NSString * SCCursorChangedNotification;


Method Types

Initializing an SCView
- initWithFrame:pixelFormat:
- initWithFrame:
Accessing the controller
- controller
- setController:
Event handling
- mouseMoved:
- mouseDown:
- mouseUp:
- mouseDragged:
- otherMouseDown:
- otherMouseUp:
- otherMouseDragged:
- rightMouseDown:
- rightMouseUp:
- rightMouseDragged:
- scrollWheel:
- keyDown:
- keyUp:
- flagsChanged:

Instance Methods

controller

- (SCController *)controller

Returns the receiver's SCController.


flagsChanged:

- (void)flagsChanged:(NSEvent *)event

Forwards event to the controller. If the event is not handled by the controller, it will be sent on through the responder chain as usual.


initWithFrame:

- (id)initWithFrame:(NSRect)rect

Equivalent to calling [self initWithFrame:rect format:nil].


initWithFrame:pixelFormat:

- (id)initWithFrame:(NSRect)rect pixelFormat:(SCOpenGLPixelFormat *)format

Designated initializer.

Initializes a newly allocated SCView with rect as its frame rectangle and sets up an OpenGL context with the pixelformat format. Returns self.


keyDown:

- (void)keyDown:(NSEvent *)event

Forwards event to the controller. If the event is not handled by the controller, it will be sent on through the responder chain as usual.


keyUp:

- (void)keyUp:(NSEvent *)event

Forwards event to the controller. If the event is not handled by the controller, it will be sent on through the responder chain as usual.


mouseDown:

- (void)mouseDown:(NSEvent *)event

Forwards event to the controller. If the event is not handled by the controller, it will be sent on through the responder chain as usual.

Note that if you press the left mouse button while holding down the ctrl key, you will not receive a mouseDown event. Instead, the view's default context menu will be shown. (This behavior is inherited from NSView.) If you want to handle ctrl-click yourself, you have to subclass SCView and override - (NSMenu *)menuForEvent:(NSEvent *)event to return nil. This will cause the event to be passed on to this function.


mouseDragged:

- (void)mouseDragged:(NSEvent *)event

Forwards event to the controller. If the event is not handled by the controller, it will be sent on through the responder chain as usual.

Note that when processing "mouse dragged" events, Coin does not distinguish between left and right mouse button. If you interested in that information, you have to evaluate the last mouseDown that occured before the dragging.


mouseMoved:

- (void)mouseMoved:(NSEvent *)event

Forwards event to the controller. If the event is not handled by the controller, it will be sent on through the responder chain as usual.

Note: You have to send setAcceptsMouseMovedEvents:YES to the receiver's parent NSWindow to enable NSMouseMoved events.


mouseUp:

- (void)mouseUp:(NSEvent *)event

Forwards event to the controller. If the event is not handled by the controller, it will be sent on through the responder chain as usual.


otherMouseDown:

- (void)otherMouseDown:(NSEvent *)event

Forwards event to the controller. If the event is not handled by the controller, it will be sent on through the responder chain as usual.


otherMouseDragged:

- (void)otherMouseDragged:(NSEvent *)event

Forwards event to the controller. If the event is not handled by the controller, it will be sent on through the responder chain as usual.

Note that when processing "mouse dragged" events, Coin does not distinguish between left and right mouse button. If you are interested in that information, you have to evaluate the last mouseDown that occured before the dragging.


otherMouseUp:

- (void)otherMouseUp:(NSEvent *)event

Forwards event to the controller. If the event is not handled by the controller, it will be sent on through the responder chain as usual.


rightMouseDown:

- (void)rightMouseDown:(NSEvent *)event

Forwards event to the controller. If the event is not handled by the controller, it will be sent on through the responder chain as usual.


rightMouseDragged:

- (void)rightMouseDragged:(NSEvent *)event

Forwards event to the controller. If the event is not handled by the controller, it will be sent on through the responder chain as usual.

Note that when processing "mouse dragged" events, Coin does not distinguish between left and right mouse button. If you are interested in that information, you have to evaluate the last mouseDown that occured before the dragging.


rightMouseUp:

- (void)rightMouseUp:(NSEvent *)event

Forwards event to the controller. If the event is not handled by the controller, it will be sent on through the responder chain as usual.


scrollWheel:

- (void)scrollWheel:(NSEvent *)event

Forwards event to the controller. If the event is not handled by the controller, it will be sent on through the responder chain as usual.


setController:

- (void)setController:(SCController *)newcontroller

Sets the receiver's SCController to newcontroller. newcontroller is retained.


Sc21 version 1.0 © 2003-2004 Systems in Motion AS.