Re: Customizing scrollbar in a ScrolledWindow



Hi again Chuck:

I've been looking at the source code of the Gtk::ScrolledWindow. The class
definition allows you to obtain pointers to the srollbar objects, internally
this is implemented this way:

  _WRAP_METHOD(HScrollbar* get_hscrollbar(),
gtk_scrolled_window_get_hscrollbar)

So I can derive a Gtk::ScrolledWindow but I still can not substitute the
scrollbar instances because they are deep inside the Gtk+ C code.  If I want
to replace the Gtk::Scrollbar instances I need a function to do this in the
Gtk+ code, so it can be used inside the Gtkmm ScrolledWindow class. 

I think this is a Gtk+ interface definition problem, inherited by the Gtkmm
wrapper.

If I want to do it that way I should create my own gtk+ scrolledwindow.c
that provides functionality to set the used scrollbar, and set those
scrollbars with the gobj() of my overloaded Gtk::MyCoolScrollbar, inside my
overloaded Gtk::ScrolledWindow that uses my gtk+ object. mmmmm.. :working: a
bit tricky, isn't it?

Thanks anyway. Probably the usual scrollbars are not so boring after all.
:,(


Chuck Crisler wrote:
> 
> No, you are correct. You can also derive a MyCoolScrolledWindow class
> from the ScrolledWindow class and substitute 2 MyCoolScrollbar instances
> for the (boring) Gtk scrollbars. Then everything might/should just work.
> 
> On Wed, 2009-07-08 at 04:11 -0700, siagogam wrote:
>> Hi Chuck:
>> 
>> I can derive the Gtk::Scrollbar class with my new class, thats not the
>> problem. The problem is that internally the Gtk::ScrolledWindow
>> instanciates
>> two Gtk::ScrollBars when is created (really is the gtk_scrolled_window
>> the
>> one that creates the scrollbars), and I cant see the way of replacing
>> those
>> Gtk::ScrollBars instances with my own class (MyCoolScrollbar) instances.
>> So
>> the expose, size.. methods that will be used inside the SrolledWindow
>> wont
>> be my overloaded methods.
>> 
>> Please tell me if I am wrong.
>> 
>> thanks
>> 
>> 
>> Chuck Crisler wrote:
>> > 
>> > This is simple C++. Derive a class (MyCoolScrollbar) from
>> Gtk::Scrollbar
>> > and override the methods that draw. They should be virtual. You may
>> have
>> > to override other methods for size, position, that sort of thing if
>> your
>> > geometry/sizing is different.
>> > 
>> > Chuck
>> > 
>> > On Mon, 2009-07-06 at 15:19 -0700, siagogam wrote:
>> >> Hi
>> >> I'm trying to build my own scrollbars customizing the way they are
>> drawn
>> >> by
>> >> using cairo. The problem is that i like the way a scrolled window
>> works
>> >> and
>> >> i wouldn't like to re implement this widget myself. But i cannot find
>> the
>> >> way of setting my custom MyCoolScrollbar:public Gtk::Scrollbar into
>> the
>> >> ScrolledWindow.
>> >> 
>> >> I was just going to modify the gtk_scrolled_window widget and the
>> >> Gtk::ScrolledWindow and rebuild all GTK+ and gtkmm %-| but im sure
>> there
>> >> is
>> >> an easyest way to do this.
>> >> 
>> >> Any suggestions?
>> >> 
>> >> thanks
>> > 
>> > _______________________________________________
>> > gtkmm-list mailing list
>> > gtkmm-list gnome org
>> > http://mail.gnome.org/mailman/listinfo/gtkmm-list
>> > 
>> > 
>> 
> 
> _______________________________________________
> gtkmm-list mailing list
> gtkmm-list gnome org
> http://mail.gnome.org/mailman/listinfo/gtkmm-list
> 
> 

-- 
View this message in context: http://www.nabble.com/Customizing-scrollbar-in-a-ScrolledWindow-tp24360834p24414406.html
Sent from the Gtkmm mailing list archive at Nabble.com.



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]