]> git.saurik.com Git - wxWidgets.git/blob - include/wx/gtk/private/object.h
Move wxInfoBar to core library from adv.
[wxWidgets.git] / include / wx / gtk / private / object.h
1 ///////////////////////////////////////////////////////////////////////////////
2 // Name: wx/gtk/private/object.h
3 // Purpose: wxGtkObject class declaration
4 // Author: Vadim Zeitlin
5 // Created: 2008-08-27
6 // RCS-ID: $Id$
7 // Copyright: (c) 2008 Vadim Zeitlin <vadim@wxwindows.org>
8 // Licence: wxWindows licence
9 ///////////////////////////////////////////////////////////////////////////////
10
11 #ifndef _WX_GTK_PRIVATE_OBJECT_H_
12 #define _WX_GTK_PRIVATE_OBJECT_H_
13
14 // ----------------------------------------------------------------------------
15 // Convenience class for calling g_object_unref() automatically
16 // ----------------------------------------------------------------------------
17
18 template <typename T>
19 class wxGtkObject
20 {
21 public:
22 explicit wxGtkObject(T *p) : m_ptr(p) { }
23 ~wxGtkObject() { g_object_unref(m_ptr); }
24
25 operator T *() const { return m_ptr; }
26
27 private:
28 T * const m_ptr;
29
30 // copying could be implemented by using g_object_ref() but for now there
31 // is no need for it so don't implement it
32 wxDECLARE_NO_COPY_CLASS(wxGtkObject);
33 };
34
35 #endif // _WX_GTK_PRIVATE_OBJECT_H_
36