Пример #1
0
void
DataFieldEnum::AddChoices(const StaticEnumChoice *p)
{
    while (p->display_string != nullptr) {
        const TCHAR *help = p->help;
        if (help != nullptr)
            help = gettext(help);

        AddChoice(p->id, gettext(p->display_string), nullptr, help);
        ++p;
    }
}
Пример #2
0
EnableToolbarActionUI::EnableToolbarActionUI(ViewerActionLogic *L) : ViewerActionUIMultiple(L)
{
    SetAllText(tr("Toolbars"));
    SetToolTip(tr("Enable toolbars"));
    SetExclusive(false);

    // Add all of the action groups as choices.
    ViewerActionManager *actionMgr = GetLogic()->GetWindow()->GetActionManager();
    stringVector names(actionMgr->GetActionGroupNames(false));
    for(size_t i = 0; i < names.size(); ++i)
        AddChoice(names[i].c_str());
}
Пример #3
0
void GroupLayout::AddSkinHeader( SkinHeader & skin_header )
{
    assert( m_Group && m_Screen );
    int oldBW = GetButtonWidth();


    bool saveFitWidth = m_FitWidthFlag;
    bool saveSameLine = m_SameLineFlag;


    vector< VspButton* > buttons;

    // Size of Set label buttons
    int setW = 25;
    // Size of Equal label button
    int eqW = 20;

    // Width of choice
    int cw = m_ChoiceButtonWidth + m_SliderWidth;

    m_FitWidthFlag = true;

    // Gap width
    int gw = FitWidth( 2 * setW + eqW + oldBW + 2 * cw, 2 * m_ButtonWidth )/2;

    m_FitWidthFlag = false;
    m_SameLineFlag = true;

    Choice* cont_choice = new Choice();
    cont_choice->AddItem( "C0" );
    cont_choice->AddItem( "C1" );
    cont_choice->AddItem( "C2" );
    AddChoice( *cont_choice, "Enforce" );

    AddX( gw );

    //==== Left Set Button ====//
    SetButtonWidth( setW );
    buttons.push_back( AddParmButton( "Set" ) );

    AddX( oldBW );

    //==== Equal Button ====//
    SetButtonWidth( eqW );
    buttons.push_back( AddParmButton( "=" ) );

    //==== Right Set Button ====//
    SetButtonWidth( setW );
    buttons.push_back( AddParmButton( "Set" ) );

    NewLineX();

    m_FitWidthFlag = saveFitWidth;
    m_SameLineFlag = saveSameLine;

    skin_header.Init( m_Screen, cont_choice, buttons );

    ForceNewLine();

    SetButtonWidth( oldBW );
}
Пример #4
0
wxChoice * ShuttleGuiBase::TieChoice( 
   const wxString &Prompt, 
   WrappedType &WrappedRef,
   const wxArrayString * pChoices )
{
   // The Add function does a UseUpId(), so don't do it here in that case.
   if( mShuttleMode != eIsCreating )
      UseUpId();
   wxChoice * pChoice=NULL;
   switch( mShuttleMode )
   {
   case eIsCreating:
      {
         if( WrappedRef.IsString() )
            pChoice = AddChoice( Prompt, WrappedRef.ReadAsString(), pChoices );
         else
         {
            wxString Temp;
            if( pChoices && ( WrappedRef.ReadAsInt() < (int)pChoices->GetCount() ) )
            {
               Temp = (*pChoices)[WrappedRef.ReadAsInt()];
            }
            pChoice = AddChoice( Prompt, Temp, pChoices );
         }
      }
      break;
   // IF setting internal storage from the controls.
   case eIsGettingFromDialog:
      {
         wxWindow * pWnd  = wxWindow::FindWindowById( miId, mpDlg);
         pChoice = wxDynamicCast(pWnd, wxChoice);
         wxASSERT( pChoice );
         if( WrappedRef.IsString())
            WrappedRef.WriteToAsString( pChoice->GetStringSelection());
         else
            WrappedRef.WriteToAsInt( pChoice->GetSelection() );
      }
      break;
   case eIsSettingToDialog:
      {
         wxWindow * pWnd  = wxWindow::FindWindowById( miId, mpDlg);
         pChoice = wxDynamicCast(pWnd, wxChoice);
         wxASSERT( pChoice );
         if( WrappedRef.IsString() )
            pChoice->SetStringSelection( WrappedRef.ReadAsString() );
         else
            pChoice->SetSelection( WrappedRef.ReadAsInt() );
      }
      break;
   // IF Saving settings to external storage...
   // or IF Getting settings from external storage.
   case eIsSavingViaShuttle:
   case eIsGettingViaShuttle:
      DoDataShuttle( Prompt, WrappedRef );
      break;
   default:
      wxASSERT( false );
      break;
   }
   return pChoice;
}
Пример #5
0
 bool addEnumText(const TCHAR *text, unsigned id, const TCHAR *help=nullptr) {
   return AddChoice(id, text, nullptr, help);
 }