Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(164)

Side by Side Diff: chrome/browser/ui/views/dropdown_bar_view.h

Issue 6913026: Compact Navigation prototype (Closed) Base URL: http://git.chromium.org/git/chromium.git@trunk
Patch Set: Added missing DropdownBarHostDelegate header file. Created 9 years, 7 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
OLDNEW
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/dropdown_bar_host_delegate.h"
11 #include "chrome/browser/ui/views/accessible_pane_view.h"
10 12
11 class DropdownBarHost; 13 namespace gfx {
14 class Canvas;
15 } // namespace gfx
12 16
13 //////////////////////////////////////////////////////////////////////////////// 17 ////////////////////////////////////////////////////////////////////////////////
14 // 18 //
15 // The DropdownBarView is an abstract view to draw the UI controls of the 19 // The DropdownBarView is an abstract view to draw the UI controls of the
16 // DropdownBarHost. 20 // DropdownBarHost.
17 // 21 //
18 //////////////////////////////////////////////////////////////////////////////// 22 ////////////////////////////////////////////////////////////////////////////////
19 class DropdownBarView : public views::View { 23 class DropdownBarView : public AccessiblePaneView,
24 public DropdownBarHostDelegate {
20 public: 25 public:
21 explicit DropdownBarView(DropdownBarHost* host) 26 explicit DropdownBarView(DropdownBarHost* host);
22 : host_(host), 27 virtual ~DropdownBarView();
23 animation_offset_(0) {
24 }
25 virtual ~DropdownBarView() {}
26
27 // Claims focus for the text field and selects its contents.
28 virtual void SetFocusAndSelection(bool select_all) = 0;
29 28
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 SetAnimationOffset(int offset) OVERRIDE;
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
41 private: 56 private:
42 // The dropdown bar host that controls this view. 57 // The dropdown bar host that controls this view.
43 DropdownBarHost* host_; 58 DropdownBarHost* host_;
44 59
45 // While animating, the host clips the widget and draws only the bottom 60 // 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 61 // 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 62 // the widget so that we can draw the curved edges that attach to the toolbar
48 // in the right location. 63 // in the right location.
49 int animation_offset_; 64 int animation_offset_;
50 65
66 // The dialog border bitmaps.
67 const SkBitmap* dialog_left_;
68 const SkBitmap* dialog_middle_;
69 const SkBitmap* dialog_right_;
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_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698