classicui_plat/item_finder_api/inc/ItemFinder.h
branchRCL_3
changeset 56 d48ab3b357f1
parent 55 aecbbf00d063
equal deleted inserted replaced
55:aecbbf00d063 56:d48ab3b357f1
    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;
       
    40 class MTouchFeedback;
    36 
    41 
    37 // CLASS DECLARATION
    42 // CLASS DECLARATION
    38 class MItemFinderObserver
    43 class MItemFinderObserver
    39     {
    44     {
    40     public:
    45     public:
    44 /**
    49 /**
    45 * Parser plugin
    50 * Parser plugin
    46 */
    51 */
    47 NONSHARABLE_CLASS(CItemFinder) :
    52 NONSHARABLE_CLASS(CItemFinder) :
    48     public CBase,
    53     public CBase,
    49     public MParser
    54     public MParser,
       
    55     public MCoeMessageMonitorObserver
    50     {
    56     {
    51     public:  // Constructors and destructor
    57     public:  // Constructors and destructor
    52 
    58 
    53         /**
    59         /**
    54         * Destructor.
    60         * Destructor.
   219         * @since Series 60 3.2
   225         * @since Series 60 3.2
   220         *
   226         *
   221         * Tells whether the point tapped inside the editor text body was hit some find item.
   227         * 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.
   228         * Also updates the current item selection and cursor position when necessary.
   223         *
   229         *
   224         * @param    aTappedPoint Tapped point relative to the upper left point of the editor text body control.
   230         * @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.
   231         *           of the editor text body control.
       
   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
   226         */
   236         */
   227         IMPORT_C TBool ItemWasTappedL( const TPoint aTappedPoint );
   237         IMPORT_C TBool ItemWasTappedL( const TPoint aTappedPoint );
   228 
   238 
   229         /**
   239         /**
   230         * @since Series 60 3.2
   240         * @since Series 60 3.2
   252         * Returns the current selection of the text buffer on the screen.
   262         * Returns the current selection of the text buffer on the screen.
   253         *
   263         *
   254         * @return   current selection of the text buffer on the screen.
   264         * @return   current selection of the text buffer on the screen.
   255         */
   265         */
   256         IMPORT_C TPtrC CurrentSelection();
   266         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;
   257 
   291 
   258     private:
   292     private:
   259 
   293 
   260         /**
   294         /**
   261         * C++ default constructor.
   295         * C++ default constructor.
   280 
   314 
   281         TInt GetMinDigitsToFindL();
   315         TInt GetMinDigitsToFindL();
   282 
   316 
   283         TInt RefreshEditor();
   317         TInt RefreshEditor();
   284 
   318 
       
   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 
   285     private:    // Data
   344     private:    // Data
   286 
   345 
   287         CEikRichTextEditor** iEditor; // Not owned
   346         CEikRichTextEditor** iEditor; // Not owned
   288         TInt iFlags;
   347         TInt iFlags;
   289 
   348 
   305         MItemFinderObserver* iExternalObserver; // not owned
   364         MItemFinderObserver* iExternalObserver; // not owned
   306 
   365 
   307         friend class CItemFinderAsyncParser;
   366         friend class CItemFinderAsyncParser;
   308 
   367 
   309         TInt iMinDigitsToFind;
   368         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         
   310     };
   405     };
   311 
   406 
   312 #endif      // ITEMFINDER_H
   407 #endif      // ITEMFINDER_H
   313 
   408 
   314 // End of File
   409 // End of File