File indexing completed on 2024-05-05 05:34:56
0001 #ifndef oxygendemowidget_h 0002 #define oxygendemowidget_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 * based on the Null Theme Engine for Gtk+. 0009 * SPDX-FileCopyrightText: 2008 Robert Staudinger <robert.staudinger@gmail.com> 0010 * 0011 * SPDX-License-Identifier: LGPL-2.0-or-later 0012 */ 0013 0014 #include "oxygensignalhandler.h" 0015 0016 #include <gtk/gtk.h> 0017 #include <cassert> 0018 #include <string> 0019 0020 namespace Oxygen 0021 { 0022 0023 class DemoWidget: public SignalHandler 0024 { 0025 0026 public: 0027 0028 //! constructor 0029 DemoWidget( void ): 0030 _mainWidget( 0L ), 0031 _widget(0L), 0032 _enabled( true ) 0033 {} 0034 0035 //! destructor 0036 virtual ~DemoWidget( void ) 0037 {} 0038 0039 //! main widget 0040 virtual GtkWidget* mainWidget( void ) 0041 { return _mainWidget; } 0042 0043 //! enable state 0044 virtual void setEnabled( bool value ) 0045 { 0046 _enabled = value; 0047 if( _widget ) 0048 { gtk_widget_set_sensitive( _widget, _enabled ); } 0049 } 0050 0051 //! name 0052 const std::string& name( void ) const 0053 { return _name; } 0054 0055 //! icon name 0056 const std::string& iconName( void ) const 0057 { return _iconName; } 0058 0059 protected: 0060 0061 //! name 0062 void setName( const std::string name ) 0063 { _name = name; } 0064 0065 //! comments 0066 void setComments( const std::string comments ) 0067 { _comments = comments; } 0068 0069 //! icon name 0070 void setIconName( const std::string iconName ) 0071 { _iconName = iconName; } 0072 0073 //! assign main widget 0074 virtual void setWidget( GtkWidget *widget ) 0075 { _widget = widget; } 0076 0077 //! realize widget 0078 void realize( void ); 0079 0080 private: 0081 0082 //! copy constructor 0083 DemoWidget( const DemoWidget& ) 0084 { assert( false ); } 0085 0086 //! assignment operator 0087 DemoWidget& operator = (const DemoWidget& ) 0088 { 0089 assert( false ); 0090 return *this; 0091 } 0092 0093 //! page name 0094 std::string _name; 0095 0096 //! page comments 0097 std::string _comments; 0098 0099 //! icon name 0100 std::string _iconName; 0101 0102 //! main widget 0103 GtkWidget* _mainWidget; 0104 0105 //! contents widget 0106 GtkWidget* _widget; 0107 0108 //! enable state 0109 bool _enabled; 0110 0111 }; 0112 0113 } 0114 0115 #endif