1
0
mirror of https://github.com/gryf/wmaker.git synced 2026-01-06 05:44:11 +01:00

changed stringselector for enumeration selector

This commit is contained in:
kojima
2000-12-21 21:06:00 +00:00
parent f912d9f38d
commit 4c60cd5ba4
5 changed files with 308 additions and 22 deletions

View File

@@ -142,6 +142,8 @@ struct W_TableView {
void *dataSource;
WMTableViewDelegate *delegate;
int editingRow;
unsigned headerHeight;
@@ -296,6 +298,8 @@ WMTableView *WMCreateTableView(WMWidget *parent)
table->gridGC = XCreateGC(WMScreenDisplay(scr), W_DRAWABLE(scr),
GCForeground, &gcv);
}
table->editingRow = -1;
table->drawsGrid = 1;
table->rowHeight = 16;
@@ -428,6 +432,13 @@ void *WMTableViewDataForCell(WMTableView *table, WMTableColumn *column,
}
void WMSetTableViewDataForCell(WMTableView *table, WMTableColumn *column,
int row, void *data)
{
(*table->delegate->setValueForCell)(table->delegate, column, row, data);
}
WMRect WMTableViewRectForCell(WMTableView *table, WMTableColumn *column,
int row)
{
@@ -686,15 +697,37 @@ static void repaintTable(WMTableView *table, int x, int y,
}
static void startRowEdit(WMTableView *table, int row)
static void stopRowEdit(WMTableView *table, int row)
{
int i;
WMTableColumn *column;
table->editingRow = -1;
for (i = 0; i < WMGetArrayItemCount(table->columns); i++) {
column = WMGetFromArray(table->columns, i);
wassertr(column->delegate && column->delegate->drawCell);
wassertr(column->delegate && column->delegate->endCellEdit);
(*column->delegate->endCellEdit)(column->delegate, column, row);
}
}
void WMEditTableViewRow(WMTableView *table, int row)
{
int i;
WMTableColumn *column;
if (table->editingRow >= 0) {
stopRowEdit(table, table->editingRow);
}
table->editingRow = row;
for (i = 0; i < WMGetArrayItemCount(table->columns); i++) {
column = WMGetFromArray(table->columns, i);
wassertr(column->delegate && column->delegate->beginCellEdit);
(*column->delegate->beginCellEdit)(column->delegate, column, row);
}
@@ -708,7 +741,6 @@ static void handleTableEvents(XEvent *event, void *data)
switch (event->type) {
case ButtonPress:
setRowSelected(table, event->xbutton.y/table->rowHeight, True);
startRowEdit(table, event->xbutton.y/table->rowHeight);
break;
case Expose: