mirror of
https://github.com/slint-ui/slint.git
synced 2025-10-01 14:21:16 +00:00
Struct exposed to .60 as struct need to be layed out in alphabetical order
because that's the order in which the C++ code generator pass the argument to the agregate initialization
This commit is contained in:
parent
dedc9b3b9b
commit
619ce6c4f7
3 changed files with 12 additions and 14 deletions
|
@ -379,10 +379,10 @@ using cbindgen_private::sixtyfps_solve_path_layout;
|
||||||
inline LayoutInfo LayoutInfo::merge(const LayoutInfo &other) const
|
inline LayoutInfo LayoutInfo::merge(const LayoutInfo &other) const
|
||||||
{
|
{
|
||||||
// Note: This "logic" is duplicated from LayoutInfo::merge in layout.rs.
|
// Note: This "logic" is duplicated from LayoutInfo::merge in layout.rs.
|
||||||
return LayoutInfo { std::max(min, other.min),
|
return LayoutInfo { std::min(max, other.max),
|
||||||
std::min(max, other.max),
|
|
||||||
std::max(min_percent, other.min_percent),
|
|
||||||
std::min(max_percent, other.max_percent),
|
std::min(max_percent, other.max_percent),
|
||||||
|
std::max(min, other.min),
|
||||||
|
std::max(min_percent, other.min_percent),
|
||||||
std::max(preferred, other.preferred),
|
std::max(preferred, other.preferred),
|
||||||
std::min(stretch, other.stretch) };
|
std::min(stretch, other.stretch) };
|
||||||
}
|
}
|
||||||
|
|
|
@ -198,10 +198,10 @@ pub struct KeyboardModifiers {
|
||||||
pub alt: bool,
|
pub alt: bool,
|
||||||
/// Indicates the control key on a keyboard.
|
/// Indicates the control key on a keyboard.
|
||||||
pub control: bool,
|
pub control: bool,
|
||||||
/// Indicates the shift key on a keyboard.
|
|
||||||
pub shift: bool,
|
|
||||||
/// Indicates the logo key on macOS and the windows key on Windows.
|
/// Indicates the logo key on macOS and the windows key on Windows.
|
||||||
pub meta: bool,
|
pub meta: bool,
|
||||||
|
/// Indicates the shift key on a keyboard.
|
||||||
|
pub shift: bool,
|
||||||
}
|
}
|
||||||
|
|
||||||
#[derive(Debug, Clone, PartialEq, strum_macros::EnumString, strum_macros::Display)]
|
#[derive(Debug, Clone, PartialEq, strum_macros::EnumString, strum_macros::Display)]
|
||||||
|
@ -224,10 +224,10 @@ impl Default for KeyEventType {
|
||||||
#[derive(Debug, Clone, PartialEq, Default)]
|
#[derive(Debug, Clone, PartialEq, Default)]
|
||||||
#[repr(C)]
|
#[repr(C)]
|
||||||
pub struct KeyEvent {
|
pub struct KeyEvent {
|
||||||
/// The unicode representation of the key pressed.
|
|
||||||
pub text: SharedString,
|
|
||||||
/// The keyboard modifiers active at the time of the key press event.
|
/// The keyboard modifiers active at the time of the key press event.
|
||||||
pub modifiers: KeyboardModifiers,
|
pub modifiers: KeyboardModifiers,
|
||||||
|
/// The unicode representation of the key pressed.
|
||||||
|
pub text: SharedString,
|
||||||
/// Indicates whether the key was pressed or released
|
/// Indicates whether the key was pressed or released
|
||||||
pub event_type: KeyEventType,
|
pub event_type: KeyEventType,
|
||||||
}
|
}
|
||||||
|
|
|
@ -25,22 +25,20 @@ type Coord = f32;
|
||||||
|
|
||||||
/// The constraint that applies to an item
|
/// The constraint that applies to an item
|
||||||
// NOTE: when adding new fields, the C++ operator== also need updates
|
// NOTE: when adding new fields, the C++ operator== also need updates
|
||||||
|
// Also, the field needs to be in alphabetical order because how the generated code sort fields for struct
|
||||||
#[repr(C)]
|
#[repr(C)]
|
||||||
#[derive(Clone, Copy, Debug, PartialEq)]
|
#[derive(Clone, Copy, Debug, PartialEq)]
|
||||||
pub struct LayoutInfo {
|
pub struct LayoutInfo {
|
||||||
/// The minimum size for this item.
|
|
||||||
pub min: f32,
|
|
||||||
/// The maximum size for the item.
|
/// The maximum size for the item.
|
||||||
pub max: f32,
|
pub max: f32,
|
||||||
|
|
||||||
/// The minimum size in percentage of the parent (value between 0 and 100).
|
|
||||||
pub min_percent: f32,
|
|
||||||
/// The maximum size in percentage of the parent (value between 0 and 100).
|
/// The maximum size in percentage of the parent (value between 0 and 100).
|
||||||
pub max_percent: f32,
|
pub max_percent: f32,
|
||||||
|
/// The minimum size for this item.
|
||||||
|
pub min: f32,
|
||||||
|
/// The minimum size in percentage of the parent (value between 0 and 100).
|
||||||
|
pub min_percent: f32,
|
||||||
/// the preferred size
|
/// the preferred size
|
||||||
pub preferred: f32,
|
pub preferred: f32,
|
||||||
|
|
||||||
/// the stretch factor
|
/// the stretch factor
|
||||||
pub stretch: f32,
|
pub stretch: f32,
|
||||||
}
|
}
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue