39 FXIMPLEMENT(
MFXAddEditTypedTable, FXTable, MFXAddEditTypedTableMap, ARRAYNUMBER(MFXAddEditTypedTableMap))
43 FXSelector sel, FXuint opts,
44 FXint x, FXint y, FXint w, FXint h,
45 FXint pl, FXint pr, FXint pt, FXint pb)
46 : FXTable(p, tgt, sel, opts, x, y, w, h, pl, pr, pt, pb) {}
191 FXTableItem* item = cells[r * ncols + c];
192 if (item ==
nullptr) {
206 field =
new FXTextField(
this, 1,
nullptr, 0, TEXTFIELD_ENTER_ONLY, 0, 0, 0, 0, getMarginLeft(), getMarginRight(), getMarginTop(), getMarginBottom());
212 field->setJustify(justify);
213 field->setFont(getFont());
214 field->setBackColor(getBackColor());
215 field->setTextColor(getTextColor());
216 field->setSelBackColor(getSelBackColor());
217 field->setSelTextColor(getSelTextColor());
218 field->setText(item->getText());
225 FXRealSpinner* field;
227 field =
new FXRealSpinner(
this, 1,
nullptr, 0, TEXTFIELD_ENTER_ONLY, 0, 0, 0, 0, getMarginLeft(), getMarginRight(), getMarginTop(), getMarginBottom());
234 field->setFont(getFont());
235 field->setBackColor(getBackColor());
236 field->setTextColor(getTextColor());
237 field->setSelBackColor(getSelBackColor());
238 field->setSelTextColor(getSelTextColor());
240 if (p.
format !=
"undefined") {
243 field->setIncrement(p.
steps2);
244 field->setRange(p.
min, p.
max);
285 FXTableRange tablerange = input;
287 FXRealSpinner* dial =
dynamic_cast<FXRealSpinner*
>(editor);
288 if (dial !=
nullptr) {
291 if (
dynamic_cast<FXTextField*
>(editor) !=
nullptr) {
298 if (notify && target) {
299 target->tryHandle(
this, FXSEL(SEL_REPLACED, message), (
void*)&tablerange);
309 FXTableItem* item = cells[r * ncols + c];
310 if (item ==
nullptr) {
311 cells[r * ncols + c] = item = createItem(
"",
nullptr,
nullptr);
312 if (isItemSelected(r, c)) {
313 item->setSelected(FALSE);
319 item->setFromControl(control);
322 item->setText(
toString(
static_cast<FXRealSpinner*
>(control)->getValue()).c_str());
325 item->setText(
toString((
int)
static_cast<FXRealSpinner*
>(control)->getValue()).c_str());
342 bool accepted =
true;
344 if (!target->handle(
this, FXSEL(SEL_CHANGED,
ID_TEXT_CHANGED), (
void*) &edited)) {
350 if (edited.
row == getNumRows() - 1) {
351 insertRows(getNumRows(), 1,
true);
352 for (
int i = 0; i < getNumColumns(); i++) {
353 setItemText(getNumRows() - 1, i,
"");
354 setItemJustify(getNumRows() - 1, i, JUSTIFY_CENTER_X);
364 FXTableItem* item = cells[r * ncols + c];
365 if (item ==
nullptr) {
371 item->setFromControl(control);
374 item->setText(
toString(
static_cast<FXRealSpinner*
>(control)->getValue()).c_str());
377 item->setText(
toString((
int)
static_cast<FXRealSpinner*
>(control)->getValue()).c_str());
392 if (!target->handle(
this, FXSEL(SEL_CHANGED,
ID_TEXT_CHANGED), (
void*) &edited)) {
401 FXEvent*
event = (FXEvent*)ptr;
404 flags &= ~FLAG_PRESSED;
405 flags |= FLAG_UPDATE;
408 setDragCursor(getApp()->getDefaultCursor(DEF_ARROW_CURSOR));
409 if (target && target->tryHandle(
this, FXSEL(SEL_LEFTBUTTONRELEASE, message), ptr)) {
414 makePositionVisible(current.row, current.col);
420 if (event->click_count == 1) {
421 handle(
this, FXSEL(SEL_CLICKED, 0), (
void*)¤t);
422 }
else if (event->click_count == 2) {
423 handle(
this, FXSEL(SEL_DOUBLECLICKED, 0), (
void*)¤t);
424 }
else if (event->click_count == 3) {
425 handle(
this, FXSEL(SEL_TRIPLECLICKED, 0), (
void*)¤t);
429 if (0 <= current.row && 0 <= current.col && isItemEnabled(current.row, current.col)) {
430 handle(
this, FXSEL(SEL_COMMAND, 0), (
void*)¤t);
441 FXEvent*
event = (FXEvent*)ptr;
444 handle(
this, FXSEL(SEL_FOCUS_SELF, 0), ptr);
447 if (target && target->tryHandle(
this, FXSEL(SEL_LEFTBUTTONPRESS, message), ptr)) {
452 tablepos.row = rowAtY(event->win_y);
453 tablepos.col = colAtX(event->win_x);
456 if (tablepos.row < 0 || tablepos.row >= nrows || tablepos.col < 0 || tablepos.col >= ncols) {
457 setCurrentItem(-1, -1, TRUE);
462 bool wasEdited = editor !=
nullptr;
463 setCurrentItem(tablepos.row, tablepos.col, TRUE);
467 if (event->state & SHIFTMASK) {
468 if (0 <= anchor.row && 0 <= anchor.col) {
469 if (isItemEnabled(anchor.row, anchor.col)) {
470 extendSelection(current.row, current.col, TRUE);
473 setAnchorItem(current.row, current.col);
474 if (isItemEnabled(current.row, current.col)) {
475 extendSelection(current.row, current.col, TRUE);
480 if (isItemEnabled(current.row, current.col)) {
482 setAnchorItem(current.row, current.col);
483 extendSelection(current.row, current.col, TRUE);
485 setAnchorItem(current.row, current.col);
490 flags &= ~FLAG_UPDATE;
491 flags |= FLAG_PRESSED;
512 if (target && target->tryHandle(
this, FXSEL(SEL_CLICKED, message), ptr)) {
515 handle(
this, FXSEL(SEL_COMMAND, ID_START_INPUT),
nullptr);
530 if (target && target->tryHandle(
this, FXSEL(SEL_CLICKED, message), ptr)) {
533 handle(
this, FXSEL(SEL_COMMAND, ID_START_INPUT),
nullptr);
561 const std::string& format) {
593 const std::vector<std::string>& params) {
594 while ((
int)
myEnums.size() <= pos) {
595 myEnums.push_back(std::vector<std::string>());
603 const std::string& e) {
604 while ((
int)
myEnums.size() <= pos) {
605 myEnums.push_back(std::vector<std::string>());
611 const std::vector<std::string>&