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

0001 #ifndef oxygenmainwindowdata_h
0002 #define oxygenmainwindowdata_h
0003 /*
0004 * this file is part of the oxygen gtk engine
0005 * SPDX-FileCopyrightText: 2010 Hugo Pereira Da Costa <hugo.pereira@free.fr>
0006 * SPDX-FileCopyrightText: 2010 Ruslan Kabatsayev <b7.10110111@gmail.com>
0007 *
0008 * SPDX-License-Identifier: LGPL-2.0-or-later
0009 */
0010 
0011 #include "oxygensignal.h"
0012 #include "oxygentimer.h"
0013 
0014 #include <gtk/gtk.h>
0015 
0016 namespace Oxygen
0017 {
0018     // track main window resize events
0019     class MainWindowData
0020     {
0021 
0022         public:
0023 
0024         //! constructor
0025         MainWindowData( void ):
0026             _target(0L),
0027             _locked(false),
0028             _width(-1),
0029             _height(-1)
0030         {}
0031 
0032         //! destructor
0033         virtual ~MainWindowData( void )
0034         { disconnect( _target ); }
0035 
0036         //! setup connections
0037         void connect( GtkWidget* );
0038 
0039         //! disconnect
0040         void disconnect( GtkWidget* );
0041 
0042         protected:
0043 
0044         //! update size
0045         void updateSize( int width, int height );
0046 
0047         //!name static callbacks
0048         static gboolean configureNotifyEvent( GtkWidget*, GdkEventConfigure*, gpointer);
0049 
0050         //! delayed update
0051         static gboolean delayedUpdate( gpointer );
0052 
0053         private:
0054 
0055         //! pointer to associated widget
0056         GtkWidget* _target;
0057 
0058         //! timer
0059         Timer _timer;
0060 
0061         //! true if next update must be delayed
0062         bool _locked;
0063 
0064         //! configure signal id
0065         Signal _configureId;
0066 
0067         //! old width
0068         int _width;
0069 
0070         //! old height
0071         int _height;
0072 
0073 
0074     };
0075 
0076 }
0077 
0078 #endif