本文整理汇总了C++中WidgetPtr类的典型用法代码示例。如果您正苦于以下问题:C++ WidgetPtr类的具体用法?C++ WidgetPtr怎么用?C++ WidgetPtr使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了WidgetPtr类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的C++代码示例。
示例1: rootWidget
void Ui::_updateHovered( const Point& mousePos )
{
WidgetPtr lastHovered = _d->hovered.current;
WidgetPtr lastHoveredNoSubelement = _d->hovered.noSubelement;
_d->hovered.lastMousePos = mousePos;
// Get the real Hovered
_d->hovered.current = rootWidget()->getElementFromPoint( mousePos );
if( _d->tooltip.element.isValid() && _d->hovered.current == _d->tooltip.element )
{
// When the mouse is over the ToolTip we remove that so it will be re-created at a new position.
// Note that ToolTip.EnterTime does not get changed here, so it will be re-created at once.
_d->tooltip.element->deleteLater();
_d->tooltip.element->hide();
_d->tooltip.element = WidgetPtr();
_d->hovered.current = rootWidget()->getElementFromPoint( mousePos );
}
// for tooltips we want the element itself and not some of it's subelements
if( _d->hovered.current != rootWidget() )
{
_d->hovered.noSubelement = _d->hovered.current;
while ( _d->hovered.noSubelement.isValid() && _d->hovered.noSubelement->isSubElement() )
{
_d->hovered.noSubelement = _d->hovered.noSubelement->parent();
}
}
else
{
_d->hovered.noSubelement = 0;
}
if( _d->hovered.current != lastHovered )
{
if( lastHovered.isValid() )
{
lastHovered->onEvent( NEvent::Gui( lastHovered.object(), 0, guiElementLeft ) );
}
if( _d->hovered.current.isValid() )
{
_d->hovered.current->onEvent( NEvent::Gui( _d->hovered.current.object(), _d->hovered.current.object(), guiElementHovered ) );
}
}
if ( lastHoveredNoSubelement != _d->hovered.noSubelement )
{
if( _d->tooltip.element.isValid() )
{
_d->tooltip.element->deleteLater();
_d->tooltip.element = WidgetPtr();
}
if( _d->hovered.noSubelement.isValid() )
{
_d->tooltip.enterTime = DateTime::elapsedTime();
}
}
}
开发者ID:binakot,项目名称:caesaria-game,代码行数:60,代码来源:environment.cpp
示例2: ShowWidgetPart
void BasicContainer::ShowWidgetPart( WidgetPtr widget, Rectangle area )
{
Rectangle widgetArea = getChildrenArea();
area.x += widget->GetX();
area.y += widget->GetY();
if (area.x + area.width > widgetArea.width)
{
widget->SetX(widget->GetX() - area.x - area.width + widgetArea.width);
}
if (area.y + area.height > widgetArea.height)
{
widget->SetY(widget->GetY() - area.y - area.height + widgetArea.height);
}
if (area.x < 0)
{
widget->SetX(widget->GetX() - area.x);
}
if (area.y < 0)
{
widget->SetY(widget->GetY() - area.y);
}
}
开发者ID:doveiya,项目名称:isilme,代码行数:27,代码来源:basiccontainer.cpp
示例3: getItemWidget
void ItemBox::_redrawAllVisible()
{
int count = mCountLineVisible * mCountItemInLine + mTopIndex;
size_t iwid = 0; // индекс виджета
for (int pos = mTopIndex; pos<count; ++pos, ++iwid) {
// дальше нет айтемов
if (pos >= mCountItems) break;
WidgetPtr widget = getItemWidget(iwid);
widget->show();
redrawItem(widget, (size_t)pos);
}
// все виджеты еще есть, то их надо бы скрыть
while (iwid < mVectorItems.size()) {
mVectorItems[iwid]->hide();
iwid ++;
}
//MYGUI_OUT(mVectorItems.size());
}
开发者ID:MyGUI,项目名称:mygui-historical,代码行数:25,代码来源:MyGUI_ItemBox.cpp
示例4: addTime
bool ControllerFadeAlpha::addTime(WidgetPtr _widget, float _time)
{
float alpha = _widget->getAlpha();
// проверяем нужно ли к чему еще стремиться
if (mAlpha > alpha) {
alpha += _time * mCoef;
if (mAlpha > alpha) {
_widget->setAlpha(alpha);
eventUpdateAction(_widget);
return true;
}
else {
_widget->setAlpha(mAlpha);
}
}
else if (mAlpha < alpha) {
alpha -= _time * mCoef;
if (mAlpha < alpha) {
_widget->setAlpha(alpha);
eventUpdateAction(_widget);
return true;
}
else {
_widget->setAlpha(mAlpha);
}
}
// вызываем пользовательский делегат пост обработки
eventPostAction(_widget);
return false;
}
开发者ID:venkatarajasekhar,项目名称:viper,代码行数:33,代码来源:MyGUI_ControllerFadeAlpha.cpp
示例5: AddChild
void Stack::AddChild( WidgetPtr child )
{
int x = 0;
int y = 0;
if (mWidgets.size() > 0)
{
WidgetPtr last = mWidgets.back();
if (mOrientation == OrientationVertical)
{
y = last->GetY() + last->GetHeight() + mSpacing;
}
else
{
x = last->GetX() + last->GetWidth() + mSpacing;
}
}
child->SetPosition(x, y);
BasicContainer::Add(child);
if (mOrientation == OrientationVertical)
{
SetSize(std::max(GetWidth(), child->GetWidth()), y + child->GetHeight());
}
else
{
SetSize(x + child->GetWidth(), std::max(GetHeight(), child->GetHeight()));
}
}
开发者ID:doveiya,项目名称:isilme,代码行数:29,代码来源:stack.cpp
示例6: attachToLayerKeeper
// поправить на виджет и проверять на рутовость
void LayerManager::attachToLayerKeeper(const std::string& _name, WidgetPtr _item)
{
MYGUI_ASSERT(_item->isRootWidget(), "attached widget must be root");
// сначала отсоединяем
detachFromLayerKeeper(_item);
// а теперь аттачим
for (VectorLayerKeeper::iterator iter=mLayerKeepers.begin(); iter!=mLayerKeepers.end(); ++iter) {
if (_name == (*iter)->getName()) {
// запоминаем в рутовом виджете хранитель лееров
_item->mLayerKeeper = (*iter);
// достаем из хранителя леер для себя
_item->mLayerItemKeeper = (*iter)->getItem();
// подписываемся на пиккинг
_item->mLayerItemKeeper->_addPeekItem(_item);
// физически подсоединяем иерархию
_item->_attachToLayerItemKeeper(_item->mLayerItemKeeper);
return;
}
}
MYGUI_EXCEPT("Layer '" << _name << "' is not found");
}
开发者ID:twktheainur,项目名称:vortex-ee,代码行数:29,代码来源:MyGUI_LayerManager.cpp
示例7: Render
void WidgetRender::Render(ContainerWidget* w)
{
m_render->PushSate();
if (w->GetBackColor().a > 0.0f)
{
m_render->SetColor(w->GetBackColor());
m_render->SetAlpha(w->GetBackColor().a);
if (w->GetStyle()->IsEnabledTextures())
{
m_render->SetTexture(w->GetBackTexture());
m_render->DrawTexturedQuad(w->GetLocalX(), w->GetLocalY(), w->GetWidth(), w->GetHeight());
}
else
{
m_render->DrawQuad(w->GetLocalX(), w->GetLocalY(), w->GetWidth(), w->GetHeight());
}
}
m_render->Translate(w->GetLocalX(), w->GetLocalY());
for (ContainerWidget::ChildrenCollection::iterator it = w->GetChildren().begin(); it != w->GetChildren().end(); ++it)
{
WidgetPtr child = (*it).second;
child->Repaint(this);
}
m_render->PopState();
}
开发者ID:Mikalai,项目名称:punk_project_a,代码行数:26,代码来源:widget_render.cpp
示例8: getNode
bool Widget::dispatchTouchEvent(TouchEvent &event)
{
auto curr = event.getCurrPoint();
bool handled = false;
// 靠前的控件先接受事件
int size = getNode()->getChildren().size();
for (int i = size - 1; i >= 0; --i) {
auto child = getNode()->getChildren()[i];
WidgetPtr childWidget = child->getComponent<Widget>();
if (!childWidget) {
continue;
}
Vec2 p = childWidget->getComponent<Transform2D>()->convertParentToLocalSpace(curr);
event.setCurrPoint(p);
// 有控件处理了事件就阻止传递
if (childWidget->onTouchEvent(event)) {
handled = true;
break;
}
}
return handled;
}
开发者ID:mink365,项目名称:RacingEngine,代码行数:30,代码来源:Widget.cpp
示例9: addChild
void ContainerWidget::addChild(const WidgetPtr& child)
{
auto oldParent = child->getParent();
if(oldParent)
oldParent->removeChild(child);
children.push_back(child);
child->setParent(sharedFromThis());
}
开发者ID:ronsaldo,项目名称:loden,代码行数:9,代码来源:ContainerWidget.cpp
示例10: convertToGlobal
// преобразует точку на виджете в глобальную позицию
IntPoint WidgetManager::convertToGlobal(const IntPoint& _point, WidgetPtr _widget)
{
IntPoint ret = _point;
WidgetPtr wid = _widget;
while (wid != null) {
ret += wid->getPosition();
wid = wid->getParent();
}
return ret;
}
开发者ID:MyGUI,项目名称:mygui-historical,代码行数:11,代码来源:MyGUI_WidgetManager.cpp
示例11: upLayerItem
void LayerManager::upLayerItem(WidgetPtr _item)
{
if (null == _item) return;
// добираемся до рута
while (_item->getParent() != null) _item = _item->getParent();
// если приаттачены, то поднимаем
if (null != _item->mLayerKeeper) _item->mLayerKeeper->upItem(_item->mLayerItemKeeper);
}
开发者ID:twktheainur,项目名称:vortex-ee,代码行数:11,代码来源:MyGUI_LayerManager.cpp
示例12: GetKeyEventSource
WidgetPtr Gui::GetKeyEventSource()
{
WidgetPtr widget = mFocusHandler->GetFocused();
while (widget->_getInternalFocusHandler()
&& widget->_getInternalFocusHandler()->GetFocused())
{
widget = widget->_getInternalFocusHandler()->GetFocused();
}
return widget;
}
开发者ID:doveiya,项目名称:isilme,代码行数:12,代码来源:gui.cpp
示例13: GetWidgetAt
WidgetPtr Gui::GetMouseEventSource(int x, int y)
{
WidgetPtr widget = GetWidgetAt(x, y);
if (mFocusHandler->GetModalMouseInputFocused()
&& !widget->isModalMouseInputFocused())
{
return mFocusHandler->GetModalMouseInputFocused();
}
return widget;
}
开发者ID:doveiya,项目名称:isilme,代码行数:12,代码来源:gui.cpp
示例14: distributeFocusGainedEvent
void FocusHandler::distributeFocusGainedEvent(const Event& focusEvent)
{
WidgetPtr sourceWidget = focusEvent.GetSource();
std::list<FocusListener*> focusListeners = sourceWidget->_getFocusListeners();
// Send the event to all focus listeners of the widget.
for (std::list<FocusListener*>::iterator it = focusListeners.begin();
it != focusListeners.end();
++it)
{
(*it)->focusGained(focusEvent);
}
}
开发者ID:doveiya,项目名称:isilme,代码行数:14,代码来源:focushandler.cpp
示例15: Widget_Caption
void WidgetFactory::Widget_Caption(WidgetPtr _widget, const Ogre::String &_key, const Ogre::String &_value)
{
// change '\n' on char 10
size_t pos = _value.find("\\n");
if (pos == std::string::npos) _widget->setCaption(_value);
else {
std::string value(_value);
while (pos != std::string::npos) {
value[pos++] = '\n';
value.erase(pos, 1);
pos = value.find("\\n");
}
_widget->setCaption(value);
}
}
开发者ID:MyGUI,项目名称:mygui-historical,代码行数:15,代码来源:MyGUI_WidgetFactory.cpp
示例16: prepareItem
void ControllerFadeAlpha::prepareItem(WidgetPtr _widget)
{
// подготовка виджета, блокируем если только нужно
if (!mEnabled) _widget->setEnabledSilent(mEnabled);
if ((ALPHA_MIN != mAlpha) && (false == _widget->isVisible())) {
_widget->setAlpha(ALPHA_MIN);
_widget->setVisible(true);
}
// отписываем его от ввода
if (false == mEnabled) InputManager::getInstance()._unlinkWidget(_widget);
// вызываем пользовательский делегат для подготовки
eventPreAction(_widget);
}
开发者ID:venkatarajasekhar,项目名称:viper,代码行数:16,代码来源:MyGUI_ControllerFadeAlpha.cpp
示例17: Add
void BasicContainer::Add(WidgetPtr widget)
{
mWidgets.push_back(widget);
if (mInternalFocusHandler == NULL)
{
widget->_setFocusHandler(_getFocusHandler());
}
else
{
widget->_setFocusHandler(mInternalFocusHandler);
}
widget->_setParent(shared_from_this());
widget->addDeathListener(this);
}
开发者ID:doveiya,项目名称:isilme,代码行数:16,代码来源:basiccontainer.cpp
示例18: GetMouseEventSource
void Gui::handleModalFocusReleased()
{
// Check all widgets below the mouse to see if they are
// present in the "widget with mouse" queue. If a widget
// is not then it should be added and an entered event should
// be sent to it.
WidgetPtr widget = GetMouseEventSource(mLastMouseX, mLastMouseY);
WidgetPtr parent = widget;
while (parent != NULL)
{
parent = widget->GetParent();
// Check if the widget is present in the "widget with mouse" queue.
bool widgetIsPresentInQueue = false;
std::deque<WidgetPtr>::iterator iter;
for (iter = mWidgetWithMouseQueue.begin();
iter != mWidgetWithMouseQueue.end();
iter++)
{
if (*iter == widget)
{
widgetIsPresentInQueue = true;
break;
}
}
// Widget is not present, send an entered event and add
// it to the "widget with mouse" queue.
if (!widgetIsPresentInQueue
&& Widget::widgetExists(widget))
{
distributeMouseEvent(widget,
MouseEvent::ENTERED,
mLastMousePressButton,
mLastMouseX,
mLastMouseY,
false,
true);
mWidgetWithMouseQueue.push_front(widget);
}
WidgetPtr swap = widget;
widget = parent;
parent = swap->GetParent();
}
}
开发者ID:doveiya,项目名称:isilme,代码行数:47,代码来源:gui.cpp
示例19: while
WidgetPtr Gui::GetWidgetAt(int x, int y)
{
// If the widget's parent has no child then we have found the widget..
WidgetPtr parent = mTop;
WidgetPtr child = mTop;
while (child != NULL)
{
WidgetPtr swap = child;
int parentX, parentY;
parent->getAbsolutePosition(parentX, parentY);
child = parent->GetWidgetAt(x - parentX, y - parentY);
parent = swap;
}
return parent;
}
开发者ID:doveiya,项目名称:isilme,代码行数:17,代码来源:gui.cpp
示例20: Remove
void BasicContainer::Remove(WidgetPtr widget)
{
WidgetListIterator iter;
for (iter = mWidgets.begin(); iter != mWidgets.end(); iter++)
{
if (*iter == widget)
{
mWidgets.erase(iter);
widget->_setFocusHandler(FocusHandlerPtr());
widget->_setParent(WidgetPtr());
widget->removeDeathListener(this);
return;
}
}
throw GCN_EXCEPTION("There is no such widget in this container.");
}
开发者ID:doveiya,项目名称:isilme,代码行数:17,代码来源:basiccontainer.cpp
注:本文中的WidgetPtr类示例由纯净天空整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论