Esempio n. 1
0
         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);
         }
Esempio n. 2
0
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();
}
Esempio n. 3
0
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;
}
ArbitratorPropertyWindow::ArbitratorPropertyWindow(MainWindow* parent, 
                               Manager* manager, ApplicationWindow* appWnd)
{   
    m_pParent = parent;
    m_pManager = manager;
    m_pAppWindow = appWnd;
    m_arbPort.clear();

    /* 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, "background-gdk", m_Columns.m_col_color);
    itemCol->add_attribute(*itemRenderer, "text", m_Columns.m_col_name);
    itemCol->set_resizable(true);
    m_TreeView.append_column(*itemCol);



    Gtk::CellRendererText* valueRenderer = Gtk::manage(new Gtk::CellRendererText());
    valueRenderer->property_editable() = false;
    Gtk::TreeViewColumn* valueCol = Gtk::manage(new Gtk::TreeViewColumn("Value", *valueRenderer));
    valueCol->add_attribute(*valueRenderer, "foreground-gdk", m_Columns.m_col_color_value);
    valueCol->add_attribute(*valueRenderer, "text", m_Columns.m_col_value);
    valueCol->set_resizable(true);
    valueRenderer->property_editable() = true;
    //valueCol->set_cell_data_func(*valueRenderer, sigc::mem_fun(*this,
    //    &ArbitratorPropertyWindow::onCellData) );
    valueRenderer->signal_edited().connect( sigc::mem_fun(*this,
              &ArbitratorPropertyWindow::onCellEdited) );
    m_TreeView.append_column(*valueCol);
    valueCol->add_attribute(*valueRenderer, "editable", m_Columns.m_col_editable);   


    //m_TreeView.append_column_editable("Value", m_Columns.m_col_value);
    //m_TreeView.get_column(1)->set_resizable(true);
       //Tell the view column how to render the model values:
    m_TreeView.set_property("enable_grid_lines", true);
    show_all_children();
    m_TreeView.set_grid_lines(Gtk::TREE_VIEW_GRID_LINES_BOTH);
    m_TreeView.set_rules_hint(true);
}
/**
 * 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));
}
Esempio n. 6
0
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;
}
//------------------------------------------------------------------------------
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;
}
Esempio n. 8
0
/** Constructor.
 * @param cobject pointer to base object type
 * @param builder Gtk builder
 */
ConfigTreeView::ConfigTreeView(BaseObjectType* cobject,
			       const Glib::RefPtr<Gtk::Builder> &builder)
  : Gtk::TreeView(cobject)
{
  m_dlg_edit = NULL;
  builder->get_widget_derived("dlgConfigEdit", m_dlg_edit);

  m_dlg_add = NULL;
  builder->get_widget_derived("dlgConfigAdd", m_dlg_add);

  m_dlg_remove = NULL;
  builder->get_widget_derived("dlgConfigRemove", m_dlg_remove);

  m_config_tree = Gtk::TreeStore::create(m_config_record);
  m_config_tree->set_sort_column(0, Gtk::SORT_ASCENDING);

  set_model(m_config_tree);
  append_column("Path", m_config_record.node);

  Gtk::TreeViewColumn *column = get_column(0);
  Gtk::CellRendererText *cell =
#if GTK_VERSION_GE(3,0)
    (Gtk::CellRendererText *)column->get_first_cell();
#else
    (Gtk::CellRendererText *)column->get_first_cell_renderer();
#endif
#ifdef GLIBMM_PROPERTIES_ENABLED
  column->add_attribute(cell->property_underline(), m_config_record.is_default);
#else
  column->add_attribute(*cell, "underline", m_config_record.is_default);
#endif

  append_column("Value", m_config_record.value_string);

  /*
  Gtk::Menu::MenuList& menulist = m_menu.items();

  menulist.push_back( Gtk::Menu_Helpers::MenuElem("Edit", sigc::mem_fun( *this, &ConfigTreeView::on_menu_edit_selected) ) );
  menulist.push_back( Gtk::Menu_Helpers::MenuElem("Remove", sigc::mem_fun( *this, &ConfigTreeView::on_menu_remove_selected) ) );
  menulist.push_back( Gtk::Menu_Helpers::MenuElem("Add", sigc::mem_fun( *this, &ConfigTreeView::on_menu_add_selected) ) );
  */

  m_config = NULL;
  m_own_config = false;

  signal_button_press_event().connect_notify( sigc::mem_fun(*this, &ConfigTreeView::on_button_press_event_custom) );
}
Esempio n. 9
0
// 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);

	}
}
Esempio n. 10
0
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));

}
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();
}
ContactsTreeWidget::ContactsTreeWidget(BaseObjectType* baseObject, const Glib::RefPtr<Gnome::Glade::Xml>& refGlade) : Gtk::TreeView(baseObject) {
  appInstance->logEvent("ContactsTreeWidget::ContactsTreeWidget()", SEVERITY_DEBUG);
  treeModel = Gtk::TreeStore::create(columns);
  // sort by status codes.
  // STATUS_OFFLINE is 0, so it will always be at bottom of the list
  treeModel->set_sort_column(columns.contactStatus, Gtk::SORT_DESCENDING);
  set_model(treeModel);
  set_search_equal_func(sigc::mem_fun(*this, &ContactsTreeWidget::onSearchEqual));

  // appending columns
  gint colCount;
  Gtk::TreeViewColumn* pColumn;
  Gtk::CellRenderer* renderer;
  Gtk::CellRendererPixbuf *avatarRenderer, *statusRenderer;
  Gtk::CellRendererText *textRenderer;

  statusRenderer = Gtk::manage(new Gtk::CellRendererPixbuf);
  statusRenderer->property_xalign() = 0.0;
  colCount = append_column(_("Status"), *statusRenderer);
  pColumn = get_column(colCount - 1);
  pColumn->add_attribute(statusRenderer->property_pixbuf(), columns.statusImage);

  textRenderer = Gtk::manage(new Gtk::CellRendererText);
  textRenderer->property_xalign() = 0.0;
  colCount = append_column(_("Nickname"), *textRenderer);
  pColumn = get_column(colCount - 1);
  pColumn->set_resizable(true);
  pColumn->add_attribute(textRenderer->property_markup(), columns.contactNickname);

  avatarRenderer = Gtk::manage(new Gtk::CellRendererPixbuf);
  avatarRenderer->property_xalign() = 1.0;
  avatarRenderer->property_xpad() = 10;
  colCount = append_column("", *avatarRenderer);
  pColumn = get_column(colCount - 1);
  pColumn->add_attribute(avatarRenderer->property_pixbuf(), columns.contactAvatar);

  // connecting signal handlers
  signal_row_activated().connect(sigc::mem_fun(*this, &ContactsTreeWidget::contactsTreeOnActivate));
  appInstance->sigServer->signal_user_status().connect(sigc::mem_fun(*this, &ContactsTreeWidget::onStatusChange));
}
void GtkTorrentTreeView::setupColumns()
{
	unsigned int cid = 0;
	Gtk::TreeViewColumn *col = nullptr;

	cid = this->append_column("Name", m_cols.m_col_name);
	col = this->get_column(cid - 1);
	col->set_fixed_width(250);

	cid = this->append_column("Seeders", m_cols.m_col_seeders);
	col = this->get_column(cid - 1);
	col->set_alignment(0.5);
	col->set_fixed_width(90);
	
	cid = this->append_column("Leechers", m_cols.m_col_leechers);
	col = this->get_column(cid - 1);
	col->set_alignment(0.5);
	col->set_fixed_width(90);

	cid = this->append_column("Rate (KB/s)", m_cols.m_col_dl_speed);
	col = this->get_column(cid - 1);
	col->set_alignment(0.5);
	col->set_fixed_width(95);

	Gtk::CellRendererProgress *cell = Gtk::manage(new Gtk::CellRendererProgress());
	cid = this->append_column("Progress", *cell);
	col = this->get_column(cid - 1);

	if (col) {
		col->add_attribute(cell->property_value(), m_cols.m_col_percent);
		col->add_attribute(cell->property_text(), m_cols.m_col_percent_text);
	}

	for (auto &c : this->get_columns()) {
		c->set_sizing(Gtk::TreeViewColumnSizing::TREE_VIEW_COLUMN_FIXED);
		c->set_clickable();
		c->set_resizable();
		c->set_reorderable();
	}
}
Esempio n. 14
0
// TODO REFACTOR THE LIVING HELL OUT OF THIS ABOMINATION -- nyanpasu
void GtkTorrentTreeView::setupColumns()
{
	unsigned int cid = 0;
	Gtk::TreeViewColumn *col = nullptr;
	Gtk::CellRendererProgress *cell = nullptr;

	this->append_column("Queue", m_cols.m_col_queue);
	this->append_column("Age", m_cols.m_col_age);
	this->append_column("ETA", m_cols.m_col_eta);
	this->append_column("Name", m_cols.m_col_name);
	this->append_column("Seed", m_cols.m_col_seeders);
	this->append_column("Leech", m_cols.m_col_leechers);
	this->append_column("Upload Speed", m_cols.m_col_ul_speed);
	this->append_column("Download Speed", m_cols.m_col_dl_speed);
	this->append_column("Uploaded", m_cols.m_col_ul_total);
	this->append_column("Downloaded", m_cols.m_col_dl_total);
	this->append_column("Size", m_cols.m_col_size);
	this->append_column("Remains", m_cols.m_col_remaining);
	this->append_column("Ratio", m_cols.m_col_dl_ratio);

	cell = Gtk::manage(new Gtk::CellRendererProgress());
	cid = this->append_column("Progress", *cell);
	col = this->get_column(cid - 1);
	col->add_attribute(cell->property_value(), m_cols.m_col_percent);
	col->add_attribute(cell->property_text(), m_cols.m_col_percent_text);

	for (auto & c : this->get_columns())
	{
		Gtk::Button *butt = c->get_button();
		butt->signal_button_press_event().connect(sigc::mem_fun(*this, &GtkTorrentTreeView::torrentColumns_onClick));
		c->set_sizing(Gtk::TreeViewColumnSizing::TREE_VIEW_COLUMN_FIXED);
		c->set_alignment(0.5f);
		c->set_clickable();
		c->set_resizable();
		c->set_reorderable();
                c->set_fixed_width(96);
	}
}
Esempio n. 15
0
         void statusRecord::appendToView(Gtk::TreeView* _treeview)
         {
            _treeview->append_column("Filename", filename);
            
            _treeview->append_column("Status",   status);

            // 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);
               }

            _treeview->append_column("Download", dn_rate);
            _treeview->append_column("Upload",   ul_rate);
            _treeview->append_column("Filesize", filesize);
            _treeview->append_column("Peers l/s", peers);
            
            headersSetResizable(*_treeview);
         }
