libyui
3.0.10
|
00001 /* 00002 Copyright (C) 2000-2012 Novell, Inc 00003 This library is free software; you can redistribute it and/or modify 00004 it under the terms of the GNU Lesser General Public License as 00005 published by the Free Software Foundation; either version 2.1 of the 00006 License, or (at your option) version 3.0 of the License. This library 00007 is distributed in the hope that it will be useful, but WITHOUT ANY 00008 WARRANTY; without even the implied warranty of MERCHANTABILITY or 00009 FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public 00010 License for more details. You should have received a copy of the GNU 00011 Lesser General Public License along with this library; if not, write 00012 to the Free Software Foundation, Inc., 51 Franklin Street, Fifth 00013 Floor, Boston, MA 02110-1301 USA 00014 */ 00015 00016 00017 /*-/ 00018 00019 File: YTimezoneSelector.cc 00020 00021 Author: Stephan Kulow <coolo@suse.de> 00022 00023 /-*/ 00024 00025 00026 #define YUILogComponent "ui" 00027 #include "YUILog.h" 00028 00029 #include "YUISymbols.h" 00030 #include "YTimezoneSelector.h" 00031 00032 00033 class YTimezoneSelectorPrivate 00034 { 00035 bool dummy; 00036 }; 00037 00038 00039 00040 00041 YTimezoneSelector::YTimezoneSelector( YWidget * parent, 00042 const std::string &pixmap, 00043 const std::map<std::string, std::string> &timezones ) 00044 : YWidget( parent ) 00045 { 00046 } 00047 00048 00049 YTimezoneSelector::~YTimezoneSelector() 00050 { 00051 // NOP 00052 } 00053 00054 00055 const YPropertySet & 00056 YTimezoneSelector::propertySet() 00057 { 00058 static YPropertySet propSet; 00059 00060 if ( propSet.isEmpty() ) 00061 { 00062 propSet.add( YProperty( YUIProperty_Value, YStringProperty ) ); 00063 propSet.add( YProperty( YUIProperty_CurrentItem, YStringProperty ) ); 00064 propSet.add( YWidget::propertySet() ); 00065 } 00066 00067 return propSet; 00068 } 00069 00070 00071 bool 00072 YTimezoneSelector::setProperty( const std::string & propertyName, const YPropertyValue & val ) 00073 { 00074 propertySet().check( propertyName, val.type() ); // throws exceptions if not found or type mismatch 00075 00076 if ( propertyName == YUIProperty_Value ) 00077 { 00078 setCurrentZone( val.stringVal(), true ); 00079 return true; // success -- no special handling necessary 00080 } 00081 if ( propertyName == YUIProperty_CurrentItem ) 00082 { 00083 setCurrentZone( val.stringVal(), false ); 00084 return true; // success -- no special handling necessary 00085 } 00086 return YWidget::setProperty( propertyName, val ); 00087 } 00088 00089 00090 YPropertyValue 00091 YTimezoneSelector::getProperty( const std::string & propertyName ) 00092 { 00093 propertySet().check( propertyName ); // throws exceptions if not found 00094 00095 if ( propertyName == YUIProperty_Value ) return YPropertyValue( currentZone() ); 00096 if ( propertyName == YUIProperty_CurrentItem ) return YPropertyValue( currentZone() ); 00097 return YWidget::getProperty( propertyName ); 00098 }