/* * \brief Menu view * \author Norman Feske * \date 2009-09-11 */ /* * Copyright (C) 2014 Genode Labs GmbH * * This file is part of the Genode OS framework, which is distributed * under the terms of the GNU General Public License version 2. */ #ifndef _STYLE_DATABASE_H_ #define _STYLE_DATABASE_H_ /* gems includes */ #include #include /* local includes */ #include "types.h" namespace Menu_view { struct Style_database; } class Menu_view::Style_database { private: enum { PATH_MAX_LEN = 200 }; struct Texture_entry : List::Element { String path; File png_file; Png_image png_image; Texture &texture; /** * Constructor * * \throw Reading_failed */ Texture_entry(char const *path, Allocator &alloc) : path(path), png_file(path, alloc), png_image(png_file.data()), texture(*png_image.texture()) { } }; struct Font_entry : List::Element { String path; File tff_file; Text_painter::Font font; /** * Constructor * * \throw Reading_failed */ Font_entry(char const *path, Allocator &alloc) : path(path), tff_file(path, alloc), font(tff_file.data()) { } }; /* * The list is mutable because it is populated as a side effect of * calling the const lookup function. */ List mutable _textures; List mutable _fonts; template T const *_lookup(List &list, char const *path) const { for (T const *e = list.first(); e; e = e->next()) if (Genode::strcmp(e->path.string(), path) == 0) return e; return 0; } typedef String<256> Path; /* * Assemble path name 'styles//