Esempio n. 16
0
ClassEditor::ClassEditor(StimTypes& stimTypes) :
	Gtk::VBox(false, 6),
	_stimTypes(stimTypes),
	_updatesDisabled(false)
{
	set_border_width(6);

	_list = Gtk::manage(new Gtk::TreeView);
	_list->set_size_request(TREE_VIEW_WIDTH, TREE_VIEW_HEIGHT);

	// Connect the signals to the callbacks
	_list->get_selection()->signal_changed().connect(sigc::mem_fun(*this, &ClassEditor::onSRSelectionChange));
	_list->signal_key_press_event().connect(sigc::mem_fun(*this, &ClassEditor::onTreeViewKeyPress), false);
	_list->signal_button_release_event().connect(
		sigc::bind(sigc::mem_fun(*this, &ClassEditor::onTreeViewButtonRelease), _list));

	// Add the columns to the treeview
	// ID number
	Gtk::TreeViewColumn* numCol = Gtk::manage(new Gtk::TreeViewColumn("#"));
	Gtk::CellRendererText* numRenderer = Gtk::manage(new Gtk::CellRendererText);

	numCol->pack_start(*numRenderer, false);
	numCol->add_attribute(numRenderer->property_text(), SREntity::getColumns().index);
	numCol->add_attribute(numRenderer->property_foreground(), SREntity::getColumns().colour);

	_list->append_column(*numCol);

	// The S/R icon
	Gtk::TreeViewColumn* classCol = Gtk::manage(new Gtk::TreeViewColumn(_("S/R")));

	Gtk::CellRendererPixbuf* pixbufRenderer = Gtk::manage(new Gtk::CellRendererPixbuf);

	classCol->pack_start(*pixbufRenderer, false);
	classCol->add_attribute(pixbufRenderer->property_pixbuf(), SREntity::getColumns().srClass);

	_list->append_column(*classCol);

	// The Type
	Gtk::TreeViewColumn* typeCol = Gtk::manage(new Gtk::TreeViewColumn(_("Type")));

	Gtk::CellRendererPixbuf* typeIconRenderer = Gtk::manage(new Gtk::CellRendererPixbuf);

	typeCol->pack_start(*typeIconRenderer, false);
	typeCol->add_attribute(typeIconRenderer->property_pixbuf(), SREntity::getColumns().icon);

	Gtk::CellRendererText* typeTextRenderer = Gtk::manage(new Gtk::CellRendererText);

	typeCol->pack_start(*typeTextRenderer, false);
	typeCol->add_attribute(typeTextRenderer->property_text(), SREntity::getColumns().caption);
	typeCol->add_attribute(typeTextRenderer->property_foreground(), SREntity::getColumns().colour);

	_list->append_column(*typeCol);
}
Esempio n. 17
0
// Create the objects panel (for manipulating the target_addobjectives objects)
void ObjectivesEditor::setupEntitiesPanel()
{
	// Tree view listing the target_addobjectives entities
    Gtk::TreeView* entityList = gladeWidget<Gtk::TreeView>(
        "entitiesTreeView"
    );
    entityList->set_model(_objectiveEntityList);
	entityList->set_headers_visible(false);

	entityList->get_selection()->signal_changed().connect(
		sigc::mem_fun(*this, &ObjectivesEditor::_onEntitySelectionChanged)
    );
	
	// Active-at-start column (checkbox)
	Gtk::CellRendererToggle* startToggle = Gtk::manage(new Gtk::CellRendererToggle);
	startToggle->signal_toggled().connect(
        sigc::mem_fun(*this, &ObjectivesEditor::_onStartActiveCellToggled)
    );
	
	Gtk::TreeViewColumn* startCol = Gtk::manage(new Gtk::TreeViewColumn(_("Start")));
	startCol->add_attribute(startToggle->property_active(), _objEntityColumns.startActive);
	
	entityList->append_column(*startCol);
	
	// Name column
	entityList->append_column(*Gtk::manage(new gtkutil::TextColumn("", _objEntityColumns.displayName)));
	
    // Connect button signals
    Gtk::Button* addButton = gladeWidget<Gtk::Button>("createEntityButton");
	addButton->signal_clicked().connect(
        sigc::mem_fun(*this, &ObjectivesEditor::_onAddEntity)
    );

    Gtk::Button* delButton = gladeWidget<Gtk::Button>("deleteEntityButton");
	delButton->set_sensitive(false); // disabled at start
	delButton->signal_clicked().connect(
        sigc::mem_fun(*this, &ObjectivesEditor::_onDeleteEntity)
    );
}
Esempio n. 18
0
CheatListDialog::CheatListDialog(GtkDialog* _pstDialog, const Glib::RefPtr<Gtk::Builder>& refBuilder)
    : Gtk::Dialog(_pstDialog)
{
    refBuilder->get_widget("CheatOpenButton", m_poCheatOpenButton);
    refBuilder->get_widget("CheatSaveButton", m_poCheatSaveButton);
    refBuilder->get_widget("CheatAddButton", m_poCheatAddButton);
    refBuilder->get_widget("CheatRemoveButton", m_poCheatRemoveButton);
    refBuilder->get_widget("CheatRemoveAllButton", m_poCheatRemoveAllButton);
    refBuilder->get_widget("CheatMarkAllButton", m_poCheatMarkAllButton);
    refBuilder->get_widget("CheatTreeView", m_poCheatTreeView);

    // Tree View model
    m_poCheatListStore = Gtk::ListStore::create(m_oRecordModel);

    m_poCheatTreeView->set_model(m_poCheatListStore);

    Gtk::CellRendererToggle* pRenderer = Gtk::manage(new Gtk::CellRendererToggle());

    int cols_count = m_poCheatTreeView->append_column("", *pRenderer);

    pRenderer->signal_toggled().connect(sigc::mem_fun(*this, &CheatListDialog::vOnCheatToggled));

    Gtk::TreeViewColumn* pColumn = m_poCheatTreeView->get_column(cols_count - 1);

    if (pColumn)
        pColumn->add_attribute(pRenderer->property_active(), m_oRecordModel.bEnabled);

    m_poCheatTreeView->append_column("Description", m_oRecordModel.uDesc);

    m_poCheatOpenButton->signal_clicked().connect(sigc::mem_fun(*this, &CheatListDialog::vOnCheatListOpen));
    m_poCheatSaveButton->signal_clicked().connect(sigc::mem_fun(*this, &CheatListDialog::vOnCheatListSave));
    m_poCheatAddButton->signal_clicked().connect(sigc::mem_fun(*this, &CheatListDialog::vOnCheatAdd));
    m_poCheatRemoveButton->signal_clicked().connect(sigc::mem_fun(*this, &CheatListDialog::vOnCheatRemove));
    m_poCheatRemoveAllButton->signal_clicked().connect(sigc::mem_fun(*this, &CheatListDialog::vOnCheatRemoveAll));
    m_poCheatMarkAllButton->signal_clicked().connect(sigc::mem_fun(*this, &CheatListDialog::vOnCheatMarkAll));

    bMark = false;
}
Esempio n. 19
0
/** greebo: Creates all the widgets
 */
