1 /*****************************************************************************
2 * popupwindow.h - QStarDict, a StarDict clone written with using Qt *
3 * Copyright (C) 2007 Alexander Rodin *
5 * This program is free software; you can redistribute it and/or modify *
6 * it under the terms of the GNU General Public License as published by *
7 * the Free Software Foundation; either version 2 of the License, or *
8 * (at your option) any later version. *
10 * This program is distributed in the hope that it will be useful, *
11 * but WITHOUT ANY WARRANTY; without even the implied warranty of *
12 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
13 * GNU General Public License for more details. *
15 * You should have received a copy of the GNU General Public License along *
16 * with this program; if not, write to the Free Software Foundation, Inc., *
17 * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. *
18 *****************************************************************************/
23 #include "resizablepopup.h"
26 #include "dictwidget.h"
35 * The PopupWindow is a window that scan selection and pop-up
38 class PopupWindow: public ResizablePopup
44 * Construct new PopupWindow.
46 PopupWindow(QWidget *parent = 0);
53 * Return true if scanning enabled, otherwise return false.
57 * Return modifier key. The modifiers are from
58 * Qt::KeyboardModifier enum.
60 int modifierKey() const
61 { return m_modifierKey; }
63 * Set behaviour for not found in dictionary words.
65 bool showIfNotFound() const
66 { return m_showIfNotFound; }
71 void setDict(DictCore *dict);
74 * Returns the dictionary.
76 DictCore* dict() const
79 * Return true if shown words will be pronounced, othewise
82 bool pronounceWord() const
83 { return m_pronounceWord; }
85 void setDefaultStyleSheet(const QString &css)
86 { translationView->setDefaultStyleSheet(css); }
88 QString defaultStyleSheet() const
89 { return translationView->defaultStyleSheet(); }
93 * Enable or disable scanning of selection.
95 void setScan(bool scan);
97 * Set modifier key. If key not is 0 then popup will be shown
98 * only if key is pressed.
100 void setModifierKey(int key)
101 { m_modifierKey = key; }
103 * Set beahivour for words that not in dictionaris.
104 * If true then popup will be shown with text "No found", otherwise
105 * popup will not be shown.
107 void setShowIfNotFound(bool mode)
108 { m_showIfNotFound = mode; }
111 * Popup with translation of text.
113 void showTranslation(const QString &text);
115 * If prounounceWord is true shown words will be prounounced.
117 void setPronounceWord(bool pronounceWord)
118 { m_pronounceWord = pronounceWord; }
123 void selectionChanged(const QString &text);
126 void scanChanged(bool scan);
131 DictWidget *translationView;
134 bool m_showIfNotFound;
135 Selection *m_selection;
136 bool m_pronounceWord;
141 #endif // POPUPWINDOW_H
143 // vim: tabstop=4 softtabstop=4 shiftwidth=4 expandtab cindent textwidth=120 formatoptions=tc