コード例 #1
0
//==== Create & Init Choice  ====//
void GroupLayout::AddChoice( Choice & choice, const char* label, int used_w )
{
    assert( m_Group && m_Screen );

    //==== Choice Button ====//
    VspButton* button = new VspButton( m_X, m_Y, m_ChoiceButtonWidth, m_StdHeight, label );
    button->box( FL_THIN_UP_BOX );
    button->labelfont( 1 );
    button->labelsize( 12 );
    button->labelcolor( FL_BLACK );
    button->copy_label( label );
    m_Group->add( button );
    AddX( m_ChoiceButtonWidth );

    //==== Choice Picker ====//
    int choice_w = FitWidth( m_ChoiceButtonWidth + used_w, m_SliderWidth );
    Fl_Choice* fl_choice = new Fl_Choice( m_X, m_Y, choice_w, m_StdHeight );
    fl_choice->down_box( FL_BORDER_BOX );
    fl_choice->textfont( 1 );
    fl_choice->textsize( 12 );
    fl_choice->textcolor( FL_DARK_BLUE );
    m_Group->add( fl_choice );
    AddX( choice_w );

    //==== Add Choice Text ===//
    vector< string > choice_vec = choice.GetItems();
    for ( int i = 0 ; i < ( int )choice_vec.size() ; i++ )
    {
        fl_choice->add( choice_vec[i].c_str() );
    }
    fl_choice->value( 0 );

    choice.Init( m_Screen, fl_choice, button );

    if( strcmp( label, "AUTO_UPDATE" ) == 0 || strcmp( label, "" ) == 0 )
    {
        choice.SetButtonNameUpdate( true );
    }

    AddY( m_StdHeight );
    NewLineX();

}