std::vector<MessageBoxStyle> MessageBoxStyle::getButtons() { std::vector<MessageBoxStyle> buttons; size_t index = 0; int num = value; while (index < _IndexIcon1) { if ((num & 1) == 1) { buttons.push_back(MessageBoxStyle::Enum( MYGUI_FLAG(index))); } ++index; num >>= 1; } return buttons; }
MessageBoxStyle Message::addButtonName(const UString& _name) { //FIXME if (mVectorButton.size() >= MessageBoxStyle::_CountUserButtons) { MYGUI_LOG(Warning, "Too many buttons in message box, ignored"); return MessageBoxStyle::None; } // бит, номер кнопки + смещение до Button1 MessageBoxStyle info = MessageBoxStyle(MessageBoxStyle::Enum(MYGUI_FLAG(mVectorButton.size() + MessageBoxStyle::_IndexUserButton1))); // запоминаем кнопки для отмены и подтверждения if (mVectorButton.empty()) mInfoOk = info; mInfoCancel = info; Widget* button = createWidgetT(mButtonType, mButtonSkin, IntCoord(), Align::Left | Align::Bottom); button->eventMouseButtonClick = newDelegate(this, &Message::notifyButtonClick); button->setCaption(_name); button->_setInternalData(info); mVectorButton.push_back(button); updateSize(); return info; }