Merge branch 'style_better' into 'master'
Style better See merge request Librem5/squeekboard!180
This commit is contained in:
@ -480,6 +480,7 @@ fn create_button(
|
||||
|
||||
::layout::Button {
|
||||
name: cname,
|
||||
outline_name: CString::new(outline_name).expect("Bad outline"),
|
||||
// TODO: do layout before creating buttons
|
||||
bounds: ::layout::c::Bounds {
|
||||
x: outline.bounds.x,
|
||||
|
||||
@ -32,6 +32,7 @@ EekBounds squeek_button_get_bounds(const struct squeek_button*);
|
||||
const char *squeek_button_get_label(const struct squeek_button*);
|
||||
const char *squeek_button_get_icon_name(const struct squeek_button*);
|
||||
const char *squeek_button_get_name(const struct squeek_button*);
|
||||
const char *squeek_button_get_outline_name(const struct squeek_button*);
|
||||
|
||||
struct squeek_key *squeek_button_get_key(const struct squeek_button*);
|
||||
uint32_t *squeek_button_has_key(const struct squeek_button* button,
|
||||
|
||||
@ -40,11 +40,6 @@ pub mod c {
|
||||
#[repr(transparent)]
|
||||
pub struct UserData(*const c_void);
|
||||
|
||||
/// The index in the relevant outline table
|
||||
#[repr(C)]
|
||||
#[derive(Clone, Debug)]
|
||||
pub struct OutlineRef(u32);
|
||||
|
||||
/// Defined in eek-types.h
|
||||
#[repr(C)]
|
||||
#[derive(Clone, Debug)]
|
||||
@ -194,6 +189,13 @@ pub mod c {
|
||||
let button = unsafe { &*button };
|
||||
button.name.as_ptr()
|
||||
}
|
||||
|
||||
#[no_mangle]
|
||||
pub extern "C"
|
||||
fn squeek_button_get_outline_name(button: *const Button) -> *const c_char {
|
||||
let button = unsafe { &*button };
|
||||
button.outline_name.as_ptr()
|
||||
}
|
||||
|
||||
#[no_mangle]
|
||||
pub extern "C"
|
||||
@ -509,6 +511,7 @@ pub mod c {
|
||||
bounds: c::Bounds {
|
||||
x: 0f64, y: 0f64, width: 0f64, height: 0f64
|
||||
},
|
||||
outline_name: CString::new("test").unwrap(),
|
||||
label: Label::Text(CString::new(name).unwrap()),
|
||||
state: state,
|
||||
})
|
||||
@ -571,6 +574,8 @@ pub struct Button {
|
||||
/// TODO: position the buttons before they get initial bounds
|
||||
/// Position relative to some origin (i.e. parent/row)
|
||||
pub bounds: c::Bounds,
|
||||
/// The name of the visual class applied
|
||||
pub outline_name: CString,
|
||||
/// current state, shared with other buttons
|
||||
pub state: Rc<RefCell<KeyState>>,
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user