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

Side by Side Diff: ui/base/gtk/owned_widget_gtk.h

Issue 93863005: ui: Rename ui_export.h to ui_base_export.h (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: UI_BASE_IMPLEMENTATION Created 6 years, 11 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 | « ui/base/gtk/gtk_windowing.h ('k') | ui/base/gtk/scoped_region.h » ('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) 2011 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 // This class assists you in dealing with a specific situation when managing 5 // This class assists you in dealing with a specific situation when managing
6 // ownership between a C++ object and a GTK widget. It is common to have a 6 // ownership between a C++ object and a GTK widget. It is common to have a
7 // C++ object which encapsulates a GtkWidget, and that widget is exposed from 7 // C++ object which encapsulates a GtkWidget, and that widget is exposed from
8 // the object for use outside of the class. In this situation, you commonly 8 // the object for use outside of the class. In this situation, you commonly
9 // want the GtkWidget's lifetime to match its C++ object's lifetime. Using an 9 // want the GtkWidget's lifetime to match its C++ object's lifetime. Using an
10 // OwnedWigetGtk will take ownership over the initial reference of the 10 // OwnedWigetGtk will take ownership over the initial reference of the
(...skipping 32 matching lines...) Expand 10 before | Expand all | Expand 10 after
43 // GtkWidget* widget = gtk_widget_new(); 43 // GtkWidget* widget = gtk_widget_new();
44 // g_object_ref_sink(widget); // Claim the initial floating reference. 44 // g_object_ref_sink(widget); // Claim the initial floating reference.
45 // ... 45 // ...
46 // gtk_destroy_widget(widget); // Ask all code to destroy their references. 46 // gtk_destroy_widget(widget); // Ask all code to destroy their references.
47 // g_object_unref(widget); // Destroy the initial reference we had claimed. 47 // g_object_unref(widget); // Destroy the initial reference we had claimed.
48 48
49 #ifndef UI_BASE_GTK_OWNED_WIDGET_GTK_H_ 49 #ifndef UI_BASE_GTK_OWNED_WIDGET_GTK_H_
50 #define UI_BASE_GTK_OWNED_WIDGET_GTK_H_ 50 #define UI_BASE_GTK_OWNED_WIDGET_GTK_H_
51 51
52 #include "base/basictypes.h" 52 #include "base/basictypes.h"
53 #include "ui/base/ui_export.h" 53 #include "ui/base/ui_base_export.h"
54 54
55 typedef struct _GtkWidget GtkWidget; 55 typedef struct _GtkWidget GtkWidget;
56 56
57 namespace ui { 57 namespace ui {
58 58
59 class UI_EXPORT OwnedWidgetGtk { 59 class UI_BASE_EXPORT OwnedWidgetGtk {
60 public: 60 public:
61 // Create an instance that isn't managing any ownership. 61 // Create an instance that isn't managing any ownership.
62 OwnedWidgetGtk() : widget_(NULL) { } 62 OwnedWidgetGtk() : widget_(NULL) { }
63 // Create an instance that owns |widget|. 63 // Create an instance that owns |widget|.
64 explicit OwnedWidgetGtk(GtkWidget* widget) : widget_(NULL) { Own(widget); } 64 explicit OwnedWidgetGtk(GtkWidget* widget) : widget_(NULL) { Own(widget); }
65 65
66 ~OwnedWidgetGtk(); 66 ~OwnedWidgetGtk();
67 67
68 // Return the currently owned widget, or NULL if no widget is owned. 68 // Return the currently owned widget, or NULL if no widget is owned.
69 GtkWidget* get() const { return widget_; } 69 GtkWidget* get() const { return widget_; }
(...skipping 16 matching lines...) Expand all
86 86
87 private: 87 private:
88 GtkWidget* widget_; 88 GtkWidget* widget_;
89 89
90 DISALLOW_COPY_AND_ASSIGN(OwnedWidgetGtk); 90 DISALLOW_COPY_AND_ASSIGN(OwnedWidgetGtk);
91 }; 91 };
92 92
93 } // namespace ui 93 } // namespace ui
94 94
95 #endif // UI_BASE_GTK_OWNED_WIDGET_GTK_H_ 95 #endif // UI_BASE_GTK_OWNED_WIDGET_GTK_H_
OLDNEW
« no previous file with comments | « ui/base/gtk/gtk_windowing.h ('k') | ui/base/gtk/scoped_region.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698