зеркало из https://github.com/mozilla/pjs.git
Fix problem in grid delete callback. It didn't set the row or column
position. Plus, it updated the row/column count before making the callback, so you could no longer access the userData with XtVaGetValues. Also add XmLTreeDeleteChildren() to XmLTree. This code written by Steve Lamm <slamm@netscape.com> and reviewed by ramiro.
This commit is contained in:
Родитель
1732f5506c
Коммит
6f8d4c63e4
|
@ -9421,6 +9421,28 @@ XmLGridDeleteColumns(Widget w,
|
|||
}
|
||||
redraw = 0;
|
||||
|
||||
if (XtHasCallbacks(w, XmNdeleteCallback) == XtCallbackHasSome)
|
||||
for (i = position; i < position + count; i++)
|
||||
{
|
||||
rowCount = XmLArrayGetCount(g->grid.rowArray);
|
||||
for (j = 0; j < rowCount; j++)
|
||||
{
|
||||
row = (XmLGridRow)XmLArrayGet(g->grid.rowArray, j);
|
||||
cbs.reason = XmCR_DELETE_CELL;
|
||||
cbs.rowType = RowPosToType(g, j);
|
||||
cbs.row = RowPosToTypePos(g, cbs.rowType, i);
|
||||
cbs.columnType = type;
|
||||
cbs.column = RowPosToTypePos(g, cbs.columnType, j);
|
||||
cbs.object = XmLArrayGet(XmLGridRowCells(row), i);
|
||||
XtCallCallbackList(w, g->grid.deleteCallback, (XtPointer)&cbs);
|
||||
}
|
||||
cbs.reason = XmCR_DELETE_COLUMN;
|
||||
cbs.columnType = type;
|
||||
cbs.column = RowPosToTypePos(g, cbs.columnType, i);
|
||||
cbs.object = XmLArrayGet(g->grid.colArray, i);
|
||||
XtCallCallbackList(w, g->grid.deleteCallback, (XtPointer)&cbs);
|
||||
}
|
||||
|
||||
/* adjust count */
|
||||
if (type == XmHEADING)
|
||||
{
|
||||
|
@ -9444,24 +9466,7 @@ XmLGridDeleteColumns(Widget w,
|
|||
g->grid.hiddenColCount--;
|
||||
redraw |= ColIsVisible(g, i);
|
||||
}
|
||||
if (XtHasCallbacks(w, XmNdeleteCallback) == XtCallbackHasSome)
|
||||
for (i = position; i < position + count; i++)
|
||||
{
|
||||
rowCount = XmLArrayGetCount(g->grid.rowArray);
|
||||
for (j = 0; j < rowCount; j++)
|
||||
{
|
||||
row = (XmLGridRow)XmLArrayGet(g->grid.rowArray, j);
|
||||
cbs.reason = XmCR_DELETE_CELL;
|
||||
cbs.rowType = RowPosToType(g, j);
|
||||
cbs.columnType = type;
|
||||
cbs.object = XmLArrayGet(XmLGridRowCells(row), i);
|
||||
XtCallCallbackList(w, g->grid.deleteCallback, (XtPointer)&cbs);
|
||||
}
|
||||
cbs.reason = XmCR_DELETE_COLUMN;
|
||||
cbs.columnType = type;
|
||||
cbs.object = XmLArrayGet(g->grid.colArray, i);
|
||||
XtCallCallbackList(w, g->grid.deleteCallback, (XtPointer)&cbs);
|
||||
}
|
||||
|
||||
/* delete columns */
|
||||
for (i = position; i < position + count; i++)
|
||||
{
|
||||
|
@ -9542,6 +9547,28 @@ XmLGridDeleteRows(Widget w,
|
|||
}
|
||||
redraw = 0;
|
||||
|
||||
if (XtHasCallbacks(w, XmNdeleteCallback) == XtCallbackHasSome)
|
||||
for (i = position; i < position + count; i++)
|
||||
{
|
||||
row = (XmLGridRow)XmLArrayGet(g->grid.rowArray, i);
|
||||
colCount = XmLArrayGetCount(g->grid.colArray);
|
||||
for (j = 0; j < colCount; j++)
|
||||
{
|
||||
cbs.reason = XmCR_DELETE_CELL;
|
||||
cbs.rowType = type;
|
||||
cbs.row = RowPosToTypePos(g, cbs.rowType, i);
|
||||
cbs.columnType = ColPosToType(g, j);
|
||||
cbs.column = ColPosToTypePos(g, cbs.columnType, j);
|
||||
cbs.object = XmLArrayGet(XmLGridRowCells(row), j);
|
||||
XtCallCallbackList(w, g->grid.deleteCallback, (XtPointer)&cbs);
|
||||
}
|
||||
cbs.reason = XmCR_DELETE_ROW;
|
||||
cbs.rowType = type;
|
||||
cbs.row = RowPosToTypePos(g, cbs.rowType, i);
|
||||
cbs.object = (void *)row;
|
||||
XtCallCallbackList(w, g->grid.deleteCallback, (XtPointer)&cbs);
|
||||
}
|
||||
|
||||
/* adjust count */
|
||||
if (type == XmHEADING)
|
||||
{
|
||||
|
@ -9565,24 +9592,7 @@ XmLGridDeleteRows(Widget w,
|
|||
g->grid.hiddenRowCount--;
|
||||
redraw |= RowIsVisible(g, i);
|
||||
}
|
||||
if (XtHasCallbacks(w, XmNdeleteCallback) == XtCallbackHasSome)
|
||||
for (i = position; i < position + count; i++)
|
||||
{
|
||||
row = (XmLGridRow)XmLArrayGet(g->grid.rowArray, i);
|
||||
colCount = XmLArrayGetCount(g->grid.colArray);
|
||||
for (j = 0; j < colCount; j++)
|
||||
{
|
||||
cbs.reason = XmCR_DELETE_CELL;
|
||||
cbs.rowType = type;
|
||||
cbs.columnType = ColPosToType(g, j);
|
||||
cbs.object = XmLArrayGet(XmLGridRowCells(row), j);
|
||||
XtCallCallbackList(w, g->grid.deleteCallback, (XtPointer)&cbs);
|
||||
}
|
||||
cbs.reason = XmCR_DELETE_ROW;
|
||||
cbs.rowType = type;
|
||||
cbs.object = (void *)row;
|
||||
XtCallCallbackList(w, g->grid.deleteCallback, (XtPointer)&cbs);
|
||||
}
|
||||
|
||||
/* delete rows and cells */
|
||||
for (i = position; i < position + count; i++)
|
||||
{
|
||||
|
|
|
@ -44,14 +44,11 @@ LIBRARY_NAME = XmL
|
|||
ifdef XFE_WIDGETS_BUILD_UNUSED
|
||||
UNUSED_CSRCS = \
|
||||
Progress.c \
|
||||
Tree.c \
|
||||
$(NULL)
|
||||
|
||||
UNUSED_EXPORTS = \
|
||||
Progress.h \
|
||||
ProgressP.h \
|
||||
Tree.h \
|
||||
TreeP.h \
|
||||
$(NULL)
|
||||
endif
|
||||
|
||||
|
@ -59,6 +56,7 @@ CSRCS = \
|
|||
$(UNUSED_CSRCS) \
|
||||
Folder.c \
|
||||
Grid.c \
|
||||
Tree.c \
|
||||
XmL.c \
|
||||
$(NULL)
|
||||
|
||||
|
@ -70,7 +68,10 @@ EXPORTS = \
|
|||
FolderP.h \
|
||||
Grid.h \
|
||||
GridP.h \
|
||||
Tree.h \
|
||||
TreeP.h \
|
||||
XmL.h \
|
||||
$(NULL)
|
||||
|
||||
include $(DEPTH)/config/rules.mk
|
||||
include $(DEPTH)/cmd/xfe/XfeWidgets/XfeWidgets.mk
|
||||
|
|
|
@ -1319,3 +1319,35 @@ XmLTreeAddRows(Widget w,
|
|||
XmNlayoutFrozen, False,
|
||||
NULL);
|
||||
}
|
||||
|
||||
|
||||
|
||||
void
|
||||
XmLTreeDeleteChildren(Widget w,
|
||||
int row)
|
||||
{
|
||||
XmLTreeWidget t;
|
||||
XmLTreeRow rowp;
|
||||
int ii, jj, level, rows;
|
||||
|
||||
t = WidgetToTree(w, "XmLTreeDeleteChildren()");
|
||||
|
||||
rowp = (XmLTreeRow)XmLGridGetRow(w, XmCONTENT, row);
|
||||
level = rowp->tree.level;
|
||||
|
||||
rows = t->grid.rowCount;
|
||||
|
||||
ii = row + 1;
|
||||
while (ii < rows)
|
||||
{
|
||||
rowp = (XmLTreeRow)XmLGridGetRow(w, XmCONTENT, ii);
|
||||
if (rowp->tree.level <= level)
|
||||
break;
|
||||
ii++;
|
||||
}
|
||||
jj = ii - row - 1;
|
||||
|
||||
if (jj > 0)
|
||||
XmLGridDeleteRows(w, XmCONTENT, row + 1, jj);
|
||||
}
|
||||
|
||||
|
|
|
@ -48,6 +48,7 @@ void XmLTreeAddRow(Widget w, int level, Boolean expands, Boolean isExpaned,
|
|||
int position, Pixmap pixmap, Pixmap pixmask, XmString string);
|
||||
void XmLTreeAddRows(Widget w, XmLTreeRowDefinition *rows,
|
||||
int count, int position);
|
||||
void XmLTreeDeleteChildren(Widget w, int position);
|
||||
|
||||
#ifdef XmL_CPP
|
||||
}
|
||||
|
|
Загрузка…
Ссылка в новой задаче