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


C++ element::set_capture方法代码示例

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


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

示例1: do_horizontal

    bool do_horizontal(UINT event_type, POINT pt, 
      dom::element &splitter_el, dom::element &first, dom::element &second,
      dom::element &parent_el)
    {
      // which element width we will change?

      RECT rc_parent = parent_el.get_location();
      RECT rc = first.get_location();

      // if width of first element is less than half of parent we
      // will change its width.
      bool change_first = 
        (rc.right - rc.left) < (rc_parent.right - rc_parent.left)/2;


      if(!change_first)
        rc = second.get_location();

      if(event_type == MOUSE_DOWN)
      {
         pressed_offset = pt.x;
         splitter_el.set_capture();
         return false; // don't need updates
      }
      // mouse move handling
      if(pt.x == pressed_offset)
        return false; // don't need updates

      int width = rc.right - rc.left;

      wchar_t buf[32];
      if(change_first)
      {
        width += (pt.x - pressed_offset);
        if(width >= 0)
        {
          first.delay_measure();
          second.delay_measure();

          swprintf(buf,L"%dpx", width);
          first.set_style_attribute("width",buf);
          second.set_style_attribute("width",L"100%%");
        }
      }
      else
      {
        width -= (pt.x - pressed_offset);
        if(width >= 0)
        {
          first.delay_measure();
          second.delay_measure();

          swprintf(buf,L"%dpx", width);
          first.set_style_attribute("width",L"100%%");
          second.set_style_attribute("width",buf);
        }
      }
      return true; // need update
    }
开发者ID:Yggdrasill1989,项目名称:MabinogiPackageTool,代码行数:59,代码来源:behavior_splitter.cpp

示例2: do_vertical

    bool do_vertical(UINT event_type, POINT pt, 
      dom::element &splitter_el, dom::element &first, dom::element &second,
      dom::element &parent_el)
    {
      RECT rc_parent = parent_el.get_location();
      RECT rc = first.get_location();

      // if width of first element is less than half of parent we
      // will change its width.
      bool change_first = 
        (rc.bottom - rc.top) < (rc_parent.bottom - rc_parent.top)/2;

      if(!change_first)
        rc = second.get_location();

      if(event_type == MOUSE_DOWN)
      {
         pressed_offset = pt.y;
         splitter_el.set_capture();
         return false; // don't need updates
      }
      // mouse move handling
      if(pt.y == pressed_offset)
        return false; // don't need updates

      int height = rc.bottom - rc.top;

      wchar_t buf[32];

      if(change_first)
      {
        height += (pt.y - pressed_offset);
        if(height >= 0)
        {
          first.delay_measure();
          second.delay_measure();

          swprintf(buf,L"%dpx", height);
          first.set_style_attribute("height",buf);
          second.set_style_attribute("height",L"100%%");
        }
      }
      else
      {
        height -= (pt.y - pressed_offset);
        if(height >= 0)
        {
          first.delay_measure();
          second.delay_measure();

          swprintf(buf,L"%dpx", height);
          first.set_style_attribute("height",L"100%%");
          second.set_style_attribute("height",buf);
        }
      }
      return true;
    }
开发者ID:Yggdrasill1989,项目名称:MabinogiPackageTool,代码行数:57,代码来源:behavior_splitter.cpp


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