4 * This file is part of LyX, the document processor.
5 * Licence details can be found in the file COPYING.
8 * \author Angus Leeming
10 * Full author contact details are available in file CREDITS.
16 #include "GuiDialog.h"
19 #include <QDockWidget>
21 #include "ui_SearchUi.h"
28 class GuiSearchWidget : public QWidget, public Ui::SearchUi
33 GuiSearchWidget(QWidget * parent);
35 void saveSession(QSettings & settings, QString const & session_key) const;
37 void restoreSession(QString const & session_key);
39 void setBufferView(BufferView const * bv) { bv_ = bv; }
41 bool isMinimized() { return minimized_; }
45 void findClicked(bool const backwards = false);
46 void findPrevClicked();
47 void replaceClicked(bool const backwards = false);
48 void replacePrevClicked();
49 void replaceallClicked();
50 void minimizeClicked(bool const toggle = true);
52 void needTitleBarUpdate() const;
53 void needSizeUpdate() const;
57 void keyPressEvent(QKeyEvent * e) override;
59 void showEvent(QShowEvent * e) override;
60 /// Searches occurrence of string
61 void find(docstring const & search,
62 bool casesensitive, bool matchword, bool forward);
63 /// Replaces occurrence of string
64 void replace(docstring const & search, docstring const & replace,
65 bool casesensitive, bool matchword,
66 bool forward, bool all);
68 BufferView const * bv_ = {};
70 bool minimized_ = false;
74 class GuiSearch : public DockView
80 GuiView & parent, ///< the main window where to dock.
81 Qt::DockWidgetArea area = Qt::BottomDockWidgetArea, ///< Position of the dock (and also drawer)
82 Qt::WindowFlags flags = {});
84 /// Controller inherited method.
86 bool initialiseParams(std::string const &) override { return true; }
87 void clearParams() override {}
88 void dispatchParams() override {}
89 bool isBufferDependent() const override { return true; }
90 void updateView() override;
91 void saveSession(QSettings & settings) const override;
92 void restoreSession() override;
93 bool wantInitialFocus() const override { return true; }
98 void onBufferViewChanged() override;
101 /// update title display
107 /// The encapsulated widget.
108 GuiSearchWidget * widget_;
111 } // namespace frontend
114 #endif // GUISEARCH_H