Beispiel #1
0
void MWO_EqualsElementCopyResize::operator()(const MatrixAliasConstant& copy) const
{
		unsigned int i, j;

		//printf("MWO_EqualsElementCopyResize called\n");

		//printf("copy.getRows():%d\ngetRows():%d\ncopy.getColumns():%d\ncopy.getColumns():%d\n",copy.getRows(),getRows(),copy.getColumns(),copy.getColumns());

		if(copy.getRows() != getRows() || copy.getColumns() != getColumns()) {
			// Resize!!

			// Change values
			setRows(copy.getRows());
			setColumns(copy.getColumns());

			// Delete old memory
			delete[] getDataPointer();

			// Allocate new memory
			setDataPointer(new double[getRows()*getColumns()]);
		}


		for (i = 0; i < getRows(); i++) {
			for (j = 0; j < getColumns(); j++) {
				element(i, j) = copy.element(i, j);
			}
		}

}
Beispiel #2
0
void CVWO_EqualsElementCopyResize::operator()(const MatrixAliasConstant& copy) const
{
		unsigned int i;

		if(copy.isColumnVector() == 0)
		{
			error("CVWO_EqualsElementCopyResize: Matrix to copy is not a column vector\n");
			return;
		}


		if(copy.getRows() != getRows()) {
			// Resize!!

			// Change values
			setRows(copy.getRows());

			// Delete old memory
			delete[] getDataPointer();

			// Allocate new memory
			setDataPointer(new double[getRows()]);
		}


		for (i = 0; i < getRows(); i++) {
			element(i, 0) = copy.element(i, 0);
		}

}
ZobristHash::ZobristHash(int rows, int cols, int statesPerSquare)
{
	setRows(rows);
	setCols(cols);
	setStatesPerSquare(statesPerSquare);
	initTable();
}
Beispiel #4
0
void core::DotMatrix::init(int dotSize, int rows, int cols, DataFormat dt)
{
	this->size = dotSize;

	//QActions
	continuousDrawingAction = new QAction(ICON_FREEHAND, "Dibujo continuo", this);
	clearAction = new QAction(ICON_CLEAR, "Limpiar", this);
	fillAction = new QAction(ICON_FILL, "Llenar", this);
	eraserAction = new QAction(ICON_ERASER, "Borrador", this);

	continuousDrawingAction->setCheckable(true);
	eraserAction->setCheckable(true);

	contextMenu.insertAction(getLockAction(), continuousDrawingAction);
	contextMenu.insertAction(continuousDrawingAction, fillAction);
	contextMenu.insertAction(fillAction, clearAction);
	contextMenu.insertAction(clearAction, eraserAction);

	setEnableContinuousDrawing(true);
	setEnableEraserPen(false);

	setRows(rows);
	setCols(cols);

	setEnableEdit(true);
	setBorder(QPen(Qt::black, 1));
	setContainerRect(getContainer());
	setDataType(dt);

	connect(continuousDrawingAction, SIGNAL(triggered(bool)), SLOT(setEnableContinuousDrawing(bool)));
	connect(clearAction, SIGNAL(triggered()), SLOT(clear()));
	connect(fillAction, SIGNAL(triggered()), SLOT(fill()));
	connect(eraserAction, SIGNAL(triggered(bool)), SLOT(setEnableEraserPen(bool)));
}
Heightmap::Heightmap(int columns, int rows) {
    setColumns(columns);
    setRows(rows);
    
    vector<vec3> vertices;
    vector<unsigned int> indices;
    vector<vec2> texcoords;
    for(int z = 0; z <= rows; z++) {
        for(int x = 0; x <= columns; x++) {
            vertices.push_back(vec3(x*(1.0f/columns), 0, z*(1.0f/rows)));
            texcoords.push_back(vec2(x*0.5f, z*0.5f));
        }
    }
    
    for(int row = 0; row < rows; row++) {
        for(int column = 0; column < columns; column++) {
            indices.push_back(column + row * (columns + 1));
            indices.push_back(column + (row + 1) * (columns + 1));
            indices.push_back(column + 1 + row * (columns + 1));
            indices.push_back(column + 1 + row * (columns + 1));
            indices.push_back(column + (row + 1) * (columns + 1));
            indices.push_back(column + 1 + (row + 1) * (columns + 1));
        }
    }
    
    setVertices(vertices);
    setIndices(indices);
    setTexcoords(texcoords);
    material.setSpecularReflectance(0.05f);
    material.setShininess(1.0f);
    material.setAmbientReflectance(0.5f);
    init();
    calculateNormals();
}
Beispiel #6
0
void pHexEdit::constructor() {
  qtWidget = qtHexEdit = new QtHexEdit(*this);

  qtHexEdit->setHorizontalScrollBarPolicy(Qt::ScrollBarAlwaysOff);
  qtHexEdit->setVerticalScrollBarPolicy(Qt::ScrollBarAlwaysOff);
  qtHexEdit->setTextInteractionFlags(Qt::TextSelectableByKeyboard | Qt::TextSelectableByMouse);

  qtLayout = new QHBoxLayout;
  qtLayout->setAlignment(Qt::AlignRight);
  qtLayout->setMargin(0);
  qtLayout->setSpacing(0);
  qtHexEdit->setLayout(qtLayout);

  qtScroll = new QtHexEditScrollBar(*this);
  qtScroll->setSingleStep(1);
  qtLayout->addWidget(qtScroll);

  connect(qtScroll, SIGNAL(actionTriggered(int)), SLOT(onScroll()));

  pWidget::synchronizeState();
  setColumns(hexEdit.state.columns);
  setRows(hexEdit.state.rows);
  setLength(hexEdit.state.length);
  setOffset(hexEdit.state.offset);
  update();
}
Beispiel #7
0
void SqMWO_EqualsElementCopyResize::operator()(const MatrixAliasConstant& copy) const
{
		unsigned int i, j;

		if(copy.isSquareMatrix() == 0)
		{
			error("SqMWO_EqualsElementCopyResize: Matrix to copy is not a square matrix\n");
			return;
		}


		if(copy.getColumns() != getColumns()) {
			// Resize!!

			// Change values
			setRows(copy.getRows());
			setColumns(copy.getColumns());

			// Delete old memory
			delete[] getDataPointer();

			// Allocate new memory
			setDataPointer(new double[getRows()*getColumns()]);
		}


		for (i = 0; i < getRows(); i++) {
			for (j = 0; j < getColumns(); j++) {
				element(i, j) = copy.element(i, j);
			}
		}
}
Beispiel #8
0
		int MiniConsole::dump()
		{
			/*
			 * We dump on screen the textual console contents.
			 * We care about user set variables.
			 * */
			int co=getGlobalIntVariable(FIM_VID_CONSOLE_LINE_OFFSET);
			int lw=getGlobalIntVariable(FIM_VID_CONSOLE_LINE_WIDTH );
			int ls=getGlobalIntVariable(FIM_VID_CONSOLE_ROWS       );
			setGlobalVariable(FIM_VID_CONSOLE_BUFFER_TOTAL,bsize);
			setGlobalVariable(FIM_VID_CONSOLE_BUFFER_FREE,(int)bsize-(int)(bp-buffer));
			setGlobalVariable(FIM_VID_CONSOLE_BUFFER_USED,(int)(bp-buffer));
			// we eventually update internal variables now
			setRows(ls);
			if( lw > 0 && lw!=lwidth ) reformat(lw);
			if(co>=0)
			{
				scroll=scroll%(rows+1);
				if(scroll>0)
					return do_dump((cline-rows+1-co)>=0?(cline-(rows-scroll)+1-co):0,cline-co);
				else
					return do_dump((cline-rows+1-co)>=0?(cline-rows+1-co):0,cline-co);
			}
			else
				return do_dump(-co-1,cline);
			return -1;
		}
