コード例 #1
0
ファイル: Ordinal.cpp プロジェクト: huellif/symbian-example
void CMainWindow::HandlePointerEvent(TPointerEvent& aPointerEvent)
    {
    switch (aPointerEvent.iType)
        {
        case TPointerEvent::EButton3Down:
            {
            // Cascade windows in top left corner
            // Window at the front should be cascaded last.
            // The window at the front (ordinal position 0) is given by Child(), and 
            // each window behind it is given by NextSibling(). We need to go down
            // the sibling list till we get to the last sibling, and move this to 
            // the top left corner. Then go back up the list and move each previous 
            // sibling on top of the last, displaced by an offset (of TPoint(10,10)).
            TPoint point(0, 0);
            TUint32 nextSib, prevSib;
            CWindow* childWindow;
            TInt numChildren = 0;
            TUint32 child = Window().Child();
            if (child)
                {
                childWindow = (CWindow*) child;
                numChildren++;
                nextSib = childWindow->Window().NextSibling();
                while (nextSib)
                    {
                    numChildren++;
                    childWindow = (CWindow*) nextSib;
                    nextSib = childWindow->Window().NextSibling();
                    }
                for (TInt i = numChildren; i > 0; i--)
                    {
                    childWindow->Window().SetPosition(point);
                    prevSib = childWindow->Window().PrevSibling();
                    if (prevSib)
                        {
                        childWindow = (CWindow*) prevSib;
                        point += TPoint(10, 10);
                        }
                    }
                }
            break;
            }
        default:
            break;
        }
    }
コード例 #2
0
ファイル: Base.cpp プロジェクト: huellif/symbian-example
void CWsRedrawer::RunL()
    {
    // find out what needs to be done in response to the event
    TWsRedrawEvent redrawEvent;
    iClient->iWs.GetRedraw(redrawEvent); // get event
    CWindow* window = (CWindow*) (redrawEvent.Handle()); // get window
    if (window)
        {
        TRect rect = redrawEvent.Rect(); // and rectangle that needs redrawing
        // now do drawing
        iClient->iGc->Activate(window->Window());
        window->Window().BeginRedraw();
        window->Draw(rect);
        window->Window().EndRedraw();
        iClient->iGc->Deactivate();
        }
    // maintain outstanding request
    IssueRequest();
    }
コード例 #3
0
ファイル: Ordinal.cpp プロジェクト: huellif/symbian-example
/****************************************************************************\
|	Function:	CNumberedWindow::HandlePointerEvent
 |	Purpose:	Handles pointer events for CNumberedWindow.
 |	Input:		aPointerEvent	The pointer event
 |	Output:		None
 \****************************************************************************/
void CNumberedWindow::HandlePointerEvent(TPointerEvent& aPointerEvent)
    {
    switch (aPointerEvent.iType)
        {
        case TPointerEvent::EDrag:
            {
            // Move the window position as the pointer is dragged.
            TPoint point = aPointerEvent.iParentPosition;
            TPoint distToMove = point - iOldPos;
            TPoint position = Window().Position();
            Window().SetPosition(position + distToMove);
            iOldPos = point;
            break;
            }
        case TPointerEvent::EButton1Down:
            {
            // Move window to front
            Window().SetOrdinalPosition(0);
            // Request drag events 
            Window().PointerFilter(EPointerFilterDrag, 0);
            // Initialize starting point for dragging
            iOldPos = aPointerEvent.iParentPosition;
            break;
            }
        case TPointerEvent::EButton1Up:
            {
            // Cancel the request for drag events.
            Window().PointerFilter(EPointerFilterDrag, EPointerFilterDrag);
            break;
            }
        case TPointerEvent::EButton3Down:
            {
            // Cascade windows in top left corner.
            // Window at the front should be cascaded last.
            // The window at the front (ordinal position 0) is given by Child(), and 
            // each window behind it is given by NextSibling(). We need to go down
            // the sibling list till we get to the last sibling, and move this to 
            // the top left corner. Then go back up the list and move each previous 
            // sibling on top of the last, displaced by an offset (of TPoint(10,10)).
            TPoint point(0, 0);
            TUint32 nextSib, prevSib;
            CWindow* childWindow;
            TInt numChildren = 0;
            TUint32 child = Window().Child();
            if (child)
                {
                childWindow = (CWindow*) child;
                numChildren++;
                nextSib = childWindow->Window().NextSibling();
                while (nextSib)
                    {
                    numChildren++;
                    childWindow = (CWindow*) nextSib;
                    nextSib = childWindow->Window().NextSibling();
                    }
                for (TInt i = numChildren; i > 0; i--)
                    {
                    childWindow->Window().SetPosition(point);
                    prevSib = childWindow->Window().PrevSibling();
                    if (prevSib)
                        {
                        childWindow = (CWindow*) prevSib;
                        point += TPoint(10, 10);
                        }
                    }
                }
            break;
            }
        default:
            break;
        }
    }