Пример #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();
}
Пример #2
0
    Gtk::Box *SmartChessWindow::createLogArea() {
        Gtk::Box * box = Gtk::manage(new Gtk::Box(Gtk::ORIENTATION_VERTICAL));
        box->set_vexpand();
        box->set_hexpand(false);

        Gtk::TextView* pTextView = Gtk::manage(new Gtk::TextView(Gtk::TextBuffer::create()));
        pTextView->set_vexpand();
        pTextView->set_hexpand(false);

        Gtk::ScrolledWindow* scrolledWindow = Gtk::manage(new Gtk::ScrolledWindow());
        scrolledWindow->set_vexpand();
        scrolledWindow->set_hexpand(false);
        scrolledWindow->add(*pTextView);

        box->pack_end(*scrolledWindow);

        return box;
    }