SymbiSoft / htmlcontrol-for-symbian

Automatically exported from code.google.com/p/htmlcontrol-for-symbian
1 stars 0 forks source link

[New feature] PageUp & PageDown support in Body or Div element #14

Closed GoogleCodeExporter closed 8 years ago

GoogleCodeExporter commented 8 years ago
Sometimes, body or div holds many data, scrolling line by line is not a 
good choice. Scrolling by page will be a better one. Now I had already 
implemented this feature. 

1) Two new commands defined in htmlstrings.h file:
__LIT(KHStrPageDown, "page-down");
__LIT(KHStrPageUp, "page-up");

2) In CHtmlElementDiv::InvokeL, add the following code:
    else if(cmd.CompareF(KHStrPageDown)==0)
    {
        if (iScrollbar)
            iScrollbar->PageDown();
    }
    else if(cmd.CompareF(KHStrPageUp)==0)
    {
        if (iScrollbar)
            iScrollbar->PageUp();
    }
3) In class CHcScrollbar, add PageUp() and PageDown() as follows:

void CHcScrollbar::PageUp()
{
    iPos -= iDiv->iDisplayRect.Height();
    if (iPos < 0)
        iPos = 0;
}

void CHcScrollbar::PageDown()
{
    iPos += iDiv->iDisplayRect.Height();
    if (iPos > iMax)
        iPos = iMax;
}

4) How to use it? It's simple, just call one line of code:
iControl->Body()->InvokeL(KHStrPageUp);   // or use KHStrPageDown instead

and then refresh the control.
iControl->RefreshAndDraw();

If you can add me as a contributor, I can merge this feature into trunk 
soon.

Original issue reported on code.google.com by douyongw...@gmail.com on 17 May 2010 at 6:38

GoogleCodeExporter commented 8 years ago
I have add you as as contributor.

Original comment by gzytom@gmail.com on 2 Jun 2010 at 7:38