(bordered padding drawable)
Graphical elem that will draw drawable with a gray border.
Graphical elem that will draw drawable with a gray border.
(bounds elem)
Returns a 2 element vector with the [width, height] of an element's bounds with respect to its origin
Returns a 2 element vector with the [width, height] of an element's bounds with respect to its origin
(box-contains? [x y width height] [px py])
Tests whether [px py] is within [x y width height].
Tests whether [px py] is within [x y width height].
(button text)
(button text on-click)
(button text on-click hover?)
Graphical elem that draws a button. Optional on-click function may be provided that is called with no arguments when button has a mouse-down event.
Graphical elem that draws a button. Optional on-click function may be provided that is called with no arguments when button has a mouse-down event.
(checkbox checked?)
Graphical elem that will draw a checkbox.
Graphical elem that will draw a checkbox.
(children elem)
Returns sub elements of elem. Useful for traversal.
Returns sub elements of elem. Useful for traversal.
(clipboard-copy elem)
Returns the effects of a clipboard copy event on elem.
Returns the effects of a clipboard copy event on elem.
(clipboard-cut elem)
Returns the effects of a clipboard cut event on elem.
Returns the effects of a clipboard cut event on elem.
(clipboard-paste elem s)
Returns the effects of a clipboard paste event on elem.
Returns the effects of a clipboard paste event on elem.
(fill-bordered color padding drawable)
Graphical elem that will draw elem with filled border.
Graphical elem that will draw elem with filled border.
(filled-rectangle color width height)
Graphical elem that draws a filled rectangle with color, [r g b] or [r g b a].
Graphical elem that draws a filled rectangle with color, [r g b] or [r g b a].
(font name size)
Creates a font.
name
: Should be the path to a font file on desktop. If nil, use the default font.
size
: Size of the font. If nil, use the default font size.
Creates a font. `name`: Should be the path to a font file on desktop. If nil, use the default font. `size`: Size of the font. If nil, use the default font size.
(group & drawables)
Creates a graphical elem that will draw drawables in order
Creates a graphical elem that will draw drawables in order
(horizontal-layout & elems)
Returns a graphical elem of elems layed out next to eachother.
Returns a graphical elem of elems layed out next to eachother.
(-bounds elem)
Returns a 2 element vector with the [width, height] of an element's bounds with respect to its origin
Returns a 2 element vector with the [width, height] of an element's bounds with respect to its origin
Allows an element add, remove, modify effects emitted from its children.
Allows an element add, remove, modify effects emitted from its children.
(-bubble _ effects)
Called when an effect is being emitted by a child element. The parent element can either return the same effects or allow them to continue to bubble.
Called when an effect is being emitted by a child element. The parent element can either return the same effects or allow them to continue to bubble.
(-children elem)
Returns sub elements of elem. Useful for traversal.
Returns sub elements of elem. Useful for traversal.
(-can-handle? this event-type)
(-handle-event this event-type event-args)
(image image-path)
(image image-path [width height :as size])
(image image-path [width height :as size] opacity)
Graphical element that draws an image.
image-path
: using the skia backend, image-path
can be one of
(ui/image (clojure.java.io/resource "filename.png"))
The image can be drawn at a different size by supplying a size. Supply a nil size will use the the original image size.
The image can be aspect scaled by supply a size with one of the dimensions as nil.
For example, to draw an image with width 30 with aspect scaling, (image "path.png" [30 nil])
opacity is a float between 0 and 1.
Allowable image formats may vary by platform, but will typically include png and jpeg.
Graphical element that draws an image. `image-path`: using the skia backend, `image-path` can be one of - a string filename - a java.net.URL This is useful for drawing images included in a jar. Simply put your image in your resources folder, typically resources. Draw the images in the jar with `(ui/image (clojure.java.io/resource "filename.png"))` The image can be drawn at a different size by supplying a size. Supply a nil size will use the the original image size. The image can be aspect scaled by supply a size with one of the dimensions as nil. For example, to draw an image with width 30 with aspect scaling, `(image "path.png" [30 nil])` opacity is a float between 0 and 1. Allowable image formats may vary by platform, but will typically include png and jpeg.
(image-size image-path)
Returns the [width, height] of the file at image-path.
Returns the [width, height] of the file at image-path.
(-origin elem)
Specifies the top left corner of a component's bounds
The origin is vector or 2 numbers [x, y]
Specifies the top left corner of a component's bounds The origin is vector or 2 numbers [x, y]
(key-event elem key scancode action mods)
Returns the effects of a key event on elem.
Returns the effects of a key event on elem.
(key-press elem key)
Returns the effects of a key press event on elem.
Returns the effects of a key press event on elem.
(label text)
(label text font)
Graphical elem that can draw text.
label will use the default line spacing for newline. font should be a membrane.ui.Font
Graphical elem that can draw text. label will use the default line spacing for newline. font should be a membrane.ui.Font
(memoize-var f)
Returns a memoized version of a referentially transparent function. The memoized version of the function keeps a cache of the mapping from arguments to results and, when calls with the same arguments are repeated often, has higher performance at the expense of higher memory use.
Returns a memoized version of a referentially transparent function. The memoized version of the function keeps a cache of the mapping from arguments to results and, when calls with the same arguments are repeated often, has higher performance at the expense of higher memory use.
(mouse-down elem [mx my :as pos])
Returns the effects of a mouse down event on elem. Will only call -mouse-event or -mouse-down if the position is in the element's bounds.
Returns the effects of a mouse down event on elem. Will only call -mouse-event or -mouse-down if the position is in the element's bounds.
(mouse-event elem global-pos button mouse-down? mods)
(mouse-event elem global-pos button mouse-down? mods offset)
Returns the effects of a mouse move event on elem. Will only call -mouse-move on mouse events within an elements bounds.
mouse-event is used for both mouse up and mouse down events.
Returns the effects of a mouse move event on elem. Will only call -mouse-move on mouse events within an elements bounds. mouse-event is used for both mouse up and mouse down events.
(mouse-move elem global-pos)
(mouse-move elem global-pos offset)
Returns the effects of a mouse move event on elem. Will only call -mouse-move on mouse events within an elements bounds.
Returns the effects of a mouse move event on elem. Will only call -mouse-move on mouse events within an elements bounds.
(mouse-move-global elem global-pos)
(mouse-move-global elem global-pos offset)
Returns the effects of a mouse move event on elem. Will -mouse-move-global for all elements and their children.
Returns the effects of a mouse move event on elem. Will -mouse-move-global for all elements and their children.
(mouse-up elem [mx my :as pos])
Returns the effects of a mouse up event on elem. Will only call -mouse-event or -mouse-down if the position is in the element's bounds.
Returns the effects of a mouse up event on elem. Will only call -mouse-event or -mouse-down if the position is in the element's bounds.
(on & events)
Wraps an elem with event handlers.
events are pairs of events and event handlers and the last argument should be an elem.
example:
Adds do nothing event handlers for mouse-down and mouse-up events on a label that says "Hello!" (on :mouse-down (fn [[mx my]] nil) :mouse-up (fn [[mx my]] nil) (label "Hello!"))
Wraps an elem with event handlers. events are pairs of events and event handlers and the last argument should be an elem. example: Adds do nothing event handlers for mouse-down and mouse-up events on a label that says "Hello!" (on :mouse-down (fn [[mx my]] nil) :mouse-up (fn [[mx my]] nil) (label "Hello!"))
(on-bubble on-bubble & drawables)
Wraps drawables and adds a handler for bubbling
on-bubble should take seq of effects
Wraps drawables and adds a handler for bubbling on-bubble should take seq of effects
(on-click on-click & drawables)
Wrap an element with a mouse down event handler, on-click.
on-click must accept 0 arguments and should return a sequence of effects.
Wrap an element with a mouse down event handler, on-click. on-click must accept 0 arguments and should return a sequence of effects.
(on-clipboard-copy on-clipboard-copy & drawables)
Wraps drawables and adds a handler for clipboard copy events.
on-clipboard-copy should take 0 arguments and return a sequence of effects.
Wraps drawables and adds a handler for clipboard copy events. on-clipboard-copy should take 0 arguments and return a sequence of effects.
(on-clipboard-cut on-clipboard-cut & drawables)
Wraps drawables and adds a handler for clipboard cut events.
on-clipboard-copy should take 0 arguments and return a sequence of effects.
Wraps drawables and adds a handler for clipboard cut events. on-clipboard-copy should take 0 arguments and return a sequence of effects.
(on-clipboard-paste on-clipboard-paste & drawables)
Wraps drawables and adds a handler for clipboard paste events.
on-clipboard-paste should take 1 arguments s and return a sequence of effects.
Wraps drawables and adds a handler for clipboard paste events. on-clipboard-paste should take 1 arguments s and return a sequence of effects.
(on-key-event on-key-event & drawables)
Wraps drawables and adds a handler for key events.
on-key-event should take 4 arguments key, scancode, action, mods and return a sequence of effects.
Wraps drawables and adds a handler for key events. on-key-event should take 4 arguments key, scancode, action, mods and return a sequence of effects.
(on-key-press on-key-press & drawables)
Wraps drawables and adds an event handler for key-press events.
on-key-press should take 1 argument key and return a sequence of effects.
Wraps drawables and adds an event handler for key-press events. on-key-press should take 1 argument key and return a sequence of effects.
(on-mouse-down on-mouse-down & drawables)
Wraps drawables and adds an event handler for mouse-down events.
on-mouse-down should take 1 argument [mx my] of the mouse position in local coordinates and return a sequence of effects.
Wraps drawables and adds an event handler for mouse-down events. on-mouse-down should take 1 argument [mx my] of the mouse position in local coordinates and return a sequence of effects.
(on-mouse-event on-mouse-event & drawables)
Wraps drawables and adds an event handler for mouse events.
on-mouse-event should take 4 arguments [pos button mouse-down? mods] and return a sequence of effects.
Wraps drawables and adds an event handler for mouse events. on-mouse-event should take 4 arguments [pos button mouse-down? mods] and return a sequence of effects.
(on-mouse-move on-mouse-move & drawables)
Wraps drawables and adds an event handler for mouse-move events.
on-mouse-move down should take 1 argument [mx my] of the mouse position in local coordinates and return a sequence of effects.
Wraps drawables and adds an event handler for mouse-move events. on-mouse-move down should take 1 argument [mx my] of the mouse position in local coordinates and return a sequence of effects.
(on-mouse-move-global on-mouse-move-global & drawables)
Wraps drawables and adds an event handler for mouse-move-global events.
on-mouse-move-global down should take 1 argument [mx my] of the mouse position in global coordinates and return a sequence of effects.
Wraps drawables and adds an event handler for mouse-move-global events. on-mouse-move-global down should take 1 argument [mx my] of the mouse position in global coordinates and return a sequence of effects.
(on-mouse-up on-mouse-up & drawables)
Wraps drawables and adds an event handler for mouse-up events.
on-mouse-up should take 1 argument [mx my] of the mouse position in local coordinates and return a sequence of effects.
Wraps drawables and adds an event handler for mouse-up events. on-mouse-up should take 1 argument [mx my] of the mouse position in local coordinates and return a sequence of effects.
(on-scroll on-scroll & drawables)
Wraps drawables and adds an event handler for scroll events.
on-scroll should take 1 argument [offset-x offset-y] of the scroll offset and return a sequence of effects.
Wraps drawables and adds an event handler for scroll events. on-scroll should take 1 argument [offset-x offset-y] of the scroll offset and return a sequence of effects.
(origin elem)
Specifies the top left corner of a component's bounds
The origin is vector or 2 numbers [x, y]
Specifies the top left corner of a component's bounds The origin is vector or 2 numbers [x, y]
(origin-x elem)
Convience function for returning the x coordinate of elem's origin
Convience function for returning the x coordinate of elem's origin
(origin-y elem)
Convience function for returning the y coordinate of elem's origin
Convience function for returning the y coordinate of elem's origin
(path & points)
A graphical element that will draw lines connecting points.
See with-style, with-stroke-width, and with-color for more options.
A graphical element that will draw lines connecting points. See with-style, with-stroke-width, and with-color for more options.
(rectangle width height)
Graphical elem that draws a rectangle.
See with-style, with-stroke-width, and with-color for more options.
Graphical elem that draws a rectangle. See with-style, with-stroke-width, and with-color for more options.
(rounded-rectangle width height border-radius)
Graphical elem that draws a rounded rectangle.
Graphical elem that draws a rounded rectangle.
(scale sx sy & drawables)
Draw drawables using scalars which is a vector of [scale-x scale-y]
Draw drawables using scalars which is a vector of [scale-x scale-y]
(scissor-view offset bounds drawable)
Graphical elem to only draw drawable within bounds with an offset.
All other drawing will be clipped.
Graphical elem to only draw drawable within bounds with an offset. All other drawing will be clipped.
(scroll elem [offset-x offset-y :as offset])
Returns the effects of a scroll event on elem.
Returns the effects of a scroll event on elem.
(scrollview bounds offset drawable)
Graphical elem that will draw drawable offset by offset and clip its drawings to bounds.
Graphical elem that will draw drawable offset by offset and clip its drawings to bounds.
(spacer x y)
An empty graphical element with width x and height y.
Useful for layout.
An empty graphical element with width x and height y. Useful for layout.
(text-cursor text cursor)
(text-cursor text cursor font)
Graphical elem that can draw a text cursor
font should be a membrane.ui.Font
Graphical elem that can draw a text cursor font should be a membrane.ui.Font
(text-selection text [selection-start selection-end :as selection])
(text-selection text [selection-start selection-end :as selection] font)
Graphical elem for drawing a selection of text.
Graphical elem for drawing a selection of text.
(translate x y drawable)
A graphical elem that will shift drawable's origin by x and y and draw it at its new origin.
A graphical elem that will shift drawable's origin by x and y and draw it at its new origin.
(vertical-layout & elems)
Returns a graphical elem of elems stacked on top of each other
Returns a graphical elem of elems stacked on top of each other
(with-color color & drawables)
Use color for all children. Color is a vector of [r g b] or [r g b a]. All values should be between 0 and 1 inclusive.
Use color for all children. Color is a vector of [r g b] or [r g b a]. All values should be between 0 and 1 inclusive.
(with-stroke-width stroke-width & drawables)
Set the stroke width for drawables.
Set the stroke width for drawables.
(with-style style & drawables)
Style for drawing paths and polygons
style is one of: :membrane.ui/style-fill :membrane.ui/style-stroke :membrane.ui/style-stroke-and-fill
Style for drawing paths and polygons style is one of: :membrane.ui/style-fill :membrane.ui/style-stroke :membrane.ui/style-stroke-and-fill
(wrap-on & events)
Wraps an elem with event handlers.
events are pairs of events and event handlers and the last argument should be an elem. The event handlers should accept an extra first argument to the event which is the original event handler.
example:
Wraps a button with a mouse-down handler that only returns an effect when the x coordinate is even. (on :mouse-down (fn [handler [mx my]] (when (even? mx) (handler [mx my]))) (button "Hello!" (fn [] [[:hello!]])))
Wraps an elem with event handlers. events are pairs of events and event handlers and the last argument should be an elem. The event handlers should accept an extra first argument to the event which is the original event handler. example: Wraps a button with a mouse-down handler that only returns an effect when the x coordinate is even. (on :mouse-down (fn [handler [mx my]] (when (even? mx) (handler [mx my]))) (button "Hello!" (fn [] [[:hello!]])))
cljdoc is a website building & hosting documentation for Clojure/Script libraries
× close