Ejemplo n.º 1
0
DeviceSelector::DeviceSelector()
{
  //domyślny rozmiar okna
  set_default_size(600, 300);
  //przyciski
  ok.set_label("OK");
  ok.set_sensitive(false);
  cancel.set_label("Anuluj");
  start_search.set_label("Szukaj urządzeń");

  //umieszczenie prezycisków
  hbox.pack_start(ok);
  hbox.pack_start(cancel);
  hbox.pack_start(start_search);

  //łączenie przycisków z akcjami
  start_search.signal_clicked().connect(sigc::mem_fun(*this, &DeviceSelector::start_search_clicked));
  ok.signal_clicked().connect(sigc::mem_fun(*this, &DeviceSelector::ok_clicked));
  cancel.signal_clicked().connect(sigc::mem_fun(*this, &DeviceSelector::cancel_clicked));


  //widok listy
  scrolled_window.add(view);
  ref_tree_model = Gtk::ListStore::create(dtn);
  view.set_model(ref_tree_model);
  scrolled_window.set_size_request(400, 300);

  //kolumny
  view.append_column("Nazwa", dtn.col_name);
  view.append_column("MAC", dtn.col_MAC);

  //umieszczenie pionowe
  //vbox.pack_start(scrolled_window, Gtk::PACK_EXPAND_PADDING);
  //vbox.pack_end(hbox, Gtk::PACK_SHRINK);

  //umieszczenie vboxa w oknie
  Gtk::Box *tmp = get_content_area();
  tmp->pack_start(scrolled_window, Gtk::PACK_EXPAND_PADDING);
  tmp->pack_end(hbox, Gtk::PACK_SHRINK);
  //tmp->pack_start(vbox, Gtk::PACK_EXPAND_WIDGET);

  //wyświetlenie
  tmp->show_all_children(true);

  //wyświetlanie urządzeń
  this->signal_devices_ready().connect(sigc::mem_fun(*this, &DeviceSelector::on_devices_ready));

  exiting = exited = false;

  //szukanie urządzeń
  search();
}
Ejemplo n.º 2
0
GenericAssistant::GenericAssistant
(
	std::string assistantTitle,
	std::vector<std::string> assistantLabels,
	std::vector<std::string> assistantPlaceholders,
	bool assistantModalMode
)
{
	set_title(assistantTitle);
	set_default_size (323, 200);
	set_modal(assistantModalMode);
	
	container = manage(new Gtk::Box(Gtk::ORIENTATION_VERTICAL,(2*assistantLabels.size())-1));
	
	for (unsigned int i=0;i<assistantLabels.size();i++) 
	{
		
		Gtk::Box * b = manage(new Gtk::Box(Gtk::ORIENTATION_HORIZONTAL,3));
		Gtk::Label * l = manage(new Gtk::Label(assistantLabels.at(i)));
		b->add(*l);
		Gtk::AspectFrame * af = manage(new Gtk::AspectFrame());
		b->add(*af);
		// entry and placeholder....
		Gtk::Entry * e = manage(new Gtk::Entry());
		e->set_placeholder_text(assistantPlaceholders.at(i).c_str());
		b->add(*e);
		// record the entry's content
		Entry.push_back(e);
		// show_children
		b->show_all_children();
		// add
		container->add(*b);
		if (assistantLabels.size()-1 != i) 
		{
			Gtk::AspectFrame * af = manage(new Gtk::AspectFrame());
			container->add(*af);	
		} 
	}
	container->show_all_children();
	// set assistant pages and config it
	append_page(*container);
	set_page_complete(*container, true);	
	set_page_type(*container, Gtk::ASSISTANT_PAGE_CONFIRM);
	show_all_children();
	// close or cancel the assistant
	signal_cancel().connect
	(
		sigc::mem_fun
		(
			*this,
			&GenericAssistant::on_assistant_cancel
		)
	);
	signal_close().connect
	(
		sigc::mem_fun
		(
			*this,
			&GenericAssistant::on_assistant_close
		)
	);

}