Imported version 0.3-2
[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 Conf;
30 class DictMngr;
31 class Library;
32 class MStarDict;
33
34 class MStarDict {
35   private:
36     GtkWidget *main_window;
37     GtkWidget *label_widget;
38     GtkWidget *results_widget;
39     GtkWidget *search;
40     GtkWidget *results_view;
41     GtkWidget *results_view_scroll;
42
43     GtkListStore *results_list;
44
45     TSearchResultList results;
46
47     static gboolean onResultsViewSelectionChanged(GtkTreeSelection *selection,
48                                                   MStarDict *mStarDict);
49     static gboolean onSearchEntryChanged(GtkEditable *editable,
50                                          MStarDict *mStarDict);
51     static gboolean onDictionariesMenuItemClicked(GtkButton *button,
52                                                   MStarDict *mStarDict);
53     static gboolean onQuitMenuItemClicked(GtkButton *button,
54                                           MStarDict *mStarDict);
55     static gboolean onLookupProgressDialogResponse(GtkDialog *dialog,
56                                                    gint response_id,
57                                                    bool *cancel);
58     static gboolean onMainWindowKeyPressEvent(GtkWidget *window,
59                                               GdkEventKey *event,
60                                               MStarDict *mStarDict);
61
62   public:
63      MStarDict();
64     ~MStarDict();
65
66     Conf *oConf;
67     DictMngr *oDict;
68     Library *oLibs;
69
70     GtkWidget *CreateLookupProgressDialog(bool *cancel);
71     void DestroyLookupProgressDialog(GtkWidget *dialog);
72     void CreateTranslationWindow(const gchar *bookname,
73                                  const gchar *def,
74                                  const gchar *exp);
75     void CreateMainWindow();
76     void CreateMainMenu();
77
78     void SearchWord();
79
80     void ResultsListClear();
81     void ResultsListInsertLast(const gchar *word);
82     void ResultsReScroll();
83     void ResultsUnselectAll(GtkSelectionMode mode);
84     void ShowNoResults(bool bNoResults);
85     void ShowNoDictionary(bool bNoDictionary);
86     void ShowProgressIndicator(bool bShow);
87 };