| OLD | NEW |
| 1 // Copyright (c) 2006-2008 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2006-2008 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 #ifndef CHROME_BROWSER_VIEWS_STAR_TOGGLE_H_ | 5 #ifndef CHROME_BROWSER_VIEWS_STAR_TOGGLE_H_ |
| 6 #define CHROME_BROWSER_VIEWS_STAR_TOGGLE_H_ | 6 #define CHROME_BROWSER_VIEWS_STAR_TOGGLE_H_ |
| 7 | 7 |
| 8 #include "views/view.h" | 8 #include "views/view.h" |
| 9 #include "views/event.h" | 9 #include "views/event.h" |
| 10 | 10 |
| (...skipping 24 matching lines...) Expand all Loading... |
| 35 // If false, on mouse release the delegate is notified, but the state is not | 35 // If false, on mouse release the delegate is notified, but the state is not |
| 36 // changed. | 36 // changed. |
| 37 void set_change_state_immediately(bool value) { | 37 void set_change_state_immediately(bool value) { |
| 38 change_state_immediately_ = value; | 38 change_state_immediately_ = value; |
| 39 } | 39 } |
| 40 | 40 |
| 41 // Check/uncheck the star. | 41 // Check/uncheck the star. |
| 42 void SwitchState(); | 42 void SwitchState(); |
| 43 | 43 |
| 44 // Overriden from view. | 44 // Overriden from view. |
| 45 void Paint(ChromeCanvas* canvas); | 45 void Paint(gfx::Canvas* canvas); |
| 46 gfx::Size GetPreferredSize(); | 46 gfx::Size GetPreferredSize(); |
| 47 virtual bool OnMousePressed(const views::MouseEvent& e); | 47 virtual bool OnMousePressed(const views::MouseEvent& e); |
| 48 virtual bool OnMouseDragged(const views::MouseEvent& event); | 48 virtual bool OnMouseDragged(const views::MouseEvent& event); |
| 49 virtual void OnMouseReleased(const views::MouseEvent& e, bool canceled); | 49 virtual void OnMouseReleased(const views::MouseEvent& e, bool canceled); |
| 50 bool OnKeyPressed(const views::KeyEvent& e); | 50 bool OnKeyPressed(const views::KeyEvent& e); |
| 51 | 51 |
| 52 private: | 52 private: |
| 53 // The state. | 53 // The state. |
| 54 bool state_; | 54 bool state_; |
| 55 | 55 |
| 56 // Our bitmap. | 56 // Our bitmap. |
| 57 SkBitmap* state_off_; | 57 SkBitmap* state_off_; |
| 58 SkBitmap* state_on_; | 58 SkBitmap* state_on_; |
| 59 | 59 |
| 60 // Parent to be notified. | 60 // Parent to be notified. |
| 61 Delegate* delegate_; | 61 Delegate* delegate_; |
| 62 | 62 |
| 63 // See note in setter. | 63 // See note in setter. |
| 64 bool change_state_immediately_; | 64 bool change_state_immediately_; |
| 65 | 65 |
| 66 DISALLOW_EVIL_CONSTRUCTORS(StarToggle); | 66 DISALLOW_EVIL_CONSTRUCTORS(StarToggle); |
| 67 }; | 67 }; |
| 68 | 68 |
| 69 #endif // CHROME_BROWSER_VIEWS_STAR_TOGGLE_H_ | 69 #endif // CHROME_BROWSER_VIEWS_STAR_TOGGLE_H_ |
| OLD | NEW |