Crate conrod [−] [src]

Conrod

An easy-to-use, immediate-mode, 2D GUI library featuring a range of useful widgets.

Reexports

pub use mouse::Mouse;
pub use mouse::ButtonState as MouseButtonState;

Modules

color
mouse
utils

Structs

Background

A type for drawing a colored window background.

Button

A pressable button widget whose reaction is triggered upon release.

Canvas

The kind of Canvas.

DropDownList

Displays a given Vec<String> as a selectable drop down menu. It's reaction is triggered upon selection of a list item.

EnvelopeEditor

Used for editing a series of 2D Points on a cartesian (X, Y) plane within some given range. Useful for things such as oscillator/automation envelopes or any value series represented periodically.

Label

Displays some given text centred within a rectangle.

NumberDialer

A widget for precision control over any digit within a value. The reaction is triggered when the value is updated or if the mouse button is released while the cursor is above the widget.

Slider

Linear value selection. If the slider's width is greater than it's height, it will automatically become a horizontal slider, otherwise it will be a vertical slider. Its reaction is triggered if the value is updated or if the mouse button is released while the cursor is above the rectangle.

Split

A type of Canvas for flexibly designing and guiding widget layout as splits of a window.

TextBox

A widget for displaying and mutating a given one-line text String. It's reaction is triggered upon pressing of the Enter/Return key.

Theme

A serializable collection of widget styling defaults.

Toggle

A pressable widget for toggling the state of a bool. Like the button widget, it's reaction is triggered upon release and will return the new bool state. Note that the toggle will not mutate the bool for you, you should do this yourself within the react closure.

Ui

Ui is the most important type within Conrod and is necessary for rendering and maintaining widget state.

Ui Handles the following:

  • Contains the state of all widgets which can be indexed via their UiId.
  • Stores rendering state for each widget until the end of each render cycle.
  • Contains the theme used for default styling of the widgets.
  • Maintains the latest user input state (for mouse and keyboard).
  • Maintains the latest window dimensions.
WidgetMatrix

Draw a matrix of any rectangular widget type, where the matrix will provide a function with the widget number, it's rows and cols position, the width and height for the widget and the location at which the widget should be drawn.

WidgetUpdate

An update to be returned by the widget after each pass.

XYPad

Used for displaying and controlling a 2D point on a cartesian plane within a given range. Its reaction is triggered when the value is updated or if the mouse button is released while the cursor is above the rectangle.

Enums

Color

Color supporting RGB and HSL variants.

Corner

A corner of a rectangle.

Direction

Directionally positioned, relative to another widget.

Framing

To be used as a parameter for defining the aesthetic of the widget frame.

HorizontalAlign

The horizontal alignment of a widget positioned relatively to another widget on the y axis.

Place

Place the widget at a position on the Canvas.

Position

A cached widget's position for rendering.

VerticalAlign

The vertical alignment of a widget positioned relatively to another widget on the x axis.

Traits

CharacterCache

Stores characters in a buffer and loads them by demand.

Colorable

Types that can be colored.

CustomWidget

A trait to be implemented for Custom widget types.

CustomWidgetState

The state to be stored within the Uis widget cache.

EnvelopePoint

EnvPoint must be implemented for any type that is used as a 2D point within the EnvelopeEditor.

Frameable

Widgets that may display a frame.

Labelable

Widgets that may display some label.

Positionable

Widgets that are positionable.

Sizeable

Widgets that support different dimensions.

Functions

align_bottom_of

The y offset required to align an element with height to the bottom of a target element.

align_left_of

The x offset required to align an element with width to the left of a target element.

align_right_of

The x offset required to align an element with width to the right of a target element.

align_top_of

The y offset required to align an element with height to the top of a target element.

Type Definitions

CanvasId

Unique identifier for Canvasses.

Depth

The depth at which the widget will be rendered. This determines the order of rendering where widgets with a greater depth will be rendered first. 0.0 is the default depth.

Dimensions

General use 2D spatial dimensions.

FontSize

Font size used throughout Conrod.

Point

General use 2D spatial point.

UiId

User interface identifier. Each widget must use a unique UiId so that it's state can be cached within the Ui type. The reason we use a usize is because widgets are cached within a Vec, which is limited to a size of usize elements.