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

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

Issue 113590: Quick reimplementation of StatusBubbleGtk to not suck as much. (Closed)
Patch Set: (git cl uploads dirty tree state!?) 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
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_STATUS_BUBBLE_GTK_H_ 5 #ifndef CHROME_BROWSER_GTK_STATUS_BUBBLE_GTK_H_
6 #define CHROME_BROWSER_GTK_STATUS_BUBBLE_GTK_H_ 6 #define CHROME_BROWSER_GTK_STATUS_BUBBLE_GTK_H_
7 7
8 #include <gtk/gtk.h>
9
8 #include <string> 10 #include <string>
9 11
10 #include <gtk/gtk.h> 12 #include "base/scoped_ptr.h"
11
12 #include "chrome/browser/status_bubble.h" 13 #include "chrome/browser/status_bubble.h"
14 #include "chrome/common/owned_widget_gtk.h"
13 15
14 class GURL; 16 class GURL;
15 17
18 // GTK implementation of StatusBubble. Unlike Windows, our status bubble
19 // doesn't have the nice leave-the-window effect since we can't rely on the
20 // window manager to not try to be "helpful" and center our popups, etc.
21 // We therefore position it absolutely in a GtkFixed, that we don't own.
16 class StatusBubbleGtk : public StatusBubble { 22 class StatusBubbleGtk : public StatusBubble {
17 public: 23 public:
18 StatusBubbleGtk(GtkWindow* parent); 24 StatusBubbleGtk();
19 virtual ~StatusBubbleGtk(); 25 virtual ~StatusBubbleGtk();
20 26
21 // StatusBubble implementation. 27 // StatusBubble implementation.
22 virtual void SetStatus(const std::wstring& status); 28 virtual void SetStatus(const std::wstring& status);
23 virtual void SetURL(const GURL& url, const std::wstring& languages); 29 virtual void SetURL(const GURL& url, const std::wstring& languages);
24 virtual void Hide(); 30 virtual void Hide();
25 virtual void MouseMoved(); 31 virtual void MouseMoved();
26 32
27 void SetStatus(const std::string& status_utf8); 33 void SetStatus(const std::string& status_utf8);
28 34
35 // Notification from our parent GtkFixed about its size. |allocation| is the
36 // size of our |parent| GtkFixed, and we use it to position our status bubble
37 // directly on top of the current render view.
38 void SetParentAllocation(GtkWidget* parent, GtkAllocation* allocation);
39
40 // Top of the widget hierarchy for a StatusBubble. This top level widget is
41 // guarenteed to have its gtk_widget_name set to "status-bubble" for
42 // identification.
43 GtkWidget* widget() { return container_.get(); }
44
29 private: 45 private:
30 // Construct the window/widget. 46 // Sets the status bubble's location in the parent GtkFixed, shows the widget
31 void Create(); 47 // and makes sure that the status bubble has the highest z-order.
48 void Show();
32 49
33 // Reposition ourselves atop our parent window. 50 // Builds the widgets, containers, etc.
34 void Reposition(); 51 void InitWidgets();
35 52
36 // The window we display on top of. 53 // An ad hoc, informally-specified, bug-ridden, slow implementation of half
37 GtkWindow* parent_; 54 // of GTK's requisition/allocation system. We use this to position the status
55 // bubble on top of our parent GtkFixed.
56 void SetStatusBubbleSize();
38 57
39 // The top-level (popup) window we own. 58 // A GtkAlignment that is the child of |slide_widget_|.
40 // NULL when we're not showing. 59 OwnedWidgetGtk container_;
41 GtkWidget* window_;
42 60
43 // The GtkLabel holding the text./ 61 // The GtkLabel holding the text.
44 GtkWidget* label_; 62 GtkWidget* label_;
63
64 // Our parent GtkFixed. (We don't own this; we only keep a reference as we
65 // set our own size by notifying |parent_| of our desired size.)
66 GtkWidget* parent_;
67
68 // |parent_|'s GtkAllocation. We make sure that |container_| lives along the
69 // bottom of this and doesn't protrude.
70 GtkAllocation parent_allocation_;
45 }; 71 };
46 72
47 #endif // #ifndef CHROME_BROWSER_GTK_STATUS_BUBBLE_GTK_H_ 73 #endif // CHROME_BROWSER_GTK_STATUS_BUBBLE_GTK_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698