本文整理汇总了C++中gtk::treemodel::Path::empty方法的典型用法代码示例。如果您正苦于以下问题:C++ Path::empty方法的具体用法?C++ Path::empty怎么用?C++ Path::empty使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类gtk::treemodel::Path
的用法示例。
在下文中一共展示了Path::empty方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的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);
}
示例2: remove_row
void MidiRuleCtrlTrigger::remove_row() {
Gtk::TreeModel::Path cpath;
Gtk::TreeViewColumn* col;
tree_view.get_cursor(cpath, col);
if (!cpath.empty()) tree_view.set_cursor(cpath);
Gtk::TreeModel::iterator it = tree_view.get_selection()->get_selected();
if (it) {
Gtk::TreePath path = list_store->get_path(it);
list_store->erase(it);
it = tree_view.get_selection()->get_selected();
if (!it) {
int i = path[0];
int n = list_store->children().size();
if (n) {
if (i >= n) i = n - 1;
path[0] = i;
tree_view.get_selection()->select(path);
}
}
}
}
示例3: add_row
void MidiRuleCtrlTrigger::add_row() {
Gtk::TreeModel::Path path;
Gtk::TreeViewColumn* col;
tree_view.get_cursor(path, col);
if (!path.empty()) tree_view.set_cursor(path);
Gtk::TreeModel::iterator it = list_store->append();
Gtk::TreeModel::Row row = *it;
update_model++;
row[columns.trigger_point] = 64;
row[columns.descending] = false;
row[columns.vel_sensitivity] = 50;
row[columns.key] = note_str(60);
row[columns.note_off] = false;
row[columns.switch_logic] = false;
row[columns.override_pedal] = false;
update_model--;
tree_view.get_selection()->select(row);
path = list_store->get_path(it);
tree_view.scroll_to_row(path);
tree_view.set_cursor(path);
}
示例4: get_node_for_path
//------------------------------------------------------------------------------
bec::NodeId ListModelWrapper::get_node_for_path(const Gtk::TreeModel::Path& path) const {
if (path.empty())
return bec::NodeId();
return bec::NodeId(path.to_string());
}
示例5: get_node_for_path
//------------------------------------------------------------------------------
bec::NodeId TreeModelWrapper::get_node_for_path(const Gtk::TreeModel::Path& path) const {
if (path.empty())
return _root_node_path_dot;
return bec::NodeId(_root_node_path_dot + path.to_string());
}