]> git.saurik.com Git - wxWidgets.git/blame - include/wx/gtk/private/object.h
Fix wxPropertyGrid::GetPropertyRect when the last item is collapsed.
[wxWidgets.git] / include / wx / gtk / private / object.h
CommitLineData
f3d74739
VZ
1///////////////////////////////////////////////////////////////////////////////
2// Name: wx/gtk/private/object.h
3// Purpose: wxGtkObject class declaration
4// Author: Vadim Zeitlin
5// Created: 2008-08-27
f3d74739
VZ
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
17template <typename T>
18class wxGtkObject
19{
20public:
21 explicit wxGtkObject(T *p) : m_ptr(p) { }
22 ~wxGtkObject() { g_object_unref(m_ptr); }
23
24 operator T *() const { return m_ptr; }
25
26private:
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
c0c133e1 31 wxDECLARE_NO_COPY_CLASS(wxGtkObject);
f3d74739
VZ
32};
33
34#endif // _WX_GTK_PRIVATE_OBJECT_H_
35