Beispiel #9
0
bool VideoPreview::showConfigDialog(QWidget *parent)
{
    VideoPreviewConfigDialog d(parent);

    d.setVideoFile(videoFile());
    d.setDVDDevice(DVDDevice());
    d.setCols(cols());
    d.setRows(rows());
    d.setInitialStep(initialStep());
    d.setMaxWidth(maxWidth());
    d.setDisplayOSD(displayOSD());
    d.setAspectRatio(aspectRatio());
    d.setFormat(extractFormat());
    d.setSaveLastDirectory(save_last_directory);

    if (d.exec() == QDialog::Accepted) {
        setVideoFile(d.videoFile());
        setDVDDevice(d.DVDDevice());
        setCols(d.cols());
        setRows(d.rows());
        setInitialStep(d.initialStep());
        setMaxWidth(d.maxWidth());
        setDisplayOSD(d.displayOSD());
        setAspectRatio(d.aspectRatio());
        setExtractFormat(d.format());
        save_last_directory = d.saveLastDirectory();

        return true;
    }

    return false;
}
void CameraLayout::setGrid( int rows, int columns ){
    //clear all widgets;
    setRows( rows );
    setColumns ( columns );
    reset();

}
Beispiel #11
0
TableViewImpl * TableViewImpl::clone() const
{
    auto result = std::make_unique<TableViewImpl>(getParentHandle(),getControlData());    
    ListView_SetExtendedListViewStyle(result->hWnd,ListView_GetExtendedListViewStyle(hWnd));
    result->imageListImpl = imageListImpl;
    for( int c = 0; c != colCount; ++c ) {
        result->addColumn(column(c));
    }
    result->setRows(rowCount);
    return result.release();
}
Beispiel #12
0
void MWO_Reshape::operator()(const unsigned int rows, const unsigned int columns) const
{
	if((rows * columns) != (getRows() * getColumns())) {
		error("MWO_Reshape : Dimensions are not consistent\n");
		return;
	}

	// Change values
	setRows(rows);
	setColumns(columns);
}
Beispiel #13
0
Matrix::Matrix(int rows, int cols)
{
	setRows(rows);
	setCols(cols);

	matrix = new char*[rows];
	for (int i = 0; i < rows; i++)
	{
		matrix[i] = new char[cols];
	}
}
Beispiel #14
0
AddresseeEdit::AddresseeEdit(const WString& label, WContainerWidget *parent,
			     WContainerWidget *labelParent)
  : WTextArea(parent)
{
  label_ = new Label(label, labelParent);

  setRows(3); setColumns(55);
  resize(WLength(99, WLength::Percentage), WLength::Auto);

  setInline(false); // for IE to position the suggestions well
}
Beispiel #15
0
void SqMWO_Resize::operator()(const unsigned int size) const
{
	// Change values
	setRows(size);
	setColumns(size);

	// Delete old memory
	delete[] getDataPointer();

	// Allocate new memory
	setDataPointer(new double[size*size]);
}
Beispiel #16
0
void MWO_Resize::operator()(const unsigned int rows, const unsigned int columns) const
{
	// Change values
	setRows(rows);
	setColumns(columns);

	// Delete old memory
	delete[] getDataPointer();

	// Allocate new memory
	setDataPointer(new double[rows*columns]);
}
Beispiel #17
0
const LLMatrix3&	LLMatrix3::orthogonalize()
{
	LLVector3 x_axis(mMatrix[VX]);
	LLVector3 y_axis(mMatrix[VY]);
	LLVector3 z_axis(mMatrix[VZ]);

	x_axis.normVec();
	y_axis -= x_axis * (x_axis * y_axis);
	y_axis.normVec();
	z_axis = x_axis % y_axis;
	setRows(x_axis, y_axis, z_axis);
	return (*this);
}
Beispiel #18
0
DatatypeCombobox::DatatypeCombobox(int nRow, int nColumn, QObject *oParent)
{
	if(nRow != -1)
	{
		std::vector<int> l;
		l.append(nRow);
		setRows(l);
	}

	if(nColumn != -1)
	{
		std::vector<int> l;
		l.append(nColumn);
		setColumns(l);
	}
}
Beispiel #19
0
void ButcherTableau::setTableau( ButcherTableau::Name name )
{
   name_ = name;
   switch( name )
   {
   case ButcherTableau::GAUSS_LEGENDRE_4:
      NPOINTS_ = GAUSS_LEGENDRE_4_NPOINTS;
      TABLEAU_ = GAUSS_LEGENDRE_4_TABLEAU;
      break;

   case ButcherTableau::IMPLICIT_MIDPOINT_2:
      NPOINTS_ = IMPLICIT_MIDPOINT_2_NPOINTS;
      TABLEAU_ = IMPLICIT_MIDPOINT_2_TABLEAU;
      break;

   default:
   case ButcherTableau::RUNGE_KUTTA_2:
      NPOINTS_ = RUNGE_KUTTA_2_NPOINTS;
      TABLEAU_ = RUNGE_KUTTA_2_TABLEAU;

      break;

   case ButcherTableau::RUNGE_KUTTA_3:
      NPOINTS_ = RUNGE_KUTTA_3_NPOINTS;
      TABLEAU_ = RUNGE_KUTTA_3_TABLEAU;

      break;

   case ButcherTableau::HEUN:
      NPOINTS_ = HEUN_NPOINTS;
      TABLEAU_ = HEUN_TABLEAU;

      break;

   case ButcherTableau::RUNGE_KUTTA_4:
      NPOINTS_ = RUNGE_KUTTA_4_NPOINTS;
      TABLEAU_ = RUNGE_KUTTA_4_TABLEAU;

      break;

   case ButcherTableau::EULER:
      NPOINTS_ = EULER_1_NPOINTS;
      TABLEAU_ = EULER_1_TABLEAU;

   };
   setRows(name);
}
Beispiel #20
0
    bool SpriteSheet::setProperty(const std::string& property, const std::string& value)
    {
        if (!Picture::setProperty(property, value))
        {
            if (property == "Rows")
            {
                setRows(atoi(value.c_str()));
            }
            else if (property == "Columns")
            {
                setColumns(atoi(value.c_str()));
            }
            else // The property didn't match
                return false;
        }

        // You pass here when one of the properties matched
        return true;
    }
