}
+/* -------------------------------- Splitpane -------------------------------- */
+
+pub type SplitpaneCreate = fn(*mut UiObject, *const UiSplitPaneArgs );
+
+pub struct SplitPaneBuilder<'a> {
+ args: *mut UiSplitPaneArgs,
+ obj: &'a mut toolkit::UiObject,
+ create: SplitpaneCreate
+}
+
+fn hsplitpane_create(obj: *mut UiObject, args: *const UiSplitPaneArgs) {
+ unsafe {
+ ui_hsplitpane_create(obj, args);
+ }
+}
+
+fn vsplitpane_create(obj: *mut UiObject, args: *const UiSplitPaneArgs) {
+ unsafe {
+ ui_vsplitpane_create(obj, args);
+ }
+}
+
+
+impl toolkit::UiObject {
+ container_fn!(hsplitpane, hsplitpane_builder, SplitPaneBuilder);
+ container_fn!(vsplitpane, vsplitpane_builder, SplitPaneBuilder);
+
+ pub fn hsplitpane_builder(&mut self) -> SplitPaneBuilder<'_>
+ {
+ unsafe {
+ let args = ui_splitpane_args_new();
+ SplitPaneBuilder {
+ args,
+ obj: self,
+ create: hsplitpane_create
+ }
+ }
+ }
+
+ pub fn vsplitpane_builder(&mut self) -> SplitPaneBuilder<'_>
+ {
+ unsafe {
+ let args = ui_splitpane_args_new();
+ SplitPaneBuilder {
+ args,
+ obj: self,
+ create: vsplitpane_create
+ }
+ }
+ }
+}
+
+impl<'a> SplitPaneBuilder<'a> {
+ pub fn create<F>(&mut self, create_ui: F)
+ where F: FnOnce(&mut toolkit::UiObject) {
+ (self.create)(self.obj.ptr, self.args);
+ create_ui(self.obj);
+ unsafe {
+ ui_container_begin_close(self.obj.ptr);
+ ui_container_finish(self.obj.ptr);
+ }
+ }
+
+ pub fn fill(&mut self, fill: bool) -> &mut Self {
+ unsafe {
+ ui_splitpane_args_set_fill(self.args, if fill { 1 } else { 0 });
+ }
+ self
+ }
+
+ pub fn hexpand(&mut self, value: bool) -> &mut Self {
+ unsafe {
+ ui_splitpane_args_set_hexpand(self.args, if value { 1 } else { 0 });
+ }
+ self
+ }
+
+ pub fn vexpand(&mut self, value: bool) -> &mut Self {
+ unsafe {
+ ui_splitpane_args_set_vexpand(self.args, if value { 1 } else { 0 });
+ }
+ self
+ }
+
+ pub fn hfill(&mut self, value: bool) -> &mut Self {
+ unsafe {
+ ui_splitpane_args_set_hfill(self.args, if value { 1 } else { 0 });
+ }
+ self
+ }
+
+ pub fn vfill(&mut self, value: bool) -> &mut Self {
+ unsafe {
+ ui_splitpane_args_set_vfill(self.args, if value { 1 } else { 0 });
+ }
+ self
+ }
+
+ pub fn override_defaults(&mut self, value: bool) -> &mut Self {
+ unsafe {
+ ui_splitpane_args_set_override_defaults(self.args, if value { 1 } else { 0 });
+ }
+ self
+ }
+
+ pub fn margin(&mut self, value: i32) -> &mut Self {
+ unsafe {
+ ui_splitpane_args_set_margin(self.args, value);
+ }
+ self
+ }
+
+ pub fn margin_left(&mut self, value: i32) -> &mut Self {
+ unsafe {
+ ui_splitpane_args_set_margin_left(self.args, value);
+ }
+ self
+ }
+
+ pub fn margin_right(&mut self, value: i32) -> &mut Self {
+ unsafe {
+ ui_splitpane_args_set_margin_right(self.args, value);
+ }
+ self
+ }
+
+ pub fn margin_top(&mut self, value: i32) -> &mut Self {
+ unsafe {
+ ui_splitpane_args_set_margin_top(self.args, value);
+ }
+ self
+ }
+
+ pub fn margin_bottom(&mut self, value: i32) -> &mut Self {
+ unsafe {
+ ui_splitpane_args_set_margin_bottom(self.args, value);
+ }
+ self
+ }
+
+ pub fn colspan(&mut self, value: i32) -> &mut Self {
+ unsafe {
+ ui_splitpane_args_set_colspan(self.args, value);
+ }
+ self
+ }
+
+ pub fn rowspan(&mut self, value: i32) -> &mut Self {
+ unsafe {
+ ui_splitpane_args_set_rowspan(self.args, value);
+ }
+ self
+ }
+
+ pub fn name(&mut self, value: &str) -> &mut Self {
+ let cstr = CString::new(value).unwrap();
+ unsafe {
+ ui_splitpane_args_set_name(self.args, cstr.as_ptr());
+ }
+ self
+ }
+
+ pub fn style_class(&mut self, value: &str) -> &mut Self {
+ let cstr = CString::new(value).unwrap();
+ unsafe {
+ ui_splitpane_args_set_style_class(self.args, cstr.as_ptr());
+ }
+ self
+ }
+
+ pub fn spacing(&mut self, value: i32) -> &mut Self {
+ unsafe {
+ ui_splitpane_args_set_spacing(self.args, value);
+ }
+ self
+ }
+
+ pub fn columnspacing(&mut self, value: i32) -> &mut Self {
+ unsafe {
+ ui_splitpane_args_set_columnspacing(self.args, value);
+ }
+ self
+ }
+
+ pub fn rowspacing(&mut self, value: i32) -> &mut Self {
+ unsafe {
+ ui_splitpane_args_set_rowspacing(self.args, value);
+ }
+ self
+ }
+}
+
+impl<'a> Drop for SplitPaneBuilder<'a> {
+ fn drop(&mut self) {
+ unsafe {
+ ui_splitpane_args_free(self.args);
+ }
+ }
+}
+
+
/* -------------------------------- C functions -------------------------------- */
extern "C" {
fn ui_frame_create(obj: *mut UiObject, args: *const UiFrameArgs) -> *mut c_void;
fn ui_expander_create(obj: *mut UiObject, args: *const UiFrameArgs) -> *mut c_void;
fn ui_scrolledwindow_create(obj: *mut UiObject, args: *const UiFrameArgs) -> *mut c_void;
+ fn ui_hsplitpane_create(obj: *mut UiObject, args: *const UiSplitPaneArgs) -> *mut c_void;
+ fn ui_vsplitpane_create(obj: *mut UiObject, args: *const UiSplitPaneArgs) -> *mut c_void;
fn ui_container_args_new() -> *mut UiContainerArgs;
fn ui_frame_args_set_expanded(args: *mut UiFrameArgs, value: c_int);
fn ui_frame_args_set_subcontainer(args: *mut UiFrameArgs, value: c_int);
fn ui_frame_args_free(args: *mut UiFrameArgs);
+
+
+ fn ui_splitpane_args_new() -> *mut UiSplitPaneArgs;
+ fn ui_splitpane_args_set_fill(args: *mut UiSplitPaneArgs, fill: c_int);
+ fn ui_splitpane_args_set_hexpand(args: *mut UiSplitPaneArgs, value: c_int);
+ fn ui_splitpane_args_set_vexpand(args: *mut UiSplitPaneArgs, value: c_int);
+ fn ui_splitpane_args_set_hfill(args: *mut UiSplitPaneArgs, value: c_int);
+ fn ui_splitpane_args_set_vfill(args: *mut UiSplitPaneArgs, value: c_int);
+ fn ui_splitpane_args_set_override_defaults(args: *mut UiSplitPaneArgs, value: c_int);
+ fn ui_splitpane_args_set_margin(args: *mut UiSplitPaneArgs, value: c_int);
+ fn ui_splitpane_args_set_margin_left(args: *mut UiSplitPaneArgs, value: c_int);
+ fn ui_splitpane_args_set_margin_right(args: *mut UiSplitPaneArgs, value: c_int);
+ fn ui_splitpane_args_set_margin_top(args: *mut UiSplitPaneArgs, value: c_int);
+ fn ui_splitpane_args_set_margin_bottom(args: *mut UiSplitPaneArgs, value: c_int);
+ fn ui_splitpane_args_set_colspan(args: *mut UiSplitPaneArgs, value: c_int);
+ fn ui_splitpane_args_set_rowspan(args: *mut UiSplitPaneArgs, value: c_int);
+ fn ui_splitpane_args_set_name(args: *mut UiSplitPaneArgs, name: *const c_char);
+ fn ui_splitpane_args_set_style_class(args: *mut UiSplitPaneArgs, classname: *const c_char);
+ fn ui_splitpane_args_set_spacing(args: *mut UiSplitPaneArgs, spacing: c_int);
+ fn ui_splitpane_args_set_columnspacing(args: *mut UiSplitPaneArgs, spacing: c_int);
+ fn ui_splitpane_args_set_rowspacing(args: *mut UiSplitPaneArgs, spacing: c_int);
+ fn ui_splitpane_args_set_visibility_states(args: *mut UiSplitPaneArgs, states: *const c_int, numstates: c_int);
+ fn ui_splitpane_args_free(args: *mut UiSplitPaneArgs);
}