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 initialiseParams(std::string const &);
43 bool isMinimized() { return minimized_; }
47 void findBufferChanged();
48 void findClicked(bool const backwards = false);
49 void findPrevClicked();
50 void replaceClicked(bool const backwards = false);
51 void replacePrevClicked();
52 void replaceallClicked();
53 void minimizeClicked(bool const toggle = true);
55 void needTitleBarUpdate() const;
56 void needSizeUpdate() const;
60 void keyPressEvent(QKeyEvent * e) override;
62 void showEvent(QShowEvent * e) override;
63 /// Searches occurrence of string
64 void find(docstring const & search,
65 bool casesensitive, bool matchword,
66 bool forward, bool instant, bool wrap);
67 /// Replaces occurrence of string
68 void replace(docstring const & search, docstring const & replace,
69 bool casesensitive, bool matchword,
70 bool forward, bool all, bool wrap);
72 BufferView const * bv_ = nullptr;
74 bool minimized_ = false;
78 class GuiSearch : public DockView
84 GuiView & parent, ///< the main window where to dock.
85 Qt::DockWidgetArea area = Qt::BottomDockWidgetArea, ///< Position of the dock (and also drawer)
86 Qt::WindowFlags flags = {});
88 /// Controller inherited method.
90 bool initialiseParams(std::string const & sdata) override
91 { return widget_->initialiseParams(sdata); }
92 void clearParams() override {}
93 void dispatchParams() override {}
94 bool isBufferDependent() const override { return true; }
95 void updateView() override;
96 void saveSession(QSettings & settings) const override;
97 void restoreSession() override;
98 bool wantInitialFocus() const override { return true; }
103 void onBufferViewChanged() override;
106 /// update title display
112 /// The encapsulated widget.
113 GuiSearchWidget * widget_;
116 } // namespace frontend
119 #endif // GUISEARCH_H