mirror of
https://github.com/slint-ui/slint.git
synced 2025-10-01 06:11:16 +00:00
internal cleanup: Rename ComponentWindow to WindowRc
That's all it is nowadays, it's a wrapper around Rc<Window>. It's not an alias because we need to also "wrap" it to C++ via cbindgen, but that's about it.
This commit is contained in:
parent
57389c1731
commit
eaddbe664e
22 changed files with 274 additions and 300 deletions
|
@ -79,36 +79,33 @@ using ItemTreeNode = cbindgen_private::ItemTreeNode<uint8_t>;
|
|||
using cbindgen_private::KeyboardModifiers;
|
||||
using cbindgen_private::KeyEvent;
|
||||
|
||||
class ComponentWindow
|
||||
class WindowRc
|
||||
{
|
||||
public:
|
||||
ComponentWindow() { cbindgen_private::sixtyfps_component_window_init(&inner); }
|
||||
~ComponentWindow() { cbindgen_private::sixtyfps_component_window_drop(&inner); }
|
||||
ComponentWindow(const ComponentWindow &other)
|
||||
WindowRc() { cbindgen_private::sixtyfps_windowrc_init(&inner); }
|
||||
~WindowRc() { cbindgen_private::sixtyfps_windowrc_drop(&inner); }
|
||||
WindowRc(const WindowRc &other)
|
||||
{
|
||||
cbindgen_private::sixtyfps_component_window_clone(&other.inner, &inner);
|
||||
cbindgen_private::sixtyfps_windowrc_clone(&other.inner, &inner);
|
||||
}
|
||||
ComponentWindow(ComponentWindow &&) = delete;
|
||||
ComponentWindow &operator=(const ComponentWindow &) = delete;
|
||||
WindowRc(WindowRc &&) = delete;
|
||||
WindowRc &operator=(const WindowRc &) = delete;
|
||||
|
||||
void show() const { sixtyfps_component_window_show(&inner); }
|
||||
void hide() const { sixtyfps_component_window_hide(&inner); }
|
||||
void show() const { sixtyfps_windowrc_show(&inner); }
|
||||
void hide() const { sixtyfps_windowrc_hide(&inner); }
|
||||
|
||||
float scale_factor() const { return sixtyfps_component_window_get_scale_factor(&inner); }
|
||||
void set_scale_factor(float value) const
|
||||
{
|
||||
sixtyfps_component_window_set_scale_factor(&inner, value);
|
||||
}
|
||||
float scale_factor() const { return sixtyfps_windowrc_get_scale_factor(&inner); }
|
||||
void set_scale_factor(float value) const { sixtyfps_windowrc_set_scale_factor(&inner, value); }
|
||||
|
||||
void free_graphics_resources(const sixtyfps::Slice<ItemRef> &items) const
|
||||
{
|
||||
cbindgen_private::sixtyfps_component_window_free_graphics_resources(&inner, &items);
|
||||
cbindgen_private::sixtyfps_windowrc_free_graphics_resources(&inner, &items);
|
||||
}
|
||||
|
||||
void set_focus_item(const ComponentRc &component_rc, uintptr_t item_index)
|
||||
{
|
||||
cbindgen_private::ItemRc item_rc { component_rc, item_index };
|
||||
cbindgen_private::sixtyfps_component_window_set_focus_item(&inner, &item_rc);
|
||||
cbindgen_private::sixtyfps_windowrc_set_focus_item(&inner, &item_rc);
|
||||
}
|
||||
|
||||
template<typename Component, typename ItemTree>
|
||||
|
@ -122,18 +119,18 @@ public:
|
|||
void set_component(const Component &c) const
|
||||
{
|
||||
auto self_rc = c.self_weak.lock().value().into_dyn();
|
||||
sixtyfps_component_window_set_component(&inner, &self_rc);
|
||||
sixtyfps_windowrc_set_component(&inner, &self_rc);
|
||||
}
|
||||
|
||||
template<typename Component, typename Parent>
|
||||
void show_popup(const Parent *parent_component, cbindgen_private::Point p) const
|
||||
{
|
||||
auto popup = Component::create(parent_component).into_dyn();
|
||||
cbindgen_private::sixtyfps_component_window_show_popup(&inner, &popup, p);
|
||||
cbindgen_private::sixtyfps_windowrc_show_popup(&inner, &popup, p);
|
||||
}
|
||||
|
||||
private:
|
||||
cbindgen_private::ComponentWindowOpaque inner;
|
||||
cbindgen_private::WindowRcOpaque inner;
|
||||
};
|
||||
|
||||
constexpr inline ItemTreeNode make_item_node(std::uintptr_t offset,
|
||||
|
|
|
@ -244,8 +244,8 @@ private:
|
|||
/// Note that models are only represented in one direction: You can create a sixtyfps::Model<Value>
|
||||
/// in C++, store it in a std::shared_ptr and construct Value from it. Then you can set it on a
|
||||
/// property in your .60 code that was declared to be either an array (`property <[sometype]> foo;`)
|
||||
/// or an object literal (`property <{foo: string, bar: int}> my_prop;`). Such properties are dynamic
|
||||
/// and accept models implemented in C++.
|
||||
/// or an object literal (`property <{foo: string, bar: int}> my_prop;`). Such properties are
|
||||
/// dynamic and accept models implemented in C++.
|
||||
///
|
||||
/// ```
|
||||
/// Value v(42.0); // Creates a value that holds a double with the value 42.
|
||||
|
@ -582,11 +582,11 @@ public:
|
|||
/// it may return nullptr if the Qt backend is not used at runtime.
|
||||
QWidget *qwidget() const
|
||||
{
|
||||
cbindgen_private::ComponentWindowOpaque win;
|
||||
cbindgen_private::WindowRcOpaque win;
|
||||
cbindgen_private::sixtyfps_interpreter_component_instance_window(inner(), &win);
|
||||
auto wid = reinterpret_cast<QWidget *>(cbindgen_private::sixtyfps_qt_get_widget(
|
||||
reinterpret_cast<cbindgen_private::ComponentWindow *>(&win)));
|
||||
cbindgen_private::sixtyfps_component_window_drop(&win);
|
||||
reinterpret_cast<cbindgen_private::WindowRc *>(&win)));
|
||||
cbindgen_private::sixtyfps_windowrc_drop(&win);
|
||||
return wid;
|
||||
}
|
||||
#endif
|
||||
|
@ -925,11 +925,11 @@ inline void send_keyboard_string_sequence(const sixtyfps::interpreter::Component
|
|||
const sixtyfps::SharedString &str,
|
||||
KeyboardModifiers modifiers = {})
|
||||
{
|
||||
cbindgen_private::ComponentWindowOpaque win;
|
||||
cbindgen_private::WindowRcOpaque win;
|
||||
cbindgen_private::sixtyfps_interpreter_component_instance_window(
|
||||
reinterpret_cast<const cbindgen_private::ErasedComponentBox *>(component), &win);
|
||||
cbindgen_private::send_keyboard_string_sequence(
|
||||
&str, modifiers, reinterpret_cast<cbindgen_private::ComponentWindow *>(&win));
|
||||
cbindgen_private::sixtyfps_component_window_drop(&win);
|
||||
&str, modifiers, reinterpret_cast<cbindgen_private::WindowRc *>(&win));
|
||||
cbindgen_private::sixtyfps_windowrc_drop(&win);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -10,8 +10,8 @@ LICENSE END */
|
|||
/*! This crate just expose the function used by the C++ integration */
|
||||
|
||||
use core::ffi::c_void;
|
||||
use sixtyfps_corelib::window::ffi::ComponentWindowOpaque;
|
||||
use sixtyfps_corelib::window::ComponentWindow;
|
||||
use sixtyfps_corelib::window::ffi::WindowRcOpaque;
|
||||
use sixtyfps_corelib::window::WindowRc;
|
||||
use sixtyfps_rendering_backend_default::backend;
|
||||
|
||||
#[doc(hidden)]
|
||||
|
@ -24,12 +24,9 @@ pub fn use_modules() -> usize {
|
|||
}
|
||||
|
||||
#[no_mangle]
|
||||
pub unsafe extern "C" fn sixtyfps_component_window_init(out: *mut ComponentWindowOpaque) {
|
||||
assert_eq!(
|
||||
core::mem::size_of::<ComponentWindow>(),
|
||||
core::mem::size_of::<ComponentWindowOpaque>()
|
||||
);
|
||||
core::ptr::write(out as *mut ComponentWindow, crate::backend().create_window().into());
|
||||
pub unsafe extern "C" fn sixtyfps_windowrc_init(out: *mut WindowRcOpaque) {
|
||||
assert_eq!(core::mem::size_of::<WindowRc>(), core::mem::size_of::<WindowRcOpaque>());
|
||||
core::ptr::write(out as *mut WindowRc, crate::backend().create_window().into());
|
||||
}
|
||||
|
||||
#[no_mangle]
|
||||
|
|
|
@ -78,7 +78,7 @@ TEST_CASE("Image")
|
|||
using namespace sixtyfps;
|
||||
|
||||
// ensure a backend exists, using private api
|
||||
private_api::ComponentWindow wnd;
|
||||
private_api::WindowRc wnd;
|
||||
|
||||
Image img;
|
||||
{
|
||||
|
|
|
@ -242,7 +242,7 @@ pub mod re_exports {
|
|||
set_state_binding, Property, PropertyTracker, StateInfo,
|
||||
};
|
||||
pub use sixtyfps_corelib::slice::Slice;
|
||||
pub use sixtyfps_corelib::window::{ComponentWindow, WindowHandleAccess};
|
||||
pub use sixtyfps_corelib::window::{WindowHandleAccess, WindowRc};
|
||||
pub use sixtyfps_corelib::Color;
|
||||
pub use sixtyfps_corelib::ComponentVTable_static;
|
||||
pub use sixtyfps_corelib::SharedString;
|
||||
|
@ -253,7 +253,7 @@ pub mod re_exports {
|
|||
|
||||
/// Creates a new window to render components in.
|
||||
#[doc(hidden)]
|
||||
pub fn create_window() -> re_exports::ComponentWindow {
|
||||
pub fn create_window() -> re_exports::WindowRc {
|
||||
sixtyfps_rendering_backend_default::backend().create_window().into()
|
||||
}
|
||||
|
||||
|
@ -450,7 +450,7 @@ pub mod testing {
|
|||
/// purposes of testing.
|
||||
pub trait HasWindow {
|
||||
/// Returns a reference to the component's window.
|
||||
fn component_window(&self) -> &super::re_exports::ComponentWindow;
|
||||
fn component_window(&self) -> &super::re_exports::WindowRc;
|
||||
}
|
||||
|
||||
pub use sixtyfps_corelib::tests::sixtyfps_mock_elapsed_time as mock_elapsed_time;
|
||||
|
|
|
@ -895,7 +895,7 @@ fn generate_component(
|
|||
component_struct.members.push((
|
||||
Access::Private,
|
||||
Declaration::Var(Var {
|
||||
ty: "sixtyfps::private_api::ComponentWindow".into(),
|
||||
ty: "sixtyfps::private_api::WindowRc".into(),
|
||||
name: "window".into(),
|
||||
..Var::default()
|
||||
}),
|
||||
|
@ -904,7 +904,7 @@ fn generate_component(
|
|||
component_struct.members.push((
|
||||
Access::Public, // FIXME: many of the different component bindings need to access this
|
||||
Declaration::Var(Var {
|
||||
ty: "sixtyfps::private_api::ComponentWindow".into(),
|
||||
ty: "sixtyfps::private_api::WindowRc".into(),
|
||||
name: "window".into(),
|
||||
..Var::default()
|
||||
}),
|
||||
|
@ -958,7 +958,7 @@ fn generate_component(
|
|||
|
||||
init.push("self->window.init_items(this, item_tree());".into());
|
||||
|
||||
component_struct.friends.push("sixtyfps::private_api::ComponentWindow".into());
|
||||
component_struct.friends.push("sixtyfps::private_api::WindowRc".into());
|
||||
}
|
||||
|
||||
if !component.is_global() {
|
||||
|
|
|
@ -622,7 +622,7 @@ fn generate_component(
|
|||
let mut visibility = None;
|
||||
let mut parent_component_type = None;
|
||||
let mut has_window_impl = None;
|
||||
let mut window_field = Some(quote!(window: sixtyfps::re_exports::ComponentWindow));
|
||||
let mut window_field = Some(quote!(window: sixtyfps::re_exports::WindowRc));
|
||||
if let Some(parent_element) = component.parent_element.upgrade() {
|
||||
if parent_element.borrow().repeated.as_ref().map_or(false, |r| !r.is_conditional_element) {
|
||||
declared_property_vars.push(format_ident!("index"));
|
||||
|
@ -640,10 +640,10 @@ fn generate_component(
|
|||
&parent_element.borrow().enclosing_component.upgrade().unwrap(),
|
||||
));
|
||||
window_field_init = Some(quote!(window: parent_window.clone()));
|
||||
window_parent_param = Some(quote!(, parent_window: &sixtyfps::re_exports::ComponentWindow))
|
||||
window_parent_param = Some(quote!(, parent_window: &sixtyfps::re_exports::WindowRc))
|
||||
} else if !component.is_global() {
|
||||
// FIXME: This field is public for testing.
|
||||
window_field = Some(quote!(pub window: sixtyfps::re_exports::ComponentWindow));
|
||||
window_field = Some(quote!(pub window: sixtyfps::re_exports::WindowRc));
|
||||
window_field_init = Some(quote!(window: sixtyfps::create_window()));
|
||||
|
||||
visibility = Some(quote!(pub));
|
||||
|
@ -652,7 +652,7 @@ fn generate_component(
|
|||
|
||||
has_window_impl = Some(quote!(
|
||||
impl sixtyfps::testing::HasWindow for #inner_component_id {
|
||||
fn component_window(&self) -> &sixtyfps::re_exports::ComponentWindow {
|
||||
fn component_window(&self) -> &sixtyfps::re_exports::WindowRc {
|
||||
&self.window
|
||||
}
|
||||
}
|
||||
|
|
|
@ -14,7 +14,7 @@ LICENSE END */
|
|||
use crate::item_tree::{ItemVisitorVTable, TraversalOrder, VisitChildrenResult};
|
||||
use crate::items::{ItemVTable, ItemWeak};
|
||||
use crate::layout::{LayoutInfo, Orientation};
|
||||
use crate::window::ComponentWindow;
|
||||
use crate::window::WindowRc;
|
||||
use vtable::*;
|
||||
|
||||
/// A Component is representing an unit that is allocated together
|
||||
|
@ -69,7 +69,7 @@ pub type ComponentWeak = vtable::VWeak<ComponentVTable, Dyn>;
|
|||
pub fn init_component_items<Base>(
|
||||
base: core::pin::Pin<&Base>,
|
||||
item_tree: &[crate::item_tree::ItemTreeNode<Base>],
|
||||
window: &ComponentWindow,
|
||||
window: &WindowRc,
|
||||
) {
|
||||
item_tree.iter().for_each(|entry| match entry {
|
||||
crate::item_tree::ItemTreeNode::Item { item, .. } => {
|
||||
|
@ -92,9 +92,9 @@ pub(crate) mod ffi {
|
|||
pub unsafe extern "C" fn sixtyfps_component_init_items(
|
||||
component: ComponentRefPin,
|
||||
item_tree: Slice<ItemTreeNode<u8>>,
|
||||
window_handle: *const crate::window::ffi::ComponentWindowOpaque,
|
||||
window_handle: *const crate::window::ffi::WindowRcOpaque,
|
||||
) {
|
||||
let window = &*(window_handle as *const ComponentWindow);
|
||||
let window = &*(window_handle as *const WindowRc);
|
||||
super::init_component_items(
|
||||
core::pin::Pin::new_unchecked(&*(component.as_ptr() as *const u8)),
|
||||
item_tree.as_slice(),
|
||||
|
|
|
@ -275,7 +275,7 @@ enum MouseGrab {
|
|||
|
||||
fn handle_mouse_grab(
|
||||
mouse_event: &MouseEvent,
|
||||
window: &crate::window::ComponentWindow,
|
||||
window: &crate::window::WindowRc,
|
||||
mut mouse_input_state: MouseInputState,
|
||||
) -> MouseGrab {
|
||||
if !mouse_input_state.grabbed || mouse_input_state.item_stack.is_empty() {
|
||||
|
@ -330,7 +330,7 @@ fn handle_mouse_grab(
|
|||
pub fn process_mouse_input(
|
||||
component: ComponentRc,
|
||||
mouse_event: MouseEvent,
|
||||
window: &crate::window::ComponentWindow,
|
||||
window: &crate::window::WindowRc,
|
||||
mut mouse_input_state: MouseInputState,
|
||||
) -> MouseInputState {
|
||||
match handle_mouse_grab(&mouse_event, window, mouse_input_state) {
|
||||
|
|
|
@ -35,7 +35,7 @@ use crate::item_rendering::CachedRenderingData;
|
|||
use crate::layout::{LayoutInfo, Orientation};
|
||||
#[cfg(feature = "rtti")]
|
||||
use crate::rtti::*;
|
||||
use crate::window::ComponentWindow;
|
||||
use crate::window::WindowRc;
|
||||
use crate::{Callback, Property, SharedString};
|
||||
use const_field_offset::FieldOffsets;
|
||||
use core::pin::Pin;
|
||||
|
@ -78,7 +78,7 @@ pub struct ItemVTable {
|
|||
/// This function is called by the run-time after the memory for the item
|
||||
/// has been allocated and initialized. It will be called before any user specified
|
||||
/// bindings are set.
|
||||
pub init: extern "C" fn(core::pin::Pin<VRef<ItemVTable>>, window: &ComponentWindow),
|
||||
pub init: extern "C" fn(core::pin::Pin<VRef<ItemVTable>>, window: &WindowRc),
|
||||
|
||||
/// Returns the geometry of this item (relative to its parent item)
|
||||
pub geometry: extern "C" fn(core::pin::Pin<VRef<ItemVTable>>) -> Rect,
|
||||
|
@ -93,7 +93,7 @@ pub struct ItemVTable {
|
|||
pub layouting_info: extern "C" fn(
|
||||
core::pin::Pin<VRef<ItemVTable>>,
|
||||
orientation: Orientation,
|
||||
window: &ComponentWindow,
|
||||
window: &WindowRc,
|
||||
) -> LayoutInfo,
|
||||
|
||||
/// Event handler for mouse and touch event. This function is called before being called on children.
|
||||
|
@ -103,7 +103,7 @@ pub struct ItemVTable {
|
|||
pub input_event_filter_before_children: extern "C" fn(
|
||||
core::pin::Pin<VRef<ItemVTable>>,
|
||||
MouseEvent,
|
||||
window: &ComponentWindow,
|
||||
window: &WindowRc,
|
||||
self_rc: &ItemRc,
|
||||
) -> InputEventFilterResult,
|
||||
|
||||
|
@ -111,17 +111,17 @@ pub struct ItemVTable {
|
|||
pub input_event: extern "C" fn(
|
||||
core::pin::Pin<VRef<ItemVTable>>,
|
||||
MouseEvent,
|
||||
window: &ComponentWindow,
|
||||
window: &WindowRc,
|
||||
self_rc: &ItemRc,
|
||||
) -> InputEventResult,
|
||||
|
||||
pub focus_event:
|
||||
extern "C" fn(core::pin::Pin<VRef<ItemVTable>>, &FocusEvent, window: &ComponentWindow),
|
||||
extern "C" fn(core::pin::Pin<VRef<ItemVTable>>, &FocusEvent, window: &WindowRc),
|
||||
|
||||
pub key_event: extern "C" fn(
|
||||
core::pin::Pin<VRef<ItemVTable>>,
|
||||
&KeyEvent,
|
||||
window: &ComponentWindow,
|
||||
window: &WindowRc,
|
||||
) -> KeyEventResult,
|
||||
|
||||
pub render: extern "C" fn(core::pin::Pin<VRef<ItemVTable>>, backend: &mut ItemRendererRef),
|
||||
|
@ -202,7 +202,7 @@ pub struct Rectangle {
|
|||
}
|
||||
|
||||
impl Item for Rectangle {
|
||||
fn init(self: Pin<&Self>, _window: &ComponentWindow) {}
|
||||
fn init(self: Pin<&Self>, _window: &WindowRc) {}
|
||||
|
||||
fn geometry(self: Pin<&Self>) -> Rect {
|
||||
euclid::rect(self.x(), self.y(), self.width(), self.height())
|
||||
|
@ -211,7 +211,7 @@ impl Item for Rectangle {
|
|||
fn layouting_info(
|
||||
self: Pin<&Self>,
|
||||
_orientation: Orientation,
|
||||
_window: &ComponentWindow,
|
||||
_window: &WindowRc,
|
||||
) -> LayoutInfo {
|
||||
LayoutInfo { stretch: 1., ..LayoutInfo::default() }
|
||||
}
|
||||
|
@ -219,7 +219,7 @@ impl Item for Rectangle {
|
|||
fn input_event_filter_before_children(
|
||||
self: Pin<&Self>,
|
||||
_: MouseEvent,
|
||||
_window: &ComponentWindow,
|
||||
_window: &WindowRc,
|
||||
_self_rc: &ItemRc,
|
||||
) -> InputEventFilterResult {
|
||||
InputEventFilterResult::ForwardAndIgnore
|
||||
|
@ -228,17 +228,17 @@ impl Item for Rectangle {
|
|||
fn input_event(
|
||||
self: Pin<&Self>,
|
||||
_: MouseEvent,
|
||||
_window: &ComponentWindow,
|
||||
_window: &WindowRc,
|
||||
_self_rc: &ItemRc,
|
||||
) -> InputEventResult {
|
||||
InputEventResult::EventIgnored
|
||||
}
|
||||
|
||||
fn key_event(self: Pin<&Self>, _: &KeyEvent, _window: &ComponentWindow) -> KeyEventResult {
|
||||
fn key_event(self: Pin<&Self>, _: &KeyEvent, _window: &WindowRc) -> KeyEventResult {
|
||||
KeyEventResult::EventIgnored
|
||||
}
|
||||
|
||||
fn focus_event(self: Pin<&Self>, _: &FocusEvent, _window: &ComponentWindow) {}
|
||||
fn focus_event(self: Pin<&Self>, _: &FocusEvent, _window: &WindowRc) {}
|
||||
|
||||
fn render(self: Pin<&Self>, backend: &mut ItemRendererRef) {
|
||||
(*backend).draw_rectangle(self)
|
||||
|
@ -273,7 +273,7 @@ pub struct BorderRectangle {
|
|||
}
|
||||
|
||||
impl Item for BorderRectangle {
|
||||
fn init(self: Pin<&Self>, _window: &ComponentWindow) {}
|
||||
fn init(self: Pin<&Self>, _window: &WindowRc) {}
|
||||
|
||||
fn geometry(self: Pin<&Self>) -> Rect {
|
||||
euclid::rect(self.x(), self.y(), self.width(), self.height())
|
||||
|
@ -282,7 +282,7 @@ impl Item for BorderRectangle {
|
|||
fn layouting_info(
|
||||
self: Pin<&Self>,
|
||||
_orientation: Orientation,
|
||||
_window: &ComponentWindow,
|
||||
_window: &WindowRc,
|
||||
) -> LayoutInfo {
|
||||
LayoutInfo { stretch: 1., ..LayoutInfo::default() }
|
||||
}
|
||||
|
@ -290,7 +290,7 @@ impl Item for BorderRectangle {
|
|||
fn input_event_filter_before_children(
|
||||
self: Pin<&Self>,
|
||||
_: MouseEvent,
|
||||
_window: &ComponentWindow,
|
||||
_window: &WindowRc,
|
||||
_self_rc: &ItemRc,
|
||||
) -> InputEventFilterResult {
|
||||
InputEventFilterResult::ForwardAndIgnore
|
||||
|
@ -299,17 +299,17 @@ impl Item for BorderRectangle {
|
|||
fn input_event(
|
||||
self: Pin<&Self>,
|
||||
_: MouseEvent,
|
||||
_window: &ComponentWindow,
|
||||
_window: &WindowRc,
|
||||
_self_rc: &ItemRc,
|
||||
) -> InputEventResult {
|
||||
InputEventResult::EventIgnored
|
||||
}
|
||||
|
||||
fn key_event(self: Pin<&Self>, _: &KeyEvent, _window: &ComponentWindow) -> KeyEventResult {
|
||||
fn key_event(self: Pin<&Self>, _: &KeyEvent, _window: &WindowRc) -> KeyEventResult {
|
||||
KeyEventResult::EventIgnored
|
||||
}
|
||||
|
||||
fn focus_event(self: Pin<&Self>, _: &FocusEvent, _window: &ComponentWindow) {}
|
||||
fn focus_event(self: Pin<&Self>, _: &FocusEvent, _window: &WindowRc) {}
|
||||
|
||||
fn render(self: Pin<&Self>, backend: &mut ItemRendererRef) {
|
||||
(*backend).draw_border_rectangle(self)
|
||||
|
@ -354,7 +354,7 @@ pub struct TouchArea {
|
|||
}
|
||||
|
||||
impl Item for TouchArea {
|
||||
fn init(self: Pin<&Self>, _window: &ComponentWindow) {}
|
||||
fn init(self: Pin<&Self>, _window: &WindowRc) {}
|
||||
|
||||
fn geometry(self: Pin<&Self>) -> Rect {
|
||||
euclid::rect(self.x(), self.y(), self.width(), self.height())
|
||||
|
@ -363,7 +363,7 @@ impl Item for TouchArea {
|
|||
fn layouting_info(
|
||||
self: Pin<&Self>,
|
||||
_orientation: Orientation,
|
||||
_window: &ComponentWindow,
|
||||
_window: &WindowRc,
|
||||
) -> LayoutInfo {
|
||||
LayoutInfo::default()
|
||||
}
|
||||
|
@ -371,7 +371,7 @@ impl Item for TouchArea {
|
|||
fn input_event_filter_before_children(
|
||||
self: Pin<&Self>,
|
||||
event: MouseEvent,
|
||||
_window: &ComponentWindow,
|
||||
_window: &WindowRc,
|
||||
_self_rc: &ItemRc,
|
||||
) -> InputEventFilterResult {
|
||||
if !self.enabled() {
|
||||
|
@ -388,7 +388,7 @@ impl Item for TouchArea {
|
|||
fn input_event(
|
||||
self: Pin<&Self>,
|
||||
event: MouseEvent,
|
||||
_window: &ComponentWindow,
|
||||
_window: &WindowRc,
|
||||
_self_rc: &ItemRc,
|
||||
) -> InputEventResult {
|
||||
if matches!(event, MouseEvent::MouseExit) {
|
||||
|
@ -422,11 +422,11 @@ impl Item for TouchArea {
|
|||
result
|
||||
}
|
||||
|
||||
fn key_event(self: Pin<&Self>, _: &KeyEvent, _window: &ComponentWindow) -> KeyEventResult {
|
||||
fn key_event(self: Pin<&Self>, _: &KeyEvent, _window: &WindowRc) -> KeyEventResult {
|
||||
KeyEventResult::EventIgnored
|
||||
}
|
||||
|
||||
fn focus_event(self: Pin<&Self>, _: &FocusEvent, _window: &ComponentWindow) {}
|
||||
fn focus_event(self: Pin<&Self>, _: &FocusEvent, _window: &WindowRc) {}
|
||||
|
||||
fn render(self: Pin<&Self>, _backend: &mut ItemRendererRef) {}
|
||||
}
|
||||
|
@ -474,7 +474,7 @@ pub struct FocusScope {
|
|||
}
|
||||
|
||||
impl Item for FocusScope {
|
||||
fn init(self: Pin<&Self>, _window: &ComponentWindow) {}
|
||||
fn init(self: Pin<&Self>, _window: &WindowRc) {}
|
||||
|
||||
fn geometry(self: Pin<&Self>) -> Rect {
|
||||
euclid::rect(self.x(), self.y(), self.width(), self.height())
|
||||
|
@ -483,7 +483,7 @@ impl Item for FocusScope {
|
|||
fn layouting_info(
|
||||
self: Pin<&Self>,
|
||||
_orientation: Orientation,
|
||||
_window: &ComponentWindow,
|
||||
_window: &WindowRc,
|
||||
) -> LayoutInfo {
|
||||
LayoutInfo::default()
|
||||
}
|
||||
|
@ -491,7 +491,7 @@ impl Item for FocusScope {
|
|||
fn input_event_filter_before_children(
|
||||
self: Pin<&Self>,
|
||||
_: MouseEvent,
|
||||
_window: &ComponentWindow,
|
||||
_window: &WindowRc,
|
||||
_self_rc: &ItemRc,
|
||||
) -> InputEventFilterResult {
|
||||
InputEventFilterResult::ForwardEvent
|
||||
|
@ -500,7 +500,7 @@ impl Item for FocusScope {
|
|||
fn input_event(
|
||||
self: Pin<&Self>,
|
||||
event: MouseEvent,
|
||||
window: &ComponentWindow,
|
||||
window: &WindowRc,
|
||||
self_rc: &ItemRc,
|
||||
) -> InputEventResult {
|
||||
/*if !self.enabled() {
|
||||
|
@ -512,7 +512,7 @@ impl Item for FocusScope {
|
|||
InputEventResult::EventIgnored
|
||||
}
|
||||
|
||||
fn key_event(self: Pin<&Self>, event: &KeyEvent, _window: &ComponentWindow) -> KeyEventResult {
|
||||
fn key_event(self: Pin<&Self>, event: &KeyEvent, _window: &WindowRc) -> KeyEventResult {
|
||||
let r = match event.event_type {
|
||||
KeyEventType::KeyPressed => {
|
||||
Self::FIELD_OFFSETS.key_pressed.apply_pin(self).call(&(event.clone(),))
|
||||
|
@ -527,7 +527,7 @@ impl Item for FocusScope {
|
|||
}
|
||||
}
|
||||
|
||||
fn focus_event(self: Pin<&Self>, event: &FocusEvent, _window: &ComponentWindow) {
|
||||
fn focus_event(self: Pin<&Self>, event: &FocusEvent, _window: &WindowRc) {
|
||||
match event {
|
||||
FocusEvent::FocusIn | FocusEvent::WindowReceivedFocus => {
|
||||
self.has_focus.set(true);
|
||||
|
@ -567,7 +567,7 @@ pub struct Clip {
|
|||
}
|
||||
|
||||
impl Item for Clip {
|
||||
fn init(self: Pin<&Self>, _window: &ComponentWindow) {}
|
||||
fn init(self: Pin<&Self>, _window: &WindowRc) {}
|
||||
|
||||
fn geometry(self: Pin<&Self>) -> Rect {
|
||||
euclid::rect(self.x(), self.y(), self.width(), self.height())
|
||||
|
@ -576,7 +576,7 @@ impl Item for Clip {
|
|||
fn layouting_info(
|
||||
self: Pin<&Self>,
|
||||
_orientation: Orientation,
|
||||
_window: &ComponentWindow,
|
||||
_window: &WindowRc,
|
||||
) -> LayoutInfo {
|
||||
LayoutInfo { stretch: 1., ..LayoutInfo::default() }
|
||||
}
|
||||
|
@ -584,7 +584,7 @@ impl Item for Clip {
|
|||
fn input_event_filter_before_children(
|
||||
self: Pin<&Self>,
|
||||
event: MouseEvent,
|
||||
_window: &ComponentWindow,
|
||||
_window: &WindowRc,
|
||||
_self_rc: &ItemRc,
|
||||
) -> InputEventFilterResult {
|
||||
if let Some(pos) = event.pos() {
|
||||
|
@ -598,17 +598,17 @@ impl Item for Clip {
|
|||
fn input_event(
|
||||
self: Pin<&Self>,
|
||||
_: MouseEvent,
|
||||
_window: &ComponentWindow,
|
||||
_window: &WindowRc,
|
||||
_self_rc: &ItemRc,
|
||||
) -> InputEventResult {
|
||||
InputEventResult::EventIgnored
|
||||
}
|
||||
|
||||
fn key_event(self: Pin<&Self>, _: &KeyEvent, _window: &ComponentWindow) -> KeyEventResult {
|
||||
fn key_event(self: Pin<&Self>, _: &KeyEvent, _window: &WindowRc) -> KeyEventResult {
|
||||
KeyEventResult::EventIgnored
|
||||
}
|
||||
|
||||
fn focus_event(self: Pin<&Self>, _: &FocusEvent, _window: &ComponentWindow) {}
|
||||
fn focus_event(self: Pin<&Self>, _: &FocusEvent, _window: &WindowRc) {}
|
||||
|
||||
fn render(self: Pin<&Self>, backend: &mut ItemRendererRef) {
|
||||
let geometry = self.geometry();
|
||||
|
@ -644,7 +644,7 @@ pub struct Opacity {
|
|||
}
|
||||
|
||||
impl Item for Opacity {
|
||||
fn init(self: Pin<&Self>, _window: &ComponentWindow) {}
|
||||
fn init(self: Pin<&Self>, _window: &WindowRc) {}
|
||||
|
||||
fn geometry(self: Pin<&Self>) -> Rect {
|
||||
euclid::rect(self.x(), self.y(), self.width(), self.height())
|
||||
|
@ -653,7 +653,7 @@ impl Item for Opacity {
|
|||
fn layouting_info(
|
||||
self: Pin<&Self>,
|
||||
_orientation: Orientation,
|
||||
_window: &ComponentWindow,
|
||||
_window: &WindowRc,
|
||||
) -> LayoutInfo {
|
||||
LayoutInfo { stretch: 1., ..LayoutInfo::default() }
|
||||
}
|
||||
|
@ -661,7 +661,7 @@ impl Item for Opacity {
|
|||
fn input_event_filter_before_children(
|
||||
self: Pin<&Self>,
|
||||
_: MouseEvent,
|
||||
_window: &ComponentWindow,
|
||||
_window: &WindowRc,
|
||||
_self_rc: &ItemRc,
|
||||
) -> InputEventFilterResult {
|
||||
InputEventFilterResult::ForwardAndIgnore
|
||||
|
@ -670,17 +670,17 @@ impl Item for Opacity {
|
|||
fn input_event(
|
||||
self: Pin<&Self>,
|
||||
_: MouseEvent,
|
||||
_window: &ComponentWindow,
|
||||
_window: &WindowRc,
|
||||
_self_rc: &ItemRc,
|
||||
) -> InputEventResult {
|
||||
InputEventResult::EventIgnored
|
||||
}
|
||||
|
||||
fn key_event(self: Pin<&Self>, _: &KeyEvent, _window: &ComponentWindow) -> KeyEventResult {
|
||||
fn key_event(self: Pin<&Self>, _: &KeyEvent, _window: &WindowRc) -> KeyEventResult {
|
||||
KeyEventResult::EventIgnored
|
||||
}
|
||||
|
||||
fn focus_event(self: Pin<&Self>, _: &FocusEvent, _window: &ComponentWindow) {}
|
||||
fn focus_event(self: Pin<&Self>, _: &FocusEvent, _window: &WindowRc) {}
|
||||
|
||||
fn render(self: Pin<&Self>, backend: &mut ItemRendererRef) {
|
||||
backend.apply_opacity(self.opacity());
|
||||
|
@ -712,7 +712,7 @@ pub struct Rotate {
|
|||
}
|
||||
|
||||
impl Item for Rotate {
|
||||
fn init(self: Pin<&Self>, _window: &ComponentWindow) {}
|
||||
fn init(self: Pin<&Self>, _window: &WindowRc) {}
|
||||
|
||||
fn geometry(self: Pin<&Self>) -> Rect {
|
||||
euclid::rect(0., 0., 0., 0.)
|
||||
|
@ -721,7 +721,7 @@ impl Item for Rotate {
|
|||
fn layouting_info(
|
||||
self: Pin<&Self>,
|
||||
_orientation: Orientation,
|
||||
_window: &ComponentWindow,
|
||||
_window: &WindowRc,
|
||||
) -> LayoutInfo {
|
||||
LayoutInfo { stretch: 1., ..LayoutInfo::default() }
|
||||
}
|
||||
|
@ -729,7 +729,7 @@ impl Item for Rotate {
|
|||
fn input_event_filter_before_children(
|
||||
self: Pin<&Self>,
|
||||
_: MouseEvent,
|
||||
_window: &ComponentWindow,
|
||||
_window: &WindowRc,
|
||||
_self_rc: &ItemRc,
|
||||
) -> InputEventFilterResult {
|
||||
InputEventFilterResult::ForwardAndIgnore
|
||||
|
@ -738,17 +738,17 @@ impl Item for Rotate {
|
|||
fn input_event(
|
||||
self: Pin<&Self>,
|
||||
_: MouseEvent,
|
||||
_window: &ComponentWindow,
|
||||
_window: &WindowRc,
|
||||
_self_rc: &ItemRc,
|
||||
) -> InputEventResult {
|
||||
InputEventResult::EventIgnored
|
||||
}
|
||||
|
||||
fn key_event(self: Pin<&Self>, _: &KeyEvent, _window: &ComponentWindow) -> KeyEventResult {
|
||||
fn key_event(self: Pin<&Self>, _: &KeyEvent, _window: &WindowRc) -> KeyEventResult {
|
||||
KeyEventResult::EventIgnored
|
||||
}
|
||||
|
||||
fn focus_event(self: Pin<&Self>, _: &FocusEvent, _window: &ComponentWindow) {}
|
||||
fn focus_event(self: Pin<&Self>, _: &FocusEvent, _window: &WindowRc) {}
|
||||
|
||||
fn render(self: Pin<&Self>, backend: &mut ItemRendererRef) {
|
||||
(*backend).translate(self.origin_x(), self.origin_y());
|
||||
|
@ -805,7 +805,7 @@ pub struct Path {
|
|||
}
|
||||
|
||||
impl Item for Path {
|
||||
fn init(self: Pin<&Self>, _window: &ComponentWindow) {}
|
||||
fn init(self: Pin<&Self>, _window: &WindowRc) {}
|
||||
|
||||
fn geometry(self: Pin<&Self>) -> Rect {
|
||||
euclid::rect(self.x(), self.y(), self.width(), self.height())
|
||||
|
@ -814,7 +814,7 @@ impl Item for Path {
|
|||
fn layouting_info(
|
||||
self: Pin<&Self>,
|
||||
_orientation: Orientation,
|
||||
_window: &ComponentWindow,
|
||||
_window: &WindowRc,
|
||||
) -> LayoutInfo {
|
||||
LayoutInfo::default()
|
||||
}
|
||||
|
@ -822,7 +822,7 @@ impl Item for Path {
|
|||
fn input_event_filter_before_children(
|
||||
self: Pin<&Self>,
|
||||
event: MouseEvent,
|
||||
_window: &ComponentWindow,
|
||||
_window: &WindowRc,
|
||||
_self_rc: &ItemRc,
|
||||
) -> InputEventFilterResult {
|
||||
if let Some(pos) = event.pos() {
|
||||
|
@ -838,17 +838,17 @@ impl Item for Path {
|
|||
fn input_event(
|
||||
self: Pin<&Self>,
|
||||
_: MouseEvent,
|
||||
_window: &ComponentWindow,
|
||||
_window: &WindowRc,
|
||||
_self_rc: &ItemRc,
|
||||
) -> InputEventResult {
|
||||
InputEventResult::EventIgnored
|
||||
}
|
||||
|
||||
fn key_event(self: Pin<&Self>, _: &KeyEvent, _window: &ComponentWindow) -> KeyEventResult {
|
||||
fn key_event(self: Pin<&Self>, _: &KeyEvent, _window: &WindowRc) -> KeyEventResult {
|
||||
KeyEventResult::EventIgnored
|
||||
}
|
||||
|
||||
fn focus_event(self: Pin<&Self>, _: &FocusEvent, _window: &ComponentWindow) {}
|
||||
fn focus_event(self: Pin<&Self>, _: &FocusEvent, _window: &WindowRc) {}
|
||||
|
||||
fn render(self: Pin<&Self>, backend: &mut ItemRendererRef) {
|
||||
let clip = self.clip();
|
||||
|
@ -918,7 +918,7 @@ pub struct Flickable {
|
|||
}
|
||||
|
||||
impl Item for Flickable {
|
||||
fn init(self: Pin<&Self>, _window: &ComponentWindow) {}
|
||||
fn init(self: Pin<&Self>, _window: &WindowRc) {}
|
||||
|
||||
fn geometry(self: Pin<&Self>) -> Rect {
|
||||
euclid::rect(self.x(), self.y(), self.width(), self.height())
|
||||
|
@ -927,7 +927,7 @@ impl Item for Flickable {
|
|||
fn layouting_info(
|
||||
self: Pin<&Self>,
|
||||
_orientation: Orientation,
|
||||
_window: &ComponentWindow,
|
||||
_window: &WindowRc,
|
||||
) -> LayoutInfo {
|
||||
LayoutInfo { stretch: 1., ..LayoutInfo::default() }
|
||||
}
|
||||
|
@ -935,7 +935,7 @@ impl Item for Flickable {
|
|||
fn input_event_filter_before_children(
|
||||
self: Pin<&Self>,
|
||||
event: MouseEvent,
|
||||
_window: &ComponentWindow,
|
||||
_window: &WindowRc,
|
||||
_self_rc: &ItemRc,
|
||||
) -> InputEventFilterResult {
|
||||
if let Some(pos) = event.pos() {
|
||||
|
@ -952,7 +952,7 @@ impl Item for Flickable {
|
|||
fn input_event(
|
||||
self: Pin<&Self>,
|
||||
event: MouseEvent,
|
||||
_window: &ComponentWindow,
|
||||
_window: &WindowRc,
|
||||
_self_rc: &ItemRc,
|
||||
) -> InputEventResult {
|
||||
if !self.interactive() && !matches!(event, MouseEvent::MouseWheel { .. }) {
|
||||
|
@ -969,11 +969,11 @@ impl Item for Flickable {
|
|||
self.data.handle_mouse(self, event)
|
||||
}
|
||||
|
||||
fn key_event(self: Pin<&Self>, _: &KeyEvent, _window: &ComponentWindow) -> KeyEventResult {
|
||||
fn key_event(self: Pin<&Self>, _: &KeyEvent, _window: &WindowRc) -> KeyEventResult {
|
||||
KeyEventResult::EventIgnored
|
||||
}
|
||||
|
||||
fn focus_event(self: Pin<&Self>, _: &FocusEvent, _window: &ComponentWindow) {}
|
||||
fn focus_event(self: Pin<&Self>, _: &FocusEvent, _window: &WindowRc) {}
|
||||
|
||||
fn render(self: Pin<&Self>, backend: &mut ItemRendererRef) {
|
||||
let geometry = self.geometry();
|
||||
|
@ -1056,7 +1056,7 @@ pub struct WindowItem {
|
|||
}
|
||||
|
||||
impl Item for WindowItem {
|
||||
fn init(self: Pin<&Self>, _window: &ComponentWindow) {}
|
||||
fn init(self: Pin<&Self>, _window: &WindowRc) {}
|
||||
|
||||
fn geometry(self: Pin<&Self>) -> Rect {
|
||||
euclid::rect(0., 0., self.width(), self.height())
|
||||
|
@ -1065,7 +1065,7 @@ impl Item for WindowItem {
|
|||
fn layouting_info(
|
||||
self: Pin<&Self>,
|
||||
_orientation: Orientation,
|
||||
_window: &ComponentWindow,
|
||||
_window: &WindowRc,
|
||||
) -> LayoutInfo {
|
||||
LayoutInfo::default()
|
||||
}
|
||||
|
@ -1073,7 +1073,7 @@ impl Item for WindowItem {
|
|||
fn input_event_filter_before_children(
|
||||
self: Pin<&Self>,
|
||||
_: MouseEvent,
|
||||
_window: &ComponentWindow,
|
||||
_window: &WindowRc,
|
||||
_self_rc: &ItemRc,
|
||||
) -> InputEventFilterResult {
|
||||
InputEventFilterResult::ForwardAndIgnore
|
||||
|
@ -1082,17 +1082,17 @@ impl Item for WindowItem {
|
|||
fn input_event(
|
||||
self: Pin<&Self>,
|
||||
_event: MouseEvent,
|
||||
_window: &ComponentWindow,
|
||||
_window: &WindowRc,
|
||||
_self_rc: &ItemRc,
|
||||
) -> InputEventResult {
|
||||
InputEventResult::EventIgnored
|
||||
}
|
||||
|
||||
fn key_event(self: Pin<&Self>, _: &KeyEvent, _window: &ComponentWindow) -> KeyEventResult {
|
||||
fn key_event(self: Pin<&Self>, _: &KeyEvent, _window: &WindowRc) -> KeyEventResult {
|
||||
KeyEventResult::EventIgnored
|
||||
}
|
||||
|
||||
fn focus_event(self: Pin<&Self>, _: &FocusEvent, _window: &ComponentWindow) {}
|
||||
fn focus_event(self: Pin<&Self>, _: &FocusEvent, _window: &WindowRc) {}
|
||||
|
||||
fn render(self: Pin<&Self>, _backend: &mut ItemRendererRef) {}
|
||||
}
|
||||
|
@ -1159,7 +1159,7 @@ pub struct BoxShadow {
|
|||
}
|
||||
|
||||
impl Item for BoxShadow {
|
||||
fn init(self: Pin<&Self>, _window: &ComponentWindow) {}
|
||||
fn init(self: Pin<&Self>, _window: &WindowRc) {}
|
||||
|
||||
fn geometry(self: Pin<&Self>) -> Rect {
|
||||
euclid::rect(self.x(), self.y(), self.width(), self.height())
|
||||
|
@ -1168,7 +1168,7 @@ impl Item for BoxShadow {
|
|||
fn layouting_info(
|
||||
self: Pin<&Self>,
|
||||
_orientation: Orientation,
|
||||
_window: &ComponentWindow,
|
||||
_window: &WindowRc,
|
||||
) -> LayoutInfo {
|
||||
LayoutInfo { stretch: 1., ..LayoutInfo::default() }
|
||||
}
|
||||
|
@ -1176,7 +1176,7 @@ impl Item for BoxShadow {
|
|||
fn input_event_filter_before_children(
|
||||
self: Pin<&Self>,
|
||||
_: MouseEvent,
|
||||
_window: &ComponentWindow,
|
||||
_window: &WindowRc,
|
||||
_self_rc: &ItemRc,
|
||||
) -> InputEventFilterResult {
|
||||
InputEventFilterResult::ForwardAndIgnore
|
||||
|
@ -1185,17 +1185,17 @@ impl Item for BoxShadow {
|
|||
fn input_event(
|
||||
self: Pin<&Self>,
|
||||
_event: MouseEvent,
|
||||
_window: &ComponentWindow,
|
||||
_window: &WindowRc,
|
||||
_self_rc: &ItemRc,
|
||||
) -> InputEventResult {
|
||||
InputEventResult::EventIgnored
|
||||
}
|
||||
|
||||
fn key_event(self: Pin<&Self>, _: &KeyEvent, _window: &ComponentWindow) -> KeyEventResult {
|
||||
fn key_event(self: Pin<&Self>, _: &KeyEvent, _window: &WindowRc) -> KeyEventResult {
|
||||
KeyEventResult::EventIgnored
|
||||
}
|
||||
|
||||
fn focus_event(self: Pin<&Self>, _: &FocusEvent, _window: &ComponentWindow) {}
|
||||
fn focus_event(self: Pin<&Self>, _: &FocusEvent, _window: &WindowRc) {}
|
||||
|
||||
fn render(self: Pin<&Self>, backend: &mut ItemRendererRef) {
|
||||
(*backend).draw_box_shadow(self)
|
||||
|
|
|
@ -23,7 +23,7 @@ use crate::item_rendering::ItemRenderer;
|
|||
use crate::layout::{LayoutInfo, Orientation};
|
||||
#[cfg(feature = "rtti")]
|
||||
use crate::rtti::*;
|
||||
use crate::window::ComponentWindow;
|
||||
use crate::window::WindowRc;
|
||||
use crate::{Brush, Property};
|
||||
use const_field_offset::FieldOffsets;
|
||||
use core::pin::Pin;
|
||||
|
@ -59,7 +59,7 @@ pub struct ImageItem {
|
|||
}
|
||||
|
||||
impl Item for ImageItem {
|
||||
fn init(self: Pin<&Self>, _window: &ComponentWindow) {}
|
||||
fn init(self: Pin<&Self>, _window: &WindowRc) {}
|
||||
|
||||
fn geometry(self: Pin<&Self>) -> Rect {
|
||||
euclid::rect(self.x(), self.y(), self.width(), self.height())
|
||||
|
@ -68,7 +68,7 @@ impl Item for ImageItem {
|
|||
fn layouting_info(
|
||||
self: Pin<&Self>,
|
||||
orientation: Orientation,
|
||||
_window: &ComponentWindow,
|
||||
_window: &WindowRc,
|
||||
) -> LayoutInfo {
|
||||
let natural_size = self.source().size();
|
||||
LayoutInfo {
|
||||
|
@ -84,7 +84,7 @@ impl Item for ImageItem {
|
|||
fn input_event_filter_before_children(
|
||||
self: Pin<&Self>,
|
||||
_: MouseEvent,
|
||||
_window: &ComponentWindow,
|
||||
_window: &WindowRc,
|
||||
_self_rc: &ItemRc,
|
||||
) -> InputEventFilterResult {
|
||||
InputEventFilterResult::ForwardAndIgnore
|
||||
|
@ -93,17 +93,17 @@ impl Item for ImageItem {
|
|||
fn input_event(
|
||||
self: Pin<&Self>,
|
||||
_: MouseEvent,
|
||||
_window: &ComponentWindow,
|
||||
_window: &WindowRc,
|
||||
_self_rc: &ItemRc,
|
||||
) -> InputEventResult {
|
||||
InputEventResult::EventIgnored
|
||||
}
|
||||
|
||||
fn key_event(self: Pin<&Self>, _: &KeyEvent, _window: &ComponentWindow) -> KeyEventResult {
|
||||
fn key_event(self: Pin<&Self>, _: &KeyEvent, _window: &WindowRc) -> KeyEventResult {
|
||||
KeyEventResult::EventIgnored
|
||||
}
|
||||
|
||||
fn focus_event(self: Pin<&Self>, _: &FocusEvent, _window: &ComponentWindow) {}
|
||||
fn focus_event(self: Pin<&Self>, _: &FocusEvent, _window: &WindowRc) {}
|
||||
|
||||
fn render(self: Pin<&Self>, backend: &mut &mut dyn ItemRenderer) {
|
||||
(*backend).draw_image(self)
|
||||
|
@ -137,7 +137,7 @@ pub struct ClippedImage {
|
|||
}
|
||||
|
||||
impl Item for ClippedImage {
|
||||
fn init(self: Pin<&Self>, _window: &ComponentWindow) {}
|
||||
fn init(self: Pin<&Self>, _window: &WindowRc) {}
|
||||
|
||||
fn geometry(self: Pin<&Self>) -> Rect {
|
||||
euclid::rect(self.x(), self.y(), self.width(), self.height())
|
||||
|
@ -146,7 +146,7 @@ impl Item for ClippedImage {
|
|||
fn layouting_info(
|
||||
self: Pin<&Self>,
|
||||
orientation: Orientation,
|
||||
_window: &ComponentWindow,
|
||||
_window: &WindowRc,
|
||||
) -> LayoutInfo {
|
||||
let natural_size = self.source().size();
|
||||
LayoutInfo {
|
||||
|
@ -162,7 +162,7 @@ impl Item for ClippedImage {
|
|||
fn input_event_filter_before_children(
|
||||
self: Pin<&Self>,
|
||||
_: MouseEvent,
|
||||
_window: &ComponentWindow,
|
||||
_window: &WindowRc,
|
||||
_self_rc: &ItemRc,
|
||||
) -> InputEventFilterResult {
|
||||
InputEventFilterResult::ForwardAndIgnore
|
||||
|
@ -171,17 +171,17 @@ impl Item for ClippedImage {
|
|||
fn input_event(
|
||||
self: Pin<&Self>,
|
||||
_: MouseEvent,
|
||||
_window: &ComponentWindow,
|
||||
_window: &WindowRc,
|
||||
_self_rc: &ItemRc,
|
||||
) -> InputEventResult {
|
||||
InputEventResult::EventIgnored
|
||||
}
|
||||
|
||||
fn key_event(self: Pin<&Self>, _: &KeyEvent, _window: &ComponentWindow) -> KeyEventResult {
|
||||
fn key_event(self: Pin<&Self>, _: &KeyEvent, _window: &WindowRc) -> KeyEventResult {
|
||||
KeyEventResult::EventIgnored
|
||||
}
|
||||
|
||||
fn focus_event(self: Pin<&Self>, _: &FocusEvent, _window: &ComponentWindow) {}
|
||||
fn focus_event(self: Pin<&Self>, _: &FocusEvent, _window: &WindowRc) {}
|
||||
|
||||
fn render(self: Pin<&Self>, backend: &mut &mut dyn ItemRenderer) {
|
||||
(*backend).draw_clipped_image(self)
|
||||
|
|
|
@ -25,7 +25,7 @@ use crate::item_rendering::{CachedRenderingData, ItemRenderer};
|
|||
use crate::layout::{LayoutInfo, Orientation};
|
||||
#[cfg(feature = "rtti")]
|
||||
use crate::rtti::*;
|
||||
use crate::window::ComponentWindow;
|
||||
use crate::window::WindowRc;
|
||||
use crate::{Callback, Property, SharedString};
|
||||
use const_field_offset::FieldOffsets;
|
||||
use core::pin::Pin;
|
||||
|
@ -112,17 +112,13 @@ pub struct Text {
|
|||
}
|
||||
|
||||
impl Item for Text {
|
||||
fn init(self: Pin<&Self>, _window: &ComponentWindow) {}
|
||||
fn init(self: Pin<&Self>, _window: &WindowRc) {}
|
||||
|
||||
fn geometry(self: Pin<&Self>) -> Rect {
|
||||
euclid::rect(self.x(), self.y(), self.width(), self.height())
|
||||
}
|
||||
|
||||
fn layouting_info(
|
||||
self: Pin<&Self>,
|
||||
orientation: Orientation,
|
||||
window: &ComponentWindow,
|
||||
) -> LayoutInfo {
|
||||
fn layouting_info(self: Pin<&Self>, orientation: Orientation, window: &WindowRc) -> LayoutInfo {
|
||||
let font_metrics = window.0.font_metrics(
|
||||
&self.cached_rendering_data,
|
||||
&|| self.unresolved_font_request(),
|
||||
|
@ -165,7 +161,7 @@ impl Item for Text {
|
|||
fn input_event_filter_before_children(
|
||||
self: Pin<&Self>,
|
||||
_: MouseEvent,
|
||||
_window: &ComponentWindow,
|
||||
_window: &WindowRc,
|
||||
_self_rc: &ItemRc,
|
||||
) -> InputEventFilterResult {
|
||||
InputEventFilterResult::ForwardAndIgnore
|
||||
|
@ -174,17 +170,17 @@ impl Item for Text {
|
|||
fn input_event(
|
||||
self: Pin<&Self>,
|
||||
_: MouseEvent,
|
||||
_window: &ComponentWindow,
|
||||
_window: &WindowRc,
|
||||
_self_rc: &ItemRc,
|
||||
) -> InputEventResult {
|
||||
InputEventResult::EventIgnored
|
||||
}
|
||||
|
||||
fn key_event(self: Pin<&Self>, _: &KeyEvent, _window: &ComponentWindow) -> KeyEventResult {
|
||||
fn key_event(self: Pin<&Self>, _: &KeyEvent, _window: &WindowRc) -> KeyEventResult {
|
||||
KeyEventResult::EventIgnored
|
||||
}
|
||||
|
||||
fn focus_event(self: Pin<&Self>, _: &FocusEvent, _window: &ComponentWindow) {}
|
||||
fn focus_event(self: Pin<&Self>, _: &FocusEvent, _window: &WindowRc) {}
|
||||
|
||||
fn render(self: Pin<&Self>, backend: &mut &mut dyn ItemRenderer) {
|
||||
(*backend).draw_text(self)
|
||||
|
@ -260,18 +256,14 @@ pub struct TextInput {
|
|||
}
|
||||
|
||||
impl Item for TextInput {
|
||||
fn init(self: Pin<&Self>, _window: &ComponentWindow) {}
|
||||
fn init(self: Pin<&Self>, _window: &WindowRc) {}
|
||||
|
||||
// FIXME: width / height. or maybe it doesn't matter? (
|
||||
fn geometry(self: Pin<&Self>) -> Rect {
|
||||
euclid::rect(self.x(), self.y(), self.width(), self.height())
|
||||
}
|
||||
|
||||
fn layouting_info(
|
||||
self: Pin<&Self>,
|
||||
orientation: Orientation,
|
||||
window: &ComponentWindow,
|
||||
) -> LayoutInfo {
|
||||
fn layouting_info(self: Pin<&Self>, orientation: Orientation, window: &WindowRc) -> LayoutInfo {
|
||||
let font_metrics = window.0.font_metrics(
|
||||
&self.cached_rendering_data,
|
||||
&|| self.unresolved_font_request(),
|
||||
|
@ -295,7 +287,7 @@ impl Item for TextInput {
|
|||
fn input_event_filter_before_children(
|
||||
self: Pin<&Self>,
|
||||
_: MouseEvent,
|
||||
_window: &ComponentWindow,
|
||||
_window: &WindowRc,
|
||||
_self_rc: &ItemRc,
|
||||
) -> InputEventFilterResult {
|
||||
InputEventFilterResult::ForwardEvent
|
||||
|
@ -304,7 +296,7 @@ impl Item for TextInput {
|
|||
fn input_event(
|
||||
self: Pin<&Self>,
|
||||
event: MouseEvent,
|
||||
window: &ComponentWindow,
|
||||
window: &WindowRc,
|
||||
self_rc: &ItemRc,
|
||||
) -> InputEventResult {
|
||||
if !self.enabled() {
|
||||
|
@ -342,7 +334,7 @@ impl Item for TextInput {
|
|||
InputEventResult::EventAccepted
|
||||
}
|
||||
|
||||
fn key_event(self: Pin<&Self>, event: &KeyEvent, window: &ComponentWindow) -> KeyEventResult {
|
||||
fn key_event(self: Pin<&Self>, event: &KeyEvent, window: &WindowRc) -> KeyEventResult {
|
||||
use std::convert::TryFrom;
|
||||
|
||||
if !self.enabled() {
|
||||
|
@ -412,7 +404,7 @@ impl Item for TextInput {
|
|||
}
|
||||
}
|
||||
|
||||
fn focus_event(self: Pin<&Self>, event: &FocusEvent, window: &ComponentWindow) {
|
||||
fn focus_event(self: Pin<&Self>, event: &FocusEvent, window: &WindowRc) {
|
||||
match event {
|
||||
FocusEvent::FocusIn | FocusEvent::WindowReceivedFocus => {
|
||||
self.has_focus.set(true);
|
||||
|
@ -474,7 +466,7 @@ impl From<KeyboardModifiers> for AnchorMode {
|
|||
}
|
||||
|
||||
impl TextInput {
|
||||
fn show_cursor(&self, window: &ComponentWindow) {
|
||||
fn show_cursor(&self, window: &WindowRc) {
|
||||
window.0.set_cursor_blink_binding(&self.cursor_visible);
|
||||
}
|
||||
|
||||
|
@ -486,7 +478,7 @@ impl TextInput {
|
|||
self: Pin<&Self>,
|
||||
direction: TextCursorDirection,
|
||||
anchor_mode: AnchorMode,
|
||||
window: &ComponentWindow,
|
||||
window: &WindowRc,
|
||||
) -> bool {
|
||||
let text = self.text();
|
||||
if text.len() == 0 {
|
||||
|
@ -534,14 +526,14 @@ impl TextInput {
|
|||
new_cursor_pos != last_cursor_pos
|
||||
}
|
||||
|
||||
fn delete_char(self: Pin<&Self>, window: &ComponentWindow) {
|
||||
fn delete_char(self: Pin<&Self>, window: &WindowRc) {
|
||||
if !self.has_selection() {
|
||||
self.move_cursor(TextCursorDirection::Forward, AnchorMode::KeepAnchor, window);
|
||||
}
|
||||
self.delete_selection();
|
||||
}
|
||||
|
||||
fn delete_previous(self: Pin<&Self>, window: &ComponentWindow) {
|
||||
fn delete_previous(self: Pin<&Self>, window: &WindowRc) {
|
||||
if self.has_selection() {
|
||||
self.delete_selection();
|
||||
return;
|
||||
|
|
|
@ -86,7 +86,7 @@ pub fn use_modules() -> usize {
|
|||
+ graphics::ffi::sixtyfps_new_path_elements as usize
|
||||
+ properties::ffi::sixtyfps_property_init as usize
|
||||
+ string::ffi::sixtyfps_shared_string_bytes as usize
|
||||
+ window::ffi::sixtyfps_component_window_drop as usize
|
||||
+ window::ffi::sixtyfps_windowrc_drop as usize
|
||||
+ component::ffi::sixtyfps_component_init_items as usize
|
||||
+ timers::ffi::sixtyfps_timer_start as usize
|
||||
+ graphics::color::ffi::sixtyfps_color_brighter as usize
|
||||
|
|
|
@ -12,7 +12,7 @@ LICENSE END */
|
|||
#![allow(unsafe_code)]
|
||||
|
||||
use crate::input::{KeyEvent, KeyEventType, KeyboardModifiers, MouseEvent};
|
||||
use crate::window::ComponentWindow;
|
||||
use crate::window::WindowRc;
|
||||
use crate::SharedString;
|
||||
|
||||
/// SixtyFPS animations do not use real time, but use a mocked time.
|
||||
|
@ -34,7 +34,7 @@ pub extern "C" fn sixtyfps_send_mouse_click(
|
|||
component: &crate::component::ComponentRc,
|
||||
x: f32,
|
||||
y: f32,
|
||||
window: &ComponentWindow,
|
||||
window: &WindowRc,
|
||||
) {
|
||||
let mut state = crate::input::MouseInputState::default();
|
||||
let pos = euclid::point2(x, y);
|
||||
|
@ -65,7 +65,7 @@ pub extern "C" fn sixtyfps_send_mouse_click(
|
|||
pub extern "C" fn send_keyboard_string_sequence(
|
||||
sequence: &crate::SharedString,
|
||||
modifiers: KeyboardModifiers,
|
||||
window: &ComponentWindow,
|
||||
window: &WindowRc,
|
||||
) {
|
||||
for ch in sequence.chars() {
|
||||
let mut modifiers = modifiers;
|
||||
|
|
|
@ -322,19 +322,18 @@ pub trait WindowHandleAccess {
|
|||
fn window_handle(&self) -> &std::rc::Rc<Window>;
|
||||
}
|
||||
|
||||
/// The ComponentWindow is the (rust) facing public type that can render the items
|
||||
/// of components to the screen.
|
||||
/// The WindowRc is the (rust) facing wrapper type for Rc<Window>.
|
||||
#[repr(C)]
|
||||
#[derive(Clone)]
|
||||
pub struct ComponentWindow(pub(crate) std::rc::Rc<Window>);
|
||||
pub struct WindowRc(pub(crate) std::rc::Rc<Window>);
|
||||
|
||||
impl From<std::rc::Rc<Window>> for ComponentWindow {
|
||||
impl From<std::rc::Rc<Window>> for WindowRc {
|
||||
fn from(inner: std::rc::Rc<Window>) -> Self {
|
||||
Self(inner)
|
||||
}
|
||||
}
|
||||
|
||||
impl WindowHandleAccess for ComponentWindow {
|
||||
impl WindowHandleAccess for WindowRc {
|
||||
fn window_handle(&self) -> &std::rc::Rc<Window> {
|
||||
&self.0
|
||||
}
|
||||
|
@ -351,116 +350,105 @@ pub mod ffi {
|
|||
#[allow(non_camel_case_types)]
|
||||
type c_void = ();
|
||||
|
||||
/// Same layout as ComponentWindow
|
||||
/// Same layout as WindowRc
|
||||
#[repr(C)]
|
||||
pub struct ComponentWindowOpaque(*const c_void);
|
||||
pub struct WindowRcOpaque(*const c_void);
|
||||
|
||||
/// Releases the reference to the component window held by handle.
|
||||
/// Releases the reference to the windowrc held by handle.
|
||||
#[no_mangle]
|
||||
pub unsafe extern "C" fn sixtyfps_component_window_drop(handle: *mut ComponentWindowOpaque) {
|
||||
assert_eq!(
|
||||
core::mem::size_of::<ComponentWindow>(),
|
||||
core::mem::size_of::<ComponentWindowOpaque>()
|
||||
);
|
||||
core::ptr::read(handle as *mut ComponentWindow);
|
||||
pub unsafe extern "C" fn sixtyfps_windowrc_drop(handle: *mut WindowRcOpaque) {
|
||||
assert_eq!(core::mem::size_of::<WindowRc>(), core::mem::size_of::<WindowRcOpaque>());
|
||||
core::ptr::read(handle as *mut WindowRc);
|
||||
}
|
||||
|
||||
/// Releases the reference to the component window held by handle.
|
||||
#[no_mangle]
|
||||
pub unsafe extern "C" fn sixtyfps_component_window_clone(
|
||||
source: *const ComponentWindowOpaque,
|
||||
target: *mut ComponentWindowOpaque,
|
||||
pub unsafe extern "C" fn sixtyfps_windowrc_clone(
|
||||
source: *const WindowRcOpaque,
|
||||
target: *mut WindowRcOpaque,
|
||||
) {
|
||||
assert_eq!(
|
||||
core::mem::size_of::<ComponentWindow>(),
|
||||
core::mem::size_of::<ComponentWindowOpaque>()
|
||||
);
|
||||
let window = &*(source as *const ComponentWindow);
|
||||
core::ptr::write(target as *mut ComponentWindow, window.clone());
|
||||
assert_eq!(core::mem::size_of::<WindowRc>(), core::mem::size_of::<WindowRcOpaque>());
|
||||
let window = &*(source as *const WindowRc);
|
||||
core::ptr::write(target as *mut WindowRc, window.clone());
|
||||
}
|
||||
|
||||
/// Spins an event loop and renders the items of the provided component in this window.
|
||||
#[no_mangle]
|
||||
pub unsafe extern "C" fn sixtyfps_component_window_show(handle: *const ComponentWindowOpaque) {
|
||||
let window = &*(handle as *const ComponentWindow);
|
||||
pub unsafe extern "C" fn sixtyfps_windowrc_show(handle: *const WindowRcOpaque) {
|
||||
let window = &*(handle as *const WindowRc);
|
||||
window.window_handle().show();
|
||||
}
|
||||
|
||||
/// Spins an event loop and renders the items of the provided component in this window.
|
||||
#[no_mangle]
|
||||
pub unsafe extern "C" fn sixtyfps_component_window_hide(handle: *const ComponentWindowOpaque) {
|
||||
let window = &*(handle as *const ComponentWindow);
|
||||
pub unsafe extern "C" fn sixtyfps_windowrc_hide(handle: *const WindowRcOpaque) {
|
||||
let window = &*(handle as *const WindowRc);
|
||||
window.window_handle().hide();
|
||||
}
|
||||
|
||||
/// Returns the window scale factor.
|
||||
#[no_mangle]
|
||||
pub unsafe extern "C" fn sixtyfps_component_window_get_scale_factor(
|
||||
handle: *const ComponentWindowOpaque,
|
||||
pub unsafe extern "C" fn sixtyfps_windowrc_get_scale_factor(
|
||||
handle: *const WindowRcOpaque,
|
||||
) -> f32 {
|
||||
assert_eq!(
|
||||
core::mem::size_of::<ComponentWindow>(),
|
||||
core::mem::size_of::<ComponentWindowOpaque>()
|
||||
);
|
||||
let window = &*(handle as *const ComponentWindow);
|
||||
assert_eq!(core::mem::size_of::<WindowRc>(), core::mem::size_of::<WindowRcOpaque>());
|
||||
let window = &*(handle as *const WindowRc);
|
||||
window.window_handle().scale_factor()
|
||||
}
|
||||
|
||||
/// Sets the window scale factor, merely for testing purposes.
|
||||
#[no_mangle]
|
||||
pub unsafe extern "C" fn sixtyfps_component_window_set_scale_factor(
|
||||
handle: *const ComponentWindowOpaque,
|
||||
pub unsafe extern "C" fn sixtyfps_windowrc_set_scale_factor(
|
||||
handle: *const WindowRcOpaque,
|
||||
value: f32,
|
||||
) {
|
||||
let window = &*(handle as *const ComponentWindow);
|
||||
let window = &*(handle as *const WindowRc);
|
||||
window.window_handle().set_scale_factor(value)
|
||||
}
|
||||
|
||||
/// Sets the window scale factor, merely for testing purposes.
|
||||
#[no_mangle]
|
||||
pub unsafe extern "C" fn sixtyfps_component_window_free_graphics_resources<'a>(
|
||||
handle: *const ComponentWindowOpaque,
|
||||
pub unsafe extern "C" fn sixtyfps_windowrc_free_graphics_resources<'a>(
|
||||
handle: *const WindowRcOpaque,
|
||||
items: &Slice<'a, Pin<ItemRef<'a>>>,
|
||||
) {
|
||||
let window = &*(handle as *const ComponentWindow);
|
||||
let window = &*(handle as *const WindowRc);
|
||||
window.window_handle().free_graphics_resources(items)
|
||||
}
|
||||
|
||||
/// Sets the focus item.
|
||||
#[no_mangle]
|
||||
pub unsafe extern "C" fn sixtyfps_component_window_set_focus_item(
|
||||
handle: *const ComponentWindowOpaque,
|
||||
pub unsafe extern "C" fn sixtyfps_windowrc_set_focus_item(
|
||||
handle: *const WindowRcOpaque,
|
||||
focus_item: &ItemRc,
|
||||
) {
|
||||
let window = &*(handle as *const ComponentWindow);
|
||||
let window = &*(handle as *const WindowRc);
|
||||
window.window_handle().clone().set_focus_item(focus_item)
|
||||
}
|
||||
|
||||
/// Associates the window with the given component.
|
||||
#[no_mangle]
|
||||
pub unsafe extern "C" fn sixtyfps_component_window_set_component(
|
||||
handle: *const ComponentWindowOpaque,
|
||||
pub unsafe extern "C" fn sixtyfps_windowrc_set_component(
|
||||
handle: *const WindowRcOpaque,
|
||||
component: &ComponentRc,
|
||||
) {
|
||||
let window = &*(handle as *const ComponentWindow);
|
||||
let window = &*(handle as *const WindowRc);
|
||||
window.window_handle().set_component(component)
|
||||
}
|
||||
|
||||
/// Show a popup.
|
||||
#[no_mangle]
|
||||
pub unsafe extern "C" fn sixtyfps_component_window_show_popup(
|
||||
handle: *const ComponentWindowOpaque,
|
||||
pub unsafe extern "C" fn sixtyfps_windowrc_show_popup(
|
||||
handle: *const WindowRcOpaque,
|
||||
popup: &ComponentRc,
|
||||
position: crate::graphics::Point,
|
||||
) {
|
||||
let window = &*(handle as *const ComponentWindow);
|
||||
let window = &*(handle as *const WindowRc);
|
||||
window.window_handle().show_popup(popup, position);
|
||||
}
|
||||
/// Close the current popup
|
||||
pub unsafe extern "C" fn sixtyfps_component_window_close_popup(
|
||||
handle: *const ComponentWindowOpaque,
|
||||
) {
|
||||
let window = &*(handle as *const ComponentWindow);
|
||||
pub unsafe extern "C" fn sixtyfps_windowrc_close_popup(handle: *const WindowRcOpaque) {
|
||||
let window = &*(handle as *const WindowRc);
|
||||
window.window_handle().close_popup();
|
||||
}
|
||||
}
|
||||
|
|
|
@ -19,7 +19,7 @@ use sixtyfps_compilerlib::object_tree::ElementRc;
|
|||
use sixtyfps_corelib::layout::{self as core_layout};
|
||||
use sixtyfps_corelib::model::RepeatedComponent;
|
||||
use sixtyfps_corelib::slice::Slice;
|
||||
use sixtyfps_corelib::window::ComponentWindow;
|
||||
use sixtyfps_corelib::window::WindowRc;
|
||||
use std::convert::TryInto;
|
||||
|
||||
pub(crate) fn to_runtime(o: Orientation) -> core_layout::Orientation {
|
||||
|
@ -353,7 +353,7 @@ pub(crate) fn fill_layout_info_constraints(
|
|||
pub(crate) fn get_layout_info(
|
||||
elem: &ElementRc,
|
||||
component: InstanceRef,
|
||||
window: &ComponentWindow,
|
||||
window: &WindowRc,
|
||||
orientation: Orientation,
|
||||
) -> core_layout::LayoutInfo {
|
||||
let elem = elem.borrow();
|
||||
|
|
|
@ -409,18 +409,18 @@ pub extern "C" fn sixtyfps_interpreter_component_instance_show(
|
|||
/// Return a window for the component
|
||||
///
|
||||
/// The out pointer must be uninitialized and must be destroyed with
|
||||
/// sixtyfps_component_window_drop after usage
|
||||
/// sixtyfps_windowrc_drop after usage
|
||||
#[no_mangle]
|
||||
pub unsafe extern "C" fn sixtyfps_interpreter_component_instance_window(
|
||||
inst: &ErasedComponentBox,
|
||||
out: *mut sixtyfps_corelib::window::ffi::ComponentWindowOpaque,
|
||||
out: *mut sixtyfps_corelib::window::ffi::WindowRcOpaque,
|
||||
) {
|
||||
use sixtyfps_corelib::window::ComponentWindow;
|
||||
use sixtyfps_corelib::window::WindowRc;
|
||||
assert_eq!(
|
||||
core::mem::size_of::<ComponentWindow>(),
|
||||
core::mem::size_of::<sixtyfps_corelib::window::ffi::ComponentWindowOpaque>()
|
||||
core::mem::size_of::<WindowRc>(),
|
||||
core::mem::size_of::<sixtyfps_corelib::window::ffi::WindowRcOpaque>()
|
||||
);
|
||||
core::ptr::write(out as *mut ComponentWindow, inst.window().into())
|
||||
core::ptr::write(out as *mut WindowRc, inst.window().into())
|
||||
}
|
||||
|
||||
/// Instantiate an instance from a definition.
|
||||
|
|
|
@ -451,7 +451,7 @@ impl PlatformWindow for GraphicsWindow {
|
|||
match &*self.map_state.borrow() {
|
||||
GraphicsWindowBackendState::Unmapped => {
|
||||
// Nothing to be done if the window isn't visible. When it becomes visible,
|
||||
// ComponentWindow::show() calls update_window_properties()
|
||||
// corelib::window::Window::show() calls update_window_properties()
|
||||
}
|
||||
GraphicsWindowBackendState::Mapped(window) => {
|
||||
let backend = window.backend.borrow();
|
||||
|
|
|
@ -49,7 +49,7 @@ pub fn use_modules() -> usize {
|
|||
mod ffi {
|
||||
#[no_mangle]
|
||||
pub extern "C" fn sixtyfps_qt_get_widget(
|
||||
_: &sixtyfps_corelib::window::ComponentWindow,
|
||||
_: &sixtyfps_corelib::window::WindowRc,
|
||||
) -> *mut std::ffi::c_void {
|
||||
std::ptr::null_mut()
|
||||
}
|
||||
|
|
|
@ -1494,7 +1494,7 @@ pub(crate) mod ffi {
|
|||
|
||||
#[no_mangle]
|
||||
pub extern "C" fn sixtyfps_qt_get_widget(
|
||||
window: &sixtyfps_corelib::window::ComponentWindow,
|
||||
window: &sixtyfps_corelib::window::WindowRc,
|
||||
) -> *mut c_void {
|
||||
use sixtyfps_corelib::window::WindowHandleAccess;
|
||||
<dyn std::any::Any>::downcast_ref(window.window_handle().as_any())
|
||||
|
|
|
@ -35,7 +35,7 @@ use sixtyfps_corelib::item_rendering::{CachedRenderingData, ItemRenderer};
|
|||
use sixtyfps_corelib::items::{Item, ItemConsts, ItemRc, ItemVTable, VoidArg};
|
||||
use sixtyfps_corelib::layout::{LayoutInfo, Orientation};
|
||||
use sixtyfps_corelib::rtti::*;
|
||||
use sixtyfps_corelib::window::ComponentWindow;
|
||||
use sixtyfps_corelib::window::WindowRc;
|
||||
use sixtyfps_corelib::{
|
||||
declare_item_vtable, Callback, ItemVTable_static, Property, SharedString, SharedVector,
|
||||
};
|
||||
|
@ -165,7 +165,7 @@ pub struct NativeButton {
|
|||
}
|
||||
|
||||
impl Item for NativeButton {
|
||||
fn init(self: Pin<&Self>, _window: &ComponentWindow) {}
|
||||
fn init(self: Pin<&Self>, _window: &WindowRc) {}
|
||||
|
||||
fn geometry(self: Pin<&Self>) -> Rect {
|
||||
euclid::rect(self.x(), self.y(), self.width(), self.height())
|
||||
|
@ -174,7 +174,7 @@ impl Item for NativeButton {
|
|||
fn layouting_info(
|
||||
self: Pin<&Self>,
|
||||
orientation: Orientation,
|
||||
_window: &ComponentWindow,
|
||||
_window: &WindowRc,
|
||||
) -> LayoutInfo {
|
||||
let mut text: qttypes::QString = self.text().as_str().into();
|
||||
let size = cpp!(unsafe [
|
||||
|
@ -200,7 +200,7 @@ impl Item for NativeButton {
|
|||
fn input_event_filter_before_children(
|
||||
self: Pin<&Self>,
|
||||
_: MouseEvent,
|
||||
_window: &ComponentWindow,
|
||||
_window: &WindowRc,
|
||||
_self_rc: &ItemRc,
|
||||
) -> InputEventFilterResult {
|
||||
InputEventFilterResult::ForwardEvent
|
||||
|
@ -209,7 +209,7 @@ impl Item for NativeButton {
|
|||
fn input_event(
|
||||
self: Pin<&Self>,
|
||||
event: MouseEvent,
|
||||
_window: &ComponentWindow,
|
||||
_window: &WindowRc,
|
||||
_self_rc: &sixtyfps_corelib::items::ItemRc,
|
||||
) -> InputEventResult {
|
||||
let enabled = self.enabled();
|
||||
|
@ -237,11 +237,11 @@ impl Item for NativeButton {
|
|||
}
|
||||
}
|
||||
|
||||
fn key_event(self: Pin<&Self>, _: &KeyEvent, _window: &ComponentWindow) -> KeyEventResult {
|
||||
fn key_event(self: Pin<&Self>, _: &KeyEvent, _window: &WindowRc) -> KeyEventResult {
|
||||
KeyEventResult::EventIgnored
|
||||
}
|
||||
|
||||
fn focus_event(self: Pin<&Self>, _: &FocusEvent, _window: &ComponentWindow) {}
|
||||
fn focus_event(self: Pin<&Self>, _: &FocusEvent, _window: &WindowRc) {}
|
||||
|
||||
fn_render! { this dpr size painter =>
|
||||
let down: bool = this.pressed();
|
||||
|
@ -298,7 +298,7 @@ pub struct NativeCheckBox {
|
|||
}
|
||||
|
||||
impl Item for NativeCheckBox {
|
||||
fn init(self: Pin<&Self>, _window: &ComponentWindow) {}
|
||||
fn init(self: Pin<&Self>, _window: &WindowRc) {}
|
||||
|
||||
fn geometry(self: Pin<&Self>) -> Rect {
|
||||
euclid::rect(self.x(), self.y(), self.width(), self.height())
|
||||
|
@ -307,7 +307,7 @@ impl Item for NativeCheckBox {
|
|||
fn layouting_info(
|
||||
self: Pin<&Self>,
|
||||
orientation: Orientation,
|
||||
_window: &ComponentWindow,
|
||||
_window: &WindowRc,
|
||||
) -> LayoutInfo {
|
||||
let text: qttypes::QString = self.text().as_str().into();
|
||||
let size = cpp!(unsafe [
|
||||
|
@ -334,7 +334,7 @@ impl Item for NativeCheckBox {
|
|||
fn input_event_filter_before_children(
|
||||
self: Pin<&Self>,
|
||||
_: MouseEvent,
|
||||
_window: &ComponentWindow,
|
||||
_window: &WindowRc,
|
||||
_self_rc: &ItemRc,
|
||||
) -> InputEventFilterResult {
|
||||
InputEventFilterResult::ForwardEvent
|
||||
|
@ -343,7 +343,7 @@ impl Item for NativeCheckBox {
|
|||
fn input_event(
|
||||
self: Pin<&Self>,
|
||||
event: MouseEvent,
|
||||
_window: &ComponentWindow,
|
||||
_window: &WindowRc,
|
||||
_self_rc: &sixtyfps_corelib::items::ItemRc,
|
||||
) -> InputEventResult {
|
||||
if !self.enabled() {
|
||||
|
@ -356,11 +356,11 @@ impl Item for NativeCheckBox {
|
|||
InputEventResult::EventAccepted
|
||||
}
|
||||
|
||||
fn key_event(self: Pin<&Self>, _: &KeyEvent, _window: &ComponentWindow) -> KeyEventResult {
|
||||
fn key_event(self: Pin<&Self>, _: &KeyEvent, _window: &WindowRc) -> KeyEventResult {
|
||||
KeyEventResult::EventIgnored
|
||||
}
|
||||
|
||||
fn focus_event(self: Pin<&Self>, _: &FocusEvent, _window: &ComponentWindow) {}
|
||||
fn focus_event(self: Pin<&Self>, _: &FocusEvent, _window: &WindowRc) {}
|
||||
|
||||
fn_render! { this dpr size painter =>
|
||||
let checked: bool = this.checked();
|
||||
|
@ -447,7 +447,7 @@ void initQSpinBoxOptions(QStyleOptionSpinBox &option, bool pressed, bool enabled
|
|||
}}
|
||||
|
||||
impl Item for NativeSpinBox {
|
||||
fn init(self: Pin<&Self>, _window: &ComponentWindow) {}
|
||||
fn init(self: Pin<&Self>, _window: &WindowRc) {}
|
||||
|
||||
fn geometry(self: Pin<&Self>) -> Rect {
|
||||
euclid::rect(self.x(), self.y(), self.width(), self.height())
|
||||
|
@ -456,7 +456,7 @@ impl Item for NativeSpinBox {
|
|||
fn layouting_info(
|
||||
self: Pin<&Self>,
|
||||
orientation: Orientation,
|
||||
_window: &ComponentWindow,
|
||||
_window: &WindowRc,
|
||||
) -> LayoutInfo {
|
||||
//let value: i32 = self.value();
|
||||
let data = self.data();
|
||||
|
@ -495,7 +495,7 @@ impl Item for NativeSpinBox {
|
|||
fn input_event_filter_before_children(
|
||||
self: Pin<&Self>,
|
||||
_: MouseEvent,
|
||||
_window: &ComponentWindow,
|
||||
_window: &WindowRc,
|
||||
_self_rc: &ItemRc,
|
||||
) -> InputEventFilterResult {
|
||||
InputEventFilterResult::ForwardEvent
|
||||
|
@ -504,7 +504,7 @@ impl Item for NativeSpinBox {
|
|||
fn input_event(
|
||||
self: Pin<&Self>,
|
||||
event: MouseEvent,
|
||||
_window: &ComponentWindow,
|
||||
_window: &WindowRc,
|
||||
_self_rc: &sixtyfps_corelib::items::ItemRc,
|
||||
) -> InputEventResult {
|
||||
let size: qttypes::QSize = get_size!(self);
|
||||
|
@ -573,11 +573,11 @@ impl Item for NativeSpinBox {
|
|||
InputEventResult::EventAccepted
|
||||
}
|
||||
|
||||
fn key_event(self: Pin<&Self>, _: &KeyEvent, _window: &ComponentWindow) -> KeyEventResult {
|
||||
fn key_event(self: Pin<&Self>, _: &KeyEvent, _window: &WindowRc) -> KeyEventResult {
|
||||
KeyEventResult::EventIgnored
|
||||
}
|
||||
|
||||
fn focus_event(self: Pin<&Self>, _: &FocusEvent, _window: &ComponentWindow) {}
|
||||
fn focus_event(self: Pin<&Self>, _: &FocusEvent, _window: &WindowRc) {}
|
||||
|
||||
fn_render! { this dpr size painter =>
|
||||
let value: i32 = this.value();
|
||||
|
@ -665,7 +665,7 @@ void initQSliderOptions(QStyleOptionSlider &option, bool pressed, bool enabled,
|
|||
}}
|
||||
|
||||
impl Item for NativeSlider {
|
||||
fn init(self: Pin<&Self>, _window: &ComponentWindow) {}
|
||||
fn init(self: Pin<&Self>, _window: &WindowRc) {}
|
||||
|
||||
fn geometry(self: Pin<&Self>) -> Rect {
|
||||
euclid::rect(self.x(), self.y(), self.width(), self.height())
|
||||
|
@ -674,7 +674,7 @@ impl Item for NativeSlider {
|
|||
fn layouting_info(
|
||||
self: Pin<&Self>,
|
||||
orientation: Orientation,
|
||||
_window: &ComponentWindow,
|
||||
_window: &WindowRc,
|
||||
) -> LayoutInfo {
|
||||
let enabled = self.enabled();
|
||||
let value = self.value() as i32;
|
||||
|
@ -714,7 +714,7 @@ impl Item for NativeSlider {
|
|||
fn input_event_filter_before_children(
|
||||
self: Pin<&Self>,
|
||||
_: MouseEvent,
|
||||
_window: &ComponentWindow,
|
||||
_window: &WindowRc,
|
||||
_self_rc: &ItemRc,
|
||||
) -> InputEventFilterResult {
|
||||
InputEventFilterResult::ForwardEvent
|
||||
|
@ -723,7 +723,7 @@ impl Item for NativeSlider {
|
|||
fn input_event(
|
||||
self: Pin<&Self>,
|
||||
event: MouseEvent,
|
||||
_window: &ComponentWindow,
|
||||
_window: &WindowRc,
|
||||
_self_rc: &sixtyfps_corelib::items::ItemRc,
|
||||
) -> InputEventResult {
|
||||
let size: qttypes::QSize = get_size!(self);
|
||||
|
@ -788,11 +788,11 @@ impl Item for NativeSlider {
|
|||
result
|
||||
}
|
||||
|
||||
fn key_event(self: Pin<&Self>, _: &KeyEvent, _window: &ComponentWindow) -> KeyEventResult {
|
||||
fn key_event(self: Pin<&Self>, _: &KeyEvent, _window: &WindowRc) -> KeyEventResult {
|
||||
KeyEventResult::EventIgnored
|
||||
}
|
||||
|
||||
fn focus_event(self: Pin<&Self>, _: &FocusEvent, _window: &ComponentWindow) {}
|
||||
fn focus_event(self: Pin<&Self>, _: &FocusEvent, _window: &WindowRc) {}
|
||||
|
||||
fn_render! { this dpr size painter =>
|
||||
let enabled = this.enabled();
|
||||
|
@ -858,7 +858,7 @@ struct GroupBoxData {
|
|||
}
|
||||
|
||||
impl Item for NativeGroupBox {
|
||||
fn init(self: Pin<&Self>, _window: &ComponentWindow) {
|
||||
fn init(self: Pin<&Self>, _window: &WindowRc) {
|
||||
let shared_data = Rc::pin(GroupBoxData::default());
|
||||
|
||||
Property::link_two_way(
|
||||
|
@ -951,7 +951,7 @@ impl Item for NativeGroupBox {
|
|||
fn layouting_info(
|
||||
self: Pin<&Self>,
|
||||
orientation: Orientation,
|
||||
_window: &ComponentWindow,
|
||||
_window: &WindowRc,
|
||||
) -> LayoutInfo {
|
||||
LayoutInfo {
|
||||
min: match orientation {
|
||||
|
@ -966,7 +966,7 @@ impl Item for NativeGroupBox {
|
|||
fn input_event_filter_before_children(
|
||||
self: Pin<&Self>,
|
||||
_: MouseEvent,
|
||||
_window: &ComponentWindow,
|
||||
_window: &WindowRc,
|
||||
_self_rc: &ItemRc,
|
||||
) -> InputEventFilterResult {
|
||||
InputEventFilterResult::ForwardEvent
|
||||
|
@ -975,17 +975,17 @@ impl Item for NativeGroupBox {
|
|||
fn input_event(
|
||||
self: Pin<&Self>,
|
||||
_: MouseEvent,
|
||||
_window: &ComponentWindow,
|
||||
_window: &WindowRc,
|
||||
_self_rc: &sixtyfps_corelib::items::ItemRc,
|
||||
) -> InputEventResult {
|
||||
InputEventResult::EventIgnored
|
||||
}
|
||||
|
||||
fn key_event(self: Pin<&Self>, _: &KeyEvent, _window: &ComponentWindow) -> KeyEventResult {
|
||||
fn key_event(self: Pin<&Self>, _: &KeyEvent, _window: &WindowRc) -> KeyEventResult {
|
||||
KeyEventResult::EventIgnored
|
||||
}
|
||||
|
||||
fn focus_event(self: Pin<&Self>, _: &FocusEvent, _window: &ComponentWindow) {}
|
||||
fn focus_event(self: Pin<&Self>, _: &FocusEvent, _window: &WindowRc) {}
|
||||
|
||||
fn_render! { this dpr size painter =>
|
||||
let text: qttypes::QString =
|
||||
|
@ -1047,7 +1047,7 @@ pub struct NativeLineEdit {
|
|||
}
|
||||
|
||||
impl Item for NativeLineEdit {
|
||||
fn init(self: Pin<&Self>, _window: &ComponentWindow) {
|
||||
fn init(self: Pin<&Self>, _window: &WindowRc) {
|
||||
let paddings = Rc::pin(Property::default());
|
||||
|
||||
paddings.as_ref().set_binding(move || {
|
||||
|
@ -1098,7 +1098,7 @@ impl Item for NativeLineEdit {
|
|||
fn layouting_info(
|
||||
self: Pin<&Self>,
|
||||
orientation: Orientation,
|
||||
_window: &ComponentWindow,
|
||||
_window: &WindowRc,
|
||||
) -> LayoutInfo {
|
||||
LayoutInfo {
|
||||
min: match orientation {
|
||||
|
@ -1113,7 +1113,7 @@ impl Item for NativeLineEdit {
|
|||
fn input_event_filter_before_children(
|
||||
self: Pin<&Self>,
|
||||
_: MouseEvent,
|
||||
_window: &ComponentWindow,
|
||||
_window: &WindowRc,
|
||||
_self_rc: &ItemRc,
|
||||
) -> InputEventFilterResult {
|
||||
InputEventFilterResult::ForwardAndIgnore
|
||||
|
@ -1122,17 +1122,17 @@ impl Item for NativeLineEdit {
|
|||
fn input_event(
|
||||
self: Pin<&Self>,
|
||||
_: MouseEvent,
|
||||
_window: &ComponentWindow,
|
||||
_window: &WindowRc,
|
||||
_self_rc: &sixtyfps_corelib::items::ItemRc,
|
||||
) -> InputEventResult {
|
||||
InputEventResult::EventIgnored
|
||||
}
|
||||
|
||||
fn key_event(self: Pin<&Self>, _: &KeyEvent, _window: &ComponentWindow) -> KeyEventResult {
|
||||
fn key_event(self: Pin<&Self>, _: &KeyEvent, _window: &WindowRc) -> KeyEventResult {
|
||||
KeyEventResult::EventIgnored
|
||||
}
|
||||
|
||||
fn focus_event(self: Pin<&Self>, _: &FocusEvent, _window: &ComponentWindow) {}
|
||||
fn focus_event(self: Pin<&Self>, _: &FocusEvent, _window: &WindowRc) {}
|
||||
|
||||
fn_render! { this dpr size painter =>
|
||||
let focused: bool = this.focused();
|
||||
|
@ -1193,7 +1193,7 @@ pub struct NativeScrollView {
|
|||
}
|
||||
|
||||
impl Item for NativeScrollView {
|
||||
fn init(self: Pin<&Self>, _window: &ComponentWindow) {
|
||||
fn init(self: Pin<&Self>, _window: &WindowRc) {
|
||||
let paddings = Rc::pin(Property::default());
|
||||
|
||||
paddings.as_ref().set_binding(move || {
|
||||
|
@ -1254,7 +1254,7 @@ impl Item for NativeScrollView {
|
|||
fn layouting_info(
|
||||
self: Pin<&Self>,
|
||||
orientation: Orientation,
|
||||
_window: &ComponentWindow,
|
||||
_window: &WindowRc,
|
||||
) -> LayoutInfo {
|
||||
LayoutInfo {
|
||||
min: match orientation {
|
||||
|
@ -1269,7 +1269,7 @@ impl Item for NativeScrollView {
|
|||
fn input_event_filter_before_children(
|
||||
self: Pin<&Self>,
|
||||
_: MouseEvent,
|
||||
_window: &ComponentWindow,
|
||||
_window: &WindowRc,
|
||||
_self_rc: &ItemRc,
|
||||
) -> InputEventFilterResult {
|
||||
InputEventFilterResult::ForwardEvent
|
||||
|
@ -1278,7 +1278,7 @@ impl Item for NativeScrollView {
|
|||
fn input_event(
|
||||
self: Pin<&Self>,
|
||||
event: MouseEvent,
|
||||
_window: &ComponentWindow,
|
||||
_window: &WindowRc,
|
||||
_self_rc: &sixtyfps_corelib::items::ItemRc,
|
||||
) -> InputEventResult {
|
||||
let size: qttypes::QSize = get_size!(self);
|
||||
|
@ -1422,11 +1422,11 @@ impl Item for NativeScrollView {
|
|||
}
|
||||
}
|
||||
|
||||
fn key_event(self: Pin<&Self>, _: &KeyEvent, _window: &ComponentWindow) -> KeyEventResult {
|
||||
fn key_event(self: Pin<&Self>, _: &KeyEvent, _window: &WindowRc) -> KeyEventResult {
|
||||
KeyEventResult::EventIgnored
|
||||
}
|
||||
|
||||
fn focus_event(self: Pin<&Self>, _: &FocusEvent, _window: &ComponentWindow) {}
|
||||
fn focus_event(self: Pin<&Self>, _: &FocusEvent, _window: &WindowRc) {}
|
||||
|
||||
fn_render! { this dpr size painter =>
|
||||
|
||||
|
@ -1558,7 +1558,7 @@ pub struct NativeStandardListViewItem {
|
|||
}
|
||||
|
||||
impl Item for NativeStandardListViewItem {
|
||||
fn init(self: Pin<&Self>, _window: &ComponentWindow) {}
|
||||
fn init(self: Pin<&Self>, _window: &WindowRc) {}
|
||||
|
||||
fn geometry(self: Pin<&Self>) -> Rect {
|
||||
euclid::rect(self.x(), self.y(), self.width(), self.height())
|
||||
|
@ -1567,7 +1567,7 @@ impl Item for NativeStandardListViewItem {
|
|||
fn layouting_info(
|
||||
self: Pin<&Self>,
|
||||
orientation: Orientation,
|
||||
_window: &ComponentWindow,
|
||||
_window: &WindowRc,
|
||||
) -> LayoutInfo {
|
||||
let index: i32 = self.index();
|
||||
let item = self.item();
|
||||
|
@ -1604,7 +1604,7 @@ impl Item for NativeStandardListViewItem {
|
|||
fn input_event_filter_before_children(
|
||||
self: Pin<&Self>,
|
||||
_: MouseEvent,
|
||||
_window: &ComponentWindow,
|
||||
_window: &WindowRc,
|
||||
_self_rc: &ItemRc,
|
||||
) -> InputEventFilterResult {
|
||||
InputEventFilterResult::ForwardAndIgnore
|
||||
|
@ -1613,17 +1613,17 @@ impl Item for NativeStandardListViewItem {
|
|||
fn input_event(
|
||||
self: Pin<&Self>,
|
||||
_event: MouseEvent,
|
||||
_window: &ComponentWindow,
|
||||
_window: &WindowRc,
|
||||
_self_rc: &sixtyfps_corelib::items::ItemRc,
|
||||
) -> InputEventResult {
|
||||
InputEventResult::EventIgnored
|
||||
}
|
||||
|
||||
fn key_event(self: Pin<&Self>, _: &KeyEvent, _window: &ComponentWindow) -> KeyEventResult {
|
||||
fn key_event(self: Pin<&Self>, _: &KeyEvent, _window: &WindowRc) -> KeyEventResult {
|
||||
KeyEventResult::EventIgnored
|
||||
}
|
||||
|
||||
fn focus_event(self: Pin<&Self>, _: &FocusEvent, _window: &ComponentWindow) {}
|
||||
fn focus_event(self: Pin<&Self>, _: &FocusEvent, _window: &WindowRc) {}
|
||||
|
||||
fn_render! { this dpr size painter =>
|
||||
let index: i32 = this.index();
|
||||
|
@ -1685,7 +1685,7 @@ pub struct NativeComboBox {
|
|||
}
|
||||
|
||||
impl Item for NativeComboBox {
|
||||
fn init(self: Pin<&Self>, _window: &ComponentWindow) {}
|
||||
fn init(self: Pin<&Self>, _window: &WindowRc) {}
|
||||
|
||||
fn geometry(self: Pin<&Self>) -> Rect {
|
||||
euclid::rect(self.x(), self.y(), self.width(), self.height())
|
||||
|
@ -1694,7 +1694,7 @@ impl Item for NativeComboBox {
|
|||
fn layouting_info(
|
||||
self: Pin<&Self>,
|
||||
orientation: Orientation,
|
||||
_window: &ComponentWindow,
|
||||
_window: &WindowRc,
|
||||
) -> LayoutInfo {
|
||||
let size = cpp!(unsafe [] -> qttypes::QSize as "QSize" {
|
||||
ensure_initialized();
|
||||
|
@ -1716,7 +1716,7 @@ impl Item for NativeComboBox {
|
|||
fn input_event_filter_before_children(
|
||||
self: Pin<&Self>,
|
||||
_: MouseEvent,
|
||||
_window: &ComponentWindow,
|
||||
_window: &WindowRc,
|
||||
_self_rc: &ItemRc,
|
||||
) -> InputEventFilterResult {
|
||||
InputEventFilterResult::ForwardEvent
|
||||
|
@ -1725,7 +1725,7 @@ impl Item for NativeComboBox {
|
|||
fn input_event(
|
||||
self: Pin<&Self>,
|
||||
event: MouseEvent,
|
||||
_window: &ComponentWindow,
|
||||
_window: &WindowRc,
|
||||
_self_rc: &sixtyfps_corelib::items::ItemRc,
|
||||
) -> InputEventResult {
|
||||
let enabled = self.enabled();
|
||||
|
@ -1755,11 +1755,11 @@ impl Item for NativeComboBox {
|
|||
}
|
||||
}
|
||||
|
||||
fn key_event(self: Pin<&Self>, _: &KeyEvent, _window: &ComponentWindow) -> KeyEventResult {
|
||||
fn key_event(self: Pin<&Self>, _: &KeyEvent, _window: &WindowRc) -> KeyEventResult {
|
||||
KeyEventResult::EventIgnored
|
||||
}
|
||||
|
||||
fn focus_event(self: Pin<&Self>, _: &FocusEvent, _window: &ComponentWindow) {}
|
||||
fn focus_event(self: Pin<&Self>, _: &FocusEvent, _window: &WindowRc) {}
|
||||
|
||||
fn_render! { this dpr size painter =>
|
||||
let down: bool = this.pressed();
|
||||
|
|
|
@ -93,7 +93,7 @@ fn gen_corelib(root_dir: &Path, include_dir: &Path) -> anyhow::Result<()> {
|
|||
config.export.include = [
|
||||
"ComponentVTable",
|
||||
"Slice",
|
||||
"ComponentWindowOpaque",
|
||||
"WindowRcOpaque",
|
||||
"PropertyAnimation",
|
||||
"EasingCurve",
|
||||
"TextHorizontalAlignment",
|
||||
|
@ -127,7 +127,7 @@ fn gen_corelib(root_dir: &Path, include_dir: &Path) -> anyhow::Result<()> {
|
|||
"sixtyfps_property_listener_scope_is_dirty",
|
||||
"PropertyTrackerOpaque",
|
||||
"CallbackOpaque",
|
||||
"ComponentWindow",
|
||||
"WindowRc",
|
||||
"VoidArg",
|
||||
"KeyEventArg",
|
||||
"sixtyfps_color_brighter",
|
||||
|
@ -215,16 +215,16 @@ fn gen_corelib(root_dir: &Path, include_dir: &Path) -> anyhow::Result<()> {
|
|||
special_config.export.include = rust_types.iter().map(|s| s.to_string()).collect();
|
||||
special_config.export.exclude = [
|
||||
"sixtyfps_visit_item_tree",
|
||||
"sixtyfps_component_window_drop",
|
||||
"sixtyfps_component_window_clone",
|
||||
"sixtyfps_component_window_show",
|
||||
"sixtyfps_component_window_hide",
|
||||
"sixtyfps_component_window_get_scale_factor",
|
||||
"sixtyfps_component_window_set_scale_factor",
|
||||
"sixtyfps_component_window_free_graphics_resources",
|
||||
"sixtyfps_component_window_set_focus_item",
|
||||
"sixtyfps_component_window_set_component",
|
||||
"sixtyfps_component_window_show_popup",
|
||||
"sixtyfps_windowrc_drop",
|
||||
"sixtyfps_windowrc_clone",
|
||||
"sixtyfps_windowrc_show",
|
||||
"sixtyfps_windowrc_hide",
|
||||
"sixtyfps_windowrc_get_scale_factor",
|
||||
"sixtyfps_windowrc_set_scale_factor",
|
||||
"sixtyfps_windowrc_free_graphics_resources",
|
||||
"sixtyfps_windowrc_set_focus_item",
|
||||
"sixtyfps_windowrc_set_component",
|
||||
"sixtyfps_windowrc_show_popup",
|
||||
"sixtyfps_new_path_elements",
|
||||
"sixtyfps_new_path_events",
|
||||
"sixtyfps_color_brighter",
|
||||
|
@ -309,8 +309,8 @@ fn gen_corelib(root_dir: &Path, include_dir: &Path) -> anyhow::Result<()> {
|
|||
.with_after_include(format!(
|
||||
r"
|
||||
namespace sixtyfps {{
|
||||
namespace private_api {{ enum class VersionCheck {{ Major = {}, Minor = {}, Patch = {} }}; class ComponentWindow; }}
|
||||
namespace cbindgen_private {{ using sixtyfps::private_api::ComponentWindow; using namespace vtable; struct KeyEvent; using private_api::Property; using private_api::PathData; }}
|
||||
namespace private_api {{ enum class VersionCheck {{ Major = {}, Minor = {}, Patch = {} }}; class WindowRc; }}
|
||||
namespace cbindgen_private {{ using sixtyfps::private_api::WindowRc; using namespace vtable; struct KeyEvent; using private_api::Property; using private_api::PathData; }}
|
||||
}}",
|
||||
0, 1, 0,
|
||||
))
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue