epoc32/include/mw/brctldialogsprovider.h
author William Roberts <williamr@symbian.org>
Wed, 31 Mar 2010 12:33:34 +0100
branchSymbian3
changeset 4 837f303aceeb
parent 2 2fe1408b6811
permissions -rw-r--r--
Current Symbian^3 public API header files (from PDK 3.0.h)
This is the epoc32/include tree with the "platform" subtrees removed, and
all but a selected few mbg and rsg files removed.
     1 /*
     2 * Copyright (c) 2006 Nokia Corporation and/or its subsidiary(-ies).
     3 * All rights reserved.
     4 * This component and the accompanying materials are made available
     5 * under the terms of the License "Eclipse Public License v1.0"
     6 * which accompanies this distribution, and is available
     7 * at the URL "http://www.eclipse.org/legal/epl-v10.html".
     8 *
     9 * Initial Contributors:
    10 * Nokia Corporation - initial contribution.
    11 *
    12 * Contributors:
    13 *
    14 * Description:  Handle dialogs needed for browser operation
    15 *
    16 */
    17 
    18 
    19 #ifndef BRCTLDIALOGSPROVIDER_H
    20 #define BRCTLDIALOGSPROVIDER_H
    21 
    22 //  INCLUDES
    23 #include <e32std.h>
    24 #include <e32base.h>
    25 
    26 /**
    27 * Type of selection list
    28 */
    29 enum TBrCtlSelectOptionType
    30     {
    31     ESelectTypeMultiple,  ///< Multiple select - Display a checkbox
    32     ESelectTypeSingle,    ///< Single select - Display a radio button
    33     ESelectTypeNone,      ///< Single select - Do not display any button
    34     /**
    35     * No buttons (single selection only)
    36     * OK softkey is available
    37     * Cancel button is not available
    38     */
    39     ESelectTypeOkOnly,
    40     /**
    41      * Added enumeration ESelectTypeWithFindPane at offset of 0x100 so that
    42      * the limit of different types of dialog boxes can be upto 256.
    43      * Any user who wants a list with find pane must "|" with a defined type
    44      * above like ESelectTypeNone | ESelectTypeWithFindPane to obtain a list
    45      * box with find pane.
    46      */
    47     ESelectTypeWithFindPane = 0x100
    48     };
    49 
    50 /**
    51 * Defines the type of image if it cannot be recognized by the
    52 * Symbian image conversion library.
    53 */
    54 
    55 enum TBrCtlImageType
    56     {
    57     EImageTypeAny, ///< Automatically recognized by the image converter
    58     EImageTypeWbmp, ///< Wireless Bitmap (WBMP) image
    59     EImageTypeOta ///< Over The Air (OTA) image
    60     };
    61 
    62 
    63 // FORWARD DECLARATIONS
    64 class TBrCtlSelectOptionData;
    65 class CBrCtlObjectInfo;
    66 class TBrCtlImageCarrier;
    67 
    68 /**
    69 * The MBrDialogsProvider class provides functions implemented by
    70 * the Browser Control to display dialogs, such as error notifications,
    71 * authentication requests, and selection lists.
    72 *
    73 * Usage:
    74 *
    75 * @code
    76 *  #include <brctldialogsprovider.h>
    77 *
    78 *
    79 * @see S60 Platform: Browser Control API Developer's Guide Version 2.0
    80 * @lib BrowserEngine.lib
    81 * @file brctldialogsprovider.h
    82 * @endcode     *
    83 */
    84 class MBrCtlDialogsProvider
    85     {
    86     public: // New functions
    87 
    88         /**
    89         * Notifies the user of an error encountered during a download.
    90         * Some examples are: insufficient memory, unrecognized URL, and DNS not found.
    91         * @since 2.8
    92         * @param aErrCode The error that occured
    93         * @return void
    94         */
    95         virtual void DialogNotifyErrorL(TInt aErrCode) = 0;
    96 
    97         /**
    98         * Notifies the user of an error from the HTTP server
    99         * during a download. Some examples are: file not found, redirect error.
   100         * @since 2.8
   101         * @param aErrCode The error that occured
   102         * @param aUri The uri of the request that failed
   103         * @return void
   104         */
   105         virtual void DialogNotifyHttpErrorL(TInt aErrCode, const TDesC& aUri) = 0;
   106 
   107         /**
   108         * Navigates through your file system and selects a file;
   109         * analogous to the Browse command in Windows.
   110         * @since 2.8
   111         * @param aStartPath The initial displayed directory
   112         * @param aRootPath The top most directory that the user can go up to
   113         * @param aSelectedFileName The selected file name.
   114         * @return ETrue if the user selected a file
   115         * EFalse if the user cancelled the transaction and did not select a file.
   116         * @attiontion Returned on cleanup stack. Browser control will free the buffer.
   117         */
   118         virtual TBool DialogFileSelectLC(const TDesC& aStartPath,
   119                                          const TDesC& aRootPath,
   120                                          HBufC*& aSelectedFileName) = 0;
   121 
   122         /**
   123         * List selection dialog
   124         * @since 2.8
   125         * @param Title of the selection dialog. This is optional.
   126         * @param aBrCtlSelectOptionType The type of the list box.
   127         * Values: One of the following:
   128         * Check boxes (multiple selections allowed)
   129         * Radio buttons (single selection only). For example, highlight a URL listed
   130         *   in the session History.
   131         *   No buttons (single selection only)
   132         * No buttons (single selection only), OK softkey available
   133         * For example, if you are about to download a plug-in, you can choose
   134         * to display the content in the Web page or in a viewer application.
   135         * @param aOptions A list of options to display
   136         * @return EFalse if the user canceled the dialog selection
   137         * ETrue if the user selected an option.
   138         */
   139         virtual TBool DialogSelectOptionL(const TDesC& aTitle,
   140                                           TBrCtlSelectOptionType aBrCtlSelectOptionType,
   141                                           CArrayFix<TBrCtlSelectOptionData>& aOptions) = 0;
   142 
   143         /**
   144         * User Authentication dialog.
   145         * @since 2.8
   146         * @param aUrl The url requiring authentication
   147         * @param aRealm The realm requiring authentication
   148         * @param aDefaultUserName The user name that was used before for this realm and path, if any
   149         * @param aReturnedUserName The user name entered by the user
   150         * @param aReturnedPasswd The password entered by the user
   151         * @param aBasicAuthentication ETrue if basic authentication is required.
   152         * EFalse if another type of authentication is required; for example, Digest.
   153         * Default: EFalse
   154         * @return EFalse if the user cancelled the selection
   155         * ETrue if the user selected an option.
   156         @ attiontion User name and password are returned on cleanup stack.
   157         */
   158         virtual TBool DialogUserAuthenticationLC(const TDesC& aUrl,
   159                                                  const TDesC& aRealm,
   160                                                  const TDesC& aDefaultUserName,
   161                                                  HBufC*& aReturnedUserName,
   162                                                  HBufC*& aReturnedPasswd,
   163                                                  TBool aBasicAuthentication = EFalse) = 0;
   164 
   165         /**
   166         * Displays a message to the user.
   167         * For example, the message may inform the user
   168         * about an error encountered while processing a request.
   169         * @since 2.8
   170         * @param aMessage The message to display
   171         * @return void
   172         * @attention Softkeys are not supported.
   173         * The message disappears after a time out.
   174         */
   175         virtual void DialogNoteL(const TDesC& aMessage) = 0;
   176 
   177         /**
   178         * Display a note to the user with ok softkey only
   179         * @since 2.8
   180         * @param aTitle The title, could be empty
   181         * @param aMessage The message to display
   182         * @return void
   183         * @attention The OK softkey is supported.
   184         * The message displays until the user presses OK.
   185         */
   186         virtual void DialogAlertL(const TDesC& aTitle, const TDesC& aMessage) = 0;
   187 
   188         /**
   189         * Display confirmation message to the user.
   190         * For example, Are you sure you want to delete this?
   191         * @since 2.8
   192         * @param aTitle The title, could be empty
   193         * @param aMessage The message to display
   194         * @param aYesMessage The text to display on left softkey
   195         * @param aNoMessage The text to display on right softkey
   196         * @return EFalse if the user cancelled the selection
   197         * ETrue if the user selected an option.
   198         */
   199         virtual TBool DialogConfirmL(const TDesC& aTitle,
   200                                      const TDesC& aMessage,
   201                                      const TDesC& aYesMessage,
   202                                      const TDesC& aNoMessage) = 0;
   203 
   204         /**
   205         * Displays an input dialog to the user. Asks the user to input data.
   206         * @since 2.8
   207         * @param aTitle The title, could be empty
   208         * @param aMessage The message to display
   209         * @param aDefaultInput The default input if available
   210         * @param aReturnedInput The input entered by the user.
   211         * @return EFalse if the user cancelled the selection
   212         * ETrue if the user selected an option.
   213         * @attention Returned on the cleanup stack.
   214         */
   215         virtual TBool DialogPromptLC(const TDesC& aTitle,
   216                                      const TDesC& aMessage,
   217                                      const TDesC& aDefaultInput,
   218                                      HBufC*& aReturnedInput) = 0;
   219 
   220         /**
   221         * Displays information about the Netscape plug-in object and
   222         * requests confirmation before downloading the object.
   223         * @since 2.8
   224         * @param aBrCtlObjectInfo Information about the object to be downloaded.
   225         * The following information is passes as part of this object:
   226         * Content type
   227         * Size
   228         * Flag to indicate whether a viewer application exists for this content
   229         * Flag to indicate whether a Netscape plug-in exists that supports this content
   230         * Name of the application or Netscape plug-in with which the content can
   231         * be viewed on the mobile phone
   232         * @return EFalse if the user cancelled the selection
   233         * ETrue if the user selected an option.
   234         */
   235         virtual TBool DialogDownloadObjectL(CBrCtlObjectInfo* aBrCtlObjectInfo) = 0;
   236 
   237         /**
   238         * Display the images that appear in the current page
   239         * @since 2.8
   240         * @param aPageImages Array describing the images that appear in the current page.
   241         * The array contains the following elements for each image:
   242         * Image data
   243         * URL of the image
   244         * Title for the image
   245         * Image type
   246         * If the image type is WBMP or OTA, it must be specified.
   247         * Symbian can detect any other image type.
   248         * @return void
   249         */
   250         virtual void DialogDisplayPageImagesL(CArrayFixFlat<TBrCtlImageCarrier>& aPageImages) = 0;
   251 
   252         /**
   253         * Cancels the dialog displayed due to browser exit or destroyed pages.
   254         * @since 2.8
   255         * @return void
   256         */
   257         virtual void CancelAll() = 0;
   258 
   259         /**
   260         * Displays a dialog for searching on the page.
   261         * @since 3.0
   262         * @return void
   263         */
   264        virtual void DialogFindL() = 0;
   265 
   266     };
   267 
   268 
   269 /**
   270 * The TBrCtlSelectOptionData class represents a list of elements
   271 * to display in the list box. This class is used for the List Selection Dialog.
   272 * @code
   273 *  #include <brctldialogsprovider.h>
   274 * @lib BrowserEngine.lib
   275 * @since 2.8
   276 * @file brctldialogsprovider.h
   277 * @endcode     *
   278 */
   279 class TBrCtlSelectOptionData
   280     {
   281     public:
   282         /**
   283         * Default Constructor
   284         * @return TbrCtlSelectOptionData object
   285         * @since 2.8
   286         */
   287         inline TBrCtlSelectOptionData()
   288                 {
   289                 iText.Set(NULL, 0);
   290                 iIsSelected = EFalse;
   291                 iIsOptGroup = EFalse;
   292                 iHasOnPick = EFalse;
   293                 }
   294 
   295         /**
   296         * Constructor
   297         * @since 2.8
   298         * @param aText The text to display with this element
   299         * @param aIsSelected If the element is selected
   300         * @param aIsOptGroup If a title of option group or an element
   301         * @param aHasOnPick If has onPick, The dialog should close when the element is selected
   302         * @return TbrCtlSelectOptionData object
   303         */
   304         inline TBrCtlSelectOptionData( const TDesC& aText,
   305                                         TBool aIsSelected,
   306                                         TBool aIsOptGroup,
   307                                         TBool aHasOnPick )
   308                                                             {
   309                                                             iText.Set(aText);
   310                                                             iIsSelected = aIsSelected;
   311                                                             iIsOptGroup = aIsOptGroup;
   312                                                             iHasOnPick = aHasOnPick;
   313                                                             }
   314         /**
   315         * Gets the display text associated with a specified option.
   316         * @since 2.8
   317         * @return A reference to a Symbian TDesC object that
   318         * contains the text associated with this option.
   319         */
   320         inline const TDesC& Text() const {return iText;}
   321         /**
   322         * Indicates whether or not an option is selected.
   323         * @since 2.8
   324         * @return ETrue if the option is selected
   325         * EFalse if the option is not selected
   326         */
   327         inline TBool IsSelected() const {return iIsSelected;}
   328         /**
   329         * Indicates whether an option group member
   330         * variable is a group title or a selectable option.
   331         * @since 2.8
   332         * @return ETrue if the listed item is the title of an option group
   333         * EFalse if the listed item is one of the options from which to select
   334         */
   335         inline TBool IsOptGroup() const {return iIsOptGroup;}
   336         /**
   337         * Indicates whether or not the dialog closes when an option is selected.
   338         * @since 2.8
   339         * @return ETrue if the dialog closes when the element is selected.
   340         * This is known as having OnPick capability.
   341         * EFalse if the dialog does not close when the element is selected
   342         */
   343         inline TBool HasOnPick() const {return iHasOnPick;}
   344         /**
   345         * Sets the text of the option object.
   346         * @since 2.8
   347         * @param aText A reference to a TDesC object that contains the
   348         * text to associate with a particular option.
   349         * @return None
   350         */
   351 
   352         inline void SetText( TDesC& aText )             { iText.Set( aText ); }
   353         /**
   354         * Sets the selection state of an option.
   355         * @since 2.8
   356         * @param aIsSelected The state of the IsSelected member variable.
   357         * Value:
   358         * ETrue if the option is selected
   359         * EFalse if the option is not selected
   360         * @return None
   361         */
   362         inline void SetIsSelected( TBool aIsSelected )  { iIsSelected = aIsSelected; }
   363         /**
   364         * Sets the state of the option group member variable.
   365         * Indicates whether an option group member variable is a group title
   366         * or a selectable option.
   367         * @since 2.8
   368         * @param aIsOptGroup The state of the option group.
   369         * Value:
   370         * ETrue if the listed item is the title of an option group.
   371         * EFalse if the listed item is one of the options from which to select.
   372         * @return None
   373         */
   374         inline void SetIsOptGroup( TBool aIsOptGroup )  { iIsOptGroup = aIsOptGroup; }
   375         /**
   376         * Sets the state of the hasOnPick member variable.
   377         * Indicates whether or not the dialog closes when an option is selected.
   378         * @since 2.8
   379         * @param aHasOnPick
   380         * ETrue if the dialog closes when the element is selected. This
   381         * is known as having OnPick capability.
   382         * EFalse if the dialog does not close when the element is selected
   383         * @return None
   384         */
   385         inline void SetHasOnPick( TBool aHasOnPick )    { iHasOnPick = aHasOnPick; }
   386 
   387     private:    // Data
   388         // The text associated with the element
   389         TPtrC iText;
   390         // Flag if the element is selected
   391         TBool iIsSelected;
   392         // Flag if an element or oprion group title
   393         TBool iIsOptGroup;
   394         // Flag if the element has onPick
   395         TBool iHasOnPick;
   396     };
   397 
   398 /**
   399 * The CBrCtlObjectInfo class used to represent the information about the
   400 * plugin object.
   401 * @code
   402 *  #include <brctldialogsprovider.h>
   403 * @lib BrowserEngine.lib
   404 * @since 3.0
   405 * @file brctldialogsprovider.h
   406 * @endcode     *
   407 */
   408 class CBrCtlObjectInfo : public CBase
   409   {
   410   public:
   411         /**
   412         * Default Constructor
   413         * @since 2.8
   414         */
   415         CBrCtlObjectInfo();
   416 
   417         /**
   418         * Constructor
   419         * @since 3.0
   420         * @param aAppSupported A flag if there is a viewer app for this object
   421         * @param aPluginSupported A flag if there is a netscape plugin for this object
   422         * @param aSize The size of the object
   423         * @param aAppName The name of the viewer app or netscape plugin that supports this object
   424         * @param aFileType The content type of the object
   425         * @return CBrCtlObjectInfo object
   426         */
   427     CBrCtlObjectInfo(TBool aAppSupported, TBool aPluginSupported,
   428                          const TDesC& aSize, const TDesC& aAppName,
   429                          const TDesC& aFileType);
   430   public:
   431         /**
   432         * Sets the flag if there is a viewer app for this object
   433         * @since 3.0
   434         * @param aAppSupported ETrue if there is a viewer app for this object
   435         * EFalse if there is not a viewer app for this object.
   436         * @return None
   437         */
   438         inline void SetAppSupported(TBool aAppSupported) {iAppSupported = aAppSupported;}
   439         /**
   440         * Sets the flag if there is a netscape plugin for this object
   441         * @since 3.0
   442         * @param aPluginSupported ETrue if there is a netscape plugin for this object
   443         * EFalse if there is not a netscape plugin for this object.
   444         * @return None
   445         */
   446         inline void SetPluginSupported(TBool aPluginSupported) {iPluginSupported = aPluginSupported;}
   447         /**
   448         * Sets the size of the object
   449         * @since 3.0
   450         * @param aSize Symbian descriptor containing the size of the object
   451         * @return None
   452         */
   453         inline void SetSize(const TDesC& aSize) {iSize.Set(aSize);}
   454         /**
   455         * Sets the name of the viewer app or netscape plugin that supports this object
   456         * @since 3.0
   457         * @param aAppName  Symbian descriptor containing the name of
   458         * the viewer app or netscape plugin that supports this object.
   459         * @return None
   460         */
   461     inline void SetAppName(const TDesC& aAppName) {iAppName.Set(aAppName);}
   462         /**
   463         * Sets the content type of the object
   464         * @since 3.0
   465         * @param aFileType Symbian descriptor holding content type of the object
   466         * @return None
   467         */
   468     inline void SetFileType(const TDesC& aFileType) {iFileType.Set(aFileType);}
   469         /**
   470         * Tells if there is a viewer app for this object
   471         * @since 3.0
   472         * @param None
   473         * @return  ETrue if there is a viewer app for this object
   474         * EFalse if there is not a viewer app for this object.
   475         */
   476         inline TBool AppSupported() {return iAppSupported;}
   477         /**
   478         * Tells if there is a netscape plugin for this object
   479         * @since 3.0
   480         * @param None
   481         * @return ETrue if there is a netscape plugin for this object
   482         * EFalse if there is not a netscape plugin for this object.
   483         */
   484         inline TBool PluginSupported() {return iPluginSupported;}
   485         /**
   486         * Gets the size of the object
   487         * @since 3.0
   488         * @param None
   489         * @return Symbian descriptor containing the size of the object
   490         */
   491         inline const TDesC& Size() const {return iSize;}
   492         /**
   493         * Gets the name of the viewer app or netscape plugin that supports this object
   494         * @since 3.0
   495         * @param None
   496         * @return Symbian descriptor containing the name of
   497         * the viewer app or netscape plugin that supports this object.
   498         */
   499     inline const TDesC& AppName() const {return iAppName;}
   500         /**
   501         * Gets the content type of the object
   502         * @since 3.0
   503         * @param None
   504         * @return Symbian descriptor holding content type of the object
   505         */
   506     inline const TDesC& FileType() const {return iFileType;}
   507   private:
   508     // A flag if there is a viewer app for this object
   509         TBool iAppSupported;
   510         // A flag if there is a Netscape plugin for this object
   511     TBool iPluginSupported;
   512         // The size of the object
   513     TPtrC iSize;
   514         // The name of the viewer app or Netscape plugin
   515     TPtrC iAppName;
   516         // The content type of the object
   517     TPtrC iFileType;
   518   };
   519 
   520 /**
   521 * TheTBrCtlImageCarrier class used to give the information about the
   522 * image.
   523 * @code
   524 *  #include <brctldialogsprovider.h>
   525 * @lib BrowserEngine.lib
   526 * @since 2.8
   527 * @file brctldialogsprovider.h
   528 * @endcode     *
   529 */
   530 class TBrCtlImageCarrier
   531     {
   532     public:
   533         /**
   534         * Constructor
   535         * @since 2.8
   536         * @param aRawData The image data
   537         * @param aUrl The url of the image
   538         * @param aAltText The alt text of the image
   539         * @param aImageType The type of the image
   540         */
   541         TBrCtlImageCarrier(const TDesC8& aRawData, const TDesC& aUrl,
   542             const TDesC& aAltText, TBrCtlImageType aImageType, const TDesC& aContentType ) :
   543             iRawData( aRawData ),
   544             iUrl( aUrl ),
   545             iAltText( aAltText ),
   546             iImageType(aImageType),
   547       iContentType(aContentType)
   548             {
   549             }
   550         /**
   551         * Provides the image data
   552         * @since 3.0
   553         * @param None
   554         * @return Symbian descriptor containing image data
   555         */
   556         inline const TDesC8& RawData() const {return iRawData;}
   557         /**
   558         * Provides the url of the image
   559         * @since 3.0
   560         * @param None
   561         * @return Symbian descriptor containing url of the image
   562         */
   563         inline const TDesC& Url() const {return iUrl;}
   564         /**
   565         * Provides the alt text of the image
   566         * @since 3.0
   567         * @param None
   568         * @return Symbian descriptor containing alt text of the image
   569         */
   570         inline const TDesC& AltText() const {return iAltText;}
   571         /**
   572         * Provides the type of the image
   573         * @since 3.0
   574         * @param None
   575         * @return Symbian descriptor containing the type of the image
   576         */
   577         inline TBrCtlImageType ImageType() const {return iImageType;}
   578         /**
   579         * Provides the content type of the image
   580         * @since 3.1
   581         * @param None
   582         * @return Symbian descriptor containing content type of the image
   583         */
   584         inline const TDesC& ContentType() const {return iContentType;}
   585     private:
   586         TPtrC8 iRawData;
   587         TPtrC iUrl;
   588         TPtrC iAltText;
   589         TBrCtlImageType iImageType;
   590     TPtrC iContentType;
   591     };
   592 
   593 
   594 #endif      // BRCTLDIALOGSPROVIDER_H
   595 
   596 // End of File