Skip to content
This repository was archived by the owner on Mar 4, 2024. It is now read-only.

Commit 8345776

Browse files
committed
Add subclass implementation for MenuButton
This way it will be possible to subclass a MenuButton
1 parent 5d8b895 commit 8345776

File tree

2 files changed

+20
-0
lines changed

2 files changed

+20
-0
lines changed

gtk/src/subclass/menu_button.rs

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
// Take a look at the license at the top of the repository in the LICENSE file.
2+
3+
use glib::subclass::prelude::*;
4+
5+
use super::toggle_button::ToggleButtonImpl;
6+
use crate::MenuButton;
7+
8+
pub trait MenuButtonImpl: MenuButtonImplExt + ToggleButtonImpl {}
9+
10+
pub trait MenuButtonImplExt: ObjectSubclass {}
11+
12+
impl<T: MenuButtonImpl> MenuButtonImplExt for T {}
13+
14+
unsafe impl<T: MenuButtonImpl> IsSubclassable<T> for MenuButton {
15+
fn class_init(class: &mut glib::Class<Self>) {
16+
Self::parent_class_init::<T>(class);
17+
}
18+
}

gtk/src/subclass/mod.rs

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,7 @@ pub mod header_bar;
2424
pub mod icon_view;
2525
pub mod list_box;
2626
pub mod list_box_row;
27+
pub mod menu_button;
2728
#[cfg(any(gdk_backend = "x11", feature = "dox"))]
2829
pub mod plug;
2930
pub mod scrolled_window;
@@ -65,6 +66,7 @@ pub mod prelude {
6566
pub use super::icon_view::{IconViewImpl, IconViewImplExt};
6667
pub use super::list_box::{ListBoxImpl, ListBoxImplExt};
6768
pub use super::list_box_row::{ListBoxRowImpl, ListBoxRowImplExt};
69+
pub use super::menu_button::MenuButtonImpl;
6870
#[cfg(any(gdk_backend = "x11", feature = "dox"))]
6971
pub use super::plug::{PlugImpl, PlugImplExt};
7072
pub use super::scrolled_window::{ScrolledWindowImpl, ScrolledWindowImplExt};

0 commit comments

Comments
 (0)