当前位置: 首页>>代码示例>>C++>>正文


C++ EventTarget::IsFormActive方法代码示例

本文整理汇总了C++中EventTarget::IsFormActive方法的典型用法代码示例。如果您正苦于以下问题:C++ EventTarget::IsFormActive方法的具体用法?C++ EventTarget::IsFormActive怎么用?C++ EventTarget::IsFormActive使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在EventTarget的用法示例。


在下文中一共展示了EventTarget::IsFormActive方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。

示例1: if

void
EventDispatch::Dispatch()
{
    int ml = Mouse::LButton();
    int mr = Mouse::RButton();
    int mx = Mouse::X();
    int my = Mouse::Y();
    int mw = Mouse::Wheel();

    EventTarget* mouse_tgt = capture;
    EventTarget* key_tgt   = focus;
    EventTarget* do_click  = 0;

    if (!mouse_tgt) {
        ListIter<EventTarget> iter = clients;
        while (++iter) {
            EventTarget* test = iter.value();
            if (test->IsFormActive()) {
                if (test->TargetRect().Contains(mx,my))
                    mouse_tgt = test;

                if (test->HasFocus())
                    key_tgt = test;
            }
        }
    }

    // Mouse Events:

    if (mouse_tgt != current) {
        if (current && current->IsEnabled() && current->IsVisible())
            current->OnMouseExit(mx,my);

        current = mouse_tgt;

        if (current && current->IsEnabled() && current->IsVisible())
            current->OnMouseEnter(mx,my);
    }

    if (mouse_tgt && mouse_tgt->IsEnabled()) {
        if (mx != mouse_x || my != mouse_y)
            mouse_tgt->OnMouseMove(mx,my);

        if (mw != 0)
            mouse_tgt->OnMouseWheel(mw);

        if (ml != mouse_l) {
            if (ml) {
                mouse_tgt->OnLButtonDown(mx,my);
                click_tgt = mouse_tgt;
            }
            else {
                mouse_tgt->OnLButtonUp(mx,my);

                if (click_tgt == mouse_tgt) {
                    if (click_tgt->TargetRect().Contains(mx,my))
                        do_click = click_tgt;
                    click_tgt = 0;
                }
            }
        }

        if (mr != mouse_r) {
            if (mr)
                mouse_tgt->OnRButtonDown(mx,my);
            else
                mouse_tgt->OnRButtonUp(mx,my);
        }
    }

    mouse_l = ml;
    mouse_r = mr;
    mouse_x = mx;
    mouse_y = my;

    // Keyboard Events:

    if (click_tgt && click_tgt != key_tgt) {
        if (key_tgt) key_tgt->KillFocus();
        key_tgt = click_tgt;

        if (key_tgt != focus) {
            if (focus) focus->KillFocus();

            if (key_tgt && key_tgt->IsEnabled() && key_tgt->IsVisible())
                focus = key_tgt;
            else
                key_tgt = 0;

            if (focus) focus->SetFocus();
        }
    }

    if (key_tgt && key_tgt->IsEnabled()) {
        int key = 0;
        int shift = 0;

        while (GetKeyPlus(key, shift)) {
            if (key == VK_ESCAPE) {
                key_tgt->KillFocus();
//.........这里部分代码省略.........
开发者ID:The-E,项目名称:Starshatter-Experimental,代码行数:101,代码来源:EventDispatch.cpp


注:本文中的EventTarget::IsFormActive方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。