calendarui/views/dayview/tsrc/unittests/unittest_calendayitem/calendayitemtest.h
changeset 70 a5ed90760192
child 83 5aadd1120515
equal deleted inserted replaced
64:1881ad52dc45 70:a5ed90760192
       
     1 /* Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies).
       
     2  * All rights reserved.
       
     3  * This component and the accompanying materials are made available
       
     4  * under the terms of "Eclipse Public License v1.0"
       
     5  * which accompanies this distribution, and is available
       
     6  * at the URL "http://www.eclipse.org/legal/epl-v10.html".
       
     7  *
       
     8  * Initial Contributors:
       
     9  * Nokia Corporation - initial contribution.
       
    10  *
       
    11  * Contributors:
       
    12  *
       
    13  * Description: Test class for CalenDayItem
       
    14  *
       
    15  */
       
    16  
       
    17 #ifndef CALENDAYITEMTEST_H
       
    18 #define CALENDAYITEMTEST_H
       
    19 
       
    20 // System includes
       
    21 #include <HbFrameItem>
       
    22 #include <HbTextItem>
       
    23 #include <HbStyle>
       
    24 #include <HbColorScheme>
       
    25 #include <agendaentry.h>
       
    26 #include <hbabstractviewitem.h>
       
    27 
       
    28 // User includes
       
    29 #include "calendaycommonheaders.h"
       
    30 #include "calendayitem.h"
       
    31 #include "calendaystatusstrip.h"
       
    32 #include "calendaymodel.h"
       
    33 #include "calendayutils.h"
       
    34 #include "calenagendautils.h"
       
    35 #include "calendaycontainer.h"
       
    36 
       
    37 #ifndef __WINSCW__
       
    38 #define private public
       
    39 #define protected public
       
    40 #endif
       
    41 
       
    42 #include "calendayitem.h"
       
    43 
       
    44 class CalenDayItemTest : public CalenDayItem
       
    45 {
       
    46 public:
       
    47     CalenDayItemTest::CalenDayItemTest(const CalenDayContainer *container) :
       
    48                 CalenDayItem(container)
       
    49     {
       
    50 #ifndef __WINSCW__
       
    51         mBg = new HbFrameItem("qtg_fr_cal_meeting_bg", HbFrameDrawer::NinePieces,
       
    52             this);
       
    53         mEventDesc = new HbTextItem(this);
       
    54         // TODO: probably ElideLeft needed for mirrored layout
       
    55         mEventDesc->setElideMode(Qt::ElideRight);
       
    56         mEventDesc->setTextWrapping(Hb::TextWrapAnywhere);
       
    57         mColorStripe = new CalenDayStatusStrip(this);
       
    58 
       
    59         HbStyle::setItemName(mBg, QLatin1String("backgroundFrame"));
       
    60         HbStyle::setItemName(mEventDesc, QLatin1String("eventDescription"));
       
    61         HbStyle::setItemName(static_cast<QGraphicsItem *> (mColorStripe),
       
    62             QLatin1String("colorStripe"));
       
    63 
       
    64         HbDeviceProfile deviceProfile;
       
    65         qreal stripeWidth = KCalenTimeStripWidth * deviceProfile.unitValue();
       
    66         mColorStripe->setPreferredWidth(stripeWidth);
       
    67 
       
    68         // Minimum size of event frame (without/with description) 
       
    69         mFrameMinWidth = KCalenMinEventWidth * deviceProfile.unitValue();
       
    70         mEventDescMinWidth = KCalenMinTouchableEventWidth
       
    71             * deviceProfile.unitValue();
       
    72         
       
    73         // Minimum width is assured by widgetml and css, additionally called here 
       
    74         // to prevent minimum size hint caching inside effectiveSizeHint
       
    75         setMinimumWidth(stripeWidth);
       
    76 #endif
       
    77     }
       
    78 };
       
    79 
       
    80 #endif