config_mediator.cpp
上传用户:yhdzpy8989
上传日期:2007-06-13
资源大小:13604k
文件大小:5k
- /*
- * ===========================================================================
- * PRODUCTION $Log: config_mediator.cpp,v $
- * PRODUCTION Revision 1000.1 2004/06/01 20:45:34 gouriano
- * PRODUCTION PRODUCTION: UPGRADED [GCC34_MSVC7] Dev-tree R1.4
- * PRODUCTION
- * ===========================================================================
- */
- /* $Id: config_mediator.cpp,v 1000.1 2004/06/01 20:45:34 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 Smith
- *
- * File Description:
- * Configuration Panel Interpreter default implementation.
- * The interface that any configuration/preference dialog uses
- * to modify its data and get its particular gui widges (IPanel).
- *
- * Derived classes with this interface mediate between IConfigPanel
- * and classes with the CSettingsSet base class, in the context of a
- * CConfigDlg.
- */
- #include <ncbi_pch.hpp>
- #include <gui/dialogs/config/config_mediator.hpp>
- #include <gui/config/settings_set.hpp>
- #include <gui/dialogs/config/config_panel.hpp>
- BEGIN_NCBI_SCOPE
- CConfigMediator::CConfigMediator(
- CSettingsSet & data,
- IConfigPanel& widget_group)
- : m_DataSet(&data),
- m_ConfigPanel(&widget_group)
- {
- }
- CConfigMediator::~CConfigMediator()
- {
- }
-
- /// return the object that can give us our Fl_Widget.
- IConfigPanel& CConfigMediator::GetPanel(void)
- {
- return *m_ConfigPanel;
- }
-
- /// return all the states this dialog knows about
- /// These constitute the valid arguments to the other methods taking
- /// 'state' parameters.
- list<string> CConfigMediator::GetStates(void) const
- {
- return m_DataSet->GetStyleNames();
- }
- string CConfigMediator::GetCurrentState(void) const
- {
- return m_DataSet->GetCurrentStyleName();
- }
- /// If the following methods return true the list of states has changed.
- /// and the dialog should call GetStates to repopulate and redisplay the list of states.
- /// if they return false the method failed and no changes to the states were done.
- /// If succesful new_state is the name of the state just added.
- bool CConfigMediator::AddState(string& new_state)
- {
- string the_state = m_DataSet->AddStyle();
- if (the_state.empty()) {
- return false;
- }
- new_state = the_state;
- return true;
- }
- bool CConfigMediator::DuplicateState(const string& state, string& new_state)
- {
- string the_state = m_DataSet->DuplicateStyle(state);
- if (the_state.empty()) {
- return false;
- }
- new_state = the_state;
- return true;
- }
- bool CConfigMediator::RenameState(const string& state,
- const string& req_state,
- string& new_state)
- {
- string the_state = m_DataSet->RenameStyle(state, req_state);
- if (the_state.empty()) {
- return false;
- }
- new_state = the_state;
- return true;
- }
- bool CConfigMediator::CanRenameState(const string& state)
- {
- return m_DataSet->CanRenameStyle(state);
- }
- bool CConfigMediator::DeleteState(const string& state)
- {
- return m_DataSet->DeleteStyle(state);
- }
- END_NCBI_SCOPE
- /*
- * ===========================================================================
- * $Log: config_mediator.cpp,v $
- * Revision 1000.1 2004/06/01 20:45:34 gouriano
- * PRODUCTION: UPGRADED [GCC34_MSVC7] Dev-tree R1.4
- *
- * Revision 1.4 2004/05/25 17:09:52 dicuccio
- * Removed unnecessary #include guards
- *
- * Revision 1.3 2004/05/24 18:43:41 gorelenk
- * PCH moved upmost
- *
- * Revision 1.2 2004/05/21 22:27:41 gorelenk
- * Added PCH ncbi_pch.hpp
- *
- * Revision 1.1 2003/12/30 14:09:40 dicuccio
- * Initial check-in - moved from gui/config
- *
- * Revision 1.1 2003/10/10 17:43:42 rsmith
- * moved from gui/core to gui/config
- *
- * Revision 1.1 2003/09/26 18:15:31 rsmith
- * plugin configration data and dialog
- *
- * ===========================================================================
- */