sort_menu.cpp
上传用户:yhdzpy8989
上传日期:2007-06-13
资源大小:13604k
文件大小:4k
- /*
- * ===========================================================================
- * PRODUCTION $Log: sort_menu.cpp,v $
- * PRODUCTION Revision 1000.1 2004/06/01 21:01:04 gouriano
- * PRODUCTION PRODUCTION: UPGRADED [GCC34_MSVC7] Dev-tree R1.4
- * PRODUCTION
- * ===========================================================================
- */
- /* $Id: sort_menu.cpp,v 1000.1 2004/06/01 21:01:04 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: Mike DiCuccio
- *
- * File Description:
- * Dynamic menu manager for sorting a table by columns.
- */
- #include <ncbi_pch.hpp>
- #include "sort_menu.hpp"
- BEGIN_NCBI_SCOPE
- //
- // default ctor for the view menu manager class
- //
- CSortMenuMgr::CSortMenuMgr(Fl_Menu_* menu, const string& base)
- : CFltkMenuMgrBase<CSortMenuProxy>(menu)
- {
- SetMenuBase(base);
- }
- //
- // Clear()
- // this clears the contents of our two submenus
- //
- void CSortMenuMgr::Clear()
- {
- // Do our base class clear
- x_ClearData();
- if ( !m_Menu ) {
- return;
- }
- // we remove two sub-items - one for active views and one for new views
- string base = m_Base;
- if ( !base.empty() ) {
- base += "/";
- }
- x_RemoveSubitems(base + "Sort by...");
- }
- //
- // AddSortMenu()
- // This will fill a menu with entries for sorting a tbale. An entry will be
- // added for each column in the table; in addition, a "null" item will be added
- // to sort by the underlying data type of the table
- //
- void CSortMenuMgr::AddSortMenu(CFeatTable* table)
- {
- if ( !table ) {
- return;
- }
- string menu_base = m_Base;
- if ( !menu_base.empty() ) {
- menu_base += "/";
- }
- menu_base += "Sort by.../";
- // first, add an item to sort by the underlying data
- x_AddItem(menu_base + "(feature data)", new CSortMenuProxy(table, -1));
- // next, add an item for each column in the table
- int size = table->cols();
- for (int i = 0; i < size; ++i) {
- const string& header = table->GetColHeader(i);
- string s = menu_base + header;
- x_AddItem(s, new CSortMenuProxy(table, i));
- }
- }
- END_NCBI_SCOPE
- /*
- * ===========================================================================
- * $Log: sort_menu.cpp,v $
- * Revision 1000.1 2004/06/01 21:01:04 gouriano
- * PRODUCTION: UPGRADED [GCC34_MSVC7] Dev-tree R1.4
- *
- * Revision 1.4 2004/05/21 22:27:49 gorelenk
- * Added PCH ncbi_pch.hpp
- *
- * Revision 1.3 2003/07/28 11:51:49 dicuccio
- * Rewrote CTablePanel<> to be more flexible and better contained. Added standard
- * multicolumn list dialog. Deprecated use of COutputDlg.
- *
- * Revision 1.2 2003/01/13 13:10:09 dicuccio
- * Namespace clean-up. Retired namespace gui -> converted all to namespace ncbi.
- * Moved all FLUID-generated code into namespace ncbi.
- *
- * Revision 1.1 2003/01/08 14:58:47 dicuccio
- * Major overhaul. Added column selection dialog to base class - moved out of
- * this class. Added ability to sort columns based on menu selections. Added
- * ability to filter features based on a wide range of criteria.
- *
- * ===========================================================================
- */