| 920 | } |
| 921 | |
| 922 | void MultiListBox::updateColumns() |
| 923 | { |
| 924 | size_t countStars = 0; |
| 925 | size_t lastIndexStar = ITEM_NONE; |
| 926 | |
| 927 | int allColumnsWidth = updateWidthColumns(countStars, lastIndexStar); |
| 928 | int clientWidth = _getClientWidget()->getWidth(); |
| 929 | int separatorsWidth = mVectorColumnInfo.empty() ? 0 : (mVectorColumnInfo.size() - 1) * mWidthSeparator; |
| 930 | int freeSpace = clientWidth - separatorsWidth - allColumnsWidth; |
| 931 | int starWidth = (countStars != 0 && freeSpace > 0) ? (freeSpace / countStars) : 0; |
| 932 | |
| 933 | mWidthBar = 0; |
| 934 | for (size_t index = 0; index < mVectorColumnInfo.size(); ++index) |
| 935 | { |
| 936 | ColumnInfo& info = mVectorColumnInfo[index]; |
| 937 | |
| 938 | int columnWidth = getColumnWidth(index, freeSpace, countStars, lastIndexStar, starWidth); |
| 939 | |
| 940 | if (mHeaderPlace != nullptr) |
| 941 | { |
| 942 | info.item->setCoord(mWidthBar, 0, columnWidth, _getClientWidget()->getHeight()); |
| 943 | } |
| 944 | else |
| 945 | { |
| 946 | info.item |
| 947 | ->setCoord(mWidthBar, mHeightButton, columnWidth, _getClientWidget()->getHeight() - mHeightButton); |
| 948 | } |
| 949 | |
| 950 | info.button->setCoord(mWidthBar, 0, columnWidth, getButtonHeight()); |
| 951 | info.button->_setInternalData(index); |
| 952 | |
| 953 | mWidthBar += columnWidth; |
| 954 | |
| 955 | // промежуток между листами |
| 956 | Widget* separator = getOrCreateSeparator(index); |
| 957 | if (separator) |
| 958 | { |
| 959 | separator->setCoord(mWidthBar, 0, mWidthSeparator, _getClientWidget()->getHeight()); |
| 960 | } |
| 961 | |
| 962 | mWidthBar += mWidthSeparator; |
| 963 | } |
| 964 | |
| 965 | redrawButtons(); |
| 966 | updateOnlyEmpty(); |
| 967 | } |
| 968 | |
| 969 | } // namespace MyGUI |