浏览代码

LibGfx: Enumerate metric theme roles

This change does practically nothing except that you no longer have to
put new roles there, as they are now automatically read from the enum
list.
Karol Kosek 3 年之前
父节点
当前提交
d1e1096bc0
共有 1 个文件被更改,包括 5 次插入6 次删除
  1. 5 6
      Userland/Libraries/LibGfx/SystemTheme.cpp

+ 5 - 6
Userland/Libraries/LibGfx/SystemTheme.cpp

@@ -77,12 +77,11 @@ Core::AnonymousBuffer load_system_theme(Core::ConfigFile const& file)
     ENUMERATE_COLOR_ROLES(__ENUMERATE_COLOR_ROLE)
     ENUMERATE_COLOR_ROLES(__ENUMERATE_COLOR_ROLE)
 #undef __ENUMERATE_COLOR_ROLE
 #undef __ENUMERATE_COLOR_ROLE
 
 
-#define DO_METRIC(x) \
-    data->metric[(int)MetricRole::x] = get_metric(#x, (int)MetricRole::x)
-
-    DO_METRIC(TitleHeight);
-    DO_METRIC(TitleButtonWidth);
-    DO_METRIC(TitleButtonHeight);
+#undef __ENUMERATE_METRIC_ROLE
+#define __ENUMERATE_METRIC_ROLE(role) \
+    data->metric[(int)MetricRole::role] = get_metric(#role, (int)MetricRole::role);
+    ENUMERATE_METRIC_ROLES(__ENUMERATE_METRIC_ROLE)
+#undef __ENUMERATE_METRIC_ROLE
 
 
 #define DO_PATH(x, allow_empty)                                                                                  \
 #define DO_PATH(x, allow_empty)                                                                                  \
     do {                                                                                                         \
     do {                                                                                                         \