File indexing completed on 2024-05-05 05:34:56

0001 #ifndef oxygensignal_h
0002 #define oxygensignal_h
0003 
0004 /*
0005 * this file is part of the oxygen gtk engine
0006 * SPDX-FileCopyrightText: 2010 Hugo Pereira Da Costa <hugo.pereira@free.fr>
0007 *
0008 * SPDX-License-Identifier: LGPL-2.0-or-later
0009 */
0010 
0011 #include <gtk/gtk.h>
0012 #include <cassert>
0013 #include <string>
0014 
0015 namespace Oxygen
0016 {
0017     //! handles gtk signal connections
0018     class Signal
0019     {
0020         public:
0021 
0022         //! constructor
0023         Signal( void ):
0024             _id(0),
0025             _object(0L)
0026         {}
0027 
0028         //! destructor
0029         virtual ~Signal( void )
0030         {}
0031 
0032         //! connect
0033         void connect( GObject*, const std::string&, GCallback, gpointer );
0034 
0035         //! disconnect
0036         void disconnect( void );
0037 
0038         //! check if signal belongs to given object
0039         bool belongsTo( GObject* object ) const
0040         { return object == _object; }
0041 
0042         private:
0043 
0044         //! signal id
0045         guint _id;
0046 
0047         //! connected object
0048         GObject* _object;
0049 
0050     };
0051 
0052 }
0053 #endif