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 "chrome/views/view.h" | 8 #include "chrome/views/view.h" |
9 #include "chrome/views/event.h" | 9 #include "chrome/views/event.h" |
10 | 10 |
(...skipping 23 matching lines...) Expand all Loading... |
34 // changed. | 34 // changed. |
35 void set_change_state_immediately(bool value) { | 35 void set_change_state_immediately(bool value) { |
36 change_state_immediately_ = value; | 36 change_state_immediately_ = value; |
37 } | 37 } |
38 | 38 |
39 // Check/uncheck the star. | 39 // Check/uncheck the star. |
40 void SwitchState(); | 40 void SwitchState(); |
41 | 41 |
42 // Overriden from view. | 42 // Overriden from view. |
43 void Paint(ChromeCanvas* canvas); | 43 void Paint(ChromeCanvas* canvas); |
44 void GetPreferredSize(CSize* out); | 44 gfx::Size GetPreferredSize(); |
45 virtual bool OnMousePressed(const ChromeViews::MouseEvent& e); | 45 virtual bool OnMousePressed(const ChromeViews::MouseEvent& e); |
46 virtual bool OnMouseDragged(const ChromeViews::MouseEvent& event); | 46 virtual bool OnMouseDragged(const ChromeViews::MouseEvent& event); |
47 virtual void OnMouseReleased(const ChromeViews::MouseEvent& e, bool canceled); | 47 virtual void OnMouseReleased(const ChromeViews::MouseEvent& e, bool canceled); |
48 bool OnKeyPressed(const ChromeViews::KeyEvent& e); | 48 bool OnKeyPressed(const ChromeViews::KeyEvent& e); |
49 | 49 |
50 private: | 50 private: |
51 // The state. | 51 // The state. |
52 bool state_; | 52 bool state_; |
53 | 53 |
54 // Our bitmap. | 54 // Our bitmap. |
55 SkBitmap* state_off_; | 55 SkBitmap* state_off_; |
56 SkBitmap* state_on_; | 56 SkBitmap* state_on_; |
57 | 57 |
58 // Parent to be notified. | 58 // Parent to be notified. |
59 Delegate* delegate_; | 59 Delegate* delegate_; |
60 | 60 |
61 // See note in setter. | 61 // See note in setter. |
62 bool change_state_immediately_; | 62 bool change_state_immediately_; |
63 | 63 |
64 DISALLOW_EVIL_CONSTRUCTORS(StarToggle); | 64 DISALLOW_EVIL_CONSTRUCTORS(StarToggle); |
65 }; | 65 }; |
66 | 66 |
67 #endif // CHROME_BROWSER_VIEWS_STAR_TOGGLE_H__ | 67 #endif // CHROME_BROWSER_VIEWS_STAR_TOGGLE_H__ |
68 | 68 |
OLD | NEW |