本文整理汇总了C++中mygui::WidgetPtr类的典型用法代码示例。如果您正苦于以下问题:C++ WidgetPtr类的具体用法?C++ WidgetPtr怎么用?C++ WidgetPtr使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了WidgetPtr类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: update
void PropertiesPanelView::update(MyGUI::WidgetPtr _current_widget)
{
current_widget = _current_widget;
if (nullptr == current_widget)
current_widget_rectangle->setVisible(false);
else
{
MyGUI::LayerManager::getInstance().upLayerItem(current_widget);
MyGUI::IntCoord coord = current_widget->getCoord();
MyGUI::WidgetPtr parent = current_widget->getParent();
if (nullptr != parent)
{
// если выбрали виджет на табе, то подн¤ть лист таба
if (parent->getTypeName() == "Sheet" || parent->getTypeName() == MyGUI::TabItem::getClassTypeName())
{
MyGUI::TabPtr tab = parent->getParent()->castType<MyGUI::Tab>();
MyGUI::SheetPtr sheet = parent->castType<MyGUI::Sheet>();
tab->setItemSelected(sheet);
}
// если выбрали лист таба, то подн¤ть лист таба
if (current_widget->getTypeName() == "Sheet" || current_widget->getTypeName() == MyGUI::TabItem::getClassTypeName())
{
MyGUI::TabPtr tab = parent->castType<MyGUI::Tab>();
MyGUI::SheetPtr sheet = current_widget->castType<MyGUI::Sheet>();
tab->setItemSelected(sheet);
}
coord = current_widget->getAbsoluteCoord();
}
current_widget_rectangle->setVisible(true);
current_widget_rectangle->setCoord(coord);
MyGUI::InputManager::getInstance().setKeyFocusWidget(current_widget_rectangle);
}
// delete all previous properties
for (std::vector<MyGUI::StaticTextPtr>::iterator iter = propertiesText.begin(); iter != propertiesText.end(); ++iter)
(*iter)->setVisible(false);
for (MyGUI::VectorWidgetPtr::iterator iter = propertiesElement.begin(); iter != propertiesElement.end(); ++iter)
(*iter)->setVisible(false);
if (nullptr == _current_widget)
{
mMainWidget->setVisible(false);
}
else
{
mMainWidget->setVisible(true);
pairs_counter = 0;
mPanelMainProperties->update(_current_widget);
mPanelTypeProperties->update(_current_widget, PanelProperties::TYPE_PROPERTIES);
mPanelGeneralProperties->update(_current_widget, PanelProperties::WIDGET_PROPERTIES);
mPanelEvents->update(_current_widget, PanelProperties::EVENTS);
mPanelItems->update(_current_widget);
mPanelUserData->update(_current_widget);
}
}
示例2: Load
bool GUIMessageLayout::Load()
{
bool res = GUILayout::Load();
MyGUI::ButtonPtr button;
MyGUI::Gui *gui = GUISystem::GetInstance()->GetGui();
button = gui->findWidget<MyGUI::Button>("MessageButtonOK");
button->eventMouseButtonClick = MyGUI::newDelegate(this, &GUIMessageLayout::mousePressed);
MyGUI::WidgetPtr widget = Widgets.front();
widget->setPosition(gui->getViewWidth()/2-widget->getWidth()/2,gui->getViewHeight()/2-widget->getHeight()/2);
return res;
}
示例3: notifyButtonClick
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();
}
}
示例4: eventMouseButtonPressed
void MenuBar::eventMouseButtonPressed(MyGUI::WidgetPtr _sender, int _left, int _top, MouseButton _id)
{
if (_id == MB_Left) {
size_t select = (size_t)_sender->_getInternalData();
if (mIndexSelect == select) select = ITEM_NONE;
setItemSelect(select);
}
}
示例5: updateView
void PanelView::updateView()
{
// вычисл¤ем максимальную высоту всего добра
int height = 0;
for (VectorPanel::iterator iter=mItems.begin(); iter!=mItems.end(); ++iter) {
MyGUI::WidgetPtr widget = (*iter)->getPanelCell()->mainWidget();
if (widget->isShow()) {
height += widget->getHeight();
}
}
// ставим высоту холста, и спрашиваем получившуюс¤ ширину клиента
mScrollView->setCanvasSize(0, height);
// ширина клиента могла помен¤тс¤
MyGUI::IntCoord coord = mScrollView->getClientCoord();
mScrollView->setCanvasSize(coord.width, height);
// выравниваем все панели
int pos = 0;
for (VectorPanel::iterator iter=mItems.begin(); iter!=mItems.end(); ++iter) {
MyGUI::WidgetPtr widget = (*iter)->getPanelCell()->mainWidget();
if (widget->isShow()) {
height = widget->getHeight();
widget->setPosition(MyGUI::IntCoord(0, pos, coord.width, height));
pos += height;
}
}
mNeedUpdate = false;
MyGUI::Gui::getInstance().eventFrameStart -= MyGUI::newDelegate(this, &PanelView::frameEntered);
}
示例6: initPreGameGui
void Client::initPreGameGui()
{
// load starting layouts
m_guiRoot = MyGUI::LayoutManager::getInstance().loadLayout( CONST_STR("GUI::ClientPreGameLayout") );
MyGUI::WidgetPtr currentWidgetRoot = m_guiRoot.at(0);
currentWidgetRoot->findWidget("addressEditBox")->castType<MyGUI::EditBox>()->setCaption(m_hostAddress);
std::stringstream ss;
ss << m_hostPort;
currentWidgetRoot->findWidget("portEditBox")->castType<MyGUI::EditBox>()->setCaption(ss.str());
currentWidgetRoot->findWidget("exitButton")->eventMouseButtonClick += MyGUI::newDelegate(this, &Client::button_handler);
currentWidgetRoot->findWidget("connectButton")->eventMouseButtonClick += MyGUI::newDelegate(this, &Client::button_handler);
m_guiRoot.at(1)->setVisible(false);
m_guiRoot.at(1)->findWidget("progressBar")->castType<MyGUI::ProgressBar>()->setProgressPosition(1);
m_isGuiOpened = true;
}
示例7: remove
void EditorWidgets::remove(MyGUI::WidgetPtr _widget)
{
// дети вперед
MyGUI::VectorWidgetPtr childs = _widget->getChilds();
for (MyGUI::VectorWidgetPtr::iterator iter = childs.begin(); iter != childs.end(); ++iter)
{
if (null != find(*iter)) remove(*iter);
}
WidgetContainer * _container = find(_widget);
MyGUI::WidgetPtr parent = _widget->getParent();
// FIXME у таба все не как у людей
if ((null != parent) && (parent->getWidgetType() == "Tab")) MyGUI::castWidget<MyGUI::Tab>(parent)->removeSheet(MyGUI::castWidget<MyGUI::Sheet>(_widget));
else MyGUI::Gui::getInstance().destroyWidget(_widget);
if (null != _container)
{
widgets.erase(std::find(widgets.begin(), widgets.end(), _container));
delete _container;
}
}
示例8: guiCallback
void GraphicsImpl::guiCallback(MyGUI::WidgetPtr sender)
{
std::string name = sender->getName();
if (name == "do") {
InformationManager::Instance()->postDataToFeed("gui_event", DataContainer(DO_BUTTON));
}
if (name == "exit") {
InformationManager::Instance()->postDataToFeed("gui_event", DataContainer(EXIT_BUTTON));
}
}
示例9: layoutVertically
void InfoBoxDialog::layoutVertically(MyGUI::WidgetPtr widget, int margin)
{
size_t count = widget->getChildCount();
int pos = 0;
pos += margin;
int width = 0;
for (unsigned i = 0; i < count; ++i)
{
MyGUI::WidgetPtr child = widget->getChildAt(i);
if (!child->getVisible())
continue;
child->setPosition(child->getLeft(), pos);
width = std::max(width, child->getWidth());
pos += child->getHeight() + margin;
}
width += margin*2;
widget->setSize(width, pos);
}
示例10: serialiseWidget
void EditorWidgets::serialiseWidget(WidgetContainer * _container, MyGUI::xml::xmlNodePtr _node)
{
MyGUI::xml::xmlNodePtr node = _node->createChild("Widget");
node->addAttributes("type", _container->type);
if ("" != _container->skin) node->addAttributes("skin", _container->skin);
if ("" != _container->position) node->addAttributes("position", _container->position);
if ("" != _container->position_real) node->addAttributes("position_real", _container->position_real);
if ("" != _container->align) node->addAttributes("align", _container->align);
if ("" != _container->layer) node->addAttributes("layer", _container->layer);
if ("" != _container->name) node->addAttributes("name", _container->name);
for (StringPairs::iterator iter = _container->mProperty.begin(); iter != _container->mProperty.end(); ++iter)
{
MyGUI::xml::xmlNodePtr nodeProp = node->createChild("Property");
nodeProp->addAttributes("key", iter->first);
nodeProp->addAttributes("value", iter->second);
}
for (MapString::iterator iter = _container->mUserString.begin(); iter != _container->mUserString.end(); ++iter)
{
MyGUI::xml::xmlNodePtr nodeProp = node->createChild("UserString");
nodeProp->addAttributes("key", iter->first);
nodeProp->addAttributes("value", iter->second);
}
// метод медленный, т.к. квадратичная сложность
for (std::vector<WidgetContainer*>::iterator iter = widgets.begin(); iter != widgets.end(); ++iter)
{
MyGUI::WidgetPtr parent = (*iter)->widget->getParent();
// сынок - это ты?
if (_container->widget->getWidgetType() == "Window"){
if (null != parent)
if (_container->widget == parent->getParent()) serialiseWidget(*iter, node);
}else if (_container->widget == parent) serialiseWidget(*iter, node);
}
}
示例11: mousePressed
void PanelObjectsList::mousePressed(MyGUI::WidgetPtr _widget)
{
EditorFrameHandler *handler = EditorFrameListener::GetInstance()->GetCurrentHandler();
size_t count = mItemsCheckBox.size();
for (size_t pos=0; pos<count; ++pos)
{
((MyGUI::ButtonPtr)mItemsCheckBox[pos])->setStateCheck(false);
}
if (handler->SelectObject(_widget->getCaption()))
((MyGUI::ButtonPtr)_widget)->setStateCheck(true);
else
((MyGUI::ButtonPtr)_widget)->setStateCheck(false);
}
示例12: ButtonClick
void GuiPopup::ButtonClick(MyGUI::WidgetPtr wp)
{
// get result button id
btnResult = -1;
sscanf(wp->getName().c_str(), "PopBtn%d", &btnResult);
// save return fields from edits
EditBox* ed;
ed = (EditBox*)mWnd->findWidget("PopEdit0"); if (ed) edit0 = ed->getCaption();
ed = (EditBox*)mWnd->findWidget("PopEdit1"); if (ed) edit1 = ed->getCaption();
ed = (EditBox*)mWnd->findWidget("PopEdit2"); if (ed) edit2 = ed->getCaption();
ed = (EditBox*)mWnd->findWidget("PopEdit3"); if (ed) edit3 = ed->getCaption();
//Hide(); // done in delegate
mDelegates();
}
示例13: remove
void EditorWidgets::remove(MyGUI::WidgetPtr _widget)
{
// дети вперед
MyGUI::VectorWidgetPtr childs = _widget->getChilds();
for (MyGUI::VectorWidgetPtr::iterator iter = childs.begin(); iter != childs.end(); ++iter)
{
if (null != find(*iter)) remove(*iter);
}
WidgetContainer * _container = find(_widget);
MyGUI::Gui::getInstance().destroyWidget(_widget);
if (null != _container)
{
widgets.erase(std::find(widgets.begin(), widgets.end(), _container));
delete _container;
}
}
示例14: openToolTip
void GUI_Multiplayer::openToolTip(MyGUI::WidgetPtr sender, const MyGUI::ToolTipInfo &t)
{
if (t.type == MyGUI::ToolTipInfo::Show)
{
String txt = sender->getUserString("tooltip");
if (!txt.empty())
{
tooltipText->setCaption(txt);
MyGUI::IntSize s = tooltipText->getTextSize();
int newWidth = s.width + 10;
tooltipPanel->setPosition(t.point - MyGUI::IntPoint(newWidth + 10, 10));
tooltipPanel->setSize(newWidth, 20);
tooltipText->setSize(newWidth, 16);
tooltipPanel->setVisible(true);
}
} else if (t.type == MyGUI::ToolTipInfo::Hide)
{
tooltipPanel->setVisible(false);
}
}
示例15: if
SpaceShipDesignerGUI::SpaceShipDesignerGUI(ENGINE *engine, SpaceShipDesigner *parent)
{
mParent = parent;
mEngine = engine;
mGUI = engine->loadGUI("Designer.layout");
for(MyGUI::VectorWidgetPtr::iterator i=mGUI.begin(); i!=mGUI.end(); ++i)
{
MyGUI::WidgetPtr w = *i;
if(w->getName() == "Root")
{
mRoot = w;
mRoot->setSize(mEngine->getWindow()->getWidth(), mEngine->getWindow()->getHeight());
for(size_t j=0; j<mRoot->getChildCount(); j++)
{
if(w->getChildAt(j)->getTypeName() == "Button")
w->getChildAt(j)->eventMouseButtonClick = MyGUI::newDelegate(SpaceShipDesignerGUI::buttonClicked);
else if(w->getChildAt(j)->getTypeName() == "EditBox")
((MyGUI::EditBox *)w->getChildAt(j))->eventEditTextChange = MyGUI::newDelegate(SpaceShipDesignerGUI::editBoxUpdated);
}
}
}
}