Пример #1
0
bool MyApp::OnInit()
{
	ScrolledWindow * sw = new ScrolledWindow(wxT("wxScrolledWindow测试")) ;
	sw->Show(true);

	return true;
}
Пример #2
0
void Chat::setWidgets() {
  // Show user button
  showUsersBtn_.set_can_focus(false);
  showUsersBtn_.signal_clicked().connect(mem_fun(this, &Chat::ShowUsers));

  // First level
  HButtonBox * firstLvl = new HButtonBox(Gtk::BUTTONBOX_END);
  firstLvl->pack_start(showUsersBtn_);

  // Result view
  resultView_.set_wrap_mode(Gtk::WRAP_WORD);
  resultView_.set_editable(false);

  ScrolledWindow * messageScroll = new Gtk::ScrolledWindow();
  messageScroll->set_policy(Gtk::POLICY_AUTOMATIC, Gtk::POLICY_AUTOMATIC);
  messageScroll->add(resultView_);

  // User list
  users_.set_column_title(0, "Users");
  users_.set_headers_visible(false);
  users_.append("Admin");
  users_.append("Console");

  userScroll_.set_policy(Gtk::POLICY_NEVER, Gtk::POLICY_AUTOMATIC);
  userScroll_.add(users_);

  // Second level
  HBox * secondLvl = new HBox();
  secondLvl->pack_start(*manage(messageScroll));
  secondLvl->pack_start(userScroll_, Gtk::PACK_SHRINK);

  // Command entry
  commandEntry_.signal_activate().connect(mem_fun(this, &Chat::Submit));
  commandEntry_.signal_changed().connect(mem_fun(this, &Chat::ShowSubmit));

  // Submit button
  submitBtn_.set_can_focus(false);
  submitBtn_.signal_clicked().connect(mem_fun(this, &Chat::Submit));

  // Third level
  HBox * thirdLvl = new HBox();
  thirdLvl->pack_start(commandEntry_);
  thirdLvl->pack_start(submitBtn_, Gtk::PACK_SHRINK);

  // Vertical Align
  pack_start(*manage(firstLvl), Gtk::PACK_SHRINK);
  pack_start(*manage(secondLvl));
  pack_start(*manage(thirdLvl), Gtk::PACK_SHRINK);

  // Window Settings
  set_focus_child(commandEntry_);
  show_all();
  submitBtn_.hide();
  userScroll_.hide();
}
Пример #3
0
EnginesTree::EnginesTree(VBox *enginesVbox, PinotSettings &settings) :
	TreeView(),
	m_settings(settings)
{
	ScrolledWindow *enginesScrolledwindow = manage(new ScrolledWindow());

	// This is the actual engines tree
	set_events(Gdk::BUTTON_PRESS_MASK);
	set_flags(CAN_FOCUS);
	set_headers_visible(true);
	set_reorderable(false);
	set_enable_search(false);
	enginesScrolledwindow->set_flags(CAN_FOCUS);
	enginesScrolledwindow->set_shadow_type(SHADOW_NONE);
	enginesScrolledwindow->set_policy(POLICY_AUTOMATIC, POLICY_AUTOMATIC);
	enginesScrolledwindow->property_window_placement().set_value(CORNER_TOP_LEFT);
	enginesScrolledwindow->add(*this);

	// Position the scrolled window
	enginesVbox->pack_start(*enginesScrolledwindow, Gtk::PACK_EXPAND_WIDGET, 0);

	// Associate the columns model to the engines tree
	m_refStore = TreeStore::create(m_enginesColumns);
	set_model(m_refStore);

	TreeViewColumn *pColumn = new TreeViewColumn(_("Search Engines"));
	// Pack an icon renderer for engines icons
	CellRendererPixbuf *pIconRenderer = new CellRendererPixbuf();
	pColumn->pack_start(*manage(pIconRenderer), false);
	pColumn->set_cell_data_func(*pIconRenderer, SigC::slot(*this, &EnginesTree::renderEngineIcon));
	pColumn->pack_end(m_enginesColumns.m_name, false);
	append_column(*manage(pColumn));

	// 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, &EnginesTree::onButtonPressEvent));
	// Control which rows can be selected
	get_selection()->set_select_function(SigC::slot(*this, &EnginesTree::onSelectionSelect));
	// Listen for style changes
	signal_style_changed().connect_notify(SigC::slot(*this, &EnginesTree::onStyleChanged));

	// Render the icons
	m_engineFolderIconPixbuf = render_icon(Stock::DIRECTORY, ICON_SIZE_MENU, "MetaSE-pinot");

	// Populate
	populate();

	// Show all
	show();
	enginesScrolledwindow->show();
}
Пример #4
0
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();
}
BackupDialog::BackupDialog(Gtk::Window& parent, Config* ppConfig, tSectionID section)
	: Dialog("Backup", parent), mSection(section),
	mOptionDummyRun("Dummy run"),
	mpConfig(ppConfig), mpBackupThread(NULL), mOptionLevel(1.0),
	mExecButton(Stock::EXECUTE)
{
#ifdef DEBUG
	cerr << "BackupDialog constructor" << endl;
#endif

	set_default_size(650,550);
	// add close button
	add_button(Stock::CLOSE, 1);

	VBox* mainbox = get_vbox(); 
	
	// add Option frame
	Frame* poptionFrame = manage(new Frame());

	poptionFrame->set_border_width(2);
	poptionFrame->set_label("Options");
	mainbox->pack_start(*poptionFrame, false, false);	

	/// add options
	{
		ustring backupType = mpConfig->get_option(mSection, "type");
		Table* optionTable = manage(new Table(2,2));

		Label* label = manage(new Label("Level:"));
		optionTable->attach(*label, 0, 1, 0, 1, Gtk::FILL, Gtk::FILL, 5, 0);
		optionTable->attach(mOptionLevel, 1, 2, 0, 1, Gtk::FILL, Gtk::FILL, 5, 0);						
		label->set_sensitive(false);
		mOptionLevel.set_sensitive(false);

		if(backupType == "incremental") // incremental backup
		{
//TODO: automatic level			mOptionLevel.set_value(mpConfig->get_num_option(mSection, "level"));
			mOptionLevel.set_range(1,999);
			mOptionLevel.set_increments(1,2);
			mOptionLevel.set_numeric();
			mOptionLevel.set_sensitive();
			label->set_sensitive();
		}

		// dummy run option
		mOptionDummyRun.set_active(false);
		optionTable->attach(mOptionDummyRun, 0, 2, 1, 2, FILL, FILL, 5, 0);
		
		// add option table to option frame
		poptionFrame->add(*optionTable);
	}


	// Buttons
	HButtonBox* buttons = manage(new HButtonBox(BUTTONBOX_START));
	buttons->set_border_width(2);
	buttons->set_spacing(10);
	mainbox->pack_start(*buttons, false, false);

	mExecButton.set_use_stock(true);
	mExecButton.signal_clicked().connect( sigc::mem_fun(*this, &BackupDialog::on_button_exec) );
	buttons->pack_start(mExecButton);

	// Log Frame
	Frame* logframe = manage(new Frame());
	logframe->set_border_width(2);
	logframe->set_label("Output");
	mainbox->pack_start(*logframe, true, true);
	
	ScrolledWindow* scrolled = manage(new ScrolledWindow());
	scrolled->set_policy(POLICY_AUTOMATIC, POLICY_ALWAYS);
	scrolled->set_shadow_type(SHADOW_IN);
	scrolled->set_border_width(2);
	logframe->add(*scrolled);

	// Log buffer

	mrefTag = Gtk::TextBuffer::Tag::create();
	mrefTag->property_foreground() = "red";

	Glib::RefPtr<Gtk::TextBuffer::TagTable> refTagTable = Gtk::TextBuffer::TagTable::create();
	refTagTable->add(mrefTag);
	
	mrefLogBuffer = Gtk::TextBuffer::create(refTagTable);
	mLogEnd = mrefLogBuffer->create_mark("bottom", mrefLogBuffer->end());
	mrefLogBuffer->signal_insert().connect(sigc::mem_fun(*this, &BackupDialog::on_buffer_insert));
	
	mLogView.set_buffer(mrefLogBuffer);
	mLogView.set_editable(false);
	mLogView.set_cursor_visible(false);
	scrolled->add(mLogView);

	mpLog = new TextBufferLog(mrefTag, mrefLogBuffer, &mLogView);
	signal_delete_event().connect(
			sigc::mem_fun(*this, &BackupDialog::on_delete_it));

	show_all_children();
}