use crate::GraphRenderer;
use glib::{
prelude::*,
signal::{connect_raw, SignalHandlerId},
translate::*,
};
use std::{boxed::Box as Box_, fmt, mem::transmute};
glib::wrapper! {
#[doc(alias = "DzlGraphLineRenderer")]
pub struct GraphLineRenderer(Object<ffi::DzlGraphLineRenderer, ffi::DzlGraphLineRendererClass>) @implements GraphRenderer;
match fn {
type_ => || ffi::dzl_graph_view_line_renderer_get_type(),
}
}
impl GraphLineRenderer {
#[doc(alias = "dzl_graph_view_line_renderer_new")]
pub fn new() -> GraphLineRenderer {
assert_initialized_main_thread!();
unsafe { from_glib_full(ffi::dzl_graph_view_line_renderer_new()) }
}
#[doc(alias = "dzl_graph_view_line_renderer_get_stroke_color_rgba")]
#[doc(alias = "get_stroke_color_rgba")]
pub fn stroke_color_rgba(&self) -> Option<gdk::RGBA> {
unsafe {
from_glib_none(ffi::dzl_graph_view_line_renderer_get_stroke_color_rgba(
self.to_glib_none().0,
))
}
}
#[doc(alias = "dzl_graph_view_line_renderer_set_stroke_color")]
pub fn set_stroke_color(&self, stroke_color: &str) {
unsafe {
ffi::dzl_graph_view_line_renderer_set_stroke_color(
self.to_glib_none().0,
stroke_color.to_glib_none().0,
);
}
}
#[doc(alias = "dzl_graph_view_line_renderer_set_stroke_color_rgba")]
pub fn set_stroke_color_rgba(&self, stroke_color_rgba: &gdk::RGBA) {
unsafe {
ffi::dzl_graph_view_line_renderer_set_stroke_color_rgba(
self.to_glib_none().0,
stroke_color_rgba.to_glib_none().0,
);
}
}
pub fn column(&self) -> u32 {
ObjectExt::property(self, "column")
}
pub fn set_column(&self, column: u32) {
ObjectExt::set_property(self, "column", column)
}
#[doc(alias = "line-width")]
pub fn line_width(&self) -> f64 {
ObjectExt::property(self, "line-width")
}
#[doc(alias = "line-width")]
pub fn set_line_width(&self, line_width: f64) {
ObjectExt::set_property(self, "line-width", line_width)
}
#[doc(alias = "stroke-color")]
pub fn stroke_color(&self) -> Option<glib::GString> {
ObjectExt::property(self, "stroke-color")
}
#[doc(alias = "column")]
pub fn connect_column_notify<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId {
unsafe extern "C" fn notify_column_trampoline<F: Fn(&GraphLineRenderer) + 'static>(
this: *mut ffi::DzlGraphLineRenderer,
_param_spec: glib::ffi::gpointer,
f: glib::ffi::gpointer,
) {
let f: &F = &*(f as *const F);
f(&from_glib_borrow(this))
}
unsafe {
let f: Box_<F> = Box_::new(f);
connect_raw(
self.as_ptr() as *mut _,
b"notify::column\0".as_ptr() as *const _,
Some(transmute::<_, unsafe extern "C" fn()>(
notify_column_trampoline::<F> as *const (),
)),
Box_::into_raw(f),
)
}
}
#[doc(alias = "line-width")]
pub fn connect_line_width_notify<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId {
unsafe extern "C" fn notify_line_width_trampoline<F: Fn(&GraphLineRenderer) + 'static>(
this: *mut ffi::DzlGraphLineRenderer,
_param_spec: glib::ffi::gpointer,
f: glib::ffi::gpointer,
) {
let f: &F = &*(f as *const F);
f(&from_glib_borrow(this))
}
unsafe {
let f: Box_<F> = Box_::new(f);
connect_raw(
self.as_ptr() as *mut _,
b"notify::line-width\0".as_ptr() as *const _,
Some(transmute::<_, unsafe extern "C" fn()>(
notify_line_width_trampoline::<F> as *const (),
)),
Box_::into_raw(f),
)
}
}
#[doc(alias = "stroke-color")]
pub fn connect_stroke_color_notify<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId {
unsafe extern "C" fn notify_stroke_color_trampoline<F: Fn(&GraphLineRenderer) + 'static>(
this: *mut ffi::DzlGraphLineRenderer,
_param_spec: glib::ffi::gpointer,
f: glib::ffi::gpointer,
) {
let f: &F = &*(f as *const F);
f(&from_glib_borrow(this))
}
unsafe {
let f: Box_<F> = Box_::new(f);
connect_raw(
self.as_ptr() as *mut _,
b"notify::stroke-color\0".as_ptr() as *const _,
Some(transmute::<_, unsafe extern "C" fn()>(
notify_stroke_color_trampoline::<F> as *const (),
)),
Box_::into_raw(f),
)
}
}
#[doc(alias = "stroke-color-rgba")]
pub fn connect_stroke_color_rgba_notify<F: Fn(&Self) + 'static>(
&self,
f: F,
) -> SignalHandlerId {
unsafe extern "C" fn notify_stroke_color_rgba_trampoline<
F: Fn(&GraphLineRenderer) + 'static,
>(
this: *mut ffi::DzlGraphLineRenderer,
_param_spec: glib::ffi::gpointer,
f: glib::ffi::gpointer,
) {
let f: &F = &*(f as *const F);
f(&from_glib_borrow(this))
}
unsafe {
let f: Box_<F> = Box_::new(f);
connect_raw(
self.as_ptr() as *mut _,
b"notify::stroke-color-rgba\0".as_ptr() as *const _,
Some(transmute::<_, unsafe extern "C" fn()>(
notify_stroke_color_rgba_trampoline::<F> as *const (),
)),
Box_::into_raw(f),
)
}
}
}
impl Default for GraphLineRenderer {
fn default() -> Self {
Self::new()
}
}
impl fmt::Display for GraphLineRenderer {
fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
f.write_str("GraphLineRenderer")
}
}