]> git.tdb.fi Git - libs/gltk.git/blobdiff - source/style.cpp
Initial revision
[libs/gltk.git] / source / style.cpp
diff --git a/source/style.cpp b/source/style.cpp
new file mode 100644 (file)
index 0000000..3f276ed
--- /dev/null
@@ -0,0 +1,43 @@
+#include "resources.h"
+#include "style.h"
+
+using namespace std;
+
+namespace Msp {
+namespace GLtk {
+
+Style::Style(const Resources &r, const string &w, const string &n):
+       res(r),
+       widget(w),
+       name(n),
+       font(&res.get_default_font())
+{ }
+
+
+Style::Loader::Loader(Style &s):
+       style(s)
+{
+       add("font", &Loader::font);
+       add("font_color", &Loader::font_color);
+       add("part", &Loader::part);
+}
+
+void Style::Loader::font(const string &f)
+{
+       style.font=&style.res.get_font(f);
+}
+
+void Style::Loader::font_color(float r, float g, float b)
+{
+       style.font_color=Color(r, g, b);
+}
+
+void Style::Loader::part(const string &n)
+{
+       Part p(style.res, n);
+       load_sub(p);
+       style.parts.push_back(p);
+}
+
+} // namespace GLtk
+} // namespace Msp