Example #1
0
void
CropForm::OnAppControlCompleteResponseReceived(const Tizen::App::AppId& appId,
		const Tizen::Base::String& operationId,
		const Tizen::App::AppCtrlResult appControlResult,
		const Tizen::Base::Collection::IMap* pResultList)
{
	if (appId.Equals(L"tizen.filemanager", true) && operationId.Equals(L"http://tizen.org/appcontrol/operation/pick", true))
	{
		AppCtrlResult selectResult = appControlResult;
		if (selectResult == APP_CTRL_RESULT_SUCCEEDED)
		{
			//Get the file name
			result r ;
			String filename;
			String* pFilePath ;
			pFilePath = (String*)(Tizen::Base::String*)pResultList->GetValue(String(L"path"));
			LoadImage(pFilePath);
		}
		else
		{
			result r;
			Frame *pFrame = Application::GetInstance()->GetAppFrame()->GetFrame();
			Form *pForm = (Form*)pFrame->GetControl(MAIN_FORM_NAME, false);
			if(pForm)
			{
				r = pFrame->SetCurrentForm(*pForm);
				pForm->Draw();
				pForm->Show();
				pFrame->RemoveControl(*this);
			}
		}
	}
}
// ----------------------------------------------------------------------------
double AdaptiveLinearVariationalSolver::
evaluate_goal(Form& M, std::shared_ptr<const Function> u) const
{
  dolfin_assert(M.num_coefficients() > 0);
  M.set_coefficient(M.num_coefficients() - 1, u);
  return assemble(M);
}
Example #3
0
FormExample::FormExample()
    : WContainerWidget()
{
  WContainerWidget *langLayout = this->addWidget(cpp14::make_unique<WContainerWidget>());
  langLayout->setContentAlignment(AlignmentFlag::Right);
  langLayout->addWidget(cpp14::make_unique<WText>(tr("language")));

  const char *lang[] = { "en", "nl" };

  for (int i = 0; i < 2; ++i) {
    WText *t = langLayout->addWidget(cpp14::make_unique<WText>(lang[i]));
    t->setMargin(5);
    t->clicked().connect(std::bind(&FormExample::changeLanguage, this, t));

    languageSelects_.push_back(t);
  }

  /*
   * Start with the reported locale, if available
   */
  setLanguage(wApp->locale().name());

  Form *form = this->addWidget(cpp14::make_unique<Form>());
  form->setMargin(20);
}
Example #4
0
// Obtain the name of the RegMask for an InstructForm
const char *ArchDesc::reg_mask(InstructForm &inForm) {
  const char *result = inForm.reduce_result();

  if (result == NULL) {
    syntax_err(inForm._linenum,
               "Did not find result operand or RegMask"
               " for this instruction: %s",
               inForm._ident);
    abort();
  }

  // Instructions producing 'Universe' use RegMask::Empty
  if( strcmp(result,"Universe")==0 ) {
    return "RegMask::Empty";
  }

  // Lookup this result operand and get its register class
  Form *form = (Form*)_globalNames[result];
  if (form == NULL) {
    syntax_err(inForm._linenum,
               "Did not find result operand for result: %s", result);
    abort();
  }
  OperandForm *oper = form->is_operand();
  if (oper == NULL) {
    syntax_err(inForm._linenum, "Form is not an OperandForm:");
    form->dump();
    abort();
  }
  return reg_mask( *oper );
}
Example #5
0
int main(int argc, char *argv[])
{
    QApplication a(argc, argv);
    QWidget window;

    QLabel* title = new QLabel("Custom widgets on a QListWidget");
    title->setAlignment(Qt::AlignHCenter);

    QListWidget* list = new QListWidget;
    list->addItem("foo");


    for (int i = 0; i < 5; i++){
        QListWidgetItem* item;
        item = new QListWidgetItem(list);
        list->addItem(item);
//        QPushButton* button = new QPushButton("hey");
        Form *f = new Form;
        item->setSizeHint(f->minimumSizeHint());
        list->setItemWidget(item, f);
    }
    list->addItem("bar");

    QVBoxLayout* layout = new QVBoxLayout(&window);
    layout->addWidget(title);
    layout->addWidget(list);
    window.setLayout(layout);

    window.show();

    return a.exec();
}
 void dump() {
   reset();
   Form *cur;
   for(; (cur =  iter()) != NULL; ) {
     cur->dump();
   };
 }
 void output(FILE* fp) {
   reset();
   Form *cur;
   for( ; (cur =  iter()) != NULL; ) {
     cur->output(fp);
   };
 }
