goldendict-ng/translatebox.hh
Tvangeste 3ed7772996 History Pane rewrite.
The new History Pane features proper mouse and keyboard navigation,
multiple selection and ability to remove the selected entries,
plus a dynamic context menu. Additionaly, the History's size is now
configurable in Preferences.

Use Ctrl+H to show/hide the History Pane.

History Pane's titlebar can be styled via #historyPaneTitleBar, e.g.:

/* Colored header for the History Pane */
  background: lightsteelblue;
  margin: 2px;
}

Closes #162: Make History sidebar independent from the Search Pane
Closes #159: "Send to main window" button from Pop-Up window does nothing when History is shown
Closes #158: Preserve History mode after restart
Closes #157: History with new UI: New words are not added when History is shown
Closes #156: History with new UI: Extra Groups widget in History is shown
Closes #155: History with new UI: Arrow keys navigation in History doesn't work
Closes #154: History with new UI: DEL key does not delete the current history entry
2013-01-17 10:08:53 +01:00

60 lines
1.1 KiB
C++

/* This file is (c) 2012 Tvangeste <i.4m.l33t@yandex.ru>
* Part of GoldenDict. Licensed under GPLv3 or later, see the LICENSE file */
#ifndef TRANSLATEBOX_HH
#define TRANSLATEBOX_HH
#include <extlineedit.hh>
#include <QWidget>
#include <QListWidget>
#include <QFocusEvent>
class CompletionList : public QListWidget
{
Q_OBJECT
public:
CompletionList(QWidget *parent = 0);
int preferredHeight() const;
#if defined(Q_OS_WIN)
void focusOutEvent (QFocusEvent * event) {
if (event->reason() == Qt::ActiveWindowFocusReason)
hide();
}
#endif
public slots:
bool acceptCurrentEntry();
};
class TranslateBox : public QWidget
{
Q_OBJECT
public:
explicit TranslateBox(QWidget * parent = 0);
void setPlaceholderText(const QString &text);
QLineEdit * translateLine();
QListWidget * wordList();
signals:
public slots:
void setPopupEnabled(bool enable);
private slots:
void showPopup();
void rightButtonClicked();
private:
bool eventFilter(QObject *obj, QEvent *event);
CompletionList * word_list;
ExtLineEdit * translate_line;
bool m_popupEnabled;
// QCompleter * completer; // disabled for now
};
#endif // TRANSLATEBOX_HH