void c_SelectPointsDlg::InitControls(bool hasAutoBtn) { m_ImgView.signal_ImageAreaBtnPress().connect(sigc::mem_fun(*this, &c_SelectPointsDlg::OnImageBtnPress)); m_ImgView.signal_DrawImageArea().connect(sigc::slot<bool, const Cairo::RefPtr<Cairo::Context>&>( [this](const Cairo::RefPtr<Cairo::Context> &cr) { for (auto &pt: m_Points) Utils::DrawAnchorPoint(cr, m_ImgView.GetZoomPercentVal() * pt.x / 100, m_ImgView.GetZoomPercentVal() * pt.y / 100); return false; } )); m_ImgView.show(); Gtk::Button *btnRemovePts = Gtk::manage(new Gtk::Button(_("Remove points"))); btnRemovePts->signal_clicked().connect(sigc::mem_fun(*this, &c_SelectPointsDlg::OnRemoveClick)); btnRemovePts->show(); Gtk::Button *btnAuto = 0; if (hasAutoBtn) { btnAuto = Gtk::manage(new Gtk::Button(_("Automatic"))); btnAuto->signal_clicked().connect(sigc::mem_fun(*this, &c_SelectPointsDlg::OnAutoClick)); btnAuto->show(); } Gtk::HButtonBox *btnBox = Gtk::manage(new Gtk::HButtonBox()); btnBox->set_layout(Gtk::ButtonBoxStyle::BUTTONBOX_START); btnBox->pack_start(*btnRemovePts, Gtk::PackOptions::PACK_SHRINK); if (hasAutoBtn) { btnBox->pack_start(*btnAuto, Gtk::PackOptions::PACK_SHRINK); } btnBox->show(); get_content_area()->pack_start(*btnBox, Gtk::PackOptions::PACK_SHRINK, Utils::Const::widgetPaddingInPixels); get_content_area()->pack_start(m_ImgView, Gtk::PackOptions::PACK_EXPAND_WIDGET, Utils::Const::widgetPaddingInPixels); m_InfoText.set_alignment(Gtk::ALIGN_START, Gtk::ALIGN_CENTER); m_InfoText.set_ellipsize(Pango::EllipsizeMode::ELLIPSIZE_END); m_InfoText.set_lines(2); get_content_area()->pack_start(m_InfoText, Gtk::PackOptions::PACK_SHRINK, Utils::Const::widgetPaddingInPixels); auto separator = Gtk::manage(new Gtk::Separator()); separator->show(); get_content_area()->pack_end(*separator, Gtk::PackOptions::PACK_SHRINK, Utils::Const::widgetPaddingInPixels); add_button(_("OK"), Gtk::RESPONSE_OK); add_button(_("Cancel"), Gtk::RESPONSE_CANCEL); }
Movie::Progress::Progress(MovieWindow& _parent, const struct MovieInfo &_movie, Movie::Renderer& _ren) : parent(_parent), renderer(_ren), chunks_done(0), chunks_count(0), frames_done(-1), npixels(_movie.height * _movie.width * (_movie.antialias ? 4 : 1)), nframes(_movie.count_frames()), movie(_movie) { // Precondition: GDK threads lock held vbox = Gtk::manage(new Gtk::VBox()); plotbar = Gtk::manage(new Gtk::ProgressBar()); framebar = Gtk::manage(new Gtk::ProgressBar()); moviebar = Gtk::manage(new Gtk::ProgressBar()); set_title("Movie progress"); set_type_hint(Gdk::WindowTypeHint::WINDOW_TYPE_HINT_UTILITY); Gtk::Label *lbl; #define LABEL(_txt) do { lbl = Gtk::manage(new Gtk::Label(_txt)); vbox->pack_start(*lbl); } while(0) LABEL("Current pass"); vbox->pack_start(*plotbar); LABEL("Current plot"); vbox->pack_start(*framebar); LABEL("Overall"); vbox->pack_start(*moviebar); Gtk::HButtonBox *bbox = Gtk::manage(new Gtk::HButtonBox()); vbox->pack_end(*bbox); cancel_btn = Gtk::manage(new Gtk::Button("Cancel")); cancel_btn->signal_clicked().connect(sigc::mem_fun(*this, &Movie::Progress::do_cancel)); bbox->pack_end(*cancel_btn); add(*vbox); show_all(); Glib::signal_timeout().connect( sigc::mem_fun(*this, &Movie::Progress::on_timer), 300 ); // Cannot call plot_complete() here as we already hold the GDK lock frames_traversed_gdklocked(1); // And set up an initial position.. Try to put this left of the Movie window. // This is tricky as the window resizes itself around its content soon after construction. // For now I'm going to cheat horribly and hard-wire what it ends up as on my machine :-) #define ASSUMED_PROGRESS_WIDTH 280 int ww, hh, px, py; Util::get_screen_geometry(*this, ww, hh); parent.get_position(px, py); int xx = px - ASSUMED_PROGRESS_WIDTH; int yy = py; // Put at same Y placement as parent, unless we don't fit if (yy + get_height() + 20 > hh) yy = hh - get_height() - 20; Util::fix_window_coords(*this, xx, yy); // Sanity check move(xx,yy); }
PanelMundo::PanelMundo() { pathFileMundos = RUTA_CARPETA_MUNDOS; pathFileMundos += "mundos.xml"; set_size_request(ANCHO_WIZARD, ALTO_WIZARD); cargarNombreMundos(); // Widgets con funcionalidad botonEditar = new Gtk::Button("Editar mundo seleccionado"); botonCrear = new Gtk::Button("Crear mundo nuevo"); selector = new SelectorMundos(nombreMundos); creador = new CreadorMundo(nombreMundos); // Contenedores Gtk::VBox* cajaVertical = manage(new Gtk::VBox(true, 30)); Gtk::HBox* cajaHorizontalUno = manage(new Gtk::HBox(false, 20)); Gtk::HBox* cajaHorizontalDos = manage(new Gtk::HBox(false, 20)); Gtk::Frame* cuadroEditar = manage(new Gtk::Frame("Edite un mundo existente")); Gtk::Frame* cuadroCrear = manage(new Gtk::Frame("Cree un mundo nuevo")); cajaHorizontalUno->pack_start(*selector); Gtk::HButtonBox* cajaAuxiliarUno = manage(new Gtk::HButtonBox()); cajaAuxiliarUno->set_layout(Gtk::BUTTONBOX_CENTER); cajaAuxiliarUno->pack_start(*botonEditar, Gtk::PACK_SHRINK); cajaHorizontalUno->pack_start(*cajaAuxiliarUno, Gtk::PACK_SHRINK); cajaHorizontalDos->pack_start(*creador); Gtk::HButtonBox* cajaAuxiliarDos = manage(new Gtk::HButtonBox()); cajaAuxiliarDos->set_layout(Gtk::BUTTONBOX_CENTER); cajaAuxiliarDos->pack_start(*botonCrear, Gtk::PACK_SHRINK); cajaHorizontalDos->pack_start(*cajaAuxiliarDos, Gtk::PACK_SHRINK); cuadroEditar->add(*cajaHorizontalUno); cuadroCrear->add(*cajaHorizontalDos); cajaVertical->pack_start(*cuadroEditar); cajaVertical->pack_start(*cuadroCrear); add(*cajaVertical); // Seniales botonEditar->signal_clicked().connect(sigc::mem_fun(*this, &PanelMundo::botonEditarClickeado)); botonCrear->signal_clicked().connect(sigc::mem_fun(*this, &PanelMundo::botonCrearClickeado)); }
static void MakeButtonAreaHIGed(Gtk::HButtonBox& action_area) { action_area.set_border_width(0); action_area.set_spacing(WDG_BORDER_WDH); }