25 #ifndef KLFSEARCHBAR_H 26 #define KLFSEARCHBAR_H 129 virtual bool equals(
PosData *other)
const = 0;
150 Pos(
const Pos& other) : posdata(other.posdata)
157 posdata.setAutoDelete(posdata->wantAutoDelete());
170 klfDbg(
"posdata="<<posdata) ;
171 return (posdata != NULL) ;
181 if (valid() && other.
valid())
184 return (valid() == other.
valid());
215 KLF_ASSERT_NOT_NULL(ptr,
"accessing a posdata that is NULL or of incompatible type!",
return NULL;) ;
232 virtual Pos searchStartFrom(
bool forward);
252 virtual Pos searchFind(
const QString& queryString,
const Pos& fromPos,
bool forward) = 0;
263 { Q_UNUSED(queryString); Q_UNUSED(found); Q_UNUSED(pos); }
267 virtual void searchAborted() = 0;
288 virtual void setSearchInterruptRequested(
bool on);
292 bool pInterruptRequested;
304 virtual Pos searchStartFrom(
bool forward);
305 virtual Pos searchFind(
const QString& queryString,
const Pos& fromPos,
bool forward);
306 virtual void searchMoveToPos(
const Pos& pos);
307 virtual void searchPerformed(
const QString& queryString,
bool found,
const Pos& pos);
308 virtual void searchAborted();
309 virtual void searchReinitialized();
310 virtual QString searchQueryString()
const;
311 virtual void setSearchQueryString(
const QString& s);
312 virtual bool searchHasInterruptRequested();
313 virtual void setSearchInterruptRequested(
bool on);
365 virtual bool searchFind(
const QString& queryString,
bool forward) = 0;
386 virtual bool searchFindNext(
bool forward) = 0;
393 virtual void searchAbort() = 0;
396 virtual Pos searchFind(
const QString& queryString,
const Pos& fromPos,
bool forward);
400 { Q_UNUSED(queryString); Q_UNUSED(found); Q_UNUSED(pos); }
419 virtual void setTarget(
KLFTarget *target);
421 virtual bool searchFind(
const QString& queryString,
bool forward);
422 virtual bool searchFindNext(
bool forward);
423 virtual void searchAbort();
432 struct KLFSearchBarPrivate;
468 Q_PROPERTY(
QString currentSearchText READ currentSearchText) ;
469 Q_PROPERTY(
bool autoHide READ autoHide WRITE setAutoHide) ;
470 Q_PROPERTY(
bool showOverlayMode READ showOverlayMode WRITE setShowOverlayMode) ;
471 Q_PROPERTY(
QRect showOverlayRelativeGeometry READ showOverlayRelativeGeometry
472 WRITE setShowOverlayRelativeGeometry ) ;
473 Q_PROPERTY(
QString focusOutText READ focusOutText WRITE setFocusOutText) ;
474 Q_PROPERTY(
QColor colorFound READ colorFound WRITE setColorFound) ;
475 Q_PROPERTY(
QColor colorNotFound READ colorNotFound WRITE setColorNotFound) ;
476 Q_PROPERTY(
bool showHideButton READ hideButtonShown WRITE setShowHideButton) ;
477 Q_PROPERTY(
bool showSearchLabel READ showSearchLabel WRITE setShowSearchLabel) ;
478 Q_PROPERTY(
bool emacsStyleBackspace READ emacsStyleBackspace WRITE setEmacsStyleBackspace) ;
479 Q_PROPERTY(
int resetTimeout READ resetTimeout WRITE setResetTimeout) ;
488 virtual void registerShortcuts(QWidget *parent);
493 virtual void setTarget(
KLFTarget *target);
495 QString currentSearchText()
const;
496 bool autoHide()
const;
497 bool showOverlayMode()
const;
498 QRect showOverlayRelativeGeometry()
const;
501 QColor colorFound()
const;
503 QColor colorNotFound()
const;
504 bool hideButtonShown()
const;
505 bool showSearchLabel()
const;
506 bool emacsStyleBackspace()
const;
507 int resetTimeout()
const;
517 void setAutoHide(
bool autohide);
524 void setShowOverlayMode(
bool showOverlayMode);
525 void setShowOverlayRelativeGeometry(
const QRect& relativeGeometryPercent);
526 void setShowOverlayRelativeGeometry(
int widthPercent,
int heightPercent,
527 int positionXPercent,
int positionYPercent);
528 void setColorFound(
const QColor& color);
529 void setColorNotFound(
const QColor& color);
530 void setShowHideButton(
bool showHideButton);
531 void setShowSearchLabel(
bool show);
532 void setEmacsStyleBackspace(
bool on);
537 void setResetTimeout(
int ms);
541 QLineEdit * editor();
545 void searchPerformed(
bool found);
546 void searchPerformed(
const QString& queryString,
bool found);
548 void found(
const QString& queryString,
bool forward);
551 void didNotFind(
const QString& queryString,
bool forward);
552 void searchAborted();
553 void escapePressed();
554 void searchReinitialized();
560 void hasMatch(
bool hasmatch);
562 void visibilityChanged(
bool isShown);
570 void focusOrNext(
bool forward =
true);
574 void find(
const QString&
string);
575 void find(
const QString&
string,
bool forward);
576 void findNext(
bool forward =
true);
582 virtual void setSearchText(
const QString& text);
583 void setFocusOutText(
const QString& focusOutText);
589 bool searchBarHasFocus();
591 virtual bool event(
QEvent *event);
595 friend class KLFSearchBarDesPlugin;
599 virtual void slotSearchFocusIn();
600 virtual void slotSearchFocusOut();
601 virtual void slotSearchReset();
602 virtual void updateSearchFound(
bool found);
604 void promptEmptySearch();
616 void showSearchBarText(
const QString& text);
622 KLFSearchBarPrivate *d;
624 void adjustOverlayGeometry();
633 void performFind(
bool forward,
bool isFindNext =
false);
virtual KLFSearchable * target()
void setSearchTarget(KLFPosSearchable *target)
bool equals(const Pos &other) const
An object that can be searched with a KLFSearchBar.
virtual bool wantAutoDelete()
Base declarations for klatexformula and some utilities.
virtual QString searchQueryString() const
The current query string.
#define klfDbg(streamableItems)
print debug stream items
#define KLF_DEBUG_BLOCK(msg)
Utility to debug the execution of a block.
virtual void searchAborted()
#define KLF_DEBUG_DECLARE_ASSIGNABLE_REF_INSTANCE()
Declare that this class has an assignable debugging ref-instance.
#define KLF_ASSERT_NOT_NULL(ptr, msg, failaction)
Asserting Non-NULL pointers (NON-FATAL)
virtual void searchPerformed(const QString &queryString, bool found, const Pos &pos)
KLF_EXPORT QDebug & operator<<(QDebug &str, const KLFPosSearchable::Pos &pos)
An Search Bar for Incremental Search.
virtual void searchMoveToPos(const Pos &pos)
virtual const KLFPosSearchable * target() const
virtual bool searchHasInterruptRequested()
virtual void setSearchTarget(KLFPosSearchable *t)
virtual QString toDebug()
Stores a pointer to an object with refcount.
virtual void searchPerformed(const QString &queryString, bool found, const Pos &pos)
KLFRefPtr< PosData > posdata
Stores the actual position data, see PosData.
virtual void searchReinitialized()
virtual void setSearchTarget(KLFPosSearchable *target)
An abstract position in a searchable object.
bool searchFind(const QString &queryString)
Find the first occurence of a query string.
A proxy class that relays search queries to another searchable object (OBSOLETE)
virtual KLFPosSearchable * target()
virtual void setSearchQueryString(const QString &s)
virtual void searchMoveToPos(const Pos &pos)
TT * data() const
A shorthand for retrieving the posdata cast into the custom type.
A Base class for storing abstract position data.
An interface for objects that can be I-searched with a KLFSearchBar (OBSOLETE)
Pos & operator=(const Pos &other)