Program Listing for File slint_internal.h
↰ Return to documentation for file (cppdocs/generated_include/slint_internal.h
)
#pragma once
/* Generated with cbindgen:0.20.0 */
#include <cstdarg>
#include <cstdint>
#include <cstdlib>
#include <ostream>
#include <new>
#include "slint_config.h"
#include "vtable.h"
#include "slint_string.h"
#include "slint_sharedvector.h"
#include "slint_properties.h"
#include "slint_callbacks.h"
#include "slint_color.h"
#include "slint_image.h"
#include "slint_pathdata.h"
#include "slint_brush.h"
#include "slint_generated_public.h"
namespace slint {
namespace private_api { class WindowRc; }
namespace cbindgen_private {
using slint::private_api::WindowRc;
using namespace vtable;
struct KeyEvent; struct PointerEvent;
using private_api::Property;
using private_api::PathData;
using private_api::Point;
}
}
namespace slint {
namespace cbindgen_private {
enum class DialogButtonRole {
none,
accept,
reject,
apply,
reset,
action,
help,
};
enum class EventResult {
reject,
accept,
};
enum class FillRule {
nonzero,
evenodd,
};
enum class FocusEvent {
FocusIn,
FocusOut,
WindowReceivedFocus,
WindowLostFocus,
};
enum class FocusEventResult {
FocusAccepted,
FocusIgnored,
};
enum class ImageFit {
fill,
contain,
cover,
};
enum class ImageRendering {
smooth,
pixelated,
};
enum class InputEventFilterResult {
ForwardEvent,
ForwardAndIgnore,
ForwardAndInterceptGrab,
Intercept,
};
enum class InputEventResult {
EventAccepted,
EventIgnored,
GrabMouse,
};
enum class InputType {
text,
password,
};
enum class KeyEventResult {
EventAccepted,
EventIgnored,
};
enum class KeyEventType {
KeyPressed,
KeyReleased,
};
enum class LayoutAlignment {
stretch,
center,
start,
end,
space_between,
space_around,
};
enum class MouseCursor {
default_,
none,
help,
pointer,
progress,
wait,
crosshair,
text,
alias,
copy,
no_drop,
not_allowed,
grab,
grabbing,
col_resize,
row_resize,
n_resize,
e_resize,
s_resize,
w_resize,
ne_resize,
nw_resize,
se_resize,
sw_resize,
ew_resize,
ns_resize,
nesw_resize,
nwse_resize,
};
enum class Orientation : uint8_t {
Horizontal,
Vertical,
};
enum class PointerEventButton {
none,
left,
right,
middle,
};
enum class PointerEventKind {
cancel,
down,
up,
};
enum class StandardButtonKind {
ok,
cancel,
apply,
close,
reset,
help,
yes,
no,
abort,
retry,
ignore,
};
enum class TextHorizontalAlignment {
left,
center,
right,
};
enum class TextOverflow {
clip,
elide,
};
enum class TextVerticalAlignment {
top,
center,
bottom,
};
enum class TextWrap {
no_wrap,
word_wrap,
};
enum class TraversalOrder : uint8_t {
BackToFront,
FrontToBack,
};
struct FlickableData;
struct ItemRendererRef;
using VisitChildrenResult = uint64_t;
struct Rect {
float x;
float y;
float width;
float height;
};
struct LayoutInfo {
float max;
float max_percent;
float min;
float min_percent;
float preferred;
float stretch;
inline LayoutInfo merge(const LayoutInfo &other) const;
friend inline LayoutInfo operator+(const LayoutInfo &a, const LayoutInfo &b) { return a.merge(b); }
friend bool operator==(const LayoutInfo&, const LayoutInfo&) = default;
};
struct MouseEvent {
enum class Tag {
MousePressed,
MouseReleased,
MouseMoved,
MouseWheel,
MouseExit,
};
struct MousePressed_Body {
Point pos;
PointerEventButton button;
};
struct MouseReleased_Body {
Point pos;
PointerEventButton button;
};
struct MouseMoved_Body {
Point pos;
};
struct MouseWheel_Body {
Point pos;
Point delta;
};
Tag tag;
union {
MousePressed_Body mouse_pressed;
MouseReleased_Body mouse_released;
MouseMoved_Body mouse_moved;
MouseWheel_Body mouse_wheel;
};
};
struct ItemRc {
VRc<ComponentVTable> component;
uintptr_t index;
};
struct KeyboardModifiers {
bool alt;
bool control;
bool meta;
bool shift;
};
struct KeyEvent {
KeyboardModifiers modifiers;
SharedString text;
KeyEventType event_type;
};
struct ItemVTable {
void (*init)(Pin<VRef<ItemVTable>>, const WindowRc *window);
Rect (*geometry)(Pin<VRef<ItemVTable>>);
uintptr_t cached_rendering_data_offset;
LayoutInfo (*layout_info)(Pin<VRef<ItemVTable>>, Orientation orientation, const WindowRc *window);
InputEventFilterResult (*input_event_filter_before_children)(Pin<VRef<ItemVTable>>, MouseEvent, const WindowRc *window, const ItemRc *self_rc);
InputEventResult (*input_event)(Pin<VRef<ItemVTable>>, MouseEvent, const WindowRc *window, const ItemRc *self_rc);
FocusEventResult (*focus_event)(Pin<VRef<ItemVTable>>, const FocusEvent*, const WindowRc *window);
KeyEventResult (*key_event)(Pin<VRef<ItemVTable>>, const KeyEvent*, const WindowRc *window);
void (*render)(Pin<VRef<ItemVTable>>, ItemRendererRef *backend);
};
struct ItemVisitorVTable {
VisitChildrenResult (*visit_item)(VRefMut<ItemVisitorVTable>, const VRc<ComponentVTable, Dyn> *component, uintptr_t index, Pin<VRef<ItemVTable>> item);
void (*drop)(VRefMut<ItemVisitorVTable>);
};
using ComponentWeak = VWeak<ComponentVTable, Dyn>;
struct ItemWeak {
ComponentWeak component;
uintptr_t index;
};
struct ComponentVTable {
VisitChildrenResult (*visit_children_item)(Pin<VRef<ComponentVTable>>, intptr_t index, TraversalOrder order, VRefMut<ItemVisitorVTable> visitor);
Pin<VRef<ItemVTable>> (*get_item_ref)(Pin<VRef<ComponentVTable>>, uintptr_t index);
void (*parent_item)(Pin<VRef<ComponentVTable>>, uintptr_t index, ItemWeak *result);
LayoutInfo (*layout_info)(Pin<VRef<ComponentVTable>>, Orientation);
Layout (*drop_in_place)(VRefMut<ComponentVTable>);
void (*dealloc)(const ComponentVTable*, uint8_t *ptr, Layout layout);
};
using ComponentRef = VRef<ComponentVTable>;
using ComponentRefPin = Pin<ComponentRef>;
template<typename T>
union ItemTreeNode {
enum class Tag : uint8_t {
Item,
DynamicTree,
};
struct Item_Body {
Tag tag;
VOffset<T, ItemVTable, AllowPin> item;
uint32_t children_count;
uint32_t children_index;
uint32_t parent_index;
};
struct DynamicTree_Body {
Tag tag;
uintptr_t index;
uint32_t parent_index;
};
struct {
Tag tag;
};
Item_Body item;
DynamicTree_Body dynamic_tree;
constexpr ItemTreeNode(Item_Body x) : item {x} {}
constexpr ItemTreeNode(DynamicTree_Body x) : dynamic_tree{x} {}
};
struct WindowRcOpaque {
const void *_0;
};
using ComponentRc = VRc<ComponentVTable, Dyn>;
struct FlickableDataBox {
struct FlickableData;
FlickableData *_0;
};
using Coord = float;
struct Padding {
Coord begin;
Coord end;
};
struct GridLayoutCellData {
uint16_t col_or_row;
uint16_t span;
LayoutInfo constraint;
};
struct GridLayoutData {
Coord size;
Coord spacing;
Padding padding;
Slice<GridLayoutCellData> cells;
};
struct BoxLayoutCellData {
LayoutInfo constraint;
};
struct BoxLayoutData {
Coord size;
Coord spacing;
Padding padding;
LayoutAlignment alignment;
Slice<BoxLayoutCellData> cells;
};
struct PathLayoutData {
PathData elements;
uint32_t item_count;
Coord x;
Coord y;
Coord width;
Coord height;
float offset;
};
struct EasingCurve {
enum class Tag : uint32_t {
Linear,
CubicBezier,
};
struct CubicBezier_Body {
float _0[4];
};
Tag tag;
union {
CubicBezier_Body cubic_bezier;
};
constexpr EasingCurve() : tag(Tag::Linear), cubic_bezier{{0,0,1,1}} {}
constexpr explicit EasingCurve(EasingCurve::Tag tag, float a, float b, float c, float d) : tag(tag), cubic_bezier{{a,b,c,d}} {}
};
struct PropertyAnimation {
int32_t delay;
int32_t duration;
float iteration_count;
EasingCurve easing;
};
using ItemRef = VRef<ItemVTable>;
struct PointerEvent {
PointerEventButton button;
PointerEventKind kind;
};
struct CachedRenderingData {
uintptr_t cache_index;
uintptr_t cache_generation;
constexpr CachedRenderingData() : cache_index{}, cache_generation{} {}
};
struct Rectangle {
Property<Brush> background;
Property<float> x;
Property<float> y;
Property<float> width;
Property<float> height;
CachedRenderingData cached_rendering_data;
};
struct BorderRectangle {
Property<Brush> background;
Property<float> x;
Property<float> y;
Property<float> width;
Property<float> height;
Property<float> border_width;
Property<float> border_radius;
Property<Brush> border_color;
CachedRenderingData cached_rendering_data;
};
struct ImageItem {
Property<Image> source;
Property<float> x;
Property<float> y;
Property<float> width;
Property<float> height;
Property<ImageFit> image_fit;
Property<ImageRendering> image_rendering;
CachedRenderingData cached_rendering_data;
};
struct ClippedImage {
Property<Image> source;
Property<float> x;
Property<float> y;
Property<float> width;
Property<float> height;
Property<ImageFit> image_fit;
Property<ImageRendering> image_rendering;
Property<Brush> colorize;
Property<int32_t> source_clip_x;
Property<int32_t> source_clip_y;
Property<int32_t> source_clip_width;
Property<int32_t> source_clip_height;
CachedRenderingData cached_rendering_data;
};
struct TouchArea {
Property<float> x;
Property<float> y;
Property<float> width;
Property<float> height;
Property<bool> enabled;
Property<bool> pressed;
Property<bool> has_hover;
Property<float> pressed_x;
Property<float> pressed_y;
Property<float> mouse_x;
Property<float> mouse_y;
Property<MouseCursor> mouse_cursor;
private_api::CallbackHelper<void> clicked;
private_api::CallbackHelper<void> moved;
private_api::CallbackHelper<PointerEvent> pointer_event;
CachedRenderingData cached_rendering_data;
bool grabbed;
};
struct FocusScope {
Property<float> x;
Property<float> y;
Property<float> width;
Property<float> height;
Property<bool> has_focus;
private_api::CallbackHelper<KeyEvent, EventResult> key_pressed;
private_api::CallbackHelper<KeyEvent, EventResult> key_released;
CachedRenderingData cached_rendering_data;
};
struct Flickable {
Property<float> x;
Property<float> y;
Property<float> width;
Property<float> height;
Rectangle viewport;
Property<bool> interactive;
FlickableDataBox data;
CachedRenderingData cached_rendering_data;
inline Flickable(); inline ~Flickable();
};
struct Text {
Property<SharedString> text;
Property<SharedString> font_family;
Property<float> font_size;
Property<int32_t> font_weight;
Property<Brush> color;
Property<TextHorizontalAlignment> horizontal_alignment;
Property<TextVerticalAlignment> vertical_alignment;
Property<TextWrap> wrap;
Property<TextOverflow> overflow;
Property<float> letter_spacing;
Property<float> x;
Property<float> y;
Property<float> width;
Property<float> height;
CachedRenderingData cached_rendering_data;
};
struct Path {
Property<float> x;
Property<float> y;
Property<float> width;
Property<float> height;
Property<PathData> elements;
Property<Brush> fill;
Property<FillRule> fill_rule;
Property<Brush> stroke;
Property<float> stroke_width;
Property<float> viewbox_x;
Property<float> viewbox_y;
Property<float> viewbox_width;
Property<float> viewbox_height;
Property<bool> clip;
CachedRenderingData cached_rendering_data;
};
struct WindowItem {
Property<float> width;
Property<float> height;
Property<Color> background;
Property<SharedString> title;
Property<bool> no_frame;
Property<Image> icon;
Property<SharedString> default_font_family;
Property<float> default_font_size;
Property<int32_t> default_font_weight;
CachedRenderingData cached_rendering_data;
};
struct TextInput {
Property<SharedString> text;
Property<SharedString> font_family;
Property<float> font_size;
Property<int32_t> font_weight;
Property<Brush> color;
Property<Color> selection_foreground_color;
Property<Color> selection_background_color;
Property<TextHorizontalAlignment> horizontal_alignment;
Property<TextVerticalAlignment> vertical_alignment;
Property<TextWrap> wrap;
Property<InputType> input_type;
Property<float> letter_spacing;
Property<float> x;
Property<float> y;
Property<float> width;
Property<float> height;
Property<int32_t> cursor_position;
Property<int32_t> anchor_position;
Property<float> text_cursor_width;
Property<bool> cursor_visible;
Property<bool> has_focus;
Property<bool> enabled;
private_api::CallbackHelper<void> accepted;
private_api::CallbackHelper<Point> cursor_position_changed;
private_api::CallbackHelper<void> edited;
bool pressed;
Property<bool> single_line;
CachedRenderingData cached_rendering_data;
};
struct Clip {
Property<float> x;
Property<float> y;
Property<float> width;
Property<float> height;
Property<float> border_radius;
Property<float> border_width;
CachedRenderingData cached_rendering_data;
Property<bool> clip;
};
struct BoxShadow {
Property<float> x;
Property<float> y;
Property<float> width;
Property<float> height;
Property<float> border_radius;
Property<float> offset_x;
Property<float> offset_y;
Property<Color> color;
Property<float> blur;
CachedRenderingData cached_rendering_data;
};
struct Rotate {
Property<float> angle;
Property<float> origin_x;
Property<float> origin_y;
Property<float> width;
Property<float> height;
CachedRenderingData cached_rendering_data;
};
struct Opacity {
Property<float> x;
Property<float> y;
Property<float> width;
Property<float> height;
Property<float> opacity;
CachedRenderingData cached_rendering_data;
};
struct StandardListViewItem {
SharedString text;
friend bool operator==(const StandardListViewItem&, const StandardListViewItem&) = default;
};
extern "C" {
void slint_callback_init(CallbackOpaque *out);
void slint_callback_call(const CallbackOpaque *sig, const void *arg, void *ret);
void slint_callback_set_handler(const CallbackOpaque *sig,
void (*binding)(void *user_data, const void *arg, void *ret),
void *user_data,
void (*drop_user_data)(void*));
void slint_callback_drop(CallbackOpaque *handle);
void slint_component_init_items(ComponentRefPin component,
Slice<ItemTreeNode<uint8_t>> item_tree,
const WindowRcOpaque *window_handle);
void slint_component_free_item_graphics_resources(ComponentRefPin component,
Slice<ItemTreeNode<uint8_t>> item_tree,
const WindowRcOpaque *window_handle);
VisitChildrenResult slint_visit_item_tree(const ComponentRc *component,
Slice<ItemTreeNode<uint8_t>> item_tree,
intptr_t index,
TraversalOrder order,
VRefMut<ItemVisitorVTable> visitor,
VisitChildrenResult (*visit_dynamic)(const uint8_t *base, TraversalOrder order, VRefMut<ItemVisitorVTable> visitor, uintptr_t dyn_index));
void slint_flickable_data_init(FlickableDataBox *data);
void slint_flickable_data_free(FlickableDataBox *data);
void slint_solve_grid_layout(const GridLayoutData *data, SharedVector<Coord> *result);
LayoutInfo slint_grid_layout_info(Slice<GridLayoutCellData> cells,
Coord spacing,
const Padding *padding);
void slint_solve_box_layout(const BoxLayoutData *data,
Slice<uint32_t> repeater_indexes,
SharedVector<Coord> *result);
LayoutInfo slint_box_layout_info(Slice<BoxLayoutCellData> cells,
Coord spacing,
const Padding *padding,
LayoutAlignment alignment);
LayoutInfo slint_box_layout_info_ortho(Slice<BoxLayoutCellData> cells, const Padding *padding);
void slint_solve_path_layout(const PathLayoutData *data,
Slice<uint32_t> repeater_indexes,
SharedVector<Coord> *result);
void slint_reorder_dialog_button_layout(GridLayoutCellData *cells, Slice<DialogButtonRole> roles);
void slint_property_init(PropertyHandleOpaque *out);
void slint_property_update(const PropertyHandleOpaque *handle, void *val);
void slint_property_set_changed(const PropertyHandleOpaque *handle, const void *value);
void slint_property_set_binding(const PropertyHandleOpaque *handle,
void (*binding)(void *user_data, void *pointer_to_value),
void *user_data,
void (*drop_user_data)(void*),
bool (*intercept_set)(void *user_data, const void *pointer_to_Value),
bool (*intercept_set_binding)(void *user_data, void *new_binding));
void slint_property_set_binding_internal(const PropertyHandleOpaque *handle, void *binding);
bool slint_property_is_dirty(const PropertyHandleOpaque *handle);
void slint_property_mark_dirty(const PropertyHandleOpaque *handle);
void slint_property_drop(PropertyHandleOpaque *handle);
void slint_property_set_animated_value_int(const PropertyHandleOpaque *handle,
int32_t from,
int32_t to,
const PropertyAnimation *animation_data);
void slint_property_set_animated_value_float(const PropertyHandleOpaque *handle,
float from,
float to,
const PropertyAnimation *animation_data);
void slint_property_set_animated_value_color(const PropertyHandleOpaque *handle,
Color from,
Color to,
const PropertyAnimation *animation_data);
void slint_property_set_animated_binding_int(const PropertyHandleOpaque *handle,
void (*binding)(void*, int32_t*),
void *user_data,
void (*drop_user_data)(void*),
const PropertyAnimation *animation_data,
PropertyAnimation (*transition_data)(void *user_data, uint64_t *start_instant));
void slint_property_set_animated_binding_float(const PropertyHandleOpaque *handle,
void (*binding)(void*, float*),
void *user_data,
void (*drop_user_data)(void*),
const PropertyAnimation *animation_data,
PropertyAnimation (*transition_data)(void *user_data, uint64_t *start_instant));
void slint_property_set_animated_binding_color(const PropertyHandleOpaque *handle,
void (*binding)(void*, Color*),
void *user_data,
void (*drop_user_data)(void*),
const PropertyAnimation *animation_data,
PropertyAnimation (*transition_data)(void *user_data, uint64_t *start_instant));
void slint_property_set_animated_binding_brush(const PropertyHandleOpaque *handle,
void (*binding)(void*, Brush*),
void *user_data,
void (*drop_user_data)(void*),
const PropertyAnimation *animation_data,
PropertyAnimation (*transition_data)(void *user_data, uint64_t *start_instant));
void slint_property_set_state_binding(const PropertyHandleOpaque *handle,
int32_t (*binding)(void*),
void *user_data,
void (*drop_user_data)(void*));
void slint_property_tracker_init(PropertyTrackerOpaque *out);
void slint_property_tracker_evaluate(const PropertyTrackerOpaque *handle,
void (*callback)(void *user_data),
void *user_data);
void slint_property_tracker_evaluate_as_dependency_root(const PropertyTrackerOpaque *handle,
void (*callback)(void *user_data),
void *user_data);
bool slint_property_tracker_is_dirty(const PropertyTrackerOpaque *handle);
void slint_property_tracker_drop(PropertyTrackerOpaque *handle);
uint8_t *slint_shared_vector_allocate(uintptr_t size,
uintptr_t align);
void slint_shared_vector_free(uint8_t *ptr,
uintptr_t size,
uintptr_t align);
const uint8_t *slint_shared_vector_empty();
const char *slint_shared_string_bytes(const SharedString *ss);
void slint_shared_string_drop(const SharedString *ss);
void slint_shared_string_clone(SharedString *out, const SharedString *ss);
void slint_shared_string_from_bytes(SharedString *out, const char *bytes, uintptr_t len);
void slint_shared_string_from_number(SharedString *out, double n);
void slint_shared_string_append(SharedString *self_, const char *bytes, uintptr_t len);
void slint_mock_elapsed_time(uint64_t time_in_ms);
void slint_send_mouse_click(const ComponentRc *component, float x, float y, const WindowRc *window);
void send_keyboard_string_sequence(const SharedString *sequence,
KeyboardModifiers modifiers,
const WindowRc *window);
int64_t slint_timer_start(int64_t id,
TimerMode mode,
uint64_t duration,
void (*callback)(void*),
void *user_data,
void (*drop_user_data)(void*));
void slint_timer_singleshot(uint64_t delay,
void (*callback)(void*),
void *user_data,
void (*drop_user_data)(void*));
void slint_timer_destroy(int64_t id);
void slint_timer_stop(int64_t id);
void slint_timer_restart(int64_t id);
bool slint_timer_running(int64_t id);
void slint_windowrc_drop(WindowRcOpaque *handle);
void slint_windowrc_clone(const WindowRcOpaque *source, WindowRcOpaque *target);
void slint_windowrc_show(const WindowRcOpaque *handle);
void slint_windowrc_hide(const WindowRcOpaque *handle);
float slint_windowrc_get_scale_factor(const WindowRcOpaque *handle);
void slint_windowrc_set_scale_factor(const WindowRcOpaque *handle, float value);
void slint_windowrc_free_graphics_resources(const WindowRcOpaque *handle,
const Slice<Pin<ItemRef>> *items);
void slint_windowrc_set_focus_item(const WindowRcOpaque *handle, const ItemRc *focus_item);
void slint_windowrc_set_component(const WindowRcOpaque *handle, const ComponentRc *component);
void slint_windowrc_show_popup(const WindowRcOpaque *handle,
const ComponentRc *popup,
Point position,
const ItemRc *parent_item);
bool slint_windowrc_set_rendering_notifier(const WindowRcOpaque *handle,
void (*callback)(RenderingState rendering_state, GraphicsAPI graphics_api, void *user_data),
void (*drop_user_data)(void *user_data),
void *user_data,
SetRenderingNotifierError *error);
void slint_windowrc_request_redraw(const WindowRcOpaque *handle);
} // extern "C"
} // namespace cbindgen_private
} // namespace slint
namespace slint::private_api {
#define SLINT_DECL_ITEM(ItemName) \
extern const cbindgen_private::ItemVTable ItemName##VTable; \
extern SLINT_DLL_IMPORT const cbindgen_private::ItemVTable* slint_get_##ItemName##VTable();
extern "C" {
SLINT_DECL_ITEM(Rectangle);
SLINT_DECL_ITEM(BorderRectangle);
SLINT_DECL_ITEM(ImageItem);
SLINT_DECL_ITEM(ClippedImage);
SLINT_DECL_ITEM(TouchArea);
SLINT_DECL_ITEM(FocusScope);
SLINT_DECL_ITEM(Flickable);
SLINT_DECL_ITEM(Text);
SLINT_DECL_ITEM(Path);
SLINT_DECL_ITEM(WindowItem);
SLINT_DECL_ITEM(TextInput);
SLINT_DECL_ITEM(Clip);
SLINT_DECL_ITEM(BoxShadow);
SLINT_DECL_ITEM(Rotate);
SLINT_DECL_ITEM(Opacity);
}
#undef SLINT_DECL_ITEM
}