Пример #1
0
//-----------------------------------------------------------------------
bool DialogResourceGroups::renameResourceGroup( const wxString& currentName, const wxString& newName )
{
    if ( !isResourceGroupDefined( newName ) )
    {
        if ( isResourceGroupDefined( currentName ) )
        {
            wxString dir = m_resourceGroups[ currentName ];
            m_resourceGroups.erase( currentName );
            m_resourceGroups[ newName ] = dir;

            // update the grid
            int idx = getInternalGroupIndex( currentName );
            if ( idx != -1 )
                m_groupsGrid->SetCellValue( idx, 0, newName );

            // handle case where default group is renamed
            if ( m_defaultGroupName.Cmp( currentName ) == 0 )
                setDefaultGroup( newName );

            return true;
        }
        else
            wxLogError ( wxT( "DialogResourceGroups::renameResourceGroup - Error: Resource group is not defined." ) );
    }
    else
        wxLogError ( wxT( "DialogResourceGroups::renameResourceGroup - Error: Resource group name already exists." ) );

    return false;
}
Пример #2
0
//--------------------------------------------------------------------------------
void DialogResourceGroups::OnSetDefaultGroupButtonClick( wxCommandEvent& event )
{
    if ( m_groupsGrid->IsSelection() )
    {
        int idx;

        // selection could be in the form of cells or rows, so grab both
        wxGridCellCoordsArray cellsSel( m_groupsGrid->GetSelectionBlockTopLeft() );
        wxArrayInt rowsSel = m_groupsGrid->GetSelectedRows();

        if ( cellsSel.Count() > 0 )
            idx = cellsSel.Item( 0 ).GetRow();
        else if ( rowsSel.Count() > 0 )
            idx = rowsSel.Item( 0 );
        else
            idx = -1;

        // if there is something selected,
        if ( idx != -1 )
            // set as default
            setDefaultGroup( m_groupsGrid->GetCellValue( idx, 0 ) );
    }

    event.Skip();
}
Пример #3
0
//--------------------------------------------------------------------------------
void DialogResourceGroups::OnCancelClick( wxCommandEvent& event )
{
    // Restore the internal state to what it was before we started playing
    m_resourceGroups = m_backupResourceGroups;

    // sync the grid ready for next time
    clearGroupsGrid();
    populateGrid();

    setDefaultGroup( m_backupDefaultGroupName );

    // wipe out backup info incase some strangeness happens
    m_backupResourceGroups.clear();
    m_backupDefaultGroupName.clear();

    event.Skip();
}
Пример #4
0
//-----------------------------------------------------------------------
bool DialogResourceGroups::deleteGroupEntry( const wxString& groupName )
{
    if ( isResourceGroupDefined( groupName ) )
    {
        m_resourceGroups.erase( groupName );
        // erase entry from the grid
        int idx = getInternalGroupIndex( groupName );
        if ( idx != -1 )
            m_groupsGrid->DeleteRows( idx, 1 );

        // update the default if we just deleted it
        if ( m_defaultGroupName.Cmp( groupName ) == 0 )
            setDefaultGroup( wxT( "" ) );

        return true;
    }
    else
    {
        wxLogError ( wxT( "DialogResourceGroups::setGroupDirectory - Error: Resource group is not defined." ) );
        return false;
    }

}
QwwTwoColorIndicatorIface::QwwTwoColorIndicatorIface(QObject *parent)
        : wwWidgetInterface(parent) {
            setGroup("[ww] Display Widgets");
            setDefaultGroup("Display Widgets");
        }
Пример #6
0
QwwRichTextEditIface::QwwRichTextEditIface(QObject *parent)
        : wwWidgetInterface(parent){
            setGroup("[ww] Input Widgets");
            setDefaultGroup("Input Widgets");
        }
Пример #7
0
QwwColorComboBoxIface::QwwColorComboBoxIface(QObject *parent)
        : wwWidgetInterface(parent) {
            setGroup("[ww] Input Widgets");
            setDefaultGroup("Input Widgets");
        }