octave-maintainers
[Top][All Lists]
Advanced

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

Graphics properties as objects


From: Michael Goffioul
Subject: Graphics properties as objects
Date: Sat, 29 Dec 2007 11:11:41 +0100

Hi,

Thinking about graphics properties and how they are currently
implemented (mainly as octave_value field of a "properties" nested
class), I was wondering if it wouldn't be better to define a set of
property classes as wrappers around the actual property value
(using the same pattern used elsewhere in octave: a graphics_property
class with a base_graphics_property "rep" field, and a set of
concrete classes deriving from base_graphics_property). This is
the system I used in JHandles. I see several advantages:
1) you can use these property classes to store data that are specific
to properties, like a hidden state or a list of listeners
2) property typing can be implemented in the derived class, by checking
the type of the property value to be set (for instance in the
operator= method)
3) having a common type for all properties (graphics_property) allows
you to define std::list<graphics_property> objects; this might be useful
to implement dynamic properties (properties added at runtime) in
the base_graphics_object class
4) property classes have already been used for radio or color properties;
I see this simply as a generalization of the concept to all properties

Comments?

Michael.


reply via email to

[Prev in Thread] Current Thread [Next in Thread]