1 /* 2 * Copyright 2011 kubtek <kubtek@mail.com> 3 * 4 * This file is part of StarDict. 5 * 6 * StarDict is free software: you can redistribute it and/or modify 7 * it under the terms of the GNU General Public License as published by 8 * the Free Software Foundation, either version 3 of the License, or 9 * (at your option) any later version. 10 * 11 * StarDict is distributed in the hope that it will be useful, 12 * but WITHOUT ANY WARRANTY; without even the implied warranty of 13 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 14 * GNU General Public License for more details. 15 * 16 * You should have received a copy of the GNU General Public License 17 * along with StarDict. If not, see <http://www.gnu.org/licenses/>. 18 */ 19 20 #ifndef _TREEDICT_HPP_ 21 #define _TREEDICT_HPP_ 22 23 #include <gtk/gtk.h> 24 25 #include "ifo_file.h" 26 #include "dictbase.h" 27 28 typedef std::list<std::string> strlist_t; 29 30 class TreeDict : public DictBase { 31 public: 32 TreeDict(); 33 bool load(const std::string& ifofilename); get_model()34 static GtkTreeStore *get_model() { return model; } 35 private: 36 static GtkTreeStore *model; 37 38 bool load_ifofile(const std::string& ifofilename, gulong *tdxfilesize); 39 void load_model(gchar **buffer, GtkTreeIter *parent, guint32 count); 40 }; 41 42 class TreeDicts { 43 public: 44 TreeDicts(); 45 ~TreeDicts(); 46 void load_dict(const std::string& url); 47 GtkTreeStore* Load(const strlist_t& tree_dicts_dirs, 48 const strlist_t& order_list, 49 const strlist_t& disable_list); 50 gchar * poGetWordData(guint32 offset, guint32 size, int iTreeDict); 51 private: 52 std::vector<TreeDict *> oTreeDict; 53 }; 54 55 #endif//!_TREEDICT_HPP_ 56