| OLD | NEW |
| 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> | 8 #include <gtk/gtk.h> |
| 9 | 9 |
| 10 #include <string> | 10 #include <string> |
| (...skipping 20 matching lines...) Expand all Loading... |
| 31 virtual void Hide(); | 31 virtual void Hide(); |
| 32 virtual void MouseMoved(); | 32 virtual void MouseMoved(); |
| 33 | 33 |
| 34 // Called when the download shelf becomes visible or invisible. | 34 // Called when the download shelf becomes visible or invisible. |
| 35 // This is used by to ensure that the status bubble does not obscure | 35 // This is used by to ensure that the status bubble does not obscure |
| 36 // the download shelf, when it is visible. | 36 // the download shelf, when it is visible. |
| 37 virtual void UpdateDownloadShelfVisibility(bool visible) { } | 37 virtual void UpdateDownloadShelfVisibility(bool visible) { } |
| 38 | 38 |
| 39 void SetStatus(const std::string& status_utf8); | 39 void SetStatus(const std::string& status_utf8); |
| 40 | 40 |
| 41 // Notification from our parent GtkFixed about its size. |allocation| is the | |
| 42 // size of our |parent| GtkFixed, and we use it to position our status bubble | |
| 43 // directly on top of the current render view. | |
| 44 void SetParentAllocation(GtkWidget* parent, GtkAllocation* allocation); | |
| 45 | |
| 46 // Top of the widget hierarchy for a StatusBubble. This top level widget is | 41 // Top of the widget hierarchy for a StatusBubble. This top level widget is |
| 47 // guarenteed to have its gtk_widget_name set to "status-bubble" for | 42 // guarenteed to have its gtk_widget_name set to "status-bubble" for |
| 48 // identification. | 43 // identification. |
| 49 GtkWidget* widget() { return container_.get(); } | 44 GtkWidget* widget() { return container_.get(); } |
| 50 | 45 |
| 51 private: | 46 private: |
| 52 // Sets the status bubble's location in the parent GtkFixed, shows the widget | 47 // Sets the status bubble's location in the parent GtkFixed, shows the widget |
| 53 // and makes sure that the status bubble has the highest z-order. | 48 // and makes sure that the status bubble has the highest z-order. |
| 54 void Show(); | 49 void Show(); |
| 55 | 50 |
| 56 // Sets an internal timer to hide the status bubble after a delay. | 51 // Sets an internal timer to hide the status bubble after a delay. |
| 57 void HideInASecond(); | 52 void HideInASecond(); |
| 58 | 53 |
| 59 // Builds the widgets, containers, etc. | 54 // Builds the widgets, containers, etc. |
| 60 void InitWidgets(); | 55 void InitWidgets(); |
| 61 | 56 |
| 62 // An ad hoc, informally-specified, bug-ridden, slow implementation of half | |
| 63 // of GTK's requisition/allocation system. We use this to position the status | |
| 64 // bubble on top of our parent GtkFixed. | |
| 65 void SetStatusBubbleSize(); | |
| 66 | |
| 67 // A GtkAlignment that is the child of |slide_widget_|. | 57 // A GtkAlignment that is the child of |slide_widget_|. |
| 68 OwnedWidgetGtk container_; | 58 OwnedWidgetGtk container_; |
| 69 | 59 |
| 70 // The GtkLabel holding the text. | 60 // The GtkLabel holding the text. |
| 71 GtkWidget* label_; | 61 GtkWidget* label_; |
| 72 | 62 |
| 73 // Our parent GtkFixed. (We don't own this; we only keep a reference as we | |
| 74 // set our own size by notifying |parent_| of our desired size.) | |
| 75 GtkWidget* parent_; | |
| 76 | |
| 77 // |parent_|'s GtkAllocation. We make sure that |container_| lives along the | |
| 78 // bottom of this and doesn't protrude. | |
| 79 GtkAllocation parent_allocation_; | |
| 80 | |
| 81 // A timer that hides our window after a delay. | 63 // A timer that hides our window after a delay. |
| 82 ScopedRunnableMethodFactory<StatusBubbleGtk> timer_factory_; | 64 ScopedRunnableMethodFactory<StatusBubbleGtk> timer_factory_; |
| 83 }; | 65 }; |
| 84 | 66 |
| 85 #endif // CHROME_BROWSER_GTK_STATUS_BUBBLE_GTK_H_ | 67 #endif // CHROME_BROWSER_GTK_STATUS_BUBBLE_GTK_H_ |
| OLD | NEW |