bool GstPropertiesModule::update_property(const std::shared_ptr<GValueBase>& value_base, const std::string prop_name) { for (auto internal_box : properties_box->get_children()) { Gtk::Box *hb = dynamic_cast<Gtk::Box*>(internal_box); if (hb == nullptr) { continue; } if (reinterpret_cast<gchar*>(hb->get_data("property-name")) != prop_name) continue; for (auto widget : hb->get_children()) { if (widget->get_data("is-gvalue-widget") == GINT_TO_POINTER(1)) { bool sensitive = widget->get_sensitive(); hb->remove(*widget); widget = value_base->get_widget(); widget->set_sensitive(sensitive); widget->show(); hb->pack_start(*widget, true, 10); hb->reorder_child(*widget, 1); return true; } } } return false; }
void FormImpl::set_menubar(mforms::Form *self, mforms::MenuBar *menu) { FormImpl* form = self->get_data<FormImpl>(); Gtk::MenuBar *mbar = widget_for_menubar(menu); if (form && mbar) { Gtk::Box *box = dynamic_cast<Gtk::Box*>(self->get_content()->get_data<ViewImpl>()->get_inner()); if (!box) throw std::logic_error("set_menubar called on a window without a Box as toplevel content"); box->pack_start(*mbar, false, true); box->reorder_child(*mbar, 0); on_add_menubar_to_window(menu, form->_window); } }