コード例 #1
0
void PresentationTreeView::initialize() {
	//  We only need single copies of these renderers since all instances of PresentationTreeView have
	//  identical properties. Cannot make them global though as that would require them to be
	//  initialized before the call to the GTK initialization and so leads to an initialization error.
	//  Having them in this scope means they are not initialized until the first instance of a
	//  PresentationTreeView is made which is after the GTK+ system is initialized.
	static Gtk::CellRendererText font_style_renderer;
	static Gtk::CellRendererText visibility_renderer;
	static Gtk::CellRendererText sample_text_renderer;
	static Gtk::CellRendererText file_name_renderer;
	PresentationListStore::ColumnRecord const & column_record{PresentationListStore::get_column_record()};
	font_style_column.pack_start(font_style_renderer, true);
	font_style_column.set_title(_("Font Style"));
	font_style_column.add_attribute(font_style_renderer.property_text(), column_record.style_name);
	visibility_column.pack_start(visibility_renderer, true);
	visibility_column.set_title(" ");
	visibility_column.add_attribute(visibility_renderer.property_text(), column_record.visibility);
	sample_text_column.pack_start(sample_text_renderer, true);
	sample_text_column.set_title(_("Sample Text"));
	sample_text_column.add_attribute(sample_text_renderer.property_font_desc(), column_record.font_description);
	sample_text_column.add_attribute(sample_text_renderer.property_text(), column_record.sample_text);
	file_name_column.pack_start(file_name_renderer, true);
	file_name_column.set_title(_("File Name"));
	file_name_column.add_attribute(file_name_renderer.property_text(), column_record.file_name);
	append_column(font_style_column);
	append_column(visibility_column);
	append_column(sample_text_column);
	append_column(file_name_column);
	for (auto i = 0; i < 4; ++i) { get_column(i)->set_resizable(true); }
	Registry::registry.insert(this);
}
コード例 #2
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);
}
コード例 #3
0
ClassEditor::TypeSelectorWidgets ClassEditor::createStimTypeSelector()
{
	TypeSelectorWidgets widgets;

	// Type Selector
	widgets.hbox = Gtk::manage(new Gtk::HBox(false, 0));

	widgets.label = Gtk::manage(new gtkutil::LeftAlignedLabel(_("Type:")));

	// Cast the helper class onto a ListStore and create a new treeview
	widgets.list = Gtk::manage(new Gtk::ComboBox(_stimTypes.getListStore()));
	widgets.list->set_size_request(-1, -1);

	// Add the cellrenderer for the name
	Gtk::CellRendererText* nameRenderer = Gtk::manage(new Gtk::CellRendererText);
	Gtk::CellRendererPixbuf* iconRenderer = Gtk::manage(new Gtk::CellRendererPixbuf);

	widgets.list->pack_start(*iconRenderer, false);
	widgets.list->pack_start(*nameRenderer, true);

	widgets.list->add_attribute(iconRenderer->property_pixbuf(), _stimTypes.getColumns().icon);
	widgets.list->add_attribute(nameRenderer->property_text(), _stimTypes.getColumns().captionPlusID);
	iconRenderer->set_fixed_size(26, -1);

	widgets.hbox->pack_start(*widgets.label, false, false, 0);
	widgets.hbox->pack_start(*Gtk::manage(new gtkutil::LeftAlignment(*widgets.list, 12, 1.0f)),
		true, true,	0
	);

	// Set the combo box to use two-column
	widgets.list->set_wrap_width(2);
	widgets.list->set_active(0);

	return widgets;
}
コード例 #4
0
ファイル: Frame_FilesTab.cpp プロジェクト: jtrag/gutorrent
void Frame_FilesTab::treeviewcolumn_filepriority(Gtk::CellRenderer* renderer, const Gtk::TreeModel::iterator& iter)
{
    if(iter)
    {
        Gtk::TreeModel::Row row = *iter;
        int model_value = row[FilesColumns.Priority];

        string Priority = "[unknown]";
        switch(model_value)
        {
        case 0:
            Priority = "Don't Download";
            break;
        case 1:
            Priority = "Low Priority";
            break;
        case 2:
            Priority = "Normal Priority";
            break;
        case 3:
            Priority = "High Priority";
            break;
        }

        Gtk::CellRendererText *crt = dynamic_cast<Gtk::CellRendererText*>(renderer);
        crt->property_text() = Priority;
    }
}
コード例 #5
0
FontSizeComboBox::FontSizeComboBox(BaseObjectType* cobject, const Glib::RefPtr<Gtk::Builder>& builder) :
	Gtk::ComboBox( cobject )
{
	font_size_tree_model_ = Gtk::ListStore::create(columns_);
	
	font_size_tree_model_->set_sort_column(columns_.font_size, Gtk::SORT_ASCENDING);
	
	set_model(font_size_tree_model_);
	
	Gtk::TreeModel::Row row = *(font_size_tree_model_->append()); row[columns_.font_size] = 6; 
	row = *(font_size_tree_model_->append()); row[columns_.font_size] = 8; 
	row = *(font_size_tree_model_->append()); row[columns_.font_size] = 10; 
	row = *(font_size_tree_model_->append()); row[columns_.font_size] = 11; 
	row = *(font_size_tree_model_->append()); row[columns_.font_size] = 12; 
	row = *(font_size_tree_model_->append()); row[columns_.font_size] = 14; 
	row = *(font_size_tree_model_->append()); row[columns_.font_size] = 16; 
	row = *(font_size_tree_model_->append()); row[columns_.font_size] = 18; 
	row = *(font_size_tree_model_->append()); row[columns_.font_size] = 24; 
	row = *(font_size_tree_model_->append()); row[columns_.font_size] = 32; 
	
	Gtk::CellRendererText* renderer = Gtk::manage (new Gtk::CellRendererText());
	pack_start (*renderer, true);
	
	add_attribute(renderer->property_text(), columns_.font_size);	
}
コード例 #6
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;
}
コード例 #7
0
ファイル: Frame_FilesTab.cpp プロジェクト: jtrag/gutorrent
void Frame_FilesTab::treeviewcolumn_filesize(Gtk::CellRenderer* renderer, const Gtk::TreeModel::iterator& iter)
{
    if(iter)
    {
        tools_formatsize fs;
        Gtk::TreeModel::Row row = *iter;
        int model_value = row[FilesColumns.Size];

        Gtk::CellRendererText *crt = dynamic_cast<Gtk::CellRendererText*>(renderer);
        crt->property_text() = fs.format(model_value);
    }
}
コード例 #8
0
void SearchNotesWidget::notebook_text_cell_data_func(Gtk::CellRenderer * renderer,
                                                     const Gtk::TreeIter & iter)
{
  Gtk::CellRendererText *crt = dynamic_cast<Gtk::CellRendererText*>(renderer);
  crt->property_ellipsize() = Pango::ELLIPSIZE_END;
  notebooks::Notebook::Ptr notebook;
  iter->get_value(0, notebook);
  if(!notebook) {
    crt->property_text() = "";
    return;
  }

  crt->property_text() = notebook->get_name();

  if(dynamic_pointer_cast<notebooks::SpecialNotebook>(notebook)) {
    // Bold the "Special" Notebooks
    crt->property_markup() = Glib::ustring::compose("<span weight=\"bold\">%1</span>",
                                 notebook->get_name());
  }
  else {
    crt->property_text() = notebook->get_name();
  }
}
コード例 #9
0
ファイル: Chooser.cpp プロジェクト: m2osw/turnwatcher
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;
}
コード例 #10
0
ファイル: Frame_FilesTab.cpp プロジェクト: jtrag/gutorrent
void Frame_FilesTab::treeviewcolumn_filetype(Gtk::CellRenderer* renderer, const Gtk::TreeModel::iterator& iter)
{
    if(iter)
    {
        Gtk::TreeModel::Row row = *iter;
        string model_value = row[FilesColumns.Name];

        string FileType = model_value.substr(model_value.find_last_of(".") + 1);
        if(model_value.compare(FileType) == 0) FileType = "[None]";

        std::transform(FileType.begin(), FileType.end(), FileType.begin(), ::tolower);

        Gtk::CellRendererText *crt = dynamic_cast<Gtk::CellRendererText*>(renderer);
        crt->property_text() = FileType;
    }
}
コード例 #11
0
// Actor Argument
ActorArgument::ActorArgument(
		const conversation::ArgumentInfo& argInfo,
		const Glib::RefPtr<Gtk::ListStore>& actorStore,
		const ActorColumns& actorColumns) :
	CommandArgumentItem(argInfo),
	_actorColumns(actorColumns),
	_actorStore(actorStore)
{
	// Cast the helper class onto a ListStore and create a new treeview
	_comboBox = Gtk::manage(new Gtk::ComboBox(Glib::RefPtr<Gtk::TreeModel>::cast_static(_actorStore)));

	// Add the cellrenderer for the name
	Gtk::CellRendererText* nameRenderer = Gtk::manage(new Gtk::CellRendererText);

	_comboBox->pack_start(*nameRenderer, true);
	_comboBox->add_attribute(nameRenderer->property_text(), _actorColumns.caption);
}
コード例 #12
0
void EffectEditor::populateWindow()
{
	// Create the overall vbox
	_dialogVBox = Gtk::manage(new Gtk::VBox(false, 3));
	add(*_dialogVBox);

	Gtk::HBox* effectHBox = Gtk::manage(new Gtk::HBox(false, 0));

	_effectTypeCombo = Gtk::manage(new Gtk::ComboBox(static_cast<const Glib::RefPtr<Gtk::TreeModel>&>(_effectStore)));

	// Add the cellrenderer for the caption
	Gtk::CellRendererText* captionRenderer = Gtk::manage(new Gtk::CellRendererText);
	_effectTypeCombo->pack_start(*captionRenderer, false);
	_effectTypeCombo->add_attribute(captionRenderer->property_text(), _effectColumns.caption);

	Gtk::Label* effectLabel = Gtk::manage(new gtkutil::LeftAlignedLabel(_("Effect:")));

	effectHBox->pack_start(*effectLabel, false, false, 0);
	effectHBox->pack_start(*Gtk::manage(new gtkutil::LeftAlignment(*_effectTypeCombo, 12, 1.0f)),
		true, true, 0
	);

	_dialogVBox->pack_start(*effectHBox, false, false, 3);

	_stateToggle = Gtk::manage(new Gtk::CheckButton(_("Active")));
	_stateToggle->signal_toggled().connect(sigc::mem_fun(*this, &EffectEditor::onStateToggle));

	_dialogVBox->pack_start(*_stateToggle, false, false, 3);

	Gtk::Label* argLabel =
		Gtk::manage(new gtkutil::LeftAlignedLabel(std::string("<b>") + _("Arguments") + "</b>"));
	_dialogVBox->pack_start(*argLabel, false, false, 0);

	Gtk::Button* saveButton = Gtk::manage(new Gtk::Button(Gtk::Stock::APPLY));
	saveButton->signal_clicked().connect(sigc::mem_fun(*this, &EffectEditor::onSave));

	Gtk::Button* cancelButton = Gtk::manage(new Gtk::Button(Gtk::Stock::CANCEL));
	cancelButton->signal_clicked().connect(sigc::mem_fun(*this, &EffectEditor::onCancel));

	Gtk::HBox* buttonHBox = Gtk::manage(new Gtk::HBox(false, 0));
	buttonHBox->pack_end(*saveButton, false, false, 0);
	buttonHBox->pack_end(*cancelButton, false, false, 6);

	_dialogVBox->pack_end(*buttonHBox, false, false, 3);
}
コード例 #13
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);
}
コード例 #14
0
Gtk::Widget& DifficultyEditor::createEditingWidgets()
{
	_editorPane = Gtk::manage(new Gtk::VBox(false, 6));
	_editorPane->set_border_width(12);

	// The "Settings" label
	Gtk::Label* settingsLabel = Gtk::manage(new gtkutil::LeftAlignedLabel(std::string("<b>") + _("Setting") + "</b>"));
	_editorPane->pack_start(*settingsLabel, false, false, 0);

	// The table aligning the editing widgets
	Gtk::Table* table = Gtk::manage(new Gtk::Table(3, 2, false));
    table->set_col_spacings(12);
    table->set_row_spacings(6);

	_editorPane->pack_start(*Gtk::manage(new gtkutil::LeftAlignment(*table, 18, 1.0)), false, false, 0);

	// ===== CLASSNAME ======

	Gtk::Label* classNameLabel = Gtk::manage(new gtkutil::LeftAlignedLabel(_("Classname:")));

	// Add classname widget
	_classCombo = Gtk::manage(new Gtk::ComboBoxEntry(
		ClassNameStore::Instance().getModel(),
		ClassNameStore::Instance().getColumns().classname
	));

	// Add completion functionality to the combobox entry
	Glib::RefPtr<Gtk::EntryCompletion> completion = Gtk::EntryCompletion::create();
	completion->set_model(ClassNameStore::Instance().getModel());
	completion->set_text_column(ClassNameStore::Instance().getColumns().classname);

	_classCombo->get_entry()->set_completion(completion);

	table->attach(*classNameLabel, 0, 1, 0, 1, Gtk::FILL, Gtk::AttachOptions(0), 0, 0);
	table->attach(*_classCombo, 1, 2, 0, 1);

	// ===== SPAWNARG ======
	_spawnArgEntry = Gtk::manage(new Gtk::Entry);
	Gtk::Label* spawnArgLabel = Gtk::manage(new gtkutil::LeftAlignedLabel(_("Spawnarg:")));

	table->attach(*spawnArgLabel, 0, 1, 1, 2, Gtk::FILL, Gtk::AttachOptions(0), 0, 0);
	table->attach(*_spawnArgEntry, 1, 2, 1, 2);

	// ===== ARGUMENT ======
	_argumentEntry = Gtk::manage(new Gtk::Entry);
	Gtk::Label* argumentLabel = Gtk::manage(new gtkutil::LeftAlignedLabel(_("Argument:")));

	// The appType chooser
	_appTypeCombo = Gtk::manage(new Gtk::ComboBox(difficulty::Setting::getAppTypeStore()));
	_appTypeCombo->signal_changed().connect(sigc::mem_fun(*this, &DifficultyEditor::onAppTypeChange));

	// Add the cellrenderer for the apptype text
	Gtk::CellRendererText* appTypeRenderer = Gtk::manage(new Gtk::CellRendererText);

	_appTypeCombo->pack_start(*appTypeRenderer, false);
	_appTypeCombo->add_attribute(appTypeRenderer->property_text(), difficulty::Setting::getTreeModelColumns().name);

	// Pack the argument entry and the appType dropdown field together
	Gtk::HBox* argHBox = Gtk::manage(new Gtk::HBox(false, 6));
	argHBox->pack_start(*_argumentEntry, true, true, 0);
	argHBox->pack_start(*_appTypeCombo, false, false, 0);

	table->attach(*argumentLabel, 0, 1, 2, 3, Gtk::FILL, Gtk::AttachOptions(0), 0, 0);
	table->attach(*argHBox, 1, 2, 2, 3);

	// Save button
	Gtk::HBox* buttonHbox = Gtk::manage(new Gtk::HBox(false, 6));

	_saveSettingButton = Gtk::manage(new Gtk::Button(Gtk::Stock::SAVE));
	_saveSettingButton->signal_clicked().connect(sigc::mem_fun(*this, &DifficultyEditor::onSettingSave));

	buttonHbox->pack_start(*_saveSettingButton, false, false, 0);
	_editorPane->pack_start(*Gtk::manage(new gtkutil::RightAlignment(*buttonHbox)), false, false, 0);

	// The "note" text
	_noteText = Gtk::manage(new Gtk::Label);
	_noteText->set_line_wrap(true);
	_editorPane->pack_start(*Gtk::manage(new gtkutil::LeftAlignment(*_noteText)), false, false, 6);

	return *_editorPane;
}
コード例 #15
0
ファイル: automatagui.cpp プロジェクト: Diegojnb/JdeRobot
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;
}