theme_config_panel.cpp

来自「ncbi源码」· C++ 代码 · 共 193 行

CPP
193
字号
/* * =========================================================================== * PRODUCTION $Log: theme_config_panel.cpp,v $ * PRODUCTION Revision 1000.1  2004/06/01 20:45:45  gouriano * PRODUCTION PRODUCTION: UPGRADED [GCC34_MSVC7] Dev-tree R1.6 * 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 Description: * */#include <ncbi_pch.hpp>#include <gui/dialogs/config/theme_config_panel.hpp>BEGIN_NCBI_SCOPE#include "theme_config_panel_.cpp"typedef Fl_Choice TDropDownMenu;static void ClearDDM(TDropDownMenu* dd_menu){    dd_menu->clear();}   static void AddDDM(TDropDownMenu* dd_menu, const string& s){    // dd_menu->Add(s.c_str());    // CComboxBox    dd_menu->add(s.c_str());   // Fl_Choice}static string GetValueDDM(TDropDownMenu* dd_menu){    // return dd_menu->value();   // CComboBox        // Fl_Choice    const char *t = dd_menu->text();    if (t) {        return t;    }    return kEmptyStr;    }static void SetValueDDM(TDropDownMenu* dd_menu, const string& s){    // dd_menu->value(s.c_str());  // CComboBox        // Fl_Choice    const Fl_Menu_Item* menu_items = dd_menu->menu();    for (int item_n = 0; menu_items != NULL  &&  menu_items->label() != NULL; ++menu_items, ++item_n) {        if (s == menu_items->label()) {            dd_menu->value(item_n);            return;        }    }    return;}CThemeConfigPanel::CThemeConfigPanel(){}Fl_Group* CThemeConfigPanel::GetConfigPanel(){    return m_ConfigPanel;}void CThemeConfigPanel::MakeWidgets(){    x_MakeWidgets();    x_SetItems();    UpdateWidgets();}// initialize the ItemList combobox. // Call in the Mediator's x_LoadFirst method, after m_ItemStyleData is set up,// NOT in this class's constructor.void CThemeConfigPanel::x_SetItems(){    ClearDDM(m_ItemList);    ITERATE(vector <SItemData> , item_it, m_ItemData) {        AddDDM(m_ItemList, item_it->desc);    }    // select the first thing in the combobox.    if ( ! m_ItemData.empty()) {        string first_item = m_ItemData.front().desc;        SetValueDDM(m_ItemList, first_item);    }}string CThemeConfigPanel::x_GetCurrentItem(){    return GetValueDDM(m_ItemList);}void  CThemeConfigPanel::UpdateWidgets(){    string this_item = x_GetCurrentItem();    x_SetStyles(this_item);        string this_style = GetCurrentStyleByDesc(this_item);    SetValueDDM(m_StyleList, this_style);    m_ConfigPanel->redraw();}void CThemeConfigPanel::x_SetStyles(const string& item){    const TStyleList& styles = GetStylesByDesc(item);    ClearDDM(m_StyleList);    ITERATE(TStyleList, style_it, styles) {        AddDDM(m_StyleList, *style_it);    }}void CThemeConfigPanel::x_StyleChosen(){    SetCurrentStyleByDesc(x_GetCurrentItem(), GetValueDDM(m_StyleList) );    m_Preview->redraw();}END_NCBI_SCOPE/* * =========================================================================== * $Log: theme_config_panel.cpp,v $ * Revision 1000.1  2004/06/01 20:45:45  gouriano * PRODUCTION: UPGRADED [GCC34_MSVC7] Dev-tree R1.6 * * Revision 1.6  2004/05/21 22:27:41  gorelenk * Added PCH ncbi_pch.hpp * * Revision 1.5  2004/02/02 19:18:07  rsmith * change obsolete types * * Revision 1.4  2004/02/02 18:39:36  rsmith * change implementation to work with the new base class. * * Revision 1.3  2004/01/29 21:27:37  rsmith * move CItemStyleMap definitions into their own file. * CItemStyleMap methods changed names. * * Revision 1.2  2004/01/02 21:02:16  rsmith * Change CComboBox to Fl_Choice and various cleanups. * * Revision 1.1  2003/12/30 14:09:41  dicuccio * Initial check-in - moved from gui/config * * Revision 1.1  2003/12/29 14:41:36  rsmith * initial checkin * * * =========================================================================== */

⌨️ 快捷键说明

复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?