本文整理汇总了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);
}