Beispiel #21
0
void MWO_EqualsMemCopyResize::operator()(const MatrixAliasConstant& copy) const
{
		if(copy.getRows() != getRows() || copy.getColumns() != getColumns()) {
			// Resize!!

			// Change values
			setRows(copy.getRows());
			setColumns(copy.getColumns());

			// Delete old memory
			delete[] getDataPointer();

			// Allocate new memory
			setDataPointer(new double[getRows()*getColumns()]);
		}

		// Perform a direct memory copy
		memcpy(getDataPointer(), copy.getDataPointer(), sizeof(double)*getRows()*getColumns());

}
Beispiel #22
0
void DataGrid::showMainData()
{
	char buf[MONEY_LEN];
	BeginBatch();
	int diff = GetNumberRows()-(m_data->getItemsNum()+1+1); // +initial and total
	if (diff < 0) {
		if (!AppendRows(-diff)) return;
		setRows(m_data->getItemsNum()+1+diff, -diff);
	} else if (diff > 0) {
		if (!DeleteRows(m_data->getItemsNum()+1, diff)) return;
	}
	SetRowLabelValue(0, HaStrings::strInitial);
	money_to_str_trail(buf, m_data->getInitial());
	SetCellValue(0, BalanceIndex, buf);
	int row = 1;
	for (DataFileRW::ItemIterator i = m_data->ItemBegin(); i != m_data->ItemEnd(); ++i, row++) {
		if (ulist_is_first(&i->owner->items, &i->ulist)) {
			SetRowLabelValue(row, i->owner->title.str);
		} else {
			SetRowLabelValue(row, wxT(""));
		}
		clearRow(row);
		if (is_dummy_item(&*i)) continue;
		if (i->money < 0) {
			money_to_str_trail(buf, -i->money);
			SetCellValue(row, IncomeIndex, buf);
		} else {
			money_to_str_trail(buf, i->money);
			SetCellValue(row, OutlayIndex, buf);
		}
		SetCellValue(row, DescIndex, i->desc.str);
		SetCellValue(row, CommentIndex, i->comment.str);
	}
	SetRowLabelValue(row, HaStrings::strTotal);
	for (int i = 0; i < ColumnNum; i++) SetReadOnly(row, i);
	wxFont font = GetCellFont(row, 0);
	font.MakeBold();
	SetCellFont(row, IncomeIndex, font);
	SetCellFont(row, OutlayIndex, font);
	EndBatch();
}
Beispiel #23
0
void VideoPreview::loadSettings()
{
    qDebug("VideoPreview::loadSettings");

    set->beginGroup("videopreview");

    setCols(set->value("columns", cols()).toInt());
    setRows(set->value("rows", rows()).toInt());
    setInitialStep(set->value("initial_step", initialStep()).toInt());
    setMaxWidth(set->value("max_width", maxWidth()).toInt());
    setDisplayOSD(set->value("osd", displayOSD()).toBool());
    setExtractFormat((ExtractFormat) set->value("format", extractFormat()).toInt());
    save_last_directory = set->value("save_last_directory", save_last_directory).toBool();
    last_directory = set->value("last_directory", last_directory).toString();

    setVideoFile(set->value("filename", videoFile()).toString());
    setDVDDevice(set->value("dvd_device", DVDDevice()).toString());

    toggleInfoAct->setChecked(set->value("show_info", true).toBool());

    set->endGroup();
}
Beispiel #24
0
void TableData::insertRow(int beforerow) {
  int R = rows();
  int C = columns();
  if (beforerow<0)
    beforerow = 0;
  if (beforerow>R)
    beforerow = R;

  QMap<RCPair, QString> oldcont = allContents(this);
  QMap<RCPair, QString> newcont;
  for (int r=0; r<R; r++)
    for (int c=0; c<C; c++)
      newcont[RCPair(r>=beforerow ? r+1 : r, c)] = oldcont[RCPair(r, c)];
  
  QMap<MarkupData *, MDPos> allmarks = allMarkupPos(this);
  for (auto &pos: allmarks) 
    pos.insertRow(beforerow);
  
  setRows(R+1);
  setText(buildContents(R+1, C, newcont));
  for (auto *md: markups())
    updateMD(md, allmarks[md], this);
}
Beispiel #25
0
void TableData::deleteRow(int row) {
  int R = rows();
  int C = columns();
  if (row<0 || row>=R || R==1)
    return;

  QMap<RCPair, QString> oldcont = allContents(this);
  QMap<RCPair, QString> newcont;
  for (int r=0; r<R-1; r++)
    for (int c=0; c<C; c++)
      newcont[RCPair(r, c)] = oldcont[RCPair(r>=row ? r+1 : r, c)];
  
  QMap<MarkupData *, MDPos> allmarks = allMarkupPos(this);
  for (auto &pos: allmarks) 
    pos.deleteRow(row);
  
  setRows(R-1);
  setText(buildContents(R-1, C, newcont));
  for (auto *md: markups()) {
    updateMD(md, allmarks[md], this);
    if (md->start()>=md->end())
      deleteMarkup(md);
  }
}
Beispiel #26
0
        void initSheetObject(lua_State* L)
        {
            luaL_newmetatable(L, meta<Sheet>());
            // Duplicate the metatable on the stack.
            lua_pushvalue(L, -1);
            // metatable.__index = metatable
            lua_setfield(L, -2, "__index");

            // Put the members into the metatable.
            const luaL_Reg functions[] = {
                {"__gc", [](lua_State* L) { return script::wrapped<Sheet>(L, 1)->gc(L); }},
                {"__index", [](lua_State* L) { return script::wrapped<Sheet>(L, 1)->index(L); }},
                {"__newindex", [](lua_State* L) { return script::wrapped<Sheet>(L, 1)->newindex(L); }},
                {"__tostring", [](lua_State* L) { return script::wrapped<Sheet>(L, 1)->tostring(L); }},
                {"__pairs", [](lua_State* L) { return script::wrapped<Sheet>(L, 1)->pairs(L); }},
                {"getFrame", [](lua_State* L)
                {
                    auto sheet = script::ptr<Sheet>(L, 1);
                    int f = script::get<int>(L, 2);

                    int x, y;
                    if(sheet->getFrame(f, x, y))
                    {
                       script::push(L, x);
                       script::push(L, y);
                       return 2;
                    }
                    else
                    {
                        return 0;
                    }
                }},
                {"get_width", [](lua_State* L)
                {
                    auto sheet = script::ptr<Sheet>(L, 1);
                    script::push(L, sheet->getWidth());
                    return 1;
                }},
                {"set_width", [](lua_State* L)
                {
                    auto sheet = script::ptr<Sheet>(L, 1);
                    sheet->setWidth(script::get<int>(L, 2));
                    return 0;
                }},
                {"get_height", [](lua_State* L)
                {
                    auto sheet = script::ptr<Sheet>(L, 1);
                    script::push(L, sheet->getHeight());
                    return 1;
                }},
                {"set_height", [](lua_State* L)
                {
                    auto sheet = script::ptr<Sheet>(L, 1);
                    sheet->setHeight(script::get<int>(L, 2));
                    return 0;
                }},
                {"get_padding", [](lua_State* L)
                {
                    auto sheet = script::ptr<Sheet>(L, 1);
                    script::push(L, sheet->getPadding());
                    return 1;
                }},
                {"set_padding", [](lua_State* L)
                {
                    auto sheet = script::ptr<Sheet>(L, 1);
                    sheet->setPadding(script::get<bool>(L, 2));
                    return 0;
                }},
                {"get_columns", [](lua_State* L)
                {
                    auto sheet = script::ptr<Sheet>(L, 1);
                    script::push(L, sheet->getColumns());
                    return 1;
                }},
                {"set_columns", [](lua_State* L)
                {
                    auto sheet = script::ptr<Sheet>(L, 1);
                    sheet->setColumns(script::get<int>(L, 2));
                    return 0;
                }},
                {"get_rows", [](lua_State* L)
                {
                    auto sheet = script::ptr<Sheet>(L, 1);
                    script::push(L, sheet->getRows());
                    return 1;
                }},
                {"set_rows", [](lua_State* L)
                {
                    auto sheet = script::ptr<Sheet>(L, 1);
                    sheet->setRows(script::get<int>(L, 2));
                    return 0;
                }},
                {nullptr, nullptr}
            };
            luaL_setfuncs(L, functions, 0);

            lua_pop(L, 1);

            // Push plum namespace.
            lua_getglobal(L, "plum");

            // plum.Sheet = <function create>
            script::push(L, "Sheet");
            lua_pushcfunction(L, [](lua_State* L)
            {
                if(script::is<int>(L, 1) && script::is<int>(L, 2) && script::is<int>(L, 3) && script::is<int>(L, 4))
                {
                    int frameWidth = script::get<int>(L, 1);
                    int frameHeight = script::get<int>(L, 2);
                    int columns = script::get<int>(L, 3);
                    int rows = script::get<int>(L, 4);
                    script::push(L, new Sheet(frameWidth, frameHeight, columns, rows), LUA_NOREF);
                    return 1;
                }
                else if(script::is<int>(L, 1) && script::is<int>(L, 2) && script::is<Image>(L, 3))
                {
                    int frameWidth = script::get<int>(L, 1);
                    int frameHeight = script::get<int>(L, 2);
                    auto img = script::ptr<Image>(L, 3);
                    script::push(L, new Sheet(frameWidth, frameHeight, img->canvas().getWidth() / frameWidth, img->canvas().getHeight() / frameHeight), LUA_NOREF);
                    return 1;
                }
                else if(script::is<int>(L, 1) && script::is<int>(L, 2) && script::is<Canvas>(L, 3))
                {
                    int frameWidth = script::get<int>(L, 1);
                    int frameHeight = script::get<int>(L, 2);
                    auto canvas = script::ptr<Canvas>(L, 3);
                    script::push(L, new Sheet(frameWidth, frameHeight, canvas->getWidth() / frameWidth, canvas->getHeight() / frameHeight), LUA_NOREF);
                    return 1;
                }
                luaL_error(L, "Attempt to call plum.Sheet constructor with invalid argument types.\r\n"
                    "Must be (int frameWidth, int frameHeight, int columns, int rows)"
                    " or (int frameWidth, int frameHeight, Image img)"
                    " or (int frameWidth, int frameHeight, Canvas canvas).");
                return 0;
            });
            lua_settable(L, -3);

            // Pop plum namespace.
            lua_pop(L, 1);
        }
