Index: Classes
Action
Mousetrap.Action
— TypeAction <: SignalEmitter
Memory-managed object that wraps a function. Each action has a unique ID and is registered with the Application
. It can furthermore have any number of shortcut triggers.
Use set_function!
to register a callback to be called when the action is activated in any way. This function is required to have the signature:
(::Action, [::Data_t]) -> Nothing
Each action can be enabled or disabled. If an action is disabled, all associated widgets, keybindings and menu items will be disabled automatically.
See the manual chapter on actions for more information.
Constructors
Action(::ActionID, ::Application)
Action(stateless_f, ::ActionID, ::Application)
Signals
activated
(::Action, [::Data_t]) -> Nothing
Emitted when
activate!
is called, or theAction
is otherwise activated.
Fields
(no public fields)
Example
action = Action("example.action", app)
set_function!(action) do self::Action
println(get_id(self) * " activated.")
end
activate!(action)
Functions that operate on this type:
activate!
add_action!
add_shortcut!
clear_shortcuts!
get_enabled
get_id
get_shortcuts
remove_action!
set_action!
set_button_action!
set_enabled!
set_function!
set_listens_for_shortcut_action!
connect_signal_activated!
disconnect_signal_activated!
emit_signal_activated
get_signal_activated_blocked
set_signal_activated_blocked!
ActionBar
Mousetrap.ActionBar
— TypeActionBar <: Widget
Horizontal bar, has an area for widgets at the start and end, along with a singular centered widget, set via set_center_widget!
. ActionBar
can be hidden / shown using set_is_revealed!
. It is always horizontal.
Constructors
ActionBar()
Signals
(no unique signals)
Fields
(no public fields)
Functions that operate on this type:
connect_signal_destroy!
disconnect_signal_destroy!
emit_signal_destroy
get_signal_destroy_blocked
set_signal_destroy_blocked!
connect_signal_hide!
disconnect_signal_hide!
emit_signal_hide
get_signal_hide_blocked
set_signal_hide_blocked!
connect_signal_map!
disconnect_signal_map!
emit_signal_map
get_signal_map_blocked
set_signal_map_blocked!
connect_signal_realize!
disconnect_signal_realize!
emit_signal_realize
get_signal_realize_blocked
set_signal_realize_blocked!
connect_signal_show!
disconnect_signal_show!
emit_signal_show
get_signal_show_blocked
set_signal_show_blocked!
connect_signal_unmap!
disconnect_signal_unmap!
emit_signal_unmap
get_signal_unmap_blocked
set_signal_unmap_blocked!
connect_signal_unrealize!
disconnect_signal_unrealize!
emit_signal_unrealize
get_signal_unrealize_blocked
set_signal_unrealize_blocked!
Adjustment
Mousetrap.Adjustment
— TypeAdjustment <: SignalEmitter
Object that represents a range of discrete values. Modifying the underlying adjustment of a widget will modify the widget, and vice-versa.
See get_adjustment
to see which widgets are available to be controlled this way.
Constructors
Adjustment(value::Number, lower::Number, upper::Number, increment::Number)
Signals
value_changed
(::Adjustment, [::Data_t]) -> Nothing
Emitted when the
value
property of theAdjustment
changes.
properties_changed
(::Adjustment, [::Data_t]) -> Nothing
Emitted when any property of the
Adjustment
other thanvalue
changes.
Fields
(no public fields)
Functions that operate on this type:
connect_signal_properties_changed!
disconnect_signal_properties_changed!
emit_signal_properties_changed
get_signal_properties_changed_blocked
set_signal_properties_changed_blocked!
connect_signal_value_changed!
disconnect_signal_value_changed!
emit_signal_value_changed
get_signal_value_changed_blocked
set_signal_value_changed_blocked!
AlertDialog
Mousetrap.AlertDialog
— TypeAlertDialog <: SignalEmitter
Simple dialog with a message, detailed description, space for a single widget, and one or more labeled buttons.
Use on_selection!
to register a function with the signature
(::AlertDialog, button_index::Integer, [::Data_t]) -> Nothing
which is called when the user makes a selection or closes the dialog.
Constructors
AlertDialog(message::String, [detailed_message::String])
Signals
(no unique signals)
Fields
(no public fields)
Example
alert_dialog = AlertDialog("Is this is a dialog?")
add_button!(alert_dialog, "yes")
add_button!(alert_dialog, "no")
on_selection!(alert_dialog) do self::AlertDialog, button_index::Signed
if button_index == 1
println("User chose `Yes`")
elseif button_index == 2
println("User chose `No`")
elseif button_index == 0
println("User dismissed the dialog")
end
end
present!(alert_dialog)
Functions that operate on this type:
add_button!
close!
get_button_label
get_detailed_description
get_is_modal
get_message
get_n_buttons
on_selection!
present!
remove_extra_widget!
set_button_label!
set_default_button!
set_detailed_description!
set_extra_widget!
set_is_modal!
set_message!
Angle
Mousetrap.Angle
— TypeAngle
Represents an angle in a unit-agnostic way.
Use radians
or degrees
to construct an object of this type.
as_radians
and as_degrees
allow for converting an angle to the respective unit.
Constructors
(no public constructors)
Fields
(no public fields)
Functions that operate on this type:
Animation
Mousetrap.Animation
— TypeAnimation <: SignalEmitter
Object that provides a steady timing function which is synched to a widget's render cycle. It can be used as the basis of implementing animations.
Use on_tick!
to register a callback with the signature
(::Animation, value::Float64, [::Data_t]) -> Nothing
Which will be called once per frame while the widget is visible.
By default, the animation's value
will be in [0, 1], this can be changed with set_lower!
and set_upper!
. The shape of the function interpolating the value over time can be set using set_timing_function!
.
Constructors
Animation(target::Widget, duration::Time)
Signals
(no unique signals)
Fields
(no public fields)
Example
# animate a gradual fade-out
to_animate = Button(Label("Click Me"))
animation = Animation(to_animate, seconds(1))
on_tick!(animation, to_animate) do self::Animation, value::AbstractFloat, target::Widget
# value will be in [0, 1]
set_opacity!(target, 1 - value)
end
on_done!(animation, to_animate) do self::Animation, target::Widget
set_is_visible!(target, false)
end
# start animation when button is clicked
connect_signal_clicked!(to_animate, animation) do self::Button, animation::Animation
play!(animation)
end
set_child!(window, to_animate)
Functions that operate on this type:
get_duration
get_is_reversed
get_lower
get_repeat_count
get_state
get_timing_function
get_upper
get_value
on_done!
on_tick!
pause!
play!
reset!
set_duration!
set_is_reversed!
set_lower!
set_repeat_count!
set_timing_function!
set_upper!
Application
Mousetrap.Application
— TypeApplication <: SignalEmitter
Used to register an application with the user's OS.
The application's ID is required to contain at least one .
, and it should be unique, meaning no other application on the users operating system shares this ID.
When all windows of an application are closed, or quit!
is called, the application exits. This can be prevented with hold!
, which has to be undone later by calling release!
. When exiting, the application will emit signal shutdown
, which should be used to safely free resources.
When creating a new application, allow_multiple_instances
governs whether resources are shared between two instances with the same ID. If set to false
, the most recently created instance will be the primary instance. If set to true
(default) the instance created first will be the primary instance. See here for more information.
Constructors
Application(::ApplicationID; [allow_multiple_instances::Bool = true])
Signals
activate
(::Application, [::Data_t]) -> Nothing
Emitted when an activatable widget is activated by the user, usually by pressing the enter key.
shutdown
(::Application, [::Data_t]) -> Nothing
Emitted when an
Application
is exiting the main loop and attempting to shut down.
Fields
(no public fields)
Example
app = Application("example.app")
connect_signal_activate!(app) app::Application
# all initialization has to happen here
end
connect_signal_shutdown!(app) app::Application
# safely free all resources
end
run!(app)
Functions that operate on this type:
add_action!
get_action
get_current_theme
get_id
get_is_holding
get_is_marked_as_busy
has_action
hold!
mark_as_busy!
quit!
release!
remove_action!
run!
set_application!
set_current_theme!
unmark_as_busy!
connect_signal_activate!
disconnect_signal_activate!
emit_signal_activate
get_signal_activate_blocked
set_signal_activate_blocked!
connect_signal_shutdown!
disconnect_signal_shutdown!
emit_signal_shutdown
get_signal_shutdown_blocked
set_signal_shutdown_blocked!
ApplicationID
Mousetrap.ApplicationID
— TypeApplicationID
Application name as a string, in reverse domain name syntax. For example, if the app's homepage is Foo.julia.org
, an appropriate application ID would be "org.julia.foo"
Functions that operate on this type:
AspectFrame
Mousetrap.AspectFrame
— TypeAspectFrame <: Widget
Container widget with a single child, makes sure that the size of its child will always be at the specified width-to-height ratio.
Constructors
AspectFrame(width_to_height::AbstractFloat; [child_x_alignment::AbstractFloat, child_y_alignment::AbstractFloat])
AspectFrame(Width_to_height::AbstractFloat, child::Widget)
Signals
(no unique signals)
Fields
(no public fields)
Functions that operate on this type:
get_child_x_alignment
get_child_y_alignment
get_ratio
remove_child!
set_child!
set_child_x_alignment!
set_child_y_alignment!
set_ratio!
AxisAlignedRectangle
Mousetrap.AxisAlignedRectangle
— TypeAxisAlignedRectangle
Axis-aligned bounding box. Defined by its top-left corner and size.
Constructors
AxisAlignedRectangle(top_left::Vector2f, size::Vector2f)
Fields
top_left::Vectorf
size::Vector2f
Box
Mousetrap.Box
— TypeBox <: Widget
Widget that aligns its children in a row or column, depending on orientation.
Constructors
Box(::Orientation)
Signals
(no unique signals)
Fields
(no public fields)
Example
box = Box(ORIENTATION_HORIZONTAL)
push_back!(box, Label("01"))
push_back!(box, Button())
push_back!(box, Label("03"))
# equivalent to
box = hbox(Label("01"), Button(), Label("02"))
Functions that operate on this type:
clear!
get_homogeneous
get_n_items
get_orientation
get_spacing
insert_after!
push_back!
push_front!
remove!
set_homogeneous!
set_orientation!
set_spacing!
connect_signal_destroy!
disconnect_signal_destroy!
emit_signal_destroy
get_signal_destroy_blocked
set_signal_destroy_blocked!
connect_signal_hide!
disconnect_signal_hide!
emit_signal_hide
get_signal_hide_blocked
set_signal_hide_blocked!
connect_signal_map!
disconnect_signal_map!
emit_signal_map
get_signal_map_blocked
set_signal_map_blocked!
connect_signal_realize!
disconnect_signal_realize!
emit_signal_realize
get_signal_realize_blocked
set_signal_realize_blocked!
connect_signal_show!
disconnect_signal_show!
emit_signal_show
get_signal_show_blocked
set_signal_show_blocked!
connect_signal_unmap!
disconnect_signal_unmap!
emit_signal_unmap
get_signal_unmap_blocked
set_signal_unmap_blocked!
connect_signal_unrealize!
disconnect_signal_unrealize!
emit_signal_unrealize
get_signal_unrealize_blocked
set_signal_unrealize_blocked!
Button
Mousetrap.Button
— TypeButton <: Widget
Button with a label. Connect to signal clicked
or specify an action via set_action!
in order to react to the user clicking the button.
Constructors
Button()
Button(label::Widget)
Button(::Icon)
Signals
clicked
(::Button, [::Data_t]) -> Nothing
Emitted when the user clicks the widget using a mouse or touchscreen.
Fields
(no public fields)
Example
button = Button()
set_child!(button, Label("Click Me"))
connect_signal_clicked!(button) do x::Button
println("clicked!")
end
set_child!(window, button)
Functions that operate on this type:
get_has_frame
get_is_circular
remove_child!
set_action!
set_child!
set_has_frame!
set_icon!
set_is_circular!
connect_signal_clicked!
disconnect_signal_clicked!
emit_signal_clicked
get_signal_clicked_blocked
set_signal_clicked_blocked!
connect_signal_destroy!
disconnect_signal_destroy!
emit_signal_destroy
get_signal_destroy_blocked
set_signal_destroy_blocked!
connect_signal_hide!
disconnect_signal_hide!
emit_signal_hide
get_signal_hide_blocked
set_signal_hide_blocked!
connect_signal_map!
disconnect_signal_map!
emit_signal_map
get_signal_map_blocked
set_signal_map_blocked!
connect_signal_realize!
disconnect_signal_realize!
emit_signal_realize
get_signal_realize_blocked
set_signal_realize_blocked!
connect_signal_show!
disconnect_signal_show!
emit_signal_show
get_signal_show_blocked
set_signal_show_blocked!
connect_signal_unmap!
disconnect_signal_unmap!
emit_signal_unmap
get_signal_unmap_blocked
set_signal_unmap_blocked!
connect_signal_unrealize!
disconnect_signal_unrealize!
emit_signal_unrealize
get_signal_unrealize_blocked
set_signal_unrealize_blocked!
CenterBox
Mousetrap.CenterBox
— TypeCenterBox <: Widget
Widget that aligns exactly 3 widgets in a row (or column), prioritizing keeping the middle widget centered at all times.
Constructors
CenterBox(::Orientation)
CenterBox(::Orientation, left::Widget, center::Widget, right::Widget)
Signals
(no unique signals)
Fields
(no public fields)
Example
center_box = CenterBox(ORIENTATION_HORIZONTAL)
set_start_child!(center_box, Label("Left"))
set_center_child!(center_box, Button())
set_end_child!(center_box, Label("Right"))
Functions that operate on this type:
get_orientation
remove_center_child!
remove_end_child!
remove_start_child!
set_center_child!
set_end_child!
set_orientation!
set_start_child!
connect_signal_destroy!
disconnect_signal_destroy!
emit_signal_destroy
get_signal_destroy_blocked
set_signal_destroy_blocked!
connect_signal_hide!
disconnect_signal_hide!
emit_signal_hide
get_signal_hide_blocked
set_signal_hide_blocked!
connect_signal_map!
disconnect_signal_map!
emit_signal_map
get_signal_map_blocked
set_signal_map_blocked!
connect_signal_realize!
disconnect_signal_realize!
emit_signal_realize
get_signal_realize_blocked
set_signal_realize_blocked!
connect_signal_show!
disconnect_signal_show!
emit_signal_show
get_signal_show_blocked
set_signal_show_blocked!
connect_signal_unmap!
disconnect_signal_unmap!
emit_signal_unmap
get_signal_unmap_blocked
set_signal_unmap_blocked!
connect_signal_unrealize!
disconnect_signal_unrealize!
emit_signal_unrealize
get_signal_unrealize_blocked
set_signal_unrealize_blocked!
CheckButton
Mousetrap.CheckButton
— TypeCheckButton <: Widget
Rectangle that displays a checkmark and an optional label. Connect to signal toggled
to react to the user changing the CheckButton
's state by clicking it.
Constructors
CheckButton()
Signals
toggled
(::CheckButton, [::Data_t]) -> Nothing
Emitted when the widgets internal state changes from active to inactive, or inactive to active.
Fields
(no public fields)
Example
check_button = CheckButton()
set_child!(check_button, Label("Click Me"))
connect_signal_toggled!(check_button) do self::CheckButton
state = get_state(self)
print("CheckButton is now: ")
if state == CHECK_BUTTON_STATE_ACTIVE
println("active!")
elseif state == CHECK_BUTTON_STATE_INACTIVE
println("inactive")
else # state == CHECK_BUTTON_STATE_INCONSISTENT
println("inconsistent")
end
end
set_child!(window, check_button)
Functions that operate on this type:
connect_signal_destroy!
disconnect_signal_destroy!
emit_signal_destroy
get_signal_destroy_blocked
set_signal_destroy_blocked!
connect_signal_hide!
disconnect_signal_hide!
emit_signal_hide
get_signal_hide_blocked
set_signal_hide_blocked!
connect_signal_map!
disconnect_signal_map!
emit_signal_map
get_signal_map_blocked
set_signal_map_blocked!
connect_signal_realize!
disconnect_signal_realize!
emit_signal_realize
get_signal_realize_blocked
set_signal_realize_blocked!
connect_signal_show!
disconnect_signal_show!
emit_signal_show
get_signal_show_blocked
set_signal_show_blocked!
connect_signal_toggled!
disconnect_signal_toggled!
emit_signal_toggled
get_signal_toggled_blocked
set_signal_toggled_blocked!
connect_signal_unmap!
disconnect_signal_unmap!
emit_signal_unmap
get_signal_unmap_blocked
set_signal_unmap_blocked!
connect_signal_unrealize!
disconnect_signal_unrealize!
emit_signal_unrealize
get_signal_unrealize_blocked
set_signal_unrealize_blocked!
ClampFrame
Mousetrap.ClampFrame
— TypeClampFrame <: Widget
Constrains its single child such that the child's width (or height, if vertically orientated) cannot exceed the size set using set_maximum_size!
.
Constructors
ClampFrame(size_px::AbstractFloat, [::Orientation = ORIENTATION_HORIZONTAL])
Signals
(no unique signals)
Fields
(no public fields)
Functions that operate on this type:
ClickEventController
Mousetrap.ClickEventController
— TypeClickEventController <: SingleClickGesture <: EventController
Event controller that reacts to a series of one or more mouse-button or touchscreen presses.
Constructors
ClickEventController()
Signals
click_pressed
(::ClickEventController, n_presses::Integer, x::AbstractFloat, y::AbstractFloat, [::Data_t]) -> Nothing
User presses a mouse button (which is currently not pressed), while the controllers associated widget holds input focus. Where
n_presses
are the current number of clicks in the sequence,x
,y
are the current cursor position, in pixels.
click_released
(::ClickEventController, n_presses::Integer, x::AbstractFloat, y::AbstractFloat, [::Data_t]) -> Nothing
User releases a mouse button (which is currently pressed), while the controllers associated widget holds input focus. Where
n_presses
are the current number of clicks in the sequence,x
,y
are the current cursor position, in pixels.
click_stopped
(::ClickEventController, [::Data_t]) -> Nothing
Emitted exactly once to signal that a series of clicks ended.
Fields
(no public fields)
Example
click_controller = ClickEventController()
connect_signal_click_pressed!(click_controller) do self::ClickEventController, n_presses::Integer, x::Float64, y::Float64
if n_presses == 2
println("double click registered at position ($(Int64(x)), $(Int64(y)))")
end
end
add_controller!(window, click_controller)
Functions that operate on this type:
connect_signal_click_pressed!
connect_signal_click_released!
connect_signal_click_stopped!
disconnect_signal_click_pressed!
disconnect_signal_click_released!
disconnect_signal_click_stopped!
emit_signal_click_pressed
emit_signal_click_released
emit_signal_click_stopped
get_signal_click_pressed_blocked
get_signal_click_released_blocked
get_signal_click_stopped_blocked
set_signal_click_pressed_blocked!
set_signal_click_released_blocked!
set_signal_click_stopped_blocked!
Clipboard
Mousetrap.Clipboard
— TypeClipboard <: SignalEmitter
Allows for accessing and overwriting the data in the user's OS-wide clipboard. Construct an instance of this type by calling get_clipboard
on the toplevel window.
If the clipboard contains an image, use get_image
to access it, any other kind of data needs to be accesses with get_string
.
Constructors
(no public constructors)
Signals
(no unique signals)
Fields
(no public fields)
Example
clipboard = get_clipboard(window)
get_string(clipboard) do self::Clipboard, value::String
println("Value in clipboard: " * value)
end
Functions that operate on this type:
contains_file
contains_image
contains_string
get_image
get_is_local
get_string
set_file!
set_image!
set_string!
Clock
Mousetrap.Clock
— TypeClock <: SignalEmitter
Object used to keep track of time. Nanosecond precision.
Constructors
Clock()
Signals
(no unique signals)
Fields
(no public fields)
Example
clock = Clock()
current = restart!(clock)
sleep(1)
now = elapsed(clock)
println("time delta: $(as_seconds(now - current))")
Functions that operate on this type:
ColorChooser
Mousetrap.ColorChooser
— TypeColorChooser <: SignalEmitter
Dialog that allows a user to choose a color.
Constructors
ColorChooser([title::String, modal::Bool])
Signals
(no unique signals)
Fields
(no public fields)
Example
color_chooser = ColorChooser()
on_accept!(color_chooser) do self::ColorChooser, color::RGBA
println("Selected $color")
end
on_cancel!(color_chooser) do self::ColorChooser
println("color selection cancelled")
end
present!(color_chooser)
Functions that operate on this type:
ColumnView
Mousetrap.ColumnView
— TypeColumnView <: Widget
Selectable widget that arranges its children as a table with rows and named columns.
Constructors
ColumnView([::SelectionMode])
Signals
activate
(::ColumnView, [::Data_t]) -> Nothing
Emitted when an activatable widget is activated by the user, usually by pressing the enter key.
Fields
(no public fields)
Example
column_view = ColumnView(SELECTION_MODE_NONE)
for column_i in 1:4
column = push_back_column!(column_view, "Column #$column_i")
for row_i in 1:3
set_widget!(column_view, column, row_i, Label("$row_i | $column_i"))
end
end
# or push an entire row at once
push_back_row!(column_view, Button(), CheckButton(), Entry(), Separator())
set_child!(window, column_view)
Functions that operate on this type:
get_column_at
get_column_with_title
get_enable_rubberband_selection
get_n_columns
get_n_rows
get_selection_model
get_show_column_separators
get_show_row_separators
get_single_click_activate
has_column_with_title
insert_column_at!
insert_row_at!
push_back_column!
push_back_row!
push_front_column!
push_front_row!
remove_column!
set_enable_rubberband_selection!
set_show_column_separators
set_show_row_separators
set_single_click_activate!
set_widget_at!
connect_signal_activate!
disconnect_signal_activate!
emit_signal_activate
get_signal_activate_blocked
set_signal_activate_blocked!
connect_signal_destroy!
disconnect_signal_destroy!
emit_signal_destroy
get_signal_destroy_blocked
set_signal_destroy_blocked!
connect_signal_hide!
disconnect_signal_hide!
emit_signal_hide
get_signal_hide_blocked
set_signal_hide_blocked!
connect_signal_map!
disconnect_signal_map!
emit_signal_map
get_signal_map_blocked
set_signal_map_blocked!
connect_signal_realize!
disconnect_signal_realize!
emit_signal_realize
get_signal_realize_blocked
set_signal_realize_blocked!
connect_signal_show!
disconnect_signal_show!
emit_signal_show
get_signal_show_blocked
set_signal_show_blocked!
connect_signal_unmap!
disconnect_signal_unmap!
emit_signal_unmap
get_signal_unmap_blocked
set_signal_unmap_blocked!
connect_signal_unrealize!
disconnect_signal_unrealize!
emit_signal_unrealize
get_signal_unrealize_blocked
set_signal_unrealize_blocked!
ColumnViewColumn
Mousetrap.ColumnViewColumn
— TypeColumnViewColumn <: SignalEmitter
Class representing a column of ColumnView
. Has a label, any number of children which represented that columns rows, and an optional header menu.
Constructors
(no public constructors)
Signals
(no unique signals)
Fields
(no public fields)
Example
# create a new column
column = push_back_column!(column_view)
# set widget in 4th row, automatically backfills rows 1 - 3
set_widget!(column, 4, Label("4"))
Functions that operate on this type:
get_fixed_width
get_is_resizable
get_is_visible
get_title
remove_column!
set_fixed_width!
set_header_menu!
set_is_resizable!
set_is_visible!
set_title!
set_widget_at!
DragEventController
Mousetrap.DragEventController
— TypeDragEventController <: SingleClickGesture <: EventController
Event controller that recogizes drag-gestures by both a mouse or touch device.
Constructors
DragEventController()
Signals
drag_begin
(::DragEventController, start_x::AbstractFloat, start_y::AbstractFloat, [::Data_t]) -> Nothing
Emitted exaclty once, on the first frame a drag gesture is recognized, where
start_y
andstart_x
are the initial position of the cursor, in pixels.
drag
(::DragEventController, x_offset::AbstractFloat, y_offset::AbstractFloat, [::Data_t]) -> Nothing
Emitted once per frame while a drag gesture is active, where
x_offset
andy_offset
are the distance between the current position of the cursor, and the position at the start of the gesture, in pixels.
drag_end
(::DragEventController, x_offset::AbstractFloat, y_offset::AbstractFloat, [::Data_t]) -> Nothing
Emitted exactly once, when the drag gesture seizes to be active, where
x_offset
andy_offset
are the distance between the current position of the cursor, and the position at the start of the gesture, in pixels.
Fields
(no public fields)
Example
drag_controller = DragEventController()
connect_signal_drag!(drag_controller) do self::DragEventController, x_offset, y_offset
start::Vector2f = get_start_position(self)
current = start + Vector2f(x_offset, y_offset)
println("Current cursor position: $current")
end
add_controller!(window, drag_controller)
Functions that operate on this type:
connect_signal_drag!
connect_signal_drag_begin!
connect_signal_drag_end!
disconnect_signal_drag!
disconnect_signal_drag_begin!
disconnect_signal_drag_end!
emit_signal_drag
emit_signal_drag_begin
emit_signal_drag_end
get_signal_drag_begin_blocked
get_signal_drag_blocked
get_signal_drag_end_blocked
set_signal_drag_begin_blocked!
set_signal_drag_blocked!
set_signal_drag_end_blocked!
DropDown
Mousetrap.DropDown
— TypeDropDown <: Widget
Presents the user with a collapsible list of items. If one of its items is clicked, that item's callback will be invoked.
Constructors
DropDown()
Signals
(no unique signals)
Fields
(no public fields)
Example
drop_down = DropDown()
push_back!(drop_down, "Item 01") do x::DropDown
println("Item 01 selected")
end
push_back!(drop_down, "Item 02") do x::DropDown
println("Item 02 selected")
end
set_child!(window, drop_down)
Functions that operate on this type:
get_always_show_arrow
get_item_at
get_selected
insert_at!
push_back!
push_front!
remove!
set_always_show_arrow!
set_selected!
connect_signal_destroy!
disconnect_signal_destroy!
emit_signal_destroy
get_signal_destroy_blocked
set_signal_destroy_blocked!
connect_signal_hide!
disconnect_signal_hide!
emit_signal_hide
get_signal_hide_blocked
set_signal_hide_blocked!
connect_signal_map!
disconnect_signal_map!
emit_signal_map
get_signal_map_blocked
set_signal_map_blocked!
connect_signal_realize!
disconnect_signal_realize!
emit_signal_realize
get_signal_realize_blocked
set_signal_realize_blocked!
connect_signal_show!
disconnect_signal_show!
emit_signal_show
get_signal_show_blocked
set_signal_show_blocked!
connect_signal_unmap!
disconnect_signal_unmap!
emit_signal_unmap
get_signal_unmap_blocked
set_signal_unmap_blocked!
connect_signal_unrealize!
disconnect_signal_unrealize!
emit_signal_unrealize
get_signal_unrealize_blocked
set_signal_unrealize_blocked!
DropDownItemID
Mousetrap.DropDownItemID
— TypeDropDownItemID
ID of a dropdown item, returned when adding a new item to the drop down. Keep track of this in order to identify items in a position-independent manner.
Constructors
(no public constructors)
Fields
(no public fields)
Functions that operate on this type:
Entry
Mousetrap.Entry
— TypeEntry <: Widget
Single-line text entry, supports "password mode", as well as inserting an icon to the left and/or right of the text area.
Constructors
Entry()
Signals
activate
(::Entry, [::Data_t]) -> Nothing
Emitted when an activatable widget is activated by the user, usually by pressing the enter key.
text_changed
(::Entry, [::Data_t]) -> Nothing
Emitted when underlying text buffer is modified in any way.
Fields
(no public fields)
Example
entry = Entry()
set_text!(entry, "Write here")
connect_signal_text_changed!(entry) do self::Entry
println("text is now: $(get_text(self))")
end
Functions that operate on this type:
get_has_frame
get_max_width_chars
get_text
get_text_visible
remove_primary_icon!
remove_secondary_icon!
set_has_frame!
set_max_width_chars!
set_primary_icon!
set_secondary_icon!
set_text!
set_text_visible!
connect_signal_activate!
disconnect_signal_activate!
emit_signal_activate
get_signal_activate_blocked
set_signal_activate_blocked!
connect_signal_destroy!
disconnect_signal_destroy!
emit_signal_destroy
get_signal_destroy_blocked
set_signal_destroy_blocked!
connect_signal_hide!
disconnect_signal_hide!
emit_signal_hide
get_signal_hide_blocked
set_signal_hide_blocked!
connect_signal_map!
disconnect_signal_map!
emit_signal_map
get_signal_map_blocked
set_signal_map_blocked!
connect_signal_realize!
disconnect_signal_realize!
emit_signal_realize
get_signal_realize_blocked
set_signal_realize_blocked!
connect_signal_show!
disconnect_signal_show!
emit_signal_show
get_signal_show_blocked
set_signal_show_blocked!
connect_signal_text_changed!
disconnect_signal_text_changed!
emit_signal_text_changed
get_signal_text_changed_blocked
set_signal_text_changed_blocked!
connect_signal_unmap!
disconnect_signal_unmap!
emit_signal_unmap
get_signal_unmap_blocked
set_signal_unmap_blocked!
connect_signal_unrealize!
disconnect_signal_unrealize!
emit_signal_unrealize
get_signal_unrealize_blocked
set_signal_unrealize_blocked!
EventController
Mousetrap.EventController
— TypeEventController <: SignalEmitter
Superclass of all event controllers. Use add_controller!
to connect an event controller to any widget, after which it starts receiving input events. Connect to the unique signals of each event controller in order to react to these events.
Supertype
Any
Subtypes
Functions that operate on this type:
Expander
Mousetrap.Expander
— TypeExpander <: Widget
Collapsible item which has a label and child. If the label is clicked, the child is shown (or hidden, if it is already shown).
This widget should not be used to create collapsible lists, use ListView
for this purpose instead.
Constructors
Expander()
Expander(child::Widget, label::Widget)
Signals
activate
(::Expander, [::Data_t]) -> Nothing
Emitted when an activatable widget is activated by the user, usually by pressing the enter key.
Fields
(no public fields)
Functions that operate on this type:
connect_signal_activate!
disconnect_signal_activate!
emit_signal_activate
get_signal_activate_blocked
set_signal_activate_blocked!
connect_signal_destroy!
disconnect_signal_destroy!
emit_signal_destroy
get_signal_destroy_blocked
set_signal_destroy_blocked!
connect_signal_hide!
disconnect_signal_hide!
emit_signal_hide
get_signal_hide_blocked
set_signal_hide_blocked!
connect_signal_map!
disconnect_signal_map!
emit_signal_map
get_signal_map_blocked
set_signal_map_blocked!
connect_signal_realize!
disconnect_signal_realize!
emit_signal_realize
get_signal_realize_blocked
set_signal_realize_blocked!
connect_signal_show!
disconnect_signal_show!
emit_signal_show
get_signal_show_blocked
set_signal_show_blocked!
connect_signal_unmap!
disconnect_signal_unmap!
emit_signal_unmap
get_signal_unmap_blocked
set_signal_unmap_blocked!
connect_signal_unrealize!
disconnect_signal_unrealize!
emit_signal_unrealize
get_signal_unrealize_blocked
set_signal_unrealize_blocked!
FileChooser
Mousetrap.FileChooser
— TypeFileChooser <: SignalEmitter
Pre-made dialog that allows users to pick a file or folder on the local disk.
Connect a function with the signature
(::FileChooser, files::Vector{FileDescriptor}, [::Data_t]) -> Nothing
using on_accept!
. When the user makes a selection, this function will be invoked and files
will contain one or more selected files.
The file choosers layout depends on the FileChooserAction
specified on construction.
Constructors
FileChooser(::FileChooserAction, [title::String])
Signals
(no unique signals)
Fields
(no public fields)
Example
file_chooser = FileChooser(FILE_CHOOSER_ACTION_OPEN_FILE)
on_accept!(file_chooser) do x::FileChooser, files::Vector{FileDescriptor}
if !isempty(files)
println("Selected file at ", get_path(files[1]))
end
end
on_cancel!(file_chooser) do x::FileChooser
println("Canceled.")
end
present!(file_chooser)
Functions that operate on this type:
add_filter!
cancel!
clear_filters!
get_accept_label
get_file_chooser_action
get_is_modal
get_title
on_accept!
on_cancel!
present!
set_accept_label!
set_file_chooser_action!
set_initial_file!
set_initial_filter!
set_initial_folder!
set_initial_name!
set_is_modal!
set_title!
FileDescriptor
Mousetrap.FileDescriptor
— TypeFileDescriptor <: SignalEmitter
Read-only object that points a specific location on disk. There is no guaruantee that this location contains a valid file or folder.
Constructors
FileDescriptor(path::String)
Signals
(no unique signals)
Fields
(no public fields)
Example
current_dir = FileDescriptor(".")
for file in get_children(current_dir)
println(get_name(file) * ": " * get_content_type(file))
end
Functions that operate on this type:
Mousetrap.copy!
create_as_file_preview!
create_directory_at!
create_file_at!
create_from_path!
create_from_uri!
create_monitor
delete_at!
exists
get_children
get_content_type
get_file_extension
get_name
get_parent
get_path
get_path_relative_to
get_uri
is_executable
is_file
is_folder
is_symlink
move!
move_to_trash!
open_file
open_url
query_info
read_symlink
set_file!
set_initial_file!
set_initial_folder!
show_in_file_explorer
FileFilter
Mousetrap.FileFilter
— TypeFileFilter <: SignalEmitter
Filter used by FileChooser
. Only files that pass the filter will be available to be selected when the file chooser is active.
If multiple filters are supplied, the user can select between them using a dropdown that is automatically added to the FileChooser
dialog.
Constructors
FileFilter(name::String)
Signals
(no unique signals)
Fields
(no public fields)
Example
julia filter = FileFilter() add_allowed_suffix!(filter, "jl") # without the `.`
`
Functions that operate on this type:
add_allow_all_supported_image_formats!
add_allowed_mime_type!
add_allowed_pattern!
add_allowed_suffix!
add_filter!
get_name
set_initial_filter!
FileMonitor
Mousetrap.FileMonitor
— TypeFileMonitor <: SignalEmitter
Object that monitors a location on disk. If anything about the object at that location changes, it invoke the callback registered using on_file_changed!
, which requires a function with signature
(::FileMonitor, event::FileMonitorEvent, self::FileDescriptor, other::FileDescriptor, [::Data_t]) -> Nothing
Where event
classifies the type of change, self
is the file being monitored.
Constructors
(no public constructors)
Signals
(no unique signals)
Fields
(no public fields)
Example
file = FileDescriptor("path/to/file.jl")
@assert(exists(file))
monitor = create_monitor(file)
on_file_changed!(monitor) do x::FileMonitor, event_type::FileMonitorEvent, self::FileDescriptor, other::FileDescriptor
if event_type == FILE_MONITOR_EVENT_CHANGED
println("File at " * get_path(self) * " was modified.")
end
end
Functions that operate on this type:
Fixed
Mousetrap.Fixed
— TypeFixed <: Widget
Container widget that places its children at a specified pixel position relative to the Fixed
s top-left corner.
Use of this widget is usually discouraged, it does not allow for automatic expansion or alignment.
Constructors
Fixed()
Signals
(no unique signals)
Fields
(no public fields)
Functions that operate on this type:
connect_signal_destroy!
disconnect_signal_destroy!
emit_signal_destroy
get_signal_destroy_blocked
set_signal_destroy_blocked!
connect_signal_hide!
disconnect_signal_hide!
emit_signal_hide
get_signal_hide_blocked
set_signal_hide_blocked!
connect_signal_map!
disconnect_signal_map!
emit_signal_map
get_signal_map_blocked
set_signal_map_blocked!
connect_signal_realize!
disconnect_signal_realize!
emit_signal_realize
get_signal_realize_blocked
set_signal_realize_blocked!
connect_signal_show!
disconnect_signal_show!
emit_signal_show
get_signal_show_blocked
set_signal_show_blocked!
connect_signal_unmap!
disconnect_signal_unmap!
emit_signal_unmap
get_signal_unmap_blocked
set_signal_unmap_blocked!
connect_signal_unrealize!
disconnect_signal_unrealize!
emit_signal_unrealize
get_signal_unrealize_blocked
set_signal_unrealize_blocked!
FlowBox
Mousetrap.FlowBox
— TypeFlowBox <: Widget
Box
-like widget that dynamically rearranges its children into multiple rows (or columns), as the widgets width (or height) changes.
Constructors
FlowBox(Orientation)
Signals
(no unique signals)
Fields
(no public fields)
Functions that operate on this type:
clear!
get_column_spacing
get_homogeneous
get_n_items
get_orientation
get_row_spacing
insert_at!
push_back!
push_front!
remove!
set_column_spacing!
set_homogeneous!
set_orientation!
set_row_spacing!
connect_signal_destroy!
disconnect_signal_destroy!
emit_signal_destroy
get_signal_destroy_blocked
set_signal_destroy_blocked!
connect_signal_hide!
disconnect_signal_hide!
emit_signal_hide
get_signal_hide_blocked
set_signal_hide_blocked!
connect_signal_map!
disconnect_signal_map!
emit_signal_map
get_signal_map_blocked
set_signal_map_blocked!
connect_signal_realize!
disconnect_signal_realize!
emit_signal_realize
get_signal_realize_blocked
set_signal_realize_blocked!
connect_signal_show!
disconnect_signal_show!
emit_signal_show
get_signal_show_blocked
set_signal_show_blocked!
connect_signal_unmap!
disconnect_signal_unmap!
emit_signal_unmap
get_signal_unmap_blocked
set_signal_unmap_blocked!
connect_signal_unrealize!
disconnect_signal_unrealize!
emit_signal_unrealize
get_signal_unrealize_blocked
set_signal_unrealize_blocked!
FocusEventController
Mousetrap.FocusEventController
— TypeFocusEventController <: EventController
Reacts to a widget gaining or loosing input focus.
Constructors
FocusEventController()
Signals
focus_gained
(::FocusEventController, [::Data_t]) -> Nothing
Emitted when the widget that is currently not focused becomes focus.
focus_lost
(::FocusEventController, [::Data_t]) -> Nothing
Emitted when the widget that is currently focused looses focus.
Fields
(no public fields)
Example
focus_controller = FocusEventController()
connect_signal_focus_gained!(focus_controller) do self::FocusController
println("Gained Focus")
end
add_controller!(widget, focus_controller)
Functions that operate on this type:
connect_signal_focus_gained!
connect_signal_focus_lost!
disconnect_signal_focus_gained!
disconnect_signal_focus_lost!
emit_signal_focus_gained
emit_signal_focus_lost
get_signal_focus_gained_blocked
get_signal_focus_lost_blocked
set_signal_focus_gained_blocked!
set_signal_focus_lost_blocked!
Frame
Mousetrap.Frame
— TypeFrame <: Widget
Widget that draws a black outline with rounded corners around its singular child.
Constructors
Frame()
Frame(child::Widget)
Signals
(no unique signals)
Fields
(no public fields)
Functions that operate on this type:
get_label_x_alignment
remove_child!
remove_label_widget!
set_child!
set_label_widget!
set_label_x_alignment!
connect_signal_destroy!
disconnect_signal_destroy!
emit_signal_destroy
get_signal_destroy_blocked
set_signal_destroy_blocked!
connect_signal_hide!
disconnect_signal_hide!
emit_signal_hide
get_signal_hide_blocked
set_signal_hide_blocked!
connect_signal_map!
disconnect_signal_map!
emit_signal_map
get_signal_map_blocked
set_signal_map_blocked!
connect_signal_realize!
disconnect_signal_realize!
emit_signal_realize
get_signal_realize_blocked
set_signal_realize_blocked!
connect_signal_show!
disconnect_signal_show!
emit_signal_show
get_signal_show_blocked
set_signal_show_blocked!
connect_signal_unmap!
disconnect_signal_unmap!
emit_signal_unmap
get_signal_unmap_blocked
set_signal_unmap_blocked!
connect_signal_unrealize!
disconnect_signal_unrealize!
emit_signal_unrealize
get_signal_unrealize_blocked
set_signal_unrealize_blocked!
FrameClock
Mousetrap.FrameClock
— TypeFrameClock <: SignalEmitter
Clock that is synched with a widget's render cycle. Connect to its signals to trigger behavior once per frame.
Constructors
(no public constructors)
Signals
(no unique signals)
Fields
(no public fields)
Example
frame_clock = get_frame_clock(widget)
connect_signal_paint!(frame_clock) do x::FrameClock
println("Widget was drawn.")
end
Functions that operate on this type:
connect_signal_paint!
disconnect_signal_paint!
emit_signal_paint
get_signal_paint_blocked
set_signal_paint_blocked!
connect_signal_update!
disconnect_signal_update!
emit_signal_update
get_signal_update_blocked
set_signal_update_blocked!
GLArea
Mousetrap.GLArea
— TypeGLArea <: Widget
Canvas that can be used a an OpenGL render target. This widget is intended to be used by third libraries, if you want to render using OpenGL using only Mousetrap, use RenderArea
instead.
Constructors
GLArea()
Signals
render
(::GLArea, gdk_gl_context::Ptr{Cvoid}, [::Data_t]) -> Bool
Emitted once per frame before the GL framebuffer is flushed to the screen. The
gdk_gl_context
argument is for internal use only and can be ignored.
resize
(::GLArea, width::Integer, height::Integer, [::Data_t]) -> Nothing
Emitted whenver the allocated area of a
RenderArea
changes, wherewidth
andheight
are the new size, in pixels.
Fields
(no public fields)
Example
canvas = GLArea()
connect_signal_resize!(canvas) do self::GLArea, x, y
# viewport was resized to x, y (in pixels)
end
connect_signal_render!(canvas) do self::GLArea, gl_context::Ptr{Cvoid}
make_current!(canvas)
# do OpenGL rendering here
return true
end
Functions that operate on this type:
connect_signal_destroy!
disconnect_signal_destroy!
emit_signal_destroy
get_signal_destroy_blocked
set_signal_destroy_blocked!
connect_signal_hide!
disconnect_signal_hide!
emit_signal_hide
get_signal_hide_blocked
set_signal_hide_blocked!
connect_signal_map!
disconnect_signal_map!
emit_signal_map
get_signal_map_blocked
set_signal_map_blocked!
connect_signal_realize!
disconnect_signal_realize!
emit_signal_realize
get_signal_realize_blocked
set_signal_realize_blocked!
connect_signal_render!
disconnect_signal_render!
emit_signal_render
get_signal_render_blocked
set_signal_render_blocked!
connect_signal_resize!
disconnect_signal_resize!
emit_signal_resize
get_signal_resize_blocked
set_signal_resize_blocked!
connect_signal_show!
disconnect_signal_show!
emit_signal_show
get_signal_show_blocked
set_signal_show_blocked!
connect_signal_unmap!
disconnect_signal_unmap!
emit_signal_unmap
get_signal_unmap_blocked
set_signal_unmap_blocked!
connect_signal_unrealize!
disconnect_signal_unrealize!
emit_signal_unrealize
get_signal_unrealize_blocked
set_signal_unrealize_blocked!
GLTransform
Mousetrap.GLTransform
— TypeGLTransform <: SignalEmitter
Transform in 3D spaces. Uses OpenGL coordinates, it should therefore only be used to modify vertices of a Shape
.
Can be indexed and modified as a 4x4 matrix of Float32
.
Constructors
GLTransform()
Signals
(no unique signals)
Fields
(no public fields)
Functions that operate on this type:
Grid
Mousetrap.Grid
— TypeGrid <: Widget
Selectable container that arranges its children in a non-uniform grid. Each child has a row- and column-index, as well as a width and height, measured in number of cells.
Constructors
Grid()
Signals
(no unique signals)
Fields
(no public fields)
Example
grid = Grid()
insert_at!(grid, Label("Label"), 1, 1, 1, 1)
insert_at!(grid, Button(), 1, 2, 1, 1)
insert_at!(grid, Separator, 2, 1, 2, 1)
Functions that operate on this type:
get_column_spacing
get_columns_homogeneous
get_orientation
get_position
get_row_spacing
get_rows_homogeneous
get_size
insert_at!
insert_column_at!
insert_next_to!
insert_row_at!
remove!
remove_column_at!
remove_row_at!
set_column_spacing!
set_columns_homogeneous!
set_orientation!
set_row_spacing!
set_rows_homogeneous!
connect_signal_destroy!
disconnect_signal_destroy!
emit_signal_destroy
get_signal_destroy_blocked
set_signal_destroy_blocked!
connect_signal_hide!
disconnect_signal_hide!
emit_signal_hide
get_signal_hide_blocked
set_signal_hide_blocked!
connect_signal_map!
disconnect_signal_map!
emit_signal_map
get_signal_map_blocked
set_signal_map_blocked!
connect_signal_realize!
disconnect_signal_realize!
emit_signal_realize
get_signal_realize_blocked
set_signal_realize_blocked!
connect_signal_show!
disconnect_signal_show!
emit_signal_show
get_signal_show_blocked
set_signal_show_blocked!
connect_signal_unmap!
disconnect_signal_unmap!
emit_signal_unmap
get_signal_unmap_blocked
set_signal_unmap_blocked!
connect_signal_unrealize!
disconnect_signal_unrealize!
emit_signal_unrealize
get_signal_unrealize_blocked
set_signal_unrealize_blocked!
GridView
Mousetrap.GridView
— TypeGridView <: Widget
Selectable widget container that arranges its children in a uniform grid.
Constructors
GridView(::Orientation, [::SelectionMode])
Signals
activate_item
(::GridView, index::Integer, [::Data_t]) -> Nothing
Emitted when the user presses the enter key while one or more items are selected.
Fields
(no public fields)
Functions that operate on this type:
clear!
find
get_enable_rubberband_selection
get_max_n_columns
get_min_n_columns
get_n_items
get_orientation
get_selection_model
get_single_click_activate
insert_at!
push_back!
push_front!
remove!
set_enable_rubberband_selection!
set_max_n_columns!
set_min_n_columns!
set_orientation!
set_single_click_activate!
connect_signal_activate_item!
disconnect_signal_activate_item!
emit_signal_activate_item
get_signal_activate_item_blocked
set_signal_activate_item_blocked!
connect_signal_destroy!
disconnect_signal_destroy!
emit_signal_destroy
get_signal_destroy_blocked
set_signal_destroy_blocked!
connect_signal_hide!
disconnect_signal_hide!
emit_signal_hide
get_signal_hide_blocked
set_signal_hide_blocked!
connect_signal_map!
disconnect_signal_map!
emit_signal_map
get_signal_map_blocked
set_signal_map_blocked!
connect_signal_realize!
disconnect_signal_realize!
emit_signal_realize
get_signal_realize_blocked
set_signal_realize_blocked!
connect_signal_show!
disconnect_signal_show!
emit_signal_show
get_signal_show_blocked
set_signal_show_blocked!
connect_signal_unmap!
disconnect_signal_unmap!
emit_signal_unmap
get_signal_unmap_blocked
set_signal_unmap_blocked!
connect_signal_unrealize!
disconnect_signal_unrealize!
emit_signal_unrealize
get_signal_unrealize_blocked
set_signal_unrealize_blocked!
GroupID
Mousetrap.GroupID
— TypeGroupID
ID of a group inside a KeyFile
. May not start with a number, and can only roman letters, 0-9, _
, -
, and .
.
Use .
to deliminate nested groups, as each key-value pair has to belong to exactly one group.
Constructors
(no public constructors)
Fields
(no public fields)
Functions that operate on this type:
HSVA
Mousetrap.HSVA
— TypeHSVA
Color in hsva format, all components are Float32
in [0, 1]
.
Constructors
HSVA(::AbstractFloat, ::AbstractFloat, ::AbstractFloat, ::AbstractFloat)
Fields
h::Float32
s::Float32
v::Float32
a::Float32
Functions that operate on this type:
HeaderBar
Mousetrap.HeaderBar
— TypeHeaderBar <: Widget
Widget that usually used as the title bar of a window. It contains a title, close-, maximize-, minimize buttons, as well as an area for widgets on both sides of the title.
Constructors
HeaderBar()
HeaderBar(layout::String)
Signals
(no unique signals)
Fields
(no public fields)
Example
header_bar = HeaderBar("close:title,minimize,maximize")
push_front!(header_bar, Button())
set_titlebar_widget!(window, header_bar)
Functions that operate on this type:
get_layout
get_show_title_buttons
push_back!
push_front!
remove!
remove_title_widget!
set_layout!
set_show_title_buttons!
set_title_widget!
connect_signal_destroy!
disconnect_signal_destroy!
emit_signal_destroy
get_signal_destroy_blocked
set_signal_destroy_blocked!
connect_signal_hide!
disconnect_signal_hide!
emit_signal_hide
get_signal_hide_blocked
set_signal_hide_blocked!
connect_signal_map!
disconnect_signal_map!
emit_signal_map
get_signal_map_blocked
set_signal_map_blocked!
connect_signal_realize!
disconnect_signal_realize!
emit_signal_realize
get_signal_realize_blocked
set_signal_realize_blocked!
connect_signal_show!
disconnect_signal_show!
emit_signal_show
get_signal_show_blocked
set_signal_show_blocked!
connect_signal_unmap!
disconnect_signal_unmap!
emit_signal_unmap
get_signal_unmap_blocked
set_signal_unmap_blocked!
connect_signal_unrealize!
disconnect_signal_unrealize!
emit_signal_unrealize
get_signal_unrealize_blocked
set_signal_unrealize_blocked!
Icon
Mousetrap.Icon
— TypeIcon
Allows loading of icons from a image file or icon theme.
Constructors
Icon()
Icon(path::String)
Icon(theme::IconTheme, id::IconID, square_resolution::Integer)
Fields
(no public fields)
Functions that operate on this type:
add_icon!
create_from_file!
create_from_icon!
create_from_theme!
get_name
get_size
has_icon
set_icon!
set_primary_icon!
set_secondary_icon!
IconID
Mousetrap.IconID
— TypeIconID
ID of an icon, used by IconTheme
to refer to icons in a file-agnostic way.
Constructors
(no public constructors)
Fields
(no public fields) )
Functions that operate on this type:
IconTheme
Mousetrap.IconTheme
— TypeIconTheme <: Any
Allows loading of items from a folder if that folder strictly adheres to the freedesktop icon theme specifications.
A Window
is required to construct the icon theme, at which point the default icons for that windows display are also loaded.
Constructors
IconTheme(::Window)
Fields
(no public fields)
Example
theme = IconTheme()
add_resource_path!(theme, "/path/to/freedesktop_icon_theme_directory")
icon = Icon()
create_from_theme!(icon, theme, "custom-icon-id", 64)
Functions that operate on this type:
Image
Mousetrap.Image
— TypeImage <: Any
2D image data, in RGBA.
Constructors
Image()
Image(path::String)
Image(width::Integer, height::Integer, [::RGBA])
Fields
(no public fields)
Functions that operate on this type:
as_cropped
as_flipped
as_scaled
create!
create_from_file!
create_from_image!
get_n_pixels
get_pixel
get_size
save_to_file
set_cursor_from_image!
set_image!
set_pixel!
ImageDisplay
Mousetrap.ImageDisplay
— TypeImageDisplay <: Widget
Widget that displays an Image
, Icon
, or image file.
Constructors
ImageDisplay(path::String)
ImageDisplay(::Image)
ImageDisplay(::Icon)
Signals
(no unique signals)
Fields
(no public fields)
Functions that operate on this type:
clear!
create_as_file_preview!
create_from_file!
create_from_icon!
create_from_image!
get_scale
get_size
set_scale!
connect_signal_destroy!
disconnect_signal_destroy!
emit_signal_destroy
get_signal_destroy_blocked
set_signal_destroy_blocked!
connect_signal_hide!
disconnect_signal_hide!
emit_signal_hide
get_signal_hide_blocked
set_signal_hide_blocked!
connect_signal_map!
disconnect_signal_map!
emit_signal_map
get_signal_map_blocked
set_signal_map_blocked!
connect_signal_realize!
disconnect_signal_realize!
emit_signal_realize
get_signal_realize_blocked
set_signal_realize_blocked!
connect_signal_show!
disconnect_signal_show!
emit_signal_show
get_signal_show_blocked
set_signal_show_blocked!
connect_signal_unmap!
disconnect_signal_unmap!
emit_signal_unmap
get_signal_unmap_blocked
set_signal_unmap_blocked!
connect_signal_unrealize!
disconnect_signal_unrealize!
emit_signal_unrealize
get_signal_unrealize_blocked
set_signal_unrealize_blocked!
KeyCode
Mousetrap.KeyCode
— TypeKeyCode
Identifier of a key. Used for ShortcutTrigger
syntax.
Constructors
(no public constructors)
Fields
(no public fields)
Functions that operate on this type:
KeyEventController
Mousetrap.KeyEventController
— TypeKeyEventController <: EventController
Event controller that recognizes keyboard key strokes.
Constructors
KeyEventController()
Signals
key_pressed
(::KeyEventController, code::KeyCode, modifiers::ModifierState, [::Data_t]) -> Nothing
Emitted when the user presses a non-modifier key (which is currently not pressed), while the controllers associated widget holds input focus.
key_released
(::KeyEventController, code::KeyCode, modifiers::ModifierState, [::Data_t]) -> Nothing
Emitted when the user releases a non-modifier key (which is currently pressed), while the controllers associated widget holds input focus.
modifiers_changed
(::KeyEventController, modifiers::ModifierState, [::Data_t]) -> Nothing
Emitted when the user presses or releases a modifier key, while the controllers associated widget holds input focus.
Fields
(no public fields)
Example
key_controller = KeyEventController()
connect_signal_key_pressed!(key_controller) do self::KeyEventController, key::KeyCode, modifier::ModifierState
if key == KEY_space
println("space bar pressed")
end
end
add_controller!(window, key_controller)
Functions that operate on this type:
connect_signal_key_pressed!
connect_signal_key_released!
disconnect_signal_key_pressed!
disconnect_signal_key_released!
emit_signal_key_pressed
emit_signal_key_released
get_signal_key_pressed_blocked
get_signal_key_released_blocked
set_signal_key_pressed_blocked!
set_signal_key_released_blocked!
connect_signal_modifiers_changed!
disconnect_signal_modifiers_changed!
emit_signal_modifiers_changed
get_signal_modifiers_changed_blocked
set_signal_modifiers_changed_blocked!
KeyFile
Mousetrap.KeyFile
— TypeKeyFile <: SignalEmitter
GLib keyfile, ordered into groups with key-value pairs.
Allows (de-)serializing of the following types:
Bool
,Vector{Bool}
AbstractFloat
,Vector{AbstractFloat}
Signed
,Vector{Signed}
Unsigned
,Vector{Unsigned}
String
,Vector{String}
RGBA
HSVA
Image
All key-values pairs have to be in exactly one group.
Constructors
KeyFile()
KeyFile(path::String)
Signals
(no unique signals)
Fields
(no public fields)
Example
key_file = KeyFile()
set_value!(key_file, "group_id", "key_id", [123, 456, 789])
set_comment_above!(key_file, "group_id", "key_id", "An example key-value pair")
println(as_string(key_file))
``` [group_id]
An example key-value pair
key_id=123;456;789; ````
Functions that operate on this type:
as_string
create_from_file!
create_from_string!
get_comment_above
get_groups
get_keys
get_value
has_group
has_key
save_to_file
set_comment_above!
set_value!
KeyID
Mousetrap.KeyID
— TypeKeyID
ID of KeyFile
key-value-pair. Contains only roman letters, 0-9, and '_'.
Constructors
(no public constructors)
Fields
(no public fields)
Functions that operate on this type:
Label
Mousetrap.Label
— TypeLabel <: Widget
Static text, multi- or single-line. Use set_ellipsize_mode!
, set_wrap_mode!
, and set_justify_mode!
to influence how text is displayed.
Supports pango markup, see the manual section on labels for more information.
Constructors
Label()
Label(markup_string::String)
Signals
(no unique signals)
Fields
(no public fields)
Functions that operate on this type:
get_ellipsize_mode
get_is_selectable
get_justify_mode
get_max_width_chars
get_text
get_use_markup
get_wrap_mode
get_x_alignment
get_y_alignment
set_ellipsize_mode!
set_is_selectable!
set_justify_mode!
set_max_width_chars!
set_text!
set_use_markup!
set_wrap_mode!
set_x_alignment!
set_y_alignment!
connect_signal_destroy!
disconnect_signal_destroy!
emit_signal_destroy
get_signal_destroy_blocked
set_signal_destroy_blocked!
connect_signal_hide!
disconnect_signal_hide!
emit_signal_hide
get_signal_hide_blocked
set_signal_hide_blocked!
connect_signal_map!
disconnect_signal_map!
emit_signal_map
get_signal_map_blocked
set_signal_map_blocked!
connect_signal_realize!
disconnect_signal_realize!
emit_signal_realize
get_signal_realize_blocked
set_signal_realize_blocked!
connect_signal_show!
disconnect_signal_show!
emit_signal_show
get_signal_show_blocked
set_signal_show_blocked!
connect_signal_unmap!
disconnect_signal_unmap!
emit_signal_unmap
get_signal_unmap_blocked
set_signal_unmap_blocked!
connect_signal_unrealize!
disconnect_signal_unrealize!
emit_signal_unrealize
get_signal_unrealize_blocked
set_signal_unrealize_blocked!
LevelBar
Mousetrap.LevelBar
— TypeLevelBar <: Widget
Non-interactive widget that displays the value of a range as a fraction.
Constructors
LevelBar(min::AbstractFloat, max::AbstractFloat)
Signals
(no unique signals)
Fields
(no public fields)
Functions that operate on this type:
add_marker!
get_inverted
get_max_value
get_min_value
get_mode
get_orientation
get_value
remove_marker!
set_inverted!
set_max_value!
set_min_value!
set_mode!
set_orientation!
set_value!
connect_signal_destroy!
disconnect_signal_destroy!
emit_signal_destroy
get_signal_destroy_blocked
set_signal_destroy_blocked!
connect_signal_hide!
disconnect_signal_hide!
emit_signal_hide
get_signal_hide_blocked
set_signal_hide_blocked!
connect_signal_map!
disconnect_signal_map!
emit_signal_map
get_signal_map_blocked
set_signal_map_blocked!
connect_signal_realize!
disconnect_signal_realize!
emit_signal_realize
get_signal_realize_blocked
set_signal_realize_blocked!
connect_signal_show!
disconnect_signal_show!
emit_signal_show
get_signal_show_blocked
set_signal_show_blocked!
connect_signal_unmap!
disconnect_signal_unmap!
emit_signal_unmap
get_signal_unmap_blocked
set_signal_unmap_blocked!
connect_signal_unrealize!
disconnect_signal_unrealize!
emit_signal_unrealize
get_signal_unrealize_blocked
set_signal_unrealize_blocked!
ListView
Mousetrap.ListView
— TypeListView <: Widget
Selectable widget container that arranges its children in a (nested) list.
Constructors
ListView(::Orientation, [::SelectionMode])
Signals
activate_item
(::ListView, index::Integer, [::Data_t]) -> Nothing
Emitted when the user presses the enter key while one or more items are selected.
Fields
(no public fields)
Example
list_view = ListView(ORIENTATION_VERTICAL)
item_01_iterator = push_back!(list_view, Label("Item 01"))
push_back!(list_view, Label("Item 02"))
push_back!(list_view, Label("Imte 03"))
push_back!(list_view, Label("Nested Item 01"), item_01_iterator)
push_back!(list_view, Label("Nested Item 02"), item_01_iterator)
set_child!(window, list_view)
Functions that operate on this type:
clear!
find
get_enable_rubberband_selection
get_n_items
get_orientation
get_selection_model
get_show_separators
get_single_click_activate
insert_at!
push_back!
push_front!
remove!
set_enable_rubberband_selection!
set_orientation!
set_show_separators!
set_single_click_activate!
set_widget_at!
connect_signal_activate_item!
disconnect_signal_activate_item!
emit_signal_activate_item
get_signal_activate_item_blocked
set_signal_activate_item_blocked!
connect_signal_destroy!
disconnect_signal_destroy!
emit_signal_destroy
get_signal_destroy_blocked
set_signal_destroy_blocked!
connect_signal_hide!
disconnect_signal_hide!
emit_signal_hide
get_signal_hide_blocked
set_signal_hide_blocked!
connect_signal_map!
disconnect_signal_map!
emit_signal_map
get_signal_map_blocked
set_signal_map_blocked!
connect_signal_realize!
disconnect_signal_realize!
emit_signal_realize
get_signal_realize_blocked
set_signal_realize_blocked!
connect_signal_show!
disconnect_signal_show!
emit_signal_show
get_signal_show_blocked
set_signal_show_blocked!
connect_signal_unmap!
disconnect_signal_unmap!
emit_signal_unmap
get_signal_unmap_blocked
set_signal_unmap_blocked!
connect_signal_unrealize!
disconnect_signal_unrealize!
emit_signal_unrealize
get_signal_unrealize_blocked
set_signal_unrealize_blocked!
ListViewIterator
Mousetrap.ListViewIterator
— TypeListViewIterator
Iterator returned when inserting an item into a ListView
. Use this iterator as an additional argument to push_back!
, push_front!
, or insert
, in order to create a nested list at that item position.
Constructors
(no public constructors)
Fields
(no public fields)
Functions that operate on this type:
LogDomain
Mousetrap.LogDomain
— TypeLogDomain
Domain of log messages, this will be used to associate log message with a specific application or library. May only contain roman letters, _
, .
and -
.
Constructors
LogDomain(::String)
Fields
(no public fields)
Functions that operate on this type:
LongPressEventController
Mousetrap.LongPressEventController
— TypeLongPressEventController <: SingleClickGesture <: EventController
Event controller that recognizes long-press-gestures from a mouse or touch device.
Constructors
LongPressEventController()
Signals
pressed
(::LongPressEventController, x::AbstractFloat, y::AbstractFloat, [::Data_t]) -> Nothing
Emitted once when a long-press gesture is recognized, where
x
andy
are the current position of the cursor, in pixels.
press_cancelled
(::LongPressEventController, [::Data_t]) -> Nothing
Emitted once when the user releases the button of a long-press gesture.
Fields
(no public fields)
Example
long_press_controller = LongPressEventController()
connect_signal_pressed!(long_press_controller) do self::LongPressEventController, x::AbstractFloat, y::AbstractFloat
println("long press recognized at ($x, $y)")
end
add_controller!(window, long_press_controller)
Functions that operate on this type:
connect_signal_press_cancelled!
connect_signal_pressed!
disconnect_signal_press_cancelled!
disconnect_signal_pressed!
emit_signal_press_cancelled
emit_signal_pressed
get_signal_press_cancelled_blocked
get_signal_pressed_blocked
set_signal_press_cancelled_blocked!
set_signal_pressed_blocked!
MenuBar
Mousetrap.MenuBar
— TypeMenuBar <: Widget
View that displays a MenuModel
as a horizontal bar.
The MenuModel
has to have the following structure:
- all top-level items have to be "submenu"-type items
- no submenu or section of another submenu may have a "widget"-type item
Constructors
HeaderBar(::MenuModel)
Signals
(no unique signals)
Fields
(no public fields)
Example
action = Action("example.action", app)
set_function!(action) do action::Action
println(get_id(action), " activate.")
end
outer_model = MenuModel()
inner_model = MenuModel()
add_action!(inner_model, "Trigger Action", action)
add_submenu!(outer_model, "Submenu", inner_model)
menu_bar = MenuBar(outer_model)
set_child!(window, menu_bar)
Functions that operate on this type:
connect_signal_destroy!
disconnect_signal_destroy!
emit_signal_destroy
get_signal_destroy_blocked
set_signal_destroy_blocked!
connect_signal_hide!
disconnect_signal_hide!
emit_signal_hide
get_signal_hide_blocked
set_signal_hide_blocked!
connect_signal_map!
disconnect_signal_map!
emit_signal_map
get_signal_map_blocked
set_signal_map_blocked!
connect_signal_realize!
disconnect_signal_realize!
emit_signal_realize
get_signal_realize_blocked
set_signal_realize_blocked!
connect_signal_show!
disconnect_signal_show!
emit_signal_show
get_signal_show_blocked
set_signal_show_blocked!
connect_signal_unmap!
disconnect_signal_unmap!
emit_signal_unmap
get_signal_unmap_blocked
set_signal_unmap_blocked!
connect_signal_unrealize!
disconnect_signal_unrealize!
emit_signal_unrealize
get_signal_unrealize_blocked
set_signal_unrealize_blocked!
MenuModel
Mousetrap.MenuModel
— TypeMenuModel <: SignalEmitter
Model that holds information about how to construct a menu.
Use MenuBar
or PopoverMenu
to display the menu to the user.
The following types of menu items are available
See the manual section on menus for more information.
Constructors
MenuModel()
Signals
items_changed
(::MenuModel, position::Integer, n_removed::Integer, n_added::Integer, [::Data_t]) -> Nothing
Emitted when the number of menu items, or any of their properties, changes.
Fields
(no public fields)
Functions that operate on this type:
connect_signal_items_changed!
disconnect_signal_items_changed!
emit_signal_items_changed
get_signal_items_changed_blocked
set_signal_items_changed_blocked!
ModifierState
Mousetrap.ModifierState
— TypeModifierState
Holds information about which modifier are currently pressed
See also:
Constructors
(no public constructors)
Fields
(no public fields)
Example
key_controller = KeyEventController()
connect_signal_modifiers_changed!(key_controller) do self::KeyEventController, modifiers::ModifierState
if shift_pressed(modifiers)
println("Shift was pressed")
end
end
add_controller!(window, key_controller)
Functions that operate on this type:
MotionEventController
Mousetrap.MotionEventController
— TypeMotionEventController <: EventController
Captures cursor motion events while the cursor is inside the allocated area of the associated widget.
Constructors
MotionEventController()
Signals
motion_enter
(::MotionEventController, x::AbstractFloat, y::AbstractFloat, [::Data_t]) -> Nothing
Emitted once when the users cursor first enters the allocated area of the widget on screen, where
x
andy
are the current position of the cursor, in pixels.
motion
(::MotionEventController, x::AbstractFloat, y::AbstractFloat, [::Data_t]) -> Nothing
Emitted once per frame, while the cursor is inside the allocated area of the widget, where
x
andy
are the current cursor position, in pixels.
motion_leave
(::MotionEventController, [::Data_t]) -> Nothing
Emitted exactly once when the cursor leaves the allocated area of the widget.
Fields
(no public fields)
Example
motion_controller = MotionEventController()
connect_signal_motion!(motion_controller) do self::MotionEventController, x::AbstractFloat, y::AbstractFloat
println("recognized motion at ($(Int64(round(x))), $(Int64(round(y))))")
end
add_controller!(window, motion_controller)
Functions that operate on this type:
connect_signal_motion!
connect_signal_motion_enter!
connect_signal_motion_leave!
disconnect_signal_motion!
disconnect_signal_motion_enter!
disconnect_signal_motion_leave!
emit_signal_motion
emit_signal_motion_enter
emit_signal_motion_leave
get_signal_motion_blocked
get_signal_motion_enter_blocked
get_signal_motion_leave_blocked
set_signal_motion_blocked!
set_signal_motion_enter_blocked!
set_signal_motion_leave_blocked!
Notebook
Mousetrap.Notebook
— TypeNotebook <: Widget
Widget that arranges its children as a list of pages. Each page has exactly one child widget, as well as an optional label widget. Pages can be freely reordered by the user if set_tabs_reorderable!
is set to true. It furthermore supports a quick-change menu, in which the user can quickly jump to another tab. To enable this, set_quick_change_menu_enabled!
needs to be set to true
.
Constructors
Notebook()
Signals
page_added
(::Notebook, page_index::Integer, [::Data_t]) -> Nothing
Emitted when the total number of pages increases, where
page_index
is the position of the page that was inserted.
page_removed
(::Notebook, page_index::Integer, [::Data_t]) -> Nothing
Emitted when a page is removed, where
page_index
is the old index of the page that was removed.
page_reordered
(::Notebook, page_index::Integer, [::Data_t]) -> Nothing
Emitted when a page changes position, where
page_index
is the new position of the page.
page_selection_changed
(::Notebook, page_index::Integer, [::Data_t]) -> Nothing
Emitted when the currently active page changes by any means, where
page_index
is the index of the now visible page.
Fields
(no public fields)
Example
notebook = Notebook()
push_back!(notebook, Separator(), Label("Page 01"))
push_back!(notebook, Separator(), Label("Page 02"))
connect_signal_page_selection_changed!(notebook) do x::Notebook, index::Integer
println("Page #$index is now selected")
end
set_child!(window, notebook)
Functions that operate on this type:
get_current_page
get_has_border
get_is_scrollable
get_n_pages
get_quick_change_menu_enabled
get_tab_position
get_tabs_reorderable
get_tabs_visible
goto_page!
insert_at!
move_page_to!
next_page!
previous_page!
push_back!
push_front!
remove!
set_has_border!
set_is_scrollable!
set_quick_change_menu_enabled!
set_tab_position!
set_tabs_reorderable!
set_tabs_visible!
connect_signal_destroy!
disconnect_signal_destroy!
emit_signal_destroy
get_signal_destroy_blocked
set_signal_destroy_blocked!
connect_signal_hide!
disconnect_signal_hide!
emit_signal_hide
get_signal_hide_blocked
set_signal_hide_blocked!
connect_signal_map!
disconnect_signal_map!
emit_signal_map
get_signal_map_blocked
set_signal_map_blocked!
connect_signal_page_added!
connect_signal_page_removed!
connect_signal_page_reordered!
connect_signal_page_selection_changed!
disconnect_signal_page_added!
disconnect_signal_page_removed!
disconnect_signal_page_reordered!
disconnect_signal_page_selection_changed!
emit_signal_page_added
emit_signal_page_removed
emit_signal_page_reordered
emit_signal_page_selection_changed
get_signal_page_added_blocked
get_signal_page_removed_blocked
get_signal_page_reordered_blocked
get_signal_page_selection_changed_blocked
set_signal_page_added_blocked!
set_signal_page_removed_blocked!
set_signal_page_reordered_blocked!
set_signal_page_selection_changed_blocked!
connect_signal_realize!
disconnect_signal_realize!
emit_signal_realize
get_signal_realize_blocked
set_signal_realize_blocked!
connect_signal_show!
disconnect_signal_show!
emit_signal_show
get_signal_show_blocked
set_signal_show_blocked!
connect_signal_unmap!
disconnect_signal_unmap!
emit_signal_unmap
get_signal_unmap_blocked
set_signal_unmap_blocked!
connect_signal_unrealize!
disconnect_signal_unrealize!
emit_signal_unrealize
get_signal_unrealize_blocked
set_signal_unrealize_blocked!
Overlay
Mousetrap.Overlay
— TypeOverlay <: Widget
Widget that has exaclty one "base" child, and any number of "overlay" children. If two interactable widgets overlap, only the top-most widget will be interactable.
Constructors
Overlay()
Overlay(base::Widget, overlays::Widget...)
Signals
(no unique signals)
Fields
(no public fields)
Example
overlay = Overlay()
set_child!(overlay, Separator())
add_overlay!(overlay, Label("On Top"))
set_child!(window, overlay)
Functions that operate on this type:
connect_signal_destroy!
disconnect_signal_destroy!
emit_signal_destroy
get_signal_destroy_blocked
set_signal_destroy_blocked!
connect_signal_hide!
disconnect_signal_hide!
emit_signal_hide
get_signal_hide_blocked
set_signal_hide_blocked!
connect_signal_map!
disconnect_signal_map!
emit_signal_map
get_signal_map_blocked
set_signal_map_blocked!
connect_signal_realize!
disconnect_signal_realize!
emit_signal_realize
get_signal_realize_blocked
set_signal_realize_blocked!
connect_signal_show!
disconnect_signal_show!
emit_signal_show
get_signal_show_blocked
set_signal_show_blocked!
connect_signal_unmap!
disconnect_signal_unmap!
emit_signal_unmap
get_signal_unmap_blocked
set_signal_unmap_blocked!
connect_signal_unrealize!
disconnect_signal_unrealize!
emit_signal_unrealize
get_signal_unrealize_blocked
set_signal_unrealize_blocked!
PanEventController
Mousetrap.PanEventController
— TypePanEventController <: SingleClickGesture <: EventController
Recognizes pan gestures along exactly one axis.
Constructors
PanEventController(axis::Orientation)
Signals
pan
(::PanEventController, ::PanDirection, offset::AbstractFloat, [::Data_t]) -> Nothing
Emitted once per frame while a pan gesture is active, where
offset
is the horizontal (or vertical) distance between the current position of the cursor, and the position at the start of the gesture, in pixels.
Fields
(no public fields)
Example
connect_signal_pan!(pan_controller) do self::PanEventController, direction::PanDirection, offset::AbstractFloat
if direction == PAN_DIRECTION_LEFT
println("panning left")
elseif direction == PAN_DIRECTION_RIGHT
println("panning right")
end
println("x-offset from start position: $offset")
end
add_controller!(window, pan_controller)
Functions that operate on this type:
connect_signal_pan!
disconnect_signal_pan!
emit_signal_pan
get_signal_pan_blocked
set_signal_pan_blocked!
Paned
Mousetrap.Paned
— TypePaned <: Widget
Widget with exactly two children. Draws a solid border between the two, which the user can drag to one side or the other to control the size of both widgets at the same time.
Constructors
Paned(orientation::Orientation)
Paned(orientation::Orientation, start_child::Widget, end_child::Widget)
Signals
(no unique signals)
Fields
(no public fields)
Example
paned = Paned(ORIENTATION_HORIZONTAL)
set_start_child!(paned, Label("Left"))
set_end_child!(paned, Label("Right"))
Functions that operate on this type:
get_end_child_resizable
get_end_child_shrinkable
get_has_wide_handle
get_orientation
get_position
get_start_child_resizable
get_start_child_shrinkable
remove_end_child!
remove_start_child!
set_end_child!
set_end_child_resizable!
set_end_child_shrinkable!
set_has_wide_handle!
set_orientation!
set_position!
set_start_child!
set_start_child_resizable!
set_start_child_shrinkable!
PinchZoomEventController
Mousetrap.PinchZoomEventController
— TypePinchZoomEventController <: EventController
Controller recognizing 2-finger pinch-zoom gestures (touch-only).
Constructors
PinchZoomEventController()
Signals
scale_changed
(::PinchZoomEventController, scale::AbstractFloat, [::Data_t]) -> Nothing
Emitted any time the distance between two fingers of a pinch-zoom-gesture changes, where
scale
is the factor of the current distance between the two fingers, compared to the distance at the start of the gesture.
Fields
(no public fields)
Example
pinch_zoom_controller = PinchZoomEventController()
connect_signal_scale_changed!(pinch_zoom_controller) do self::PinchZoomEventController, scale::AbstractFloat
println("current scale: $scale")
end
add_controller!(window, pinch_zoom_controller)
Functions that operate on this type:
connect_signal_scale_changed!
disconnect_signal_scale_changed!
emit_signal_scale_changed
get_signal_scale_changed_blocked
set_signal_scale_changed_blocked!
Popover
Mousetrap.Popover
— TypePopover <: Widget
Window-type widget with exactly one child, has to be attached to another widget to be visible. Use PopoverButton
to automatically show / hide the popover.
Constructors
Popover()
Signals
closed
(::Popover, [::Data_t]) -> Nothing
Emitted when a popover-window is closed, for example by calling
popdown!
, or it loosing focus whileset_autohide!
is set totrue
.
Fields
(no public fields)
Example
popover = Popover()
set_child!(popover, Label("Popover!"))
popover_button = PopoverButton()
set_popover!(popover_button, popover)
set_child!(window, popover_button)
Functions that operate on this type:
get_autohide
get_has_base_arrow
get_relative_position
popdown!
popup!
remove_child!
set_autohide!
set_child!
set_has_base_arrow!
set_popover!
set_relative_position!
connect_signal_closed!
disconnect_signal_closed!
emit_signal_closed
get_signal_closed_blocked
set_signal_closed_blocked!
connect_signal_destroy!
disconnect_signal_destroy!
emit_signal_destroy
get_signal_destroy_blocked
set_signal_destroy_blocked!
connect_signal_hide!
disconnect_signal_hide!
emit_signal_hide
get_signal_hide_blocked
set_signal_hide_blocked!
connect_signal_map!
disconnect_signal_map!
emit_signal_map
get_signal_map_blocked
set_signal_map_blocked!
connect_signal_realize!
disconnect_signal_realize!
emit_signal_realize
get_signal_realize_blocked
set_signal_realize_blocked!
connect_signal_show!
disconnect_signal_show!
emit_signal_show
get_signal_show_blocked
set_signal_show_blocked!
connect_signal_unmap!
disconnect_signal_unmap!
emit_signal_unmap
get_signal_unmap_blocked
set_signal_unmap_blocked!
connect_signal_unrealize!
disconnect_signal_unrealize!
emit_signal_unrealize
get_signal_unrealize_blocked
set_signal_unrealize_blocked!
PopoverButton
Mousetrap.PopoverButton
— TypePopoverButton <: Widget
Button that automatically shows or hides its associated Popover
or PopoverMenu
when clicked.
Constructors
PopoverButton(::Popover)
PopoverButton(::PopoverMenu)
Signals
(no unique signals)
Fields
(no public fields)
Example
popover = Popover()
set_child!(popover, Label("Popover!"))
popover_button = PopoverButton()
set_popover!(popover_button, popover)
set_child!(window, popover_button)
Functions that operate on this type:
get_always_show_arrow
get_has_frame
get_is_circular
get_relative_position
popdown!
popup!
remove_child!
remove_popover!
set_always_show_arrow!
set_child!
set_has_frame!
set_icon!
set_is_circular!
set_popover!
set_popover_menu!
set_relative_position!
connect_signal_activate!
disconnect_signal_activate!
emit_signal_activate
get_signal_activate_blocked
set_signal_activate_blocked!
connect_signal_destroy!
disconnect_signal_destroy!
emit_signal_destroy
get_signal_destroy_blocked
set_signal_destroy_blocked!
connect_signal_hide!
disconnect_signal_hide!
emit_signal_hide
get_signal_hide_blocked
set_signal_hide_blocked!
connect_signal_map!
disconnect_signal_map!
emit_signal_map
get_signal_map_blocked
set_signal_map_blocked!
connect_signal_realize!
disconnect_signal_realize!
emit_signal_realize
get_signal_realize_blocked
set_signal_realize_blocked!
connect_signal_show!
disconnect_signal_show!
emit_signal_show
get_signal_show_blocked
set_signal_show_blocked!
connect_signal_unmap!
disconnect_signal_unmap!
emit_signal_unmap
get_signal_unmap_blocked
set_signal_unmap_blocked!
connect_signal_unrealize!
disconnect_signal_unrealize!
emit_signal_unrealize
get_signal_unrealize_blocked
set_signal_unrealize_blocked!
PopoverMenu
Mousetrap.PopoverMenu
— TypePopoverMenu <: Widget
Menu view that display a MenuModel
in a popover window. Use PopoverButton
to automatically show / hide the popover.
Constructors
PopoverMenu(::MenuModel)
Signals
closed
(::PopoverMenu, [::Data_t]) -> Nothing
Emitted when a popover-window is closed, for example by calling
popdown!
, or it loosing focus whileset_autohide!
is set totrue
.
Fields
(no public fields)
Example
action = Action("example.action", app)
set_function!(action) do x::Action
println("Action activated")
end
model = MenuModel()
add_action!(model, "Trigger Example", action)
popover_menu = PopoverMenu(model)
popover_button = PopoverButton()
set_popover_menu!(popover_button, popover_menu)
set_child!(window, popover_button)
Functions that operate on this type:
connect_signal_closed!
disconnect_signal_closed!
emit_signal_closed
get_signal_closed_blocked
set_signal_closed_blocked!
connect_signal_destroy!
disconnect_signal_destroy!
emit_signal_destroy
get_signal_destroy_blocked
set_signal_destroy_blocked!
connect_signal_hide!
disconnect_signal_hide!
emit_signal_hide
get_signal_hide_blocked
set_signal_hide_blocked!
connect_signal_map!
disconnect_signal_map!
emit_signal_map
get_signal_map_blocked
set_signal_map_blocked!
connect_signal_realize!
disconnect_signal_realize!
emit_signal_realize
get_signal_realize_blocked
set_signal_realize_blocked!
connect_signal_show!
disconnect_signal_show!
emit_signal_show
get_signal_show_blocked
set_signal_show_blocked!
connect_signal_unmap!
disconnect_signal_unmap!
emit_signal_unmap
get_signal_unmap_blocked
set_signal_unmap_blocked!
connect_signal_unrealize!
disconnect_signal_unrealize!
emit_signal_unrealize
get_signal_unrealize_blocked
set_signal_unrealize_blocked!
PopupMessage
Mousetrap.PopupMessage
— TypePopupMessage <: SignalEmitter
Popup message, always has a title and a close button. Additionally, a singular optional button can be placed next to the title. When clicked, the PopupMessage
emits signal button_clicked
, or calls the Action
connected to the button using set_button_action!
.
Use PopupMessageOverlay
to display the message above a widget.
Constructors
PopupMessage(title::String)
PopupMessage(title::String, button_label::String)
Signals
dismissed
(::PopupMessage, [::Data_t]) -> Nothing
Emitted when the user clicks the close button of the
PopupMessage
button_clicked
(::PopupMessage, [::Data_t]) -> Nothing
Emitted when the user clicks the button of a
PopupMessage
. Note that the button is only visible ifset_button_label!
was set to anything but""
Fields
(no public fields)
Example
message_overlay = PopupMessageOverlay()
set_child!(message_overlay, Separator())
message = PopupMessage("Is this a message?", "Yes")
connect_signal_button_clicked!(message) do self::PopupMessage
println("button clicked")
end
connect_signal_dismissed!(message) do self::PopupMessage
println("message closed")
end
show_message!(message_overlay, message)
Functions that operate on this type:
get_button_action_id
get_button_label
get_is_high_priority
get_timeout
get_title
set_button_action!
set_button_label!
set_is_high_priority!
set_timeout!
set_title!
show_message!
connect_signal_button_clicked!
disconnect_signal_button_clicked!
emit_signal_button_clicked
get_signal_button_clicked_blocked
set_signal_button_clicked_blocked!
connect_signal_dismissed!
disconnect_signal_dismissed!
emit_signal_dismissed
get_signal_dismissed_blocked
set_signal_dismissed_blocked!
PopupMessageOverlay
Mousetrap.PopupMessageOverlay
— TypePopupMessageOverlay <: SignalEmitter
Widget that can display a PopupMessage
above the PopupMessageOverlay
's singular child. Only one message can be shown at a time.
Constructors
PopupMessageOverlay()
Signals
(no unique signals)
Fields
(no public fields)
Example
overlay = PopupMessageOverlay()
set_child!(overlay, widget)
message = PopupMessage("This example works!", "ok")
connect_signal_button_clicked!(message) do self::PopupMessage
println("button clicked")
end
connect_signal_dismissed!(message) do self::PopupMessage
println("message closed")
end
show_message!(overlay, message)
Functions that operate on this type:
connect_signal_destroy!
disconnect_signal_destroy!
emit_signal_destroy
get_signal_destroy_blocked
set_signal_destroy_blocked!
connect_signal_hide!
disconnect_signal_hide!
emit_signal_hide
get_signal_hide_blocked
set_signal_hide_blocked!
connect_signal_map!
disconnect_signal_map!
emit_signal_map
get_signal_map_blocked
set_signal_map_blocked!
connect_signal_realize!
disconnect_signal_realize!
emit_signal_realize
get_signal_realize_blocked
set_signal_realize_blocked!
connect_signal_show!
disconnect_signal_show!
emit_signal_show
get_signal_show_blocked
set_signal_show_blocked!
connect_signal_unmap!
disconnect_signal_unmap!
emit_signal_unmap
get_signal_unmap_blocked
set_signal_unmap_blocked!
connect_signal_unrealize!
disconnect_signal_unrealize!
emit_signal_unrealize
get_signal_unrealize_blocked
set_signal_unrealize_blocked!
ProgressBar
Mousetrap.ProgressBar
— TypeProgressBar <: Widget
Bar that displays a fraction in [0, 1]
. Use set_fraction!
to change the current value.
Constructors
ProgressBar()
Signals
(no unique signals)
Fields
(no public fields)
Functions that operate on this type:
get_fraction
get_is_inverted
get_orientation
get_show_text
get_text
pulse
set_fraction!
set_is_inverted!
set_orientation!
set_show_text!
set_text!
RGBA
Mousetrap.RGBA
— TypeRGBA
Color representation in rgba. All components are Float32
in [0, 1]
.
Constructors
RGBA(r::AbstractFloat, g::AbstractFloat, b::AbstractFloat, a::AbstractFloat)
Fields
r::Float32
g::Float32
b::Float32
a::Flota32
Functions that operate on this type:
RenderArea
Mousetrap.RenderArea
— TypeRenderArea <: Widget
Canvas for rendering custom shapes.
See the manual chapter on native rendering for more information.
Constructors
RenderArea([AntiAliasingQuality = ANTI_ALIASING_QUALITY_OFF])
Signals
resize
(::RenderArea, width::Integer, height::Integer, [::Data_t]) -> Nothing
Emitted whenver the allocated area of a
RenderArea
changes, wherewidth
andheight
are the new size, in pixels.
Fields
(no public fields)
Example
render_area = RenderArea()
rectangle = Rectangle(Vector2f(-0.5, -0.5), Vector2f(1, 1))
add_render_task!(render_area, RenderTask(rectangle))
set_size_request!(render_area, Vector2f(150, 150))
set_child!(window, render_area)
Functions that operate on this type:
add_render_task!
clear
clear_render_tasks!
Mousetrap.flush
from_gl_coordinates
make_current
queue_render
render_render_tasks
to_gl_coordinates
connect_signal_destroy!
disconnect_signal_destroy!
emit_signal_destroy
get_signal_destroy_blocked
set_signal_destroy_blocked!
connect_signal_hide!
disconnect_signal_hide!
emit_signal_hide
get_signal_hide_blocked
set_signal_hide_blocked!
connect_signal_map!
disconnect_signal_map!
emit_signal_map
get_signal_map_blocked
set_signal_map_blocked!
connect_signal_realize!
disconnect_signal_realize!
emit_signal_realize
get_signal_realize_blocked
set_signal_realize_blocked!
connect_signal_render!
disconnect_signal_render!
emit_signal_render
get_signal_render_blocked
set_signal_render_blocked!
connect_signal_resize!
disconnect_signal_resize!
emit_signal_resize
get_signal_resize_blocked
set_signal_resize_blocked!
connect_signal_show!
disconnect_signal_show!
emit_signal_show
get_signal_show_blocked
set_signal_show_blocked!
connect_signal_unmap!
disconnect_signal_unmap!
emit_signal_unmap
get_signal_unmap_blocked
set_signal_unmap_blocked!
connect_signal_unrealize!
disconnect_signal_unrealize!
emit_signal_unrealize
get_signal_unrealize_blocked
set_signal_unrealize_blocked!
RenderTask
Mousetrap.RenderTask
— TypeRenderTask <: SignalEmitter
Task that groups a Shape
, Shader
, [GLTransform
]@ref, and BlendMode
, allowing them to be bound for rendering.
If no shader, transform, and/or blend mode is specified, the default shader, identity transform, and BLEND_MODE_NORMAL
will be used, respectively.
See the manual chapter on native rendering for more information.
Constructors
RenderTask(::Shape; [shader::Union{Shader, Nothing}, transform::Union{GLTransform, Nothing}, blend_mode::BlendMode])
Signals
(no unique signals)
Fields
(no public fields)
Example
shape = Rectangle(Vector2f(-0.5, -0.5), Vector2f(1, 1))
task = RenderTask(shape)
# euivalent to
task = RenderTask(shape;
shader = nothing,
transform = nothing,
blend_mode = BLEND_MODE_NORMAL
)
Functions that operate on this type:
add_render_task!
get_uniform_float
get_uniform_hsva
get_uniform_int
get_uniform_rgba
get_uniform_transform
get_uniform_uint
get_uniform_vec2
get_uniform_vec3
get_uniform_vec4
render
set_uniform_float!
set_uniform_hsva!
set_uniform_int!
set_uniform_rgba!
set_uniform_transform!
set_uniform_uint!
set_uniform_vec2!
set_uniform_vec3!
set_uniform_vec4!
RenderTexture
Mousetrap.RenderTexture
— TypeRenderTexture <: TextureObject <: SignalEmitter
Texture that can be bound as a render target. This object is for internal use only.
Constructors
RenderTexture()
Signals
(no unique signals)
Fields
(no public fields)
Functions that operate on this type:
Revealer
Mousetrap.Revealer
— TypeRevealer <: Widget
Container that plays an animation to reveal or hide its singular child.
Constructors
Revealer([::RevealerTransitionType])
Revealer(child::Widget, [::RevealerTransitionType])
Signals
revealed
(::Revealer, [::Data_t]) -> Nothing
Emitted once when a
Revealer
s child goes from hidden to shown (or shown to hidden) and the corresponding animation has finished playing.
Fields
(no public fields)
Functions that operate on this type:
get_is_revealed
get_transition_duration
get_transition_type
remove_child!
set_child!
set_is_revealed!
set_transition_duration!
set_transition_type!
connect_signal_destroy!
disconnect_signal_destroy!
emit_signal_destroy
get_signal_destroy_blocked
set_signal_destroy_blocked!
connect_signal_hide!
disconnect_signal_hide!
emit_signal_hide
get_signal_hide_blocked
set_signal_hide_blocked!
connect_signal_map!
disconnect_signal_map!
emit_signal_map
get_signal_map_blocked
set_signal_map_blocked!
connect_signal_realize!
disconnect_signal_realize!
emit_signal_realize
get_signal_realize_blocked
set_signal_realize_blocked!
connect_signal_revealed!
disconnect_signal_revealed!
emit_signal_revealed
get_signal_revealed_blocked
set_signal_revealed_blocked!
connect_signal_show!
disconnect_signal_show!
emit_signal_show
get_signal_show_blocked
set_signal_show_blocked!
connect_signal_unmap!
disconnect_signal_unmap!
emit_signal_unmap
get_signal_unmap_blocked
set_signal_unmap_blocked!
connect_signal_unrealize!
disconnect_signal_unrealize!
emit_signal_unrealize
get_signal_unrealize_blocked
set_signal_unrealize_blocked!
RotateEventController
Mousetrap.RotateEventController
— TypeRotateEventController <: EventController
Recognizes 2-finger rotate gestures (touch-only).
Constructors
RotateEventController()
Signals
rotation_changed
(::RotateEventController, angle_absolute::AbstractFloat, angle_delta::AbstractFloat, [::Data_t]) -> Nothing
Emitted when the angle between the two fingers of a rotate-gesture changes, where
angle_delta
is the offset,angle_absolute
the current angle, in radians.
Fields
(no public fields)
Example
rotate_controller = RotateEventController()
connect_signal_rotation_changed!(rotate_controller) do self::RotateEventController, angle_absolute::AbstractFloat, angle_dela::AbstractFloat
println("angle is now: " * as_degrees(radians(angle_absolute)) * "°")
end
add_controller!(window, rotate_controller)
Functions that operate on this type:
connect_signal_rotation_changed!
disconnect_signal_rotation_changed!
emit_signal_rotation_changed
get_signal_rotation_changed_blocked
set_signal_rotation_changed_blocked!
Scale
Mousetrap.Scale
— TypeScale <: Widget
Allows users to select a value from a range.
Constructors
Scale(lower::AbstractFloat, upper::AbstractFloat, step_increment::AbstractFloat, [::Orientation])
Signals
value_changed
(::Scale, [::Data_t]) -> Nothing
Emitted when the
value
property of theAdjustment
changes.
Fields
(no public fields)
Example
scale = Scale(0, 1, 0.01)
connect_signal_value_changed!(scale) self::Scale
println("Current value: $(get_value(scale))")
end
Functions that operate on this type:
add_mark!
clear_marks!
get_adjustment
get_has_origin
get_lower
get_orientation
get_should_draw_value
get_step_increment
get_upper
get_value
set_has_origin!
set_lower!
set_orientation!
set_should_draw_value!
set_step_increment!
set_upper!
set_value!
connect_signal_destroy!
disconnect_signal_destroy!
emit_signal_destroy
get_signal_destroy_blocked
set_signal_destroy_blocked!
connect_signal_hide!
disconnect_signal_hide!
emit_signal_hide
get_signal_hide_blocked
set_signal_hide_blocked!
connect_signal_map!
disconnect_signal_map!
emit_signal_map
get_signal_map_blocked
set_signal_map_blocked!
connect_signal_realize!
disconnect_signal_realize!
emit_signal_realize
get_signal_realize_blocked
set_signal_realize_blocked!
connect_signal_show!
disconnect_signal_show!
emit_signal_show
get_signal_show_blocked
set_signal_show_blocked!
connect_signal_unmap!
disconnect_signal_unmap!
emit_signal_unmap
get_signal_unmap_blocked
set_signal_unmap_blocked!
connect_signal_unrealize!
disconnect_signal_unrealize!
emit_signal_unrealize
get_signal_unrealize_blocked
set_signal_unrealize_blocked!
connect_signal_value_changed!
disconnect_signal_value_changed!
emit_signal_value_changed
get_signal_value_changed_blocked
set_signal_value_changed_blocked!
ScrollEventController
Mousetrap.ScrollEventController
— TypeScrollEventController <: EventController
Controller recognizing scrolling gestures by a mouse scrollwheel or touch device.
Constructors
ScrollEventController([kinetic_scrolling_enabled::Bool = false])
Signals
scroll_begin
(::ScrollEventController, [::Data_t]) -> Nothing
Emitted once when a scroll gesture is first recognized.
scroll
(::ScrollEventController, x_delta::AbstractFloat, y_delta::AbstractFloat, [::Data_t]) -> Nothing
Emitted once per frame while a scroll gesture is active, where
x_delta
andy_delta
are the offset along the horizontal and vertical axis, in pixels.
scroll_end
(::ScrollEventController, [::Data_t]) -> Nothing
Emitted to signal the end of a scroll gesture.
kinetic_scroll_decelerate
(::ScrollEventController, x_velocity::AbstractFloat, y_velocity::AbstractFloat, [::Data_t]) -> Nothing
Emitted once per frame while kinetic scrolling is active, see the manual on
ScrollEventController
for more information.
Fields
(no public fields)
Example
scroll_controller = ScrollEventController()
connect_signal_scroll!(scroll_controller) do self::ScrollEventController, delta_x::AbstractFloat, delta_y::AbstractFloat
println("current scroll offset: ($delta_x, $delta_y)")
end
add_controller!(window, scroll_controller)
Functions that operate on this type:
connect_signal_kinetic_scroll_decelerate!
disconnect_signal_kinetic_scroll_decelerate!
emit_signal_kinetic_scroll_decelerate
get_signal_kinetic_scroll_decelerate_blocked
set_signal_kinetic_scroll_decelerate_blocked!
connect_signal_scroll!
connect_signal_scroll_begin!
connect_signal_scroll_end!
disconnect_signal_scroll!
disconnect_signal_scroll_begin!
disconnect_signal_scroll_end!
emit_signal_scroll
emit_signal_scroll_begin
emit_signal_scroll_end
get_signal_scroll_begin_blocked
get_signal_scroll_blocked
get_signal_scroll_end_blocked
set_signal_scroll_begin_blocked!
set_signal_scroll_blocked!
set_signal_scroll_end_blocked!
Scrollbar
Mousetrap.Scrollbar
— TypeScrollbar <: Widget
GUI element typically used to scroll another widget. Connect to the signals of the underlying adjustment to react to the user scrolling.
Constructors
Scrollbar(::Orientation, ::Adjustment)
Signals
(no unique signals)
Fields
(no public fields)
Example
```julia scrollbar = Scrollbar(ORIENTATIONHORIZONTAL, Adjustment(0, 0, 1, 0.01)) connectsignalvaluechanged!(getadjustment(scrollbar)) do self::Adjustment println("value is now $(Expr(:incomplete, "incomplete: premature end of input"))value(self))") end
Functions that operate on this type:
connect_signal_destroy!
disconnect_signal_destroy!
emit_signal_destroy
get_signal_destroy_blocked
set_signal_destroy_blocked!
connect_signal_hide!
disconnect_signal_hide!
emit_signal_hide
get_signal_hide_blocked
set_signal_hide_blocked!
connect_signal_map!
disconnect_signal_map!
emit_signal_map
get_signal_map_blocked
set_signal_map_blocked!
connect_signal_realize!
disconnect_signal_realize!
emit_signal_realize
get_signal_realize_blocked
set_signal_realize_blocked!
connect_signal_show!
disconnect_signal_show!
emit_signal_show
get_signal_show_blocked
set_signal_show_blocked!
connect_signal_unmap!
disconnect_signal_unmap!
emit_signal_unmap
get_signal_unmap_blocked
set_signal_unmap_blocked!
connect_signal_unrealize!
disconnect_signal_unrealize!
emit_signal_unrealize
get_signal_unrealize_blocked
set_signal_unrealize_blocked!
SelectionModel
Mousetrap.SelectionModel
— TypeSelectionModel <: SignalEmitter
Model that governs the current selection of a selectable widget, such as GridView
, ListView
, or Stack
.
Only if the selection mode is set to anything other than SELECTION_MODE_NONE
will the selection model emit its signals.
Use get_selection_model
to retrieve the model from a selectable widget.
Constructors
(no public constructors)
Signals
selection_changed
(::SelectionModel, position::Integer, n_items::Integer, [::Data_t]) -> Nothing
The number or position of one or more selected items has changed, where
position
is the item index that was modified,n_items
is the number of items currently selected.
Fields
(no public fields)
Example
grid_view = GridView(SELECTION_MODE_SINGLE)
for i in 1:4
push_back!(grid_view, Label("0$i"))
end
selection_model = get_selection_model(grid_view)
connect_signal_selection_changed!(selection_model) do x::SelectionModel, position::Integer, n_items::Integer
println("selected item is now: $position")
end
set_child!(window, grid_view)
Functions that operate on this type:
connect_signal_selection_changed!
disconnect_signal_selection_changed!
emit_signal_selection_changed
get_signal_selection_changed_blocked
set_signal_selection_changed_blocked!
Separator
Mousetrap.Separator
— TypeSeparator <: Widget
Simple spacer, fills its allocated area with a solid color.
Constructors
Separator([::Orientation, opacity::AbstractFloat = 1.0])
Signals
(no unique signals)
Fields
(no public fields)
Functions that operate on this type:
connect_signal_destroy!
disconnect_signal_destroy!
emit_signal_destroy
get_signal_destroy_blocked
set_signal_destroy_blocked!
connect_signal_hide!
disconnect_signal_hide!
emit_signal_hide
get_signal_hide_blocked
set_signal_hide_blocked!
connect_signal_map!
disconnect_signal_map!
emit_signal_map
get_signal_map_blocked
set_signal_map_blocked!
connect_signal_realize!
disconnect_signal_realize!
emit_signal_realize
get_signal_realize_blocked
set_signal_realize_blocked!
connect_signal_show!
disconnect_signal_show!
emit_signal_show
get_signal_show_blocked
set_signal_show_blocked!
connect_signal_unmap!
disconnect_signal_unmap!
emit_signal_unmap
get_signal_unmap_blocked
set_signal_unmap_blocked!
connect_signal_unrealize!
disconnect_signal_unrealize!
emit_signal_unrealize
get_signal_unrealize_blocked
set_signal_unrealize_blocked!
Shader
Mousetrap.Shader
— TypeShader <: SignalEmitter
OpenGL shader program, contains a fragment and vertex shader.
See the manual chapter on native rendering for more information.
Constructors
Shader()
Signals
(no unique signals)
Fields
(no public fields)
Functions that operate on this type:
create_from_file!
create_from_string!
get_fragment_shader_id
get_program_id
get_uniform_location
get_vertex_shader_id
render
set_uniform_float!
set_uniform_int!
set_uniform_transform!
set_uniform_uint!
set_uniform_vec2!
set_uniform_vec3!
set_uniform_vec4!
Shape
Mousetrap.Shape
— TypeShape <: SignalEmitter
OpenGL vertex buffer, pre-initialized as one of various shape types.
See the manual chapter on native rendering for more information.
Constructors
Shape()
Point(::Vector2f)
Points(::Vector{Vector2f})
Triangle(::Vector2f, ::Vector2f, ::Vector2f)
Rectangle(top_left::Vecto2f, size::Vector2f)
Circle(center::Vector2f, radius::AbstractFloat, n_outer_vertices::Integer)
Ellipse(center::Vector2f, x_radius::AbstractFloat, y_radius::AbstractFloat, n_outer_vertices)
Line(::Vector2f, ::Vector2f)
Lines(::Vector{Pair{Vector2f, Vector2f}})
LineStrip(::Vector2{Vector2f})
Polygon(::Vector{Vector2f})
RectangularFrame(top_left::Vector2f, outer_size::Vector2f, x_width::AbstractFloat, y_width::AbstractFloat)
CircularRing(center::Vector2f, outer_radius::AbstractFloat, thickness::AbstractFloat, n_outer_vertices::Integer)
EllipticalRing(center::Vector2f, outer_x_radius::AbstractFloat, outer_y_radius::AbstractFloat, x_thickness::AbstractFloat, y_thickness::AbstractFloat, n_outer_vertices::Unsigned)
Wireframe(::Vector{Vector2f})
Outline(other_shape::Shape)
Signals
(no unique signals)
Fields
(no public fields)
Functions that operate on this type:
Outline
as_circle!
as_circular_ring!
as_ellipse!
as_elliptical_ring!
as_line!
as_line_strip!
as_lines!
as_outline!
as_point!
as_points!
as_polygon!
as_rectangle!
as_rectangular_frame!
as_triangle!
as_wireframe!
get_bounding_box
get_centroid
get_is_visible
get_n_vertices
get_native_handle
get_size
get_top_left
get_vertex_color
get_vertex_position
get_vertex_texture_coordinate
remove_texture!
render
rotate!
set_centroid!
set_color!
set_is_visible!
set_texture!
set_top_left!
set_vertex_color!
set_vertex_position!
set_vertex_texture_coordinate!
ShortcutEventController
Mousetrap.ShortcutEventController
— TypeShortcutEventController <: EventController
Triggers actions if their associate shortcuts are recognized. Call add_action!
to specify which actions the controller should manage.
Constructors
ShortcutEventController()
Signals
(no unique signals)
Fields
(no public fields)
Example
action = Action("example.action", app)
set_function!(action) do x::Action
println("example.action activated")
end
add_shortcut!(action, "<Control>space")
# activate action when the user presses Control + Space
shortcut_controller = ShortcutEventController()
add_action!(shortcut_controller, action)
add_controller!(window, shortcut_controller)
Functions that operate on this type:
ShortcutTrigger
Mousetrap.ShortcutTrigger
— TypeShortcutTrigger
String expressing a combination of zero or more modifier keys, enclosed in <>
, followed by exactly one non-modifier key.
See the section on ShortctuEventController
in the manual chapter on event handling for more information.
Constructors
ShortcutTrigger(::String)
Fields
(no public fields)
Functions that operate on this type:
SignalEmitter
Mousetrap.SignalEmitter
— TypeSignalEmitter <: Any
Object that can emit signals.
Any signal emitter is memory-managed independently of Julia, once its internal reference counter reaches zero, it is safely deallocated. Julia users do not have to worry about keeping any signal emitters in scope, it is kept alive automatically.
Supertype
Any
Subtypes
Action
ActionBar
Adjustment
AlertDialog
Animation
Application
AspectFrame
Box
Button
CenterBox
CheckButton
ClampFrame
ClickEventController
Clipboard
Clock
ColorChooser
ColumnView
ColumnViewColumn
DragEventController
DropDown
Entry
Expander
FileChooser
FileDescriptor
FileFilter
FileMonitor
Fixed
FlowBox
FocusEventController
Frame
FrameClock
GLArea
GLTransform
Grid
GridView
HeaderBar
ImageDisplay
KeyEventController
KeyFile
Label
LevelBar
ListView
LongPressEventController
MenuBar
MenuModel
MotionEventController
Notebook
Overlay
PanEventController
Paned
PinchZoomEventController
Popover
PopoverButton
PopoverMenu
PopupMessage
PopupMessageOverlay
ProgressBar
RenderArea
RenderTask
RenderTexture
Revealer
RotateEventController
Scale
ScrollEventController
Scrollbar
SelectionModel
Separator
Shader
Shape
ShortcutEventController
SpinButton
Spinner
Stack
StackSidebar
StackSwitcher
StylusEventController
SwipeEventController
Switch
TextView
Texture
ToggleButton
TransformBin
Viewport
Window
SingleClickGesture
Mousetrap.SingleClickGesture
— TypeSingleClickGesture <: EventController
Specialized type of EventController
that provides the following functions:
Supertype
Any
Subtypes
Functions that operate on this type:
get_current_button
get_only_listens_to_button
get_touch_only
set_only_listens_to_button!
set_touch_only!
SpinButton
Mousetrap.SpinButton
— TypeSpinButton <: Widget
Widget with a value-entry and two buttons.
Constructors
SpinButton(lower::Number, upper::Number, step_increment::Number, [orientation::Orientation])
Signals
value_changed
(::SpinButton, [::Data_t]) -> Nothing
Emitted when the
value
property of theAdjustment
changes.
Fields
(no public fields)
Functions that operate on this type:
get_acceleration_rate
get_adjustment
get_allow_only_numeric
get_lower
get_n_digits
get_orientation
get_should_snap_to_ticks
get_should_wrap
get_step_increment
get_upper
get_value
reset_text_to_value_function!
reset_value_to_text_function!
set_acceleration_rate!
set_allow_only_numeric!
set_lower!
set_n_digits!
set_orientation!
set_should_snap_to_ticks!
set_should_wrap!
set_step_increment!
set_text_to_value_function!
set_upper!
set_value!
set_value_to_text_function!
connect_signal_destroy!
disconnect_signal_destroy!
emit_signal_destroy
get_signal_destroy_blocked
set_signal_destroy_blocked!
connect_signal_hide!
disconnect_signal_hide!
emit_signal_hide
get_signal_hide_blocked
set_signal_hide_blocked!
connect_signal_map!
disconnect_signal_map!
emit_signal_map
get_signal_map_blocked
set_signal_map_blocked!
connect_signal_realize!
disconnect_signal_realize!
emit_signal_realize
get_signal_realize_blocked
set_signal_realize_blocked!
connect_signal_show!
disconnect_signal_show!
emit_signal_show
get_signal_show_blocked
set_signal_show_blocked!
connect_signal_unmap!
disconnect_signal_unmap!
emit_signal_unmap
get_signal_unmap_blocked
set_signal_unmap_blocked!
connect_signal_unrealize!
disconnect_signal_unrealize!
emit_signal_unrealize
get_signal_unrealize_blocked
set_signal_unrealize_blocked!
connect_signal_value_changed!
disconnect_signal_value_changed!
emit_signal_value_changed
get_signal_value_changed_blocked
set_signal_value_changed_blocked!
connect_signal_wrapped!
disconnect_signal_wrapped!
emit_signal_wrapped
get_signal_wrapped_blocked
set_signal_wrapped_blocked!
Spinner
Mousetrap.Spinner
— TypeSpinner <: Widget
Graphical widget that signifies that a process is busy. Set set_is_spinning!
to true
to start the spinning animation.
Constructors
Spinner()
Signals
(no unique signals)
Fields
(no public fields)
Functions that operate on this type:
Stack
Mousetrap.Stack
— TypeStack <: Widget
Selectable widget that always shows exactly one of its children. Use StackSwitcher
or StackSidebar
to provide a way for users to choose the page of the stack.
Connect to the signals of the SelectionModel
provided by get_selection_model
to track which stack page is currently selected.
Constructors
Stack()
Signals
(no unique signals)
Fields
(no public fields)
Example
stack = Stack()
add_child!(stack, Label("Page 01"), "Page 01")
add_child!(stack, Label("Page 02"), "Page 02")
add_child!(stack, Label("Page 03"), "Page 03")
stack_switcher = StackSwitcher(stack)
box = Box(ORIENTATION_VERTICAL)
push_back!(box, stack)
push_back!(box, stack_switcher)
set_child!(window, box)
Functions that operate on this type:
add_child!
get_child_at
get_is_horizontally_homogeneous
get_is_vertically_homogeneous
get_selection_model
get_should_interpolate_size
get_transition_duration
get_transition_type
get_visible_child
remove_child!
set_is_horizontally_homogeneous!
set_is_vertically_homogeneous!
set_should_interpolate_size!
set_transition_duration!
set_transition_type!
set_visible_child!
connect_signal_destroy!
disconnect_signal_destroy!
emit_signal_destroy
get_signal_destroy_blocked
set_signal_destroy_blocked!
connect_signal_hide!
disconnect_signal_hide!
emit_signal_hide
get_signal_hide_blocked
set_signal_hide_blocked!
connect_signal_map!
disconnect_signal_map!
emit_signal_map
get_signal_map_blocked
set_signal_map_blocked!
connect_signal_realize!
disconnect_signal_realize!
emit_signal_realize
get_signal_realize_blocked
set_signal_realize_blocked!
connect_signal_show!
disconnect_signal_show!
emit_signal_show
get_signal_show_blocked
set_signal_show_blocked!
connect_signal_unmap!
disconnect_signal_unmap!
emit_signal_unmap
get_signal_unmap_blocked
set_signal_unmap_blocked!
connect_signal_unrealize!
disconnect_signal_unrealize!
emit_signal_unrealize
get_signal_unrealize_blocked
set_signal_unrealize_blocked!
StackID
Mousetrap.StackID
— TypeStackID
ID that uniquely identifies a page of a Stack
. Will be used as the page title for StackSwitcher
and StackSidebar
.
Constructors
(no public constructors)
Fields
(no public fields)
Functions that operate on this type:
StackSidebar
Mousetrap.StackSidebar
— TypeStackSidebar <: Widget
Widget that allows users to select a page of a Stack
.
Constructors
StackSidebar(::Stack)
Signals
(no unique signals)
Fields
(no public fields)
Functions that operate on this type:
connect_signal_destroy!
disconnect_signal_destroy!
emit_signal_destroy
get_signal_destroy_blocked
set_signal_destroy_blocked!
connect_signal_hide!
disconnect_signal_hide!
emit_signal_hide
get_signal_hide_blocked
set_signal_hide_blocked!
connect_signal_map!
disconnect_signal_map!
emit_signal_map
get_signal_map_blocked
set_signal_map_blocked!
connect_signal_realize!
disconnect_signal_realize!
emit_signal_realize
get_signal_realize_blocked
set_signal_realize_blocked!
connect_signal_show!
disconnect_signal_show!
emit_signal_show
get_signal_show_blocked
set_signal_show_blocked!
connect_signal_unmap!
disconnect_signal_unmap!
emit_signal_unmap
get_signal_unmap_blocked
set_signal_unmap_blocked!
connect_signal_unrealize!
disconnect_signal_unrealize!
emit_signal_unrealize
get_signal_unrealize_blocked
set_signal_unrealize_blocked!
StackSwitcher
Mousetrap.StackSwitcher
— TypeStackSwitcher <: Widget
Widget that allows users to select a page of a Stack
.
Constructors
StackSwitcher(::Stack)
Signals
(no unique signals)
Fields
(no public fields)
Functions that operate on this type:
connect_signal_destroy!
disconnect_signal_destroy!
emit_signal_destroy
get_signal_destroy_blocked
set_signal_destroy_blocked!
connect_signal_hide!
disconnect_signal_hide!
emit_signal_hide
get_signal_hide_blocked
set_signal_hide_blocked!
connect_signal_map!
disconnect_signal_map!
emit_signal_map
get_signal_map_blocked
set_signal_map_blocked!
connect_signal_realize!
disconnect_signal_realize!
emit_signal_realize
get_signal_realize_blocked
set_signal_realize_blocked!
connect_signal_show!
disconnect_signal_show!
emit_signal_show
get_signal_show_blocked
set_signal_show_blocked!
connect_signal_unmap!
disconnect_signal_unmap!
emit_signal_unmap
get_signal_unmap_blocked
set_signal_unmap_blocked!
connect_signal_unrealize!
disconnect_signal_unrealize!
emit_signal_unrealize
get_signal_unrealize_blocked
set_signal_unrealize_blocked!
StylusEventController
Mousetrap.StylusEventController
— TypeStylusEventController <: SingleClickGesture <: EventController
Controller handling events from a stylus devices, such as drawing tablets.
Has access to many manufacturer specific sensors, see the section on StylusEventController
in the manual chapter on event handling for more information.
Constructors
StylusEventController()
Signals
stylus_up
(::StylusEventController, x::AbstractFloat, y::AbstractFloat, [::Data_t]) -> Nothing
Emitted once when the stylus seizes to make contact with the touchpad, where
x
andy
is the cursor position, in pixels.
stylus_down
(::StylusEventController, x::AbstractFloat, y::AbstractFloat, [::Data_t]) -> Nothing
Emitted once when the stylus makes contact with the touchpad, where
x
andy
are the cursor position, in pixels.
proximity
(::StylusEventController, x::AbstractFloat, y::AbstractFloat, [::Data_t]) -> Nothing
Emitted when the stylus enters or exits the proximity distance recognized by the touchpad. This will usually precede a
stylus_down
orstylus_up
signal.
motion
(::StylusEventController, x::AbstractFloat, y::AbstractFloat, [::Data_t]) -> Nothing
Emitted once per frame, while the cursor is inside the allocated area of the widget, where
x
andy
are the current cursor position, in pixels.
Fields
(no public fields)
Example
stylus_controller = StylusEventController()
connect_signal_motion!(stylus_controller) do self::StylusEventController, x::AbstractFloat, y::AbstractFloat
println("stylus position detected at ($x, $y)")
end
add_controller!(window, stylus_controller)
Functions that operate on this type:
connect_signal_motion!
disconnect_signal_motion!
emit_signal_motion
get_signal_motion_blocked
set_signal_motion_blocked!
connect_signal_proximity!
disconnect_signal_proximity!
emit_signal_proximity
get_signal_proximity_blocked
set_signal_proximity_blocked!
connect_signal_stylus_down!
connect_signal_stylus_up!
disconnect_signal_stylus_down!
disconnect_signal_stylus_up!
emit_signal_stylus_down
emit_signal_stylus_up
get_signal_stylus_down_blocked
get_signal_stylus_up_blocked
set_signal_stylus_down_blocked!
set_signal_stylus_up_blocked!
SwipeEventController
Mousetrap.SwipeEventController
— TypeSwipeEventController <: SingleClickGesture <: EventController
Recognizes swipe gestures (touch-only).
Constructors
SwipeEventController()
)
Signals
swipe
(::SwipeEventController, x_velocity::AbstractFloat, y_velocity::AbstractFloat, [::Data_t]) -> Nothing
Emitted once per frame while a swipe gesture is active, where
x_velocity
andy_velocity
are the current velocity of the swipe, in pixels.
Fields
(no public fields)
Example
swipe_controller = SwipeEventController()
connect_signal_swipe!(swipe_controller) do self::SwipeEventController, x_velocity::AbstractFloat, y_velocity::AbstractFloat
print("swiping ")
if (y_velocity < 0)
print("up ")
elseif (y_velocity > 0)
print("down ")
end
if (x_velocity < 0)
println("left")
elseif (x_velocity > 0)
println("right")
end
end
add_controller!(window, swipe_controller)
Functions that operate on this type:
connect_signal_swipe!
disconnect_signal_swipe!
emit_signal_swipe
get_signal_swipe_blocked
set_signal_swipe_blocked!
Switch
Mousetrap.Switch
— TypeSwitch <: Widget
Widget with a binary state, emits signal switched
when triggered.
Constructors
Switch()
Signals
switched
(::Switch, [::Data_t]) -> Nothing
Emitted whenever the internal state of a
Switch
changes, for example byset_is_active!
, or by the user operating theSwitch
.
Fields
(no public fields)
Functions that operate on this type:
connect_signal_destroy!
disconnect_signal_destroy!
emit_signal_destroy
get_signal_destroy_blocked
set_signal_destroy_blocked!
connect_signal_hide!
disconnect_signal_hide!
emit_signal_hide
get_signal_hide_blocked
set_signal_hide_blocked!
connect_signal_map!
disconnect_signal_map!
emit_signal_map
get_signal_map_blocked
set_signal_map_blocked!
connect_signal_realize!
disconnect_signal_realize!
emit_signal_realize
get_signal_realize_blocked
set_signal_realize_blocked!
connect_signal_show!
disconnect_signal_show!
emit_signal_show
get_signal_show_blocked
set_signal_show_blocked!
connect_signal_switched!
disconnect_signal_switched!
emit_signal_switched
get_signal_switched_blocked
set_signal_switched_blocked!
connect_signal_unmap!
disconnect_signal_unmap!
emit_signal_unmap
get_signal_unmap_blocked
set_signal_unmap_blocked!
connect_signal_unrealize!
disconnect_signal_unrealize!
emit_signal_unrealize
get_signal_unrealize_blocked
set_signal_unrealize_blocked!
TextView
Mousetrap.TextView
— TypeTextView <: Widget
Multi-line text entry.
Constructors
TextVew()
Signals
text_changed
(::TextView, [::Data_t]) -> Nothing
Emitted when underlying text buffer is modified in any way.
Fields
(no public fields)
Example
text_view = TextView()
set_text!(text_view, "Write here")
connect_signal_text_changed!(text_view) do self::TextView
println("text is now: $(get_text(self))")
end
Functions that operate on this type:
get_bottom_margin
get_cursor_visible
get_editable
get_justify_mode
get_left_margin
get_right_margin
get_text
get_top_margin
get_was_modified
redo!
set_bottom_margin!
set_cursor_visible!
set_editable!
set_justify_mode!
set_left_margin!
set_right_margin!
set_text!
set_top_margin!
set_was_modified!
undo!
connect_signal_destroy!
disconnect_signal_destroy!
emit_signal_destroy
get_signal_destroy_blocked
set_signal_destroy_blocked!
connect_signal_hide!
disconnect_signal_hide!
emit_signal_hide
get_signal_hide_blocked
set_signal_hide_blocked!
connect_signal_map!
disconnect_signal_map!
emit_signal_map
get_signal_map_blocked
set_signal_map_blocked!
connect_signal_realize!
disconnect_signal_realize!
emit_signal_realize
get_signal_realize_blocked
set_signal_realize_blocked!
connect_signal_show!
disconnect_signal_show!
emit_signal_show
get_signal_show_blocked
set_signal_show_blocked!
connect_signal_text_changed!
disconnect_signal_text_changed!
emit_signal_text_changed
get_signal_text_changed_blocked
set_signal_text_changed_blocked!
connect_signal_unmap!
disconnect_signal_unmap!
emit_signal_unmap
get_signal_unmap_blocked
set_signal_unmap_blocked!
connect_signal_unrealize!
disconnect_signal_unrealize!
emit_signal_unrealize
get_signal_unrealize_blocked
set_signal_unrealize_blocked!
Texture
Mousetrap.Texture
— TypeTexture <: TextureObject <: SignalEmitter
OpenGL Texture.
See the manual chapter on native rendering for more information.
Constructors
Texture()
Signals
(no unique signals)
Fields
(no public fields)
TextureObject
Mousetrap.TextureObject
— TypeTextureObject
Object that can be bound as a texture. Use set_texture!
to associate it with a Shape
.
See the manual chapter on native rendering for more information.
Functions that operate on this type:
Mousetrap.bind
create!
create_from_image!
Mousetrap.download
get_native_handle
get_scale_mode
get_size
get_wrap_mode
set_scale_mode!
set_texture!
set_wrap_mode!
unbind
Time
Mousetrap.Time
— TypeTime
Object representing a duration of time, nanoseconds precision, may be negative.
Constructors
nanoseconds(::Int64)
microseconds(::Number)
milliseconds(::Number)
seconds(::Number)
minutes(::Number)
Fields
(no public fields)
Example
# convert seconds to microseconds
println(as_microseconds(seconds(3.14159)))
Functions that operate on this type:
as_microseconds
as_milliseconds
as_minutes
as_nanoseconds
as_seconds
set_duration!
set_timeout!
set_transition_duration!
ToggleButton
Mousetrap.ToggleButton
— TypeToggleButton <: Widget
Button with a boolean state. Emits signal toggled
when its state changes.
Constructors
ToggleButton()
ToggleButton(label::Widget)
ToggleButton(::Icon)
Signals
toggled
(::ToggleButton, [::Data_t]) -> Nothing
Emitted when the widgets internal state changes from active to inactive, or inactive to active.
clicked
(::ToggleButton, [::Data_t]) -> Nothing
Emitted when the user clicks the widget using a mouse or touchscreen.
Fields
(no public fields)
Example
toggle_button = ToggleButton()
connect_signal_toggled!(toggle_button) do self::ToggleButton
println("state is now: " get_is_active(self))
end
set_child!(window, toggle_button)
Functions that operate on this type:
connect_signal_clicked!
disconnect_signal_clicked!
emit_signal_clicked
get_signal_clicked_blocked
set_signal_clicked_blocked!
connect_signal_destroy!
disconnect_signal_destroy!
emit_signal_destroy
get_signal_destroy_blocked
set_signal_destroy_blocked!
connect_signal_hide!
disconnect_signal_hide!
emit_signal_hide
get_signal_hide_blocked
set_signal_hide_blocked!
connect_signal_map!
disconnect_signal_map!
emit_signal_map
get_signal_map_blocked
set_signal_map_blocked!
connect_signal_realize!
disconnect_signal_realize!
emit_signal_realize
get_signal_realize_blocked
set_signal_realize_blocked!
connect_signal_show!
disconnect_signal_show!
emit_signal_show
get_signal_show_blocked
set_signal_show_blocked!
connect_signal_toggled!
disconnect_signal_toggled!
emit_signal_toggled
get_signal_toggled_blocked
set_signal_toggled_blocked!
connect_signal_unmap!
disconnect_signal_unmap!
emit_signal_unmap
get_signal_unmap_blocked
set_signal_unmap_blocked!
connect_signal_unrealize!
disconnect_signal_unrealize!
emit_signal_unrealize
get_signal_unrealize_blocked
set_signal_unrealize_blocked!
TransformBin
Mousetrap.TransformBin
— TypeTransformBin <: Widget
Container with a singular child, allows applying spatial transform operations to its child widget.
Constructors
TransformBin()
TransformBin(child::Widget)
Signals
(no unique signals)
Fields
(no public fields)
Example
# continuously rotate a widget
widget = Button()
bin = TransformBin()
set_child!(widget)
animation = Animation(bin, seconds(1))
set_repeat_count!(animation, 0) # infinite repeats
on_tick!(animation, bin) do self::Animation, bin::TransformBin
rotate!(bin, degrees(1))
end
play!(animation)
set_child!(window, button)
Functions that operate on this type:
connect_signal_destroy!
disconnect_signal_destroy!
emit_signal_destroy
get_signal_destroy_blocked
set_signal_destroy_blocked!
connect_signal_hide!
disconnect_signal_hide!
emit_signal_hide
get_signal_hide_blocked
set_signal_hide_blocked!
connect_signal_map!
disconnect_signal_map!
emit_signal_map
get_signal_map_blocked
set_signal_map_blocked!
connect_signal_realize!
disconnect_signal_realize!
emit_signal_realize
get_signal_realize_blocked
set_signal_realize_blocked!
connect_signal_show!
disconnect_signal_show!
emit_signal_show
get_signal_show_blocked
set_signal_show_blocked!
connect_signal_unmap!
disconnect_signal_unmap!
emit_signal_unmap
get_signal_unmap_blocked
set_signal_unmap_blocked!
connect_signal_unrealize!
disconnect_signal_unrealize!
emit_signal_unrealize
get_signal_unrealize_blocked
set_signal_unrealize_blocked!
TypedFunction
Mousetrap.TypedFunction
— TypeTypedFunction
Object used to invoke an arbitrary function using the given signature. This wrapper will automatically convert any arguments and return values to the types specified as the signature, unless impossible, at which point an assertion error will be thrown on instantiation.
In this way, it can be used to assert a functions signature at compile time.
Constructors
(no public constructors)
Fields
(no public fields)
Example
as_typed = TypedFunction(Int64, (Integer,)) do(x::Integer)
return string(x)
end
as_typed(12) # returns 12, because "12" will be converted to given return type, Int64
Vector2
Mousetrap.Vector2
— TypeVector2{T}
Vector with two components, all operations are component-wise, just like in GLSL.
Constructors
Vector2{T}(::T, ::T)
Vector2{T}(both::T)
Fields
x::T
y::T
Vector3
Mousetrap.Vector3
— TypeVector3{T}
Vector with 4 components, all operations are component-wise, just like in GLSL.
Constructors
Vector3{T}(::T, ::T, ::T)
Vector3{T}(all::T)
Fields
x::T
y::T
z::T
Vector4
Mousetrap.Vector4
— TypeVector4{T}
Vector with 4 components, all operations are component-wise, just like in GLSL.
Constructors
Vector4{T}(::T, ::T, ::T, ::T)
Vector4{T}(all::T)
Fields
x::T
y::T
z::T
w::T
Viewport
Mousetrap.Viewport
— TypeViewport <: Widget
Container that displays part of its singular child. The allocated size of the Viewport
is independent of that of its child.
The user can control which part is shown by operating two scrollbars. These will automatically hide or show themself when the user's cursor enters the viewport. This behavior can be influenced by setting the ScrollbarVisibilityPolicy
for one or both of the scrollbars.
Viewport
can be forced to obey the width and/or height of its child by setting set_propagate_natural_width!
or set_propagate_natural_height!
to true
.
The placement of both scrollbars at the same time can be set with set_scrollbar_placement!
.
Connect to the value_changed
signal of each of the scrollbars Adjustment
in order to react to the user scrolling the Viewport
.
Constructors
Viewport()
Signals
scroll_child
(::Viewport, scroll_type::ScrollType, is_horizontal::Bool, [::Data_t]) -> Nothing
Emitted any time a user triggers a scroll action that moves one or both of the
Viewport
s scroll bars, wherescroll_type
identifies the type of action that triggered the scrolling, whileis_horizontal
determines along which axis the scrolling took place.
Fields
(no public fields)
Functions that operate on this type:
get_has_frame
get_horizontal_adjustment
get_horizontal_scrollbar_policy
get_kinetic_scrolling_enabled
get_propagate_natural_height
get_propagate_natural_width
get_scrollbar_placement
get_vertical_adjustment
get_vertical_scrollbar_policy
remove_child!
set_child!
set_has_frame!
set_horizontal_scrollbar_policy!
set_kinetic_scrolling_enabled!
set_propagate_natural_height!
set_propagate_natural_width!
set_scrollbar_placement!
set_vertical_scrollbar_policy!
connect_signal_destroy!
disconnect_signal_destroy!
emit_signal_destroy
get_signal_destroy_blocked
set_signal_destroy_blocked!
connect_signal_hide!
disconnect_signal_hide!
emit_signal_hide
get_signal_hide_blocked
set_signal_hide_blocked!
connect_signal_map!
disconnect_signal_map!
emit_signal_map
get_signal_map_blocked
set_signal_map_blocked!
connect_signal_realize!
disconnect_signal_realize!
emit_signal_realize
get_signal_realize_blocked
set_signal_realize_blocked!
connect_signal_scroll_child!
disconnect_signal_scroll_child!
emit_signal_scroll_child
get_signal_scroll_child_blocked
set_signal_scroll_child_blocked!
connect_signal_show!
disconnect_signal_show!
emit_signal_show
get_signal_show_blocked
set_signal_show_blocked!
connect_signal_unmap!
disconnect_signal_unmap!
emit_signal_unmap
get_signal_unmap_blocked
set_signal_unmap_blocked!
connect_signal_unrealize!
disconnect_signal_unrealize!
emit_signal_unrealize
get_signal_unrealize_blocked
set_signal_unrealize_blocked!
Widget
Mousetrap.Widget
— TypeWidget <: SignalEmitter
Superclass of all renderable entities in Mousetrap. Like all SignalEmitter
s, a widgets lifetime is managed automatically.
Widgets have a large number of properties that influence their size and position on screen. See the manual chapter on widgets for more information.
In order for an object to be treated as a widget, it needs to subtype this abstract type and define Mousetrap.get_top_level_widget
. See the manual section on compound widgets in the chapter on widgets.
All widgets share the following signals, where T
is the subclass of Widget
. For example, signal realize
of class Label
has the signature (::Label, [::Data_t]) -> Nothing
:
Signals
realize
(::T, [::Data_t]) -> Nothing
Emitted when the widget is shown for the first time after being initialized.
unrealize
(::T, [::Data_t]) -> Nothing
Emitted when the widget was hidden and no longer has an allocated area on screen.
destroy
(::T, [::Data_t]) -> Nothing
Emitted when the widgets reference count reaches 0, it will be finalized and deleted permanently.
hide
(::T, [::Data_t]) -> Nothing
Emitted when the widget is hidden, for example by calling
hide!
, being removed from its parent, or its parent being hidden.
show
(::T, [::Data_t]) -> Nothing
Emitted when the widget is shown, for example by calling
show!
or its parent being shown.
map
(::T, [::Data_t]) -> Nothing
Emitted when the widget has chosen its final size allocation and is assuming its size and position on screen.
unmap
(::T, [::Data_t]) -> Nothing
Emitted when the widget looses its current size allocation, usually in the process of being hidden or destroyed.
Fields
(no public fields)
Supertype
Any
Subtypes
ActionBar
AspectFrame
Box
Button
CenterBox
CheckButton
ClampFrame
ColumnView
DropDown
Entry
Expander
Fixed
FlowBox
Frame
GLArea
Grid
GridView
HeaderBar
ImageDisplay
Label
LevelBar
ListView
MenuBar
Notebook
Overlay
Paned
Popover
PopoverButton
PopoverMenu
PopupMessageOverlay
ProgressBar
RenderArea
Revealer
Scale
Scrollbar
Separator
SpinButton
Spinner
Stack
StackSidebar
StackSwitcher
Switch
TextView
ToggleButton
TransformBin
Viewport
Window
Functions that operate on this type:
activate!
add_child!
add_controller!
add_css_class!
add_overlay!
add_widget!
calculate_monitor_dpi
find
get_allocated_size
get_can_respond_to_input
get_clipboard
get_css_classes
get_expand_horizontally
get_expand_vertically
get_focus_on_click
get_has_focus
get_hide_on_overflow
get_horizontal_alignment
get_is_focusable
get_is_realized
get_is_visible
get_margin_bottom
get_margin_end
get_margin_start
get_margin_top
get_minimum_size
get_natural_size
get_opacity
get_position
get_scale_factor
get_size
get_size_request
get_vertical_alignment
grab_focus!
hide!
insert_after!
insert_at!
insert_next_to!
push_back!
push_front!
remove!
remove_child!
remove_controller!
remove_css_class!
remove_overlay!
remove_tick_callback!
remove_tooltip_widget!
set_alignment!
set_can_respond_to_input!
set_center_child!
set_child!
set_child_position!
set_cursor!
set_cursor_from_image!
set_default_widget!
set_end_child!
set_expand!
set_expand_horizontally!
set_expand_vertically!
set_extra_widget!
set_focus_on_click!
set_hide_on_overflow!
set_horizontal_alignment!
set_is_focusable!
set_is_visible!
set_label_widget!
set_listens_for_shortcut_action!
set_margin!
set_margin_bottom!
set_margin_end!
set_margin_horizontal!
set_margin_start!
set_margin_top!
set_margin_vertical!
set_opacity!
set_size_request!
set_start_child!
set_tick_callback!
set_title_widget!
set_tooltip_text!
set_tooltip_widget!
set_vertical_alignment!
show!
unparent!
connect_signal_activate!
connect_signal_activate_default_widget!
connect_signal_activate_focused_widget!
connect_signal_activate_item!
connect_signal_activated!
disconnect_signal_activate!
disconnect_signal_activate_default_widget!
disconnect_signal_activate_focused_widget!
disconnect_signal_activate_item!
disconnect_signal_activated!
emit_signal_activate
emit_signal_activate_default_widget
emit_signal_activate_focused_widget
emit_signal_activate_item
emit_signal_activated
get_signal_activate_blocked
get_signal_activate_default_widget_blocked
get_signal_activate_focused_widget_blocked
get_signal_activate_item_blocked
get_signal_activated_blocked
set_signal_activate_blocked!
set_signal_activate_default_widget_blocked!
set_signal_activate_focused_widget_blocked!
set_signal_activate_item_blocked!
set_signal_activated_blocked!
connect_signal_button_clicked!
disconnect_signal_button_clicked!
emit_signal_button_clicked
get_signal_button_clicked_blocked
set_signal_button_clicked_blocked!
connect_signal_click_pressed!
connect_signal_click_released!
connect_signal_click_stopped!
connect_signal_clicked!
disconnect_signal_click_pressed!
disconnect_signal_click_released!
disconnect_signal_click_stopped!
disconnect_signal_clicked!
emit_signal_click_pressed
emit_signal_click_released
emit_signal_click_stopped
emit_signal_clicked
get_signal_click_pressed_blocked
get_signal_click_released_blocked
get_signal_click_stopped_blocked
get_signal_clicked_blocked
set_signal_click_pressed_blocked!
set_signal_click_released_blocked!
set_signal_click_stopped_blocked!
set_signal_clicked_blocked!
connect_signal_close_request!
connect_signal_closed!
disconnect_signal_close_request!
disconnect_signal_closed!
emit_signal_close_request
emit_signal_closed
get_signal_close_request_blocked
get_signal_closed_blocked
set_signal_close_request_blocked!
set_signal_closed_blocked!
connect_signal_destroy!
disconnect_signal_destroy!
emit_signal_destroy
get_signal_destroy_blocked
set_signal_destroy_blocked!
connect_signal_dismissed!
disconnect_signal_dismissed!
emit_signal_dismissed
get_signal_dismissed_blocked
set_signal_dismissed_blocked!
connect_signal_drag!
connect_signal_drag_begin!
connect_signal_drag_end!
disconnect_signal_drag!
disconnect_signal_drag_begin!
disconnect_signal_drag_end!
emit_signal_drag
emit_signal_drag_begin
emit_signal_drag_end
get_signal_drag_begin_blocked
get_signal_drag_blocked
get_signal_drag_end_blocked
set_signal_drag_begin_blocked!
set_signal_drag_blocked!
set_signal_drag_end_blocked!
connect_signal_focus_gained!
connect_signal_focus_lost!
disconnect_signal_focus_gained!
disconnect_signal_focus_lost!
emit_signal_focus_gained
emit_signal_focus_lost
get_signal_focus_gained_blocked
get_signal_focus_lost_blocked
set_signal_focus_gained_blocked!
set_signal_focus_lost_blocked!
connect_signal_hide!
disconnect_signal_hide!
emit_signal_hide
get_signal_hide_blocked
set_signal_hide_blocked!
connect_signal_items_changed!
disconnect_signal_items_changed!
emit_signal_items_changed
get_signal_items_changed_blocked
set_signal_items_changed_blocked!
connect_signal_key_pressed!
connect_signal_key_released!
disconnect_signal_key_pressed!
disconnect_signal_key_released!
emit_signal_key_pressed
emit_signal_key_released
get_signal_key_pressed_blocked
get_signal_key_released_blocked
set_signal_key_pressed_blocked!
set_signal_key_released_blocked!
connect_signal_kinetic_scroll_decelerate!
disconnect_signal_kinetic_scroll_decelerate!
emit_signal_kinetic_scroll_decelerate
get_signal_kinetic_scroll_decelerate_blocked
set_signal_kinetic_scroll_decelerate_blocked!
connect_signal_map!
disconnect_signal_map!
emit_signal_map
get_signal_map_blocked
set_signal_map_blocked!
connect_signal_modifiers_changed!
disconnect_signal_modifiers_changed!
emit_signal_modifiers_changed
get_signal_modifiers_changed_blocked
set_signal_modifiers_changed_blocked!
connect_signal_motion!
connect_signal_motion_enter!
connect_signal_motion_leave!
disconnect_signal_motion!
disconnect_signal_motion_enter!
disconnect_signal_motion_leave!
emit_signal_motion
emit_signal_motion_enter
emit_signal_motion_leave
get_signal_motion_blocked
get_signal_motion_enter_blocked
get_signal_motion_leave_blocked
set_signal_motion_blocked!
set_signal_motion_enter_blocked!
set_signal_motion_leave_blocked!
connect_signal_page_added!
connect_signal_page_removed!
connect_signal_page_reordered!
connect_signal_page_selection_changed!
disconnect_signal_page_added!
disconnect_signal_page_removed!
disconnect_signal_page_reordered!
disconnect_signal_page_selection_changed!
emit_signal_page_added
emit_signal_page_removed
emit_signal_page_reordered
emit_signal_page_selection_changed
get_signal_page_added_blocked
get_signal_page_removed_blocked
get_signal_page_reordered_blocked
get_signal_page_selection_changed_blocked
set_signal_page_added_blocked!
set_signal_page_removed_blocked!
set_signal_page_reordered_blocked!
set_signal_page_selection_changed_blocked!
connect_signal_paint!
disconnect_signal_paint!
emit_signal_paint
get_signal_paint_blocked
set_signal_paint_blocked!
connect_signal_pan!
disconnect_signal_pan!
emit_signal_pan
get_signal_pan_blocked
set_signal_pan_blocked!
connect_signal_press_cancelled!
connect_signal_pressed!
disconnect_signal_press_cancelled!
disconnect_signal_pressed!
emit_signal_press_cancelled
emit_signal_pressed
get_signal_press_cancelled_blocked
get_signal_pressed_blocked
set_signal_press_cancelled_blocked!
set_signal_pressed_blocked!
connect_signal_properties_changed!
disconnect_signal_properties_changed!
emit_signal_properties_changed
get_signal_properties_changed_blocked
set_signal_properties_changed_blocked!
connect_signal_proximity!
disconnect_signal_proximity!
emit_signal_proximity
get_signal_proximity_blocked
set_signal_proximity_blocked!
connect_signal_realize!
disconnect_signal_realize!
emit_signal_realize
get_signal_realize_blocked
set_signal_realize_blocked!
connect_signal_render!
disconnect_signal_render!
emit_signal_render
get_signal_render_blocked
set_signal_render_blocked!
connect_signal_resize!
disconnect_signal_resize!
emit_signal_resize
get_signal_resize_blocked
set_signal_resize_blocked!
connect_signal_revealed!
disconnect_signal_revealed!
emit_signal_revealed
get_signal_revealed_blocked
set_signal_revealed_blocked!
connect_signal_rotation_changed!
disconnect_signal_rotation_changed!
emit_signal_rotation_changed
get_signal_rotation_changed_blocked
set_signal_rotation_changed_blocked!
connect_signal_scale_changed!
disconnect_signal_scale_changed!
emit_signal_scale_changed
get_signal_scale_changed_blocked
set_signal_scale_changed_blocked!
connect_signal_scroll!
connect_signal_scroll_begin!
connect_signal_scroll_child!
connect_signal_scroll_end!
disconnect_signal_scroll!
disconnect_signal_scroll_begin!
disconnect_signal_scroll_child!
disconnect_signal_scroll_end!
emit_signal_scroll
emit_signal_scroll_begin
emit_signal_scroll_child
emit_signal_scroll_end
get_signal_scroll_begin_blocked
get_signal_scroll_blocked
get_signal_scroll_child_blocked
get_signal_scroll_end_blocked
set_signal_scroll_begin_blocked!
set_signal_scroll_blocked!
set_signal_scroll_child_blocked!
set_signal_scroll_end_blocked!
connect_signal_selection_changed!
disconnect_signal_selection_changed!
emit_signal_selection_changed
get_signal_selection_changed_blocked
set_signal_selection_changed_blocked!
connect_signal_show!
disconnect_signal_show!
emit_signal_show
get_signal_show_blocked
set_signal_show_blocked!
connect_signal_shutdown!
disconnect_signal_shutdown!
emit_signal_shutdown
get_signal_shutdown_blocked
set_signal_shutdown_blocked!
connect_signal_stylus_down!
connect_signal_stylus_up!
disconnect_signal_stylus_down!
disconnect_signal_stylus_up!
emit_signal_stylus_down
emit_signal_stylus_up
get_signal_stylus_down_blocked
get_signal_stylus_up_blocked
set_signal_stylus_down_blocked!
set_signal_stylus_up_blocked!
connect_signal_swipe!
disconnect_signal_swipe!
emit_signal_swipe
get_signal_swipe_blocked
set_signal_swipe_blocked!
connect_signal_switched!
disconnect_signal_switched!
emit_signal_switched
get_signal_switched_blocked
set_signal_switched_blocked!
connect_signal_text_changed!
disconnect_signal_text_changed!
emit_signal_text_changed
get_signal_text_changed_blocked
set_signal_text_changed_blocked!
connect_signal_toggled!
disconnect_signal_toggled!
emit_signal_toggled
get_signal_toggled_blocked
set_signal_toggled_blocked!
connect_signal_unmap!
disconnect_signal_unmap!
emit_signal_unmap
get_signal_unmap_blocked
set_signal_unmap_blocked!
connect_signal_unrealize!
disconnect_signal_unrealize!
emit_signal_unrealize
get_signal_unrealize_blocked
set_signal_unrealize_blocked!
connect_signal_update!
disconnect_signal_update!
emit_signal_update
get_signal_update_blocked
set_signal_update_blocked!
connect_signal_value_changed!
disconnect_signal_value_changed!
emit_signal_value_changed
get_signal_value_changed_blocked
set_signal_value_changed_blocked!
connect_signal_wrapped!
disconnect_signal_wrapped!
emit_signal_wrapped
get_signal_wrapped_blocked
set_signal_wrapped_blocked!
Window
Mousetrap.Window
— TypeWindow <: Widget
Top-level window, associated with an Application
. Has exactly one child, as well as a titlebar widget, which will usually be a HeaderBar
.
When the users window manager requests for a window to close, signal close_request
will be emitted, whose return value can prevent the window from closing.
Constructors
Window(app::Application)
Signals
close_request
(::Window, [::Data_t]) -> WindowCloseRequestResult
Emitted when the window is requested to be closed, for example by the user pressing the close button. Depending on whether the return value of the signal handler is
WINDOW_CLOSE_REQUEST_RESULT_ALLOW_CLOSE
orWINDOW_CLOSE_REQUEST_RESULT_PREVENT_CLOSE
, closing of the window will be permitted or prevented.
activate_default_widget
(::Window, [::Data_t]) -> Nothing
Emitted when the child widget designated via
set_default_widget!
was activated.
activate_focused_widget
(::Window, [::Data_t]) -> Nothing
Emitted when the child widget that currently holds input focus is activated.
Fields
(no public fields)
Example
main() do app::Application
window = Window(app)
present!(window)
end
Functions that operate on this type:
close!
destroy!
get_destroy_with_parent
get_focus_visible
get_has_close_button
get_header_bar
get_hide_on_close
get_is_closed
get_is_decorated
get_is_modal
get_title
present!
remove_child!
set_application!
set_child!
set_default_widget!
set_destroy_with_parent!
set_focus_visible!
set_fullscreen!
set_has_close_button!
set_hide_on_close!
set_is_decorated!
set_is_modal!
set_maximized!
set_minimized!
set_startup_notification_identifier!
set_title!
set_transient_for!
connect_signal_activate_default_widget!
disconnect_signal_activate_default_widget!
emit_signal_activate_default_widget
get_signal_activate_default_widget_blocked
set_signal_activate_default_widget_blocked!
connect_signal_activate_focused_widget!
disconnect_signal_activate_focused_widget!
emit_signal_activate_focused_widget
get_signal_activate_focused_widget_blocked
set_signal_activate_focused_widget_blocked!
connect_signal_close_request!
disconnect_signal_close_request!
emit_signal_close_request
get_signal_close_request_blocked
set_signal_close_request_blocked!
connect_signal_destroy!
disconnect_signal_destroy!
emit_signal_destroy
get_signal_destroy_blocked
set_signal_destroy_blocked!
connect_signal_hide!
disconnect_signal_hide!
emit_signal_hide
get_signal_hide_blocked
set_signal_hide_blocked!
connect_signal_map!
disconnect_signal_map!
emit_signal_map
get_signal_map_blocked
set_signal_map_blocked!
connect_signal_realize!
disconnect_signal_realize!
emit_signal_realize
get_signal_realize_blocked
set_signal_realize_blocked!
connect_signal_show!
disconnect_signal_show!
emit_signal_show
get_signal_show_blocked
set_signal_show_blocked!
connect_signal_unmap!
disconnect_signal_unmap!
emit_signal_unmap
get_signal_unmap_blocked
set_signal_unmap_blocked!
connect_signal_unrealize!
disconnect_signal_unrealize!
emit_signal_unrealize
get_signal_unrealize_blocked
set_signal_unrealize_blocked!