void CustomStimEditor::populatePage()
{
	set_border_width(6);

	// Setup a treemodel filter to display the custom stims only
	_customStimStore = Gtk::TreeModelFilter::create(_stimTypes.getListStore());
	_customStimStore->set_visible_column(_stimTypes.getColumns().isCustom);

	_list = Gtk::manage(new Gtk::TreeView(_customStimStore));
	_list->set_size_request(TREE_VIEW_WIDTH, TREE_VIEW_HEIGHT);

	// Connect the signals to the callbacks
	_list->get_selection()->signal_changed().connect(sigc::mem_fun(*this, &CustomStimEditor::onSelectionChange));
	_list->signal_button_release_event().connect(sigc::mem_fun(*this, &CustomStimEditor::onTreeViewButtonRelease));

	// Add the columns to the treeview
	// ID number
	Gtk::TreeViewColumn* numCol = Gtk::manage(new Gtk::TreeViewColumn(_("ID")));

	Gtk::CellRendererText* numRenderer = Gtk::manage(new Gtk::CellRendererText);
	numCol->pack_start(*numRenderer, false);
	numCol->add_attribute(numRenderer->property_text(), _stimTypes.getColumns().id);

	_list->append_column(*numCol);

	// The Type
	Gtk::TreeViewColumn* typeCol = Gtk::manage(new Gtk::TreeViewColumn(_("Type")));

	Gtk::CellRendererPixbuf* typeIconRenderer = Gtk::manage(new Gtk::CellRendererPixbuf);
	typeCol->pack_start(*typeIconRenderer, false);

	Gtk::CellRendererText* typeTextRenderer = Gtk::manage(new Gtk::CellRendererText);
	typeCol->pack_start(*typeTextRenderer, false);

	typeCol->add_attribute(typeTextRenderer->property_text(), _stimTypes.getColumns().caption);
	typeCol->add_attribute(typeIconRenderer->property_pixbuf(), _stimTypes.getColumns().icon);

	_list->append_column(*typeCol);

	Gtk::VBox* listVBox = Gtk::manage(new Gtk::VBox(false, 6));
	listVBox->pack_start(*Gtk::manage(new gtkutil::ScrolledFrame(*_list)), true, true, 0);
	listVBox->pack_start(createListButtons(), false, false, 0);

	pack_start(*listVBox, false, false, 0);

	_propertyWidgets.vbox = Gtk::manage(new Gtk::VBox(false, 6));

	pack_start(*_propertyWidgets.vbox, true, true, 0);

	// The name widgets
	Gtk::HBox* nameHBox = Gtk::manage(new Gtk::HBox(false, 6));
	_propertyWidgets.nameLabel = Gtk::manage(new Gtk::Label(_("Name:")));
	_propertyWidgets.nameEntry = Gtk::manage(new Gtk::Entry);

	nameHBox->pack_start(*_propertyWidgets.nameLabel, false, false, 0);
	nameHBox->pack_start(*_propertyWidgets.nameEntry, true, true, 0);

	// Connect the entry field
	_propertyWidgets.nameEntry->signal_changed().connect(sigc::mem_fun(*this, &CustomStimEditor::onEntryChanged));

	_propertyWidgets.vbox->pack_start(*nameHBox, false, false, 0);

	Gtk::Label* infoText = Gtk::manage(new gtkutil::LeftAlignedLabel(
		_("<b>Note:</b> Please beware that deleting custom stims may\n"
		"affect other entities as well. So check before you delete.")
	));
	_propertyWidgets.vbox->pack_start(*infoText, false, false, 0);
}
Esempio n. 20
0
LayerWindow::LayerWindow(MainWindow & mw) : OptionBox("Layers"),
                                            m_currentModel(0)
{
    // destroy.connect(slot(this, &LayerWindow::destroy_handler));
    // Gtk::VBox * vbox = manage( new Gtk::VBox(false, 2) );
    Gtk::VBox * vbox = this;

    Gtk::HBox * tophbox = manage( new Gtk::HBox() );

    tophbox->pack_start(*(manage( new Gtk::Label("Model:") )), Gtk::PACK_SHRINK, 2);
    m_modelMenu = manage( new Gtk::OptionMenu() );

    tophbox->pack_start(*m_modelMenu, Gtk::PACK_EXPAND_WIDGET, 2);
    tophbox->pack_start(*(manage( new Gtk::Label("WOOT") ) ), Gtk::PACK_SHRINK, 2);
   
    vbox->pack_start(*tophbox, Gtk::PACK_SHRINK, 2);
    
    m_columns = new Gtk::TreeModelColumnRecord();
    m_visColumn = new Gtk::TreeModelColumn<bool>();
    m_typeColumn = new Gtk::TreeModelColumn<Glib::ustring>();
    m_nameColumn = new Gtk::TreeModelColumn<Glib::ustring>();
    m_ptrColumn = new Gtk::TreeModelColumn<Layer*>();
    m_columns->add(*m_visColumn);
    m_columns->add(*m_typeColumn);
    m_columns->add(*m_nameColumn);
    m_columns->add(*m_ptrColumn);

    m_treeModel = Gtk::ListStore::create(*m_columns);

    m_treeView = manage( new Gtk::TreeView() );

    m_treeView->set_model( m_treeModel );

    Gtk::CellRendererToggle * crt = manage( new Gtk::CellRendererToggle() );
    crt->signal_toggled().connect( sigc::mem_fun(*this, &LayerWindow::visibleToggled) );
    int column_no = m_treeView->append_column("Visible", *crt);
    Gtk::TreeViewColumn * column = m_treeView->get_column(column_no - 1);
    column->add_attribute(crt->property_active(), *m_visColumn);
    column->set_clickable();

    m_treeView->append_column("Type", *m_typeColumn);
    m_treeView->append_column("Name", *m_nameColumn);

    m_refTreeSelection = m_treeView->get_selection();
    m_refTreeSelection->set_mode(Gtk::SELECTION_SINGLE);
    m_refTreeSelection->signal_changed().connect( sigc::mem_fun(*this, &LayerWindow::selectionChanged) );

    vbox->pack_start(*manage(new Gtk::HSeparator()), Gtk::PACK_SHRINK);

    Gtk::ScrolledWindow *scrolled_window = manage(new Gtk::ScrolledWindow());
    scrolled_window->set_policy(Gtk::POLICY_AUTOMATIC, Gtk::POLICY_ALWAYS);
    scrolled_window->set_size_request(250,150);
    scrolled_window->add(*m_treeView);

    vbox->pack_start(*scrolled_window);

    Gtk::HBox * bothbox = manage( new Gtk::HBox() );
    Gtk::Button * b = manage( new Gtk::Button() );


    Glib::RefPtr<Gdk::Bitmap> pixmask;
    Glib::RefPtr<Gdk::Pixmap> p = Gdk::Pixmap::create_from_xpm(get_colormap(), pixmask, newlayer_xpm);
    b->add_pixmap(p, pixmask);

    b->signal_clicked().connect(sigc::mem_fun(*this, &LayerWindow::newLayerRequested));
    bothbox->pack_start(*b, Gtk::PACK_EXPAND_PADDING, 6);

    b = manage( new Gtk::Button() );
    p = Gdk::Pixmap::create_from_xpm(get_colormap(), pixmask, raise_xpm);
    b->add_pixmap(p, pixmask);
    b->signal_clicked().connect(sigc::mem_fun(*this, &LayerWindow::raiseLayer));
    bothbox->pack_start(*b, Gtk::PACK_EXPAND_PADDING, 6);

    b = manage( new Gtk::Button() );
    p = Gdk::Pixmap::create_from_xpm(get_colormap(), pixmask, lower_xpm);
    b->add_pixmap(p, pixmask);
    b->signal_clicked().connect(sigc::mem_fun(*this, &LayerWindow::lowerLayer));
    bothbox->pack_start(*b, Gtk::PACK_EXPAND_PADDING, 6);

    b = manage( new Gtk::Button() );
    p = Gdk::Pixmap::create_from_xpm(get_colormap(), pixmask, duplicate_xpm);
    b->add_pixmap(p, pixmask);
    bothbox->pack_start(*b, Gtk::PACK_EXPAND_PADDING, 6);

    b = manage( new Gtk::Button() );
    p = Gdk::Pixmap::create_from_xpm(get_colormap(), pixmask, delete_xpm);
    b->add_pixmap(p, pixmask);
    bothbox->pack_start(*b, Gtk::PACK_EXPAND_PADDING, 6);

    vbox->pack_start(*bothbox, Gtk::PACK_SHRINK, 6);

    // add(*vbox);
    // set_title("Layers");
    set_sensitive(false);

    // FIXME Organise the xpms
    //m_eye = gdk_pixmap_create_from_xpm_d(m_clist->gtkobj()->clist_window,
            //&m_eyemask, &GTK_WIDGET(m_clist->gtkobj())->style->white, eye_xpm);

    //m_null = gdk_pixmap_create_from_xpm_d(m_clist->gtkobj()->clist_window,
           //&m_nullmask, &GTK_WIDGET(m_clist->gtkobj())->style->white, null_xpm);

    m_newLayerWindow = new NewLayerWindow();
    // show_all();

    mw.modelAdded.connect(sigc::mem_fun(*this, &LayerWindow::modelAdded));
    mw.currentModelChanged.connect(sigc::mem_fun(*this, &LayerWindow::currentModelChanged));

    signal_delete_event().connect(sigc::mem_fun(*this, &LayerWindow::deleteEvent));
}
Esempio n. 21
0
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();
}
Esempio n. 22
0
void WelcomeWindow::LaunchMatchLobbyPane(
		const std::vector<PlayerDescription> &playerDescriptions)
{
	m_welcome_box->set_visible(false);
	m_lobby_box->set_visible(false);
	m_match_lobby_box->set_visible(true);

	//Clear out anything in the Player ListView
	m_player_list_view->remove_all_columns();
	m_player_list_view->unset_model();

	m_playerColumns = new PlayerListColumns();
	m_playerListStore = ListStore::create(*m_playerColumns);
	m_player_list_view->set_model(m_playerListStore);

	m_teamNumberListStore = PopulateTeamNumberCombo();

	//Add a new row for each player
	for(uint i = 0; i < playerDescriptions.size(); i++)
	{
		TreeModel::Row row = *(m_playerListStore->append());

		row[m_playerColumns->m_name] = string(playerDescriptions[i].m_name);
		row[m_playerColumns->m_ID] = playerDescriptions[i].m_ID;
		row[m_playerColumns->m_teamChosen] = m_teamNumberListStore;
		row[m_playerColumns->m_teamName] = Team::TeamNumberToString(playerDescriptions[i].m_team);
		if( playerDescriptions[i].m_ID == m_currentMatch.m_leaderID)
		{
			row[m_playerColumns->m_isLeader] = true;
		}
		else
		{
			row[m_playerColumns->m_isLeader] = false;
		}
		if(m_playerDescription.m_ID == m_currentMatch.m_leaderID)
		{
			row[m_playerColumns->m_leaderSelectable] = true;
			swap_leader_widgets(true);
		}
		else
		{
			row[m_playerColumns->m_leaderSelectable] = false;
			swap_leader_widgets(false);
		}
	}

	CellRendererToggle *toggleRender = Gtk::manage( new Gtk::CellRendererToggle() );
	int cols_count = m_player_list_view->append_column("Leader", *toggleRender);
	Gtk::TreeViewColumn* toggleRenderColumn = m_player_list_view->get_column(cols_count-1);
	if(toggleRenderColumn)
	{
		toggleRenderColumn->add_attribute(
				toggleRender->property_active(), m_playerColumns->m_isLeader);
		toggleRenderColumn->add_attribute(
				toggleRender->property_activatable(), m_playerColumns->m_leaderSelectable);
	}
	toggleRender->signal_toggled().connect(sigc::mem_fun(*this,
		        &WelcomeWindow::on_leader_toggled));

	m_player_list_view->append_column("Name", m_playerColumns->m_name);

	TreeView::Column* pColumn = manage( new Gtk::TreeView::Column("Team") );
	CellRendererCombo* pRenderer = manage(	new CellRendererCombo());
	pColumn->pack_start(*pRenderer);
	m_player_list_view->append_column(*pColumn);

	pRenderer->property_model() = m_teamNumberListStore;
	pColumn->add_attribute(pRenderer->property_text(), m_playerColumns->m_teamName);
	pColumn->add_attribute(pRenderer->property_model(), m_playerColumns->m_teamChosen);

	pRenderer->property_text_column() = 0;
	pRenderer->property_editable() = true;
	pRenderer->property_has_entry() = false;

	pRenderer->signal_changed().connect(
			sigc::mem_fun(*this, &WelcomeWindow::on_teamNumber_combo_changed));

	m_player_list_view->set_rules_hint(true);
	m_player_list_view->show_all();
}
Esempio n. 23
0
MessagesList::MessagesList(Gtk::Window* pParent) : bTimeStamp(false)
{
    m_pParent = pParent;

    /* Create a new scrolled window, with scrollbars only if needed */
    set_policy(Gtk::POLICY_AUTOMATIC, Gtk::POLICY_AUTOMATIC);
    add(m_TreeView);

    /* create list store */
    m_refListStore = Gtk::ListStore::create(m_Columns);
    m_TreeView.set_model(m_refListStore);

    //Add the Model’s column to the View’s columns:
    Gtk::CellRendererText* textRenderer = Gtk::manage(new Gtk::CellRendererText());
    Gtk::TreeViewColumn* col = Gtk::manage(new Gtk::TreeViewColumn("Messages")); 
    textRenderer->property_editable() = false;
    col->pack_start(*textRenderer, true);
    col->add_attribute(*textRenderer, "text", 0);
    col->add_attribute(*textRenderer, "background-gdk", 1);
    m_TreeView.append_column(*col);
    m_TreeView.set_headers_visible(false);


    // adding popup menubar
    m_refActionGroup = Gtk::ActionGroup::create();
    m_refActionGroup->add( Gtk::Action::create("PMenuClear", Gtk::Stock::CLEAR, "_Clear log", "Clear log"),
                            sigc::mem_fun(*this, &MessagesList::onPMenuClear) );
    m_refActionGroup->add( Gtk::Action::create("PMenueSave", Gtk::Stock::SAVE, "_Save log...", "Save log..."),
                            sigc::mem_fun(*this, &MessagesList::onPMenuSave) );

    m_refUIManager = Gtk::UIManager::create();
    m_refUIManager->insert_action_group(m_refActionGroup);
    if(m_pParent)
        m_pParent->add_accel_group(m_refUIManager->get_accel_group());
    Glib::ustring ui_info =
        "<ui>"
        " <popup name='PopupMenu'>"
        "      <menuitem action='PMenuClear'/>"
        "      <menuitem action='PMenueSave'/>"
        " </popup>"
        "</ui>";


#ifdef GLIBMM_EXCEPTIONS_ENABLED
    try
    {
        m_refUIManager->add_ui_from_string(ui_info);
    }
    catch(const Glib::Error& ex)
    {
        std::cerr << "building popup menus failed: " << ex.what();
    }
#else
    std::auto_ptr<Glib::Error> ex;
    m_refUIManager->add_ui_from_string(ui_info, ex);
    if(ex.get())
    {
        std::cerr << "building popu menus failed: " << ex->what();
    }   
#endif //GLIBMM_EXCEPTIONS_ENABLED


    m_TreeView.signal_button_press_event().connect_notify(sigc::mem_fun(*this,
            &MessagesList::onTreeButtonPressed) );

    show_all_children();
}
LivePathEffectEditor::LivePathEffectEditor()
    : UI::Widget::Panel("", "/dialogs/livepatheffect", SP_VERB_DIALOG_LIVE_PATH_EFFECT),
      lpe_list_locked(false),
      combo_effecttype(Inkscape::LivePathEffect::LPETypeConverter),
      effectwidget(NULL),
      explain_label("", Gtk::ALIGN_CENTER),
      // TRANSLATORS: this dialog is accessible via menu Path - Path Effect Editor...
      effectapplication_frame(_("Apply new effect")),
      effectcontrol_frame(_("Current effect")),
      effectlist_frame(_("Effect list")),
      button_up(Gtk::Stock::GO_UP),
      button_down(Gtk::Stock::GO_DOWN),
      button_apply(Gtk::Stock::ADD),
      button_remove(Gtk::Stock::REMOVE),
      current_desktop(NULL),
      current_lpeitem(NULL)
{
    Gtk::Box *contents = _getContents();
    contents->set_spacing(4);

    //Add the TreeView, inside a ScrolledWindow, with the button underneath:
    scrolled_window.add(effectlist_view);
    //Only show the scrollbars when they are necessary:
    scrolled_window.set_policy(Gtk::POLICY_AUTOMATIC, Gtk::POLICY_AUTOMATIC);
    scrolled_window.set_size_request(0, 50);

    effectapplication_hbox.set_spacing(4);
    effectcontrol_vbox.set_spacing(4);
    effectlist_vbox.set_spacing(4);

    effectapplication_hbox.pack_start(combo_effecttype, true, true);
    effectapplication_hbox.pack_start(button_apply, true, true);
    effectapplication_frame.add(effectapplication_hbox);

    effectlist_vbox.pack_start(scrolled_window, Gtk::PACK_EXPAND_WIDGET);
    effectlist_vbox.pack_end(toolbar, Gtk::PACK_SHRINK);
   // effectlist_vbox.pack_end(button_hbox, Gtk::PACK_SHRINK);
    effectlist_frame.add(effectlist_vbox);

    effectcontrol_vbox.pack_start(explain_label, true, true);
    effectcontrol_frame.add(effectcontrol_vbox);

 //   button_hbox.pack_start(button_up, true, true);
 //   button_hbox.pack_start(button_down, true, true);
 //   button_hbox.pack_end(button_remove, true, true);
    toolbar.set_toolbar_style(Gtk::TOOLBAR_ICONS);
 // Add toolbar items to toolbar
    toolbar.append(button_up);
    toolbar.append(button_down);
    toolbar.append(button_remove);


    // Add toolbar
    //add_toolbar(toolbar);
    toolbar.show_all(); //Show the toolbar and all its child widgets.


    //Create the Tree model:
    effectlist_store = Gtk::ListStore::create(columns);
    effectlist_view.set_model(effectlist_store);

    effectlist_view.set_headers_visible(false);

    // Handle tree selections
    effectlist_selection = effectlist_view.get_selection();
    effectlist_selection->signal_changed().connect( sigc::mem_fun(*this, &LivePathEffectEditor::on_effect_selection_changed) );

    //Add the visibility icon column:
    Inkscape::UI::Widget::ImageToggler *eyeRenderer = manage( new Inkscape::UI::Widget::ImageToggler(
        INKSCAPE_ICON_OBJECT_VISIBLE, INKSCAPE_ICON_OBJECT_HIDDEN) );
    int visibleColNum = effectlist_view.append_column("is_visible", *eyeRenderer) - 1;
    eyeRenderer->signal_toggled().connect( sigc::mem_fun(*this, &LivePathEffectEditor::on_visibility_toggled) );
    eyeRenderer->property_activatable() = true;
    Gtk::TreeViewColumn* col = effectlist_view.get_column(visibleColNum);
    if ( col ) {
        col->add_attribute( eyeRenderer->property_active(), columns.col_visible );
    }

    //Add the effect name column:
    effectlist_view.append_column("Effect", columns.col_name);

    contents->pack_start(effectapplication_frame, false, false);
    contents->pack_start(effectlist_frame, true, true);
    contents->pack_start(effectcontrol_frame, false, false);

    // connect callback functions to buttons
    button_apply.signal_clicked().connect(sigc::mem_fun(*this, &LivePathEffectEditor::onApply));
    button_remove.signal_clicked().connect(sigc::mem_fun(*this, &LivePathEffectEditor::onRemove));

    button_up.signal_clicked().connect(sigc::mem_fun(*this, &LivePathEffectEditor::onUp));
    button_down.signal_clicked().connect(sigc::mem_fun(*this, &LivePathEffectEditor::onDown));

    show_all_children();

    //button_remove.hide();
}
Esempio n. 25
0
// Cringe.
void GtkTorrentSideBar::setupColumns()
{
	int cid = 0;
	Gtk::TreeViewColumn     *col = nullptr;
	Gtk::CellRendererText   *cell = Gtk::manage(new Gtk::CellRendererText());
	Gtk::CellRendererPixbuf *cellp = Gtk::manage(new Gtk::CellRendererPixbuf());

	cell->set_alignment(0, 0.5);
	cell->signal_edited().connect([this](const std::string& path,const std::string& name){ addedItem(path, name); });

	cid = append_column(*Gtk::manage(new Gtk::TreeViewColumn("Name")));	
	col = get_column(cid - 1);
	col->pack_start(*cellp);
	col->pack_start(*cell);
	col->add_attribute(cell->property_markup(), m_cols.name);
	col->add_attribute(cell->property_editable(), m_cols.editable);
	col->add_attribute(cellp->property_pixbuf(), m_cols.icon);

        // This really isn't "setupColumns" anymore from this point.
        // TODO Move to own function
	m_torrent_row = *(m_liststore->append());
	m_torrent_row[m_cols.name] = "Torrents";
	m_torrent_row[m_cols.editable] = false;
	m_torrent_row[m_cols.clickCallback] = [](){}; // clicks on titles don't do shit

	auto torrent_icon = Gdk::Pixbuf::create_from_resource("/org/gtk/gtorrent/icon-torrent.png");
	auto torrent_icon_scaled =  torrent_icon->scale_simple(16, 16, Gdk::INTERP_BILINEAR);
	m_torrent_row[m_cols.icon] = torrent_icon_scaled;

        // XXX TMP WILL REMOVE AND REPLACE WITH PROPER FUNCTION
        // Yes this is horrible. Bear with it for now.
        auto g = Application::getSingleton()->getCore()->getAllTorrents();
	Gtk::TreeModel::Row row = *(m_liststore->append(m_torrent_row.children()));
	row[m_cols.name] = "All";
	row[m_cols.title] = "All";
	row[m_cols.group] = g;
	row[m_cols.group_vector] = &g->m_torrents_all;

	Gtk::TreeModel::Row row2 = *(m_liststore->append(row.children()));
	row2[m_cols.name] = "Downloading";
	row2[m_cols.title] = "Downloading";
	row2[m_cols.group_vector] = &g->m_torrents_downloading;
        row2 = *(m_liststore->append(row.children()));
        row2[m_cols.name] = "Seeding";
        row2[m_cols.title] = "Seeding";
        row2[m_cols.group_vector] = &g->m_torrents_seeding;
        row2 = *(m_liststore->append(row.children()));
        row2[m_cols.name] = "Checking";
        row2[m_cols.title] = "Checking";
        row2[m_cols.group_vector] = &g->m_torrents_checking;
        row2 = *(m_liststore->append(row.children()));
        row2[m_cols.name] = "Finished";
        row2[m_cols.title] = "Finished";
        row2[m_cols.group_vector] = &g->m_torrents_finished;
        row2 = *(m_liststore->append(row.children()));
        row2[m_cols.name] = "Stopped";
        row2[m_cols.title] = "Stopped";
        row2[m_cols.group_vector] = &g->m_torrents_stopped;
        row2 = *(m_liststore->append(row.children()));
        row2[m_cols.name] = "Paused";
        row2[m_cols.title] = "Paused";
        row2[m_cols.group_vector] = &g->m_torrents_paused;

        // End of new horrible code
        // Continue horrible code from before
	//row = *(m_liststore->append(m_torrent_row.children()));
	//row[m_cols.name] = "Add a label";
	//row[m_cols.editable] = true;
	//row[m_cols.icon] = Gtk::IconTheme::get_default()->lookup_icon("list-add-symbolic", 16, Gtk::ICON_LOOKUP_USE_BUILTIN).load_icon();
	//row[m_cols.clickCallback] = [row](){};

	m_rssfeed_row = *(m_liststore->append());
	m_rssfeed_row[m_cols.name] = "RSS Feeds";
	m_rssfeed_row[m_cols.editable] = false;
	m_rssfeed_row[m_cols.clickCallback] = [](){};

	auto rss_icon = Gdk::Pixbuf::create_from_resource("/org/gtk/gtorrent/icon-rss.png");
	auto rss_icon_scaled =  rss_icon->scale_simple(16, 16, Gdk::INTERP_BILINEAR);
	m_rssfeed_row[m_cols.icon] = rss_icon_scaled;

	for(auto fg : Application::getSingleton()->getCore()->m_feeds)
	{
		row = *(m_liststore->append(m_rssfeed_row.children()));
		row[m_cols.name] = fg->name;
		row[m_cols.editable] = false;
		// TODO change icon to some sort of generic RSS icon
		row[m_cols.clickCallback] = [this, fg](){m_rss->run(fg->name);m_rss->hide();};

	}
	
	row = *(m_liststore->append(m_rssfeed_row.children()));
	row[m_cols.name] = "Add an RSS group";
	row[m_cols.editable] = true;

	row[m_cols.icon] = Gtk::IconTheme::get_default()->lookup_icon("list-add-symbolic", 16, Gtk::ICON_LOOKUP_USE_BUILTIN).load_icon();
	row[m_cols.clickCallback] = [row](){};

	//Maybe migrate settings there
/*	row = *(m_liststore->append());
	row[m_cols.name] = "Settings";
	row[m_cols.title] = true;
	row[m_cols.clickCallback] = [](){}; // clicks on titles don't do shit*/
}
Esempio n. 26
0
int AutomataGui::init(){
	//CREATE REFBUILDER
	this->refBuilder = Gtk::Builder::create();
	const std::string gladepath = resourcelocator::findGladeFile("automatagui.glade");
	try{
		refBuilder->add_from_file(gladepath);
	}catch (const Glib::FileError& ex){
		std::cerr << "FileError: " << ex.what() << std::endl;
	  	return -1;
	}catch (const Glib::MarkupError& ex){
	  	std::cerr << "MarkupError: " << ex.what() << std::endl;
	  	return -1;
	}catch (const Gtk::BuilderError& ex){
		std::cerr << "BuilderError: " << ex.what() << std::endl;
		return -1;
	}

	//GETTING WIDGETS
	refBuilder->get_widget("scrolledwindow_schema", this->scrolledwindow_schema);
	refBuilder->get_widget("treeview", this->treeView);
	refBuilder->get_widget("up_button", this->pUpButton);
	refBuilder->get_widget("check_autofocus", this->checkAutofocus);
	refBuilder->get_widget("DialogDerived", guiDialog);
	if(!guiDialog){
		std::cerr << "Error: couldn't get DialogDerived" << std::endl;
		return -1;
	}

	this->pUpButton->signal_clicked().connect(sigc::mem_fun(*this,
										&AutomataGui::on_up_button_clicked));

	//INIT CANAVS
	this->canvas = Gtk::manage(new Goocanvas::Canvas());
	this->canvas->signal_item_created().connect(sigc::mem_fun(*this,
										&AutomataGui::on_item_created));
	this->root = Goocanvas::GroupModel::create();
	this->canvas->set_root_item_model(root);
	this->canvas->set_visible(true);
	this->scrolledwindow_schema->add(*(this->canvas));

	//INIT TREEVIEW
	this->lastExpanded = "";
	this->refTreeModel = Gtk::TreeStore::create(this->m_Columns);
	this->treeView->set_model(this->refTreeModel);
	this->treeView->append_column("ID", this->m_Columns.m_col_id);
	Gtk::CellRendererText *cell = new Gtk::CellRendererText;
	int column_count = treeView->append_column("Name", *cell);
	Gtk::TreeViewColumn *column = treeView->get_column(column_count-1);
	if (column) {
	#ifdef GLIBMM_PROPERTIES_ENABLED
        column->add_attribute(cell->property_background(), this->m_Columns.m_col_color);
		column->add_attribute(cell->property_text(), this->m_Columns.m_col_name);
	#else
        column->add_attribute(*cell, "background", this->m_Columns.m_col_color);
        column->add_attribute(*cell, "text", this->m_Columns.m_col_name);
	#endif
    }
    this->treeView->signal_row_activated().connect(
    					sigc::mem_fun(*this, &AutomataGui::on_row_activated));

    //Atach handler to the dispatcher
    this->dispatcher.connect(sigc::mem_fun(*this, &AutomataGui::on_notify_received));

    //SETTING CANVAS BOUNDS
	Glib::RefPtr<Gdk::Screen> screen = this->guiDialog->get_screen();
    int width = screen->get_width();
    int height = screen->get_height();

    Goocanvas::Bounds bounds;
    this->canvas->get_bounds(bounds);
    bounds.set_x2(width);
    bounds.set_y2(height * 2);
    this->canvas->set_bounds(bounds);
    return 0;
}
Esempio n. 27
0
MidiRuleCtrlTrigger::MidiRuleCtrlTrigger() :
    table(2, 1),
    eControllerNumber(_("Controller"))
