[Y-devel] Slider widget done
Andrew Suffield asuffield at debian.org
Wed Mar 10 16:03:17 GMT 2004
On Mon, Mar 08, 2004 at 10:16:37PM +0100, Jerome Laheurte wrote:
> BTW, I also have a patch against patch-32 to ease the syntax of
> property access in libYc++, ie instead of writing
>
> obj->setProperty("foobar", "spam");
>
> you just write
>
> obj->foobar = "spam";
>
> To do so, you just have to add in the class declaration, as public:
>
> StringProperty foobar;
Something like this is on my todo list, although a fair ways down. Not
quite the same though, and...
> obj->foobar = "spam";
...I don't think it's a good idea to pretend that these things are
lvalues, because they aren't. Furthermore, you don't (can't) provide
the equivalent "read" behaviour in a sane way. Reading a property is a
two-step process.
> There's also a 'IntegerProperty' class, of course.
Templates, damn you. That's what they're for.
template <class T> class Y::Object::Property
{
public:
Property(Y::Connection* y, Y::Object* obj, std::string name);
class Value
{
public:
bool hasValue() const;
T value();
private:
Value(Y::Property *prop);
};
friend class Value;
void set(const T value);
Value* get();
};
--
.''`. ** Debian GNU/Linux ** | Andrew Suffield
: :' : https://www.debian.org/ |
`. `' |
`- -><- |
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 189 bytes
Desc: Digital signature
Url : https://www.y-windows.org/pipermail/y-devel/attachments/20040310/6fc3a21c/attachment.bin
More information about the Y-devel mailing list
2026 © www.Y-Windows.Org - All Rights Reserved