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 findBufferChanged();
46 void findClicked(bool const backwards = false);
47 void findPrevClicked();
48 void replaceClicked(bool const backwards = false);
49 void replacePrevClicked();
50 void replaceallClicked();
51 void minimizeClicked(bool const toggle = true);
53 void needTitleBarUpdate() const;
54 void needSizeUpdate() const;
58 void keyPressEvent(QKeyEvent * e) override;
60 void showEvent(QShowEvent * e) override;
61 /// Searches occurrence of string
62 void find(docstring const & search,
63 bool casesensitive, bool matchword, bool forward);
64 /// Replaces occurrence of string
65 void replace(docstring const & search, docstring const & replace,
66 bool casesensitive, bool matchword,
67 bool forward, bool all);
69 BufferView const * bv_ = {};
71 bool minimized_ = false;
75 class GuiSearch : public DockView
81 GuiView & parent, ///< the main window where to dock.
82 Qt::DockWidgetArea area = Qt::BottomDockWidgetArea, ///< Position of the dock (and also drawer)
83 Qt::WindowFlags flags = {});
85 /// Controller inherited method.
87 bool initialiseParams(std::string const &) override { return true; }
88 void clearParams() override {}
89 void dispatchParams() override {}
90 bool isBufferDependent() const override { return true; }
91 void updateView() override;
92 void saveSession(QSettings & settings) const override;
93 void restoreSession() override;
94 bool wantInitialFocus() const override { return true; }
99 void onBufferViewChanged() override;
102 /// update title display
108 /// The encapsulated widget.
109 GuiSearchWidget * widget_;
112 } // namespace frontend
115 #endif // GUISEARCH_H