mirror of
https://github.com/italicsjenga/muda.git
synced 2024-12-24 04:11:30 +11:00
add title
& enabled
getters
This commit is contained in:
parent
0fbc8cf4f4
commit
bac4dbd1ab
16
src/lib.rs
16
src/lib.rs
|
@ -40,10 +40,18 @@ impl Menu {
|
||||||
pub struct Submenu(platform_impl::Submenu);
|
pub struct Submenu(platform_impl::Submenu);
|
||||||
|
|
||||||
impl Submenu {
|
impl Submenu {
|
||||||
|
pub fn label(&self) -> String {
|
||||||
|
self.0.label()
|
||||||
|
}
|
||||||
|
|
||||||
pub fn set_label(&mut self, label: impl AsRef<str>) {
|
pub fn set_label(&mut self, label: impl AsRef<str>) {
|
||||||
self.0.set_label(label)
|
self.0.set_label(label)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
pub fn enabled(&self) -> bool {
|
||||||
|
self.0.enabled()
|
||||||
|
}
|
||||||
|
|
||||||
pub fn set_enabled(&mut self, enabled: bool) {
|
pub fn set_enabled(&mut self, enabled: bool) {
|
||||||
self.0.set_enabled(enabled)
|
self.0.set_enabled(enabled)
|
||||||
}
|
}
|
||||||
|
@ -60,10 +68,18 @@ impl Submenu {
|
||||||
pub struct TextMenuItem(platform_impl::TextMenuItem);
|
pub struct TextMenuItem(platform_impl::TextMenuItem);
|
||||||
|
|
||||||
impl TextMenuItem {
|
impl TextMenuItem {
|
||||||
|
pub fn label(&self) -> String {
|
||||||
|
self.0.label()
|
||||||
|
}
|
||||||
|
|
||||||
pub fn set_label(&mut self, label: impl AsRef<str>) {
|
pub fn set_label(&mut self, label: impl AsRef<str>) {
|
||||||
self.0.set_label(label)
|
self.0.set_label(label)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
pub fn enabled(&self) -> bool {
|
||||||
|
self.0.enabled()
|
||||||
|
}
|
||||||
|
|
||||||
pub fn set_enabled(&mut self, enabled: bool) {
|
pub fn set_enabled(&mut self, enabled: bool) {
|
||||||
self.0.set_enabled(enabled)
|
self.0.set_enabled(enabled)
|
||||||
}
|
}
|
||||||
|
|
|
@ -105,6 +105,10 @@ fn add_entries_to_menu<M: IsA<gtk::MenuShell>>(gtk_menu: &M, entries: &Vec<Arc<M
|
||||||
pub struct Submenu(Arc<Mutex<MenuEntry>>);
|
pub struct Submenu(Arc<Mutex<MenuEntry>>);
|
||||||
|
|
||||||
impl Submenu {
|
impl Submenu {
|
||||||
|
pub fn label(&self) -> String {
|
||||||
|
self.0.lock().label.clone()
|
||||||
|
}
|
||||||
|
|
||||||
pub fn set_label(&mut self, label: impl AsRef<str>) {
|
pub fn set_label(&mut self, label: impl AsRef<str>) {
|
||||||
let label = label.as_ref().to_string();
|
let label = label.as_ref().to_string();
|
||||||
let mut entry = self.0.lock();
|
let mut entry = self.0.lock();
|
||||||
|
@ -114,6 +118,10 @@ impl Submenu {
|
||||||
entry.label = label;
|
entry.label = label;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
pub fn enabled(&self) -> bool {
|
||||||
|
self.0.lock().enabled
|
||||||
|
}
|
||||||
|
|
||||||
pub fn set_enabled(&mut self, enabled: bool) {
|
pub fn set_enabled(&mut self, enabled: bool) {
|
||||||
let mut entry = self.0.lock();
|
let mut entry = self.0.lock();
|
||||||
entry.enabled = true;
|
entry.enabled = true;
|
||||||
|
@ -155,6 +163,10 @@ impl Submenu {
|
||||||
pub struct TextMenuItem(Arc<Mutex<MenuEntry>>);
|
pub struct TextMenuItem(Arc<Mutex<MenuEntry>>);
|
||||||
|
|
||||||
impl TextMenuItem {
|
impl TextMenuItem {
|
||||||
|
pub fn label(&self) -> String {
|
||||||
|
self.0.lock().label.clone()
|
||||||
|
}
|
||||||
|
|
||||||
pub fn set_label(&mut self, label: impl AsRef<str>) {
|
pub fn set_label(&mut self, label: impl AsRef<str>) {
|
||||||
let label = label.as_ref().to_string();
|
let label = label.as_ref().to_string();
|
||||||
let mut entry = self.0.lock();
|
let mut entry = self.0.lock();
|
||||||
|
@ -164,6 +176,10 @@ impl TextMenuItem {
|
||||||
entry.label = label;
|
entry.label = label;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
pub fn enabled(&self) -> bool {
|
||||||
|
self.0.lock().enabled
|
||||||
|
}
|
||||||
|
|
||||||
pub fn set_enabled(&mut self, enabled: bool) {
|
pub fn set_enabled(&mut self, enabled: bool) {
|
||||||
let mut entry = self.0.lock();
|
let mut entry = self.0.lock();
|
||||||
for item in entry.item_gtk_items.as_ref().unwrap().lock().iter() {
|
for item in entry.item_gtk_items.as_ref().unwrap().lock().iter() {
|
||||||
|
|
Loading…
Reference in a new issue