classicui_plat/item_finder_api/inc/ItemFinder.h
branchRCL_3
changeset 15 08e69e956a8c
parent 0 2f259fa3e83a
child 23 3d340a0166ff
equal deleted inserted replaced
10:9f56a4e1b8ab 15:08e69e956a8c
    22 #ifndef ITEMFINDER_H
    22 #ifndef ITEMFINDER_H
    23 #define ITEMFINDER_H
    23 #define ITEMFINDER_H
    24 
    24 
    25 // INCLUDES
    25 // INCLUDES
    26 #include <mparser.h>                       // for MParser
    26 #include <mparser.h>                       // for MParser
       
    27 #include <coemain.h>                       // for MCoeMessageMonitorObserver
    27 
    28 
    28 // CONSTANTS
    29 // CONSTANTS
    29 
    30 
    30 // FORWARD DECLARATIONS
    31 // FORWARD DECLARATIONS
    31 class CEikRichTextEditor;
    32 class CEikRichTextEditor;
    32 class CFindItemEngine;
    33 class CFindItemEngine;
    33 class CItemFinderAsyncParser;
    34 class CItemFinderAsyncParser;
    34 class CSchemeResolver;
    35 class CSchemeResolver;
    35 class CFindItemEngine;
    36 class CFindItemEngine;
       
    37 class MAknItemFinderObserver;
       
    38 class CCoeEnv;
       
    39 class CCoeControl;
    36 
    40 
    37 // CLASS DECLARATION
    41 // CLASS DECLARATION
    38 class MItemFinderObserver
    42 class MItemFinderObserver
    39     {
    43     {
    40     public:
    44     public:
    44 /**
    48 /**
    45 * Parser plugin
    49 * Parser plugin
    46 */
    50 */
    47 NONSHARABLE_CLASS(CItemFinder) :
    51 NONSHARABLE_CLASS(CItemFinder) :
    48     public CBase,
    52     public CBase,
    49     public MParser
    53     public MParser,
       
    54     public MCoeMessageMonitorObserver
    50     {
    55     {
    51     public:  // Constructors and destructor
    56     public:  // Constructors and destructor
    52 
    57 
    53         /**
    58         /**
    54         * Destructor.
    59         * Destructor.
   219         * @since Series 60 3.2
   224         * @since Series 60 3.2
   220         *
   225         *
   221         * Tells whether the point tapped inside the editor text body was hit some find item.
   226         * Tells whether the point tapped inside the editor text body was hit some find item.
   222         * Also updates the current item selection and cursor position when necessary.
   227         * Also updates the current item selection and cursor position when necessary.
   223         *
   228         *
   224         * @param    aTappedPoint Tapped point relative to the upper left point of the editor text body control.
   229         * @param    aTappedPoint Tapped point relative to the upper left point
   225         * @return   ETrue if some find item inside editor text body was tapped. Otherwise EFalse.
   230         *           of the editor text body control.
       
   231         * @return   ETrue if some find item inside editor text body was tapped. 
       
   232         *           Otherwise EFalse. If observer is given, then this returns
       
   233         *           always EFalse, since the information is given via observer
       
   234         *           interface
   226         */
   235         */
   227         IMPORT_C TBool ItemWasTappedL( const TPoint aTappedPoint );
   236         IMPORT_C TBool ItemWasTappedL( const TPoint aTappedPoint );
   228 
   237 
   229         /**
   238         /**
   230         * @since Series 60 3.2
   239         * @since Series 60 3.2
   252         * Returns the current selection of the text buffer on the screen.
   261         * Returns the current selection of the text buffer on the screen.
   253         *
   262         *
   254         * @return   current selection of the text buffer on the screen.
   263         * @return   current selection of the text buffer on the screen.
   255         */
   264         */
   256         IMPORT_C TPtrC CurrentSelection();
   265         IMPORT_C TPtrC CurrentSelection();
       
   266         
       
   267         /**
       
   268         * Sets external observer (Must implement MAknItemFinderObserver) to
       
   269         * which notify item activations.
       
   270         *
       
   271         * @param   aObserver Observer which will be notified about item activations
       
   272         * @since   S60 5.2
       
   273         */
       
   274         IMPORT_C void SetItemFinderObserverL( MAknItemFinderObserver*
       
   275                 aObserver );
       
   276 
       
   277         /**
       
   278          * From @c MCoeMessageMonitorObserver, this method is called
       
   279          * when a window server event is received.
       
   280          *
       
   281          * @param  aEvent  received event.
       
   282          */
       
   283         void MonitorWsMessage( const TWsEvent& aEvent );
       
   284 
       
   285         /**
       
   286          *  Returns text highlight status.
       
   287          *  @return ETrue if there is highlighted text, otherwise EFalse
       
   288          */
       
   289         TBool HasSelection () const;
   257 
   290 
   258     private:
   291     private:
   259 
   292 
   260         /**
   293         /**
   261         * C++ default constructor.
   294         * C++ default constructor.
   280 
   313 
   281         TInt GetMinDigitsToFindL();
   314         TInt GetMinDigitsToFindL();
   282 
   315 
   283         TInt RefreshEditor();
   316         TInt RefreshEditor();
   284 
   317 
       
   318         /**
       
   319          *  Sets window conrol, that is used when monitoring pointer events
       
   320          *  @param aControl pointer to editor control
       
   321          */
       
   322         void SetWindowControl( CCoeControl* aControl ); 
       
   323 
       
   324         /**
       
   325          *  Monitors pointer events and calls observer when item is tapped. 
       
   326          *  @param aEvent pointer event
       
   327          *  @param aTargetControl control that the pointer event is targeted to
       
   328          */
       
   329         void MonitorPointerEventL( TPointerEvent& aEvent, CCoeControl* aTargetControl );
       
   330 
       
   331         /**
       
   332          *  Modifies pointer event so that it is relative to editor control
       
   333          *  @param aTapPoint tapped point
       
   334          */
       
   335         void ModifyPointerEvent( TPoint& aTapPoint );
       
   336 
       
   337         /**
       
   338          *  Returns drag threshold.
       
   339          *  @return drag threshold
       
   340          */
       
   341         TInt DragThresholdL();
       
   342 
   285     private:    // Data
   343     private:    // Data
   286 
   344 
   287         CEikRichTextEditor** iEditor; // Not owned
   345         CEikRichTextEditor** iEditor; // Not owned
   288         TInt iFlags;
   346         TInt iFlags;
   289 
   347 
   305         MItemFinderObserver* iExternalObserver; // not owned
   363         MItemFinderObserver* iExternalObserver; // not owned
   306 
   364 
   307         friend class CItemFinderAsyncParser;
   365         friend class CItemFinderAsyncParser;
   308 
   366 
   309         TInt iMinDigitsToFind;
   367         TInt iMinDigitsToFind;
       
   368 
       
   369         /** 
       
   370          * Pointer to item activation observer
       
   371          */
       
   372         MAknItemFinderObserver* iItemFinderObserver; // not owned
       
   373         /**
       
   374          * Control environment.
       
   375          * Not own.
       
   376          */
       
   377         CCoeEnv* iCoeEnv;
       
   378         
       
   379         /**
       
   380          * Tells if focus move is allowed. 
       
   381          */
       
   382         TBool iAllowHighlight;
       
   383 
       
   384         /**
       
   385          * CCoeControl that owns the window and receives pointer events. 
       
   386          */
       
   387         CCoeControl* iWindowControl;
       
   388 
       
   389         /**
       
   390          * Tap point. 
       
   391          */
       
   392         TPoint iTapPoint;
       
   393         
       
   394         /**
       
   395          * Drag threshold
       
   396          */
       
   397         TInt iDragThreshold;
       
   398         
   310     };
   399     };
   311 
   400 
   312 #endif      // ITEMFINDER_H
   401 #endif      // ITEMFINDER_H
   313 
   402 
   314 // End of File
   403 // End of File