void Menu::key_cancel() { if (signal_cancel()) { play_cancel_sound(); close_menu = true; } }
TheDummyAssistant(openfluid::machine::SimulationBlob* SimBlob) : Gtk::Assistant(), mp_SimBlob(SimBlob), mp_TestUnitsColl(0), m_Applied(false) { set_title("Dummy assistant"); set_default_size(400, 300); set_modal(true); Gtk::Label* Label1 = Gtk::manage(new Gtk::Label( "I'm a Dummy assistant for tests")); append_page(*Label1); set_page_title(*Label1, "Page 1/2"); set_page_type(*Label1, Gtk::ASSISTANT_PAGE_INTRO); set_page_complete(*Label1, true); Gtk::Label* Label2 = Gtk::manage(new Gtk::Label()); if (!mp_SimBlob) { Label2->set_text("Nb of units in TestUnits class: no CoreRepository\n" "Nothing to do"); signal_apply().connect(sigc::mem_fun(*this, &Gtk::Assistant::hide)); } else { unsigned int Size = 0; mp_TestUnitsColl = mp_SimBlob->getCoreRepository().getUnits("TestUnits"); if (mp_TestUnitsColl) Size = mp_TestUnitsColl->getList()->size(); Label2->set_text(Glib::ustring::compose( "Nb of units in TestUnits class: %1\n" "Clicking ok will add a Unit of class \"TestUnits\"", Size)); signal_apply().connect( sigc::mem_fun(*this, &TheDummyAssistant::m_apply)); } append_page(*Label2); set_page_title(*Label2, "Page 2/2"); set_page_type(*Label2, Gtk::ASSISTANT_PAGE_CONFIRM); set_page_complete(*Label2, true); signal_cancel().connect(sigc::mem_fun(*this, &Gtk::Assistant::hide)); signal_close().connect(sigc::mem_fun(*this, &Gtk::Assistant::hide)); show_all_children(); }
DialogWait::DialogWait(QWidget *parent, bool animation, bool closeBtnHint) : QDialog(parent, Qt::FramelessWindowHint), animationHint(animation), isAltF4Flag(false), cycl(NULL), labelText(NULL), closeBtn(NULL), alpha(int(255 * 0.75)) { setAttribute(Qt::WA_TranslucentBackground); // cycl cycl = new ZCyclProgress(":/images/loading.png", 6, this); cycl->setFixedSize(QPixmap(":/images/loading.png").size()); // text labelText = new QLabel(this); labelText->setStyleSheet("color: white;"); // close btn closeBtn = new QPushButton(tr("Cancel"), this); closeBtn->setObjectName("closeBtn"); closeBtn->setStyleSheet("#closeBtn {background-color: transparent; border: none; font: 12px; color: #33B6FF;}"); closeBtn->setMinimumSize(40, 15); closeBtn->setMaximumSize(40, 15); connect(closeBtn, SIGNAL(clicked()), SIGNAL(signal_cancel())); connect(closeBtn, SIGNAL(clicked()), SLOT(close())); closeBtn->setVisible(closeBtnHint); // layout QHBoxLayout *layout = new QHBoxLayout(this); layout->setSpacing(6); layout->setContentsMargins(9, 9, 9, 9); layout->addItem(new QSpacerItem(0, 40, QSizePolicy::Expanding, QSizePolicy::Preferred)); layout->addWidget(cycl); layout->addWidget(labelText); if (closeBtnHint) { layout->addItem(new QSpacerItem(0, 40, QSizePolicy::Expanding, QSizePolicy::Preferred)); } layout->addWidget(closeBtn); layout->setAlignment(closeBtn, Qt::AlignCenter); layout->addItem(new QSpacerItem(0, 40, QSizePolicy::Expanding, QSizePolicy::Preferred)); setLayout(layout); installEventFilter(this); closeBtn->installEventFilter(this); setStyleSheet("QDialog {border: none;}"); }
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 ) ); }