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