KHtml

khtmlfindbar.h
1 /* This file is part of the KDE project
2  *
3  * Copyright (C) 2008 Bernhard Beschow <bbeschow AT cs DOT tu-berlin DOT de>
4  *
5  * This library is free software; you can redistribute it and/or
6  * modify it under the terms of the GNU Library General Public
7  * License as published by the Free Software Foundation; either
8  * version 2 of the License, or (at your option) any later version.
9  *
10  * This library 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 GNU
13  * Library General Public License for more details.
14  *
15  * You should have received a copy of the GNU Library General Public License
16  * along with this library; see the file COPYING.LIB. If not, write to
17  * the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
18  * Boston, MA 02110-1301, USA.
19  */
20 #ifndef __khtml_findbar_h__
21 #define __khtml_findbar_h__
22 
23 #include "khtmlviewbarwidget.h"
24 #include "ui_khtmlfindbar_base.h"
25 
26 class QMenu;
27 class QAction;
28 
29 class KHTMLFindBar : public KHTMLViewBarWidget, private Ui::KHTMLFindBarBase
30 {
31  Q_OBJECT
32 public:
33  KHTMLFindBar(QWidget *parent = nullptr);
34 
35  /**
36  * Provide the list of @p strings to be displayed as the history
37  * of find strings. @p strings might get truncated if it is
38  * too long.
39  *
40  * @param history The find history.
41  * @see findHistory
42  */
43  void setFindHistory(const QStringList &history);
44 
45  /**
46  * Returns the list of history items.
47  *
48  * @see setFindHistory
49  */
50  QStringList findHistory() const;
51 
52  /*
53  * makes the current pattern be the first entry of the find history.
54  * Return false if the history was empty.
55  *
56  */
57  bool restoreLastPatternFromHistory();
58 
59  /**
60  * Enable/disable the 'search in selection' option, depending
61  * on whether there actually is a selection.
62  *
63  * @param hasSelection true if a selection exists
64  */
65  void setHasSelection(bool hasSelection);
66 
67  /**
68  * Hide/show the 'from cursor' option, depending
69  * on whether the application implements a cursor.
70  *
71  * @param hasCursor true if the application features a cursor
72  * This is assumed to be the case by default.
73  */
74  void setHasCursor(bool hasCursor);
75 
76  /**
77  * Set the options which are checked.
78  *
79  * @param options The setting of the Options.
80  *
81  * @see options()
82  * @see KFind::Options
83  */
84  void setOptions(long options);
85 
86  /**
87  * Returns the state of the options. Disabled options may be returned in
88  * an indeterminate state.
89  *
90  * @see setOptions()
91  * @see KFind::Options
92  */
93  long options() const;
94 
95  /**
96  * Returns the pattern to find.
97  */
98  QString pattern() const;
99 
100  void setFoundMatch(bool match);
101  void setAtEnd(bool atEnd);
102  void setVisible(bool visible) override;
103 
104 protected:
105  bool event(QEvent *e) override;
106 
107 private Q_SLOTS:
108  void slotSelectedTextToggled(bool selec);
109  void slotSearchChanged();
110  void slotAddPatternToHistory();
111 
112 Q_SIGNALS:
113  void searchChanged();
114  void findNextClicked();
115  void findPreviousClicked();
116 
117 private:
118  long m_enabled;
119  QMenu *m_incMenu;
120  QAction *m_caseSensitive;
121  QAction *m_wholeWordsOnly;
122  QAction *m_fromCursor;
123  QAction *m_selectedText;
124  QAction *m_regExp;
125  QAction *m_findLinksOnly;
126  QString m_prevPattern;
127  bool m_atEnd;
128 };
129 
130 #endif
Q_SIGNALSQ_SIGNALS
QString pattern(Mode mode=Reading)
Q_OBJECTQ_OBJECT
Q_SLOTSQ_SLOTS
This file is part of the KDE documentation.
Documentation copyright © 1996-2021 The KDE developers.
Generated on Mon Oct 25 2021 22:48:17 by doxygen 1.8.11 written by Dimitri van Heesch, © 1997-2006

KDE's Doxygen guidelines are available online.