flu_toggle_group.cpp

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

CPP
113
字号
/* * =========================================================================== * PRODUCTION $Log: Flu_Toggle_Group.cpp,v $ * PRODUCTION Revision 1000.1  2004/06/01 21:06:06  gouriano * PRODUCTION PRODUCTION: UPGRADED [GCC34_MSVC7] Dev-tree R1.2 * PRODUCTION * =========================================================================== *//* * These files were imported into NCBI's CVS directly from FLU version 2.9.1. * Modifications to the source are listed below. * * ========================================================================== * $Log: Flu_Toggle_Group.cpp,v $ * Revision 1000.1  2004/06/01 21:06:06  gouriano * PRODUCTION: UPGRADED [GCC34_MSVC7] Dev-tree R1.2 * * Revision 1.2  2004/05/21 22:27:51  gorelenk * Added PCH ncbi_pch.hpp * * Revision 1.1  2004/03/11 13:51:40  dicuccio * Imported FLU version 2.9.1.  Altered export specifiers to match NCBI layout. * Altered include paths to match NCBI toolkit layout. * * ========================================================================== */// $Id: Flu_Toggle_Group.cpp,v 1000.1 2004/06/01 21:06:06 gouriano Exp $/*************************************************************** *                FLU - FLTK Utility Widgets  *  Copyright (C) 2002 Ohio Supercomputer Center, Ohio State University * * This file and its content is protected by a software license. * You should have received a copy of this license with this file. * If not, please contact the Ohio Supercomputer Center immediately: * Attn: Jason Bryan Re: FLU 1224 Kinnear Rd, Columbus, Ohio 43212 *  ***************************************************************/#include <ncbi_pch.hpp>#include <gui/widgets/FLU/Flu_Toggle_Group.h>Flu_Toggle_Group :: Flu_Toggle_Group( int x, int y, int w, int h, const char *l )  : Fl_Group( x, y, w, h, l ){  chkBtn = new Fl_Check_Button( 0, 0, 0, 0 );  chkBtn->callback( _toggleCB, this );  box( FL_EMBOSSED_FRAME );  align( FL_ALIGN_LEFT | FL_ALIGN_INSIDE );}void Flu_Toggle_Group :: toggleCB(){  do_callback();  redraw();}void Flu_Toggle_Group :: draw(){  int lblW = 0, lblH, X, i;  if( chkBtn->value() )    {      for( i = 1; i < children(); i++ )	child(i)->activate();    }  else    {      for( i = 1; i < children(); i++ )	child(i)->deactivate();    }  if( label() == 0 )    lblW = lblH = 0;  else if( strlen( label() ) == 0 )    lblW = lblH = 0;  else    {      measure_label( lblW, lblH );      lblW += 18;      lblH += 2;    }  // align the label  if( align() & FL_ALIGN_LEFT )    X = 4;  else if( align() & FL_ALIGN_RIGHT )    X = w() - lblW - 8;  else    X = w()/2 - lblW/2 - 2;  // draw the main group box  fl_draw_box( box(), x(), y()+lblH/2, w(), h()-lblH/2, color() );  // clip and draw the children  fl_clip( x()+2, y()+lblH+1, w()-4, h()-lblH-3 );  chkBtn->hide();  draw_children();  chkBtn->show();  fl_pop_clip();  // clear behind the button and draw it  fl_color( color() );  fl_rectf( x()+X, y(), lblW+4, lblH );  fl_color( labelcolor() );  chkBtn->label( label() );  chkBtn->resize( x()+X+2, y(), lblW, lblH );  draw_child( *chkBtn );}

⌨️ 快捷键说明

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