document_dlg.cpp
上传用户:yhdzpy8989
上传日期:2007-06-13
资源大小:13604k
文件大小:4k
- /*
- * ===========================================================================
- * PRODUCTION $Log: document_dlg.cpp,v $
- * PRODUCTION Revision 1000.3 2004/06/01 20:47:54 gouriano
- * PRODUCTION PRODUCTION: UPGRADED [GCC34_MSVC7] Dev-tree R1.6
- * PRODUCTION
- * ===========================================================================
- */
- /* $Id: document_dlg.cpp,v 1000.3 2004/06/01 20:47:54 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:
- *
- */
- #include <ncbi_pch.hpp>
- #include "document_dlg.hpp"
- #include "records_table.hpp"
- #include <gui/core/selection_buffer.hpp>
- #include <gui/core/algo_menu.hpp>
- BEGIN_NCBI_SCOPE
- #include "document_dlg_.cpp"
- CDocumentDlg::CDocumentDlg()
- {
- m_Window.reset(x_CreateWindow());
- m_Records->SetCellBox(FL_NO_BOX);
- }
- void CDocumentDlg::Show()
- {
- m_Window->show();
- }
- bool CDocumentDlg::Shown() const
- {
- return m_Window->shown() ? true : false;
- }
- void CDocumentDlg::Hide()
- {
- m_Window->hide();
- }
- string CDocumentDlg::GetTitle() const
- {
- return "Records View";
- }
- void CDocumentDlg::Update(TUpdateFlags flags)
- {
- GetSelBuffer().Clear();
- // update the various menus
- x_UpdateDynMenus();
- // ... and update our records list
- if (m_Records) {
- m_Records->Update(flags);
- m_Records->redraw();
- }
- }
- void CDocumentDlg::x_OnUnload()
- {
- }
- void CDocumentDlg::x_OnOK()
- {
- m_Window->hide();
- }
- void CDocumentDlg::GetSelections(TConstScopedObjects& objs) const
- {
- objs = GetSelBuffer().DecomposeToPairs();
- }
- void CDocumentDlg::SetSelections(const TConstScopedObjects& objs)
- {
- // FIXME: stub only
- }
- void CDocumentDlg::x_OnSelChanged()
- {
- // first, collect our selected documents
- GetSelBuffer().Clear();
- for (size_t i = 0; i < m_Records->GetRows(); ++i) {
- if ( !m_Records->IsRowSelected(i) ) {
- continue;
- }
- IDocument* doc = m_Records->GetData(i);
- GetSelBuffer().AddSelection(doc);
- }
- // now, refresh the menus
- x_UpdateDynMenus();
- }
- void CDocumentDlg::x_UpdateDynMenus()
- {
- if ( !m_ToolsMgr.get() ) {
- m_ToolsMgr.reset(new CAlgoMenuMgr(m_ToolsButton, "", this));
- }
- //
- // fill the algorithm plugins menus
- //
- m_ToolsMgr->Clear();
- m_ToolsMgr->AddAlgoMenu();//GetSelBuffer());
- }
- END_NCBI_SCOPE
- /*
- * ===========================================================================
- * $Log: document_dlg.cpp,v $
- * Revision 1000.3 2004/06/01 20:47:54 gouriano
- * PRODUCTION: UPGRADED [GCC34_MSVC7] Dev-tree R1.6
- *
- * Revision 1.6 2004/05/21 22:27:42 gorelenk
- * Added PCH ncbi_pch.hpp
- *
- * Revision 1.5 2004/05/07 15:34:21 dicuccio
- * Fixed unsigned/signed comparison
- *
- * Revision 1.4 2004/04/16 14:39:42 dicuccio
- * Inherit from ISelection for selection marshalling
- *
- * Revision 1.3 2004/01/20 18:15:52 dicuccio
- * Changed to match new API in CTablePanel
- *
- * Revision 1.2 2003/09/04 14:02:36 dicuccio
- * Introduce IDocument as abstract base class for CDocument; replace use of
- * CDocument with IDocument
- *
- * Revision 1.1 2003/08/06 13:53:27 dicuccio
- * Added document dialog files
- *
- * ===========================================================================
- */