Exemplo n.º 1
0
void ModBox::shift_item_next()
{
    const bool are_rows_selected = getNumSelectedRows() > 0 ?  true : false;
    const int num_rows = display_list.size();
    const int end_of_list = num_rows - 1;
    
    if (are_rows_selected == true) {
        const int selected_row = getSelectedRow();
        const bool all_good = selected_row != end_of_list ? true : false;
        if (all_good) {
            StringArray holding_array(display_list);
            holding_array.move(selected_row, selected_row + 1);
            display_list.clear();
            display_list.addArray(holding_array);
            selectRow(selected_row + 1);
            updateContent();
            on_off();
            selectRow(selected_row + 1);
        } else {
            StringArray holding_array(display_list);
            holding_array.move(selected_row, 0);
            display_list.clear();
            display_list.addArray(holding_array);
            selectRow(0);
            updateContent();
            on_off();
            selectRow(0);
        }
    }
    qk_save();
}
Exemplo n.º 2
0
void ListBox::selectRowInternal (const int row,
                                 bool dontScroll,
                                 bool deselectOthersFirst,
                                 bool isMouseClick)
{
    if (! multipleSelection)
        deselectOthersFirst = true;

    if ((! isRowSelected (row))
         || (deselectOthersFirst && getNumSelectedRows() > 1))
    {
        if (isPositiveAndBelow (row, totalItems))
        {
            if (deselectOthersFirst)
                selected.clear();

            selected.addRange (Range<int> (row, row + 1));

            if (getHeight() == 0 || getWidth() == 0)
                dontScroll = true;

            viewport->selectRow (row, getRowHeight(), dontScroll,
                                 lastRowSelected, totalItems, isMouseClick);

            lastRowSelected = row;
            model->selectedRowsChanged (row);
        }
        else
        {
            if (deselectOthersFirst)
                deselectAllRows();
        }
    }
}
Exemplo n.º 3
0
void ModBox::select_prev_item()
{
    const bool are_rows_selected = getNumSelectedRows() > 0 ?  true : false;
    const int num_rows = display_list.size();
    const int end_of_list = num_rows - 1;
    
    if (are_rows_selected == true) {
        const int selected_row = getSelectedRow();
        const bool all_good = selected_row != 0 ? true : false;
        if (all_good == true) {
            deselectRow(selected_row);
            selectRow(selected_row - 1);
        } else {
            deselectRow(selected_row);
            selectRow(end_of_list);
        }
    } else {
        selectRow(0);
    }
}
int FileListComponent::getNumSelectedFiles() const
{
    return getNumSelectedRows();
}