412ea409848dded8fac9807207d9e92bc44cb826
[mstardict] / src / mstardict.hpp
1 /*
2  *  MStarDict - International dictionary for Maemo.
3  *  Copyright (C) 2010 Roman Moravcik
4  *
5  *  base on code of stardict:
6  *  Copyright (C) 2003-2007 Hu Zheng <huzheng_001@163.com>
7  *
8  *  based on code of sdcv:
9  *  Copyright (C) 2005-2006 Evgeniy <dushistov@mail.ru>
10  *
11  *  This program is free software; you can redistribute it and/or modify
12  *  it under the terms of the GNU General Public License as published by
13  *  the Free Software Foundation; either version 2 of the License, or
14  *  (at your option) any later version.
15  *
16  *  This program is distributed in the hope that it will be useful,
17  *  but WITHOUT ANY WARRANTY; without even the implied warranty of
18  *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
19  *  GNU General Public License for more details.
20  *
21  *  You should have received a copy of the GNU General Public License
22  *  along with this program; if not, write to the Free Software
23  *  Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
24  */
25
26 #include <gtk/gtk.h>
27 #include <hildon/hildon.h>
28
29 class Library;
30 class MStarDictConf;
31 class MStarDict;
32
33 extern MStarDict *pMStarDict;
34
35 class MStarDict {
36   private:
37     GtkWidget *main_window;
38     GtkWidget *label_widget;
39     GtkWidget *results_widget;
40     GtkWidget *search;
41     GtkWidget *results_view;
42     GtkWidget *results_view_scroll;
43
44     GtkListStore *results_list;
45
46     Library *oLibs;
47     MStarDictConf *oConf;
48     TSearchResultList results;
49
50     static gboolean onResultsViewSelectionChanged(GtkTreeSelection *selection,
51                                                   MStarDict *mStarDict);
52     static gboolean onSearchEntryChanged(GtkEditable *editable,
53                                          MStarDict *mStarDict);
54     static gboolean onDictionariesMenuItemClicked(GtkButton *button,
55                                                   MStarDict *mStarDict);
56     static gboolean onQuitMenuItemClicked(GtkButton *button,
57                                           MStarDict *mStarDict);
58
59   public:
60      MStarDict();
61     ~MStarDict();
62
63     void CreateTranslationWindow(const gchar *bookname,
64                                  const gchar *def,
65                                  const gchar *exp);
66     void CreateMainWindow();
67     void CreateMainMenu();
68
69     void GetAllDictionaryList(std::list < std::string > &dict_list);
70     void LoadDictionaries();
71     void ReLoadDictionaries(std::list < std::string > &dict_list);
72
73     void ResultsListClear();
74     void ResultsListInsertLast(const gchar *word);
75     void ReScroll();
76     void ShowNoResults(bool bNoResults);
77     void ShowNoDictionary(bool bNoDictionary);
78     void ShowProgressIndicator(bool bShow);
79 };