scroll_widget.cpp

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

CPP
184
字号
/* * =========================================================================== * PRODUCTION $Log: scroll_widget.cpp,v $ * PRODUCTION Revision 1000.1  2004/06/01 20:49:39  gouriano * PRODUCTION PRODUCTION: UPGRADED [GCC34_MSVC7] Dev-tree R1.5 * PRODUCTION * =========================================================================== *//*  $Id: scroll_widget.cpp,v 1000.1 2004/06/01 20:49:39 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:  Andrey Yazhuk * * File Description: * */#include <ncbi_pch.hpp>#include <gui/graph/scroll_widget.hpp>#include <gui/graph/igraph_utils.hpp>BEGIN_NCBI_SCOPE////////////////////////////////////////////////////////////////////////////////// IScrollableWidgetCScrollWidget::CScrollWidget(int x, int y, int w, int h): Fl_Group(x, y, w, h),  m_pScrollX(NULL),  m_pScrollY(NULL),  m_pScWidget(NULL){}CScrollWidget::~CScrollWidget(){    m_pScWidget = NULL;    destroy_null(m_pScrollX);    destroy_null(m_pScrollY);}void    CScrollWidget::SetScrollableWidget(IScrollableWidget* pScW){    m_pScWidget = pScW;    m_pScWidget->SetContainer(static_cast<IScrollContainer*>(this));    Fl_Widget* pW = dynamic_cast<Fl_Widget*>(pScW);    pW->box(FL_NO_BOX);    pW->color(49);    pW->selection_color(49);    pW->labeltype(FL_NORMAL_LABEL);    pW->labelfont(0);    pW->labelsize(14);    pW->labelcolor(56);    pW->align(FL_ALIGN_CENTER);    pW->when(FL_WHEN_RELEASE);          add_resizable(*pW);    const int kScrollBarSize = 15;        m_pScrollX = new Fl_Scrollbar            (x(), y() + (h() - kScrollBarSize),             w() - kScrollBarSize, kScrollBarSize);    m_pScrollX->type(FL_HORIZONTAL);    m_pScrollX->labeltype(FL_NO_LABEL);    m_pScrollX->callback(CScrollWidget::x_OnScrollX, this );       m_pScrollY = new Fl_Scrollbar        (x() + (w() - kScrollBarSize), y(), kScrollBarSize,                   h() - kScrollBarSize);    m_pScrollY->type(FL_VERTICAL);    m_pScrollY->labeltype(FL_NO_LABEL);    m_pScrollY->callback(CScrollWidget::x_OnScrollY, this );     end(); }void CScrollWidget::SetValuesX(int Pos, int Page, int Min, int Max){    if (m_pScrollX)        m_pScrollX->value(Pos, Page, Min, Max);}void CScrollWidget::SetValuesY(int Pos, int Page, int Min, int Max){    if (m_pScrollY)        m_pScrollY->value(Pos, Page, Min, Max);}/*void CScrollWidget::SetPosX(int Pos){    if (m_pScrollX)        m_pScrollX->value(Pos, Size, minimum(), maximum());}void CScrollWidget::SetPageSizeX(int Size){    if (m_pScrollX) {        int Pos = value();        m_pScrollX->value(Pos, Size, minimum(), maximum());    }}void CScrollWidget::SetScrollRangeX(int Min, int Max){    if (m_pScrollX)        m_pScrollX->range(Min, Max);}void CScrollWidget::SetPosY(int Pos){}void CScrollWidget::SetPageSizeY(int Size){}void CScrollWidget::SetScrollRangeY(int Start, int End){}*/void CScrollWidget::x_OnScrollX(Fl_Widget* pW, void* pData){    CScrollWidget* pCont = reinterpret_cast<CScrollWidget*>(pData);    if (pCont)               pCont->m_pScWidget->OnScrollX(pCont->m_pScrollX);}void CScrollWidget::x_OnScrollY(Fl_Widget* pW, void* pData){    CScrollWidget* pCont = reinterpret_cast<CScrollWidget*>(pData);    if (pCont)               pCont->m_pScWidget->OnScrollY(pCont->m_pScrollY);}END_NCBI_SCOPE/* * =========================================================================== * $Log: scroll_widget.cpp,v $ * Revision 1000.1  2004/06/01 20:49:39  gouriano * PRODUCTION: UPGRADED [GCC34_MSVC7] Dev-tree R1.5 * * Revision 1.5  2004/05/21 22:27:42  gorelenk * Added PCH ncbi_pch.hpp * * Revision 1.4  2003/09/04 14:03:03  dicuccio * Inlined destructors of interface classes * * Revision 1.3  2003/08/11 16:10:57  yazhuk * Compilation fixes for GCC * * Revision 1.2  2003/08/08 15:59:36  yazhuk * Comments added * * =========================================================================== */ 

⌨️ 快捷键说明

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