Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(51)

Side by Side Diff: chrome/browser/chromeos/login/user_view.cc

Issue 5966008: Show hand cursor only on small user pods and labels (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: use_small_shape is a constructor argument Created 9 years, 11 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
OLDNEW
1 // Copyright (c) 2010 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2010 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #include "chrome/browser/chromeos/login/user_view.h" 5 #include "chrome/browser/chromeos/login/user_view.h"
6 6
7 #include "app/l10n_util.h" 7 #include "app/l10n_util.h"
8 #include "app/resource_bundle.h" 8 #include "app/resource_bundle.h"
9 #include "chrome/browser/chromeos/login/helper.h" 9 #include "chrome/browser/chromeos/login/helper.h"
10 #include "chrome/browser/chromeos/login/rounded_rect_painter.h" 10 #include "chrome/browser/chromeos/login/rounded_rect_painter.h"
(...skipping 196 matching lines...) Expand 10 before | Expand all | Expand 10 after
207 SkBitmap icon_; 207 SkBitmap icon_;
208 std::wstring text_; 208 std::wstring text_;
209 gfx::Point top_right_; 209 gfx::Point top_right_;
210 bool was_first_click_; 210 bool was_first_click_;
211 211
212 DISALLOW_COPY_AND_ASSIGN(RemoveButton); 212 DISALLOW_COPY_AND_ASSIGN(RemoveButton);
213 }; 213 };
214 214
215 class PodImageView : public views::ImageView { 215 class PodImageView : public views::ImageView {
216 public: 216 public:
217 PodImageView() { } 217 explicit PodImageView(const UserView::Delegate* delegate)
218 : delegate_(delegate) { }
218 219
219 void SetImage(const SkBitmap& image, const SkBitmap& image_hot) { 220 void SetImage(const SkBitmap& image, const SkBitmap& image_hot) {
220 image_ = image; 221 image_ = image;
221 image_hot_ = image_hot; 222 image_hot_ = image_hot;
222 views::ImageView::SetImage(image_); 223 views::ImageView::SetImage(image_);
223 } 224 }
224 225
225 protected: 226 protected:
226 // Overridden from View: 227 // Overridden from View:
227 virtual void OnMouseEntered(const views::MouseEvent& event) { 228 virtual void OnMouseEntered(const views::MouseEvent& event) {
228 views::ImageView::SetImage(image_hot_); 229 views::ImageView::SetImage(image_hot_);
229 } 230 }
230 231
231 virtual void OnMouseExited(const views::MouseEvent& event) { 232 virtual void OnMouseExited(const views::MouseEvent& event) {
232 views::ImageView::SetImage(image_); 233 views::ImageView::SetImage(image_);
233 } 234 }
234 235
235 gfx::NativeCursor GetCursorForPoint( 236 gfx::NativeCursor GetCursorForPoint(
236 views::Event::EventType event_type, 237 views::Event::EventType event_type,
237 const gfx::Point& p) { 238 const gfx::Point& p) {
238 return gfx::GetCursor(GDK_HAND2); 239 return (delegate_->IsUserSelected()) ? NULL : gfx::GetCursor(GDK_HAND2);
239 } 240 }
240 241
241 private: 242 private:
243 const UserView::Delegate* delegate_;
244
242 SkBitmap image_; 245 SkBitmap image_;
243 SkBitmap image_hot_; 246 SkBitmap image_hot_;
244 247
245 DISALLOW_COPY_AND_ASSIGN(PodImageView); 248 DISALLOW_COPY_AND_ASSIGN(PodImageView);
246 }; 249 };
247 250
248 UserView::UserView(Delegate* delegate, bool is_login, bool need_background) 251 UserView::UserView(Delegate* delegate, bool is_login, bool need_background)
249 : delegate_(delegate), 252 : delegate_(delegate),
250 signout_view_(NULL), 253 signout_view_(NULL),
251 image_view_(NULL), 254 image_view_(NULL),
252 remove_button_(NULL) { 255 remove_button_(NULL) {
253 DCHECK(delegate); 256 DCHECK(delegate);
254 if (!is_login) 257 if (!is_login)
255 signout_view_ = new SignoutView(this); 258 signout_view_ = new SignoutView(this);
256 259
257 if (need_background) 260 if (need_background)
258 image_view_ = new RoundedView<PodImageView>; 261 image_view_ = new RoundedView<PodImageView>(delegate);
259 else 262 else
260 image_view_ = new PodImageView; 263 image_view_ = new PodImageView(delegate);
261 264
262 Init(need_background); 265 Init(need_background);
263 } 266 }
264 267
265 void UserView::Init(bool need_background) { 268 void UserView::Init(bool need_background) {
266 if (need_background) { 269 if (need_background) {
267 image_view_->set_background( 270 image_view_->set_background(
268 views::Background::CreateSolidBackground(kBackgroundColor)); 271 views::Background::CreateSolidBackground(kBackgroundColor));
269 } 272 }
270 273
(...skipping 58 matching lines...) Expand 10 before | Expand all | Expand 10 after
329 DCHECK(delegate_); 332 DCHECK(delegate_);
330 if (remove_button_ == sender) 333 if (remove_button_ == sender)
331 delegate_->OnRemoveUser(); 334 delegate_->OnRemoveUser();
332 } 335 }
333 336
334 void UserView::OnLocaleChanged() { 337 void UserView::OnLocaleChanged() {
335 remove_button_->SetText(l10n_util::GetString(IDS_LOGIN_REMOVE)); 338 remove_button_->SetText(l10n_util::GetString(IDS_LOGIN_REMOVE));
336 } 339 }
337 340
338 } // namespace chromeos 341 } // namespace chromeos
OLDNEW
« no previous file with comments | « chrome/browser/chromeos/login/user_view.h ('k') | chrome/browser/chromeos/login/username_view.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698