void MultiList::notifyButtonClick(MyGUI::WidgetPtr _widget) { if (_widget->_getInternalData() == mSortColumnIndex) { mSortUp = !mSortUp; redrawButtons(); // если было недосортированно то сортируем if (mIsDirtySort) sortList(); flipList(); } else { mSortColumnIndex = (size_t)_widget->_getInternalData(); mSortUp = true; redrawButtons(); sortList(); } }
void MultiListBox::setColumnNameAt(size_t _column, const UString& _name) { MYGUI_ASSERT_RANGE(_column, mVectorColumnInfo.size(), "MultiListBox::setColumnNameAt"); mVectorColumnInfo[_column].name = _name; // обновляем кэпшен сначала redrawButtons(); updateColumns(); }
void MultiListBox::sortByColumn(size_t _column, bool _backward) { mSortColumnIndex = _column; if (_backward) { mSortUp = !mSortUp; redrawButtons(); // если было недосортированно то сортируем if (mFrameAdvise) sortList(); flipList(); } else { mSortUp = true; redrawButtons(); sortList(); } }
void MultiListBox::updateColumns() { size_t countStars = 0; size_t lastIndexStar = ITEM_NONE; int allColumnsWidth = updateWidthColumns(countStars, lastIndexStar); int clientWidth = mClient->getWidth(); int separatorsWidth = mVectorColumnInfo.empty() ? 0 : (mVectorColumnInfo.size() - 1) * mWidthSeparator; int freeSpace = clientWidth - separatorsWidth - allColumnsWidth; int starWidth = (countStars != 0 && freeSpace > 0) ? (freeSpace / countStars) : 0; mWidthBar = 0; for (size_t index = 0; index < mVectorColumnInfo.size(); ++ index) { ColumnInfo& info = mVectorColumnInfo[index]; int columnWidth = getColumnWidth(index, freeSpace, countStars, lastIndexStar, starWidth); if (mHeaderPlace != nullptr) { info.item->setCoord(mWidthBar, 0, columnWidth, mClient->getHeight()); } else { info.item->setCoord(mWidthBar, mHeightButton, columnWidth, mClient->getHeight() - mHeightButton); } info.button->setCoord(mWidthBar, 0, columnWidth, getButtonHeight()); info.button->_setInternalData(index); mWidthBar += columnWidth; // промежуток между листами Widget* separator = getSeparator(index); if (separator) { separator->setCoord(mWidthBar, 0, mWidthSeparator, mClient->getHeight()); } mWidthBar += mWidthSeparator; } redrawButtons(); updateOnlyEmpty(); }