IndexPage::IndexPage(const ustring &indexName, IndexTree *pTree, PinotSettings &settings) : NotebookPageBox(indexName, NotebookPageBox::INDEX_PAGE, settings), m_pTree(pTree), m_pLabelCombobox(NULL), m_pBackButton(NULL), m_pForwardButton(NULL), m_docsCount(0), m_firstDoc(0) { m_pLabelCombobox = manage(new ComboBox()); Image *image521 = manage(new Image(StockID("gtk-media-rewind"), IconSize(4))); Label *label52 = manage(new Label(_("Show Previous"))); HBox *hbox45 = manage(new HBox(false, 2)); Alignment *alignment31 = manage(new Alignment(0.5, 0.5, 0, 0)); m_pBackButton = manage(new Button()); Image *image522 = manage(new Image(StockID("gtk-media-forward"), IconSize(4))); Label *label53 = manage(new Label(_("Show Next"))); HBox *hbox46 = manage(new HBox(false, 2)); Alignment *alignment32 = manage(new Alignment(0.5, 0.5, 0, 0)); m_pForwardButton = manage(new Button()); HButtonBox *indexHbuttonbox = manage(new HButtonBox(BUTTONBOX_START, 0)); HBox *indexButtonsHbox = manage(new HBox(false, 0)); // Buttons image521->set_alignment(0.5,0.5); image521->set_padding(0,0); label52->set_alignment(0.5,0.5); label52->set_padding(0,0); label52->set_justify(Gtk::JUSTIFY_LEFT); label52->set_line_wrap(false); label52->set_use_markup(false); label52->set_selectable(false); hbox45->pack_start(*image521, Gtk::PACK_SHRINK, 0); hbox45->pack_start(*label52, Gtk::PACK_SHRINK, 0); alignment31->add(*hbox45); m_pBackButton->set_flags(Gtk::CAN_FOCUS); m_pBackButton->set_flags(Gtk::CAN_DEFAULT); m_pBackButton->set_relief(Gtk::RELIEF_NORMAL); m_pBackButton->add(*alignment31); image522->set_alignment(0.5,0.5); image522->set_padding(0,0); label53->set_alignment(0.5,0.5); label53->set_padding(0,0); label53->set_justify(Gtk::JUSTIFY_LEFT); label53->set_line_wrap(false); label53->set_use_markup(false); label53->set_selectable(false); hbox46->pack_start(*image522, Gtk::PACK_SHRINK, 0); hbox46->pack_start(*label53, Gtk::PACK_SHRINK, 0); alignment32->add(*hbox46); m_pForwardButton->set_flags(Gtk::CAN_FOCUS); m_pForwardButton->set_flags(Gtk::CAN_DEFAULT); m_pForwardButton->set_relief(Gtk::RELIEF_NORMAL); m_pForwardButton->add(*alignment32); // Position everything indexHbuttonbox->pack_start(*m_pBackButton); indexHbuttonbox->pack_start(*m_pForwardButton); indexButtonsHbox->pack_start(*m_pLabelCombobox, Gtk::PACK_SHRINK, 4); indexButtonsHbox->pack_start(*indexHbuttonbox, Gtk::PACK_EXPAND_WIDGET, 4); pack_start(*indexButtonsHbox, Gtk::PACK_SHRINK, 4); if (pTree != NULL) { pack_start(*pTree->getScrolledWindow()); } // Associate the columns model to the label combo m_refLabelNameTree = ListStore::create(m_labelNameColumns); m_pLabelCombobox->set_model(m_refLabelNameTree); m_pLabelCombobox->pack_start(m_labelNameColumns.m_name); // Populate populateLabelCombobox(); // Connect the signals m_pLabelCombobox->signal_changed().connect( SigC::slot(*this, &IndexPage::onLabelChanged)); m_pBackButton->signal_clicked().connect( SigC::slot(*this, &IndexPage::onBackClicked)); m_pForwardButton->signal_clicked().connect( SigC::slot(*this, &IndexPage::onForwardClicked)); // Disable the buttons until something is being shown m_pBackButton->set_sensitive(false); m_pForwardButton->set_sensitive(false); // Show all m_pLabelCombobox->show(); image521->show(); label52->show(); hbox45->show(); alignment31->show(); m_pBackButton->show(); image522->show(); label53->show(); hbox46->show(); alignment32->show(); m_pForwardButton->show(); indexHbuttonbox->show(); indexButtonsHbox->show(); show(); }
ResultsTree::ResultsTree(VBox *resultsVbox, Menu *pPopupMenu, PinotSettings &settings) : TreeView(), m_pPopupMenu(pPopupMenu), m_settings(settings), m_extractScrolledwindow(NULL), m_extractTextview(NULL), m_showExtract(true) { HBox *extractHbox = manage(new class Gtk::HBox(false, 0)); ScrolledWindow *resultsScrolledwindow = manage(new ScrolledWindow()); m_extractScrolledwindow = manage(new ScrolledWindow()); m_extractTextview = manage(new TextView()); // This is the actual results tree set_events(Gdk::BUTTON_PRESS_MASK); set_flags(CAN_FOCUS); set_headers_visible(true); set_rules_hint(true); set_reorderable(false); set_enable_search(true); resultsScrolledwindow->set_flags(CAN_FOCUS); resultsScrolledwindow->set_border_width(4); resultsScrolledwindow->set_shadow_type(SHADOW_NONE); resultsScrolledwindow->set_policy(POLICY_AUTOMATIC, POLICY_ALWAYS); resultsScrolledwindow->property_window_placement().set_value(CORNER_TOP_LEFT); resultsScrolledwindow->add(*this); // That's for the extract view m_extractTextview->set_flags(CAN_FOCUS); m_extractTextview->set_editable(false); m_extractTextview->set_cursor_visible(false); m_extractTextview->set_pixels_above_lines(0); m_extractTextview->set_pixels_below_lines(0); m_extractTextview->set_pixels_inside_wrap(0); m_extractTextview->set_left_margin(0); m_extractTextview->set_right_margin(0); m_extractTextview->set_indent(0); m_extractTextview->set_wrap_mode(WRAP_WORD); m_extractTextview->set_justification(JUSTIFY_LEFT); m_extractScrolledwindow->set_flags(CAN_FOCUS); m_extractScrolledwindow->set_border_width(4); m_extractScrolledwindow->set_shadow_type(SHADOW_NONE); m_extractScrolledwindow->set_policy(POLICY_AUTOMATIC, POLICY_AUTOMATIC); m_extractScrolledwindow->property_window_placement().set_value(CORNER_TOP_LEFT); m_extractScrolledwindow->add(*m_extractTextview); // Position the scrolled windows resultsVbox->pack_start(*resultsScrolledwindow, Gtk::PACK_EXPAND_WIDGET, 0); resultsVbox->pack_start(*m_extractScrolledwindow, Gtk::PACK_SHRINK, 0); // Associate the columns model to the results tree m_refStore = TreeStore::create(m_resultsColumns); set_model(m_refStore); // The title column is also used for status icons TreeViewColumn *treeColumn = new TreeViewColumn(_("Title")); // Pack an icon renderer for the viewed status CellRendererPixbuf *iconRenderer = new CellRendererPixbuf(); treeColumn->pack_start(*manage(iconRenderer), false); treeColumn->set_cell_data_func(*iconRenderer, SigC::slot(*this, &ResultsTree::renderViewStatus)); // Pack a second icon renderer for the indexed status iconRenderer = new CellRendererPixbuf(); treeColumn->pack_start(*manage(iconRenderer), false); treeColumn->set_cell_data_func(*iconRenderer, SigC::slot(*this, &ResultsTree::renderIndexStatus)); // And a third one for the ranking iconRenderer = new CellRendererPixbuf(); treeColumn->pack_start(*manage(iconRenderer), false); treeColumn->set_cell_data_func(*iconRenderer, SigC::slot(*this, &ResultsTree::renderRanking)); treeColumn->pack_end(m_resultsColumns.m_text, false); treeColumn->set_resizable(true); append_column(*manage(treeColumn)); // The last column is for the URL append_column(_("URL"), m_resultsColumns.m_url); // Make headers clickable set_headers_clickable(true); // Allow multiple selection get_selection()->set_mode(SELECTION_MULTIPLE); // Handle button presses signal_button_press_event().connect_notify(SigC::slot(*this, &ResultsTree::onButtonPressEvent)); // Enable interactive search set_search_column(m_resultsColumns.m_text.index()); set_search_equal_func(SigC::slot(*this, &ResultsTree::onSearchEqual)); // Control which rows can be selected get_selection()->set_select_function(SigC::slot(*this, &ResultsTree::onSelectionSelect)); // Listen for style changes signal_style_changed().connect_notify(SigC::slot(*this, &ResultsTree::onStyleChanged)); // Render the icons m_indexedIconPixbuf = render_icon(Stock::INDEX, ICON_SIZE_MENU, "MetaSE-pinot"); m_viewededIconPixbuf = render_icon(Stock::YES, ICON_SIZE_MENU, "MetaSE-pinot"); m_newIconPixbuf = render_icon(Stock::NEW, ICON_SIZE_MENU, "MetaSE-pinot"); m_upIconPixbuf = render_icon(Stock::GO_UP, ICON_SIZE_MENU, "MetaSE-pinot"); m_downIconPixbuf = render_icon(Stock::GO_DOWN, ICON_SIZE_MENU, "MetaSE-pinot"); // Show all show(); resultsScrolledwindow->show(); m_extractTextview->show(); m_extractScrolledwindow->show(); extractHbox->show(); }