Hi!
I am creating a Object that extends directly from a GtkSourceView:
mod imp {
use super::*;
use gtk::glib;
use sourceview::subclass::prelude::*;
#[derive(Default)]
pub struct MyView;
#[glib::object_subclass]
impl ObjectSubclass for MyView {
const NAME: &'static str = "MySourceView";
type Type = super::MyView;
type ParentType = sourceview::View;
}
impl ObjectImpl for MyView {}
impl WidgetImpl for MyView {}
impl TextViewImpl for MyView {}
impl ViewImpl for MyView {}
}
glib::wrapper! {
pub struct MyView(ObjectSubclass<imp::MyView>)
@extends sourceview::View, gtk::TextView, gtk::Widget;
}
impl MyView {
pub fn new() -> Self {
...
}
}
I have problems getting the Buffer of MyView, because it returns the TextBuffer (of the TextView) and not the Buffer of the SourceView
my_view.buffer() (as TextViewExt) // â Wrong
// I need the SourceViewBuffer
The rest is correct, it shows me and returns the functions corresponding to GtkSourceView.
I donât know if itâs a problem when I extended the Widget. Or how can you cast from TextBuffer to SourceViewBuffer.
I did tests in C and Vala and I donât have that problem.
Thanks.