diff options
author | Nicolas "Pixel" Noble <pixel@nobis-crew.org> | 2010-09-09 02:26:30 +0200 |
---|---|---|
committer | Nicolas "Pixel" Noble <pixel@nobis-crew.org> | 2010-09-09 02:32:26 +0200 |
commit | 7505e88db66798b2b8fcdff2d92a7136cd826b5b (patch) | |
tree | b6ced565318f8e8112e35cb0ad53abe4212ef8de /iup/srccontrols/matrix | |
parent | e9a184546b18cf3b796bd560561f312934004c54 (diff) |
Upgrading to IUP 3.2 - and cleaning up.
Diffstat (limited to 'iup/srccontrols/matrix')
-rwxr-xr-x | iup/srccontrols/matrix/iupmat_def.h | 1 | ||||
-rwxr-xr-x | iup/srccontrols/matrix/iupmat_mark.c | 30 | ||||
-rwxr-xr-x | iup/srccontrols/matrix/iupmatrix.c | 4 |
3 files changed, 28 insertions, 7 deletions
diff --git a/iup/srccontrols/matrix/iupmat_def.h b/iup/srccontrols/matrix/iupmat_def.h index 225cc16..dd414c8 100755 --- a/iup/srccontrols/matrix/iupmat_def.h +++ b/iup/srccontrols/matrix/iupmat_def.h @@ -82,6 +82,7 @@ struct _IcontrolData int use_title_size; /* use title contents when calculating cell size */ int need_calcsize; int first_redraw; + int inside_markedit_cb; /* avoid recursion */ /* attributes */ int mark_continuous, mark_mode, mark_multiple; diff --git a/iup/srccontrols/matrix/iupmat_mark.c b/iup/srccontrols/matrix/iupmat_mark.c index 99aad32..bffd6ce 100755 --- a/iup/srccontrols/matrix/iupmat_mark.c +++ b/iup/srccontrols/matrix/iupmat_mark.c @@ -62,8 +62,12 @@ static void iMatrixMarkCellSet(Ihandle* ih, int lin, int col, int mark, IFniii m if (ih->data->callback_mode) { - if (markedit_cb) + if (markedit_cb && !ih->data->inside_markedit_cb) + { + ih->data->inside_markedit_cb = 1; markedit_cb(ih, lin, col, mark); + ih->data->inside_markedit_cb = 0; + } else { sprintf(str, "MARK%d:%d", lin, col); @@ -604,7 +608,7 @@ int iupMatrixSetMarkAttrib(Ihandle* ih, const char* name_id, const char* value) if (ih->data->mark_mode == IMAT_MARK_CELL) { - int mark; + int mark, ret = 0; if (lin == 0 || col == 0) /* title can NOT have a mark */ return 0; @@ -614,10 +618,24 @@ int iupMatrixSetMarkAttrib(Ihandle* ih, const char* name_id, const char* value) if (ih->data->callback_mode) { IFniii markedit_cb = (IFniii)IupGetCallback(ih, "MARKEDIT_CB"); - if (markedit_cb) + if (markedit_cb && !ih->data->inside_markedit_cb) + { + ih->data->inside_markedit_cb = 1; markedit_cb(ih, lin, col, mark); - else if (mark) - return 1; /* store the attribute */ + ih->data->inside_markedit_cb = 0; + } + else + { + char str[100] = "MARK"; + strcat(str, name_id); + if (mark) + { + iupAttribSetStr(ih, str, "1"); + ret = 1; + } + else + iupAttribSetStr(ih, str, NULL); + } } else { @@ -633,6 +651,8 @@ int iupMatrixSetMarkAttrib(Ihandle* ih, const char* name_id, const char* value) iupMatrixPrepareDrawData(ih); iupMatrixDrawCells(ih, lin, col, lin, col); } + + return ret; } else { diff --git a/iup/srccontrols/matrix/iupmatrix.c b/iup/srccontrols/matrix/iupmatrix.c index 9e379e2..c94fcdc 100755 --- a/iup/srccontrols/matrix/iupmatrix.c +++ b/iup/srccontrols/matrix/iupmatrix.c @@ -809,9 +809,9 @@ static void iMatrixComputeNaturalSizeMethod(Ihandle* ih, int *w, int *h, int *ex { int sb_size = iupdrvGetScrollbarSize(); if (ih->data->canvas.sb & IUP_SB_HORIZ) - natural_w += sb_size; + natural_h += sb_size; /* sb horizontal affects vertical size */ if (ih->data->canvas.sb & IUP_SB_VERT) - natural_h += sb_size; + natural_w += sb_size; /* sb vertical affects horizontal size */ } *w = natural_w + iMatrixGetNaturalWidth(ih); |