1 #ifndef oxygenmainwindowdata_h
2 #define oxygenmainwindowdata_h
3 /*
4 * this file is part of the oxygen gtk engine
5 * Copyright (c) 2010 Hugo Pereira Da Costa <hugo.pereira@free.fr>
6 * Copyright (c) 2010 Ruslan Kabatsayev <b7.10110111@gmail.com>
7 *
8 * This  library is free  software; you can  redistribute it and/or
9 * modify it  under  the terms  of the  GNU Lesser  General  Public
10 * License  as published  by the Free  Software  Foundation; either
11 * version 2 of the License, or(at your option ) any later version.
12 *
13 * This library is distributed  in the hope that it will be useful,
14 * but  WITHOUT ANY WARRANTY; without even  the implied warranty of
15 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
16 * Lesser General Public License for more details.
17 *
18 * You should have received a copy of the GNU Lesser General Public
19 * License  along  with  this library;  if not,  write to  the Free
20 * Software Foundation, Inc., 51  Franklin St, Fifth Floor, Boston,
21 * MA 02110-1301, USA.
22 */
23 
24 #include "oxygensignal.h"
25 #include "oxygentimer.h"
26 
27 #include <gtk/gtk.h>
28 
29 namespace Oxygen
30 {
31     // track main window resize events
32     class MainWindowData
33     {
34 
35         public:
36 
37         //! constructor
MainWindowData(void)38         MainWindowData( void ):
39             _target(0L),
40             _locked(false),
41             _width(-1),
42             _height(-1)
43         {}
44 
45         //! destructor
~MainWindowData(void)46         virtual ~MainWindowData( void )
47         { disconnect( _target ); }
48 
49         //! setup connections
50         void connect( GtkWidget* );
51 
52         //! disconnect
53         void disconnect( GtkWidget* );
54 
55         protected:
56 
57         //! update size
58         void updateSize( int width, int height );
59 
60         //!name static callbacks
61         static gboolean configureNotifyEvent( GtkWidget*, GdkEventConfigure*, gpointer);
62 
63         //! delayed update
64         static gboolean delayedUpdate( gpointer );
65 
66         private:
67 
68         //! pointer to associated widget
69         GtkWidget* _target;
70 
71         //! timer
72         Timer _timer;
73 
74         //! true if next update must be delayed
75         bool _locked;
76 
77         //! configure signal id
78         Signal _configureId;
79 
80         //! old width
81         int _width;
82 
83         //! old height
84         int _height;
85 
86 
87     };
88 
89 }
90 
91 #endif
92