Deduplicated the default text column parameters across platforms.
This commit is contained in:
parent
9b340ed40c
commit
4dbf1994a6
|
@ -11,6 +11,7 @@ extern uiTableValueType uiprivTableModelColumnType(uiTableModel *m, int column);
|
|||
extern int uiprivTableModelNumRows(uiTableModel *m);
|
||||
extern uiTableValue *uiprivTableModelCellValue(uiTableModel *m, int row, int column);
|
||||
extern void uiprivTableModelSetCellValue(uiTableModel *m, int row, int column, const uiTableValue *value);
|
||||
extern const uiTableTextColumnOptionalParams uiprivDefaultTextColumnOptionalParams;
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
|
|
|
@ -42,3 +42,7 @@ void uiprivTableModelSetCellValue(uiTableModel *m, int row, int column, const ui
|
|||
mh = uiprivTableModelHandler(m);
|
||||
(*(mh->SetCellValue))(mh, m, row, column, value);
|
||||
}
|
||||
|
||||
const uiTableTextColumnOptionalParams uiprivDefaultTextColumnOptionalParams = {
|
||||
.ColorModelColumn = -1,
|
||||
};
|
||||
|
|
|
@ -51,10 +51,6 @@ static BOOL isCellEditable(uiTableModel *m, NSInteger row, int modelColumn)
|
|||
return editable != 0;
|
||||
}
|
||||
|
||||
static uiTableTextColumnOptionalParams defaultTextColumnOptionalParams = {
|
||||
.ColorModelColumn = -1,
|
||||
};
|
||||
|
||||
struct textColumnCreateParams {
|
||||
uiTable *t;
|
||||
uiTableModel *m;
|
||||
|
@ -623,9 +619,10 @@ void uiTableAppendTextColumn(uiTable *t, const char *name, int textModelColumn,
|
|||
p.makeTextField = YES;
|
||||
p.textModelColumn = textModelColumn;
|
||||
p.textEditableColumn = textEditableModelColumn;
|
||||
if (params == NULL)
|
||||
params = &defaultTextColumnOptionalParams;
|
||||
if (params != NULL)
|
||||
p.textParams = *params;
|
||||
else
|
||||
p.textParams = uiprivDefaultTextColumnOptionalParams;
|
||||
|
||||
str = [NSString stringWithUTF8String:name];
|
||||
col = [[uiprivTextImageCheckboxTableColumn alloc] initWithIdentifier:str params:&p];
|
||||
|
@ -665,9 +662,10 @@ void uiTableAppendImageTextColumn(uiTable *t, const char *name, int imageModelCo
|
|||
p.makeTextField = YES;
|
||||
p.textModelColumn = textModelColumn;
|
||||
p.textEditableColumn = textEditableModelColumn;
|
||||
if (textParams == NULL)
|
||||
textParams = &defaultTextColumnOptionalParams;
|
||||
if (textParams != NULL)
|
||||
p.textParams = *textParams;
|
||||
else
|
||||
p.textParams = uiprivDefaultTextColumnOptionalParams;
|
||||
|
||||
p.makeImage = YES;
|
||||
p.imageModelColumn = imageModelColumn;
|
||||
|
@ -711,9 +709,10 @@ void uiTableAppendCheckboxTextColumn(uiTable *t, const char *name, int checkboxM
|
|||
p.makeTextField = YES;
|
||||
p.textModelColumn = textModelColumn;
|
||||
p.textEditableColumn = textEditableModelColumn;
|
||||
if (textParams == NULL)
|
||||
textParams = &defaultTextColumnOptionalParams;
|
||||
if (textParams != NULL)
|
||||
p.textParams = *textParams;
|
||||
else
|
||||
p.textParams = uiprivDefaultTextColumnOptionalParams;
|
||||
|
||||
p.makeCheckbox = YES;
|
||||
p.checkboxModelColumn = checkboxModelColumn;
|
||||
|
|
|
@ -87,11 +87,6 @@ static void onEdited(uiTableModel *m, int column, const char *pathstr, const uiT
|
|||
uiprivTableModelSetCellValue(m, row, column, tvalue);
|
||||
}
|
||||
|
||||
// TODO deduplicate this between platforms
|
||||
static uiTableTextColumnOptionalParams defaultTextColumnOptionalParams = {
|
||||
.ColorModelColumn = -1,
|
||||
};
|
||||
|
||||
struct textColumnParams {
|
||||
uiTable *t;
|
||||
uiTableModel *m;
|
||||
|
@ -282,7 +277,7 @@ static void addTextColumn(uiTable *t, GtkTreeViewColumn *c, int textModelColumn,
|
|||
if (params != NULL)
|
||||
p->params = *params;
|
||||
else
|
||||
p->params = defaultTextColumnOptionalParams;
|
||||
p->params = uiprivDefaultTextColumnOptionalParams;
|
||||
|
||||
r = gtk_cell_renderer_text_new();
|
||||
gtk_tree_view_column_pack_start(c, r, TRUE);
|
||||
|
|
|
@ -7,10 +7,6 @@
|
|||
// - implement keyboard accessibility
|
||||
// - implement accessibility in general (Dynamic Annotations maybe?)
|
||||
|
||||
static uiTableTextColumnOptionalParams defaultTextColumnOptionalParams = {
|
||||
/*TODO.ColorModelColumn = */-1,
|
||||
};
|
||||
|
||||
uiTableModel *uiNewTableModel(uiTableModelHandler *mh)
|
||||
{
|
||||
uiTableModel *m;
|
||||
|
@ -401,7 +397,7 @@ static uiprivTableColumnParams *appendColumn(uiTable *t, const char *name, int c
|
|||
p = uiprivNew(uiprivTableColumnParams);
|
||||
p->textModelColumn = -1;
|
||||
p->textEditableColumn = -1;
|
||||
p->textParams = defaultTextColumnOptionalParams;
|
||||
p->textParams = uiprivDefaultTextColumnOptionalParams;
|
||||
p->imageModelColumn = -1;
|
||||
p->checkboxModelColumn = -1;
|
||||
p->checkboxEditableColumn = -1;
|
||||
|
|
Loading…
Reference in New Issue