Chromium Code Reviews| OLD | NEW |
|---|---|
| 1 // Copyright (c) 2010 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2011 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_VIEWS_DROPDOWN_BAR_VIEW_H_ | 5 #ifndef CHROME_BROWSER_UI_VIEWS_DROPDOWN_BAR_VIEW_H_ |
| 6 #define CHROME_BROWSER_UI_VIEWS_DROPDOWN_BAR_VIEW_H_ | 6 #define CHROME_BROWSER_UI_VIEWS_DROPDOWN_BAR_VIEW_H_ |
| 7 #pragma once | 7 #pragma once |
| 8 | 8 |
| 9 #include "views/view.h" | 9 #include "chrome/browser/ui/views/dropdown_bar_host.h" |
| 10 #include "chrome/browser/ui/views/accessible_pane_view.h" | |
| 10 | 11 |
|
sky
2011/05/03 18:38:32
remove newline
SteveT
2011/05/06 18:48:43
Done.
| |
| 11 class DropdownBarHost; | 12 #include "ui/gfx/canvas.h" |
|
sky
2011/05/03 18:38:32
forward declare canvas
SteveT
2011/05/06 18:48:43
Done.
| |
| 12 | 13 |
| 13 //////////////////////////////////////////////////////////////////////////////// | 14 //////////////////////////////////////////////////////////////////////////////// |
| 14 // | 15 // |
| 15 // The DropdownBarView is an abstract view to draw the UI controls of the | 16 // The DropdownBarView is an abstract view to draw the UI controls of the |
| 16 // DropdownBarHost. | 17 // DropdownBarHost. |
| 17 // | 18 // |
| 18 //////////////////////////////////////////////////////////////////////////////// | 19 //////////////////////////////////////////////////////////////////////////////// |
| 19 class DropdownBarView : public views::View { | 20 class DropdownBarView : public AccessiblePaneView, |
| 21 public DropdownBarHost::Delegate { | |
| 20 public: | 22 public: |
| 21 explicit DropdownBarView(DropdownBarHost* host) | 23 explicit DropdownBarView(DropdownBarHost* host) |
| 22 : host_(host), | 24 : host_(host), |
| 23 animation_offset_(0) { | 25 animation_offset_(0) { |
| 24 } | 26 } |
| 25 virtual ~DropdownBarView() {} | 27 virtual ~DropdownBarView() {} |
| 26 | 28 |
| 27 // Claims focus for the text field and selects its contents. | |
| 28 virtual void SetFocusAndSelection(bool select_all) = 0; | |
| 29 | |
| 30 // Updates the view to let it know where the host is clipping the | 29 // Updates the view to let it know where the host is clipping the |
| 31 // dropdown widget (while animating the opening or closing of the widget). | 30 // dropdown widget (while animating the opening or closing of the widget). |
| 32 void set_animation_offset(int offset) { animation_offset_ = offset; } | 31 virtual void set_animation_offset(int offset) OVERRIDE; |
|
sky
2011/05/03 18:38:32
This isn't OVERRIDE, is it? Should be CamelCase fo
SteveT
2011/05/06 18:48:43
Renamed everywhere.
| |
| 33 | 32 |
| 34 // Returns the offset used while animating. | 33 // Returns the offset used while animating. |
| 35 int animation_offset() const { return animation_offset_; } | 34 int animation_offset() const { return animation_offset_; } |
| 36 | 35 |
| 37 protected: | 36 protected: |
| 38 // Returns the DropdownBarHost that manages this view. | 37 // Returns the DropdownBarHost that manages this view. |
| 39 DropdownBarHost* host() const { return host_; } | 38 DropdownBarHost* host() const { return host_; } |
| 40 | 39 |
| 40 // Assign border bitmaps for this drop down instance. | |
| 41 void SetDialogBorderBitmaps(const SkBitmap* dialog_left, | |
| 42 const SkBitmap* dialog_middle, | |
| 43 const SkBitmap* dialog_right); | |
| 44 | |
| 45 // Paints the offset toolbar background over the widget area and returns the | |
| 46 // bounds of the widget. | |
| 47 gfx::Rect PaintOffsetToolbarBackground(gfx::Canvas* canvas); | |
| 48 | |
| 49 // Paint the border for the drop down dialog given the ends and middle | |
| 50 // bitmaps. | |
| 51 void PaintDialogBorder(gfx::Canvas* canvas, const gfx::Rect& bounds) const; | |
| 52 | |
| 53 // Special paint code for the edges when the drop down bar is animating. | |
| 54 void PaintAnimatingEdges(gfx::Canvas* canvas, const gfx::Rect& bounds) const; | |
| 55 | |
| 56 // The dialog border bitmaps. | |
| 57 const SkBitmap* dialog_left_; | |
|
sky
2011/05/03 18:38:32
no protected members.
SteveT
2011/05/06 18:48:43
Made private.
| |
| 58 const SkBitmap* dialog_middle_; | |
| 59 const SkBitmap* dialog_right_; | |
| 60 | |
| 41 private: | 61 private: |
| 42 // The dropdown bar host that controls this view. | 62 // The dropdown bar host that controls this view. |
| 43 DropdownBarHost* host_; | 63 DropdownBarHost* host_; |
| 44 | 64 |
| 45 // While animating, the host clips the widget and draws only the bottom | 65 // While animating, the host clips the widget and draws only the bottom |
| 46 // part of it. The view needs to know the pixel offset at which we are drawing | 66 // part of it. The view needs to know the pixel offset at which we are drawing |
| 47 // the widget so that we can draw the curved edges that attach to the toolbar | 67 // the widget so that we can draw the curved edges that attach to the toolbar |
| 48 // in the right location. | 68 // in the right location. |
| 49 int animation_offset_; | 69 int animation_offset_; |
| 50 | 70 |
| 51 DISALLOW_COPY_AND_ASSIGN(DropdownBarView); | 71 DISALLOW_COPY_AND_ASSIGN(DropdownBarView); |
| 52 }; | 72 }; |
| 53 | 73 |
| 54 #endif // CHROME_BROWSER_UI_VIEWS_DROPDOWN_BAR_VIEW_H_ | 74 #endif // CHROME_BROWSER_UI_VIEWS_DROPDOWN_BAR_VIEW_H_ |
| OLD | NEW |