ProjectDashboard::ProjectDashboard() { mref_TreeModel = Gtk::ListStore::create(m_Columns); mp_TreeView = Gtk::manage(new Gtk::TreeView(mref_TreeModel)); Gtk::TreeView::Column* pColumn = Gtk::manage(new Gtk::TreeView::Column( "Project Dashboard")); pColumn->pack_start(m_Columns.m_StateIcon, false); pColumn->pack_start(m_Columns.m_Title, false); mp_TreeView->append_column(*pColumn); mp_TreeView->append_column("", m_Columns.m_StateInfo); Gtk::CellRendererText* InfoCell = ((Gtk::CellRendererText*) mp_TreeView->get_column_cell_renderer(1)); InfoCell->property_wrap_mode() = Pango::WRAP_WORD; InfoCell->property_wrap_width() = 200; mp_TreeView->set_visible(true); mp_MainWin = Gtk::manage(new Gtk::ScrolledWindow()); mp_MainWin->set_policy(Gtk::POLICY_AUTOMATIC, Gtk::POLICY_AUTOMATIC); mp_MainWin->add(*mp_TreeView); mp_MainWin->set_visible(true); m_RedIcon = BuilderGraphicsHelper::createPixbufFromFile("red.png"); m_OrangeIcon = BuilderGraphicsHelper::createPixbufFromFile("orange.png"); m_GreenIcon = BuilderGraphicsHelper::createPixbufFromFile("green.png"); }
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(); }
Gtk::TreeView::Column* Chooser::addTextColumn( const Glib::ustring& name, Gtk::TreeModelColumnBase& column ) { Gtk::CellRendererText* renderer = Gtk::manage( new Gtk::CellRendererText ); Gtk::TreeView::Column* col = Gtk::manage( new Gtk::TreeView::Column( name, *renderer ) ); col->add_attribute( renderer->property_text(), column ); /*col->add_attribute( renderer->property_cell_background(), f_columns.background_color ); col->add_attribute( renderer->property_foreground(), f_columns.foreground_color ); col->add_attribute( renderer->property_style(), f_columns.style ); col->add_attribute( renderer->property_sensitive(), f_columns.sensitive );*/ col->set_resizable( true ); col->set_alignment( 0.5 ); col->set_sort_column( column ); append_column( *col ); return col; }
//------------------------------------------------------------------------------ const StringColumn& ColumnsModel::append_combo_column(const int bec_tm_idx ,const std::string &name ,Glib::RefPtr<Gtk::ListStore> list_w ,const Editable editable ,bool popup_only) { Gtk::TreeModelColumn<Glib::ustring> *choosen = new Gtk::TreeModelColumn<Glib::ustring>; _columns.push_back(choosen); add(*choosen); add_bec_index_mapping(bec_tm_idx); Gtk::TreeView::Column *col = Gtk::manage(new Gtk::TreeViewColumn(bec::replace_string(name, "_", "__"))); Gtk::CellRendererCombo *cell = Gtk::manage(new Gtk::CellRendererCombo); col->pack_start(*cell); col->add_attribute(cell->property_text(), *choosen); cell->property_model() = list_w; cell->property_text_column() = 0; cell->property_editable() = editable; cell->property_has_entry() = !popup_only; Gtk::TreeModelColumn<Glib::RefPtr<Gtk::TreeModel> > *model_col = new Gtk::TreeModelColumn<Glib::RefPtr<Gtk::TreeModel> >(); add_bec_index_mapping(bec_tm_idx); add(*model_col); const int nr_of_cols = _treeview->append_column(*col); _columns.push_back(model_col); _treeview->get_column(nr_of_cols-1)->set_resizable(true); if ( editable == EDITABLE ) { Gtk::CellRendererText *cell = (Gtk::CellRendererText*)(_treeview->get_column_cell_renderer(nr_of_cols - 1)); cell->signal_edited().connect(sigc::bind (sigc::mem_fun(*_tmw ,&ListModelWrapper::after_cell_edit<Glib::ustring> ) , sigc::ref(*choosen) ) ); } return *choosen; }
ObjectsTreeView::ObjectsTreeView(std::shared_ptr<CG::World> world) : _world(world) { _refObjectsTreeModel = Gtk::ListStore::create(_objectsModelColumns); set_model(_refObjectsTreeModel); append_column("Name", _objectsModelColumns.colName); append_column("Type", _objectsModelColumns.colType); // _refObjectsTreeModel->set_sort_column(0, Gtk::SORT_ASCENDING); //Make all the columns reorderable for(guint i = 0; i < 2; i++) { Gtk::TreeView::Column* pColumn = get_column(i); pColumn->set_reorderable(); } init_popup_menu(); }
TimeTrackView() { int label_index(append_column_editable(_("Name"),model.label)); Gtk::TreeView::Column* label_column = get_column(label_index-1); { // --- T I M E T R A C K -------------------------------------------- Gtk::TreeView::Column* column = Gtk::manage( new Gtk::TreeView::Column(_("Time Track")) ); // Set up the value-node cell-renderer cellrenderer_time_track=LayerParamTreeStore::add_cell_renderer_value_node(column); cellrenderer_time_track->property_mode()=Gtk::CELL_RENDERER_MODE_ACTIVATABLE; cellrenderer_time_track->signal_waypoint_clicked_cellrenderer().connect(sigc::mem_fun(*this, &TimeTrackView::on_waypoint_clicked_timetrackview)); cellrenderer_time_track->signal_waypoint_changed().connect(sigc::mem_fun(*this, &TimeTrackView::on_waypoint_changed) ); column->add_attribute(cellrenderer_time_track->property_value_desc(), model.value_desc); column->add_attribute(cellrenderer_time_track->property_canvas(), model.canvas); //column->add_attribute(cellrenderer_time_track->property_visible(), model.is_value_node); //column->pack_start(*cellrenderer_time_track); // Finish setting up the column column->set_reorderable(); column->set_resizable(); column->set_min_width(200); append_column(*column); } set_rules_hint(); set_expander_column(*label_column); label_column->set_visible(false); set_headers_visible(false); set_size_request(-1,64); }
TaskList::TaskList(std::shared_ptr<DB::IDatabase>& database): taskAccessor(database->getExtendedTaskAccessor()) { runningIcon = Gdk::Pixbuf::create_from_file(Glib::build_filename(Utils::getImagePath(), "running.svg"), 24, 24, true); blankIcon = Gdk::Pixbuf::create_from_file(Glib::build_filename(Utils::getImagePath(), "blank.svg"), 24, 24, true); treeModel = TreeStore::create(columns); set_model(treeModel); append_column(_("Name"), columns.col_name); append_column("", columns.col_pixbuf); append_column(_("Time"), columns.col_time); Gtk::TreeView::Column* pColumn = get_column(1); pColumn->set_min_width(60); treeModel->set_sort_column(columns.col_name, Gtk::SORT_ASCENDING); // Initial sorting column taskAccessor->attach(this); get_selection()->signal_changed().connect(sigc::mem_fun(*this, &TaskList::on_selection_changed)); populate(); //Popup menu Gtk::Menu::MenuList& menulist = Menu_Popup.items(); menulist.push_back( Gtk::Menu_Helpers::MenuElem(_("Start"), sigc::mem_fun(*this, &TaskList::on_menu_start))); menulist.push_back(Gtk::Menu_Helpers::MenuElem(_("Stop"), sigc::mem_fun(*this, &TaskList::on_menu_stop))); menulist.push_back(Gtk::Menu_Helpers::SeparatorElem()); menulist.push_back( Gtk::Menu_Helpers::MenuElem(_("Add time"), sigc::mem_fun(*this, &TaskList::on_menu_add_time))); menulist.push_back(Gtk::Menu_Helpers::SeparatorElem()); menulist.push_back( Gtk::Menu_Helpers::MenuElem(_("Add task"), sigc::mem_fun(*this, &TaskList::on_menu_add_task))); menulist.push_back( Gtk::Menu_Helpers::MenuElem(_("Edit task"), sigc::mem_fun(*this, &TaskList::on_menu_edit))); menulist.push_back( Gtk::Menu_Helpers::MenuElem(_("Remove task"), sigc::mem_fun(*this, &TaskList::on_menu_remove_task))); }
void playlistWindow::configureTreeview(void) { // create the data model playlistStore = Gtk::ListStore::create(playlistColumns); // set the data model playlistTreeview->set_model(playlistStore); //Add the TreeView's view columns playlistTreeview->append_column("", playlistColumns.playlistidcol); playlistTreeview->append_column("Name", playlistColumns.playlistnamecol); playlistTreeview->append_column("Length", playlistColumns.playlistlengthcol); playlistTreeview->append_column("Format", playlistColumns.playlistformatcol); playlistTreeview->append_column("Date of creation", playlistColumns.playlistdateofcreationcol); playlistTreeview->append_column("Cell background color", playlistColumns.playlistcellbgcolorcol); Gtk::TreeView::Column* pColumn; for(guint i = 1; i < 5; i++) { pColumn = playlistTreeview->get_column(i); Gtk::CellRenderer* cellRenderer = playlistTreeview->get_column_cell_renderer(i); pColumn->add_attribute(cellRenderer->property_cell_background(), playlistColumns.playlistcellbgcolorcol); pColumn->set_reorderable(); switch(i) { case 1 : pColumn->set_sort_column(playlistColumns.playlistnamecol); break; case 2 : pColumn->set_sort_column(playlistColumns.playlistlengthcol); break; case 3 : pColumn->set_sort_column(playlistColumns.playlistformatcol); break; case 4 : pColumn->set_sort_column(playlistColumns.playlistdateofcreationcol); break; } } pColumn = playlistTreeview->get_column(5); pColumn->set_visible(false); //All the items to be reordered with drag-and-drop // Set the visibility state of the headers. playlistTreeview->set_headers_visible(true); // Allow the column title buttons to be clicked playlistTreeview->set_headers_clickable(true); // Resize all columns to their optimal width. playlistTreeview->columns_autosize(); // all element are reordorable playlistTreeview->set_reorderable(); playlistTreeview->set_rules_hint(); // grab the treeview selection playlistTreeviewSelection = playlistTreeview->get_selection(); // connect signal to dectect when tree selection change playlistTreeview->signal_button_press_event().connect(sigc::mem_fun(*this, &playlistWindow::on_playlist_selection_changed),false); initPlaylistStates(); }
QRTestWidget::QRTestWidget(bool show_header) { // TestTree m_TestTreeModel = Gtk::ListStore::create (m_TestTreeModelColumns); m_TestTreeView.set_model (m_TestTreeModel); m_TestTreeView.set_headers_visible(show_header); m_TestTreeView.set_headers_clickable(false); Glib::RefPtr<Gtk::TreeSelection> selection = m_TestTreeView.get_selection (); // selection->set_select_function (sigc::mem_fun (*this, &QRTestWidget::selection_callback)); // Level Combo initialization m_TestTreeLevelComboModel = Gtk::ListStore::create (m_TestTreeModelLevelCombo); (*m_TestTreeLevelComboModel->append())[m_TestTreeModelLevelCombo.m_level_choices] = "Level L"; (*m_TestTreeLevelComboModel->append())[m_TestTreeModelLevelCombo.m_level_choices] = "Level M"; (*m_TestTreeLevelComboModel->append())[m_TestTreeModelLevelCombo.m_level_choices] = "Level Q"; (*m_TestTreeLevelComboModel->append())[m_TestTreeModelLevelCombo.m_level_choices] = "Level H"; // Test id // m_TestTreeView.append_column ("Test ID", m_TestTreeModelColumns.m_test_id); // data size Gtk::TreeView::Column* pDataColumn = Gtk::manage (new Gtk::TreeView::Column ("Data Size")); Gtk::CellRendererSpin* data_size_spin_renderer = Gtk::manage (new Gtk::CellRendererSpin() ); Gtk::Adjustment* data_adj = manage (new Gtk::Adjustment (0.0, 0.0, .0, 1.0, 10.0, 100.0)); data_size_spin_renderer->set_property ("digits", 0); data_size_spin_renderer->set_property ("adjustment", data_adj); data_size_spin_renderer->set_property ("editable", true); data_size_spin_renderer->property_alignment() = Pango::ALIGN_RIGHT; data_size_spin_renderer->property_editable () = true; data_size_spin_renderer->property_width() = 40; data_size_spin_renderer->property_height() = 40; data_size_spin_renderer->signal_edited().connect (sigc::mem_fun (*this, &QRTestWidget::on_data_size_edited)); pDataColumn->pack_start (m_TestTreeModelColumns.m_data_label, false); pDataColumn->pack_start (*data_size_spin_renderer, true); pDataColumn->add_attribute (data_size_spin_renderer->property_text (), m_TestTreeModelColumns.m_data_size); m_TestTreeView.append_column (*pDataColumn); // version Gtk::TreeView::Column* pVersionColumn = Gtk::manage (new Gtk::TreeView::Column ("Version")); Pango::AttrList attr; Gtk::CellRendererText* version_text_renderer = Gtk::manage (new Gtk::CellRendererText() ); version_text_renderer->property_alignment() = Pango::ALIGN_RIGHT; Gtk::CellRendererSpin* version_spin_renderer = Gtk::manage (new Gtk::CellRendererSpin() ); Gtk::Adjustment* ver_adj = manage (new Gtk::Adjustment (0.0, 0.0, 100.0, 1.0, 10.0, 100.0)); version_spin_renderer->set_property ("digits", 0); version_spin_renderer->set_property ("adjustment", ver_adj); version_spin_renderer->set_property ("editable", true); version_spin_renderer->set_property ("width", 40); version_spin_renderer->signal_edited().connect (sigc::mem_fun (*this, &QRTestWidget::on_version_edited)); // pVersionColumn->pack_start (m_TestTreeModelColumns.m_version_label, false); pVersionColumn->pack_start (*version_text_renderer, false); pVersionColumn->add_attribute(version_text_renderer->property_text (), m_TestTreeModelColumns.m_version_label); pVersionColumn->pack_start (*version_spin_renderer, true); pVersionColumn->add_attribute(version_spin_renderer->property_text (), m_TestTreeModelColumns.m_version); m_TestTreeView.append_column (*pVersionColumn); // m_TestTreeView.get_column (m_TestTreeView.append_column ("Data Size", *version_spin_renderer) - 1) // ->add_attribute(version_spin_renderer->property_text (), m_TestTreeModelColumns.m_version); // correction level Gtk::TreeView::Column* pCorrectionColumn = Gtk::manage (new Gtk::TreeView::Column ("Correction Level")); m_ComboRenderer.property_model () = m_TestTreeLevelComboModel; m_ComboRenderer.property_has_entry () = false; m_ComboRenderer.property_text_column () = 0; m_ComboRenderer.property_editable () = true; m_ComboRenderer.property_width () = 80; m_ComboRenderer.signal_edited().connect (sigc::mem_fun (*this, &QRTestWidget::on_correction_edited)); pCorrectionColumn->pack_start (m_TestTreeModelColumns.m_level_label, false); pCorrectionColumn->pack_start (m_ComboRenderer, true); pCorrectionColumn->add_attribute(m_ComboRenderer.property_text (), m_TestTreeModelColumns.m_correction_level); m_TestTreeView.append_column (*pCorrectionColumn); // Use Image Gtk::TreeView::Column* pImageColumn = Gtk::manage (new Gtk::TreeView::Column ("Image Based")); Gtk::CellRendererToggle* image_toggle_renderer = Gtk::manage (new Gtk::CellRendererToggle() ); image_toggle_renderer->property_activatable() = true; image_toggle_renderer->property_sensitive() = true; image_toggle_renderer->property_width() = 70; image_toggle_renderer->signal_toggled().connect (sigc::mem_fun (*this, &QRTestWidget::on_use_image_edited)); pImageColumn->pack_start(*image_toggle_renderer, true); pImageColumn->add_attribute(image_toggle_renderer->property_active() , m_TestTreeModelColumns.m_image_based); pImageColumn->add_attribute(image_toggle_renderer->property_visible() , m_TestTreeModelColumns.m_image_option_visible); m_TestTreeView.append_column (*pImageColumn); // pixel size Gtk::TreeView::Column* pPixelColumn = Gtk::manage (new Gtk::TreeView::Column ("Pixel Size")); Gtk::CellRendererSpin* pixel_size_spin_renderer = Gtk::manage (new Gtk::CellRendererSpin() ); Gtk::Adjustment* pix_adj = manage (new Gtk::Adjustment (0.0, 0.0, 100.0, 1.0, 10.0, 100.0)); pixel_size_spin_renderer->set_property ("digits", 0); pixel_size_spin_renderer->set_property ("adjustment", pix_adj); pixel_size_spin_renderer->set_property ("editable", true); pixel_size_spin_renderer->property_alignment() = Pango::ALIGN_RIGHT; pixel_size_spin_renderer->property_width () = 40; pixel_size_spin_renderer->signal_edited().connect (sigc::mem_fun (*this, &QRTestWidget::on_pixel_size_edited)); pPixelColumn->pack_start (m_TestTreeModelColumns.m_pixel_label, false); pPixelColumn->pack_start (*pixel_size_spin_renderer, true); pPixelColumn->add_attribute(pixel_size_spin_renderer->property_text (), m_TestTreeModelColumns.m_pixel_size); pPixelColumn->add_attribute(pixel_size_spin_renderer->property_editable (), m_TestTreeModelColumns.m_image_based); pPixelColumn->add_attribute(pixel_size_spin_renderer->property_sensitive (), m_TestTreeModelColumns.m_image_based); m_TestTreeView.append_column (*pPixelColumn); // Use Background Gtk::TreeView::Column* pBgColumn = Gtk::manage (new Gtk::TreeView::Column ("Use Background")); Gtk::CellRendererToggle* bg_toggle_renderer = Gtk::manage (new Gtk::CellRendererToggle() ); bg_toggle_renderer->property_width() = 90; bg_toggle_renderer->signal_toggled().connect (sigc::mem_fun (*this, &QRTestWidget::on_use_bkg_edited)); pBgColumn->pack_start(*bg_toggle_renderer, true); pBgColumn->add_attribute(bg_toggle_renderer->property_active() , m_TestTreeModelColumns.m_use_background); pBgColumn->add_attribute(bg_toggle_renderer->property_visible() , m_TestTreeModelColumns.m_use_background_visible); pBgColumn->add_attribute(bg_toggle_renderer->property_activatable() , m_TestTreeModelColumns.m_image_based); pBgColumn->add_attribute(bg_toggle_renderer->property_sensitive() , m_TestTreeModelColumns.m_image_based); m_TestTreeView.append_column (*pBgColumn); // margin Gtk::TreeView::Column* pMarginColumn = Gtk::manage (new Gtk::TreeView::Column ("Margin Size")); Gtk::CellRendererSpin* margin_spin_renderer = Gtk::manage (new Gtk::CellRendererSpin() ); Gtk::Adjustment* mar_adj = manage (new Gtk::Adjustment (0.0, 0.0, 100.0, 1.0, 10.0, 100.0)); margin_spin_renderer->set_property ("digits", 0); margin_spin_renderer->set_property ("adjustment", mar_adj); margin_spin_renderer->set_property ("editable", true); margin_spin_renderer->set_property ("height", 40); margin_spin_renderer->set_property ("width", 40); margin_spin_renderer->signal_edited().connect (sigc::mem_fun (*this, &QRTestWidget::on_margin_edited)); pMarginColumn->pack_start (m_TestTreeModelColumns.m_margin_label, false); pMarginColumn->pack_start (*margin_spin_renderer, true); pMarginColumn->add_attribute(margin_spin_renderer->property_text (), m_TestTreeModelColumns.m_margin); pMarginColumn->add_attribute(margin_spin_renderer->property_editable (), m_TestTreeModelColumns.m_use_background); pMarginColumn->add_attribute(margin_spin_renderer->property_sensitive (), m_TestTreeModelColumns.m_use_background); m_TestTreeView.append_column (*pMarginColumn); // Add Rows AddRows (); this->add (m_TestTreeView); this->show_all_children (); }
ChildrenTree::ChildrenTree() { const ChildrenTreeStore::Model model; { // --- N A M E -------------------------------------------------------- Gtk::TreeView::Column* column = Gtk::manage( new Gtk::TreeView::Column(_("ID")) ); // Set up the icon cell-renderer Gtk::CellRendererPixbuf* icon_cellrenderer = Gtk::manage( new Gtk::CellRendererPixbuf() ); column->pack_start(*icon_cellrenderer,false); column->add_attribute(icon_cellrenderer->property_pixbuf(), model.icon); // Pack the label into the column column->pack_start(model.label,true); // Finish setting up the column column->set_reorderable(); column->set_resizable(); column->set_clickable(); column->set_min_width(150); column->set_sort_column(model.label); tree_view.append_column(*column); } { // --- T Y P E -------------------------------------------------------- int cols_count = tree_view.append_column(_("Type"),model.type); Gtk::TreeViewColumn* column = tree_view.get_column(cols_count-1); if(column) { column->set_reorderable(); column->set_resizable(); column->set_clickable(); column->set_sort_column(model.type); } } { // --- V A L U E ----------------------------------------------------- Gtk::TreeView::Column* column = Gtk::manage( new Gtk::TreeView::Column(_("ValueBase")) ); // Set up the value cell-renderer cellrenderer_value=ChildrenTreeStore::add_cell_renderer_value(column); cellrenderer_value->signal_edited().connect(sigc::mem_fun(*this, &studio::ChildrenTree::on_edited_value)); cellrenderer_value->property_value()=synfig::ValueBase(); column->add_attribute(cellrenderer_value->property_value_desc(), model.value_desc); // Finish setting up the column tree_view.append_column(*column); column->set_sizing(Gtk::TREE_VIEW_COLUMN_AUTOSIZE); column->set_min_width(150); column->set_reorderable(); column->set_resizable(); column->set_clickable(false); } { // --- T I M E T R A C K -------------------------------------------- Gtk::TreeView::Column* column = Gtk::manage( new Gtk::TreeView::Column(_("Time Track")) ); column_time_track=column; // Set up the value-node cell-renderer cellrenderer_time_track=ChildrenTreeStore::add_cell_renderer_value_node(column); cellrenderer_time_track->property_mode()=Gtk::CELL_RENDERER_MODE_ACTIVATABLE; cellrenderer_time_track->signal_waypoint_clicked_cellrenderer().connect(sigc::mem_fun(*this, &studio::ChildrenTree::on_waypoint_clicked_childrentree) ); column->add_attribute(cellrenderer_time_track->property_value_desc(), model.value_desc); column->add_attribute(cellrenderer_time_track->property_canvas(), model.canvas); //column->pack_start(*cellrenderer_time_track); // Finish setting up the column column->set_reorderable(); column->set_resizable(); tree_view.append_column(*column); } // This makes things easier to read. tree_view.set_rules_hint(); // Make us more sensitive to several events tree_view.add_events(Gdk::BUTTON_PRESS_MASK | Gdk::BUTTON_RELEASE_MASK | Gdk::BUTTON1_MOTION_MASK | Gdk::BUTTON2_MOTION_MASK|Gdk::POINTER_MOTION_MASK); tree_view.signal_event().connect(sigc::mem_fun(*this, &studio::ChildrenTree::on_tree_event)); tree_view.signal_query_tooltip().connect(sigc::mem_fun(*this, &studio::ChildrenTree::on_tree_view_query_tooltip)); // Create a scrolled window for that tree Gtk::ScrolledWindow *scroll_children_tree = manage(new class Gtk::ScrolledWindow()); scroll_children_tree->set_flags(Gtk::CAN_FOCUS); scroll_children_tree->set_policy(Gtk::POLICY_AUTOMATIC, Gtk::POLICY_AUTOMATIC); scroll_children_tree->add(tree_view); scroll_children_tree->set_shadow_type(Gtk::SHADOW_ETCHED_IN); scroll_children_tree->show(); attach(*scroll_children_tree, 0, 3, 0, 1, Gtk::EXPAND|Gtk::FILL,Gtk::EXPAND|Gtk::FILL, 0, 0); hbox=manage(new Gtk::HBox()); attach(*hbox, 0, 1, 1, 2, Gtk::FILL|Gtk::SHRINK, Gtk::SHRINK, 0, 0); tree_view.set_enable_search(true); tree_view.set_search_column(model.label); /* // Buttons to raise/lower/duplicate/delete children valuenodes // Commented out because these functions are not implemented // and children sort themselves alphabetically Gtk::Image *icon; //Gtk::IconSize iconsize(Gtk::IconSize::from_name("synfig-small_icon")); Gtk::IconSize iconsize(Gtk::ICON_SIZE_SMALL_TOOLBAR); SMALL_BUTTON(button_raise,"gtk-go-up",_("Raise")); SMALL_BUTTON(button_lower,"gtk-go-down",_("Lower")); SMALL_BUTTON(button_duplicate,"synfig-duplicate",_("Duplicate")); SMALL_BUTTON(button_delete,"gtk-delete",_("Delete")); hbox->pack_start(*button_raise,Gtk::PACK_SHRINK); hbox->pack_start(*button_lower,Gtk::PACK_SHRINK); hbox->pack_start(*button_duplicate,Gtk::PACK_SHRINK); hbox->pack_start(*button_delete,Gtk::PACK_SHRINK); button_raise->signal_clicked().connect(sigc::mem_fun(*this, &studio::ChildrenTree::on_raise_pressed)); button_lower->signal_clicked().connect(sigc::mem_fun(*this, &studio::ChildrenTree::on_lower_pressed)); button_duplicate->signal_clicked().connect(sigc::mem_fun(*this, &studio::ChildrenTree::on_duplicate_pressed)); button_delete->signal_clicked().connect(sigc::mem_fun(*this, &studio::ChildrenTree::on_delete_pressed)); button_raise->set_sensitive(false); button_lower->set_sensitive(false); button_duplicate->set_sensitive(false); button_delete->set_sensitive(false); */ get_selection()->signal_changed().connect(sigc::mem_fun(*this, &studio::ChildrenTree::on_selection_changed)); tree_view.set_reorderable(true); hbox->show(); tree_view.show(); tree_view.set_has_tooltip(); //get_selection()->set_mode(Gtk::SELECTION_MULTIPLE); }
KeyframeTree::KeyframeTree() { const KeyframeTreeStore::Model model; { Gtk::TreeView::Column* column = Gtk::manage( new Gtk::TreeView::Column(_("Time")) ); cell_renderer_time = Gtk::manage( new CellRenderer_Time() ); column->pack_start(*cell_renderer_time,true); column->add_attribute(cell_renderer_time->property_time(), model.time); cell_renderer_time->signal_edited().connect(sigc::mem_fun(*this,&studio::KeyframeTree::on_edited_time)); column->set_reorderable(); column->set_resizable(); column->set_clickable(); column->set_sort_column(model.time); append_column(*column); } { Gtk::TreeView::Column* column = Gtk::manage( new Gtk::TreeView::Column(_("Length")) ); cell_renderer_time_delta = Gtk::manage( new CellRenderer_Time() ); column->pack_start(*cell_renderer_time_delta,true); column->add_attribute(cell_renderer_time_delta->property_time(), model.time_delta); cell_renderer_time_delta->signal_edited().connect(sigc::mem_fun(*this,&studio::KeyframeTree::on_edited_time_delta)); column->set_reorderable(); column->set_resizable(); column->set_clickable(false); // column->set_sort_column(model.time_delta); append_column(*column); } { Gtk::TreeView::Column* column = Gtk::manage( new Gtk::TreeView::Column(_("Jump")) ); Gtk::CellRendererText* cell_renderer_jump=Gtk::manage(new Gtk::CellRendererText()); column->pack_start(*cell_renderer_jump,true); cell_renderer_jump->property_text()=_("(JMP)"); cell_renderer_jump->property_foreground()="#003a7f"; column->set_reorderable(); column->set_resizable(); column->set_clickable(false); column->set_sort_column(COLUMNID_JUMP); // without this, (JMP) needs a double click?! append_column(*column); } { Gtk::TreeView::Column* column = Gtk::manage( new Gtk::TreeView::Column(_("Description")) ); cell_renderer_description=Gtk::manage(new Gtk::CellRendererText()); column->pack_start(*cell_renderer_description,true); column->add_attribute(cell_renderer_description->property_text(), model.description); cell_renderer_description->signal_edited().connect(sigc::mem_fun(*this,&studio::KeyframeTree::on_edited_description)); column->set_reorderable(); column->set_resizable(); column->set_clickable(); column->set_sort_column(model.description); append_column(*column); } set_enable_search(true); set_search_column(model.description); // This makes things easier to read. set_rules_hint(); // Make us more sensitive to several events add_events(Gdk::BUTTON_PRESS_MASK | Gdk::BUTTON_RELEASE_MASK); }
ListView::ListView() : Gtk::TreeView() { // поиграемся с TreeView // создаём модель m_refTreeModel = Gtk::ListStore::create( m_Columns ); set_model( m_refTreeModel ); // Теперь добавляем столбцы для отображения append_column( "Name", m_Columns.m_col_name ); append_column( "Size", m_Columns.m_col_size ); append_column( "User/Group", m_Columns.m_col_users ); append_column( "Permission", m_Columns.m_col_permission ); append_column( "Type", m_Columns.m_col_type ); append_column( "Modified", m_Columns.m_col_modified ); //Set the sort column of the Tree model: m_refTreeModel->set_sort_column(0, Gtk::SORT_ASCENDING); Gtk::TreeView::Column* pColumn; pColumn = get_column(0); if( pColumn ) pColumn->set_sort_column( m_Columns.m_col_name ); pColumn = get_column(1); if( pColumn ) pColumn->set_sort_column( m_Columns.m_col_size ); pColumn = get_column(2); if( pColumn ) pColumn->set_sort_column( m_Columns.m_col_users ); pColumn = get_column(3); if( pColumn ) pColumn->set_sort_column( m_Columns.m_col_permission ); pColumn = get_column(4); if( pColumn ) pColumn->set_sort_column( m_Columns.m_col_type ); pColumn = get_column(5); if( pColumn ) pColumn->set_sort_column( m_Columns.m_col_modified ); //Fill popup menu: Gtk::MenuItem* item = Gtk::manage(new Gtk::MenuItem("_Open", true)); item->signal_activate().connect( sigc::mem_fun(*this, &ListView::on_menu_file_popup_generic) ); m_Menu_Popup.append(*item); item = Gtk::manage(new Gtk::MenuItem("_Open with…", true)); item->signal_activate().connect( sigc::mem_fun(*this, &ListView::on_menu_file_popup_generic) ); m_Menu_Popup.append(*item); item = Gtk::manage(new Gtk::MenuItem("_Properties", true)); item->signal_activate().connect( sigc::mem_fun(*this, &ListView::on_menu_file_popup_generic) ); m_Menu_Popup.append(*item); m_Menu_Popup.accelerate(*this); m_Menu_Popup.show_all(); //Show all menu items when the menu pops up signal_button_press_event() .connect(sigc::mem_fun(*this, &ListView::on_button_press_event), false); Navigator nvg; show_file_list( nvg.get_file_list() ); }
AddUPnPServerDlg::AddUPnPServerDlg(MusicLibrary& library) : Gtk::Dialog(_("Add UPnP server"), true) , m_SelectContainerLabel(_("Select a upnp container containing albums"), Gtk::ALIGN_LEFT) , m_EnterNameLabel(_("Server name: "), Gtk::ALIGN_LEFT) , m_CustomServerName(false) , m_Destroy(false) , m_pLibrary(dynamic_cast<UPnPMusicLibrary*>(&library)) , m_pClient(m_pLibrary ? (&m_pLibrary->getClient()) : new upnp::Client()) , m_DeviceScanner(*m_pClient, upnp::Device::Type::MediaServer) , m_IOwnControlPoint(m_pLibrary == nullptr) , m_ContainerDispatcher(*this) { set_title(_("Add UPnP server")); set_size_request(400, 400); set_resizable(true); set_border_width(5); m_TreeModel = Gtk::TreeStore::create(m_Columns); m_TreeView.set_model(m_TreeModel); Gtk::TreeView::Column* pColumn = Gtk::manage(new Gtk::TreeView::Column("Server")); pColumn->pack_start(m_Columns.icon, false); //false = don't expand. pColumn->pack_start(m_Columns.name); m_TreeView.append_column(*pColumn); m_TreeView.set_headers_visible(false); m_ScrolledWindow.add(m_TreeView); m_ScrolledWindow.set_shadow_type(Gtk::SHADOW_IN); m_ScrolledWindow.set_policy(Gtk::POLICY_AUTOMATIC, Gtk::POLICY_AUTOMATIC); m_NameLayout.set_spacing(5); m_NameLayout.pack_start(m_EnterNameLabel, Gtk::PACK_SHRINK); m_NameLayout.pack_start(m_ServerNameEntry, Gtk::PACK_EXPAND_WIDGET); Gtk::VBox* pVBox = get_vbox(); pVBox->set_spacing(5); pVBox->pack_start(m_SelectContainerLabel, Gtk::PACK_SHRINK); pVBox->pack_start(m_ScrolledWindow, Gtk::PACK_EXPAND_WIDGET); pVBox->pack_start(m_NameLayout, Gtk::PACK_SHRINK); add_button(Gtk::Stock::CANCEL, Gtk::RESPONSE_CANCEL); add_button(Gtk::Stock::ADD, Gtk::RESPONSE_OK); set_response_sensitive (Gtk::RESPONSE_OK, false); m_TreeView.get_selection()->signal_changed().connect(sigc::mem_fun(*this, &AddUPnPServerDlg::onCheckAddSensitivity)); m_ServerNameEntry.signal_changed().connect(sigc::mem_fun(*this, &AddUPnPServerDlg::onCheckAddSensitivity)); m_ServerNameEntry.signal_key_release_event().connect(sigc::mem_fun(*this, &AddUPnPServerDlg::onCustomServerName)); show_all_children(); m_DeviceAddedDispatcher.DispatchedItemEvent.connect(std::bind(&AddUPnPServerDlg::onUPnPDeviceDiscovered, this, _1), this); m_DeviceRemovedDispatcher.DispatchedItemEvent.connect(std::bind(&AddUPnPServerDlg::onUPnPDeviceDissapeared, this, _1), this); m_DeviceScanner.DeviceDiscoveredEvent.connect([this] (std::shared_ptr<upnp::Device> dev) { m_DeviceAddedDispatcher.onItem(dev); }, this); m_DeviceScanner.DeviceDissapearedEvent.connect([this] (std::shared_ptr<upnp::Device> dev) { m_DeviceRemovedDispatcher.onItem(dev); }, this); if (m_IOwnControlPoint) { m_pClient->initialize(); } m_DeviceScanner.start(); m_DeviceScanner.refresh(); }
MainWindow::MainWindow() { set_title("Handle Project"); set_icon_from_file("images/HaPr_high_80x100_ver2.gif"); set_size_request(200, 200); set_default_size(500, 300); set_position(Gtk::WIN_POS_CENTER); signal_hide().connect(sigc::mem_fun(*this, &MainWindow::on_action_file_exit)); Gtk::VBox *const main_box = new Gtk::VBox(false, 0); add(*Gtk::manage(main_box)); create_menu(main_box); std::list<Project> active_projects = get_projects_from_db(); Glib::ustring str_no_proj, str_late_proj, str_history_proj; std::stringstream ss, ss2, ss3; no_active = active_projects.size(); ss << no_active; ss >> str_no_proj; std::list<Project> hist_projects = get_projects_from_db(HISTORY_PROJECT); no_history = hist_projects.size(); ss3 << no_history; ss3 >> str_history_proj; no_late = 0; for(std::list<Project>::iterator it = active_projects.begin(); it != active_projects.end(); it++) { if(it->is_late()) no_late++; } ss2 << no_late; ss2 >> str_late_proj; treeview = new Gtk::TreeView(); Gtk::manage(treeview); scrollview.add(*treeview); scrollview.set_policy(Gtk::POLICY_AUTOMATIC, Gtk::POLICY_AUTOMATIC); treeviewhist = new Gtk::TreeView(); Gtk::manage(treeviewhist); Gtk::ScrolledWindow *scrollhistory = new Gtk::ScrolledWindow(); Gtk::manage(scrollhistory); scrollhistory->add(*treeviewhist); scrollhistory->set_policy(Gtk::POLICY_AUTOMATIC, Gtk::POLICY_AUTOMATIC); tabview = new Gtk::Notebook(); Gtk::manage(tabview); tabview->append_page(scrollview, _("_Active projects"), true); tabview->append_page(*scrollhistory, _("P_roject history"), true); main_box->pack_start(*tabview); //Table for active projects. Gtk::TreeModel::ColumnRecord *col_record = new Gtk::TreeModel::ColumnRecord(); col_id = new Gtk::TreeModelColumn<time_t>(); col_no = new Gtk::TreeModelColumn<std::string>(); col_name = new Gtk::TreeModelColumn<std::string>(); col_desc = new Gtk::TreeModelColumn<std::string>(); col_leader_name = new Gtk::TreeModelColumn<std::string>(); col_leader_surname = new Gtk::TreeModelColumn<std::string>(); col_start_date = new Gtk::TreeModelColumn<std::string>(); col_end_date = new Gtk::TreeModelColumn<std::string>(); col_record->add(*col_id); col_record->add(*col_no); col_record->add(*col_name); col_record->add(*col_desc); col_record->add(*col_leader_name); col_record->add(*col_leader_surname); col_record->add(*col_start_date); col_record->add(*col_end_date); ref_tree_model = Gtk::ListStore::create(*col_record); treeview->set_model(ref_tree_model); int j = 0; Gtk::TreeModel::Row row; for(std::list<Project>::iterator it = active_projects.begin(); it != active_projects.end(); it++) { row = *(ref_tree_model->append()); row[*col_id] = it->get_id(); row[*col_no] = it->get_project_no(); row[*col_name] = it->get_project_name(); row[*col_desc] = it->get_description(); row[*col_leader_name] = it->get_project_leader_name(); row[*col_leader_surname] = it->get_project_leader_surname(); row[*col_start_date] = it->get_start_date_str_eu(); row[*col_end_date] = it->get_end_date_str_eu(); j++; } treeview->append_column(_("Number"), *col_no); treeview->append_column(_("Name"), *col_name); treeview->append_column(_("Description"), *col_desc); treeview->append_column(_("Leader name"), *col_leader_name); treeview->append_column(_("Leader surmane"), *col_leader_surname); treeview->append_column(_("Start date"), *col_start_date); treeview->append_column(_("End date"), *col_end_date); treeview->set_headers_clickable(true); treeview->set_grid_lines(Gtk::TREE_VIEW_GRID_LINES_BOTH); for(int i=0; i < 7; i++) { Gtk::TreeView::Column *pColumn = treeview->get_column(i); pColumn->set_resizable(true); pColumn->set_sort_column(i+1); } //Table for history. Gtk::TreeModel::ColumnRecord *col_record_hist = new Gtk::TreeModel::ColumnRecord(); col_id_hist = new Gtk::TreeModelColumn<time_t>(); col_no_hist = new Gtk::TreeModelColumn<std::string>(); col_desc_hist = new Gtk::TreeModelColumn<std::string>(); col_name_hist = new Gtk::TreeModelColumn<std::string>(); col_leader_name_hist = new Gtk::TreeModelColumn<std::string>(); col_leader_surname_hist = new Gtk::TreeModelColumn<std::string>(); col_start_date_hist = new Gtk::TreeModelColumn<std::string>(); col_end_date_hist = new Gtk::TreeModelColumn<std::string>(); col_record_hist->add(*col_id_hist); col_record_hist->add(*col_no_hist); col_record_hist->add(*col_name_hist); col_record_hist->add(*col_desc_hist); col_record_hist->add(*col_leader_name_hist); col_record_hist->add(*col_leader_surname_hist); col_record_hist->add(*col_start_date_hist); col_record_hist->add(*col_end_date_hist); ref_tree_model_hist = Gtk::ListStore::create(*col_record_hist); treeviewhist->set_model(ref_tree_model_hist); Gtk::TreeModel::Row row_hist; for(std::list<Project>::iterator it = hist_projects.begin(); it != hist_projects.end(); it++) { row_hist = *(ref_tree_model_hist->append()); row_hist[*col_id_hist] = it->get_id(); row_hist[*col_no_hist] = it->get_project_no(); row_hist[*col_name_hist] = it->get_project_name(); row_hist[*col_desc_hist] = it->get_description(); row_hist[*col_leader_name_hist] = it->get_project_leader_name(); row_hist[*col_leader_surname_hist] = it->get_project_leader_surname(); row_hist[*col_start_date_hist] = it->get_start_date_str_eu(); row_hist[*col_end_date_hist] = it->get_end_date_str_eu(); j++; } treeviewhist->append_column(_("Number"), *col_no_hist); treeviewhist->append_column(_("Name"), *col_name_hist); treeviewhist->append_column(_("Description"), *col_desc_hist); treeviewhist->append_column(_("Leader name"), *col_leader_name_hist); treeviewhist->append_column(_("Leader surmane"), *col_leader_surname_hist); treeviewhist->append_column(_("Start date"), *col_start_date_hist); treeviewhist->append_column(_("End date"), *col_end_date_hist); treeviewhist->set_headers_clickable(true); treeviewhist->set_grid_lines(Gtk::TREE_VIEW_GRID_LINES_BOTH); for(int i=0; i < 7; i++) { Gtk::TreeView::Column *pColumn_hist = treeviewhist->get_column(i); pColumn_hist->set_resizable(true); pColumn_hist->set_sort_column(i+1); } Gtk::HBox *const status_box = new Gtk::HBox(false, 0); Gtk::manage(status_box); active_label = new Gtk::Label(_("Number of active projects: ") + str_no_proj); late_label = new Gtk::Label(_("Number of late projects: ") + str_late_proj); history_label = new Gtk::Label(_("Number of projects in history: ") + str_history_proj); Gtk::manage(active_label); Gtk::manage(late_label); Gtk::manage(history_label); status_box->pack_start(*active_label); status_box->pack_start(*late_label); status_box->pack_start(*history_label); main_box->pack_start(*status_box, Gtk::PACK_SHRINK); show_all_children(); }
Gtk::Widget* Dock_History::create_action_tree() { studio::HistoryTreeStore::Model history_tree_model; action_tree=manage(new class Gtk::TreeView()); { Gtk::TreeView::Column* column = Gtk::manage( new Gtk::TreeView::Column("") ); Gtk::CellRendererToggle* toggle_cr = Gtk::manage( new Gtk::CellRendererToggle() ); toggle_cr->signal_toggled().connect(sigc::mem_fun(*this, &studio::Dock_History::on_action_toggle) ); column->pack_start(*toggle_cr); //false = don't expand. column->add_attribute(toggle_cr->property_active(),history_tree_model.is_active); column->set_resizable(); column->set_clickable(); action_tree->append_column(*column); } /*{ Gtk::TreeView::Column* column = Gtk::manage( new Gtk::TreeView::Column(_("Canvas")) ); Gtk::CellRendererText *text_cr=Gtk::manage(new Gtk::CellRendererText()); text_cr->property_foreground()=Glib::ustring("#7f7f7f"); column->pack_start(*text_cr); column->add_attribute(text_cr->property_text(),history_tree_model.canvas_id); column->add_attribute(text_cr->property_foreground_set(),history_tree_model.is_redo); action_tree->append_column(*column); }*/ { Gtk::TreeView::Column* column = Gtk::manage( new Gtk::TreeView::Column(_("Jump")) ); Gtk::CellRendererText* cell_renderer_jump=Gtk::manage(new Gtk::CellRendererText()); column->pack_start(*cell_renderer_jump,true); cell_renderer_jump->property_text()=_("(JMP)"); cell_renderer_jump->property_foreground()="#003a7f"; column->set_resizable(); column->set_clickable(); column->set_sort_column(COLUMNID_JUMP); action_tree->append_column(*column); //column->clicked(); } { Gtk::TreeView::Column* column = Gtk::manage( new Gtk::TreeView::Column(_("Action")) ); Gtk::CellRendererText *text_cr=Gtk::manage(new Gtk::CellRendererText()); text_cr->property_foreground()=Glib::ustring("#7f7f7f"); //column->pack_start(history_tree_model.icon, false); //false = don't expand. column->pack_start(*text_cr); column->add_attribute(text_cr->property_text(),history_tree_model.name); column->add_attribute(text_cr->property_foreground_set(),history_tree_model.is_redo); action_tree->append_column(*column); } action_tree->set_enable_search(true); action_tree->set_search_column(history_tree_model.name); action_tree->set_search_equal_func(sigc::ptr_fun(&studio::HistoryTreeStore::search_func)); action_tree->set_rules_hint(); // action_tree->signal_row_activated().connect(sigc::mem_fun(*this,&Dock_History::on_row_activate)); action_tree->signal_event().connect(sigc::mem_fun(*this,&Dock_History::on_action_event)); // action_tree->add_events(Gdk::BUTTON_PRESS_MASK | Gdk::BUTTON_RELEASE_MASK); // action_tree->add_events(Gdk::BUTTON1_MOTION_MASK); action_tree->show(); Gtk::ScrolledWindow *scrolledwindow = manage(new class Gtk::ScrolledWindow()); scrolledwindow->set_flags(Gtk::CAN_FOCUS); scrolledwindow->set_policy(Gtk::POLICY_AUTOMATIC, Gtk::POLICY_AUTOMATIC); scrolledwindow->add(*action_tree); scrolledwindow->set_shadow_type(Gtk::SHADOW_ETCHED_IN); scrolledwindow->show_all(); /* { Gtk::Widget& widget(*action_tree); Pango::FontDescription font(widget.get_modifier_style()->get_font()); font.set_size(Pango::SCALE*5); widget.get_modifier_style()->set_font(font); widget.modify_font(font); } */ return scrolledwindow; }
ModulePropertyWindow::ModulePropertyWindow(MainWindow* parent, Manager* manager, ApplicationWindow* appWnd) : m_pModule(NULL) { m_pParent = parent; m_pManager = manager; m_pModule = NULL; m_pAppWindow = appWnd; /* 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* itemRenderer = Gtk::manage(new Gtk::CellRendererText()); itemRenderer->property_editable() = false; Gtk::TreeViewColumn* itemCol = Gtk::manage(new Gtk::TreeViewColumn("Property", *itemRenderer)); itemCol->add_attribute(*itemRenderer, "foreground-gdk", m_Columns.m_col_color_item); itemCol->add_attribute(*itemRenderer, "text", m_Columns.m_col_name); itemCol->set_resizable(true); m_TreeView.append_column(*itemCol); Gtk::CellRendererCombo* valueRenderer = Gtk::manage(new Gtk::CellRendererCombo()); Gtk::TreeView::Column* valueCol = Gtk::manage(new Gtk::TreeView::Column("Value")); valueCol->pack_start(*valueRenderer); valueCol->add_attribute(*valueRenderer, "foreground-gdk", m_Columns.m_col_color_value); //valueCol->set_resizable(true); valueCol->add_attribute(*valueRenderer, "editable", m_Columns.m_col_editable); //Make this View column represent the m_col_itemchosen model column: #ifdef GLIBMM_PROPERTIES_ENABLED valueCol->add_attribute(valueRenderer->property_text(), m_Columns.m_col_value); #else pColumn->add_attribute(*valueRenderer, "text", m_Columns.m_col_value); #endif #ifdef GLIBMM_PROPERTIES_ENABLED valueCol->add_attribute(valueRenderer->property_model(), m_Columns.m_col_choices); #else valueCol->add_attribute(*valueRenderer, "model", m_Columns.m_col_choices); #endif #ifdef GLIBMM_PROPERTIES_ENABLED valueRenderer->property_text_column() = 0; #else valueRenderer->set_property("text_column", 0); #endif valueRenderer->signal_edited().connect( sigc::mem_fun(*this, &ModulePropertyWindow::onCellEdited) ); m_TreeView.append_column(*valueCol); m_TreeView.set_grid_lines(Gtk::TREE_VIEW_GRID_LINES_BOTH); m_TreeView.set_rules_hint(true); show_all_children(); }
KeyframeTree::KeyframeTree() { const KeyframeTreeStore::Model model; { // --- O N / O F F ---------------------------------------------------- Gtk::TreeView::Column* column = Gtk::manage( new Gtk::TreeView::Column(_(" ")) ); // Set up the on/off cell-renderer Gtk::CellRendererToggle* cellrenderer = Gtk::manage( new Gtk::CellRendererToggle() ); cellrenderer->signal_toggled().connect(sigc::mem_fun(*this, &studio::KeyframeTree::on_keyframe_toggle)); column->pack_start(*cellrenderer,false); column->add_attribute(cellrenderer->property_active(), model.active); append_column(*column); } { Gtk::TreeView::Column* column = Gtk::manage( new Gtk::TreeView::Column(_("Time")) ); cell_renderer_time = Gtk::manage( new CellRenderer_Time() ); column->pack_start(*cell_renderer_time,true); column->add_attribute(cell_renderer_time->property_time(), model.time); cell_renderer_time->signal_edited().connect(sigc::mem_fun(*this,&studio::KeyframeTree::on_edited_time)); column->set_reorderable(); column->set_resizable(); column->set_clickable(); column->set_sort_column(model.time); append_column(*column); } { Gtk::TreeView::Column* column = Gtk::manage( new Gtk::TreeView::Column(_("Length")) ); cell_renderer_time_delta = Gtk::manage( new CellRenderer_Time() ); column->pack_start(*cell_renderer_time_delta,true); column->add_attribute(cell_renderer_time_delta->property_time(), model.time_delta); cell_renderer_time_delta->signal_edited().connect(sigc::mem_fun(*this,&studio::KeyframeTree::on_edited_time_delta)); column->set_reorderable(); column->set_resizable(); column->set_clickable(false); // column->set_sort_column(model.time_delta); append_column(*column); } { Gtk::TreeView::Column* column = Gtk::manage( new Gtk::TreeView::Column(_("Jump")) ); Gtk::CellRendererText* cell_renderer_jump=Gtk::manage(new Gtk::CellRendererText()); column->pack_start(*cell_renderer_jump,true); cell_renderer_jump->property_text()=_("(JMP)"); cell_renderer_jump->property_foreground()="#003a7f"; column->set_reorderable(); column->set_resizable(); column->set_clickable(false); append_column(*column); } { Gtk::TreeView::Column* column = Gtk::manage( new Gtk::TreeView::Column(_("Description")) ); cell_renderer_description=Gtk::manage(new Gtk::CellRendererText()); column->pack_start(*cell_renderer_description,true); column->add_attribute(cell_renderer_description->property_text(), model.description); cell_renderer_description->signal_edited().connect(sigc::mem_fun(*this,&studio::KeyframeTree::on_edited_description)); column->set_reorderable(); column->set_resizable(); column->set_clickable(); column->set_sort_column(model.description); append_column(*column); } set_enable_search(true); set_search_column(model.description); // This makes things easier to read. set_rules_hint(); // Make us more sensitive to several events add_events(Gdk::BUTTON_PRESS_MASK | Gdk::BUTTON_RELEASE_MASK); // Listen to the changed selection signal to perform kf synchro thrue canvas interface get_selection()->signal_changed().connect(sigc::mem_fun(*this, &studio::KeyframeTree::on_selection_changed)); send_selection = false; }
MetaDataTree::MetaDataTree() : editable_(false) { { Gtk::TreeView::Column* column = Gtk::manage( new Gtk::TreeView::Column(_("Key")) ); cell_renderer_key = Gtk::manage( new Gtk::CellRendererText() ); column->pack_start(*cell_renderer_key,true); column->add_attribute(cell_renderer_key->property_text(), model.key); cell_renderer_key->signal_edited().connect(sigc::mem_fun(*this,&studio::MetaDataTree::on_edited_key)); column->set_reorderable(); column->set_resizable(); column->set_clickable(); column->set_sort_column(model.key); append_column(*column); } { Gtk::TreeView::Column* column = Gtk::manage( new Gtk::TreeView::Column(_("Data")) ); cell_renderer_data = Gtk::manage( new Gtk::CellRendererText() ); column->pack_start(*cell_renderer_data,true); column->add_attribute(cell_renderer_data->property_text(), model.data); cell_renderer_data->signal_edited().connect(sigc::mem_fun(*this,&studio::MetaDataTree::on_edited_data)); column->set_reorderable(); column->set_resizable(); column->set_clickable(false); append_column(*column); } set_rules_hint(); add_events(Gdk::BUTTON_PRESS_MASK | Gdk::BUTTON_RELEASE_MASK); }
TimeTrackView() { //Text attributes must be the same that layer param tree's to have aligned rows Pango::AttrList attr_list; { Pango::AttrInt pango_size(Pango::Attribute::create_attr_size(Pango::SCALE*8)); pango_size.set_start_index(0); pango_size.set_end_index(64); attr_list.change(pango_size); } int label_index(append_column_editable(_("Name"),model.label)); Gtk::TreeView::Column* label_column = get_column(label_index-1); label_column->set_sizing(Gtk::TREE_VIEW_COLUMN_AUTOSIZE); { // --- T I M E T R A C K -------------------------------------------- Gtk::TreeView::Column* column = Gtk::manage( new Gtk::TreeView::Column(_("Time Track")) ); Gtk::TreeView::Column* column2 = Gtk::manage( new Gtk::TreeView::Column("Align") ); // Set up the value-node cell-renderer cellrenderer_time_track=LayerParamTreeStore::add_cell_renderer_value_node(column); cellrenderer_time_track->property_mode()=Gtk::CELL_RENDERER_MODE_ACTIVATABLE; cellrenderer_time_track->signal_waypoint_clicked_cellrenderer().connect(sigc::mem_fun(*this, &TimeTrackView::on_waypoint_clicked_timetrackview)); cellrenderer_time_track->signal_waypoint_changed().connect(sigc::mem_fun(*this, &TimeTrackView::on_waypoint_changed) ); //column->add_attribute(cellrenderer_time_track->property_value_desc(), model.value_desc); //column->add_attribute(cellrenderer_time_track->property_canvas(), model.canvas); //column->add_attribute(cellrenderer_time_track->property_visible(), model.is_value_node); //column->pack_start(*cellrenderer_time_track); // Add a fixed size (same that layer param tree) empty text renderer // to align the rows with params dock when the text is taller than value_type icons height Gtk::CellRendererText* text_cellrenderer = Gtk::manage( new Gtk::CellRendererText() ); text_cellrenderer->property_attributes()=attr_list; column2->pack_end(*text_cellrenderer,false); text_cellrenderer->set_fixed_size (1,-1); // Add a fixed size (1pixel widht, same height than value_type icon) empty (alpha) icon // to align the rows with params dock when the text is smaller than value_type icons height Gtk::CellRendererPixbuf* icon_cellrenderer = Gtk::manage( new Gtk::CellRendererPixbuf() ); Glib::RefPtr<Gdk::Pixbuf> pixbuf; pixbuf=Gtk::Button().render_icon_pixbuf(Gtk::StockID("synfig-utils_timetrack_align"),Gtk::ICON_SIZE_SMALL_TOOLBAR); icon_cellrenderer->property_pixbuf() = pixbuf; column2->pack_end(*icon_cellrenderer,false); icon_cellrenderer->set_fixed_size(1,-1); // Finish setting up the columns column->set_reorderable(); column->set_sizing(Gtk::TREE_VIEW_COLUMN_AUTOSIZE); column->set_resizable(); column->set_expand(true); // Commented during Align rows fixing // http://www.synfig.org/issues/thebuggenie/synfig/issues/161 // column->set_min_width(200); column2->set_resizable(); column2->set_fixed_width(1); append_column(*column); append_column(*column2); } set_rules_hint(); set_expander_column(*label_column); label_column->set_visible(false); set_headers_visible(false); set_size_request(-1,64); }
void SPGradientSelector::onTreeColorColClick() { Gtk::TreeView::Column* column = treeview->get_column(0); column->set_sort_column(columns->color); }
void SPGradientSelector::onTreeCountColClick() { Gtk::TreeView::Column* column = treeview->get_column(2); column->set_sort_column(columns->refcount); }
void SPGradientSelector::onTreeNameColClick() { Gtk::TreeView::Column* column = treeview->get_column(1); column->set_sort_column(columns->name); }