theme_config_panel_base.hpp
上传用户:yhdzpy8989
上传日期:2007-06-13
资源大小:13604k
文件大小:6k
源码类别:
生物技术
开发平台:
C/C++
- /*
- * ===========================================================================
- * PRODUCTION $Log: theme_config_panel_base.hpp,v $
- * PRODUCTION Revision 1000.1 2004/06/01 19:47:36 gouriano
- * PRODUCTION PRODUCTION: UPGRADED [GCC34_MSVC7] Dev-tree R1.7
- * PRODUCTION
- * ===========================================================================
- */
- #ifndef GUI_DIALOGS_CONFIG___THEME_CONFIG_PANEL_BASE__HPP
- #define GUI_DIALOGS_CONFIG___THEME_CONFIG_PANEL_BASE__HPP
- /* $Id: theme_config_panel_base.hpp,v 1000.1 2004/06/01 19:47:36 gouriano Exp $
- * ===========================================================================
- *
- * 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.hpp
- ///
- #include <corelib/ncbistd.hpp>
- #include <gui/gui.hpp>
- #include <gui/dialogs/config/config_panel.hpp>
- /** @addtogroup Miscellaneous
- *
- * @{
- */
- BEGIN_NCBI_SCOPE
- /// IThemeConfigPanelBase.
- /// The interace CThemeMediator expects of any widget panel it can interact with,
- /// to display and modify data from a CThemeSet.
- class IThemeConfigPanelBase : public IConfigPanel
- {
- public:
- typedef list<string> TStyleList;
- virtual ~IThemeConfigPanelBase();
- virtual void Clear() = 0;
- virtual string GetCurrentStyle(const string& type) const = 0;
- virtual void SetCurrentStyle(const string& type, const string& style) = 0;
- virtual void AddItem(const string& type,
- const string& cur_style,
- const TStyleList& styles,
- const string& desc) = 0;
- virtual void MakeWidgets() = 0;
- virtual void UpdateWidgets() = 0;
- };
- /// CThemeConfigPanelBase
- /// The default implementation for Theme widget panels.
- class NCBI_GUIDIALOGS_EXPORT CThemeConfigPanelBase
- : public IThemeConfigPanelBase
- {
- public:
- virtual ~CThemeConfigPanelBase();
- virtual void Clear();
- virtual string GetCurrentStyle(const string& type) const;
- virtual void SetCurrentStyle(const string& type, const string& style);
- virtual void AddItem(const string& type,
- const string& cur_style,
- const TStyleList& styles,
- const string& desc);
- struct SItemData
- {
- SItemData(const string& t, const string& cs,
- const TStyleList& ss, const string& d)
- : type(t), current_style(cs), styles(ss), desc(d) {}
- string type;
- string current_style;
- TStyleList styles;
- string desc;
- };
- protected:
- vector <string> TDescList;
- string GetCurrentStyleByDesc(const string& desc) const;
- void SetCurrentStyleByDesc(const string& desc, const string& style);
- TStyleList GetStylesByDesc(const string& desc) const;
- // mess to help with lookups by description or type.
- enum EKeyType {
- eFindByType,
- eFindByDesc
- };
- const SItemData& x_GetItemData(const string& key, EKeyType e ) const;
- SItemData& x_SetItemData(const string& key, EKeyType e );
- // predicates for find_if.
- struct PFindType
- {
- PFindType(const string& s) : m_Val(s) {};
- bool operator()(const SItemData& d) const
- {
- return d.type == m_Val;
- }
- private:
- string m_Val;
- };
- struct PFindDesc
- {
- PFindDesc(const string& s) : m_Val(s) {};
- bool operator()(const SItemData& d) const
- {
- return d.desc == m_Val;
- }
- private:
- string m_Val;
- };
- vector <SItemData> m_ItemData;
- };
- END_NCBI_SCOPE
- /* @} */
- /*
- * ===========================================================================
- * $Log: theme_config_panel_base.hpp,v $
- * Revision 1000.1 2004/06/01 19:47:36 gouriano
- * PRODUCTION: UPGRADED [GCC34_MSVC7] Dev-tree R1.7
- *
- * Revision 1.7 2004/05/03 12:42:46 dicuccio
- * Added #include for gui/gui.hpp
- *
- * Revision 1.6 2004/02/04 11:41:11 dicuccio
- * Added export specifier
- *
- * Revision 1.5 2004/02/03 14:59:24 dicuccio
- * Code reformatting. Don't use class identifier when referring to internal class
- * - breaks MSVC build
- *
- * Revision 1.4 2004/02/03 01:29:13 ucko
- * Make CThemeConfigPanelBase::SItemData public to address visibility
- * issues on some compilers.
- *
- * Revision 1.3 2004/02/02 19:17:33 rsmith
- * get rid of obsolete include
- *
- * Revision 1.2 2004/02/02 18:36:58 rsmith
- * Make this a pure interface class with an default implementation class.
- *
- * Revision 1.1 2004/01/29 21:18:57 rsmith
- * initial checkin
- *
- * ===========================================================================
- */
- #endif /* GUI_DIALOGS_CONFIG___THEME_CONFIG_PANEL_BASE__HPP */