mirror of
https://github.com/gryf/wmaker.git
synced 2026-01-10 07:44:14 +01:00
changed stringselector for enumeration selector
This commit is contained in:
@@ -5,6 +5,18 @@
|
||||
#include "tabledelegates.h"
|
||||
|
||||
|
||||
static char *col1[20] = {0};
|
||||
static int col2[20];
|
||||
|
||||
|
||||
static char *options[] = {
|
||||
"Option1",
|
||||
"Option2",
|
||||
"Option3",
|
||||
"Option4",
|
||||
"Option5"
|
||||
};
|
||||
|
||||
|
||||
int numberOfRows(WMTableViewDelegate *self, WMTableView *table)
|
||||
{
|
||||
@@ -15,8 +27,27 @@ int numberOfRows(WMTableViewDelegate *self, WMTableView *table)
|
||||
void *valueForCell(WMTableViewDelegate *self, WMTableColumn *column, int row)
|
||||
{
|
||||
WMTableView *table = (WMTableView*)WMGetTableColumnTableView(column);
|
||||
|
||||
return "TESTE";
|
||||
int i;
|
||||
if (col1[0] == 0) {
|
||||
for (i = 0; i < 20; i++) {
|
||||
col1[i] = "teste";
|
||||
col2[i] = 0;
|
||||
}
|
||||
}
|
||||
if (WMGetTableColumnId(column) == 1)
|
||||
return col1[row];
|
||||
else
|
||||
return col2[row];
|
||||
}
|
||||
|
||||
|
||||
void setValueForCell(WMTableViewDelegate *self, WMTableColumn *column, int row,
|
||||
void *data)
|
||||
{
|
||||
if (WMGetTableColumnId(column) == 1)
|
||||
col1[row] = data;
|
||||
else
|
||||
col2[row] = data;
|
||||
}
|
||||
|
||||
|
||||
@@ -24,11 +55,21 @@ static WMTableViewDelegate delegate = {
|
||||
NULL,
|
||||
numberOfRows,
|
||||
valueForCell,
|
||||
NULL
|
||||
setValueForCell
|
||||
};
|
||||
|
||||
|
||||
|
||||
void selectedRowObserver(void *self, WMNotification *notif)
|
||||
{
|
||||
int row = (int)WMGetNotificationClientData(notif);
|
||||
|
||||
WMEditTableViewRow(self, row);
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
main(int argc, char **argv)
|
||||
{
|
||||
Display *dpy = XOpenDisplay("");
|
||||
@@ -60,8 +101,11 @@ main(int argc, char **argv)
|
||||
WMSetTableViewGridColor(table, WMGrayColor(scr));
|
||||
WMSetTableViewHeaderHeight(table, 20);
|
||||
WMSetTableViewDelegate(table, &delegate);
|
||||
WMAddNotificationObserver(selectedRowObserver, table,
|
||||
WMTableViewRowWasSelectedNotification,
|
||||
table);
|
||||
|
||||
colDeleg = WTCreateStringDelegate(table);
|
||||
colDeleg = WTCreateStringEditorDelegate(table);
|
||||
|
||||
col = WMCreateTableColumn("Group");
|
||||
WMSetTableColumnWidth(col, 180);
|
||||
@@ -69,10 +113,11 @@ main(int argc, char **argv)
|
||||
WMSetTableColumnDelegate(col, colDeleg);
|
||||
WMSetTableColumnId(col, (void*)1);
|
||||
|
||||
colDeleg = WTCreateStringDelegate(table);
|
||||
|
||||
colDeleg = WTCreateEnumSelectorDelegate(table);
|
||||
WTSetEnumSelectorOptions(colDeleg, options, 5);
|
||||
|
||||
col = WMCreateTableColumn("Package");
|
||||
WMSetTableColumnWidth(col, 240);
|
||||
WMSetTableColumnWidth(col, 140);
|
||||
WMAddTableViewColumn(table, col);
|
||||
WMSetTableColumnDelegate(col, colDeleg);
|
||||
WMSetTableColumnId(col, (void*)2);
|
||||
|
||||
Reference in New Issue
Block a user