Fixed typo in word Preferences (Preferencies->Preferences).
[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 #include "lib/pluginmanager.h"
30
31 extern MStarDict *pMStarDict;
32
33 class Conf;
34 class DictMngr;
35 class TransWin;
36 class Library;
37 class MStarDict;
38 class PrefsDlg;
39 class Tts;
40
41 class MStarDict {
42   private:
43     GtkWidget *window;
44     GtkWidget *label_widget;
45     GtkWidget *results_widget;
46     GtkWidget *search_entry;
47     GtkWidget *results_view;
48     GtkWidget *results_view_scroll;
49
50     GtkListStore *results_list;
51
52     static gboolean onResultsViewSelectionChanged(GtkTreeSelection *selection,
53                                                   MStarDict *mStarDict);
54     static gboolean onSearchEntryChanged(GtkEditable *editable,
55                                          MStarDict *mStarDict);
56     static gboolean onSearchClearClicked(GtkButton *button,
57                                          MStarDict *mStarDict);
58     static gboolean onDictionariesMenuItemClicked(GtkButton *button,
59                                                   MStarDict *mStarDict);
60     static gboolean onPreferencesMenuItemClicked(GtkButton *button,
61                                                  MStarDict *mStarDict);
62     static gboolean onQuitMenuItemClicked(GtkButton *button,
63                                           MStarDict *mStarDict);
64     static gboolean onLookupProgressDialogResponse(GtkDialog *dialog,
65                                                    gint response_id,
66                                                    bool *cancel);
67     static gboolean onMainWindowKeyPressEvent(GtkWidget *window,
68                                               GdkEventKey *event,
69                                               MStarDict *mStarDict);
70
71   public:
72      MStarDict();
73     ~MStarDict();
74
75     Conf *oConf;
76     DictMngr *oDict;
77     TransWin *oTransWin;
78     Library *oLibs;
79     StarDictPlugins *oPlugins;
80     PrefsDlg *oPrefs;
81     Tts *oTts;
82
83     GtkWidget *CreateLookupProgressDialog(bool *cancel);
84     void DestroyLookupProgressDialog(GtkWidget *dialog);
85     void CreateMainWindow();
86     GtkWidget *GetMainWindow();
87     GtkWidget *CreateSearchBar();
88     void CreateMainMenu();
89
90     void SearchWord();
91
92     void ResultsListClear();
93     void ResultsListInsertLast(const gchar *word);
94     void ResultsReScroll();
95     void ResultsUnselectAll(GtkSelectionMode mode);
96     void ShowNoResults(bool bNoResults);
97     void ShowNoDictionary(bool bNoDictionary);
98     void ShowProgressIndicator(bool bShow);
99     void GrabFocus();
100 };