test_config_mediat.cpp
来自「ncbi源码」· C++ 代码 · 共 184 行
CPP
184 行
/* * =========================================================================== * PRODUCTION $Log: test_config_mediat.cpp,v $ * PRODUCTION Revision 1000.1 2004/06/01 20:46:11 gouriano * PRODUCTION PRODUCTION: UPGRADED [GCC34_MSVC7] Dev-tree R1.3 * PRODUCTION * =========================================================================== *//* $Id: test_config_mediat.cpp,v 1000.1 2004/06/01 20:46:11 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 Mediator for Graphics View. * * Mediates between the panel of widgets CTestConfigPanel * and the data class CTestSettings, * in the context of a CConfigDlg. */#include <ncbi_pch.hpp>#include "test_config_mediat.hpp"BEGIN_NCBI_SCOPECTestConfigMediator::CTestConfigMediator( CTestSettings & data, CTestConfigPanel& widget_group) : CConfigMediator(data, widget_group){}CTestConfigMediator::~CTestConfigMediator(){}/// What should we title the dialog window?string CTestConfigMediator::GetWindowTitle(void) const{ return "Sequence Graphics View Preferences";}/// Load data into that panelvoid CTestConfigMediator::Load(const string& state){ CTestSettings& data_set = GetDataSet(); CTestConfigPanel& widget_group = dynamic_cast<CTestConfigPanel&>(GetPanel()); if (state != kEmptyStr) { data_set.SetCurrentStyleName(state); data_set.LoadCurrentSettings(CSettingsSet::eLoad_Current); } x_Load(data_set, widget_group); }/// Load 'factory default' data into that panel.void CTestConfigMediator::LoadDefault(void){ // load the factory defaults into my data set. CTestSettings& data_set = GetDataSet(); data_set.LoadCurrentSettings(CSettingsSet::eLoad_FactDefs); // load the data into the widgets. CTestConfigPanel& widget_group = dynamic_cast<CTestConfigPanel&>(GetPanel()); x_Load(data_set, widget_group); }void CTestConfigMediator::x_Load( CTestSettings & data_set, CTestConfigPanel& widget_group){ // view options int btn_value; btn_value = 0; if (data_set.m_ShowFeatures) btn_value = 1; widget_group.m_ShowFeaturesBtn->value(btn_value); // colors widget_group.m_SelectionColorBtn->SetGlColor(data_set.m_SelectionColor); // string widget_group.m_Name->value(data_set.m_Name.c_str());} /// Save the panel's data.void CTestConfigMediator::Save(const string& state) // state is unused.{ CTestSettings& data_set = GetDataSet(); CTestConfigPanel& widget_group = dynamic_cast<CTestConfigPanel&>(GetPanel()); data_set.m_ShowFeatures = widget_group.m_ShowFeaturesBtn->value(); data_set.m_SelectionColor = widget_group.m_SelectionColorBtn->GetGlColor(); data_set.m_Name = widget_group.m_Name->value(); data_set.SaveCurrentSettings();}/// Has the data represented by the panel's widgets been modified?bool CTestConfigMediator::Modified(void) const{ const CTestSettings& data_set = GetDataSet(); return data_set.CurrentSettingsModified();}// the following accessors are just to hide the ugly down casts.CTestSettings& CTestConfigMediator::GetDataSet(void) { return static_cast<CTestSettings&>(*m_DataSet);}const CTestSettings& CTestConfigMediator::GetDataSet(void) const{ return static_cast<const CTestSettings&>(*m_DataSet);}IConfigPanel& CTestConfigMediator::GetPanel(void) { return (*m_ConfigPanel);}END_NCBI_SCOPE/* * =========================================================================== * $Log: test_config_mediat.cpp,v $ * Revision 1000.1 2004/06/01 20:46:11 gouriano * PRODUCTION: UPGRADED [GCC34_MSVC7] Dev-tree R1.3 * * Revision 1.3 2004/05/21 22:27:41 gorelenk * Added PCH ncbi_pch.hpp * * Revision 1.2 2004/04/07 12:50:18 dicuccio * Fixed use of casting * * Revision 1.1 2004/02/12 14:57:46 rsmith * initial checkin. Moved from gui/config/test * * Revision 1.1 2003/11/18 20:17:16 rsmith * Initial checkin. Demo of gui_config dialog. * * =========================================================================== */
⌨️ 快捷键说明
复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?