theme_config_panel_base.cpp
上传用户:yhdzpy8989
上传日期:2007-06-13
资源大小:13604k
文件大小:5k
源码类别:
生物技术
开发平台:
C/C++
- /*
- * ===========================================================================
- * PRODUCTION $Log: theme_config_panel_base.cpp,v $
- * PRODUCTION Revision 1000.1 2004/06/01 20:45:53 gouriano
- * PRODUCTION PRODUCTION: UPGRADED [GCC34_MSVC7] Dev-tree R1.2
- * PRODUCTION
- * ===========================================================================
- */
- /* $Id $
- * ===========================================================================
- *
- * PUBLIC DOMAIN NOTICE
- * National Center for Biotechnology Information
- *
- * This software/database is a "United States Government Work" under the
- * terms of the United States Copyright Act. It was written as part of
- * the author's official duties as a United States Government employee and
- * thus cannot be copyrighted. This software/database is freely available
- * to the public for use. The National Library of Medicine and the U.S.
- * Government have not placed any restriction on its use or reproduction.
- *
- * Although all reasonable efforts have been taken to ensure the accuracy
- * and reliability of the software and data, the NLM and the U.S.
- * Government do not and cannot warrant the performance or results that
- * may be obtained by using this software or data. The NLM and the U.S.
- * Government disclaim all warranties, express or implied, including
- * warranties of performance, merchantability or fitness for any particular
- * purpose.
- *
- * Please cite the author in any work or product based on this material.
- *
- * ===========================================================================
- *
- * Authors: Robert G. Smith
- *
- *
- */
- /// @file theme_config_panel_base.cpp
- ///
- #include <ncbi_pch.hpp>
- #include <gui/dialogs/config/theme_config_panel_base.hpp>
- #include <gui/config/settings_set.hpp> // for exception decl.
- BEGIN_NCBI_SCOPE
- IThemeConfigPanelBase::~IThemeConfigPanelBase()
- {
- }
- CThemeConfigPanelBase::~CThemeConfigPanelBase()
- {
- }
- void CThemeConfigPanelBase::Clear()
- {
- m_ItemData.clear();
- }
- void CThemeConfigPanelBase::AddItem(
- const string& item,
- const string& sel_style,
- const TStyleList& styles,
- const string& desc
- )
- {
- m_ItemData.push_back(SItemData(item, sel_style, styles, desc));
- }
- string CThemeConfigPanelBase::GetCurrentStyle(const string& item) const
- {
- return x_GetItemData(item, eFindByType).current_style;
- }
- void CThemeConfigPanelBase::SetCurrentStyle(const string& item, const string& style)
- {
- x_SetItemData(item, eFindByType).current_style = style;
- }
- string CThemeConfigPanelBase::GetCurrentStyleByDesc(const string& desc) const
- {
- return x_GetItemData(desc, eFindByDesc).current_style;
- }
- void CThemeConfigPanelBase::SetCurrentStyleByDesc(const string& desc, const string& style)
- {
- x_SetItemData(desc, eFindByDesc).current_style = style;
- }
- CThemeConfigPanelBase::TStyleList CThemeConfigPanelBase::GetStylesByDesc(const string& desc) const
- {
- return x_GetItemData(desc, eFindByDesc).styles;
- }
- const CThemeConfigPanelBase::SItemData& CThemeConfigPanelBase::x_GetItemData(const string& key, EKeyType e ) const
- {
- vector <SItemData>::const_iterator data_it;
- if (e == eFindByType) {
- data_it =find_if(m_ItemData.begin(), m_ItemData.end(), PFindType(key));
- } else if (e == eFindByDesc) {
- data_it = find_if(m_ItemData.begin(), m_ItemData.end(), PFindDesc(key));
- }
- if (data_it == m_ItemData.end()) {
- NCBI_THROW(CConfigException, eConfigPanel, "key: " + key + " not found in panel's data.");
- }
- return *data_it;
- }
- CThemeConfigPanelBase::SItemData& CThemeConfigPanelBase::x_SetItemData(const string& key, EKeyType e )
- {
- vector <SItemData>::iterator data_it;
- if (e == eFindByType) {
- data_it = find_if(m_ItemData.begin(), m_ItemData.end(), PFindType(key));
- } else if (e == eFindByDesc) {
- data_it = find_if(m_ItemData.begin(), m_ItemData.end(), PFindDesc(key));
- }
- if (data_it == m_ItemData.end()) {
- NCBI_THROW(CConfigException, eConfigPanel, "key: " + key + " not found in panel's data.");
- }
- return *data_it;
- }
- END_NCBI_SCOPE
- /*
- * ===========================================================================
- * $Log: theme_config_panel_base.cpp,v $
- * Revision 1000.1 2004/06/01 20:45:53 gouriano
- * PRODUCTION: UPGRADED [GCC34_MSVC7] Dev-tree R1.2
- *
- * Revision 1.2 2004/05/21 22:27:41 gorelenk
- * Added PCH ncbi_pch.hpp
- *
- * Revision 1.1 2004/02/02 18:42:25 rsmith
- * initial checkin
- *
- * Revision 1.1 2004/01/29 21:25:49 rsmith
- * initial checkin
- *
- *
- * ===========================================================================
- */