epoc32/include/mw/eiksbfrm.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.
williamr@2
     1
/*
williamr@2
     2
* Copyright (c) 1997-1999 Nokia Corporation and/or its subsidiary(-ies).
williamr@2
     3
* All rights reserved.
williamr@2
     4
* This component and the accompanying materials are made available
williamr@4
     5
* under the terms of "Eclipse Public License v1.0"
williamr@2
     6
* which accompanies this distribution, and is available
williamr@4
     7
* at the URL "http://www.eclipse.org/legal/epl-v10.html".
williamr@2
     8
*
williamr@2
     9
* Initial Contributors:
williamr@2
    10
* Nokia Corporation - initial contribution.
williamr@2
    11
*
williamr@2
    12
* Contributors:
williamr@2
    13
*
williamr@2
    14
* Description:
williamr@2
    15
*
williamr@2
    16
*/
williamr@2
    17
williamr@2
    18
	
williamr@2
    19
#if !defined(__EIKSBFRM_H__)
williamr@2
    20
#define __EIKSBFRM_H__
williamr@2
    21
williamr@2
    22
#include <lafpublc.h>
williamr@2
    23
#if !defined(__AKNSCRLB_H__)
williamr@2
    24
#include <aknscrlb.h>
williamr@2
    25
#endif
williamr@2
    26
 
williamr@2
    27
class CEikCba;
williamr@2
    28
williamr@2
    29
/**
williamr@2
    30
 * Enables setting of the frame layout for a scroll bar.
williamr@2
    31
 */
williamr@2
    32
class TEikScrollBarFrameLayout
williamr@2
    33
    {
williamr@2
    34
williamr@2
    35
public:
williamr@2
    36
williamr@2
    37
    /** 
williamr@2
    38
     * Determines whether the client rectangle or the inclusive rectangle
williamr@2
    39
     * remains constant.
williamr@2
    40
     */
williamr@2
    41
    enum TTilingMode
williamr@2
    42
        {
williamr@2
    43
williamr@2
    44
        /** The client rectangle remains constant. */
williamr@2
    45
        EClientRectConstant,
williamr@2
    46
williamr@2
    47
        /** The inclusive rectangle remains constant. */
williamr@2
    48
        EInclusiveRectConstant
williamr@2
    49
        };
williamr@2
    50
williamr@2
    51
public:
williamr@2
    52
williamr@2
    53
    /**
williamr@2
    54
     * C++ default constructor.
williamr@2
    55
     */
williamr@2
    56
    IMPORT_C TEikScrollBarFrameLayout();
williamr@2
    57
williamr@2
    58
    /**
williamr@2
    59
     * Sets all inclusive margins.
williamr@2
    60
     *
williamr@2
    61
     * @param aMargin The value to use for all inclusive margins.
williamr@2
    62
     */
williamr@2
    63
    IMPORT_C void SetInclusiveMargin(TInt aMargin);
williamr@2
    64
williamr@2
    65
    /**
williamr@2
    66
     * Sets all client margins. These surround the client rectangle which is
williamr@2
    67
     * the client area viewport onto the larger canvas to be scrolled.
williamr@2
    68
     *
williamr@2
    69
     * @param aMargin The value to use for all client margins.
williamr@2
    70
     */
williamr@2
    71
    IMPORT_C void SetClientMargin(TInt aMargin);
williamr@2
    72
williamr@2
    73
public:
williamr@2
    74
williamr@2
    75
    /** The inclusive margin (in twips or pixels). */
williamr@2
    76
    TMargins iInclusiveMargin;
williamr@2
    77
williamr@2
    78
    /** 
williamr@2
    79
     * The amount of screen movement performed when the nudge button is 
williamr@2
    80
     * pressed.
williamr@2
    81
     */
williamr@2
    82
    TMargins iClientMargin;
williamr@2
    83
williamr@2
    84
    /** 
williamr@2
    85
     * The amount of screen movement performed when the nudge button is
williamr@2
    86
     * pressed.
williamr@2
    87
     */
williamr@2
    88
    TSize iClientAreaGranularity;
williamr@2
    89
williamr@2
    90
    /** 
williamr@2
    91
     * Determines whether the client rectangle, or the inclusive rectangle,
williamr@2
    92
     * remains constant.
williamr@2
    93
     */
williamr@2
    94
    TTilingMode iTilingMode;
williamr@2
    95
    };
williamr@2
    96
williamr@2
    97
williamr@2
    98
class CEikCornerWindow;
williamr@2
    99
class CEikScrollBarFrameExtension;
williamr@2
   100
williamr@2
   101
/**
williamr@2
   102
 * The scroll bar frame is a control assemblage manager that relates a control,
williamr@2
   103
 * or control body, to two scroll bars and a corner window. A corner window is
williamr@2
   104
 * that part of the screen that is common to both the horizontal, and the 
williamr@2
   105
 * vertical elements of a scroll bar.
williamr@2
   106
 *
williamr@2
   107
 * This class helps with access to, and set up of, scroll bars and also with 
williamr@2
   108
 * the layout of the scrolled control or control body. A scroll bar frame is 
williamr@2
   109
 * not a control, but it does implement the standard control composite pattern
williamr@2
   110
 * to manage the assemblage.
williamr@2
   111
 */
williamr@2
   112
