| OLD | NEW |
| 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 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_UI_COCOA_LOCATION_BAR_BUTTON_DECORATION_H_ | 5 #ifndef CHROME_BROWSER_UI_COCOA_LOCATION_BAR_BUTTON_DECORATION_H_ |
| 6 #define CHROME_BROWSER_UI_COCOA_LOCATION_BAR_BUTTON_DECORATION_H_ | 6 #define CHROME_BROWSER_UI_COCOA_LOCATION_BAR_BUTTON_DECORATION_H_ |
| 7 | 7 |
| 8 #import "base/mac/scoped_nsobject.h" | 8 #import "base/mac/scoped_nsobject.h" |
| 9 #include "chrome/browser/ui/cocoa/location_bar/location_bar_decoration.h" | 9 #include "chrome/browser/ui/cocoa/location_bar/location_bar_decoration.h" |
| 10 #import "ui/base/cocoa/appkit_utils.h" | 10 #import "ui/base/cocoa/appkit_utils.h" |
| (...skipping 15 matching lines...) Expand all Loading... |
| 26 // pixels of inner horizontal padding to be used between the left/right 9-part | 26 // pixels of inner horizontal padding to be used between the left/right 9-part |
| 27 // images and the icon. | 27 // images and the icon. |
| 28 ButtonDecoration(ui::NinePartImageIds normal_image_ids, | 28 ButtonDecoration(ui::NinePartImageIds normal_image_ids, |
| 29 int normal_icon_id, | 29 int normal_icon_id, |
| 30 ui::NinePartImageIds hover_image_ids, | 30 ui::NinePartImageIds hover_image_ids, |
| 31 int hover_icon_id, | 31 int hover_icon_id, |
| 32 ui::NinePartImageIds pressed_image_ids, | 32 ui::NinePartImageIds pressed_image_ids, |
| 33 int pressed_icon_id, | 33 int pressed_icon_id, |
| 34 CGFloat max_inner_padding); | 34 CGFloat max_inner_padding); |
| 35 | 35 |
| 36 virtual ~ButtonDecoration(); | 36 ~ButtonDecoration() override; |
| 37 | 37 |
| 38 void SetButtonState(ButtonState state); | 38 void SetButtonState(ButtonState state); |
| 39 ButtonState GetButtonState() const; | 39 ButtonState GetButtonState() const; |
| 40 | 40 |
| 41 // Whether a click on this decoration should prevent focusing of the omnibox | 41 // Whether a click on this decoration should prevent focusing of the omnibox |
| 42 // or not. | 42 // or not. |
| 43 virtual bool PreventFocus(NSPoint location) const; | 43 virtual bool PreventFocus(NSPoint location) const; |
| 44 | 44 |
| 45 // Changes the icon for the specified button state only. | 45 // Changes the icon for the specified button state only. |
| 46 void SetIcon(ButtonState state, int icon_id); | 46 void SetIcon(ButtonState state, int icon_id); |
| 47 | 47 |
| 48 // Changes the icon for all button states. | 48 // Changes the icon for all button states. |
| 49 void SetIcon(int icon_id); | 49 void SetIcon(int icon_id); |
| 50 | 50 |
| 51 // Changes the background image for all button states. | 51 // Changes the background image for all button states. |
| 52 void SetBackgroundImageIds(ui::NinePartImageIds normal_image_ids, | 52 void SetBackgroundImageIds(ui::NinePartImageIds normal_image_ids, |
| 53 ui::NinePartImageIds hover_image_ids, | 53 ui::NinePartImageIds hover_image_ids, |
| 54 ui::NinePartImageIds pressed_image_ids); | 54 ui::NinePartImageIds pressed_image_ids); |
| 55 | 55 |
| 56 ui::NinePartImageIds GetBackgroundImageIds() const; | 56 ui::NinePartImageIds GetBackgroundImageIds() const; |
| 57 NSImage* GetIconImage() const; | 57 NSImage* GetIconImage() const; |
| 58 | 58 |
| 59 // Implement |LocationBarDecoration|. | 59 // Implement |LocationBarDecoration|. |
| 60 virtual CGFloat GetWidthForSpace(CGFloat width) override; | 60 CGFloat GetWidthForSpace(CGFloat width) override; |
| 61 virtual void DrawInFrame(NSRect frame, NSView* control_view) override; | 61 void DrawInFrame(NSRect frame, NSView* control_view) override; |
| 62 virtual bool AcceptsMousePress() override; | 62 bool AcceptsMousePress() override; |
| 63 virtual bool IsDraggable() override; | 63 bool IsDraggable() override; |
| 64 virtual bool OnMousePressed(NSRect frame, NSPoint location) override; | 64 bool OnMousePressed(NSRect frame, NSPoint location) override; |
| 65 virtual ButtonDecoration* AsButtonDecoration() override; | 65 ButtonDecoration* AsButtonDecoration() override; |
| 66 | 66 |
| 67 private: | 67 private: |
| 68 ui::NinePartImageIds normal_image_ids_; | 68 ui::NinePartImageIds normal_image_ids_; |
| 69 ui::NinePartImageIds hover_image_ids_; | 69 ui::NinePartImageIds hover_image_ids_; |
| 70 ui::NinePartImageIds pressed_image_ids_; | 70 ui::NinePartImageIds pressed_image_ids_; |
| 71 int normal_icon_id_; | 71 int normal_icon_id_; |
| 72 int hover_icon_id_; | 72 int hover_icon_id_; |
| 73 int pressed_icon_id_; | 73 int pressed_icon_id_; |
| 74 ButtonState state_; | 74 ButtonState state_; |
| 75 CGFloat max_inner_padding_; | 75 CGFloat max_inner_padding_; |
| 76 | 76 |
| 77 DISALLOW_COPY_AND_ASSIGN(ButtonDecoration); | 77 DISALLOW_COPY_AND_ASSIGN(ButtonDecoration); |
| 78 }; | 78 }; |
| 79 | 79 |
| 80 #endif // CHROME_BROWSER_UI_COCOA_LOCATION_BAR_BUTTON_DECORATION_H_ | 80 #endif // CHROME_BROWSER_UI_COCOA_LOCATION_BAR_BUTTON_DECORATION_H_ |
| OLD | NEW |