Beispiel #27
0
    // inline constructor
    UserFormView() {
        model = std::make_shared<UserFormModel>();

        setTemplateText(tr("userForm-template"));
        addFunction("id", &WTemplate::Functions::id);
        addFunction("block", &WTemplate::Functions::id);

        /*
	 * First Name
	 */
	setFormWidget(UserFormModel::FirstNameField,
	              Wt::cpp14::make_unique<Wt::WLineEdit>());

	/*
	 * Last Name
	 */
	setFormWidget(UserFormModel::LastNameField,
	              Wt::cpp14::make_unique<Wt::WLineEdit>());

	/*
	 * Country
	 */
	auto countryCB = Wt::cpp14::make_unique<Wt::WComboBox>();
	auto countryCB_ = countryCB.get();
	countryCB->setModel(model->countryModel());

	countryCB_->activated().connect([=] {
	    std::string code = model->countryCode(countryCB_->currentIndex());
	    model->updateCityModel(code);
	});

        setFormWidget(UserFormModel::CountryField, std::move(countryCB),
            [=] { // updateViewValue()
                std::string code =
                    Wt::asString(model->value(UserFormModel::CountryField)).toUTF8();
		int row = model->countryModelRow(code);
		countryCB_->setCurrentIndex(row);
	    },

            [=] { // updateModelValue()
                std::string code = model->countryCode(countryCB_->currentIndex());
		model->setValue(UserFormModel::CountryField, code);
            });

	/*
	 * City
	 */
	auto cityCB = Wt::cpp14::make_unique<Wt::WComboBox>();
	cityCB->setModel(model->cityModel());
	setFormWidget(UserFormModel::CityField, std::move(cityCB));

	/*
	 * Birth Date
	 */
	auto dateEdit = Wt::cpp14::make_unique<Wt::WDateEdit>();
	auto dateEdit_ = dateEdit.get();
	setFormWidget(UserFormModel::BirthField, std::move(dateEdit),
	    [=] { // updateViewValue()
	        Wt::WDate date = Wt::cpp17::any_cast<Wt::WDate>
		    (model->value(UserFormModel::BirthField));
		dateEdit_->setDate(date);
	    }, 

            [=] { // updateModelValue()
                Wt::WDate date = dateEdit_->date();
                model->setValue(UserFormModel::BirthField, date);
	    });

        /*
	 * Children
	 */ 
	setFormWidget(UserFormModel::ChildrenField, Wt::cpp14::make_unique<Wt::WSpinBox>());

	/*
	 * Remarks
	 */
	auto remarksTA = Wt::cpp14::make_unique<Wt::WTextArea>();
	remarksTA->setColumns(40);
	remarksTA->setRows(5);
	setFormWidget(UserFormModel::RemarksField, std::move(remarksTA));

	/*
	 * Title & Buttons
	 */
	Wt::WString title = Wt::WString("Create new user");
        bindString("title", title);

        auto button = Wt::cpp14::make_unique<Wt::WPushButton>("Save");
        auto button_ = bindWidget("submit-button", std::move(button));

        bindString("submit-info", Wt::WString());

        button_->clicked().connect(this, &UserFormView::process);

        updateView(model.get());
    }
Beispiel #28
0
void core::DotMatrix::setInputs(const vector<double> &inputs, int rows, int cols)
{
	setRows(rows);
	setCols(cols);
	setInputs(inputs);
}
Beispiel #29
0
DatatypeCombobox::DatatypeCombobox(std::vector<int> const &oRows, std::vector<int> const &oColumns, QObject *oParent)
: QStyledItemDelegate(oParent)
{
	setRows(oRows);
	setColumns(oColumns);
}
void WPCLampMatrix::setColumn(byte column, byte values) {
	setColumn(column);
	setRows(values);
}