progress_dlg.cpp

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

CPP
144
字号
/* * =========================================================================== * PRODUCTION $Log: progress_dlg.cpp,v $ * PRODUCTION Revision 1000.3  2004/06/01 20:46:40  gouriano * PRODUCTION PRODUCTION: UPGRADED [GCC34_MSVC7] Dev-tree R1.6 * PRODUCTION * =========================================================================== *//*  $Id: progress_dlg.cpp,v 1000.3 2004/06/01 20:46:40 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 <gui/dialogs/progress/progress_dlg.hpp>#include <gui/utils/fltk_utils.hpp>BEGIN_NCBI_SCOPE#include "progress_dlg_.cpp"CProgressDlg::CProgressDlg(){    CFltkGuard FL_GUARD;    m_Window.reset(x_CreateWindow());    m_Progress->minimum(  0);    m_Progress->maximum(100);    SetTitle("Waiting...");    SetMessage("Waiting...");    SetPctCompleted(0);    m_Window->position((Fl::w() - m_Window->w()) / 2,                       (Fl::h() - m_Window->h()) / 2);    m_RetValue = eOK;}void CProgressDlg::SetTitle(const string& title){    CFastMutexGuard LOCK(m_Mutex);    CFltkGuard FL_GUARD;    m_TitleStr = title;    m_Window->label(m_TitleStr.c_str());}void CProgressDlg::SetMessage(const string& label){    CFastMutexGuard LOCK(m_Mutex);    CFltkGuard FL_GUARD;    m_LabelStr = label;    m_Label->label(m_LabelStr.c_str());}void CProgressDlg::SetPctCompleted(int pct){    CFastMutexGuard LOCK(m_Mutex);    CFltkGuard FL_GUARD;    pct = min(pct, 100);    pct = max(pct, 0);    m_Progress->value(pct);}void CProgressDlg::Clear(void){    CFastMutexGuard LOCK(m_Mutex);    CFltkGuard FL_GUARD;    m_LabelStr = "";    m_Label->label(m_LabelStr.c_str());    m_RetValue = eOK;}bool CProgressDlg::HasBeenCanceled(void) const{    return (m_RetValue == eCancel);}END_NCBI_SCOPE/* * =========================================================================== * $Log: progress_dlg.cpp,v $ * Revision 1000.3  2004/06/01 20:46:40  gouriano * PRODUCTION: UPGRADED [GCC34_MSVC7] Dev-tree R1.6 * * Revision 1.6  2004/05/28 19:13:31  johnson * Added asynchronous mechanism to poll for 'cancel' message. * * Revision 1.5  2004/05/21 22:27:41  gorelenk * Added PCH ncbi_pch.hpp * * Revision 1.4  2004/04/14 20:57:22  johnson * added Clear() to IReporter interface * * Revision 1.3  2003/12/22 19:22:15  dicuccio * Added calls to FLTK's locking mechanism via CFltkGuard * * Revision 1.2  2003/12/04 18:10:58  dicuccio * Added locking for thread safety * * Revision 1.1  2003/11/26 17:21:19  dicuccio * Initial version * * =========================================================================== */

⌨️ 快捷键说明

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