sbImageLinkPropertyInfo.cpp
Go to the documentation of this file.
1 /*
2 //
3 // BEGIN SONGBIRD GPL
4 //
5 // This file is part of the Songbird web player.
6 //
7 // Copyright(c) 2005-2008 POTI, Inc.
8 // http://songbirdnest.com
9 //
10 // This file may be licensed under the terms of of the
11 // GNU General Public License Version 2 (the "GPL").
12 //
13 // Software distributed under the License is distributed
14 // on an "AS IS" basis, WITHOUT WARRANTY OF ANY KIND, either
15 // express or implied. See the GPL for the specific language
16 // governing rights and limitations.
17 //
18 // You should have received a copy of the GPL along with this
19 // program. If not, go to http://www.gnu.org/licenses/gpl.html
20 // or write to the Free Software Foundation, Inc.,
21 // 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
22 //
23 // END SONGBIRD GPL
24 //
25 */
26 
28 
29 #include <sbIPropertyArray.h>
30 #include <sbIPropertyManager.h>
31 #include <nsITreeView.h>
32 
33 #include <nsIURI.h>
34 #include <nsNetUtil.h>
35 #include <nsServiceManagerUtils.h>
36 #include <nsUnicharUtils.h>
37 
43 
44 sbImageLinkPropertyInfo::sbImageLinkPropertyInfo(const nsAString& aPropertyID,
45  const nsAString& aDisplayName,
46  const nsAString& aLocalizationKey,
47  const PRBool aRemoteReadable,
48  const PRBool aRemoteWritable,
49  const PRBool aUserViewable,
50  const PRBool aUserEditable,
51  const nsAString& aUrlPropertyID)
52 {
53  mID = aPropertyID;
54  mDisplayName = aDisplayName;
55  mLocalizationKey = aLocalizationKey;
56  mUserViewable = aUserViewable;
57  mUserEditable = aUserEditable;
58  mRemoteReadable = aRemoteReadable;
59  mRemoteWritable = aRemoteWritable;
60  mUrlPropertyID = aUrlPropertyID;
61  mType.AssignLiteral("image");
62  mSuppressSelect = PR_TRUE;
63 }
64 
65 nsresult
67 {
68  nsresult rv;
69 
71  NS_ENSURE_SUCCESS(rv, rv);
72 
73  return NS_OK;
74 }
75 
76 // sbITreeViewPropertyInfo
77 
78 NS_IMETHODIMP
79 sbImageLinkPropertyInfo::GetImageSrc(const nsAString& aValue,
80  nsAString& _retval)
81 {
82  if(!aValue.IsEmpty() &&
83  !aValue.LowerCaseEqualsLiteral("default")) {
84  _retval = aValue;
85  return NS_OK;
86  }
87 
88  _retval.Truncate();
89 
90  return NS_OK;
91 }
92 
93 NS_IMETHODIMP
94 sbImageLinkPropertyInfo::GetProgressMode(const nsAString& aValue,
95  PRInt32* _retval)
96 {
97  NS_ENSURE_ARG_POINTER(_retval);
98  *_retval = nsITreeView::PROGRESS_NONE;
99  return NS_OK;
100 }
101 
102 NS_IMETHODIMP
103 sbImageLinkPropertyInfo::GetCellValue(const nsAString& aValue,
104  nsAString& _retval)
105 {
106  _retval.Truncate();
107  return NS_OK;
108 }
109 
110 NS_IMETHODIMP
111 sbImageLinkPropertyInfo::GetRowProperties(const nsAString& aValue,
112  nsAString& _retval)
113 {
114  _retval.Truncate();
115  return NS_OK;
116 }
117 
118 NS_IMETHODIMP
119 sbImageLinkPropertyInfo::GetCellProperties(const nsAString& aValue,
120  nsAString& _retval)
121 {
122  if(aValue.IsEmpty()) {
123  _retval.AssignLiteral("image noLink");
124  return NS_OK;
125  }
126 
127  _retval.AssignLiteral("image link");
128 
129  return NS_OK;
130 }
131 
132 NS_IMETHODIMP
133 sbImageLinkPropertyInfo::GetColumnType(nsAString& _retval)
134 {
135  _retval.AssignLiteral("text");
136  return NS_OK;
137 }
138 
139 // sbIClickablePropertyInfo
140 
141 NS_IMETHODIMP
142 sbImageLinkPropertyInfo::GetSuppressSelect(PRBool* aSuppressSelect)
143 {
144  NS_ENSURE_ARG_POINTER(aSuppressSelect);
145  *aSuppressSelect = mSuppressSelect;
146  return NS_OK;
147 }
148 
149 NS_IMETHODIMP
150 sbImageLinkPropertyInfo::SetSuppressSelect(PRBool aSuppressSelect)
151 {
152  mSuppressSelect = aSuppressSelect;
153  return NS_OK;
154 }
155 
156 NS_IMETHODIMP
157 sbImageLinkPropertyInfo::IsDisabled(const nsAString& aCurrentValue,
158  PRBool* _retval)
159 {
160  NS_ENSURE_ARG_POINTER(_retval);
161  *_retval = PR_FALSE;
162  return NS_OK;
163 }
164 
165 NS_IMETHODIMP
166 sbImageLinkPropertyInfo::HitTest(const nsAString& aCurrentValue,
167  const nsAString& aPart,
168  PRUint32 aBoxWidth,
169  PRUint32 aBoxHeight,
170  PRUint32 aMouseX,
171  PRUint32 aMouseY,
172  PRBool* _retval)
173 {
174  NS_ENSURE_ARG_POINTER(_retval);
175  *_retval = aPart.EqualsLiteral("image");
176  return NS_OK;
177 }
178 
179 NS_IMETHODIMP
180 sbImageLinkPropertyInfo::GetValueForClick(const nsAString& aCurrentValue,
181  PRUint32 aBoxWidth,
182  PRUint32 aBoxHeight,
183  PRUint32 aMouseX,
184  PRUint32 aMouseY,
185  nsAString& _retval)
186 {
187  return NS_ERROR_NOT_IMPLEMENTED;
188 }
189 
190 /* boolean onClick (in sbIMediaItem aItem,
191  [optional] in nsISupports aEvent,
192  [optional] in nsISupports aContext); */
193 NS_IMETHODIMP
194 sbImageLinkPropertyInfo::OnClick(sbIMediaItem *aItem,
195  nsISupports *aEvent,
196  nsISupports *aContext,
197  PRBool *_retval NS_OUTPARAM)
198 {
199  NS_ENSURE_ARG_POINTER(_retval);
200  *_retval = PR_FALSE;
201  return NS_OK;
202 }
203 
204 // sbIPropertyInfo
205 
206 NS_IMETHODIMP
207 sbImageLinkPropertyInfo::Format(const nsAString& aValue,
208  nsAString& _retval)
209 {
210  _retval.Truncate();
211  return NS_OK;
212 }
213 
214 // sbIImageLinkPropertyInfo
215 
216 NS_IMETHODIMP
217 sbImageLinkPropertyInfo::GetUrlProperty(nsAString& _retval)
218 {
219  _retval = mUrlPropertyID;
220 
221  return NS_OK;
222 }
223 
224 NS_IMETHODIMP
225 sbImageLinkPropertyInfo::GetPreventNavigation(const nsAString& aImageValue,
226  const nsAString& aUrlValue,
227  PRBool *_retval)
228 {
229  NS_ENSURE_ARG_POINTER(_retval);
230 
231  *_retval = aImageValue.IsEmpty() ||
232  aUrlValue.IsEmpty();
233 
234  return NS_OK;
235 }
236 
return NS_OK
onPageChanged aValue
Definition: FeedWriter.js:1395
The property information specific to clickable properties.
Interface that defines a single item of media in the system.