[wx-dev] wxSpinCtrlDbl was: Re: Fityk GSoC project
(wxFileCtrl/custom wxFileDialog)
Vadim Zeitlin
vadim at wxwindows.org
Wed May 2 19:16:47 PDT 2007
On Wed, 2 May 2007 19:14:49 -0400 John Labenski <jlabenski at gmail.com> wrote:
JL> We talked about this a little while back and I dropped it since I
JL> think it will be a big change.
JL>
JL> 1) Mac & MSW both use spin button + text ctrl (easy to do, use member
JL> double value and increment variable)
JL> 2) Gtk does float (not double), but we'll pretend it's double
JL>
JL> This means that the integer control should be subclassed from the
JL> double control since it's merely a specialized case with an increment
JL> of 1.
I don't think so. The int control doesn't verify "is a" relationship with
the float one: the latter has methods which are not implemented by the
former. So if anything, the float control should inherit from the int one.
But this doesn't make much sense implementation-wise so I think the best
solution is to do neither and inherit them both from a common base class
which would contain platform-specific code.
JL> On the other hand, I would bet that the the GTK spinctrl is merely a
JL> textctrl packed with a spinbutton, but after downloading the GTK+2
JL> source code I cannot find how it's made.
Although it's surely implemented like this internally, it doesn't show in
its API.
JL> So, if this is the case, and we combine a textctrl + spinbutton
JL> ourselves we could really just use a generic control using a wxTextCtrl
JL> and wxSpinButton for everything since there is little to no advantage
JL> in creating native controls at a low level for MSW or Mac. Essentially
JL> we'd only have a single generic control for everything.
Actually Mac does seem to do it like this already. And while MSW uses the
native text control instead of the generic one I am not sure if there is
really any advantage in doing it like this. So I agree we should use the
generic version for both Mac and MSW if we don't find problems with doing
this during testing.
JL> So... this is why I left it since I couldn't convince myself to go
JL> though all the trouble of creating separate controls just because GTK
JL> has a native float version.
Implementing this under GTK+ is really the easy part. If you can make a
patch implementing wxSpinCtrlReal for the generic version it should be
pretty easy to also make it available in wxGTK.
Regards,
VZ
More information about the wx-dev
mailing list