Extending GtkRange to support buffered region / GtkRange subclassing limitation


I subclassed GtkHScale and overrode expose_event virtual function and others to add additional functionality to the class. I called the parent classes's (particularly GtkRange's) expose_event implementation to draw the trough and slider. So far so good.

Due to the lack of support for "buffered region" in GtkRange for multimedia application, I'm trying to extend its implementation to add that support.

However, GtkRange is extremely inflexible (in my opinion, that is.) Its layout object is private, gtk_range_calc_layout() function is static, there is no class virtual functions for layout calculation, no virtual function for drawing of its parts -- its trough (I investigated GtkStyle, which can't provide a solution here), etc., making me thinking that my only way out is create my own GtkRange replacement. I cannot make use of part of GtkRange functionality because it won't let me. In my opinion, the layout object should be accessible to the subclass so that subclass can add drawing on top of the parts correctly whenever necessary.

This also meant that I need my own GtkScale and GtkHScale, even if I don't need to make any changes in these GtkRange subclasses.

Does anybody see other alternatives to maintaining private stack of GtkRange, GtkScale, and GtkHScale?

(Is a second rewrite of GtkRange warranted?)


Daniel Yek

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