本文整理汇总了C++中gtk::TreeViewColumn类的典型用法代码示例。如果您正苦于以下问题:C++ TreeViewColumn类的具体用法?C++ TreeViewColumn怎么用?C++ TreeViewColumn使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了TreeViewColumn类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的C++代码示例。
示例1: add
//------------------------------------------------------------------------------
const StringColumn& ColumnsModel::append_markup_column(const int bec_tm_idx, const std::string& name,
const Iconic have_icon) {
Gtk::TreeModelColumn<Glib::RefPtr<Gdk::Pixbuf>>* icon = 0;
Gtk::TreeViewColumn* column = Gtk::manage(new Gtk::TreeViewColumn(base::replaceString(name, "_", "__")));
if (have_icon == WITH_ICON) {
icon = new Gtk::TreeModelColumn<Glib::RefPtr<Gdk::Pixbuf>>;
add(*icon);
add_bec_index_mapping(bec_tm_idx);
column->pack_start(*icon, false);
_columns.push_back(icon);
}
Gtk::TreeModelColumn<Glib::ustring>* col = new Gtk::TreeModelColumn<Glib::ustring>;
Gtk::CellRendererText* cell = Gtk::manage(new Gtk::CellRendererText());
add(*col);
add_bec_index_mapping(bec_tm_idx);
column->pack_start(*cell);
column->add_attribute(cell->property_markup(), *col);
_columns.push_back(col);
int nr_of_cols = _treeview->append_column(*column);
_treeview->get_column(nr_of_cols - 1)->set_resizable(true);
return *col;
}
开发者ID:pk-codebox-evo,项目名称:mysql-workbench,代码行数:30,代码来源:listmodel_wrapper.cpp
示例2: append_note_column
int MidiRuleCtrlTrigger::append_note_column(
const char* title,
const Gtk::TreeModelColumn<Glib::ustring>& column) {
Gtk::CellRendererSpin* renderer = Gtk::manage(new Gtk::CellRendererSpin());
renderer->property_editable() = true;
renderer->signal_editing_started().connect(
sigc::bind(
sigc::mem_fun(*this, &MidiRuleCtrlTrigger::note_editing_started),
renderer));
renderer->signal_edited().connect(
sigc::bind(
sigc::mem_fun(*this, &MidiRuleCtrlTrigger::note_edited),
column));
#if (GTKMM_MAJOR_VERSION == 2 && GTKMM_MINOR_VERSION < 90) || GTKMM_MAJOR_VERSION < 2
renderer->property_adjustment() = new Gtk::Adjustment(0, 0, 127);
#else
renderer->property_adjustment() = Gtk::Adjustment::create(0, 0, 127);
#endif
int cols_count = tree_view.append_column(title, *renderer);
Gtk::TreeViewColumn* col = tree_view.get_column(cols_count - 1);
col->add_attribute(*renderer, "text", column);
col->set_min_width(98);
return cols_count;
}
开发者ID:lxlxlo,项目名称:LS-gigedit,代码行数:25,代码来源:midirules.cpp
示例3:
void
PluginTreeView::ctor()
{
m_plugin_list = Gtk::ListStore::create(m_plugin_record);
set_model(m_plugin_list);
set_rules_hint(true);
append_column("#", m_plugin_record.index);
append_column_editable("Status", m_plugin_record.loaded);
append_plugin_column();
on_name_clicked();
Gtk::TreeViewColumn *column = get_column(0);
column->signal_clicked().connect(sigc::mem_fun(*this, &PluginTreeView::on_id_clicked));
column = get_column(1);
column->signal_clicked().connect(sigc::mem_fun(*this, &PluginTreeView::on_status_clicked));
Gtk::CellRendererToggle* renderer;
renderer = dynamic_cast<Gtk::CellRendererToggle*>( get_column_cell_renderer(1) );
renderer->signal_toggled().connect( sigc::mem_fun(*this, &PluginTreeView::on_status_toggled));
m_dispatcher.signal_connected().connect(sigc::mem_fun(*this, &PluginTreeView::on_connected));
m_dispatcher.signal_disconnected().connect(sigc::mem_fun(*this, &PluginTreeView::on_disconnected));
m_dispatcher.signal_message_received().connect(sigc::mem_fun(*this, &PluginTreeView::on_message_received));
}
开发者ID:sanyaade-teachings,项目名称:fawkes,代码行数:25,代码来源:plugin_tree_view.cpp
示例4: add
ModuleWindow::ModuleWindow(Module* module, MainWindow* parent,
Manager* manager)
{
m_pModule = module;
m_pParent = parent;
m_pManager = manager;
/* Create a new scrolled window, with scrollbars only if needed */
set_policy(Gtk::POLICY_AUTOMATIC, Gtk::POLICY_AUTOMATIC);
add(m_TreeView);
/* create tree store */
m_refTreeModel = Gtk::TreeStore::create(m_Columns);
m_TreeView.set_model(m_refTreeModel);
//Add the Model’s column to the View’s columns:
Gtk::CellRendererText* cellText = Gtk::manage(new Gtk::CellRendererText());
Gtk::CellRendererPixbuf* cellPix = Gtk::manage(new Gtk::CellRendererPixbuf());
Gtk::TreeViewColumn* col = Gtk::manage(new Gtk::TreeViewColumn("Item"));
col->pack_start(*cellPix, false);
col->pack_start(*cellText, true);
col->add_attribute(*cellText, "text", 1);
col->add_attribute(*cellPix, "pixbuf", 0);
m_TreeView.append_column(*col);
m_TreeView.get_column(0)->set_resizable(true);
m_TreeView.append_column("Value", m_Columns.m_col_value);
m_TreeView.get_column(1)->set_resizable(true);
updateWidget();
show_all_children();
}
开发者ID:JoErNanO,项目名称:yarp,代码行数:32,代码来源:module_window.cpp
示例5: setupColumns
void GtkPeerTreeView::setupColumns()
{
int cid;
Gtk::TreeViewColumn *col;
cid = append_column("IP" , m_cols.m_col_ip);
col = get_column(cid - 1);
col->set_sort_column(m_cols.m_col_ip);
append_column("Port", m_cols.m_col_port);
cid = append_column("Client" , m_cols.m_col_client);
col = get_column(cid - 1);
col->set_sort_column(m_cols.m_col_client);
append_column("Flags", m_cols.m_col_flags);
append_column("%", m_cols.m_col_percent);
append_column("Relevance", m_cols.m_col_relevance);
cid = append_column("Down Speed", m_cols.m_col_down);
col = get_column(cid - 1);
col->set_sort_column(m_cols.m_col_down);
cid = append_column("Up Speed" , m_cols.m_col_up);
col = get_column(cid - 1);
col->set_sort_column(m_cols.m_col_up);
append_column("Reqs", m_cols.m_col_reqs);
append_column("Waited", m_cols.m_col_waited);
append_column("Downloaded", m_cols.m_col_downloaded);
append_column("Uploaded", m_cols.m_col_uploaded);
append_column("Hasherr", m_cols.m_col_hasherr);
append_column("Peer Download Rate", m_cols.m_col_peer_download_rate);
append_column("MaxDown", m_cols.m_col_max_down);
append_column("MaxUp", m_cols.m_col_max_up);
append_column("Queued", m_cols.m_col_queued);
append_column("Inactive", m_cols.m_col_inactive);
append_column("Debug", m_cols.m_col_debug);
}
开发者ID:infoburp,项目名称:gtorrent-gtk,代码行数:32,代码来源:GtkPeerTreeView.cpp
示例6: setColumns
void ResViewerViewImpl::setColumns(ResViewerColumns* Columns)
{
mp_TreeView->remove_all_columns();
if (Columns)
{
Gtk::TreeViewColumn* CurrentCol;
mp_TreeView->append_column(_("Time step"), *Columns->getStepColumn());
CurrentCol = mp_TreeView->get_column(0);
CurrentCol->set_sort_column(*Columns->getStepColumn());
CurrentCol->set_resizable(true);
CurrentCol->set_reorderable(true);
mp_TreeView->append_column(_("Date-Time"), *Columns->getDateColumn());
CurrentCol = mp_TreeView->get_column(1);
CurrentCol->set_sort_column(*Columns->getDateColumn());
CurrentCol->set_resizable(true);
CurrentCol->set_reorderable(true);
std::map<std::string, Gtk::TreeModelColumn<std::string>*> ColumnsByTitle =
Columns->getByTitleColumns();
for (std::map<std::string, Gtk::TreeModelColumn<std::string>*>::iterator
it = ColumnsByTitle.begin(); it != ColumnsByTitle.end(); ++it)
{
int ColNb = mp_TreeView->append_column(it->first, *it->second);
CurrentCol = mp_TreeView->get_column(ColNb - 1);
CurrentCol->set_sort_column(*it->second);
CurrentCol->set_resizable(true);
CurrentCol->set_reorderable(true);
}
}
}
开发者ID:VaysseB,项目名称:openfluid,代码行数:34,代码来源:ResViewerView.cpp
示例7: appendToView
void statusRecord::appendToView(Gtk::TreeView* _treeview)
{
_treeview->append_column("Filename", filename);
_treeview->append_column("Status", status);
#if GTKMM_2_6_OR_BETTER
// Add a progress bar, showing status.
Gtk::CellRendererProgress* cell = Gtk::manage(new Gtk::CellRendererProgress);
int last_count = _treeview->append_column("Progress", *cell);
Gtk::TreeViewColumn* column = _treeview->get_column(last_count - 1);
if (column)
{
column->add_attribute(cell->property_value(), done);
column->add_attribute(cell->property_text(), doneText);
}
#else
// Old gtkmm version, so use boring text.
_treeview->append_column("Progress", done);
#endif // GTKMM_2_6_OR_BETTER
_treeview->append_column("Download", dn_rate);
_treeview->append_column("Upload", ul_rate);
_treeview->append_column("Filesize", filesize);
_treeview->append_column("Peers l/s", peers);
}
开发者ID:BackupTheBerlios,项目名称:btg-svn,代码行数:27,代码来源:mainmodel.cpp
示例8: wx
bool
KeyframeTree::on_event(GdkEvent *event)
{
switch(event->type)
{
case GDK_BUTTON_PRESS:
{
Gtk::TreeModel::Path path;
Gtk::TreeViewColumn *column;
int cell_x, cell_y;
int wx(round_to_int(event->button.x)),wy(round_to_int(event->button.y));
//tree_to_widget_coords (,, wx, wy);
if(!get_path_at_pos(
wx,wy, // 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));
signal_user_click()(event->button.button,row,(ColumnID)column->get_sort_column_id());
if((ColumnID)column->get_sort_column_id()==COLUMNID_JUMP)
{
keyframe_tree_store_->canvas_interface()->set_time(row[model.time]);
}
}
break;
case GDK_2BUTTON_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));
{
keyframe_tree_store_->canvas_interface()->set_time(row[model.time]);
return true;
}
}
break;
case GDK_BUTTON_RELEASE:
break;
default:
break;
}
return false;
}
开发者ID:breaklyn,项目名称:synfig-osx,代码行数:56,代码来源:keyframetree.cpp
示例9: setNotificationsView
void AttributesView::setNotificationsView() {
columns_notif.add(col_notif);
list_notif = Gtk::ListStore::create(columns_notif);
view_notif->set_model(list_notif);
int i = this->view_notif->append_column("Notificaciones", col_notif);
Gtk::TreeViewColumn* pColumn = this->view_files->get_column(i);
pColumn->set_resizable(true);
}
开发者ID:chuchu132,项目名称:lalalalacode,代码行数:10,代码来源:AttributeView.cpp
示例10: fillTagsList
/// @fn void LibraryView::fillTagsList()
/// @brief Method responsible for loading tags list from library.
void LibraryView::fillTagsList() {
tags_list = core->getTagsList();
tags_view.set_model(tags_list);
tags_view.append_column("Tags List", tags_columns.name);
Gtk::TreeViewColumn *column = tags_view.get_column(0);
if(column) column->set_expand(true);
tags_view.append_column_editable("", tags_columns.selected);
tags_view.signal_cursor_changed().connect(sigc::mem_fun(*this,
&LibraryView::loadImagesByTags));
}
开发者ID:jjkrol,项目名称:ZPR,代码行数:12,代码来源:libraryView.cpp
示例11: reflesh
void Portfolio::reflesh()
{
//Fill the TreeView's model
m_refTreeModel->clear();
m_TreeView.remove_all_columns();
//Add the TreeView's view columns:
m_TreeView.append_column("Currency", m_Columns.m_col_currency);
m_TreeView.append_column("Amount", m_Columns.m_col_amount);
vector<AccountDatum*> accountData = OutgoingRequest::requestAccountData();
vector<double> in_yens;
vector<double> percentages;
double sum;
for(size_t i=0; i<accountData.size(); i++)
{
string symbol = accountData.at(i)->currency;
double rate = lexical_cast<double>(OutgoingRequest::requestLatestRate(symbol, "JPY"));
double in_yen = accountData.at(i)->amount * rate;
in_yens.push_back(in_yen);
}
sum = boost::accumulate(in_yens, 0);
for(size_t i=0; i<accountData.size(); i++)
{
double percentage = in_yens.at(i)/sum * 100;
percentages.push_back(percentage);
}
Gtk::TreeModel::Row row;
for(size_t i=0; i<accountData.size(); i++){
row = *(m_refTreeModel->append());
row[m_Columns.m_col_currency] = accountData.at(i)->currency;
row[m_Columns.m_col_amount] = accountData.at(i)->amount;
row[m_Columns.m_col_percentage] = percentages.at(i);
}
Gtk::CellRendererProgress* cell = Gtk::manage(new Gtk::CellRendererProgress);
int cols_count = m_TreeView.append_column("Percentage", *cell);
Gtk::TreeViewColumn* pColumn = m_TreeView.get_column(cols_count - 1);
if(pColumn)
{
pColumn->add_attribute(cell->property_value(), m_Columns.m_col_percentage);
}
for(guint i = 0; i < 2; i++)
{
Gtk::TreeView::Column* pColumn = m_TreeView.get_column(i);
pColumn->set_reorderable();
}
show_all_children();
}
开发者ID:vn271,项目名称:simple-forex-server-client,代码行数:55,代码来源:portfolio.cpp
示例12: int
bool
Dock_History::on_action_event(GdkEvent *event)
{
studio::HistoryTreeStore::Model model;
switch(event->type)
{
case GDK_BUTTON_PRESS:
case GDK_2BUTTON_PRESS:
{
Gtk::TreeModel::Path path;
Gtk::TreeViewColumn *column;
int cell_x, cell_y;
if(!action_tree->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 = *(action_tree->get_model()->get_iter(path));
//signal_user_click()(event->button.button,row,(ColumnID)column->get_sort_column_id());
if((ColumnID)column->get_sort_column_id()==COLUMNID_JUMP)
{
etl::handle<synfigapp::Action::Undoable> action(row[model.action]);
try{
if((bool)row[model.is_undo])
{
while(get_selected_instance()->undo_action_stack().size() && get_selected_instance()->undo_action_stack().front()!=action)
if(get_selected_instance()->undo()==false)
throw int();
}
else if((bool)row[model.is_redo])
{
while(get_selected_instance()->redo_action_stack().size() && get_selected_instance()->undo_action_stack().front()!=action)
if(get_selected_instance()->redo()==false)
throw int();
}
}
catch(int)
{
return true;
}
}
break;
}
case GDK_BUTTON_RELEASE:
break;
default:
break;
}
return false;
}
开发者ID:blackwarthog,项目名称:synfig,代码行数:54,代码来源:dock_history.cpp
示例13:
void
LiningAdjustmentDialog::init_ui()
{
builder_->get_widget( "combobox-chip", combobox_chip_);
builder_->get_widget( "spinbutton-strip", spinbutton_strip_);
builder_->get_widget( "spinbutton-code", spinbutton_code_);
builder_->get_widget( "spinbutton-broadcast", spinbutton_broadcast_);
builder_->get_widget( "toolbutton-load-from-file", menutoolbutton_load_from_file_);
builder_->get_widget( "menuitem-restore-current", menuitem_restore_current_);
builder_->get_widget( "menuitem-restore-all", menuitem_restore_all_);
builder_->get_widget( "toolbutton-write-current", menutoolbutton_write_current_);
builder_->get_widget( "menuitem-write-all", menuitem_write_all_);
Glib::RefPtr<Glib::Object> obj;
obj = builder_->get_object("liststore-strip-code");
liststore_strip_code_ = Glib::RefPtr<Gtk::ListStore>::cast_dynamic(obj);
// create items
StripCodeVector codes;
for ( int i = 0; i < SCANNER_STRIPS_PER_CHIP_REAL; ++i) {
codes.push_back(StripCode( i + 1, 0));
}
// add rows
for ( StripCodeVector::const_iterator it = codes.begin();
it != codes.end(); ++ it) {
Gtk::TreeRow row = *(liststore_strip_code_->append());
row[model_columns.strip] = it->first;
row[model_columns.code] = it->second;
}
builder_->get_widget( "treeview-strip-code", treeview_strip_code_);
selection_strip_code_ = treeview_strip_code_->get_selection();
selection_strip_code_->set_mode(Gtk::SELECTION_SINGLE);
// add columns
Gtk::TreeViewColumn* column;
Gtk::CellRenderer* renderer;
column = new Gtk::TreeView::Column( _("Strip"), model_columns.strip);
column->set_alignment(Gtk::ALIGN_CENTER);
renderer = column->get_first_cell_renderer();
renderer->property_xalign() = 1.;
treeview_strip_code_->append_column(*Gtk::manage(column));
column = new Gtk::TreeView::Column( _("Code"), model_columns.code);
column->set_alignment(Gtk::ALIGN_CENTER);
renderer = column->get_first_cell_renderer();
renderer->property_xalign() = .5;
treeview_strip_code_->append_column(*Gtk::manage(column));
}
开发者ID:MichaelColonel,项目名称:ScanAmatiTest,代码行数:52,代码来源:lining_adjustment.cpp
示例14: TreeViewColumn
/**
* Append appropriate plugin column - depending on the GConf value
*/
void
PluginTreeView::append_plugin_column()
{
#if GTKMM_MAJOR_VERSION > 2 || ( GTKMM_MAJOR_VERSION == 2 && GTKMM_MINOR_VERSION >= 14 )
bool description_as_tooltip = false;
# ifdef HAVE_GCONFMM
if ( __gconf )
{
# ifdef GLIBMM_EXCEPTIONS_ENABLED
description_as_tooltip = __gconf->get_bool(__gconf_prefix + "/description_as_tooltip");
# else
std::auto_ptr<Glib::Error> error;
description_as_tooltip = __gconf->get_bool(__gconf_prefix + "/description_as_tooltip", error);
# endif
}
# endif
#endif
#if GTKMM_MAJOR_VERSION > 2 || ( GTKMM_MAJOR_VERSION == 2 && GTKMM_MINOR_VERSION >= 14 )
if (description_as_tooltip)
{
#endif
append_column("Plugin", m_plugin_record.name);
#if GTKMM_MAJOR_VERSION > 2 || ( GTKMM_MAJOR_VERSION == 2 && GTKMM_MINOR_VERSION >= 14 )
set_tooltip_column(2);
}
else
{
TwoLinesCellRenderer *twolines_renderer = new TwoLinesCellRenderer();
Gtk::TreeViewColumn *tlcol =
new Gtk::TreeViewColumn("Plugin", *Gtk::manage(twolines_renderer));
append_column(*Gtk::manage(tlcol));
# ifdef GLIBMM_PROPERTIES_ENABLED
tlcol->add_attribute(twolines_renderer->property_line1(), m_plugin_record.name);
tlcol->add_attribute(twolines_renderer->property_line2(), m_plugin_record.description);
# else
tlcol->add_attribute(*twolines_renderer, "line1", m_plugin_record.name);
tlcol->add_attribute(*twolines_renderer, "line2", m_plugin_record.description);
# endif
set_tooltip_column(-1);
}
#endif
set_headers_clickable();
Gtk::TreeViewColumn *plugin_col = get_column(2);
if (plugin_col) plugin_col->signal_clicked().connect(sigc::mem_fun(*this, &PluginTreeView::on_name_clicked));
}
开发者ID:sanyaade-teachings,项目名称:fawkes,代码行数:52,代码来源:plugin_tree_view.cpp
示例15: setFilesView
void AttributesView::setFilesView() {
columns_files.add(col_size_files);
columns_files.add(col_path_files);
list_files = Gtk::ListStore::create(columns_files);
view_files->set_model(list_files);
this->view_files->append_column("Ruta del Archivo", col_path_files);
int cols_count = this->view_files->append_column("Tamaño", col_size_files);
Gtk::TreeViewColumn* pColumn;
for (int i = 0; i < cols_count; i++) {
pColumn = this->view_files->get_column(i);
pColumn->set_resizable(true);
}
}
开发者ID:chuchu132,项目名称:lalalalacode,代码行数:15,代码来源:AttributeView.cpp
示例16: setPeersView
void AttributesView::setPeersView() {
columns_peers.add(col_name_peers);
columns_peers.add(col_port_peers);
columns_peers.add(col_type_peers);
list_peers = Gtk::ListStore::create(columns_peers);
view_peers->set_model(list_peers);
this->view_peers->append_column("Nombre del Peer", col_name_peers);
this->view_peers->append_column("Puerto", col_port_peers);
int cols_count = this->view_peers->append_column("Tipo de Peer",
col_type_peers);
Gtk::TreeViewColumn* pColumn;
for (int i = 0; i < cols_count; i++) {
pColumn = this->view_peers->get_column(i);
pColumn->set_resizable(true);
}
}
开发者ID:chuchu132,项目名称:lalalalacode,代码行数:17,代码来源:AttributeView.cpp
示例17: setupColumns
// TODO REFACTOR THE LIVING HELL OUT OF THIS ABOMINATION -- nyanpasu
void GtkTorrentTreeView::setupColumns()
{
Gtk::TreeViewColumn *col = nullptr;
Gtk::CellRendererProgress *cell = nullptr;
vector<pair<int, int>> columns; //First element id second element size
columns.push_back(make_pair(this->append_column("#", m_cols.m_col_queue), 30));
columns.push_back(make_pair(this->append_column("Status", m_cols.m_col_name), 200));
columns.push_back(make_pair(this->append_column("Name", m_cols.m_col_name), 200));
columns.push_back(make_pair(this->append_column("Size", m_cols.m_col_size), 80));
columns.push_back(make_pair(this->append_column("Down", m_cols.m_col_dl_speed), 60));
columns.push_back(make_pair(this->append_column("Up", m_cols.m_col_ul_speed), 60));
columns.push_back(make_pair(this->append_column("Ratio", m_cols.m_col_dl_ratio), 60));
columns.push_back(make_pair(this->append_column("Downloaded", m_cols.m_col_dl_total), 80));
get_column(columns.back().first - 1)->set_visible(false);
columns.push_back(make_pair(this->append_column("Uploaded", m_cols.m_col_ul_total), 80));
get_column(columns.back().first - 1)->set_visible(false);
columns.push_back(make_pair(this->append_column("Seed", m_cols.m_col_seeders), 60));
columns.push_back(make_pair(this->append_column("Leech", m_cols.m_col_leechers), 60));
columns.push_back(make_pair(this->append_column("Age", m_cols.m_col_age), 50));
columns.push_back(make_pair(this->append_column("ETA", m_cols.m_col_eta), 80));
cell = Gtk::manage(new Gtk::CellRendererProgress());
columns.push_back(make_pair(this->append_column("Progress", *cell), 160));
col = this->get_column(columns.back().first - 1);
col->add_attribute(cell->property_value(), m_cols.m_col_percent);
col->add_attribute(cell->property_text(), m_cols.m_col_percent_text);
columns.push_back(make_pair(this->append_column("Remains", m_cols.m_col_remaining), 80));
get_column(columns.back().first - 1)->set_visible(false);
for (pair<int, int> colpair : columns)
{
Gtk::Button *butt = get_column(colpair.first - 1)->get_button();
butt->signal_button_press_event().connect(sigc::mem_fun(*this, &GtkTorrentTreeView::torrentColumns_onClick));
get_column(colpair.first - 1)->set_sizing(Gtk::TreeViewColumnSizing::TREE_VIEW_COLUMN_FIXED);
get_column(colpair.first - 1)->set_alignment(0.5f);
get_column(colpair.first - 1)->set_clickable();
get_column(colpair.first - 1)->set_resizable();
get_column(colpair.first - 1)->set_reorderable();
get_column(colpair.first - 1)->set_fixed_width(colpair.second);
}
}
开发者ID:infoburp,项目名称:gTorrent,代码行数:46,代码来源:GtkTorrentTreeView.cpp
示例18: setup_model
void setup_model(){
{
//treeview
treemodel = Gtk::ListStore::create(columns);
treeview1->set_model(treemodel);
treeview1->append_column("Filename", columns.Filename);
treeview1->append_column("Url", columns.url);
treeview1->append_column("Size", columns.size);
treeview1->append_column("%", columns.percentage_complete);
treeview1->append_column("Time Left", columns.time_left);
treeview1->append_column("Action", columns.action);
//make all columns resizeable and set width
std::vector<Gtk::TreeViewColumn*> tv_columns = treeview1->get_columns();
std::vector<Gtk::TreeViewColumn*>::iterator iter = tv_columns.begin();
int count = 0;
for (; iter!=tv_columns.end(); iter++, count++){
Gtk::TreeViewColumn* col = *iter;
col->set_resizable(true);
col->set_fixed_width(column_widths[count]);
}
Gtk::TreeModel::Row row = *(treemodel->append());
row[columns.Filename] = "33";
row[columns.url] = "SFDSD";
Gtk::TreeModel::Children children = treemodel->children();
for(Gtk::TreeModel::Children::iterator iter = children.begin(); iter != children.end(); ++iter){
Gtk::TreeModel::Row row = *iter;
row->set_value(0, (Glib::ustring)"asdfaksdhfakshdfklasjdfhklsafdhlaskjdhflksajdhfasdfads");
row->set_value(4, (Glib::ustring)"asdfads");
}
}
{
comboboxmodel = Gtk::ListStore::create(combo_columns);
combobox_size->set_model(comboboxmodel);
Gtk::TreeModel::Row row = *(comboboxmodel->append());
combobox_size->set_id_column(0);
Gtk::CellRendererText *cell = new Gtk::CellRendererText();
combobox_size->pack_start(*cell);
combobox_size->add_attribute(*cell, "text", combo_columns.size);
row[combo_columns.size] = "kB";
(*(comboboxmodel->append()))[combo_columns.size] = "MB";
combobox_size->set_active(0);
}
}
开发者ID:geonyoro,项目名称:GeoVideoDownloader,代码行数:45,代码来源:main.cpp
示例19:
Gtk::Widget& DifficultyEditor::createTreeView()
{
// First, create the treeview
_settingsView = Gtk::manage(new Gtk::TreeView(_settings->getTreeStore()));
_settingsView->set_size_request(TREE_VIEW_MIN_WIDTH, -1);
// Connect the tree view selection
Glib::RefPtr<Gtk::TreeSelection> selection = _settingsView->get_selection();
selection->signal_changed().connect(sigc::mem_fun(*this, &DifficultyEditor::onSettingSelectionChange));
// Add columns to this view
Gtk::CellRendererText* textRenderer = Gtk::manage(new Gtk::CellRendererText);
Gtk::TreeViewColumn* settingCol = Gtk::manage(new Gtk::TreeViewColumn);
settingCol->pack_start(*textRenderer, false);
settingCol->set_title(_("Setting"));
settingCol->set_sizing(Gtk::TREE_VIEW_COLUMN_AUTOSIZE);
settingCol->set_spacing(3);
_settingsView->append_column(*settingCol);
settingCol->add_attribute(textRenderer->property_text(), _settings->getColumns().description);
settingCol->add_attribute(textRenderer->property_foreground(), _settings->getColumns().colour);
settingCol->add_attribute(textRenderer->property_strikethrough(), _settings->getColumns().isOverridden);
Gtk::ScrolledWindow* frame = Gtk::manage(new gtkutil::ScrolledFrame(*_settingsView));
// Create the action buttons
Gtk::HBox* buttonHBox = Gtk::manage(new Gtk::HBox(false, 6));
// Create button
_createSettingButton = Gtk::manage(new Gtk::Button(Gtk::Stock::ADD));
_createSettingButton->signal_clicked().connect(sigc::mem_fun(*this, &DifficultyEditor::onSettingCreate));
// Delete button
_deleteSettingButton = Gtk::manage(new Gtk::Button(Gtk::Stock::DELETE));
_deleteSettingButton->signal_clicked().connect(sigc::mem_fun(*this, &DifficultyEditor::onSettingDelete));
_refreshButton = Gtk::manage(new Gtk::Button(Gtk::Stock::REFRESH));
_refreshButton->signal_clicked().connect(sigc::mem_fun(*this, &DifficultyEditor::onRefresh));
buttonHBox->pack_start(*_createSettingButton, true, true, 0);
buttonHBox->pack_start(*_deleteSettingButton, true, true, 0);
buttonHBox->pack_start(*_refreshButton, true, true, 0);
Gtk::VBox* vbox = Gtk::manage(new Gtk::VBox(false, 6));
vbox->pack_start(*frame, true, true, 0);
vbox->pack_start(*buttonHBox, false, false, 0);
vbox->set_border_width(12);
return *vbox;
}
开发者ID:DerSaidin,项目名称:DarkRadiant,代码行数:54,代码来源:DifficultyEditor.cpp
示例20: setTreeView
void TorrentView::setTreeView(Gtk::TreeView *view_torrents) {
this->view_torrents = view_torrents;
//agrego la lista de torrents al tree view
this->view_torrents->set_model(list_torrents);
Gtk::TreeViewColumn* pColumn;
int cols_count;
//agrego columnas al Tree View
this->view_torrents->append_column(COL_NAME, col_name);
this->view_torrents->append_column(COL_SIZE, col_size);
this->view_torrents->append_column(COL_STATUS, col_status);
//mostrar una progress bar para el porcentaje de progreso
Gtk::CellRendererProgress* cell =
Gtk::manage(new Gtk::CellRendererProgress);
cols_count = this->view_torrents->append_column(COL_PROGRESS, *cell);
pColumn = this->view_torrents->get_column(cols_count - 1);
if (pColumn) {
#ifdef GLIBMM_PROPERTIES_ENABLED
pColumn->add_attribute(cell->property_value(), col_progress);
#else
pColumn->add_attribute(*cell, "value", col_progress);
#endif
}
this->view_torrents->append_column(COL_COMPLETED, col_completed);
this->view_torrents->append_column(COL_REMAINING, col_remaining);
this->view_torrents->append_column(COL_DOWNSPEED, col_downspeed);
this->view_torrents->append_column(COL_UPSPEED, col_upspeed);
cols_count = this->view_torrents->append_column(COL_TIME, col_time);
for (int i = 0; i < cols_count; i++) {
pColumn = this->view_torrents->get_column(i);
pColumn->set_resizable(true); //hago que sean columnas redimensionables
}
this->view_torrents->columns_autosize();
selection = this->view_torrents->get_selection();
selection->signal_changed().connect(sigc::mem_fun(*this,
&TorrentView::on_row_selected));
}
开发者ID:chuchu132,项目名称:lalalalacode,代码行数:44,代码来源:TorrentView.cpp
注:本文中的gtk::TreeViewColumn类示例由纯净天空整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论