row_display_style.cpp
上传用户:yhdzpy8989
上传日期:2007-06-13
资源大小:13604k
文件大小:5k
- /*
- * ===========================================================================
- * PRODUCTION $Log: row_display_style.cpp,v $
- * PRODUCTION Revision 1000.1 2004/06/01 21:07:25 gouriano
- * PRODUCTION PRODUCTION: UPGRADED [GCC34_MSVC7] Dev-tree R1.5
- * PRODUCTION
- * ===========================================================================
- */
- /* $Id: row_display_style.cpp,v 1000.1 2004/06/01 21:07:25 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 <corelib/ncbistd.hpp>
- #include <gui/widgets/aln_multiple/row_display_style.hpp>
- BEGIN_NCBI_SCOPE
- CWidgetDisplayStyle::CWidgetDisplayStyle()
- : m_TextFont(CGlBitmapFont::eHelvetica12),
- m_SeqFont(CGlBitmapFont::eCourier14),
- m_TextColor(0.0f, 0.0f, 0.0f), // black
- m_SelTextColor(1.0f, 1.0f, 0.0f), // yellow
- m_SelBackColor(0.75f, 0.75f, 0.75f), // gray
- m_SelBackFocusedColor(0.0f, 0.0f, 0.5f), // dark blue
- m_FrameColor(0.8f, 0.8f, 0.8f) // light gray
- {
- }
- CRowDisplayStyle::CRowDisplayStyle()
- : m_pWidgetStyle(NULL)
- {
- }
- CRowDisplayStyle::~CRowDisplayStyle()
- {
- }
- void CRowDisplayStyle::SetWidgetStyle(const CWidgetDisplayStyle* style)
- {
- m_pWidgetStyle = style;
- }
- const CGlBitmapFont& CRowDisplayStyle::GetTextFont(void) const
- {
- return m_pWidgetStyle->m_TextFont;
- }
- const CGlBitmapFont& CRowDisplayStyle::GetSeqFont(void) const
- {
- return m_pWidgetStyle->m_SeqFont;
- }
- const CGlColor& CRowDisplayStyle::GetTextColor(void) const
- {
- return m_pWidgetStyle->m_TextColor;
- }
- const CGlColor& CRowDisplayStyle::GetSelTextColor(void) const
- {
- return m_pWidgetStyle->m_SelTextColor;
- }
- const CGlColor& CRowDisplayStyle::GetSelBackColor(void) const
- {
- return m_pWidgetStyle->m_SelBackColor;
- }
- const CGlColor& CRowDisplayStyle::GetSelBackFocusedColor(void) const
- {
- return m_pWidgetStyle->m_SelBackFocusedColor;
- }
- const CGlColor& CRowDisplayStyle::GetFrameColor(void) const
- {
- return m_pWidgetStyle->m_FrameColor;
- }
- CRowStyleCatalog::CRowStyleCatalog()
- : m_pWidgetStyle(NULL),
- m_pDefStyle(NULL)
- {
- }
- CRowStyleCatalog::~CRowStyleCatalog()
- {
- }
- void CRowStyleCatalog::SetWidgetStyle(const CWidgetDisplayStyle* style)
- {
- m_pWidgetStyle = style;
- if(m_pDefStyle) {
- m_pDefStyle->SetWidgetStyle(m_pWidgetStyle);
- }
- }
-
- void CRowStyleCatalog::SetDefaultStyle(CRowDisplayStyle* style)
- {
- m_pDefStyle = style;
- if(m_pDefStyle) {
- m_pDefStyle->SetWidgetStyle(m_pWidgetStyle);
- }
- }
- const CRowDisplayStyle* CRowStyleCatalog::GetStyleForRow(int row) const
- {
- TRowToStyle::const_iterator it = m_RowToStyle.find(row);
- return (it == m_RowToStyle.end()) ? m_pDefStyle : it->second;
- }
- const CRowDisplayStyle* CRowStyleCatalog::GetStyleForRow(int row, int type) const
- {
- TTypeToStyle::const_iterator it_t = m_TypeToStyle.find(type);
- if(it_t == m_TypeToStyle.end()) {
- TRowToStyle::const_iterator it = m_RowToStyle.find(row);
- return (it == m_RowToStyle.end()) ? m_pDefStyle : it->second;
- } else {
- return it_t->second;
- }
- }
- void CRowStyleCatalog::SetRowStyle(TNumrow row, CRowDisplayStyle* style)
- {
- _ASSERT(style);
- style->SetWidgetStyle(m_pWidgetStyle);
- m_RowToStyle[row] = style;
- }
- void CRowStyleCatalog::SetRowTypeStyle(int type, CRowDisplayStyle* style)
- {
- _ASSERT(style);
- style->SetWidgetStyle(m_pWidgetStyle);
- m_TypeToStyle[type] = style;
- }
- void CRowStyleCatalog::ClearCustomStyles()
- {
- m_RowToStyle.clear();
- m_TypeToStyle.clear();
- }
- END_NCBI_SCOPE
- /*
- * ===========================================================================
- * $Log: row_display_style.cpp,v $
- * Revision 1000.1 2004/06/01 21:07:25 gouriano
- * PRODUCTION: UPGRADED [GCC34_MSVC7] Dev-tree R1.5
- *
- * Revision 1.5 2004/05/21 22:27:52 gorelenk
- * Added PCH ncbi_pch.hpp
- *
- * Revision 1.4 2004/04/02 16:24:29 yazhuk
- * Added Frame color to display styles
- *
- * Revision 1.3 2003/12/22 16:43:15 ucko
- * Don't try to get non-const_ iterators in const methods.
- *
- * Revision 1.2 2003/12/22 16:27:57 yazhuk
- * Implemented binding display styles to row number and ow types
- *
- * Revision 1.1 2003/12/18 21:20:08 yazhuk
- * Initial revision
- *
- * ===========================================================================
- */