| 1019 for(int i=0;i<model->columns;i++,c++) { |
1019 for(int i=0;i<model->columns;i++,c++) { |
| 1020 UiBool freevalue = FALSE; |
1020 UiBool freevalue = FALSE; |
| 1021 void *data = listview->getvalue(list, elm, row, c, listview->getvaluedata, &freevalue); |
1021 void *data = listview->getvalue(list, elm, row, c, listview->getvaluedata, &freevalue); |
| 1022 |
1022 |
| 1023 UiModelType type = model->types[i]; |
1023 UiModelType type = model->types[i]; |
| 1024 |
1024 UiTextStyle cstyle = { 0, 0 }; |
| 1025 if(getstyle) { |
1025 if(getstyle) { |
| 1026 // in case the column is icon+text, only get a style for the text column |
1026 // in case the column is icon+text, only get a style for the text column |
| 1027 int style_col = c; |
1027 int style_col = c; |
| 1028 if(type == UI_ICON_TEXT || type == UI_ICON_TEXT_FREE) { |
1028 if(type == UI_ICON_TEXT || type == UI_ICON_TEXT_FREE) { |
| 1029 style_col++; |
1029 style_col++; |
| 1030 } |
1030 } |
| 1031 |
1031 |
| 1032 // Get the individual column style |
1032 // Get the individual column style |
| 1033 // The column style overrides the row style, however if no column style |
1033 // The column style overrides the row style, however if no column style |
| 1034 // is provided, we stick with the row style |
1034 // is provided, we stick with the row style |
| 1035 if(getstyle(list, elm, row, style_col, listview->getstyledata, &style)) { |
1035 if(getstyle(list, elm, row, style_col, listview->getstyledata, &cstyle)) { |
| 1036 style_set = TRUE; |
1036 style_set = TRUE; |
| |
1037 cstyle.text_style |= style.text_style; |
| |
1038 if(!cstyle.fg_set) { |
| |
1039 cstyle.fg_set = style.fg_set; |
| |
1040 cstyle.fg = style.fg; |
| |
1041 } |
| |
1042 } else { |
| |
1043 cstyle = style; |
| 1037 } |
1044 } |
| 1038 } |
1045 } |
| 1039 |
1046 |
| 1040 GValue value = G_VALUE_INIT; |
1047 GValue value = G_VALUE_INIT; |
| 1041 switch(type) { |
1048 switch(type) { |
| 1137 g_value_set_boolean(&style_set_value, TRUE); |
1144 g_value_set_boolean(&style_set_value, TRUE); |
| 1138 gtk_list_store_set_value(store, iter, soff, &style_set_value); |
1145 gtk_list_store_set_value(store, iter, soff, &style_set_value); |
| 1139 |
1146 |
| 1140 GValue style_weight_value = G_VALUE_INIT; |
1147 GValue style_weight_value = G_VALUE_INIT; |
| 1141 g_value_init(&style_weight_value, G_TYPE_INT); |
1148 g_value_init(&style_weight_value, G_TYPE_INT); |
| 1142 if(style.text_style & UI_TEXT_STYLE_BOLD) { |
1149 if(cstyle.text_style & UI_TEXT_STYLE_BOLD) { |
| 1143 g_value_set_int(&style_weight_value, 600); |
1150 g_value_set_int(&style_weight_value, 600); |
| 1144 } else { |
1151 } else { |
| 1145 g_value_set_int(&style_weight_value, 400); |
1152 g_value_set_int(&style_weight_value, 400); |
| 1146 } |
1153 } |
| 1147 gtk_list_store_set_value(store, iter, soff + 1, &style_weight_value); |
1154 gtk_list_store_set_value(store, iter, soff + 1, &style_weight_value); |
| 1148 |
1155 |
| 1149 GValue style_underline_value = G_VALUE_INIT; |
1156 GValue style_underline_value = G_VALUE_INIT; |
| 1150 g_value_init(&style_underline_value, G_TYPE_INT); |
1157 g_value_init(&style_underline_value, G_TYPE_INT); |
| 1151 if(style.text_style & UI_TEXT_STYLE_UNDERLINE) { |
1158 if(cstyle.text_style & UI_TEXT_STYLE_UNDERLINE) { |
| 1152 g_value_set_int(&style_underline_value, PANGO_UNDERLINE_SINGLE); |
1159 g_value_set_int(&style_underline_value, PANGO_UNDERLINE_SINGLE); |
| 1153 } else { |
1160 } else { |
| 1154 g_value_set_int(&style_underline_value, PANGO_UNDERLINE_NONE); |
1161 g_value_set_int(&style_underline_value, PANGO_UNDERLINE_NONE); |
| 1155 } |
1162 } |
| 1156 gtk_list_store_set_value(store, iter, soff + 2, &style_underline_value); |
1163 gtk_list_store_set_value(store, iter, soff + 2, &style_underline_value); |
| 1157 |
1164 |
| 1158 GValue style_italic_value = G_VALUE_INIT; |
1165 GValue style_italic_value = G_VALUE_INIT; |
| 1159 g_value_init(&style_italic_value, G_TYPE_INT); |
1166 g_value_init(&style_italic_value, G_TYPE_INT); |
| 1160 if(style.text_style & UI_TEXT_STYLE_ITALIC) { |
1167 if(cstyle.text_style & UI_TEXT_STYLE_ITALIC) { |
| 1161 g_value_set_int(&style_italic_value, PANGO_STYLE_ITALIC); |
1168 g_value_set_int(&style_italic_value, PANGO_STYLE_ITALIC); |
| 1162 } else { |
1169 } else { |
| 1163 g_value_set_int(&style_italic_value, PANGO_STYLE_NORMAL); |
1170 g_value_set_int(&style_italic_value, PANGO_STYLE_NORMAL); |
| 1164 } |
1171 } |
| 1165 gtk_list_store_set_value(store, iter, soff + 3, &style_italic_value); |
1172 gtk_list_store_set_value(store, iter, soff + 3, &style_italic_value); |
| 1166 |
1173 |
| 1167 GValue style_fgset_value = G_VALUE_INIT; |
1174 GValue style_fgset_value = G_VALUE_INIT; |
| 1168 g_value_init(&style_fgset_value, G_TYPE_BOOLEAN); |
1175 g_value_init(&style_fgset_value, G_TYPE_BOOLEAN); |
| 1169 g_value_set_boolean(&style_fgset_value, style.fg_set); |
1176 g_value_set_boolean(&style_fgset_value, cstyle.fg_set); |
| 1170 gtk_list_store_set_value(store, iter, soff + 4, &style_fgset_value); |
1177 gtk_list_store_set_value(store, iter, soff + 4, &style_fgset_value); |
| 1171 |
1178 |
| 1172 if(style.fg_set) { |
1179 if(cstyle.fg_set) { |
| 1173 char buf[8]; |
1180 char buf[8]; |
| 1174 snprintf(buf, 8, "#%02X%02X%02X", (int)style.fg.red, (int)style.fg.green, (int)style.fg.blue); |
1181 snprintf(buf, 8, "#%02X%02X%02X", (int)cstyle.fg.red, (int)cstyle.fg.green, (int)cstyle.fg.blue); |
| 1175 |
1182 |
| 1176 GValue style_fg_value = G_VALUE_INIT; |
1183 GValue style_fg_value = G_VALUE_INIT; |
| 1177 g_value_init(&style_fg_value, G_TYPE_STRING); |
1184 g_value_init(&style_fg_value, G_TYPE_STRING); |
| 1178 g_value_set_string(&style_fg_value, buf); |
1185 g_value_set_string(&style_fg_value, buf); |
| 1179 gtk_list_store_set_value(store, iter, soff + 5, &style_fg_value); |
1186 gtk_list_store_set_value(store, iter, soff + 5, &style_fg_value); |