]> git.saurik.com Git - wxWidgets.git/blame_incremental - include/wx/gtk/private/object.h
Extract wxFDIOHandler in its own header.
[wxWidgets.git] / include / wx / gtk / private / object.h
... / ...
CommitLineData
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
18template <typename T>
19class wxGtkObject
20{
21public:
22 explicit wxGtkObject(T *p) : m_ptr(p) { }
23 ~wxGtkObject() { g_object_unref(m_ptr); }
24
25 operator T *() const { return m_ptr; }
26
27private:
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