mmuifw_plat/alf_scrollbarwidget_api/inc/alf/ialfscrollbarmodel.h
branchRCL_3
changeset 26 0e9bb658ef58
parent 0 e83bab7cf002
equal deleted inserted replaced
25:4ea6f81c838a 26:0e9bb658ef58
       
     1 /*
       
     2 * Copyright (c) 2007 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 "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:  Model interface with utilities for scrollbar widget.
       
    15 *
       
    16 */
       
    17 
       
    18 
       
    19 #ifndef IALF_SCROLLBARMODEL_H
       
    20 #define IALF_SCROLLBARMODEL_H
       
    21 
       
    22 
       
    23 //WidgetModel Includes
       
    24 #include <alf/ialfmodel.h>
       
    25 
       
    26 using namespace osncore;
       
    27 
       
    28 namespace Alf
       
    29     {
       
    30 
       
    31 namespace alfscrollbarmodel
       
    32     {
       
    33     static const IfId ident =
       
    34         {
       
    35         0, "alfscrollbarmodel"
       
    36         };
       
    37     }
       
    38 
       
    39 /**
       
    40  *  An interface of the scrollbar model.
       
    41  */
       
    42 class IAlfScrollBarModel : public IAlfModel
       
    43     {
       
    44 
       
    45 public:
       
    46 
       
    47     /**
       
    48      * Getter for the type identifier of this interface.
       
    49      *
       
    50      * @return A descriptor to identify the type of this interface.
       
    51      */
       
    52     static inline const IfId& type()
       
    53         {
       
    54         return alfscrollbarmodel::ident;
       
    55         } 
       
    56 
       
    57     /**
       
    58      * Function for initializing the model.
       
    59      * 
       
    60      * The unit of paremeters aTotalLength, aViewLength, aViewStartPosition 
       
    61      * depends on the user of scrollbar. For example editor may 
       
    62      * decide to support scrolling by line,means in case of editor 
       
    63      * aTotalLenght can be total number of lines in the document, 
       
    64      * aViewlength can be the number of lines which fit inside a page/view,
       
    65      * aViewstartPosition can be the line number from which view starts and 
       
    66      *  
       
    67      * (currently no visualization is there for focus position inside scrollbar)
       
    68      *
       
    69      * @param aTotalLength - Total length of the content or document if it 
       
    70      *                       were laid out. Minimum Value of total length can be
       
    71      *                       1. If a value less than 1 is passed it is converted 
       
    72      *                       to 1 automatically.
       
    73      *
       
    74      * @param aViewLength - Amount of TotalLength which is viewable. Minmum 
       
    75      *                      value of viewlength is 1 and maximum value is equal 
       
    76      *                      to total length. If a value less than 1 is passed
       
    77      *                      it is converted to 1 similarly, if a value greater 
       
    78      *                      than aTotalLength is passed it is converted to 
       
    79      *                      aTotalLength.
       
    80      * @param aViewStartPosition - view start position. This can be between 0 
       
    81      *                             and (aTotalLength - aViewLength). As in 
       
    82      *                             case of total length and view length, if a 
       
    83      *                             value out side range is passed it is convered
       
    84      *                             to the nearest boundary value (0 or 
       
    85      *                             aTotalLength - aViewLength).
       
    86      * @return void.
       
    87      */
       
    88     virtual void initializeData(
       
    89         int aTotalLength,
       
    90         int aViewLength,
       
    91         int aViewStartPosition) = 0;
       
    92 
       
    93     /**
       
    94      * Sets the Total Length for the Scrollbar
       
    95      * which is the length of the document or viewable data.
       
    96      *
       
    97      * Arbitrary units are used, but the same units as the rest of the model.
       
    98      * This length is best current estimate of the length of the entire 
       
    99      * viewable data in this model's direction.(i.e, vertical, horizontal).
       
   100      * It represents physical extent (e.g. could be pixels), not logical size
       
   101      * of the data.
       
   102      * It is understood to represent the physical laid out size of the data 
       
   103      * if it were possible to view it all at once.
       
   104      *
       
   105      * @param aTotalLength - Total length of the content or document. Minimum 
       
   106      *                       Value of total length can be 1. If a value less 
       
   107      *                       than 1 is passed, it is converted to 1 
       
   108      *                       automatically.
       
   109      *                       If the value passed is less than the current view 
       
   110      *                       length, current view length is also changed to the 
       
   111      *                       passed total length so that view length is still
       
   112      *                       valid. Similarly if required, view start position
       
   113      *                       is also changed so that it is still valid. 
       
   114      *                       See the documentation of initializeData() to know
       
   115      *                       valid values of each model data. If change of more
       
   116      *                       than one model data is required, use changeData() 
       
   117      *                       function.
       
   118      *
       
   119      * @return void.
       
   120      */
       
   121     virtual void setTotalLength(int aTotalLength) = 0;
       
   122 
       
   123     /**
       
   124      * Sets the View Length for the Scrollbar
       
   125      * For horizontal models, this is the width of the view.
       
   126      * For veritcal, this is the height of the view.
       
   127      *
       
   128      * Note the units are arbitrary but uniform with the rest of the model.
       
   129      * Note that this measure is proportional to the physical width or height
       
   130      * of the view.This metric is sometimes called the Thumb size.
       
   131      * @param aViewLegth - Amount of Total Length which is viewable. Minmum 
       
   132      *                     value of viewlength is 1 and maximum value is equal 
       
   133      *                     to total length. If a value out of range is passed
       
   134      *                     it is converted to the nearest boundary (1 or total
       
   135      *                     length).
       
   136      *                     See the documentation of initializeData() to know
       
   137      *                     valid values of each model data. If change of more
       
   138      *                     than one model data is required, use changeData() 
       
   139      *                     function.
       
   140      * @return void.
       
   141      */
       
   142     virtual void setViewLength(int aViewLength) = 0;
       
   143 
       
   144     /**
       
   145      * Sets the View Start Position for the Scrollbar
       
   146      * Position in arbitrary units of the start of the currently viewed data.
       
   147      * For horizontal models, this is the position of the left of the view 
       
   148      * relative to the far left end of the document.
       
   149      * For veritcal, this is the position of the top of the view from the 
       
   150      * top of the viewable data.
       
   151      *
       
   152      * Note the units are arbitrary but uniform with the rest of the model.
       
   153      * Position is in physical space as if the entire data were laid out.
       
   154      * This metric is sometimes called the Thumb position.
       
   155      *
       
   156      * @param aViewStartPosition - start position of the viewable area. This can
       
   157      *                             be between 0 and (aTotalLength - aViewLength  
       
   158      *                             ). If a value out side range is passed, it
       
   159      *                             is convered to the nearest boundary value (0
       
   160      *                             or totalLength - viewLength)
       
   161      *                             See the documentation of initializeData() to 
       
   162      *                             know valid values of each model data. If 
       
   163      *                             change of more than one model data is 
       
   164      *                             required, use changeData() function.     
       
   165      *                             
       
   166      * @return void.
       
   167      */
       
   168     virtual void setViewStartPosition(int aViewStartPosition) = 0;
       
   169 
       
   170     /**
       
   171      * Sets TotalLength, View length and ViewStartPosition for the Scrollbar.
       
   172      *
       
   173      * See the documentation of initializeData() to know valid values of each 
       
   174      * model data. If the value passed are not valid, they are changed to the 
       
   175      * closest valid value.
       
   176      *
       
   177      * @param aTotalLength - total length
       
   178      * @param aViewLength - view Length
       
   179      * @param aViewStartPosition - View Start Position
       
   180      * @return void.
       
   181      */
       
   182     virtual void changeData(
       
   183         int aTotalLength,
       
   184         int aViewLength,
       
   185         int aViewStartPosition) = 0;
       
   186 
       
   187     /**
       
   188      * Length of the document or viewable data.
       
   189      * (refer setter function for detailed concept).
       
   190      * @return length in arbitrary units of the viewable data 
       
   191      */
       
   192     virtual int getTotalLength() const = 0;
       
   193 
       
   194     /**
       
   195      * Length of the view (refer setter function for detailed concept).
       
   196      *
       
   197      * @return view length
       
   198      */
       
   199     virtual int getViewLength() const = 0;
       
   200 
       
   201     /**
       
   202      * Position in arbitrary units of the start of the currently viewed data 
       
   203      * (refer setter function for detailed concept).
       
   204      * @return position of the start of the view
       
   205      */
       
   206     virtual int getViewStartPosition() const = 0;
       
   207 
       
   208     };
       
   209 
       
   210     } // namespace Alf
       
   211 
       
   212 #endif // IALF_SCROLLBARMODEL_H
       
   213 //End Of File