Re: [Fxruby-users] subclassing FXColor
Status: Inactive
Brought to you by:
lyle
From: meinrad r. <mei...@gm...> - 2004-01-31 16:07:51
|
Lyle Johnson wrote: > -----BEGIN PGP SIGNED MESSAGE----- > Hash: SHA1 > > > On Jan 30, 2004, at 5:29 PM, meinrad recheis wrote: > >> id like to subclass FXColor to add some more functionality. like this: >> >> class Color < Fox::FXColor >> def initialize r, g, b >> end >> end >> >> but i don't know how to subclass Bignum (that is what FXRGB returns ...) >> how could i do this to integrate with fxruby? > > > Fox::FXColor should really be a Ruby module and not a class; you can't > create instances of it and use them in any meaningful way. And as you > already noted, we already have a way to construct color values from the > red, green and blue (and optionally alpha) components, e.g. > > color = Fox.FXRGB(r, g, b) > > or > > color_with_some_alpha = Fox.FXRGBA(r, g, b, a) > > It's not clear what advantage a full-blown FXColor class would offer. [...] it is the OO-paradigma that gives many advantages by encapsulating data (the color value) and methods that operate on that data (FXRGB, FXREDVALUE, etc ...) in an object! i now see that FXRuby expects bignum where FXColor is stated, so the question is how to subclass bignum (and that does not belong to this list). thanks anyways, meinrad |