cegui根据一个位置获得窗体

不是很多,但是偶尔会遇到这种需求:传入一个Windows窗口的位置,然后返回一个该位置上可以点到的控件。。

第一次找到的了CEGUI::System下的

Window* getTargetWindow(const Point& pt, const bool allow_disabled) const;

但是他是私有..

看看实现就知道其实还是通过Window::getTargetChildAtPosition得到的~看看这个函数的实现,是迭代的过程~那么调用根窗体的这个方法应该可以得到~

System中不过做了一个全局的考虑~比如CaptureWindow和ModalTarget,ModalTarget应该就是独占窗体吧。。。

有意思的是Window::getTargetChildAtPosition如何能正确得到哪个孩子在上还是在下。。

秘密在这:

Window* Window::getTargetChildAtPosition(const Vector2& position,
                                         const bool allow_disabled) const
{
    const ChildList::const_reverse_iterator end = d_drawList.rend();

...

}

 

    //! Child window objects arranged in rendering order.
    ChildList d_drawList;

 

后绘在上...

..........................................


 /*!
 /brief
  Return the Window object that the mouse is presently within

 /return
  Pointer to the Window object that currently contains the mouse cursor, or NULL if none.
 */
 Window* getWindowContainingMouse(void) const {return d_wndWithMouse;}

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值