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

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

Issue 7328011: Introduce ui.dll / libui.so for the component build. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src/
Patch Set: '' Created 9 years, 5 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) 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 #ifndef UI_BASE_GTK_GTK_SIGNAL_REGISTRAR_H_ 5 #ifndef UI_BASE_GTK_GTK_SIGNAL_REGISTRAR_H_
6 #define UI_BASE_GTK_GTK_SIGNAL_REGISTRAR_H_ 6 #define UI_BASE_GTK_GTK_SIGNAL_REGISTRAR_H_
7 #pragma once 7 #pragma once
8 8
9 #include <glib.h> 9 #include <glib.h>
10 #include <map> 10 #include <map>
11 #include <vector> 11 #include <vector>
12 12
13 #include "base/basictypes.h" 13 #include "base/basictypes.h"
14 #include "ui/ui_api.h"
14 15
15 typedef void (*GCallback) (void); 16 typedef void (*GCallback) (void);
16 typedef struct _GObject GObject; 17 typedef struct _GObject GObject;
17 typedef struct _GtkWidget GtkWidget; 18 typedef struct _GtkWidget GtkWidget;
18 19
19 namespace ui { 20 namespace ui {
20 21
21 // A class that ensures that callbacks don't run on stale owner objects. Similar 22 // A class that ensures that callbacks don't run on stale owner objects. Similar
22 // in spirit to NotificationRegistrar. Use as follows: 23 // in spirit to NotificationRegistrar. Use as follows:
23 // 24 //
24 // class ChromeObject { 25 // class ChromeObject {
25 // public: 26 // public:
26 // ChromeObject() { 27 // ChromeObject() {
27 // ... 28 // ...
28 // 29 //
29 // signals_.Connect(widget, "event", CallbackThunk, this); 30 // signals_.Connect(widget, "event", CallbackThunk, this);
30 // } 31 // }
31 // 32 //
32 // ... 33 // ...
33 // 34 //
34 // private: 35 // private:
35 // GtkSignalRegistrar signals_; 36 // GtkSignalRegistrar signals_;
36 // }; 37 // };
37 // 38 //
38 // When |signals_| goes down, it will disconnect the handlers connected via 39 // When |signals_| goes down, it will disconnect the handlers connected via
39 // Connect. 40 // Connect.
40 class GtkSignalRegistrar { 41 class UI_API GtkSignalRegistrar {
41 public: 42 public:
42 GtkSignalRegistrar(); 43 GtkSignalRegistrar();
43 ~GtkSignalRegistrar(); 44 ~GtkSignalRegistrar();
44 45
45 // Connect before the default handler. Returns the handler id. 46 // Connect before the default handler. Returns the handler id.
46 glong Connect(gpointer instance, const gchar* detailed_signal, 47 glong Connect(gpointer instance, const gchar* detailed_signal,
47 GCallback signal_handler, gpointer data); 48 GCallback signal_handler, gpointer data);
48 // Connect after the default handler. Returns the handler id. 49 // Connect after the default handler. Returns the handler id.
49 glong ConnectAfter(gpointer instance, const gchar* detailed_signal, 50 glong ConnectAfter(gpointer instance, const gchar* detailed_signal,
50 GCallback signal_handler, gpointer data); 51 GCallback signal_handler, gpointer data);
(...skipping 12 matching lines...) Expand all
63 GCallback signal_handler, gpointer data, bool after); 64 GCallback signal_handler, gpointer data, bool after);
64 65
65 HandlerMap handler_lists_; 66 HandlerMap handler_lists_;
66 67
67 DISALLOW_COPY_AND_ASSIGN(GtkSignalRegistrar); 68 DISALLOW_COPY_AND_ASSIGN(GtkSignalRegistrar);
68 }; 69 };
69 70
70 } // namespace ui 71 } // namespace ui
71 72
72 #endif // UI_BASE_GTK_GTK_SIGNAL_REGISTRAR_H_ 73 #endif // UI_BASE_GTK_GTK_SIGNAL_REGISTRAR_H_
OLDNEW
« no previous file with comments | « ui/base/gtk/gtk_im_context_util.h ('k') | ui/base/gtk/gtk_windowing.h » ('j') | ui/ui.gyp » ('J')

Powered by Google App Engine
This is Rietveld 408576698