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


C++ Path::gobj方法代码示例

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


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

示例1: handle_popup

//------------------------------------------------------------------------------
void ListModelWrapper::handle_popup(const int x, const int y, const int time, GdkEventButton* evb)
{
  Gtk::TreeModel::Path   path;
  Gtk::TreeView::Column *column(0);
  int                    cell_x(-1);
  int                    cell_y(-1);

  ListModelWrapper::NodeIdArray list = get_selection();

  bool there_is_path_at_pos = false;
  if (_treeview)
    there_is_path_at_pos = _treeview->get_path_at_pos(x, y, path, column, cell_x, cell_y);
  else if (_iconview)
  {
    path = _iconview->get_path_at_pos(x, y);
    there_is_path_at_pos = path.gobj() && !path.empty();
  }

  if ( there_is_path_at_pos )
  {
    // Check that @path is on selection, otherwise add @path to selection
    bec::NodeId node = get_node_for_path(path);
    // list stores current selection
    bool path_at_pos_is_in_selection = false;
    for (int i = list.size() - 1; i >= 0; --i)
    {
      if (node == list[i])
      {
        path_at_pos_is_in_selection = true;
        break;
      }
    }

    if (!path_at_pos_is_in_selection)
    {
      // Add it, if user holds Ctrl while clicking right mouse btn
      // Otherwise clear selection, and select only @path
      const bool clear_selection = evb ? (!(evb->state & GDK_CONTROL_MASK)) : false;
      if (clear_selection)
      {
        if (_treeview)
          _treeview->get_selection()->unselect_all();
        if (_iconview)
          _iconview->unselect_all();
      }

      if (_treeview)
        _treeview->get_selection()->select(path);
      if (_iconview)
        _iconview->select_path(path);

      list = get_selection();
    }
  }
  if (!_context_menu)
    _context_menu = new Gtk::Menu();

  run_menu_and_forward_action((*_tm)->get_popup_items_for_nodes(list), x, y, time, *_tm, list, _fe_menu_handler, _context_menu);
}
开发者ID:ThiagoGarciaAlves,项目名称:mysql-workbench,代码行数:60,代码来源:listmodel_wrapper.cpp


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