29 #include <nsAutoPtr.h>
30 #include <sbIPropertyManager.h>
31 #include <nsITreeView.h>
40 #define ZERO_HIT_WIDTH 10
43 const nsAString& aDisplayName,
44 const nsAString& aLocalizationKey,
45 const PRBool aRemoteReadable,
46 const PRBool aRemoteWritable,
47 const PRBool aUserViewable,
48 const PRBool aUserEditable)
57 mType.AssignLiteral(
"rating");
58 mSuppressSelect = PR_TRUE;
66 nsRefPtr<sbPropertyOperator> propOp;
68 rv = sbImmutablePropertyInfo::GetOPERATOR_EQUALS(op);
69 NS_ENSURE_SUCCESS(rv, rv);
71 NS_ENSURE_TRUE(propOp, NS_ERROR_OUT_OF_MEMORY);
73 NS_ENSURE_SUCCESS(rv, rv);
75 rv = sbImmutablePropertyInfo::GetOPERATOR_NOTEQUALS(op);
76 NS_ENSURE_SUCCESS(rv, rv);
78 NS_ENSURE_TRUE(propOp, NS_ERROR_OUT_OF_MEMORY);
80 NS_ENSURE_SUCCESS(rv, rv);
82 rv = sbImmutablePropertyInfo::GetOPERATOR_GREATER(op);
83 NS_ENSURE_SUCCESS(rv, rv);
85 NS_ENSURE_TRUE(propOp, NS_ERROR_OUT_OF_MEMORY);
87 NS_ENSURE_SUCCESS(rv, rv);
89 rv = sbImmutablePropertyInfo::GetOPERATOR_GREATEREQUAL(op);
90 NS_ENSURE_SUCCESS(rv, rv);
92 NS_ENSURE_TRUE(propOp, NS_ERROR_OUT_OF_MEMORY);
94 NS_ENSURE_SUCCESS(rv, rv);
96 rv = sbImmutablePropertyInfo::GetOPERATOR_LESS(op);
97 NS_ENSURE_SUCCESS(rv, rv);
99 NS_ENSURE_TRUE(propOp, NS_ERROR_OUT_OF_MEMORY);
101 NS_ENSURE_SUCCESS(rv, rv);
103 rv = sbImmutablePropertyInfo::GetOPERATOR_LESSEQUAL(op);
104 NS_ENSURE_SUCCESS(rv, rv);
106 NS_ENSURE_TRUE(propOp, NS_ERROR_OUT_OF_MEMORY);
108 NS_ENSURE_SUCCESS(rv, rv);
110 rv = sbImmutablePropertyInfo::GetOPERATOR_BETWEEN(op);
111 NS_ENSURE_SUCCESS(rv, rv);
113 NS_ENSURE_TRUE(propOp, NS_ERROR_OUT_OF_MEMORY);
115 NS_ENSURE_SUCCESS(rv, rv);
126 NS_ENSURE_SUCCESS(rv, rv);
129 NS_ENSURE_SUCCESS(rv, rv);
137 sbRatingPropertyInfo::GetImageSrc(
const nsAString&
aValue,
145 sbRatingPropertyInfo::GetProgressMode(
const nsAString& aValue,
148 NS_ENSURE_ARG_POINTER(_retval);
149 *_retval = nsITreeView::PROGRESS_NONE;
154 sbRatingPropertyInfo::GetCellValue(
const nsAString& aValue,
162 sbRatingPropertyInfo::GetRowProperties(
const nsAString& aValue,
170 sbRatingPropertyInfo::GetCellProperties(
const nsAString& aValue,
173 _retval.AssignLiteral(
"rating rating");
174 _retval.Append(aValue);
179 sbRatingPropertyInfo::GetColumnType(nsAString& _retval)
181 _retval.AssignLiteral(
"text");
188 sbRatingPropertyInfo::GetSuppressSelect(PRBool* aSuppressSelect)
190 NS_ENSURE_ARG_POINTER(aSuppressSelect);
191 *aSuppressSelect = mSuppressSelect;
196 sbRatingPropertyInfo::SetSuppressSelect(PRBool aSuppressSelect)
198 mSuppressSelect = aSuppressSelect;
203 sbRatingPropertyInfo::IsDisabled(
const nsAString& aCurrentValue,
206 NS_ENSURE_ARG_POINTER(_retval);
212 sbRatingPropertyInfo::HitTest(
const nsAString& aCurrentValue,
213 const nsAString& aPart,
220 NS_ENSURE_ARG_POINTER(_retval);
226 sbRatingPropertyInfo::GetValueForClick(
const nsAString& aCurrentValue,
249 ratingStr.AppendInt(rating);
251 if (ratingStr.Equals(aCurrentValue) || ratingStr.EqualsLiteral(
"0")) {
252 ratingStr.SetIsVoid(PR_TRUE);
266 PRBool *_retval NS_OUTPARAM)
268 NS_ENSURE_ARG_POINTER(_retval);
281 if (aValue.EqualsLiteral(
"0")) {
282 _retval.SetIsVoid(PR_TRUE);
296 if (aValue.IsVoid()) {
301 PRUint32 rating = aValue.ToInteger(&rv);
302 if (NS_SUCCEEDED(rv) && rating >= 0 && rating <=
MAX_RATING) {
dataSBHighestRatedArtists SBProperties rating
The property information specific to clickable properties.
NS_IMETHOD Validate(const nsAString &aValue, PRBool *_retval)
nsresult InitializeOperators()
nsCOMArray< sbIPropertyOperator > mOperators
NS_IMPL_ISUPPORTS_INHERITED2(sbRatingPropertyInfo, sbImmutablePropertyInfo, sbIClickablePropertyInfo, sbITreeViewPropertyInfo) sbRatingPropertyInfo
nsString mLocalizationKey
NS_DECL_ISUPPORTS_INHERITED NS_DECL_SBICLICKABLEPROPERTYINFO NS_DECL_SBITREEVIEWPROPERTYINFO sbRatingPropertyInfo(const nsAString &aPropertyID, const nsAString &aDisplayName, const nsAString &aLocalizationKey, const PRBool aRemoteReadable, const PRBool aRemoteWritable, const PRBool aUserViewable, const PRBool aUserEditable)
NS_IMETHOD Format(const nsAString &aValue, nsAString &_retval)