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

Side by Side Diff: chrome/browser/views/find_bar_view.h

Issue 200035: First cut at implementation of FindBar for views / gtk... (Closed) Base URL: svn://chrome-svn/chrome/trunk/src/
Patch Set: '' Created 11 years, 3 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) 2009 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2009 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_FIND_BAR_VIEW_H_ 5 #ifndef CHROME_BROWSER_VIEWS_FIND_BAR_VIEW_H_
6 #define CHROME_BROWSER_VIEWS_FIND_BAR_VIEW_H_ 6 #define CHROME_BROWSER_VIEWS_FIND_BAR_VIEW_H_
7 7
8 #include "base/gfx/size.h" 8 #include "base/gfx/size.h"
9 #include "base/string16.h" 9 #include "base/string16.h"
10 #include "chrome/browser/find_notification_details.h" 10 #include "chrome/browser/find_notification_details.h"
11 #include "views/controls/button/button.h" 11 #include "views/controls/button/button.h"
12 #include "views/controls/textfield/textfield.h" 12 #include "views/controls/textfield/textfield.h"
13 13
14 class FindBarWin; 14 class FindBarHost;
15 15
16 namespace views { 16 namespace views {
17 class ImageButton; 17 class ImageButton;
18 class Label; 18 class Label;
19 class MouseEvent; 19 class MouseEvent;
20 class View; 20 class View;
21 } 21 }
22 22
23 //////////////////////////////////////////////////////////////////////////////// 23 ////////////////////////////////////////////////////////////////////////////////
24 // 24 //
25 // The FindInPageView is responsible for drawing the UI controls of the 25 // The FindInPageView is responsible for drawing the UI controls of the
26 // FindInPage window, the find text box, the 'Find' button and the 'Close' 26 // FindInPage window, the find text box, the 'Find' button and the 'Close'
27 // button. It communicates the user search words to the FindBarWin. 27 // button. It communicates the user search words to the FindBarHost.
28 // 28 //
29 //////////////////////////////////////////////////////////////////////////////// 29 ////////////////////////////////////////////////////////////////////////////////
30 class FindBarView : public views::View, 30 class FindBarView : public views::View,
31 public views::ButtonListener, 31 public views::ButtonListener,
32 public views::Textfield::Controller { 32 public views::Textfield::Controller {
33 public: 33 public:
34 // A tag denoting which button the user pressed. 34 // A tag denoting which button the user pressed.
35 enum ButtonTag { 35 enum ButtonTag {
36 FIND_PREVIOUS_TAG = 0, // The Find Previous button. 36 FIND_PREVIOUS_TAG = 0, // The Find Previous button.
37 FIND_NEXT_TAG, // The Find Next button. 37 FIND_NEXT_TAG, // The Find Next button.
38 CLOSE_TAG, // The Close button (the 'X'). 38 CLOSE_TAG, // The Close button (the 'X').
39 }; 39 };
40 40
41 explicit FindBarView(FindBarWin* container); 41 explicit FindBarView(FindBarHost* container);
42 virtual ~FindBarView(); 42 virtual ~FindBarView();
43 43
44 // Sets the text displayed in the text box. 44 // Sets the text displayed in the text box.
45 void SetFindText(const string16& find_text); 45 void SetFindText(const string16& find_text);
46 46
47 // Updates the label inside the Find text box that shows the ordinal of the 47 // Updates the label inside the Find text box that shows the ordinal of the
48 // active item and how many matches were found. 48 // active item and how many matches were found.
49 void UpdateForResult(const FindNotificationDetails& result, 49 void UpdateForResult(const FindNotificationDetails& result,
50 const string16& find_text); 50 const string16& find_text);
51 51
(...skipping 38 matching lines...) Expand 10 before | Expand all | Expand 10 after
90 private: 90 private:
91 virtual bool OnMousePressed(const views::MouseEvent& event); 91 virtual bool OnMousePressed(const views::MouseEvent& event);
92 92
93 views::Textfield* view_to_focus_on_mousedown_; 93 views::Textfield* view_to_focus_on_mousedown_;
94 94
95 DISALLOW_COPY_AND_ASSIGN(FocusForwarderView); 95 DISALLOW_COPY_AND_ASSIGN(FocusForwarderView);
96 }; 96 };
97 97
98 // Manages the OS-specific view for the find bar and acts as an intermediary 98 // Manages the OS-specific view for the find bar and acts as an intermediary
99 // between us and the TabContentsView. 99 // between us and the TabContentsView.
100 FindBarWin* container_; 100 FindBarHost* container_;
101 101
102 // The controls in the window. 102 // The controls in the window.
103 views::Textfield* find_text_; 103 views::Textfield* find_text_;
104 views::Label* match_count_text_; 104 views::Label* match_count_text_;
105 FocusForwarderView* focus_forwarder_view_; 105 FocusForwarderView* focus_forwarder_view_;
106 views::ImageButton* find_previous_button_; 106 views::ImageButton* find_previous_button_;
107 views::ImageButton* find_next_button_; 107 views::ImageButton* find_next_button_;
108 views::ImageButton* close_button_; 108 views::ImageButton* close_button_;
109 109
110 // While animating, the controller clips the window and draws only the bottom 110 // While animating, the controller clips the window and draws only the bottom
111 // part of it. The view needs to know the pixel offset at which we are drawing 111 // part of it. The view needs to know the pixel offset at which we are drawing
112 // the window so that we can draw the curved edges that attach to the toolbar 112 // the window so that we can draw the curved edges that attach to the toolbar
113 // in the right location. 113 // in the right location.
114 int animation_offset_; 114 int animation_offset_;
115 115
116 DISALLOW_COPY_AND_ASSIGN(FindBarView); 116 DISALLOW_COPY_AND_ASSIGN(FindBarView);
117 }; 117 };
118 118
119 #endif // CHROME_BROWSER_VIEWS_FIND_BAR_VIEW_H_ 119 #endif // CHROME_BROWSER_VIEWS_FIND_BAR_VIEW_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698