#if (GTKMM_MAJOR_VERSION == 2 && GTKMM_MINOR_VERSION < 90) || GTKMM_MAJOR_VERSION < 2
    , add_button(Gtk::Stock::ADD),
    remove_button(Gtk::Stock::REMOVE)
#endif
{
    connect(eControllerNumber, &gig::MidiRuleCtrlTrigger::ControllerNumber);

    set_spacing(6);

    scrolled_window.set_size_request(-1, 120);

    list_store = Gtk::ListStore::create(columns);
    tree_view.set_model(list_store);
    list_store->signal_row_changed().connect(
        sigc::mem_fun(*this, &MidiRuleCtrlTrigger::row_changed));
    list_store->signal_row_inserted().connect(
        sigc::mem_fun(*this, &MidiRuleCtrlTrigger::row_inserted));
    list_store->signal_row_deleted().connect(
        sigc::mem_fun(*this, &MidiRuleCtrlTrigger::row_deleted));

    append_num_column(_("Trigger point"), columns.trigger_point);
    tree_view.append_column_editable(_("Descending"), columns.descending);
    append_num_column(_("Vel sensitivity"), columns.vel_sensitivity, 1, 100);
    append_note_column(_("Key"), columns.key);
    tree_view.append_column_editable(_("Note off"), columns.note_off);
    tree_view.append_column_editable(_("Switch"), columns.switch_logic);

    int cols_count = append_num_column(_("Velocity"), columns.velocity);
    Gtk::TreeViewColumn* col = tree_view.get_column(cols_count - 1);
    col->add_attribute(*col->get_first_cell(), "visible", columns.switch_logic);
    cols_count = tree_view.append_column_editable(_("Override pedal"),
                                                  columns.override_pedal);
    col = tree_view.get_column(cols_count - 1);
    col->add_attribute(*col->get_first_cell(), "visible", columns.note_off);

    tree_view.get_selection()->signal_changed().connect(
        sigc::mem_fun(*this, &MidiRuleCtrlTrigger::sel_changed));

    scrolled_window.add(tree_view);
    scrolled_window.set_shadow_type(Gtk::SHADOW_IN);
    scrolled_window.set_policy(Gtk::POLICY_NEVER, Gtk::POLICY_AUTOMATIC);

    table.set_col_spacings(5);
    table.add(eControllerNumber);
    pack_start(table, Gtk::PACK_SHRINK);

    vbox.add(scrolled_window);

#if (GTKMM_MAJOR_VERSION == 2 && GTKMM_MINOR_VERSION < 90) || GTKMM_MAJOR_VERSION < 2
    vbox.set_spacing(6);
    toolbar.set_layout(Gtk::BUTTONBOX_START);
    toolbar.set_homogeneous();
    toolbar.set_spacing(6);
#else
    toolbar.set_toolbar_style(Gtk::TOOLBAR_ICONS);
    toolbar.set_show_arrow(false);
    toolbar.set_icon_size(Gtk::IconSize(1));
    toolbar.get_style_context()->add_class("inline-toolbar");

    add_button.set_icon_name("list-add-symbolic");
    remove_button.set_icon_name("list-remove-symbolic");
#endif

    add_button.signal_clicked().connect(
        sigc::mem_fun(*this, &MidiRuleCtrlTrigger::add_row));
    toolbar.add(add_button);

    remove_button.signal_clicked().connect(
        sigc::mem_fun(*this, &MidiRuleCtrlTrigger::remove_row));
    toolbar.add(remove_button);

    vbox.pack_start(toolbar, Gtk::PACK_SHRINK);
    add(vbox);
}
Esempio n. 28
0
ApplicationList::ApplicationList(MainWindow* parent)
{

    /* Create a new scrolled window, with scrollbars only if needed */
    set_policy(Gtk::POLICY_AUTOMATIC, Gtk::POLICY_AUTOMATIC);
    add(m_TreeView);

    /* create list store */
    m_refTreeModel = Gtk::TreeStore::create(m_appColumns);
    m_TreeView.set_model(m_refTreeModel);
    m_TreeView.enable_model_drag_source(parent->dragTargets,
                                        Gdk::BUTTON1_MASK, Gdk::ACTION_COPY);
    m_TreeView.signal_drag_begin().connect(sigc::mem_fun(*this,
                                          &ApplicationList::onDragBegin) );
    m_TreeView.signal_drag_data_get().connect(sigc::mem_fun(*this,
                                          &ApplicationList::onDragDataGet) );

    m_refPixComputer = Gdk::Pixbuf::create_from_data(computer_ico.pixel_data, 
                                Gdk::COLORSPACE_RGB,
                                true,
                                8,
                                computer_ico.width,
                                computer_ico.height,
                                computer_ico.bytes_per_pixel*computer_ico.width);

    //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("Entities"));
    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.expand_all();


    m_appRow = *(m_refTreeModel->append());
    m_appRow[m_appColumns.m_col_type] = NODE_OTHER;
    m_appRow[m_appColumns.m_col_name] = "Applications";
    m_appRow.set_value(0, Gdk::Pixbuf::create_from_data(folderapp_ico.pixel_data, 
                                            Gdk::COLORSPACE_RGB,
                                            true,
                                            8,
                                            folderapp_ico.width,
                                            folderapp_ico.height,
                                            folderapp_ico.bytes_per_pixel*folderapp_ico.width));
                                                               
    m_modRow = *(m_refTreeModel->append());
    m_modRow[m_appColumns.m_col_type] = NODE_OTHER;
    m_modRow[m_appColumns.m_col_name] = "Modules";
    m_modRow.set_value(0, Gdk::Pixbuf::create_from_data(foldermod_ico.pixel_data, 
                                            Gdk::COLORSPACE_RGB,
                                            true,
                                            8,
                                            foldermod_ico.width,
                                            foldermod_ico.height,
                                            foldermod_ico.bytes_per_pixel*foldermod_ico.width));

    
    m_resRow = *(m_refTreeModel->append());
    m_resRow[m_appColumns.m_col_type] = NODE_OTHER;
    m_resRow[m_appColumns.m_col_name] = "Resources";
    m_resRow.set_value(0, Gdk::Pixbuf::create_from_data(folderres_ico.pixel_data, 
                                            Gdk::COLORSPACE_RGB,
                                            true,
                                            8,
                                            folderres_ico.width,
                                            folderres_ico.height,
                                            folderres_ico.bytes_per_pixel*folderres_ico.width));

    
    m_tempRow = *(m_refTreeModel->append());
    m_tempRow[m_appColumns.m_col_type] = NODE_OTHER;
    m_tempRow[m_appColumns.m_col_name] = "Templates";
    m_tempRow.set_value(0, Gdk::Pixbuf::create_from_data(folder_ico.pixel_data, 
                                            Gdk::COLORSPACE_RGB,
                                            true,
                                            8,
                                            folder_ico.width,
                                            folder_ico.height,
                                            folder_ico.bytes_per_pixel*folder_ico.width));    
    show_all_children();
}
Esempio n. 29
0
Cal3dStoreOptions::Cal3dStoreOptions(Cal3dStore & s) :
                                     OptionBox("Cal3d Options"),
                                     m_cal3dStore(s)
{
    Gtk::VBox * vbox = this;

    m_columns = new Gtk::TreeModelColumnRecord();
    m_nameColumn = new Gtk::TreeModelColumn<Glib::ustring>();
    m_selectColumn = new Gtk::TreeModelColumn<bool>();
    m_idColumn = new Gtk::TreeModelColumn<int>();
    m_componentColumn = new Gtk::TreeModelColumn<ComponentType>();
    m_columns->add(*m_nameColumn);
    m_columns->add(*m_selectColumn);
    m_columns->add(*m_idColumn);
    m_columns->add(*m_componentColumn);

    m_treeModel = Gtk::TreeStore::create(*m_columns);

    m_treeView = manage( new Gtk::TreeView() );

    m_treeView->set_model( m_treeModel );

    m_treeView->append_column("Component", *m_nameColumn);

    Gtk::CellRendererToggle * crt = manage( new Gtk::CellRendererToggle() );
    crt->signal_toggled().connect( sigc::mem_fun(*this, &Cal3dStoreOptions::enableToggled) );
    int column_no = m_treeView->append_column("View", *crt);
    Gtk::TreeViewColumn * column = m_treeView->get_column(column_no - 1);
    column->add_attribute(crt->property_active(), *m_selectColumn);
    column->set_clickable();

    m_refTreeSelection = m_treeView->get_selection();
    m_refTreeSelection->set_mode(Gtk::SELECTION_SINGLE);
    // m_refTreeSelection->signal_changed().connect( sigc::mem_fun(*this, &Cal3dStoreOptions::selectionChanged) );

    Gtk::ScrolledWindow *scrolled_window = manage(new Gtk::ScrolledWindow());
    scrolled_window->set_policy(Gtk::POLICY_AUTOMATIC, Gtk::POLICY_ALWAYS);
    scrolled_window->set_size_request(250,150);
    scrolled_window->add(*m_treeView);

    vbox->pack_start(*scrolled_window);

    Gtk::HBox * bothbox = manage( new Gtk::HBox );

    Gtk::Button * b = manage( new Gtk::Button("Wuh...") );
    // b->signal_clicked().connect(sigc::mem_fun(*this, &Cal3dStoreOptions::typesPressed));
    bothbox->pack_start(*b, Gtk::PACK_EXPAND_PADDING, 6);

    vbox->pack_start(*bothbox, Gtk::PACK_SHRINK, 6);

    animationRow = *(m_treeModel->append());
    animationRow[*m_nameColumn] = Glib::ustring("Animations");

    actionRow = *(m_treeModel->append());
    actionRow[*m_nameColumn] = Glib::ustring("Actions");

    meshRow = *(m_treeModel->append());
    meshRow[*m_nameColumn] = Glib::ustring("Meshes");

    materialRow = *(m_treeModel->append());
    materialRow[*m_nameColumn] = Glib::ustring("Materials");

    Cal3dModel & m = s.getModel();

    m.skeletonLoaded.connect(sigc::mem_fun(*this, &Cal3dStoreOptions::skeletonLoaded));
    m.animationLoaded.connect(sigc::mem_fun(*this, &Cal3dStoreOptions::animationLoaded));
    m.actionLoaded.connect(sigc::mem_fun(*this, &Cal3dStoreOptions::actionLoaded));
    m.meshLoaded.connect(sigc::mem_fun(*this, &Cal3dStoreOptions::meshLoaded));
    m.materialLoaded.connect(sigc::mem_fun(*this, &Cal3dStoreOptions::materialLoaded));
}