コード例 #1
0
/*! Adds an element to the panel
 * \param[in]	pos	the path of the word containing the element
 * \param[in]	cluster	the element's class name
 * \param[in]	pb	the image to be displayed
 * \param[in]	tip_pb	the image to be displayed in tooltip
 * \param[in]	char_id	optional character id
 */
void ValidationPanel::add_element(const ElementPosition &pos, const crn::StringUTF8 cluster, const Glib::RefPtr<Gdk::Pixbuf> &pb, const Glib::RefPtr<Gdk::Pixbuf> &tip_pb, const Id &char_id)
{
	auto msg = crn::StringUTF8{};
	msg += _("View") + " "_s + pos.view + "\n";
	msg += _("Page") + " "_s + pos.page + "\n";
	msg += _("Column") + " "_s += pos.column + "\n";
	msg += _("Line") + " "_s + pos.line + "\n";
	msg += _("Word") + " "_s + pos.word;
	if (char_id.IsNotEmpty())
		msg += "\n"_s + _("Character") + " "_s + char_id;

	elements[cluster].emplace(ElementId{pos, char_id}, Element{pb, tip_pb, msg.CStr()});
	nelem += 1;
}