SuperCollider CLASSES (extension)

WindowHandleView

A custom view that enables dragging of it's parent window.
Source: /home/egor/.local/share/SuperCollider/downloaded-quarks/WindowHandleView/WindowHandleView.sc
Inherits from: UserView : View : QObject : Object

Description

WindowHandleView is a view that acts as a drag handle for it's parent window. This is generally useful for windows without titlebars.

NOTE: By default WindowHandleView has no content other than it's background, so if it's contained in a layout it may be resized to a 0px width or height. To prevent this, specify an explicit size using View: -minHeight / View: -minWidth / View: -minSize or View: -fixedHeight / View: -fixedWidth / View: -fixedSize.

Class Methods

*new (parent, bounds)

Creates a new instance of View and makes it a child of another View or Window, effectively placing it within the parent's visual space. If there is a decorator installed on the parent, it will manage the position of the new View.

NOTE: The 'parent' argument may be omitted, in which case the view will be displayed as a window on its own, when shown.

The 'bounds' argument may be omitted, in which case the view will be created with its preferred size at position (0,0).

If a parent is given and there is a layout installed on it, the layout will manage the position and size of this view and the 'bounds' argument will have no effect.

Arguments:

parent

The instance of View or Window that the new View will become a child of.

bounds

A Rect or a Point describing size and position of the new View. If a Point is given, its coordinates will denote the view's size, while the view's position will be (0,0). Position is measured relative to the parent's top-left corner.

Inherited class methods

Undocumented class methods

*new (parent, bounds)

*qtClass

Instance Methods

-setBackgroundImage (image, tileMode: 5, alpha: 1, fromRect)

Set the background image for the view. Default option is to x-y tile, unlike base class implementation of this function.

Arguments:

image

An image for the background. Can be nil for no background image. Defaults to a crosshatch pattern.

Inherited instance methods

Undocumented instance methods

-drawBorder

-mouseDown (x, y)

-mouseMove (x, y)

-mouseUp (v, x, y)

-setDefaultBackground (v)

-win

-win = value

Examples

(
w = Window(border:false);
w.view.layout_(
    VLayout(
        WindowHandleView().minHeight_(20),
        StaticText().string_("Here's a window."),
        StaticText().string_("You can drag it using the handle above."),
        Button().states_([["Close"]]).action_({ w.close }),
        nil
    ).margins_(2)
).front;
)