X-Git-Url: http://git.tdb.fi/?a=blobdiff_plain;f=source%2Fstyle.cpp;h=f26112a6c14c688674b13cc7adb40c415adcc151;hb=8716fc73506869a7b1b435819428470d8eafd0fa;hp=001b36937e03f4ab03261043d3414ae9ce49060e;hpb=3d84860cb25cf05ed36ee6cbd07d9e58cee52422;p=libs%2Fgltk.git diff --git a/source/style.cpp b/source/style.cpp index 001b369..f26112a 100644 --- a/source/style.cpp +++ b/source/style.cpp @@ -29,38 +29,42 @@ const Part *Style::get_part(const string &name) const Style::Loader::Loader(Style &s, Resources &r): - style(s), - res(r) + DataFile::CollectionObjectLoader(s, &r) { - if(!style.font) + if(!obj.font) { - style.font = &r.get_default_font(); - style.font_size = style.font->get_native_size(); + obj.font = &get_collection().get_default_font(); + obj.font_size = obj.font->get_native_size(); } - add("font", &Style::font); + add("font", &Loader::font); add("font_color", &Loader::font_color); - add("part", static_cast(&Loader::part)); - add("part", static_cast(&Loader::part)); - // Deprecated alias - add("special", static_cast(&Loader::part)); + add("font_size", &Style::font_size); + add("part", &Loader::part); + add("part", &Loader::unnamed_part); } -void Style::Loader::font_color(float r, float g, float b) +void Style::Loader::font(const string &n) { - style.font_color = GL::Color(r, g, b); + obj.font = &get_collection().get(n); + obj.font_size = obj.font->get_native_size(); } -void Style::Loader::part() +void Style::Loader::font_color(float r, float g, float b) { - part(string()); + obj.font_color = GL::Color(r, g, b); } void Style::Loader::part(const string &n) { Part p(n); - load_sub(p, res); - style.parts.push_back(p); + load_sub(p, get_collection()); + obj.parts.push_back(p); +} + +void Style::Loader::unnamed_part() +{ + part(string()); } } // namespace GLtk