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

Side by Side Diff: chrome/browser/gtk/find_bar_gtk.h

Issue 99166: Linux findbar improvements:... (Closed) Base URL: svn://chrome-svn/chrome/trunk/src/
Patch Set: '' Created 11 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
« no previous file with comments | « chrome/browser/gtk/browser_window_gtk.cc ('k') | chrome/browser/gtk/find_bar_gtk.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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_GTK_FIND_BAR_GTK_H_ 5 #ifndef CHROME_BROWSER_GTK_FIND_BAR_GTK_H_
6 #define CHROME_BROWSER_GTK_FIND_BAR_GTK_H_ 6 #define CHROME_BROWSER_GTK_FIND_BAR_GTK_H_
7 7
8 #include <gtk/gtk.h> 8 #include <gtk/gtk.h>
9 9
10 #include "base/basictypes.h" 10 #include "base/basictypes.h"
(...skipping 14 matching lines...) Expand all
25 public: 25 public:
26 FindBarGtk(BrowserWindowGtk* browser); 26 FindBarGtk(BrowserWindowGtk* browser);
27 virtual ~FindBarGtk(); 27 virtual ~FindBarGtk();
28 28
29 // Callback when the text in the find box changes. 29 // Callback when the text in the find box changes.
30 void ContentsChanged(); 30 void ContentsChanged();
31 31
32 // Callback when Escape is pressed. 32 // Callback when Escape is pressed.
33 void EscapePressed(); 33 void EscapePressed();
34 34
35 GtkWidget* widget() const { return container_.get(); } 35 GtkWidget* widget() const { return fixed_.get(); }
36 36
37 // Methods from FindBar. 37 // Methods from FindBar.
38 virtual FindBarController* GetFindBarController() const { 38 virtual FindBarController* GetFindBarController() const {
39 return find_bar_controller_; 39 return find_bar_controller_;
40 } 40 }
41 virtual void SetFindBarController(FindBarController* find_bar_controller) { 41 virtual void SetFindBarController(FindBarController* find_bar_controller) {
42 find_bar_controller_ = find_bar_controller; 42 find_bar_controller_ = find_bar_controller;
43 } 43 }
44 virtual void Show(); 44 virtual void Show();
45 virtual void Hide(bool animate); 45 virtual void Hide(bool animate);
46 virtual void SetFocusAndSelection(); 46 virtual void SetFocusAndSelection();
47 virtual void ClearResults(const FindNotificationDetails& results); 47 virtual void ClearResults(const FindNotificationDetails& results);
48 virtual void StopAnimation(); 48 virtual void StopAnimation();
49 virtual void MoveWindowIfNecessary(const gfx::Rect& selection_rect, 49 virtual void MoveWindowIfNecessary(const gfx::Rect& selection_rect,
50 bool no_redraw); 50 bool no_redraw);
51 virtual void SetFindText(const string16& find_text); 51 virtual void SetFindText(const string16& find_text);
52 virtual void UpdateUIForFindResult(const FindNotificationDetails& result, 52 virtual void UpdateUIForFindResult(const FindNotificationDetails& result,
53 const string16& find_text); 53 const string16& find_text);
54 virtual gfx::Rect GetDialogPosition(gfx::Rect avoid_overlapping_rect); 54 virtual gfx::Rect GetDialogPosition(gfx::Rect avoid_overlapping_rect);
55 virtual void SetDialogPosition(const gfx::Rect& new_pos, bool no_redraw); 55 virtual void SetDialogPosition(const gfx::Rect& new_pos, bool no_redraw);
56 virtual bool IsFindBarVisible(); 56 virtual bool IsFindBarVisible();
57 virtual void RestoreSavedFocus(); 57 virtual void RestoreSavedFocus();
58 virtual FindBarTesting* GetFindBarTesting(); 58 virtual FindBarTesting* GetFindBarTesting();
59 59
60 // Methods from FindBarTesting. 60 // Methods from FindBarTesting.
61 virtual bool GetFindBarWindowInfo(gfx::Point* position, 61 virtual bool GetFindBarWindowInfo(gfx::Point* position,
62 bool* fully_visible); 62 bool* fully_visible);
63 63
64 // Make sure the find bar is foremost on the z axis in the widget hierarchy
65 // by hiding and showing it.
66 void AssureOnTop();
67
64 private: 68 private:
65 void InitWidgets(); 69 void InitWidgets();
66 70
67 // Callback for previous, next, and close button. 71 // Callback for previous, next, and close button.
68 static void OnButtonPressed(GtkWidget* button, FindBarGtk* find_bar); 72 static void OnButtonPressed(GtkWidget* button, FindBarGtk* find_bar);
69 73
70 // GtkHBox containing the find bar widgets. 74 // Called when |fixed_| changes sizes. Used to position |container_|.
71 OwnedWidgetGtk container_; 75 static void OnSizeAllocate(GtkWidget* fixed,
76 GtkAllocation* allocation,
77 FindBarGtk* container_);
78
79 // GtkFixed containing the find bar widgets.
80 OwnedWidgetGtk fixed_;
81
82 // An event box which shows the background for |fixed_|. We could just set
83 // |fixed_| to have its own GdkWindow and draw the background directly, but
84 // then |container_| would clip to the bounds of |fixed_|.
85 GtkWidget* border_;
86
87 // A GtkAlignment which holds what the user perceives as the findbar (the text
88 // field, the buttons, etc.).
89 GtkWidget* container_;
72 90
73 // The widget where text is entered. 91 // The widget where text is entered.
74 GtkWidget* find_text_; 92 GtkWidget* find_text_;
75 93
76 // The next and previous match buttons. 94 // The next and previous match buttons.
77 scoped_ptr<CustomDrawButton> find_previous_button_; 95 scoped_ptr<CustomDrawButton> find_previous_button_;
78 scoped_ptr<CustomDrawButton> find_next_button_; 96 scoped_ptr<CustomDrawButton> find_next_button_;
79 97
80 // The X to close the find bar. 98 // The X to close the find bar.
81 scoped_ptr<CustomDrawButton> close_button_; 99 scoped_ptr<CustomDrawButton> close_button_;
82 100
83 // Pointer back to the owning controller. 101 // Pointer back to the owning controller.
84 FindBarController* find_bar_controller_; 102 FindBarController* find_bar_controller_;
85 103
86 DISALLOW_COPY_AND_ASSIGN(FindBarGtk); 104 DISALLOW_COPY_AND_ASSIGN(FindBarGtk);
87 }; 105 };
88 106
89 #endif // CHROME_BROWSER_GTK_FIND_BAR_GTK_H_ 107 #endif // CHROME_BROWSER_GTK_FIND_BAR_GTK_H_
OLDNEW
« no previous file with comments | « chrome/browser/gtk/browser_window_gtk.cc ('k') | chrome/browser/gtk/find_bar_gtk.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698