RE: [gtkmm] Adding more C++ power to Gtkmm
- From: Murray Cumming Comneon com
- To: kaas_10 hotmail com, gtkmm-list gnome org
- Subject: RE: [gtkmm] Adding more C++ power to Gtkmm
- Date: Mon, 7 Apr 2003 10:19:05 +0200
Please mention just one subject per email. Big multi-subject emails generate
big multi-subject threads that are hard to follow. Most of this should be in
bugzilla anyway.
> From: r ve [mailto:kaas_10 hotmail com]
> Some time ago, I've been complaining that Gtkmm does things
> too much C-like.
Personally I don't remember. I don't think that's true in general, unless
you are talking about the GTK+ implementation. gtkmm is generally thought of
as the most C++-like of C++ GUI APIs.
> Because things won't change when keeping my mouth shut, here's a few
> suggestions that I would really like to see added in Gtkmm.
>
>
>
> One example of something 'C-like' in Gtkmm is that some
> methods contain far
> too many arguments.
>
> Here's a method with 16 (!!) arguments:
>
> - Gdk::Pixbuf::composite_color(const
> Glib::RefPtr<Gdk::Pixbuf>& dest, int
> dest_x, int dest_y, int dest_width, int dest_height, double
> offset_x, double
> offset_y, double scale_x, double scale_y, InterpType interp_type, int
> overall_alpha, int check_x, int check_y, int check_size,
> guint32 color1,
> guint32 color2)
>
> These arguments could be reduced to 13 arguments by rewriting
> it to this:
>
> - Gdk::Pixbuf::composite_color(const Glib::RefPtr<Gdk::Pixbuf& dest,
> Gdk::Rectangle& dest_rect, double offset_x, double offset_y,
> double scale_x,
> double scale_y, InterpType interp_type, int overall_alpha,
> int check_x, int
> check_y, int check_size, guint32 color1, guint32 color2)
Sure. Please submit a patch for gtkmm 2.4 - see the instructions for this on
the website.
> It could be reduced to 10 arguments by modifying the
> Gdk::Point class to
> become a template (would be useful for a few other classes as well):
That would be interesting. I would like to see that as a separate patch.
> - Gdk::Pixbuf::composite_color(const Glib::RefPtr<Gdk::Pixbuf& dest,
> Gdk::Rectangle& dest_rect, Gdk::Point<double>& offset,
> Gdk::Point<double>&
> scale, InterpType interp_type, int overall_alpha, Gdk::Point<int>&
> check_offset, int check_size, guint32 color1, guint32 color2)
>
> Well, I think you get the point :)
> 10 arguments is still quite a lot imho, but it's much better
> than 16 (!)
> arguments.
>
>
>
> Other things that could be done to improve Gtkmm is to add
> more overloaded
> operators.
>
> The Gdk::Point class, for example, does only overload the == and !=
> operators, but this class could be much more useful if it had
> operators for
> adding, subtracting and multiplying Gdk::Points.
> On top of that, the Gdk::Point class doesn't have a
> Point(const Point& rhs)
> constructor, which can also prove to be useful at some times.
Again, please provide a patch.
> The Gdk::Rectangle class doesn't overload _any_ operator,
> that's bad because
> it's a pain to write something like this:
>
> if ((rect1->get_x() != rect2->get_x()) && (rect1->get_y() !=
> rect2->get_y())
> && (rect1->get_width() != rect2->get_width() &&
> (rect1->get_height() !=
> rect2->get_height()) bleh;
>
> Instead of:
>
> if (rect1 != rect2) bleh;
>
> Which is not only much easier on the eyes, but faster to type as well.
Again, please provide a patch.
> Also, it would be really nice if virtual methods (signals)
> wouldn't be like
> this (the C way):
>
> virtual void on_set_focus(Widget* focus); // set_focus signal for
> Gtk::Window
>
> But rather like this (the C++ way):
>
> virtual void on_set_focus(Gtk::Widget* focus);
I don't see what's different there.
> (or const
> Gtk::Widget&
> focus.. whatever)
It's possible that focus might be null sometimes (I don't know) so that
might not work. Feel free to investigate and provide a patch.
> And same goes for all other signals.
Well it's still not clear what you mean.
Murray Cumming
murrayc usa net
www.murrayc.com
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]