Example #8
0
// Recursive call for construction of match lists
void ArchDesc::buildMList(MatchNode *node, const char *rootOp,
                          const char *resultOp, Predicate *pred,
                          const char *cost) {
  const char *leftstr, *rightstr;
  const char *resultop;
  const char *opcode;
  MatchNode  *mnode;
  Form       *form;

  leftstr = rightstr = NULL;
  // Do not process leaves of the Match Tree if they are not ideal
  if ((node) && (node->_lChild == NULL) && (node->_rChild == NULL) &&
      ((form = (Form *)_globalNames[node->_opType]) != NULL) &&
      (!form->ideal_only())) {
    return;
  }

  // Identify index position among ideal operands
  intptr_t    index     = _last_opcode;
  const char *indexStr  = node ? node->_opType : (char *) " ";
  index            = (intptr_t)_idealIndex[indexStr];
  if (index == 0) {
    fprintf(stderr, "error: operand \"%s\" not found\n", indexStr);
    assert(0, "fatal error");
  }

  // Build MatchLists for children
  // Check each child for an internal operand name, and use that name
  // for the parent's matchlist entry if it exists
  mnode = node->_lChild;
  if (mnode) {
    buildMList(mnode, NULL, NULL, NULL, NULL);
    leftstr = mnode->_internalop ? mnode->_internalop : mnode->_opType;
  }
  mnode = node->_rChild;
  if (mnode) {
    buildMList(mnode, NULL, NULL, NULL, NULL);
    rightstr = mnode->_internalop ? mnode->_internalop : mnode->_opType;
  }
  // Grab the string for the opcode of this list entry
  if (rootOp == NULL) {
    opcode = (node->_internalop) ? node->_internalop : node->_opType;
  } else {
    opcode = rootOp;
  }
  // Grab the string for the result of this list entry
  if (resultOp == NULL) {
    resultop = (node->_internalop) ? node->_internalop : node->_opType;
  }
  else resultop = resultOp;
  // Search for an identical matchlist entry already on the list
  if ((_mlistab[index] == NULL) || (_mlistab[index] &&
                                    !_mlistab[index]->search(opcode, resultop, leftstr, rightstr, pred))) {
    // Place this match rule at front of list
    MatchList *mList =
      new MatchList(_mlistab[index],pred,cost,
                    opcode, resultop, leftstr, rightstr);
    _mlistab[index] = mList;
  }
}
Example #9
0
void	OfficeBlock::doBureaucracy(const std::string& form_name, const std::string& target) const
{
	if (this->_intern && this->_b_sign && this->_b_exec)
	{
		Form 	*f = this->_intern->makeForm(form_name, target);
		if (f)
		{
			std::cout << "Intern make a form of type \"" << form_name << "\": " << *f;
			f->beSigned(*this->_b_sign);
			std::cout << "Bureaucrat " << this->_b_sign->getName() << " signed the form " << f->getName() << std::endl;
			f->execute(*this->_b_exec);
			std::cout << "Bureaucrat " << this->_b_exec->getName() << " execute the form " << f->getName() << std::endl;
			delete f;
		} else {
			std::cerr << "Intern can't make a Form of type \"" << form_name << "\"" << std::endl;
		}
	} else {
		if (!this->_intern)
			std::cerr << "An Intern is required in OfficeBlock" << std::endl;
		if (!this->_b_sign)
			std::cerr << "An Bureaucrat is required in OfficeBlock to sign the form" << std::endl;
		if (!this->_b_exec)
			std::cerr << "An Bureaucrat is required in OfficeBlock to execute the form" << std::endl;
	}
}
Example #10
0
void UITransform::transformForm2Object(Form& form, SkillsInformation& info)
{
	info.setCategoryId( form.getText("Category Id"));
	info.setSkillDescription( form.getText("Skill Description"));
	info.setSkillId( form.getText("Skill Id"));
	info.setSkillName(form.getText("Skill Name"));
	info.setStatus( form.getText("Skill Status"));
}
Example #11
0
Form* Form::create(const char* id, Theme::Style* style, Layout::Type layoutType)
{
	Form* form = new Form();
	form->_id = id ? id : "";
	form->_layout = createLayout(layoutType);
	form->initialize("Form", style, NULL);
	return form;
}
Example #12
0
int main(int argc, char *argv[])
{
    QApplication a(argc, argv);
    Form w;

    w.show();
    return a.exec();
}
Example #13
0
int main(int argc, char *argv[])
{
  QApplication app(argc, argv);
  Form form;

  form.show();
  return app.exec();
}
Example #14
0
void FormsSample::initialize()
{
    setMultiTouch(true);
    setVsync(false);

    _formSelect = Form::create("res/common/forms/formSelect.form");
    _formSelect->setFocus();

    RadioButton* form0Button = static_cast<RadioButton*>(_formSelect->getControl("form0"));
    form0Button->addListener(this, Control::Listener::CLICK);

    RadioButton* form1Button = static_cast<RadioButton*>(_formSelect->getControl("form1"));
    form1Button->addListener(this, Control::Listener::CLICK);

    RadioButton* form2Button = static_cast<RadioButton*>(_formSelect->getControl("form2"));
    form2Button->addListener(this, Control::Listener::CLICK);
    
    RadioButton* form3Button = static_cast<RadioButton*>(_formSelect->getControl("form3"));
    form3Button->addListener(this, Control::Listener::CLICK);

    RadioButton* form4Button = static_cast<RadioButton*>(_formSelect->getControl("form4"));
    form4Button->addListener(this, Control::Listener::CLICK);
    
    RadioButton* form5Button = static_cast<RadioButton*>(_formSelect->getControl("form5"));
    form5Button->addListener(this, Control::Listener::CLICK);
    for (unsigned int i = 0; i < _formFiles.size(); i++)
    {
		Form* form = Form::create(_formFiles[i]);
        form->setEnabled(false);
        _forms.push_back(form);
    }
    _formIndex = 0;

    // Create a form programmatically.
    createSampleForm();

    Button* button = static_cast<Button*>(_forms[0]->getControl("testButton"));
    button->setFocus();

    // Create a scene with a camera node.
    Camera* camera = Camera::createPerspective(45.0f, (float)getWidth() / (float)getHeight(), 0.25f, 100.0f);
    _scene = Scene::create();
    Node* cameraNode = _scene->addNode("Camera");
    cameraNode->setCamera(camera);
    _scene->setActiveCamera(camera);
    SAFE_RELEASE(camera);
    _formNodeParent = _scene->addNode("FormParent");
    _formNode = Node::create("Form");
    _formNodeParent->addChild(_formNode);
    
    formChanged();

    _gamepad = getGamepad(0);
    // This is needed because the virtual gamepad is shared between all samples.
    // SamplesGame always ensures the virtual gamepad is disabled when a sample is exited.
    if (_gamepad && _gamepad->isVirtual())
        _gamepad->getForm()->setEnabled(true);
}
Example #15
0
int main( int argc, char ** argv )
{
	QApplication a(argc, argv);
	Form f;

	f.show();

	return a.exec();
}
Example #16
0
void Bureaucrat::signForm(Form & form)
{
	try {
		form.beSigned(*this);
		std::cout << this->_name << " signs " << form.getName() << std::endl;
	} catch (std::exception &e) {
		std::cout << this->_name << " cannot sign " << form.getName() << " because " << e.what() << std::endl;
	}
}
Example #17
0
void Bureaucrat::executeForm(Form const & form)
{
	try {
		form.execute(*this);
		std::cout << this->_name << " executes " << form.getName() << std::endl;
	} catch (std::exception & e) {
		std::cout << this->_name << " can't execute " << form.getName() << " : " << e.what() << std::endl;
	}
}
void InputSample::initialize()
{
    setMultiTouch(true);

    // Load font
    _font = Font::create("res/ui/arial.gpb");
    assert(_font);

    // Reuse part of the gamepad texture as the crosshair in this sample.
    _crosshair = SpriteBatch::create("res/png/gamepad.png");
    _crosshairDstRect.set(0, 0, 256, 256);
    _crosshairSrcRect.set(256, 0, 256, 256);
    _crosshairLowerLimit.set(-_crosshairSrcRect.width / 2.0f, -_crosshairSrcRect.height / 2.0f);
    _crosshairUpperLimit.set((float)getWidth(), (float)getHeight());
    _crosshairUpperLimit += _crosshairLowerLimit;

    // Create input sample controls
    _keyboardState = false;
    _inputSampleControls = Form::create("res/common/inputs.form");
    static_cast<Button*>(_inputSampleControls->getControl("showKeyboardButton"))->addListener(this, Listener::CLICK);
    static_cast<Button*>(_inputSampleControls->getControl("captureMouseButton"))->addListener(this, Listener::CLICK);

    if (!hasMouse())
    {
        static_cast<Button*>(_inputSampleControls->getControl("captureMouseButton"))->setVisible(false);
    }
    _inputSampleControls->getControl("restoreMouseLabel")->setVisible(false);

    _mousePoint.set(-100, -100);

    // Create a 3D form that responds to raw sensor inputs.
    // For this, we will need a scene with a camera node.
    Camera* camera = Camera::createPerspective(45.0f, (float)getWidth() / (float)getHeight(), 0.25f, 100.0f);
    _scene = Scene::create();
    Node* cameraNode = _scene->addNode("Camera");
    cameraNode->setCamera(camera);
    _scene->setActiveCamera(camera);
    SAFE_RELEASE(camera);
    _formNodeParent = _scene->addNode("FormParent");
    _formNode = Node::create("Form");
    _formNodeParent->addChild(_formNode);
    Theme* theme = _inputSampleControls->getTheme();
    Form* form = Form::create("testForm", theme->getStyle("basicContainer"), Layout::LAYOUT_ABSOLUTE);
    form->setSize(225, 100);
    Label* label = Label::create("sensorLabel", theme->getStyle("iconNoBorder"));
    label->setPosition(25, 15);
    label->setSize(175, 50);
    label->setText("Raw sensor response (accel/gyro)");
    form->addControl(label);
    label->release();
    _formNode->setScale(0.0015f, 0.0015f, 1.0f);
    _formNodeRestPosition.set(0, 0, -1.5f);
    _formNodeParent->setTranslation(_formNodeRestPosition);
    _formNode->setTranslation(-0.2f, -0.2f, 0);
    _formNode->setDrawable(form);
    form->release();
}
Example #19
0
void				Bureaucrat::executeForm(Form & form) const {
	try {
		form.execute(*this);
		std::cout << _name << " executes " << form.getName() << std::endl;
	} catch (std::exception & e) {
		std::cout << _name << " cannot execute " << form.getName();
		std::cout << " because " << e.what() << std::endl;
	}
}
Example #20
0
int main(int argc, char *argv[])
{
    QApplication app(argc, argv);

    Form widget;
    widget.show();

    return app.exec();
}
Example #21
0
void UITransform::transformForm2Object(Form& form, SkillCategory& info)
{
	info.setCategoryDescription(form.getText("Category Description"));
	info.setCategoryName(form.getText("Category Name"));
	info.setStatus(form.getText("Category Status"));
	
    
    //info.setSkillList(form.getText("SkillList"));
}
Example #22
0
void UITransform::transformObject2Form(SkillsInformation& info, Form& form)
{
	form.setText("Category Id",info.getCategoryId());
	form.setText("Skill Description",info.getSkillDescription());
	form.setText("Skill Id",info.getSkillId());
	form.setText("Skill Name",info.getSkillName());
	form.setText("Skill Status",info.getStatus());

}
Example #23
0
void				Bureaucrat::signForm( Form & form ) const {
	try {
		form.beSigned(*this);
		std::cout << _name << "signs form [" << form.getName() << "]" << std::endl;
	} catch (Form::GradeTooLowException & e) {
		std::cout << _name << " cannot sign form [" << form.getName() << "] because";
		std::cout << " " << e.what() << std::endl;
	}
}
Example #24
0
void FormMgr::BreakCapture()
{
    Form *pfrm = GetFormCapture();
    if (pfrm == NULL) {
        return;
    }
    pfrm->BreakCapture();
    m_idfCapture = 0;
    m_cCaptureDowns = 0;
}
Example #25
0
void FormController::CloseForm()
{
	if (m_formStack->Size() > 0) {
		Form *form = static_cast<Form*>(m_formStack->Top());
		form->OnClose();
		onClose.emit(form);
	}
	m_formStack->Pop();
	Refresh();
}
Example #26
0
bool Bureaucrat::executeForm(Form const & form)
{
	try {
		form.execute(*this);
		return true;
	} catch (std::exception & e) {
		std::cout << this->_name << " can't execute " << form.getName() << " : " << e.what() << std::endl;
	}
	return false;
}
Example #27
0
		Form & operator()(Args &&... args) const
		{
			Form* res = detail::bedrock::instance().rt_manager.create_form<Form>(std::forward<Args>(args)...);
			if (nullptr == res)
				throw nana::bad_window("form_loader.operator(): failed to create a window");

			if (IsMakeVisible) res->show();

			return *res;
		}
Example #28
0
void Bureaucrat::signForm(Form &src) {

    src.beSigned(*this);
    if (src.getGradeSign() >= this->getGrade()) {
        std::cout << "<" << this->name << "> signs " << src.getName() << std::endl;
    }
    else {
        std::cout << "<" << this->name << "> cannot signs " << src.getName() << " because " << "the form grade is too low" << std::endl;
    }
}
Example #29
0
void Bureaucrat::executeForm(Form const &form) {
    try {
        form.execute(*this);
        std::cout << "<bureaucrat> executes <" << form.getName() << ">" << std::endl;

    }
    catch (std::exception &e) {
        std::cout << e.what() << std::endl;
    }
}
/** Show function pointer */
extern "C" MidpError
form_show(MidpFrame* framePtr) {

  Form *f = (Form *)framePtr->widgetPtr;
  PlatformMScreen::getMScreen()->addChild(f);

  f->show();

 return KNI_OK;
}