idlehomescreen/widgetmanager/inc/wmportalbutton.h
changeset 2 08c6ee43b396
parent 1 5315654608de
child 9 f966699dea19
equal deleted inserted replaced
1:5315654608de 2:08c6ee43b396
    23 #include "wmimageconverter.h"
    23 #include "wmimageconverter.h"
    24 #include "wmcommon.h"
    24 #include "wmcommon.h"
    25 
    25 
    26 // FORWARD DECLARATIONS
    26 // FORWARD DECLARATIONS
    27 class CWmMainContainer;
    27 class CWmMainContainer;
       
    28 class CFbsBitmap;
    28 
    29 
    29 /**
    30 /**
    30  * Portal button ( ovi, operator ) class for Wm
    31  * Portal button ( ovi, operator ) class for Wm
    31  * 
    32  * 
    32  * @class   CWmPortalButton wmportalbutton.h
    33  * @class   CWmPortalButton wmportalbutton.h
    33  */
    34  */
    34 NONSHARABLE_CLASS( CWmPortalButton ) : public CAknButton,
    35 NONSHARABLE_CLASS( CWmPortalButton ) : public CAknButton,
    35                                        public MConverterObserver 
    36                                        public MConverterObserver,
       
    37                                        public MCoeControlObserver
    36     {
    38     {
    37 public:
    39 public:
    38     /*
    40     /*
    39      * Two-phased constructor.
    41      * Two-phased constructor.
    40      * 
    42      * 
    41      * @param aParent button title text
    43      * @param aParent button title text
    42      * @param aText button title text
    44      * @param aPortalButtonIndex index of this button (0 or 1)
    43      * @param aUrl Url to open in browser when clicked.  
       
    44      * @param aButtonCtrlId type of button 
       
    45      */
    45      */
    46     static CWmPortalButton* NewL(
    46     static CWmPortalButton* NewL(
    47             const CCoeControl* aParent,
    47             const CCoeControl* aParent,
    48             const TDesC& aText = KNullDesC,
    48             TInt aPortalButtonIndex = 0 );
    49             const TDesC& aUrl = KNullDesC, 
       
    50             TWmUiControlIds aButtonCtrlId = EOviPortal );
       
    51     
    49     
    52     /** Destructor */
    50     /** Destructor */
    53     virtual ~CWmPortalButton();
    51     virtual ~CWmPortalButton();
    54                                       
    52                                       
    55 public: // Functions from base class
    53 public: // Functions from base class
    56     
    54 
    57     /**
       
    58      * Handles key events.
       
    59      * 
       
    60      * @see CCoeControl::OfferKeyEventL
       
    61      */
       
    62 	TKeyResponse OfferKeyEventL( 
       
    63 	        const TKeyEvent& aKeyEvent, TEventCode aType );
       
    64             
       
    65     /**
       
    66 	 * Handles pointer events.
       
    67 	 * 
       
    68 	 * @see CCoeControl::HandlePointerEventL
       
    69 	 */
       
    70     void HandlePointerEventL( const TPointerEvent& aPointerEvent );
       
    71     
       
    72     /*
    55     /*
    73      * Draws the control.
    56      * Draws the control.
    74      * 
    57      * 
    75      * @see CCoeControl::Draw
    58      * @see CCoeControl::Draw
    76      */
    59      */
    81      * 
    64      * 
    82      * @see CCoeControl::SizeChanged
    65      * @see CCoeControl::SizeChanged
    83      */
    66      */
    84     void SizeChanged();
    67     void SizeChanged();
    85     
    68     
       
    69     /**
       
    70      * Executes action for button pressed
       
    71      */
       
    72     void ExecuteL();
       
    73     
    86 protected: // from MConverterObserver
    74 protected: // from MConverterObserver
    87 
    75 
    88     /** image conversin completed */
    76     /** image conversin completed */
    89     void NotifyCompletion( TInt aError );
    77     void NotifyCompletion( TInt aError );
    90    
    78 
       
    79 protected: // from MCoeControlObserver
       
    80 
       
    81     /** Observes the button's own activity  */
       
    82     void HandleControlEventL( CCoeControl* aControl, TCoeEvent aEventType );
       
    83     
    91 protected: // Constructors
    84 protected: // Constructors
    92     
    85     
    93     /** Constructor for performing 1st stage construction */
    86     /** Constructor for performing 1st stage construction */
    94     CWmPortalButton( const TInt aFlags,
    87     CWmPortalButton( const TInt aFlags,
    95             TWmUiControlIds aButtonCtrlId = EOviPortal );
    88             TInt aPortalButtonIndex );
    96     
    89     
    97     /** 2nd phase constructor */
    90     /** 2nd phase constructor */
    98     void ConstructL( 
    91     void ConstructL( 
    99             const CCoeControl* aParent,
    92             CWmMainContainer* aParent,
   100             const TDesC& aText = KNullDesC,
    93             const TDesC& aText = KNullDesC,
   101             const TDesC& aUrl = KNullDesC );
    94             const TDesC& aIcon = KNullDesC );
   102     
    95     
   103 private:
    96 private:
   104 
    97 
   105     /** 
    98     /** size of button icon, defined in the layout */
   106 	 * Draws text over button
    99     TSize LayoutIconSize() const;
   107 	 */
   100     
       
   101     /** Draws text over button */
   108     void DrawText( CWindowGc& aGc,
   102     void DrawText( CWindowGc& aGc,
   109                    const TDesC& aText, 
   103                    const TDesC& aText, 
   110                    TAknTextComponentLayout& aLayout,
   104                    TAknTextComponentLayout& aLayout,
   111                    TInt aMargin ) const;
   105                    TInt aMargin ) const;
   112 
   106 
   113 private: //data members
   107 private: //data members
   114     /**
       
   115      * Button text
       
   116      */ 
       
   117     HBufC* iText;
       
   118 
       
   119     /**
       
   120      * Url assigned to button
       
   121      */ 
       
   122     HBufC* iUrl;
       
   123 
   108 
   124     /**
   109     /**
   125      * the image converter utility
   110      * the image converter utility
   126      */    
   111      */    
   127     CWmImageConverter*  iImageConverter;
   112     CWmImageConverter*  iImageConverter;
   130      * Parent control
   115      * Parent control
   131      */ 
   116      */ 
   132     CWmMainContainer* iWmMainContainer;
   117     CWmMainContainer* iWmMainContainer;
   133 
   118 
   134     /** 
   119     /** 
   135      * Button ctrl id
   120      * Button index
   136      */ 
   121      */ 
   137     TWmUiControlIds iButtonCtrlId;
   122     TInt iPortalButtonIndex;
       
   123 
       
   124     /** icon */
       
   125     CFbsBitmap* iButtonIcon;
       
   126     
       
   127     /** icon mask */
       
   128     CFbsBitmap* iButtonIconMask;
   138  	};
   129  	};
   139 
   130 
   140 #endif //___WMPORTALBUTTON_H__
   131 #endif //___WMPORTALBUTTON_H__
   141 
   132 
   142 // End of File
   133 // End of File