| OLD | NEW |
| 1 // Copyright (c) 2009 The Chromium Authors. All rights reserved. Use of this | 1 // Copyright (c) 2009 The Chromium Authors. All rights reserved. Use of this |
| 2 // source code is governed by a BSD-style license that can be found in the | 2 // source code is governed by a BSD-style license that can be found in the |
| 3 // LICENSE file. | 3 // LICENSE file. |
| 4 | 4 |
| 5 #ifndef CHROME_VIEWS_CONTROLS_BUTTON_CHECKBOX_H_ | 5 #ifndef CHROME_VIEWS_CONTROLS_BUTTON_CHECKBOX_H_ |
| 6 #define CHROME_VIEWS_CONTROLS_BUTTON_CHECKBOX_H_ | 6 #define CHROME_VIEWS_CONTROLS_BUTTON_CHECKBOX_H_ |
| 7 | 7 |
| 8 #include "chrome/views/controls/button/native_button.h" | 8 #include "chrome/views/controls/button/native_button.h" |
| 9 | 9 |
| 10 namespace views { | 10 namespace views { |
| (...skipping 23 matching lines...) Expand all Loading... |
| 34 // Sets/Gets whether or not the checkbox is checked. | 34 // Sets/Gets whether or not the checkbox is checked. |
| 35 virtual void SetChecked(bool checked); | 35 virtual void SetChecked(bool checked); |
| 36 bool checked() const { return checked_; } | 36 bool checked() const { return checked_; } |
| 37 | 37 |
| 38 // Returns the indentation of the text from the left edge of the view. | 38 // Returns the indentation of the text from the left edge of the view. |
| 39 static int GetTextIndent(); | 39 static int GetTextIndent(); |
| 40 | 40 |
| 41 // Overridden from View: | 41 // Overridden from View: |
| 42 virtual gfx::Size GetPreferredSize(); | 42 virtual gfx::Size GetPreferredSize(); |
| 43 virtual void Layout(); | 43 virtual void Layout(); |
| 44 virtual void Paint(ChromeCanvas* canvas); | 44 virtual void PaintFocusBorder(ChromeCanvas* canvas); |
| 45 virtual View* GetViewForPoint(const gfx::Point& point); | 45 virtual View* GetViewForPoint(const gfx::Point& point); |
| 46 virtual View* GetViewForPoint(const gfx::Point& point, | 46 virtual View* GetViewForPoint(const gfx::Point& point, |
| 47 bool can_create_floating); | 47 bool can_create_floating); |
| 48 virtual void OnMouseEntered(const MouseEvent& e); | 48 virtual void OnMouseEntered(const MouseEvent& e); |
| 49 virtual void OnMouseMoved(const MouseEvent& e); | 49 virtual void OnMouseMoved(const MouseEvent& e); |
| 50 virtual void OnMouseExited(const MouseEvent& e); | 50 virtual void OnMouseExited(const MouseEvent& e); |
| 51 virtual bool OnMousePressed(const MouseEvent& e); | 51 virtual bool OnMousePressed(const MouseEvent& e); |
| 52 virtual void OnMouseReleased(const MouseEvent& e, bool canceled); | 52 virtual void OnMouseReleased(const MouseEvent& e, bool canceled); |
| 53 virtual bool OnMouseDragged(const MouseEvent& e); |
| 54 virtual void WillGainFocus(); |
| 55 virtual void WillLoseFocus(); |
| 53 | 56 |
| 54 protected: | 57 protected: |
| 55 virtual std::string GetClassName() const; | 58 virtual std::string GetClassName() const; |
| 56 | 59 |
| 57 // Overridden from NativeButton2: | 60 // Overridden from NativeButton2: |
| 58 virtual void CreateWrapper(); | 61 virtual void CreateWrapper(); |
| 59 virtual void InitBorder(); | 62 virtual void InitBorder(); |
| 60 | 63 |
| 64 // Returns true if the event (in Checkbox coordinates) is within the bounds of |
| 65 // the label. |
| 66 bool HitTestLabel(const MouseEvent& e); |
| 67 |
| 61 private: | 68 private: |
| 62 // Called from the constructor to create and configure the checkbox label. | 69 // Called from the constructor to create and configure the checkbox label. |
| 63 void Init(const std::wstring& label_text); | 70 void Init(const std::wstring& label_text); |
| 64 | 71 |
| 65 // Returns true if the event (in Checkbox coordinates) is within the bounds of | |
| 66 // the label. | |
| 67 bool HitTestLabel(const MouseEvent& e); | |
| 68 | |
| 69 // The checkbox's label. We don't use the OS version because of transparency | 72 // The checkbox's label. We don't use the OS version because of transparency |
| 70 // and sizing issues. | 73 // and sizing issues. |
| 71 Label* label_; | 74 Label* label_; |
| 72 | 75 |
| 73 // True if the checkbox is checked. | 76 // True if the checkbox is checked. |
| 74 bool checked_; | 77 bool checked_; |
| 75 | 78 |
| 76 DISALLOW_COPY_AND_ASSIGN(Checkbox); | 79 DISALLOW_COPY_AND_ASSIGN(Checkbox); |
| 77 }; | 80 }; |
| 78 | 81 |
| 79 } // namespace views | 82 } // namespace views |
| 80 | 83 |
| 81 #endif // #ifndef CHROME_VIEWS_CONTROLS_BUTTON_CHECKBOX_H_ | 84 #endif // #ifndef CHROME_VIEWS_CONTROLS_BUTTON_CHECKBOX_H_ |
| OLD | NEW |