]> git.saurik.com Git - wxWidgets.git/blob - include/wx/gtk/private/object.h
Add wxActivateEvent::GetActivationReason().
[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 // Copyright: (c) 2008 Vadim Zeitlin <vadim@wxwindows.org>
7 // Licence: wxWindows licence
8 ///////////////////////////////////////////////////////////////////////////////
9
10 #ifndef _WX_GTK_PRIVATE_OBJECT_H_
11 #define _WX_GTK_PRIVATE_OBJECT_H_
12
13 // ----------------------------------------------------------------------------
14 // Convenience class for calling g_object_unref() automatically
15 // ----------------------------------------------------------------------------
16
17 template <typename T>
18 class wxGtkObject
19 {
20 public:
21 explicit wxGtkObject(T *p) : m_ptr(p) { }
22 ~wxGtkObject() { g_object_unref(m_ptr); }
23
24 operator T *() const { return m_ptr; }
25
26 private:
27 T * const m_ptr;
28
29 // copying could be implemented by using g_object_ref() but for now there
30 // is no need for it so don't implement it
31 wxDECLARE_NO_COPY_CLASS(wxGtkObject);
32 };
33
34 #endif // _WX_GTK_PRIVATE_OBJECT_H_
35