forked from vitrine/wmaker
Reimplment the WMCreateCommandButton macro in Rust.
This is a macro in C, and it would be helpful to be able to do the same thing in Rust. It is simply ported over as a Rust function.
This commit is contained in:
@@ -2,6 +2,7 @@ AUTOMAKE_OPTIONS =
|
||||
|
||||
RUST_SOURCES = \
|
||||
src/WINGsP.rs \
|
||||
src/button.rs \
|
||||
src/configuration.rs \
|
||||
src/font.rs \
|
||||
src/lib.rs \
|
||||
|
||||
21
WINGs/wings-rs/src/button.rs
Normal file
21
WINGs/wings-rs/src/button.rs
Normal file
@@ -0,0 +1,21 @@
|
||||
pub mod ffi {
|
||||
use crate::WINGsP::*;
|
||||
|
||||
/// Creates a button like an "Ok" button to dismiss a dialog.
|
||||
///
|
||||
/// ## Rust rewrite notes
|
||||
///
|
||||
/// This was originally a macro.
|
||||
#[unsafe(no_mangle)]
|
||||
pub unsafe extern "C" fn WMCreateCommandButton(parent: *mut WMWidget) -> *mut WMButton {
|
||||
unsafe {
|
||||
WMCreateCustomButton(
|
||||
parent,
|
||||
(WMButtonBehaviorMask_WBBSpringLoadedMask
|
||||
| WMButtonBehaviorMask_WBBPushInMask
|
||||
| WMButtonBehaviorMask_WBBPushLightMask
|
||||
| WMButtonBehaviorMask_WBBPushChangeMask) as i32,
|
||||
)
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -3,6 +3,7 @@
|
||||
#[allow(non_snake_case)]
|
||||
#[allow(non_upper_case_globals)]
|
||||
pub mod WINGsP;
|
||||
pub mod button;
|
||||
pub mod configuration;
|
||||
pub mod font;
|
||||
pub(crate) mod pango_extras;
|
||||
|
||||
Reference in New Issue
Block a user