annotate base/PropertyContainer.h @ 27:070e9e1e40ea

* Change SpectrogramLayer to use its own cache type instead of a QImage * Some gcc-4.0 compile fixes
author Chris Cannam
date Tue, 14 Feb 2006 17:43:14 +0000
parents d86891498eef
children 4b16526b011b
rev   line source
Chris@0 1 /* -*- c-basic-offset: 4 -*- vi:set ts=8 sts=4 sw=4: */
Chris@0 2
Chris@0 3 /*
Chris@0 4 A waveform viewer and audio annotation editor.
Chris@2 5 Chris Cannam, Queen Mary University of London, 2005-2006
Chris@0 6
Chris@0 7 This is experimental software. Not for distribution.
Chris@0 8 */
Chris@0 9
Chris@0 10 #ifndef _PROPERTY_CONTAINER_H_
Chris@0 11 #define _PROPERTY_CONTAINER_H_
Chris@0 12
Chris@0 13 #include <QString>
Chris@0 14 #include <QObject>
Chris@0 15 #include <vector>
Chris@0 16
Chris@0 17 class Playable;
Chris@0 18
Chris@0 19 class PropertyContainer
Chris@0 20 {
Chris@0 21 public:
Chris@27 22 virtual ~PropertyContainer() { }
Chris@27 23
Chris@0 24 typedef QString PropertyName;
Chris@0 25 typedef std::vector<PropertyName> PropertyList;
Chris@0 26
Chris@0 27 enum PropertyType {
Chris@0 28 ToggleProperty, // on or off
Chris@0 29 RangeProperty, // range of integers
Chris@0 30 ValueProperty, // range of integers given string labels
Chris@0 31 ColourProperty, // colours, get/set as qRgb
Chris@0 32 InvalidProperty, // property not found!
Chris@0 33 };
Chris@0 34
Chris@0 35 /**
Chris@0 36 * Get a list of the names of all the supported properties on this
Chris@0 37 * container. Note that these should already have been
Chris@0 38 * internationalized with a call to tr() or equivalent. If the
Chris@0 39 * container needs to test for equality with string literals
Chris@0 40 * subsequently, it must be sure to call tr() again on the strings
Chris@0 41 * in order to ensure they match.
Chris@0 42 */
Chris@0 43 virtual PropertyList getProperties() const;
Chris@0 44
Chris@0 45 /**
Chris@0 46 * Return the type of the given property, or InvalidProperty if
Chris@0 47 * the property is not supported on this container.
Chris@0 48 */
Chris@0 49 virtual PropertyType getPropertyType(const PropertyName &) const;
Chris@0 50
Chris@0 51 /**
Chris@0 52 * If this property has something in common with other properties
Chris@0 53 * on this container, return a name that can be used to group them
Chris@0 54 * (in order to save screen space, for example). e.g. "Window
Chris@0 55 * Type" and "Window Size" might both have a group name of "Window".
Chris@0 56 * If this property is not groupable, return the empty string.
Chris@0 57 */
Chris@0 58 virtual QString getPropertyGroupName(const PropertyName &) const;
Chris@0 59
Chris@0 60 /**
Chris@0 61 * Return the minimum and maximum values for the given property
Chris@0 62 * and its current value in this container. Min and/or max may be
Chris@0 63 * passed as NULL if their values are not required.
Chris@0 64 */
Chris@0 65 virtual int getPropertyRangeAndValue(const PropertyName &,
Chris@0 66 int *min, int *max) const;
Chris@0 67
Chris@0 68 /**
Chris@0 69 * If the given property is a ValueProperty, return the display
Chris@0 70 * label to be used for the given value for that property.
Chris@0 71 */
Chris@0 72 virtual QString getPropertyValueLabel(const PropertyName &,
Chris@0 73 int value) const;
Chris@0 74
Chris@0 75 /**
Chris@0 76 * Set a property. This is used for all property types. For
Chris@0 77 * boolean properties, zero is false and non-zero true; for
Chris@0 78 * colours, the integer value should be treated as a qRgb.
Chris@0 79 */
Chris@0 80 virtual void setProperty(const PropertyName &, int value);
Chris@0 81
Chris@0 82 virtual QString getPropertyContainerName() const = 0;
Chris@0 83 virtual QString getPropertyContainerIconName() const = 0;
Chris@0 84
Chris@0 85 Playable *getPlayable() const { return 0; }
Chris@0 86 };
Chris@0 87
Chris@0 88 #endif