This repository has been archived by the owner on Jun 8, 2021. It is now read-only.
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #584 from pizzaiter/radiotoolbutton
Add RadioToolButton
- Loading branch information
Showing
5 changed files
with
114 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,55 @@ | ||
// This file was generated by gir (0fe730d) from gir-files (db49619) | ||
// DO NOT EDIT | ||
|
||
use Actionable; | ||
use Bin; | ||
use Container; | ||
use RadioButton; | ||
use ToggleToolButton; | ||
use ToolButton; | ||
use ToolItem; | ||
use Widget; | ||
use ffi; | ||
use glib::object::Downcast; | ||
use glib::object::IsA; | ||
use glib::translate::*; | ||
use glib_ffi; | ||
use gobject_ffi; | ||
use std::mem; | ||
use std::ptr; | ||
|
||
glib_wrapper! { | ||
pub struct RadioToolButton(Object<ffi::GtkRadioToolButton>): ToggleToolButton, ToolButton, ToolItem, Bin, Container, Widget, Actionable; | ||
|
||
match fn { | ||
get_type => || ffi::gtk_radio_tool_button_get_type(), | ||
} | ||
} | ||
|
||
impl RadioToolButton { | ||
pub fn new_from_widget(group: &RadioToolButton) -> RadioToolButton { | ||
skip_assert_initialized!(); | ||
unsafe { | ||
ToolItem::from_glib_none(ffi::gtk_radio_tool_button_new_from_widget(group.to_glib_none().0)).downcast_unchecked() | ||
} | ||
} | ||
|
||
pub fn new_with_stock_from_widget(group: &RadioToolButton, stock_id: &str) -> RadioToolButton { | ||
skip_assert_initialized!(); | ||
unsafe { | ||
ToolItem::from_glib_none(ffi::gtk_radio_tool_button_new_with_stock_from_widget(group.to_glib_none().0, stock_id.to_glib_none().0)).downcast_unchecked() | ||
} | ||
} | ||
} | ||
|
||
pub trait RadioToolButtonExt { | ||
fn get_group(&self) -> Vec<RadioButton>; | ||
} | ||
|
||
impl<O: IsA<RadioToolButton>> RadioToolButtonExt for O { | ||
fn get_group(&self) -> Vec<RadioButton> { | ||
unsafe { | ||
FromGlibPtrContainer::from_glib_none(ffi::gtk_radio_tool_button_get_group(self.to_glib_none().0)) | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,32 @@ | ||
use std::ptr; | ||
|
||
use RadioToolButton; | ||
use ToolItem; | ||
use ffi; | ||
use glib::object::Downcast; | ||
use glib::translate::*; | ||
use glib::Value; | ||
use gobject_ffi; | ||
|
||
impl RadioToolButton { | ||
pub fn new() -> RadioToolButton { | ||
assert_initialized_main_thread!(); | ||
unsafe { | ||
ToolItem::from_glib_none(ffi::gtk_radio_tool_button_new(ptr::null_mut())).downcast_unchecked() | ||
} | ||
} | ||
|
||
pub fn new_from_stock(stock_id: &str) -> RadioToolButton { | ||
assert_initialized_main_thread!(); | ||
unsafe { | ||
ToolItem::from_glib_none(ffi::gtk_radio_tool_button_new_from_stock(ptr::null_mut(), stock_id.to_glib_none().0)).downcast_unchecked() | ||
} | ||
} | ||
|
||
pub fn join_group<'a, P: Into<Option<&'a RadioToolButton>>>(&self, group: P) { | ||
let group = group.into(); | ||
unsafe { | ||
gobject_ffi::g_object_set_property(self.to_glib_none().0, "group".to_glib_none().0, Value::from(group).to_glib_none().0); | ||
} | ||
} | ||
} |