MerzView
Note: Delegates are experimental and the API and behavior may change.
- class merz.views.MerzView(posSize, backgroundColor=None, delegate=None)
A vanilla view that displays Merz layers.
The group can optionally have a
backgroundColor
.Optionally a `delegate` can be provided. A delegate can receive users events: | delegate method | user event | | --- | --- | --- | | "sizeChanged" | Called when the view frame is changed. | | "scrollViewSizeChanged" | Called when the scroll view frame is changed, | | "movedToWindow" | Called when the view has moved to a window. | | "acceptsFirstResponder" | Called to ask if the view should accepts being first responder, default `False`, the return value must be a bool. | | "becomeFirstResponder" | Called to ask if the view should become the first responder, default `True`, the return value must be a bool. | | "resignFirstResponder" | Called to ask if the view should resign being the first responder, default `True`, the return value must be a bool. | | "acceptsMouseMoved" | Called to ask if the view should accept mouse moved event, default `False`, the return value must be a bool. | | "updateTrackingAreas" | Called when mouse tracking areas need to be updated. By default, the view has one area covering the entire view unless overriden by this delegate method. If overriden, a list of `(x, y, w, h)` areas must be returned. | | "mouseMoved" | Called when the mouse has moved, argument is: `event` | | "mouseEntered" | Called when the mouse has entered the view, argument is: `event` | | "mouseExited" | Called when the mouse has exited the view, argument is: `event` | | "mouseDown" | Called on mouse down inside the view, argument is: `event` | | "mouseDragged" | Called when the mouse has been dragged inside the view, argument is: `event` | | "mouseUp" | Called on mouse up, argument is: `event` | | "rightMouseDown" | Called on right mouse down inside the view, argument is: `event` | | "rightMouseDragged" | Called when the right mouse has been dragged inside the view, argument is: `event` | | "rightMouseUp" | Called on right mouse up, argument is: `event` | | "keyDown" | Called on key down, argument is: `event` | | "keyUp" | Called on key up, argument is: `event` | | "flagsChanged" | Called when any of the modifier keys changed, argument is: `event`| | "scrollWheel" | Called on a scroll wheel user event, argument is: `event` | | "magnifyWithEvent" | Called when user pinches on a trackpad, argument is: `event` | | "rotateWithEvent" | Called when user rotates on a trackpad, argument is: `event` | | "swipeWithEvent" | Called when user swipes on a trackpad, argument is: `event` | | "menu" | called when user requests a contextual menu, argument is: `event`. Return a `NSMenu`. |
- MerzView.getMerzContainer()
Return the merz container.
ScrollingMerzView
Note: Delegates are experimental and the API and behavior may change.
- class merz.views.ScrollingMerzView(*args, delegate=None, centered=True, **kwargs)
A vanilla
ScrollView
with aMerzDocumentView
.The Merz view can be
centered
inside the scroll view. This isTrue
by default.Optionally a `delegate` can be provided. A delegate can receive users events: | delegate method | user event | | --- | --- | --- | | "sizeChanged" | Called when the view frame is changed. | | "scrollViewSizeChanged" | Called when the scroll view frame is changed, | | "movedToWindow" | Called when the view has moved to a window. | | "acceptsFirstResponder" | Called to ask if the view should accepts being first responder, default `False`, the return value must be a bool. | | "becomeFirstResponder" | Called to ask if the view should become the first responder, default `True`, the return value must be a bool. | | "resignFirstResponder" | Called to ask if the view should resign being the first responder, default `True`, the return value must be a bool. | | "acceptsMouseMoved" | Called to ask if the view should accept mouse moved event, default `False`, the return value must be a bool. | | "updateTrackingAreas" | Called when mouse tracking areas need to be updated. By default, the view has one area covering the entire view unless overriden by this delegate method. If overriden, a list of `(x, y, w, h)` areas must be returned. | | "mouseMoved" | Called when the mouse has moved, argument is: `event` | | "mouseEntered" | Called when the mouse has entered the view, argument is: `event` | | "mouseExited" | Called when the mouse has exited the view, argument is: `event` | | "mouseDown" | Called on mouse down inside the view, argument is: `event` | | "mouseDragged" | Called when the mouse has been dragged inside the view, argument is: `event` | | "mouseUp" | Called on mouse up, argument is: `event` | | "rightMouseDown" | Called on right mouse down inside the view, argument is: `event` | | "rightMouseDragged" | Called when the right mouse has been dragged inside the view, argument is: `event` | | "rightMouseUp" | Called on right mouse up, argument is: `event` | | "keyDown" | Called on key down, argument is: `event` | | "keyUp" | Called on key up, argument is: `event` | | "flagsChanged" | Called when any of the modifier keys changed, argument is: `event`| | "scrollWheel" | Called on a scroll wheel user event, argument is: `event` | | "magnifyWithEvent" | Called when user pinches on a trackpad, argument is: `event` | | "rotateWithEvent" | Called when user rotates on a trackpad, argument is: `event` | | "swipeWithEvent" | Called when user swipes on a trackpad, argument is: `event` | | "menu" | called when user requests a contextual menu, argument is: `event`. Return a `NSMenu`. |
- ScrollingMerzView.getMerzView()
Return the merz document view.
- ScrollingMerzView.getMerzContainer()
Return the merz container.
- ScrollingMerzView.getMerzViewSize()
Get the size of the merz document view.
- ScrollingMerzView.setMerzViewSize(size)
Set the size of the merz document view.