1 #ifndef oxygengroupboxlabeldata_h 2 #define oxygengroupboxlabeldata_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 * 7 * This library is free software; you can redistribute it and/or 8 * modify it under the terms of the GNU Lesser General Public 9 * License as published by the Free Software Foundation; either 10 * version 2 of the License, or(at your option ) any later version. 11 * 12 * This library is distributed in the hope that it will be useful, 13 * but WITHOUT ANY WARRANTY; without even the implied warranty of 14 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 15 * Lesser General Public License for more details. 16 * 17 * You should have received a copy of the GNU Lesser General Public 18 * License along with this library; if not, write to the Free 19 * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, 20 * MA 02110-1301, USA. 21 */ 22 23 #include "../oxygengtkutils.h" 24 25 #include <gtk/gtk.h> 26 27 namespace Oxygen 28 { 29 // track groupboxlabels 30 class GroupBoxLabelData 31 { 32 33 public: 34 35 //! constructor GroupBoxLabelData(void)36 GroupBoxLabelData( void ): 37 _resized( false ) 38 {} 39 40 //! destructor ~GroupBoxLabelData(void)41 virtual ~GroupBoxLabelData( void ) 42 {} 43 44 //! setup connections connect(GtkWidget *)45 void connect( GtkWidget* ) 46 {} 47 48 //! disconnect disconnect(GtkWidget *)49 void disconnect( GtkWidget* ) 50 { _resized = false; } 51 52 //! adjust widget size adjustSize(GtkWidget * widget)53 void adjustSize( GtkWidget* widget ) 54 { 55 if( _resized ) return; 56 const GdkRectangle allocation( Gtk::gtk_widget_get_allocation( widget ) ); 57 if( allocation.height > 1 ) 58 { 59 60 // Save resized state before actually resizing to prevent infinite recursion (bug 305833) 61 _resized = true; 62 gtk_widget_set_size_request( widget, allocation.width, allocation.height+14 ); 63 64 } 65 } 66 67 private: 68 69 bool _resized; 70 71 }; 72 73 } 74 75 #endif 76