class CEikScrollBarFrame : public CBase
williamr@2
   113
    {
williamr@2
   114
	
williamr@2
   115
public:	// enums 
williamr@2
   116
williamr@2
   117
    DECLARE_TYPE_ID(0x101F8672)   
williamr@2
   118
williamr@2
   119
    /** Defines the scroll bar’s visibility.*/
williamr@2
   120
    enum TScrollBarVisibility
williamr@2
   121
        {
williamr@2
   122
        /** Scroll bar not visible.*/
williamr@2
   123
        EOff,
williamr@2
   124
williamr@2
   125
        /** Scroll bar visible.*/
williamr@2
   126
        EOn,
williamr@2
   127
williamr@2
   128
        /** Scroll bar visible if required.*/
williamr@2
   129
        EAuto
williamr@2
   130
        };
williamr@2
   131
williamr@2
   132
    /** Defines the type of scroll bar.*/	
williamr@2
   133
    enum TScrollBarType
williamr@2
   134
        {
williamr@2
   135
        /** Scroll bar complete with shaft. Not used.*/
williamr@2
   136
        ENormalScrollBar =0x0,
williamr@2
   137
williamr@2
   138
        /** Floating arrow head scroll bar, without shaft. Legacy type. */
williamr@2
   139
        EArrowHead =0x200,
williamr@2
   140
williamr@2
   141
        /** Spanned scroll bar. */
williamr@2
   142
        EDoubleSpan =0x400
williamr@2
   143
        };
williamr@2
   144
williamr@2
   145
    /** Defines where the scroll bar is located. */		
williamr@2
   146
    enum TScrollBarSide
williamr@2
   147
        {
williamr@2
   148
        /** 
williamr@2
   149
         * Scroll bar located at the bottom, or to the right of the scroll bar
williamr@2
   150
         * frame.
williamr@2
   151
         */
williamr@2
   152
        EBottomOrRight =0x0,
williamr@2
   153
williamr@2
   154
        /** 
williamr@2
   155
         * Scroll bar located at the top, or to the left of the scroll bar
williamr@2
   156
         * frame.
williamr@2
   157
         */
williamr@2
   158
        ETopOrLeft =0x800
williamr@2
   159
        };
williamr@2
   160
		
williamr@2
   161
    /** Determines how the scroll bar frame manages scroll bars.*/
williamr@2
   162
    enum TScrollBarManagement 
williamr@2
   163
        {
williamr@2
   164
        /** 
williamr@2
   165
         * The scroll bar frame creates, destroys and recreates, scroll bars
williamr@2
   166
         * according to the visibility mode. The scroll bar frame also acts as
williamr@2
   167
         * an intermediary with its owning control so that the scroll bars can
williamr@2
   168
         * be treated as component controls.
williamr@2
   169
         */
williamr@2
   170
        EComponent                  ,//=SLafScrollBarFrame::EComponent,
williamr@2
   171
williamr@2
   172
        /** 
williamr@2
   173
         * The scroll bar frame creates, destroys and recreates, scroll bars 
williamr@2
   174
         * according to the visibility mode. In this case, the scroll bars are
williamr@2
   175
         * not treated as component controls. Instead, the scroll bars are 
williamr@2
   176
         * geometry managed in windows floating above the control window and
williamr@2
   177
         * their position is determined in relation to the frame’s position on
williamr@2
   178
         * the screen.
williamr@2
   179
         */
williamr@2
   180
        EFloating                   ,//=SLafScrollBarFrame::EFloating,
williamr@2
   181
williamr@2
   182
        /** 
williamr@2
   183
         * The scroll bar frame uses the central application scroll bar as held
williamr@2
   184
         * in the environment. This scroll bar is neither owned by the frame 
williamr@2
   185
         * nor treated as a component control of the frame’s owner.
williamr@2
   186
         */
williamr@2
   187
        EApplicationScrollBar       //=SLafScrollBarFrame::EApplicationScrollBar
williamr@2
   188
        };
williamr@2
   189
williamr@2
   190
    /**
williamr@2
   191
     * Defines that is the horizontal or the vertical (spanned) scroll bar
williamr@2
   192
     * visible. Applicaple  only for spanned scroll bars.
williamr@2
   193
     */
williamr@2
   194
    enum TScrollBarFrameFlags
williamr@2
   195
        {
williamr@2
   196
        /** Horizontal spanned scroll bar visible. */
williamr@2
   197
        EHVisible           =0x01,
williamr@2
   198
williamr@2
   199
        /** Vertical spanned scroll bar visible. */
williamr@2
   200
        EVVisible           =0x02,
williamr@2
   201
williamr@2
   202
        /** 
williamr@2
   203
         * Enables nudge buttons in touch devices. This flag MUST
williamr@2
   204
         * be set before the creation of the doublespan scrollbar.
williamr@2
   205
         */
williamr@2
   206
        EEnableNudgeButtons = 0x04,
williamr@2
   207
        
williamr@2
   208
        /** 
williamr@2
   209
         * Disables expanded touch area, which is on by default
williamr@2
   210
         * in touch devices. This flag MUST be set before the
williamr@2
   211
         * creation of the doublespan scrollbar.
williamr@2
   212
         */
williamr@2
   213
        EDisableExpandedTouchArea = 0x08      
williamr@2
   214
        };
williamr@2
   215
private:
williamr@2
   216
    enum TMarginsAdjustmentMode
williamr@2
   217
        {
williamr@2
   218
        EGrow,
williamr@2
   219
        EShrink
williamr@2
   220
        };
williamr@2
   221
williamr@2
   222
public:	// specific
williamr@2
   223
williamr@2
   224
    /**
williamr@2
   225
     * C++ default constructor.
williamr@2
   226
     */
williamr@2
   227
    CEikScrollBarFrame(){}
williamr@2
   228
williamr@2
   229
    /**
williamr@2
   230
     * Constructor. Constructs a scroll bar frame object.
williamr@2
   231
     *
williamr@2
   232
     * @param aParentWindow The scroll bar’s parent control.
williamr@2
   233
     * @param aObserver The scroll bar observer.
williamr@2
   234
     * @param aPreAlloc Not used.
williamr@2
   235
     */  	
williamr@2
   236
    IMPORT_C CEikScrollBarFrame(CCoeControl* aParentWindow, 
williamr@2
   237
                                MEikScrollBarObserver* aObserver, 
williamr@2
   238
                                TBool aPreAlloc=EFalse);
williamr@2
   239
williamr@2
   240
    /**
williamr@2
   241
     * Destructor.
williamr@2
   242
     */  
williamr@2
   243
    IMPORT_C ~CEikScrollBarFrame();
williamr@2
   244
williamr@2
   245
    /**
williamr@2
   246
     * Constructor. Internal only to Eikcoctl.lib use. Parameter @c aDoubleSpan
williamr@2
   247
     * offers possibility to optimize scroll bar loading (if @c ETrue,
williamr@2
   248
     * arrowhead scroll bar will never be loaded).
williamr@2
   249
     *
williamr@2
   250
     * @since S60 3.0
williamr@2
   251
     * @param aParentWindow The scroll bar’s parent control.
williamr@2
   252
     * @param aObserver The scroll bar observer.
williamr@2
   253
     * @param aPreAlloc Not used.
williamr@2
   254
     * @param aDoubleSpan If @c ETrue, spanned scroll bar is created.
williamr@2
   255
     */     
williamr@2
   256
    CEikScrollBarFrame(CCoeControl* aParentWindow, 
williamr@2
   257
                       MEikScrollBarObserver* aObserver, 
williamr@2
   258
                       TBool aPreAlloc, 
williamr@2
   259
                       TBool aDoubleSpan);
williamr@2
   260
williamr@2
   261
    /**
williamr@2
   262
     * Initializes a new @c CEikScrollBarFrameExtension object.
williamr@2
   263
     *
williamr@2
   264
     * @since S60 3.0
williamr@2
   265
     * @param aParentWindow The scroll bar’s parent control.
williamr@2
   266
     * @param aObserver The scroll bar observer.
williamr@2
   267
     */
williamr@2
   268
    void InitExtension(CCoeControl* aParentWindow, 
williamr@2
   269
                       MEikScrollBarObserver* aObserver);
williamr@2
   270
williamr@2
   271
    /**
williamr@2
   272
     * Forces any scroll bars and the corner window if it is visible to be 
williamr@2
   273
     * redrawn.
williamr@2
   274
     */     
williamr@2
   275
    IMPORT_C void DrawScrollBarsNow() const;
williamr@2
   276
williamr@2
   277
	/**
williamr@2
   278
     * Tell scroll bars and the corner window to redraw if it is visible
williamr@2
   279
     */     
williamr@2
   280
    void DrawScrollBarsDeferred() const;
williamr@2
   281
williamr@2
   282
    /**
williamr@2
   283
     * Sets the visibility state for both the horizontal and the vertical scroll
williamr@2
   284
     * bars. This is used when tiling.
williamr@2
   285
     *
williamr@2
   286
     * @param aHVisibility Horizontal scroll bar visibility.
williamr@2
   287
     * @param aVVisibility Vertical scroll bar visibility.
williamr@2
   288
     */     
williamr@2
   289
    IMPORT_C void SetScrollBarVisibilityL(TScrollBarVisibility aHVisibility, 
williamr@2
   290
                                          TScrollBarVisibility aVVisibility);
williamr@2
   291
williamr@2
   292
    /**
williamr@2
   293
     * Determines the vertical scroll bar’s visibility. @c 
williamr@2
   294
     * CEikScrollBarFrame::ScrollBarVisibility @c 
williamr@2
   295
     * (CEikScrollBar::TOrientation aOrientation) can be used instead of this
williamr@2
   296
     * method.
williamr@2
   297
     * 
williamr@2
   298
     * @return Visibility for vertical scroll bar.
williamr@2
   299
     */     
williamr@2
   300
    inline TScrollBarVisibility VScrollBarVisibility() const;
williamr@2
   301
williamr@2
   302
    /**
williamr@2
   303
     * Sets scrollbar observers.
williamr@2
   304
     *
williamr@2
   305
     * @param aObserver The scroll bar observer. 
williamr@2
   306
     */     
williamr@2
   307
    IMPORT_C void SetScrollBarFrameObserver(MEikScrollBarObserver* aObserver);
williamr@2
   308
williamr@2
   309
    // Model setting. 
williamr@2
   310
williamr@2
   311
    /**
williamr@2
   312
     * Sets the vertical scrollbar mode. Does not actually draw anything until 
williamr@2
   313
     * the thumb or focus setting functions are called.
williamr@2
   314
     *
williamr@2
   315
     * @param aVModel Model for the vertical scrollbar.
williamr@2
   316
     * @return @c EFalse.
williamr@2
   317
     */     
williamr@2
   318
    IMPORT_C TBool Tile(TEikScrollBarModel* aVModel);
williamr@2
   319
williamr@2
   320
    /**
williamr@2
   321
     * Tiles the client area and the scroll bars managed by the frame. The 
williamr@2
   322
     * scroll bars are set up according to the scroll bar models; @c aHModel and
williamr@2
   323
     * @c aVModel. Ownership is not transferred as a result of passing these
williamr@2
   324
     * parameters as pointers. The result of tiling geometry management is 
williamr@2
   325
     * observable through the two rectangles @c aClientRect and @c 
williamr@2
   326
     * aInclusiveRect. Depending on the tiling layout @c aLayout and the scroll 
williamr@2
   327
     * bar visibility settings, either of these rectangles can be made constant
williamr@2
   328
     * and the other rectangle adjusted accordingly.
williamr@2
   329
     *
williamr@2
   330
     * For @c EArrowhead type scrollbar the layout is always fixed, it cannot be
williamr@2
   331
     * altered by using this method.
williamr@2
   332
     *
williamr@2
   333
     * For @c EDoublespan type scrollbar the layout can be set also with two 
williamr@2
   334
     * helper methods from the @c AknLayoutUtils class:
williamr@2
   335
     *
williamr@2
   336
     * @code
williamr@2
   337
     * AknLayoutUtils::LayoutVerticalScrollBar(
williamr@2
   338
     *           CEikScrollBarFrame* aScrollBarFrame, 
williamr@2
   339
     *           const TRect& aControlParent, 
williamr@2
   340
     *           const TAknWindowLineLayout& aLayout);
williamr@2
   341
     * AknLayoutUtils::LayoutHorizontalScrollBar(
williamr@2
   342
     *           CEikScrollBarFrame* aScrollBarFrame, 
williamr@2
   343
     *           const TRect& aControlParent, 
williamr@2
   344
     *           const TAknWindowLineLayout& aLayout);
williamr@2
   345
     * @endcode
williamr@2
   346
     *   
williamr@2
   347
     * @param aHModel Horizontal scroll bar model.
williamr@2
   348
     * @param aVModel Vertical scroll bar model.
williamr@2
   349
     * @param aClientRect Client rectangle.
williamr@2
   350
     * @param aInclusiveRect A rectangle that includes the area to be scrolled 
williamr@2
   351
     *        and the scroll bars themselves.
williamr@2
   352
     * @param aLayout Tiling layout.
williamr@2
   353
     * 
williamr@2
   354
     * @return @c ETrue if the non-constant rectangle is adjusted, otherwise @c 
williamr@2
   355
     *         EFalse.
williamr@2
   356
     */     
williamr@2
   357
    IMPORT_C TBool TileL(TEikScrollBarModel* aHModel, 
williamr@2
   358
                         TEikScrollBarModel* aVModel,
williamr@2
   359
                         TRect& aClientRect,
williamr@2
   360
                         TRect& aInclusiveRect,
williamr@2
   361
                         const TEikScrollBarFrameLayout& aLayout);
williamr@2
   362
williamr@2
   363
    /**
williamr@2
   364
     * Moves the scroll bar thumbs by the specified amounts. This updates the 
williamr@2
   365
     * scroll bars after an external scroll. The values of the parameters should
williamr@2
   366
     * be supplied in terms of the horizontal and vertical scrolling models 
williamr@2
   367
     * respectively. The scrolling models are presumed not to have changed 
williamr@2
   368
     * spans.
williamr@2
   369
     *
williamr@2
   370
     * @param aDeltaX The amount to move the horizontal scroll bar.
williamr@2
   371
     * @param aDeltaY The amount to move the vertical scroll bar.
williamr@2
   372
     */     
williamr@2
   373
    IMPORT_C void MoveThumbsBy(TInt aDeltaX, TInt aDeltaY);
williamr@2
   374
williamr@2
   375
    /**
williamr@2
   376
     * Moves the horizontal scroll bar thumb to the position @c aHorizThumbPos.
williamr@2
   377
     * This function is used to update the scroll bar after an external scroll.
williamr@2
   378
     * The value of @c aThumbPos should be supplied in terms of the scrolling
williamr@2
   379
     * model, which is presumed not to have changed spans.
williamr@2
   380
     * 
williamr@2
   381
     * @param aHorizThumbPos The required thumb position.
williamr@2
   382
     */     
williamr@2
   383
    IMPORT_C void MoveHorizThumbTo(TInt aHorizThumbPos);
williamr@2
   384
williamr@2
   385
    /**
williamr@2
   386
     * Moves the vertical scroll bar thumb to the position @c aVertThumbPos. 
williamr@2
   387
     * This function is used to update the scroll bar after an external scroll.
williamr@2
   388
     * The value of aThumbPos should be supplied in terms of the scrolling 
williamr@2
   389
     * model, which is presumed not to have changed spans.
williamr@2
   390
     * 
williamr@2
   391
     * @param aVertThumbPos The required thumb position.
williamr@2
   392
     */     
williamr@2
   393
    IMPORT_C void MoveVertThumbTo(TInt aVertThumbPos);
williamr@2
   394
williamr@2
   395
    /**
williamr@2
   396
     * Moves the vertical scroll bar thumb to the position @c aFocusPosition. 
williamr@2
   397
     * This function is used to update the scroll bar after an external scroll. 
williamr@2
   398
     * The value of @c aFocusPosition should be supplied in terms of the 
williamr@2
   399
     * scrolling model, which is presumed not to have changed spans.
williamr@2
   400
     * 
williamr@2
   401
     * @param aFocusPosition The required thumb position.
williamr@2
   402
     */     
williamr@2
   403
    IMPORT_C void SetVFocusPosToThumbPos(TInt aFocusPosition);
williamr@2
   404
williamr@2
   405
    /**
williamr@2
   406
     * Returns the breadth of the scroll bar idenitified by @c aOrientation, or
williamr@2
   407
     * zero if none exists.
williamr@2
   408
     *
williamr@2
   409
     * @param  aOrientation The orientation of the scroll bar for which you wish
williamr@2
   410
     *         to obtain the breadth.
williamr@2
   411
     *
williamr@2
   412
     * @return The specified scroll bar's breadth. This is zero if none exists.
williamr@2
   413
     */     
williamr@2
   414
    IMPORT_C TInt ScrollBarBreadth(
williamr@2
   415
        CEikScrollBar::TOrientation aOrientation) const;
williamr@2
   416
williamr@2
   417
    // scroll bar frame behavior functions
williamr@2
   418
williamr@2
   419
    /**
williamr@2
   420
     * Not implemented.
williamr@2
   421
     *
williamr@2
   422
     * @param aAdjusts Not used. 
williamr@2
   423
     */     
williamr@2
   424
    IMPORT_C void SetAdjustsHorizontalModel(TBool aAdjusts); 
williamr@2
   425
williamr@2
   426
    /**
williamr@2
   427
     * Not implemented.
williamr@2
   428
     *
williamr@2
   429
     * @param aAdjusts Not used. 
williamr@2
   430
     */      
williamr@2
   431
    IMPORT_C void SetAdjustsVerticalModel(TBool aAdjusts);
williamr@2
   432
williamr@2
   433
    /**
williamr@2
   434
     * Sets scrollbar frame flags. 
williamr@2
   435
     *
williamr@2
   436
     * @param aMask Bitmask of the bits that are to be set.
williamr@2
   437
     */     
williamr@2
   438
    inline void SetScrollBarFrameFlags(TInt aMask);
williamr@2
   439
williamr@2
   440
    /**
williamr@2
   441
     * Determines whether the scroll bar specified by aOrientation exists
williamr@2
   442
     * 
williamr@2
   443
     * @param aOrientation The scroll bar’s orientation.
williamr@2
   444
     * @return @c ETrue if the specified scroll bar exists otherwise @c EFalse.
williamr@2
   445
     */     
williamr@2
   446
    IMPORT_C TBool ScrollBarExists(
williamr@2
   447
        CEikScrollBar::TOrientation aOrientation) const;
williamr@2
   448
williamr@2
   449
    /**
williamr@2
   450
     * From @c CCoeControl
williamr@2
   451
     *
williamr@2
   452
     * Gets the number of controls contained in a compound control.
williamr@2
   453
     * 
williamr@2
   454
     * @return The number of component controls contained in this control.
williamr@2
   455
     */     
williamr@2
   456
    IMPORT_C TInt CountComponentControls() const;
williamr@2
   457
williamr@2
   458
    /**
williamr@2
   459
     * From @c CCoeControl
williamr@2
   460
     *
williamr@2
   461
     * Gets the component specified by index. Within a compound control, each
williamr@2
   462
     * component control is identified by an index, where the index depends on
williamr@2
   463
     * the order the controls were added: the first is given an index of 0, the
williamr@2
   464
     * next an index of 1, and so on.
williamr@2
   465
     * 
williamr@2
   466
     * @return The component control with an index of aIndex
williamr@2
   467
     */         
williamr@2
   468
    IMPORT_C CCoeControl* ComponentControl(TInt aIndex) const;
williamr@2
   469
williamr@2
   470
    /**
williamr@2
   471
     * Returns a pointer to the scroll bar identified by orientation @c 
williamr@2
   472
     * aOrientation.
williamr@2
   473
     * 
williamr@2
   474
     * @param aOrientation The orientation of the scroll bar for which you wish
williamr@2
   475
     *        to obtain a pointer.
williamr@2
   476
     * @return A pointer to the scroll bar with orientation @c aOrientation if 
williamr@2
   477
     *         the scrollbar is visible.
williamr@2
   478
     */         
williamr@2
   479
    IMPORT_C CEikScrollBar* GetScrollBarHandle(
williamr@2
   480
        CEikScrollBar::TOrientation aOrientation) const;
williamr@2
   481
williamr@2
   482
    /**
williamr@2
   483
     * Returns a pointer to the vertical scroll bar.
williamr@2
   484
     * 
williamr@2
   485
     * @return A pointer to the vertical scroll bar.
williamr@2
   486
     */         
williamr@2
   487
    IMPORT_C CEikScrollBar* VerticalScrollBar() const;
williamr@2
   488
williamr@2
   489
    /**
williamr@2
   490
     * Sets the type of horizontal scroll bar. Possible values are @c EArrowHead
williamr@2
   491
     * and @c EDoubleSpan.
williamr@2
   492
     *
williamr@2
   493
     * @param aType Type of the scrollbar. 
williamr@2
   494
     */         
williamr@2
   495
    IMPORT_C void SetTypeOfHScrollBar(TScrollBarType aType);
williamr@2
   496
williamr@2
   497
    /**
williamr@2
   498
     * Sets the type of vertical scroll bar. Possible values are @c EArrowHead
williamr@2
   499
     * and @c EDoubleSpan.
williamr@2
   500
     *
williamr@2
   501
     * @param aType Type of the scrollbar. 
williamr@2
   502
     */         
williamr@2
   503
    IMPORT_C void SetTypeOfVScrollBar(TScrollBarType aType);
williamr@2
   504
williamr@2
   505
    /**
williamr@2
   506
     * Returns the control type of the horizontal scroll bar 
williamr@2
   507
     * 
williamr@2
   508
     * @return Type of the scrollbar.
williamr@2
   509
     */         
williamr@2
   510
    IMPORT_C TScrollBarType TypeOfHScrollBar() const;
williamr@2
   511
williamr@2
   512
    /**
williamr@2
   513
     * Returns the control type of the vertical scroll bar 
williamr@2
   514
     * 
williamr@2
   515
     * @return Type of the scrollbar.
williamr@2
   516
     */         
williamr@2
   517
    IMPORT_C TScrollBarType TypeOfVScrollBar() const;
williamr@2
   518
williamr@2
   519
    /**
williamr@2
   520
     * Checks if the vertical scrollbar type is @c EArrowHead.
williamr@2
   521
     *
williamr@2
   522
     * @param aFlag Not used.
williamr@2
   523
     * @return @c ETrue if the type of the scrollbar is @c EArrowHead.
williamr@2
   524
     */         
williamr@2
   525
    IMPORT_C TBool IsArrowHeadScrollBar(TInt aFlag) const;
williamr@2
   526
williamr@2
   527
    // application scroll bar utilities
williamr@2
   528
williamr@2
   529
    /**
williamr@2
   530
     * This method is used only internally by the @c CEikScrollBar. Disconnects
williamr@2
   531
     * externally connected scrollbar.
williamr@2
   532
     * 
williamr@2
   533
     * @param aScrollBar Scrollbar to be disconnected.
williamr@2
   534
     */     
williamr@2
   535
    void DisconnectExternalScrollBar(CEikScrollBar* aScrollBar);
williamr@2
   536
williamr@2
   537
    /**
williamr@2
   538
     * This method creates double span type scrollbars into this frame. Old
williamr@2
   539
     * scrollbars are deleted or disconnected.
williamr@2
   540
     *
williamr@2
   541
     * @since S60 2.6
williamr@2
   542
     * @param aWindowOwning Tells wheter created scrollbar should be 
williamr@2
   543
     *        a window owning control or not. Selection for this is 
williamr@2
   544
     *        relevant especially because skinned scrollbar draws            
williamr@2
   545
     * @param aRemote @c True if this method should instead of creating own 
williamr@2
   546
     *        scrollbar try to connect to a remote scrollbar frame and 
williamr@2
   547
     *        start using its scrollbars. Connecting is done using 
williamr@2
   548
     *        through object provider mechanism, so the object supply 
williamr@2
   549
     *        chain must be valid. Also if true, then parameter @c 
williamr@2
   550
     *        aWindowOwning will be ignored.
williamr@2
   551
     *
williamr@2
   552
     * Example of use:
williamr@2
   553
     *
williamr@2
   554
     * @code
williamr@2
   555
     *    iSBFrame=new(ELeave) CEikScrollBarFrame(this, NULL, ETrue);
williamr@2
   556
     *    iSBFrame->SetScrollBarVisibilityL(CEikScrollBarFrame::EOff,
williamr@2
   557
     *                                      CEikScrollBarFrame::EAuto);
williamr@2
   558
     *    iSBFrame->CreateDoubleSpanScrollBarsL(ETrue, EFalse);
williamr@2
   559
     *
williamr@2
   560
     *    Note that double span scrollbar types requires different model classes
williamr@2
   561
     *    to be used in places of @c TEikScrollBarModel of this scrollbar frame 
williamr@2
   562
     *    API:s other method calls.
williamr@2
   563
     *    
williamr@2
   564
     *    Scrollbar type        Required model (in places of TEikScrollBarModel)
williamr@2
   565
     *    ---------------       ------------------------------------------------
williamr@2
   566
     *    EDoubleSpan           TAknDoubleSpanScrollBarModel 
williamr@2
   567
     *    EArrowHead            TEikScrollBarModel
williamr@2
   568
     *
williamr@2
   569
     *   // model for double span type scrollbar
williamr@2
   570
     *   TAknDoubleSpanScrollBarModel vModel; 
williamr@2
   571
     *   // model for double span type scrollbar
williamr@2
   572
     *   TAknDoubleSpanScrollBarModel hModel; 
williamr@2
   573
     *   
williamr@2
   574
     *   iSBFrame->Tile(vModel, iVRect);
williamr@2
   575
     * @endcode
williamr@2
   576
     */ 
williamr@2
   577
    IMPORT_C void CreateDoubleSpanScrollBarsL(TBool aWindowOwning, 
williamr@2
   578
                                              TBool aRemote);
williamr@2
   579
williamr@2
   580
    /**
williamr@2
   581
     * This method creates double span type scrollbars into this frame. Old 
williamr@2
   582
     * scrollbars are deleted or disconnected.
williamr@2
   583
     *
williamr@2
   584
     * @since S60 2.8
williamr@2
   585
     * @param aWindowOwning Tells wheter created scrollbar should be a window 
williamr@2
   586
     *        owning control or not. Selection for this is relevant especially
williamr@2
   587
     *        because skinned scrollbar draws its background using its parent 
williamr@2
   588
     *        windows background context.                   
williamr@2
   589
     * @param aRemote True if this method should instead of creating own
williamr@2
   590
     *        scrollbar try to connect to a remote scrollbar frame and start
williamr@2
   591
     *        using its scrollbars. Connecting is done using through object 
williamr@2
   592
     *        provider mechanism, so the object supply chain must be valid. Also
williamr@2
   593
     *        if true, then parameter @c aWindowOwning will be ignored.
williamr@2
   594
     * @param aVertical If @c ETrue vertical scrollbar will be created to 
williamr@2
   595
     *        scrollbar frame.
williamr@2
   596
     * @param aHorizontal If @c ETrue horizontal scrollbar will be created to
williamr@2
   597
     *        scrollbar frame.
williamr@2
   598
     * @leave KErrNotFound Parent object doesn't have scrollbar frame.
williamr@2
   599
     */ 
williamr@2
   600
    IMPORT_C void CreateDoubleSpanScrollBarsL(TBool aWindowOwning, 
williamr@2
   601
                                              TBool aRemote, 
williamr@2
   602
                                              TBool aVertical, 
williamr@2
   603
                                              TBool aHorizontal);
williamr@2
   604
williamr@2
   605
    /**
williamr@2
   606
     * Tiles the vertical @c EDouble span type scroll bar managed by the frame.
williamr@2
   607
     * The scroll bar is set up according to the scroll bar model and given 
williamr@2
   608
     * rectangle which is relative to the parent window of the frame.
williamr@2
   609
     *
williamr@2
   610
     * @since S60 2.6
williamr@2
   611
     * @param aVModel Vertical scrollbar model.         
williamr@2
   612
     * @param aVScrollBar Vertical scrollbar rectangle.            
williamr@2
   613
     *
williamr@2
   614
     * For @c EDoublespan type scrollbar the layout can be set also with a 
williamr@2
   615
     * helper method from the @c AknLayoutUtils class:
williamr@2
   616
     *
williamr@2
   617
     * @code
williamr@2
   618
     * AknLayoutUtils::LayoutVerticalScrollBar(
williamr@2
   619
     *                                   CEikScrollBarFrame* aScrollBarFrame, 
williamr@2
   620
     *                                   const TRect& aControlParent, 
williamr@2
   621
     *                                   const TAknWindowLineLayout& aLayout);
williamr@2
   622
     * @endcode
williamr@2
   623
     */     
williamr@2
   624
    IMPORT_C void Tile(TEikScrollBarModel* aVModel, TRect& aVScrollBar);
williamr@2
   625
williamr@2
   626
    /**
williamr@2
   627
     * Sets the models of the scrollbars. 
williamr@2
   628
     * 
williamr@2
   629
     * @since S60 2.6
williamr@2
   630
     * @param aHModel The model of the horizontal scrollbar.
williamr@2
   631
     * @param aVModel The model of the vertical scrollbar.
williamr@2
   632
     *
williamr@2
   633
     */     
williamr@2
   634
    IMPORT_C void Tile(TEikScrollBarModel* aHModel,
williamr@2
   635
                       TEikScrollBarModel* aVModel);
williamr@2
   636
williamr@2
   637
    /**
williamr@2
   638
     * Gets the visibility of given scrollbar orientation. 
williamr@2
   639
     * 
williamr@2
   640
     * This method should be used instead of a deprecated method @c
williamr@2
   641
     * CEikScrollBarFrame::HScrollBarVisibility() and
williamr@2
   642
     * also can be used instead of @c CEikScrollBarFrame::VScrollBarVisibility()
williamr@2
   643
     *
williamr@2
   644
     * @since S60 2.6
williamr@2
   645
     * @param aOrientation The orientation of a scrollbar in the frame.
williamr@2
   646
     * @return The visibility of requested scrollbar.
williamr@2
   647
     */     
williamr@2
   648
    IMPORT_C TScrollBarVisibility ScrollBarVisibility(
williamr@2
   649
            CEikScrollBar::TOrientation aOrientation) const;
williamr@2
   650
	/**
williamr@2
   651
    * Sets the background drawing for the double spanned scrollbars 
williamr@2
   652
    * 
williamr@2
   653
    * This method can be used to enable or disable the drawing of the scrollbar 
williamr@2
   654
    * background via mop chain.
williamr@2
   655
    *
williamr@2
   656
    * @since    3.0
williamr@2
   657
    * @param    aDrawHorizontal sets the state of the background drawing of 
williamr@2
   658
    * 			the horizontal scrollbar.
williamr@2
   659
    * @param    aDrawVertical sets the state of the background drawing of 
williamr@2
   660
    * 			the vertical scrollbar.
williamr@2
   661
    * @return   Success of the call, KErrNotSupported if the scrollbars 
williamr@2
   662
    * 			are not doublespan scrollbars.
williamr@2
   663
    *
williamr@2
   664
    */
williamr@2
   665
	IMPORT_C TInt DrawBackground(TBool aDrawHorizontal, TBool aDrawVertical);
williamr@2
   666
	
williamr@2
   667
	/**
williamr@2
   668
    * Gets the state of the background drawing for the double spanned scrollbars.
williamr@2
   669
    * 
williamr@2
   670
    * This method can be used to get the state of drawing of the scrollbar 
williamr@2
   671
    * background via mop chain.
williamr@2
   672
    *
williamr@2
   673
    * @since    3.0
williamr@2
   674
    * @param    aDrawHorizontal gets the state of the background drawing of 
williamr@2
   675
    * 			the horizontal scrollbar.
williamr@2
   676
    * @param    aDrawVertical gets the state of the background drawing of 
williamr@2
   677
    * 			the vertical scrollbar.
williamr@2
   678
    * @return   Success of the call, KErrNotSupported if the scrollbars 
williamr@2
   679
    * 			are not doublespan scrollbars.
williamr@2
   680
    *
williamr@2
   681
    */
williamr@2
   682
	IMPORT_C TInt DrawBackgroundState(TBool& aDrawHorizontal, TBool& aDrawVertical);
williamr@2
   683
williamr@2
   684
public:
williamr@2
   685
williamr@2
   686
    /**
williamr@2
   687
     * Gets a pointer to the horizontal scroll bar.
williamr@2
   688
     * 
williamr@2
   689
     * @return A pointer to the horizontal scroll bar.
williamr@2
   690
     */         
williamr@2
   691
    CEikScrollBar* HorizontalScrollBar() const;
williamr@2
   692
    
williamr@2
   693
    /**
williamr@2
   694
     * Sets scrollbar observers.
williamr@2
   695
     *
williamr@2
   696
     * @param aObserver The scroll bar observer. 
williamr@2
   697
     */
williamr@2
   698
    MEikScrollBarObserver* ScrollBarFrameObserver();
williamr@2
   699
williamr@2
   700
protected:
williamr@2
   701
    // Accessor methods
williamr@2
   702
williamr@2
   703
    /**
williamr@2
   704
     * Sets parent window.
williamr@2
   705
     * 
williamr@2
   706
     * @param aParentWindow A pointer to the parent window.
williamr@2
   707
     */ 
williamr@2
   708
    void SetParentWindow(CCoeControl* aParentWindow);
williamr@2
   709
williamr@2
   710
    /**
williamr@2
   711
     * Gets a pointer to the parent window.
williamr@2
   712
     *  
williamr@2
   713
     * @return A pointer to the parent window.
williamr@2
   714
     */ 
williamr@2
   715
    CCoeControl* ParentWindow() const;
williamr@2
   716
williamr@2
   717
protected:
williamr@2
   718
   
williamr@2
   719
    /** Struct */ 
williamr@2
   720
    struct SBarData
williamr@2
   721
        {
williamr@2
   722
williamr@2
   723
        /** Pointer to the @c CAknScrollBar class */
williamr@2
   724
        CAknScrollBar* iBar;
williamr@2
   725
williamr@2
   726
        /** Enum @c TEikScrollBarModel */
williamr@2
   727
        TEikScrollBarModel iModel;
williamr@2
   728
williamr@2
   729
        /** Enum @c TScrollBarVisibility. */
williamr@2
   730
        TScrollBarVisibility iVisibility;
williamr@2
   731
williamr@2
   732
        /** Boolean value if external scroll bar is attached. */
williamr@2
   733
        TBool iExternalScrollBarAttached;
williamr@2
   734
        };
williamr@2
   735
williamr@2
   736
private:
williamr@2
   737
williamr@2
   738
    void CalcTheoreticalScrollBarVisibility(const TEikScrollBarModel* aVModel);
williamr@2
   739
    void ApplyModel(SBarData& aSBar);
williamr@2
   740
    void MakeSBarVisible(SBarData& aSBar, TBool aVisible);
williamr@2
   741
    void GetScrollBars(TBool aDoubleSpan);
williamr@2
   742
    CEikCba* GetCurrentCba();
williamr@2
   743
    void DeleteScrollBars();
williamr@2
   744
    void CreateArrowHeadScrollBarsL();
williamr@2
   745
williamr@2
   746
    void CalcTheoreticalScrollBarVisibility(const TEikScrollBarModel* aVModel,
williamr@2
   747
                                            const TEikScrollBarModel* aHModel);
williamr@2
   748
williamr@2
   749
protected:
williamr@2
   750
williamr@2
   751
    /** Struct object.*/
williamr@2
   752
    SBarData iV;
williamr@2
   753
williamr@2
   754
private:
williamr@2
   755
williamr@2
   756
    CEikScrollBarFrameExtension* iExtension; 
williamr@2
   757
    TInt iScrollBarFrameFlags;
williamr@2
   758
williamr@2
   759
    friend class CEikScrollBarFrameExtension;
williamr@2
   760
    };
williamr@2
   761
williamr@2
   762
inline CEikScrollBarFrame::TScrollBarVisibility CEikScrollBarFrame::VScrollBarVisibility() const
williamr@2
   763
    { return iV.iVisibility; }
williamr@2
   764
inline void CEikScrollBarFrame::SetScrollBarFrameFlags(TInt aMask)
williamr@2
   765
    { iScrollBarFrameFlags|=aMask; }
williamr@2
   766
williamr@2
   767
// Cba scroll bar frame (with it's own scrollbar creation methods)
williamr@2
   768
class CEikCbaScrollBarFrame : public CEikScrollBarFrame
williamr@2
   769
    {
williamr@2
   770
public:
williamr@2
   771
    CEikCbaScrollBarFrame(CCoeControl* aParentWindow, MEikScrollBarObserver* aObserver, TBool aPreAlloc=EFalse);
williamr@2
   772
    void ConstructL();
williamr@2
   773
    void SwitchToArrowHeadScrollBarL();  // @since 3.0
williamr@2
   774
    };
williamr@2
   775
williamr@2
   776
#endif