本文整理汇总了C++中gtk::treemodel::Path类的典型用法代码示例。如果您正苦于以下问题:C++ Path类的具体用法?C++ Path怎么用?C++ Path使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了Path类的14个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的C++代码示例。
示例1: queueDrawIfNeccesary
bool MouseAwareTreeView::queueDrawIfNeccesary(int32_t x, int32_t y, Glib::ustring* pPath)
{
Gtk::TreeModel::Path mousePath;
Gtk::TreeViewColumn* pColumn;
Gdk::Rectangle rect;
convert_bin_window_to_widget_coords (x, y, m_MouseInfo.x, m_MouseInfo.y);
if (get_path_at_pos(x, y, mousePath, pColumn, x, y))
{
int32_t offsetX, offsetY;
convert_bin_window_to_widget_coords(0, 0, offsetX, offsetY);
m_MouseInfo.x -= offsetX;
m_MouseInfo.y -= offsetY;
get_cell_area(mousePath, *pColumn, rect);
queue_draw_area(rect.get_x() + offsetX, rect.get_y() + offsetY, rect.get_width(), rect.get_height());
if (rect.get_y() != m_CurrentCell)
{
m_CurrentCell = rect.get_y();
m_CellChanged = true;
}
if (pPath)
{
*pPath = mousePath.to_string();
}
return true;
}
return false;
}
开发者ID:wwplaygh,项目名称:gejengel,代码行数:33,代码来源:mouseawaretreeview.cpp
示例2: cell_editing_done
//--------------------------------------------------------------------------------
void DbMySQLTableEditorIndexPage::cell_editing_done(GtkCellEditable *ce) {
if (_editing_done_id != 0 && _editable_cell != 0) {
g_signal_handler_disconnect(_editable_cell, _editing_done_id);
_editing_done_id = 0;
_editable_cell = 0;
}
// If it's Gtk::Entry, we try to find out if maybe user leave edit field empty,
// if so we revert it to the last known value or to the default one.
if (GTK_IS_ENTRY(ce)) {
GtkEntry *entry_widget = GTK_ENTRY(ce);
if (entry_widget) {
Gtk::Entry *entry = Glib::wrap(entry_widget);
if (entry && entry->get_text_length() == 0) {
Gtk::TreeModel::Path path;
Gtk::TreeView::Column *column(0);
_indexes_tv->get_cursor(path, column);
bec::NodeId node(path.to_string());
if (node.is_valid()) {
std::string name = _user_index_name;
if (name.empty())
name = strfmt("index%i", path[0] + 1);
_be->get_indexes()->set_field(node, MySQLTableIndexListBE::Name, name);
entry->set_text(name);
}
}
}
}
}
开发者ID:pk-codebox-evo,项目名称:mysql-workbench,代码行数:32,代码来源:mysql_table_editor_index_page.cpp
示例3: 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
示例4:
//------------------------------------------------------------------------------
Gtk::TreeModel::Path node2path(const ::bec::NodeId& node) {
const int depth = node.depth();
Gtk::TreeModel::Path path;
for (int i = 0; i < depth; i++)
path.push_back(node[i]);
return path;
}
开发者ID:pk-codebox-evo,项目名称:mysql-workbench,代码行数:10,代码来源:listmodel_wrapper.cpp
示例5:
Gtk::TreeModel::Path TreeModelWrapper::get_path_vfunc(const iterator& iter) const {
bec::NodeId node = node_for_iter(iter);
Gtk::TreeModel::Path path;
if (node.is_valid()) {
const int node_depth = node.depth();
// get path from an iterator. The iterator points to the node, so
// we have to trim the root node prefix so we have a path to the tree
for (int i = bec::NodeId(_root_node_path).depth(); i < node_depth; i++)
path.push_back(node[i]);
}
return path;
}
开发者ID:pk-codebox-evo,项目名称:mysql-workbench,代码行数:14,代码来源:treemodel_wrapper.cpp
示例6: loadArtistsSongs
void ArtistsWidget::loadArtistsSongs(std::string artist) {
selectedArtist = artist;
// set label of tab
artistsLabel->set_text(selectedArtist);
Gtk::TreeModel::Path path;
Gtk::CellRenderer* cell;
artistsView->get_cursor(path, cell);
std::cout << "sel path:" << path.to_string();
// cell->;
// clear treemodel
m_actualSongs.clear();
// start searching for artist
MPD::Client::GetInstance()->StartSearch(1);
MPD::Client::GetInstance()->AddSearch(MPD_TAG_ARTIST, artist);
MPD::Client::GetInstance()->CommitSearch(m_actualSongs);
// sort songs
std::sort(m_actualSongs.begin(), m_actualSongs.end(), actualSongSortCond);
artistsView->unset_model();
treeModel->clear();
// insert return button
insertReturn();
for (int i = 0; i < m_actualSongs.size(); i++) {
Gtk::TreeModel::Row row = *(treeModel->append());
row[columns.artist] = m_actualSongs[i]->GetTitle();
Gtk::Image image;
image.set("ui/icon_smaller.png");
row[columns.image] = image.get_pixbuf();
row[columns.isArtist] = 0;
row[columns.song] = m_actualSongs[i];
}
artistsView->set_model(treeModel);
//scroll to top
artistScrolledWindow->get_vadjustment()->set_value(0);
}
开发者ID:tomwagner,项目名称:IntelligentMPDClient,代码行数:47,代码来源:guiartistswidget.cpp
示例7: drag_data_received_vfunc
//------------------------------------------------------------------------------
bool ListModelWrapper::drag_data_received_vfunc(const Gtk::TreeModel::Path& dest,
const Gtk::SelectionData& selection_data) {
bool ret = false;
// Currently this works for linear lists
try {
(*_tm)->reorder(bec::NodeId((const char*)selection_data.get_data()), dest.front());
ret = true;
} catch (const std::logic_error& e) {
}
return ret;
}
开发者ID:pk-codebox-evo,项目名称:mysql-workbench,代码行数:12,代码来源:listmodel_wrapper.cpp
示例8: 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);
}
}
}
}
开发者ID:lxlxlo,项目名称:LS-gigedit,代码行数:23,代码来源:midirules.cpp
示例9: 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);
}
开发者ID:lxlxlo,项目名称:LS-gigedit,代码行数:24,代码来源:midirules.cpp
示例10: get_selected_indices_walk_selected
static void get_selected_indices_walk_selected(const Gtk::TreeModel::Path& path, std::vector<size_t> *res)
{
res->push_back(path.back());
}
开发者ID:Sonano,项目名称:mysql-workbench,代码行数:4,代码来源:lf_listbox.cpp
示例11: if
bool
on_event(GdkEvent *event)
{
switch(event->type)
{
case GDK_SCROLL:
if(mimic_tree_view)
{
if(event->scroll.direction==GDK_SCROLL_DOWN)
{
mimic_tree_view->get_vadjustment()->set_value(
std::min(
mimic_tree_view->get_vadjustment()->get_value()+
mimic_tree_view->get_vadjustment()->get_step_increment(),
mimic_tree_view->get_vadjustment()->get_upper()-
mimic_tree_view->get_vadjustment()->get_page_size()
)
);
mimic_tree_view->get_vadjustment()->value_changed();
}
else if(event->scroll.direction==GDK_SCROLL_UP)
{
mimic_tree_view->get_vadjustment()->set_value(
std::max(
mimic_tree_view->get_vadjustment()->get_value()-
mimic_tree_view->get_vadjustment()->get_step_increment(),
mimic_tree_view->get_vadjustment()->get_lower()
)
);
mimic_tree_view->get_vadjustment()->value_changed();
}
}
break;
case GDK_BUTTON_PRESS:
{
Gtk::TreeModel::Path path;
Gtk::TreeViewColumn *column;
int cell_x, cell_y;
if(!get_path_at_pos(
int(event->button.x),int(event->button.y), // x, y
path, // TreeModel::Path&
column, //TreeViewColumn*&
cell_x,cell_y //int&cell_x,int&cell_y
)
) break;
const Gtk::TreeRow row = *(get_model()->get_iter(path));
if(column && column->get_first_cell_renderer()==cellrenderer_time_track)
{
Gdk::Rectangle rect;
get_cell_area(path,*column,rect);
cellrenderer_time_track->property_value_desc()=row[model.value_desc];
cellrenderer_time_track->property_canvas()=row[model.canvas];
cellrenderer_time_track->activate(event,*this,path.to_string(),rect,rect,Gtk::CellRendererState());
queue_draw_area(rect.get_x(),rect.get_y(),rect.get_width(),rect.get_height());
return true;
//return signal_param_user_click()(event->button.button,row,COLUMNID_TIME_TRACK);
}
}
break;
case GDK_MOTION_NOTIFY:
{
Gtk::TreeModel::Path path;
Gtk::TreeViewColumn *column;
int cell_x, cell_y;
if(!get_path_at_pos(
(int)event->motion.x,(int)event->motion.y, // x, y
path, // TreeModel::Path&
column, //TreeViewColumn*&
cell_x,cell_y //int&cell_x,int&cell_y
)
) break;
if(!get_model()->get_iter(path))
break;
Gtk::TreeRow row = *(get_model()->get_iter(path));
if ((event->motion.state&GDK_BUTTON1_MASK || event->motion.state&GDK_BUTTON3_MASK) &&
column &&
cellrenderer_time_track == column->get_first_cell_renderer())
{
Gdk::Rectangle rect;
get_cell_area(path,*column,rect);
cellrenderer_time_track->property_value_desc()=row[model.value_desc];
cellrenderer_time_track->property_canvas()=row[model.canvas];
cellrenderer_time_track->activate(event,*this,path.to_string(),rect,rect,Gtk::CellRendererState());
queue_draw();
//queue_draw_area(rect.get_x(),rect.get_y(),rect.get_width(),rect.get_height());
return true;
}
/* else
if(last_tooltip_path.get_depth()<=0 || path!=last_tooltip_path)
{
tooltips_.unset_tip(*this);
Glib::ustring tooltips_string(row[layer_model.tooltip]);
last_tooltip_path=path;
if(!tooltips_string.empty())
{
//.........这里部分代码省略.........
开发者ID:breaklyn,项目名称:synfig-osx,代码行数:101,代码来源:dock_timetrack.cpp
示例12: drag_data_get_vfunc
//------------------------------------------------------------------------------
bool ListModelWrapper::drag_data_get_vfunc(const Gtk::TreeModel::Path& path, Gtk::SelectionData& selection_data) const {
selection_data.set("text/path", path.to_string());
return true;
}
开发者ID:pk-codebox-evo,项目名称:mysql-workbench,代码行数:5,代码来源:listmodel_wrapper.cpp
示例13: 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());
}
开发者ID:pk-codebox-evo,项目名称:mysql-workbench,代码行数:6,代码来源:listmodel_wrapper.cpp
示例14: 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());
}
开发者ID:pk-codebox-evo,项目名称:mysql-workbench,代码行数:6,代码来源:treemodel_wrapper.cpp
注:本文中的gtk::treemodel::Path类示例由纯净天空整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论