[KLF Backend][KLF Tools][KLF Home]
KLatexFormula Project
Public Member Functions
KLFSearchable Class Reference

An interface for objects that can be I-searched with a KLFSearchBar (OBSOLETE) More...

#include <klfsearchbar.h>

Inheritance diagram for KLFSearchable:
Inheritance graph
[legend]
Collaboration diagram for KLFSearchable:
Collaboration graph
[legend]

List of all members.

Public Member Functions

 KLFSearchable ()
virtual ~KLFSearchable ()
virtual bool searchFind (const QString &queryString, bool forward)=0
 Find the first occurence of a query string.
bool searchFind (const QString &queryString)
 Find the first occurence of a query string.
virtual bool searchFindNext (bool forward)=0
 Find next or previous occurence of query string.
virtual void searchAbort ()=0
 Abort I-Search.
virtual Pos searchFind (const QString &queryString, const Pos &fromPos, bool forward)
virtual void searchMoveToPos (const Pos &pos)
virtual void searchPerformed (const QString &queryString, bool found, const Pos &pos)
virtual void searchAborted ()

Detailed Description

An interface for objects that can be I-searched with a KLFSearchBar (OBSOLETE)

THIS CLASS IS OBSOLETE. Use KLFPosSearchable instead.

This class is the base skeleton interface for displays that will be targets for I-searches. There are three functions to reimplement:

 virtual bool searchFind(const QString& queryString, bool forward);
 virtual bool searchFindNext(bool forward);
 virtual void searchAbort();

That have to actually perform the search.

It is not uncommon for the display widget itself to inherit also from a KLFSearchable. See KLFAbstractLibView and KLFLibDefautlView for an example (in klfapp library).

This class is pretty low-level search (you have to manually walk all items, remember the query string for future find-next operations, etc.). For a higher-level search implementation, see KLFIteratorSearchable (which itself is a KLFSearchable object and can also be used as target for KLFSearchBar).

Definition at line 346 of file klfsearchbar.h.


Constructor & Destructor Documentation

Definition at line 240 of file klfsearchbar.cpp.

Definition at line 243 of file klfsearchbar.cpp.


Member Function Documentation

virtual void KLFSearchable::searchAbort ( ) [pure virtual]

Abort I-Search.

The behavior depends on the object/data being searched. This could be reimplemented for example to return to the beginning of the list, or to the position where the user was at the beginning of the search.

Implemented in KLFSearchableProxy.

Referenced by KLFSearchableProxy::searchAbort().

virtual void KLFSearchable::searchAborted ( ) [inline, virtual]

Implements KLFPosSearchable.

Definition at line 401 of file klfsearchbar.h.

virtual bool KLFSearchable::searchFind ( const QString queryString,
bool  forward 
) [pure virtual]

Find the first occurence of a query string.

This function has to be reimplemented to find the first occurence of the string queryString, searching from top of the displayed information if forward is TRUE, or reverse from end of display of FALSE.

The reimplementation should call from time to time

 qApp->processEvents() 

to keep the GUI from freezing in long searches.

Note:
If the reimplementation implements the above suggestion, note that the slot searchAbort() may be called during that time! It is best to take that into account and provide a means to stop the search if that is the case.

Implemented in KLFSearchableProxy.

Referenced by searchFind(), and KLFSearchableProxy::searchFind().

bool KLFSearchable::searchFind ( const QString queryString) [inline]

Find the first occurence of a query string.

This function is provided for calling convenience. Subclasses should reimplement searchFind(const QString&, bool) instead.

This function directly calls searchFind(const QString& bool) with the forward argument set to TRUE.

Definition at line 374 of file klfsearchbar.h.

References searchFind().

Referenced by searchFind().

KLFPosSearchable::Pos KLFSearchable::searchFind ( const QString queryString,
const Pos fromPos,
bool  forward 
) [virtual]
virtual bool KLFSearchable::searchFindNext ( bool  forward) [pure virtual]

Find next or previous occurence of query string.

This function has to be reimplemented to find the next occurence of the query string given by a previous call to searchFind(). The search must be performed in the direction given by forward (see searchFind()).

It is up to the sub-class to remember the query string and the current match location.

This function should also call the applications's processEvents() to keep the GUI from freezing. See documentation in searchFind().

Implemented in KLFSearchableProxy.

Referenced by searchFind(), and KLFSearchableProxy::searchFindNext().

virtual void KLFSearchable::searchMoveToPos ( const Pos pos) [inline, virtual]

Reimplemented from KLFPosSearchable.

Definition at line 397 of file klfsearchbar.h.

virtual void KLFSearchable::searchPerformed ( const QString queryString,
bool  found,
const Pos pos 
) [inline, virtual]

Reimplemented from KLFPosSearchable.

Definition at line 399 of file klfsearchbar.h.


The documentation for this class was generated from the following files:

Generated by doxygen 1.7.6.1. The KLatexFormula website is hosted on sourceforge.net