src/hbwidgets/widgets/hbgroupbox.cpp
branchGCC_SURGE
changeset 15 f378acbc9cfb
parent 7 923ff622b8b9
child 21 4633027730f5
child 34 ed14f46c0e55
equal deleted inserted replaced
9:730c025d4b77 15:f378acbc9cfb
    50 */
    50 */
    51 HbGroupBoxPrivate::HbGroupBoxPrivate()
    51 HbGroupBoxPrivate::HbGroupBoxPrivate()
    52     :HbWidgetPrivate(),
    52     :HbWidgetPrivate(),
    53     mContentWidget( 0 ),
    53     mContentWidget( 0 ),
    54     mHeadingWidget( 0 ),
    54     mHeadingWidget( 0 ),
       
    55     collapsed( false),
       
    56     collapsable( true ),
    55     mGroupBoxType( GroupBoxTypeUnknown )
    57     mGroupBoxType( GroupBoxTypeUnknown )
    56 {
    58 {
    57 }
    59 }
    58 
    60 
    59 /*
    61 /*
    87     HbStyle::setItemName( mContentWidget , "contentwidget");
    89     HbStyle::setItemName( mContentWidget , "contentwidget");
    88 }
    90 }
    89 
    91 
    90 /*!
    92 /*!
    91     \internal
    93     \internal
    92     Sets the group box type
    94     Sets the groupbox type
    93 */
    95 */
    94 void HbGroupBoxPrivate::setGroupBoxType( GroupBoxType type )
    96 void HbGroupBoxPrivate::setGroupBoxType( GroupBoxType type )
    95 {
    97 {
    96     Q_Q( HbGroupBox );
    98     Q_Q( HbGroupBox );
    97     
    99     
   104     mGroupBoxType = type;
   106     mGroupBoxType = type;
   105   
   107   
   106     // set the type and makes necesary primitive creation/deletion
   108     // set the type and makes necesary primitive creation/deletion
   107     switch(mGroupBoxType) {
   109     switch(mGroupBoxType) {
   108         case GroupBoxSimpleLabel:
   110         case GroupBoxSimpleLabel:
   109             {
   111             {               
   110             if(mHeadingWidget){
   112                 mHeadingWidget->setType(type);                        
   111                 mHeadingWidget->setType(type);				
       
   112                 mHeadingWidget->setVisible(true);
       
   113              
       
   114             }else{
       
   115                 createHeadingWidget();
       
   116             }
       
   117 
       
   118             if(mContentWidget){
       
   119                 mContentWidget->setVisible(false);
       
   120                 HbStyle::setItemName( mContentWidget , "");
       
   121             }
       
   122             
       
   123             }
   113             }
   124             break;
   114             break;
   125         case GroupBoxRichLabel:
   115         case GroupBoxRichLabel:
   126             {
   116             {
   127             if(mHeadingWidget){
       
   128                 mHeadingWidget->setVisible(false);
       
   129 
       
   130             }
       
   131             if(mContentWidget){
       
   132                 mContentWidget->setType(type);
   117                 mContentWidget->setType(type);
   133                 mContentWidget->setVisible(true);
       
   134                 HbStyle::setItemName( mContentWidget , "contentwidget");
   118                 HbStyle::setItemName( mContentWidget , "contentwidget");
   135             }else{
       
   136                 createContentWidget();
       
   137             }
       
   138 
       
   139             }
   119             }
   140             break;
   120             break;
   141         case GroupBoxCollapsingContainer:
   121         case GroupBoxCollapsingContainer:
   142             {
   122             {
   143             if((mHeadingWidget)){
       
   144                 mHeadingWidget->setType(type);
   123                 mHeadingWidget->setType(type);
   145                 mHeadingWidget->setVisible(true);                
       
   146             }else{
       
   147                 createHeadingWidget();
       
   148             }
       
   149 
       
   150             if(mContentWidget){
       
   151                 mContentWidget->setType(type);
   124                 mContentWidget->setType(type);
   152                 if(!q->isCollapsed()){
   125                 if(!q->isCollapsed()){
   153                     mContentWidget->setVisible(true);
   126                     mContentWidget->setVisible(true);
   154                     HbStyle::setItemName( mContentWidget , "contentwidget");
   127                     HbStyle::setItemName( mContentWidget , "contentwidget");
   155                 }else{
   128                 }else{
   156                     mContentWidget->setVisible(false);
   129                     mContentWidget->setVisible(false);
   157                     HbStyle::setItemName( mContentWidget , "");
   130                     HbStyle::setItemName( mContentWidget , "");
   158                 }
   131                 }
   159             }else{
       
   160                 createContentWidget();
       
   161             }
       
   162             }
   132             }
   163             break;
   133             break;
   164         default:
   134         default:
   165             break;
   135             break;
   166     }
   136     }
   169     q->repolish();
   139     q->repolish();
   170 }
   140 }
   171 
   141 
   172 
   142 
   173 /*!
   143 /*!
   174     @alpha
   144     @beta
   175     @hbwidgets
   145     @hbwidgets
   176     \class HbGroupBox
   146     \class HbGroupBox
   177 
   147 
   178     \brief HbGroupBox shows the user that a set of controls belong together.
   148     \brief HbGroupBox shows the user that a set of controls belong together.
   179     
   149     
   180     HbGroupBox is a container that provides the following : 
   150     HbGroupBox is a container, which can have following Elementes: 
   181 
   151 
   182     \li Heading: text only
   152     \li Heading: A heading contains one row text and disclosure indicator if the disclosure mechanism is on.
   183     \li Body content: arbitrary content (any HbWidget)
   153     \li Body content: Can have arbitrary content (any HbWidget)and application is responsible for its layout.
   184     \li Disclosure mechanism: expands and collapses the body content;
   154     \li Disclosure Indicator: Indicates the expands and collapses state of body;
   185 
   155 
   186     There are three types of GroupBox:
   156     There are three types of GroupBox:
   187 
   157 
   188     \li Simple Label - it's only function is to show relationship between items.
   158     \li Simple Label - Simple Label is to indicate the users position in the application hierarchy 
   189     simple Label shows a heading with marquee, no disclosure mechanism, and 
   159     or to display a textual label and its noninteractive. 
   190     no body content. Marquee is disabled by default.Also it is not focusable. 
   160     Simple Label has a heading text with marquee, no disclosure mechanism, and 
       
   161     no body content.Simple label only has heading element. 
       
   162     Marquee is disabled by default, can be enabled using setMarqueeHeading () .Also it is not focusable. 
   191 
   163 
   192     Example usage: For SimpleLabel type groupbox
   164     Example usage: For SimpleLabel type groupbox
   193     \code
   165     \code
   194     // create groupBox and set only heading; without any body content
   166     // create groupBox and set only heading; without any body content
   195     HbGroupBox *simpleLabel = new HbGroupBox();
   167     HbGroupBox *simpleLabel = new HbGroupBox();
   196     simpleLabel->setHeading("Simple label groupBox comes with marquee disabled by default");
   168     simpleLabel->setHeading("Simple label groupBox comes with marquee disabled by default");
       
   169     //to make marqee enabled
       
   170     simpleLabel->setMarqueeHeading(true);
   197     \endcode 
   171     \endcode 
   198     
   172     
   199     \image html simpleLabelgroupbox.png A SimpleLabel groupbox
   173     \image html simpleLabelgroupbox.png A SimpleLabel groupbox
   200 
   174 
   201 
   175 
   202     \li Rich Label - does not show a heading and all content is in the body area 
   176     \li Rich Label - Rich label can contain dynamic content,which themselves can be interactive,or informative
   203     with no marquee and no disclosure control.Body Content must describe its own behavior and layout. 
   177     with no heading ,no marquee and no disclosure control.Body Content must describe its own behavior and layout. 
   204 
   178 
   205     Example usage: For RichLabel type groupbox
   179     Example usage: For RichLabel type groupbox
   206     \code
   180     \code
   207     // create groupBox and set only content; without any heading
   181     // create groupBox and set only content; without any heading
   208     HbGroupBox *richHeading = new HbGroupBox();
   182     HbGroupBox *richLabel = new HbGroupBox();
   209     // content widget can be any HbWidget
   183     HbPushButton *button = new HbPushButton(HbIcon(QString("qtg_large_info")),"Ovi");
   210     // layouting and interaction behaviour inside Content widget is application's responsiblity
       
   211     HbPushButton *button = new HbPushButton(HbIcon(":/icons/ovi.png"),"Ovi");
       
   212     button->setAdditionalText("Launch Ovi Music store");
   184     button->setAdditionalText("Launch Ovi Music store");
   213     button->setOrientation(Qt::Vertical);
   185     richLabel->setContentWidget(button);
   214     button->setTextAlignment(Qt::AlignLeft);
   186     mainlayout->addItem(richLabel);
   215     richHeading->setContentWidget(button);
       
   216     \endcode 
   187     \endcode 
   217 
   188 
   218     \image html richLabelgroupbox.png A RichLabel groupbox.
   189     \image html richLabelgroupbox.png A RichLabel groupbox.
   219     In RichLabel type, groupbox provides background for body content.
   190     In RichLabel type, groupbox provides background for body content.
   220 
   191 
   221     \li Collapsing container - also allows the user to show or hide the content of the groupBox.
   192     \li Collapsing container - Collapsing container allows the user to show or hide the content of the groupBox.
   222     It always has a heading and body content; optionally has a disclosure mechanism.
   193     It always has a heading and body content; optionally has a disclosure mechanism.
   223     The heading does not marquee.The collapse/expand disclosure mechanism is located 
   194     The heading does not marquee.The body content must describe its own behavior and layout.
   224     in the heading and is the chief utility of this type of group box.
   195     The collapse/expand disclosure mechanism is located in the heading and is the chief utility of this type of groupbox.
   225 
   196 
   226     If disclosure mechanism is Off, then heading will appear without expand/collapse indication icon 
   197     If disclosure mechanism is Off,then heading will appear without expand/collapse indication icon 
   227     heading.Also the user will not be able to expand/collapse the body content.
   198     heading.Also the user will not be able to expand/collapse the body content.
   228 
   199 
   229     Example usage:For collapsingContainer groupbox
   200     Example usage:For collapsingContainer groupbox
   230     \code    
   201     \code    
   231     // create groupBox and set both heading and content
   202     // create groupBox and set both heading and content
   239     \endcode
   210     \endcode
   240 
   211 
   241     \image html collapsableContainergroupbox.png A Collapsing container groupbox.
   212     \image html collapsableContainergroupbox.png A Collapsing container groupbox.
   242 
   213 
   243     In this type, groupBox body content can be expanded/collapsed, 
   214     In this type, groupBox body content can be expanded/collapsed, 
   244     depending on whether or not the group box is collapsed.
   215     depending on whether or not the groupbox is collapsed.
   245 
   216 
   246     CollapsingContainer type groupBox comes with disclosure mechanism On by default.
   217     CollapsingContainer type groupBox comes with disclosure mechanism On by default.
   247 
   218 
   248     Setting heading and body content decides type of the groupbox.
   219     Setting heading and body content decides type of the groupbox.
   249 
   220 
   260 /*!
   231 /*!
   261     \fn void HbGroupBox::clicked()
   232     \fn void HbGroupBox::clicked()
   262 
   233 
   263     This signal is emitted only in case of richLabel and collapsing container groupbox,
   234     This signal is emitted only in case of richLabel and collapsing container groupbox,
   264     whenever click happened on body content.If the body content set is an interactive widget
   235     whenever click happened on body content.If the body content set is an interactive widget
   265     and consumes mouse press event, then clicked signal will not get emitted from groupBox in that case.
   236     and consumes mouse press event, then in that case clicked signal will not get emitted from groupBox.
   266  */
   237  */
   267 
   238 
   268 /*!
   239 /*!
   269     \fn void HbGroupBox::toggled(bool)
   240     \fn void HbGroupBox::toggled(bool)
   270 
   241 
   271     This signal is emitted only in case of collapsing container groupbox,
   242     This signal is emitted only in case of collapsing container groupbox,
   272     whenever groupbox is collapsed/expanded
   243     whenever groupbox is collapsed/expanded
   273  */
   244  */
   274 
   245 
   275 /*!
   246 /*!
   276     @alpha
   247     @beta
   277     Constructs a group box with the given \a parent.
   248     Constructs a groupbox with the given \a parent.
   278 */
   249 */
   279 HbGroupBox::HbGroupBox( QGraphicsItem *parent)
   250 HbGroupBox::HbGroupBox( QGraphicsItem *parent)
   280     : HbWidget(*new HbGroupBoxPrivate, parent)
   251     : HbWidget(*new HbGroupBoxPrivate, parent)
   281 {
   252 {
   282     Q_D( HbGroupBox );
   253     Q_D( HbGroupBox );
   292     Q_D( HbGroupBox );
   263     Q_D( HbGroupBox );
   293     d->q_ptr = this;
   264     d->q_ptr = this;
   294 }
   265 }
   295 
   266 
   296 /*!
   267 /*!
   297     Destructs the group box.
   268     Destructs the groupbox.
   298 */
   269 */
   299 HbGroupBox::~HbGroupBox()
   270 HbGroupBox::~HbGroupBox()
   300 {
   271 {
   301 }
   272 }
   302 
   273 
   303 /*!
   274 /*!
   304     @alpha
   275     @beta
   305     
   276     
   306     Sets the group box heading
   277     Sets the groupbox heading
   307 
   278 
   308     Note: heading property is valid for simpleLabel & collapsing container type.
   279     Note: heading property is valid for simpleLabel & collapsing container type.
       
   280     In case of collapsing container,
       
   281     if empty heading is set on runtime Groupbox will change to RichLabel.
       
   282     For Collapsing container,
       
   283     if body content is collapsible ,heading will appear along with Disclosure indicator.
   309     If heading is set on richLabel type groupBox, it will be ignored
   284     If heading is set on richLabel type groupBox, it will be ignored
   310 
   285 
   311     \sa heading
   286     \sa heading
   312 */
   287 */
   313 void HbGroupBox::setHeading( const QString &text )
   288 void HbGroupBox::setHeading( const QString &text )
   314 {
   289 {
   315     Q_D( HbGroupBox );
   290     Q_D( HbGroupBox );
   316 
   291 
   317     if(!d->mHeadingWidget)
   292     if( !text.isEmpty() ){
   318         d->createHeadingWidget();
   293         if( !d->mHeadingWidget ){
   319     
   294             d->createHeadingWidget( );
   320     d->mHeadingWidget->setHeading(text);
   295         }
   321 
   296         d->mHeadingWidget->setHeading( text );
   322     if(d->mContentWidget){
   297         if( d->mContentWidget ){
   323         d->setGroupBoxType(GroupBoxCollapsingContainer);
   298             d->setGroupBoxType(GroupBoxCollapsingContainer);
   324     }else
   299         }else {
   325         d->setGroupBoxType(GroupBoxSimpleLabel);
   300             d->setGroupBoxType(GroupBoxSimpleLabel);
   326 }
   301         }
   327 
   302     }else{
   328 /*!
   303         if( d->mHeadingWidget ){
   329     @alpha
   304             delete d->mHeadingWidget;
       
   305             d->mHeadingWidget = 0;
       
   306             if( d->mContentWidget ) {
       
   307                 d->setGroupBoxType( GroupBoxRichLabel );
       
   308             }else{
       
   309                 d->setGroupBoxType( GroupBoxTypeUnknown );
       
   310             }
       
   311         }        
       
   312     }
       
   313     repolish();
       
   314 }
       
   315 
       
   316 /*!
       
   317     @beta
   330 
   318 
   331     Returns text shown on the groupBox heading.
   319     Returns text shown on the groupBox heading.
   332 
   320 
   333     There is no default heading string set.
   321     There is no default heading string set.
   334 
   322 
   344         return d->mHeadingWidget->headingText;
   332         return d->mHeadingWidget->headingText;
   345     return QString();
   333     return QString();
   346 }
   334 }
   347 
   335 
   348 /*!
   336 /*!
   349     @alpha
   337     @beta
   350 
   338 
   351     Sets whether the groupbox is collapsable or not
   339     Sets whether the groupbox is collapsable or not
   352 
   340 
   353     If this property is true, then disclosure mechanism is On.    
   341     If this property is true, then disclosure mechanism is On.    
   354 
   342 
   360 void HbGroupBox::setCollapsable( bool collapsable )
   348 void HbGroupBox::setCollapsable( bool collapsable )
   361 {
   349 {
   362     Q_D( HbGroupBox );
   350     Q_D( HbGroupBox );
   363 
   351 
   364     if(d->mGroupBoxType == GroupBoxCollapsingContainer){
   352     if(d->mGroupBoxType == GroupBoxCollapsingContainer){
   365         if(d->mHeadingWidget->collapsable  == collapsable)
   353         if(d->collapsable  == collapsable)
   366         {
   354         {
   367             return;
   355             return;
   368         }
   356         }
   369         d->mHeadingWidget->collapsable  = collapsable;
   357         d->collapsable  = collapsable;
   370 
   358 
   371         d->mHeadingWidget->createPrimitives();
   359         d->mHeadingWidget->createPrimitives();
   372 
   360 
   373         // make it expand otherwise groupBox can't be expanded at all, after this scenario
   361         // make it expand otherwise groupBox can't be collapsed at all, after this scenario
   374         if(!collapsable && d->mHeadingWidget->collapsed){
   362         if(!collapsable && d->collapsed){
   375             d->mContentWidget->setVisible(true);
   363             d->mContentWidget->setVisible(true);
   376             HbStyle::setItemName( d->mContentWidget , "contentwidget");
   364             HbStyle::setItemName( d->mContentWidget , "contentwidget");
   377             d->mHeadingWidget->collapsed  = false;            
   365             d->collapsed  = false;            
   378         }
   366         }
   379         d->mHeadingWidget->updatePrimitives();
   367         d->mHeadingWidget->updatePrimitives();
   380         repolish();
   368         repolish();
   381     }
   369     }
   382 }
   370 }
   383 
   371 
   384 /*!
   372 /*!
   385     @alpha
   373     @beta
   386 
   374 
   387     Returns whether the groupbox is collapsable or not
   375     Returns whether the groupbox is collapsable or not
   388 
   376 
   389     By default, group boxes are collapsable.
   377     By default, groupbox is collapsable.
   390 
   378 
   391     \sa setCollapsable
   379     \sa setCollapsable
   392 */
   380 */
   393 bool HbGroupBox::isCollapsable( ) const
   381 bool HbGroupBox::isCollapsable( ) const
   394 {
   382 {
   395     Q_D( const HbGroupBox );
   383     Q_D( const HbGroupBox );
   396     if(d->mHeadingWidget && d->mGroupBoxType == GroupBoxCollapsingContainer)
   384     if(d->mHeadingWidget && d->mGroupBoxType == GroupBoxCollapsingContainer)
   397         return d->mHeadingWidget->collapsable;
   385         return d->collapsable;
   398     return false;
   386     return false;
   399 }
   387 }
   400 
   388 
   401 /*!
   389 /*!
   402     @alpha
   390     @beta
   403 
   391 
   404     Sets whether the groupbox collapsed or expanded
   392     Sets whether the groupbox collapsed or expanded
   405 
   393 
   406     If the groupbox is collapsed,the group box's content widget are hidden; 
   394     If the groupbox is collapsed,the groupbox's content widget are hidden; 
   407     otherwise they will be visible
   395     otherwise they will be visible
   408 
   396 
   409     setCollapsed on groupbox will emit signal toggled( bool ) 
   397     setCollapsed on groupbox will emit signal toggled( bool ) 
   410     upon collapse\expand of content widget
   398     upon collapse\expand of content widget
   411 
   399 
   412     Only collapsable groupboxes can be collapsed. (i.e)this API will not do anything 
   400     Only collapsable groupbox can be collapsed. (i.e)this API will not do anything 
   413     if group box is not collapsable.By default, group boxes are not collapsed.
   401     if groupbox is not collapsable.By default, groupbox is not collapsed.
   414 
   402 
   415     Note: collapsed property is valid only for collapsing container type.
   403     Note: collapsed property is valid only for collapsing container type.
   416     If collapsed is set on simpleLabel or richLabel type groupBox, it will be ignored
   404     If collapsed is set on simpleLabel or richLabel type groupBox, it will be ignored
   417 
   405 
   418     \sa isCollapsed \sa setCollapsable
   406     \sa isCollapsed \sa setCollapsable
   419 */
   407 */
   420 void HbGroupBox::setCollapsed( bool collapsed )
   408 void HbGroupBox::setCollapsed( bool collapsed )
   421 {
   409 {
   422     Q_D( HbGroupBox );
   410     Q_D( HbGroupBox );
   423     if(d->mGroupBoxType == GroupBoxCollapsingContainer){
   411     if(d->mGroupBoxType == GroupBoxCollapsingContainer){
   424         if( d->mContentWidget && d->mHeadingWidget->collapsable) {
   412         if( d->mContentWidget && d->collapsable) {
   425             if ( d->mHeadingWidget->collapsed == collapsed )
   413             if ( d->collapsed == collapsed )
   426                 return;
   414                 return;
   427 
   415 
   428             d->mHeadingWidget->collapsed = collapsed;
   416             d->collapsed = collapsed;
   429 
   417 
   430             #ifdef HB_EFFECTS
   418             #ifdef HB_EFFECTS
   431             HbEffectInternal::add(HB_GROUPBOX_TYPE,"groupbox_expand", "expand");
   419             HbEffectInternal::add(HB_GROUPBOX_TYPE,"groupbox_expand", "expand");
   432             //HbEffectInternal::add(HB_GROUPBOX_TYPE,"groupbox_collapse", "collapse");
   420             //HbEffectInternal::add(HB_GROUPBOX_TYPE,"groupbox_collapse", "collapse");
   433             #endif
   421             #endif
   434 
   422 
   435             if ( d->mHeadingWidget->collapsed ) {
   423             if ( d->collapsed ) {
   436                 #ifdef HB_EFFECTS
   424                 #ifdef HB_EFFECTS
   437                 HbEffect::start( d->mContentWidget, HB_GROUPBOX_TYPE, "collapse");  
   425                 HbEffect::start( d->mContentWidget, HB_GROUPBOX_TYPE, "collapse");  
   438                 #endif
   426                 #endif
   439                 HbStyle::setItemName( d->mContentWidget , "");
   427                 HbStyle::setItemName( d->mContentWidget , QString());
   440                 d->mContentWidget->setVisible(false);
   428                 d->mContentWidget->setVisible(false);
   441             }
   429             }
   442             else {
   430             else {
   443                 #ifdef HB_EFFECTS
   431                 #ifdef HB_EFFECTS
   444                 HbEffect::start( d->mContentWidget, HB_GROUPBOX_TYPE, "expand");  
   432                 HbEffect::start( d->mContentWidget, HB_GROUPBOX_TYPE, "expand");  
   445                 #endif
   433                 #endif
   446                 HbStyle::setItemName( d->mContentWidget , "contentwidget");
   434                 HbStyle::setItemName( d->mContentWidget , "contentwidget");
   447                 d->mContentWidget->setVisible(true);
   435                 d->mContentWidget->setVisible(true);
       
   436                 repolish();
   448             }
   437             }
   449             d->mHeadingWidget->updatePrimitives();
   438             d->mHeadingWidget->updatePrimitives();
   450             emit toggled( d->mHeadingWidget->collapsed );
   439             emit toggled( d->collapsed );
   451         }
   440         }
   452     }
   441     }    
   453 }
   442 }
   454 
   443 
   455 /*!
   444 /*!
   456     @alpha
   445     @beta
   457 
   446 
   458     Returns whether the group box is collapsed or expanded
   447     Returns whether the groupbox is collapsed or expanded
   459 
   448 
   460     By default, groupboxes are not collapsed.
   449     By default, groupbox is not collapsed.
   461      
   450      
   462     \sa setCollapsed \sa setCollapsable
   451     \sa setCollapsed \sa setCollapsable
   463 */
   452 */
   464 bool HbGroupBox::isCollapsed( ) const
   453 bool HbGroupBox::isCollapsed( ) const
   465 {
   454 {
   466     Q_D ( const HbGroupBox );
   455     Q_D ( const HbGroupBox );
   467     if(d->mGroupBoxType == GroupBoxCollapsingContainer)
   456     if(d->mGroupBoxType == GroupBoxCollapsingContainer)
   468         return d->mHeadingWidget->collapsed;
   457         return d->collapsed;
   469 		
   458 		
   470     return false;
   459     return false;
   471 }
   460 }
   472 
   461 
   473 /*!
   462 /*!
   474     @alpha
   463     @beta
   475 
   464 
   476     Enables the marquee for heading if marqueeHeading is true, otherwise the 
   465     Enables the marquee for heading if marqueeHeading is true, otherwise the 
   477     heading will not marquee.
   466     heading will not marquee.
   478 
   467 
   479     Note: marqueeHeading property is valid  only for simpleLabel type.
   468     Note: marqueeHeading property is valid  only for simpleLabel type.
   489     }
   478     }
   490 
   479 
   491 }
   480 }
   492 
   481 
   493 /*!
   482 /*!
   494     @alpha
   483     @beta
   495 
   484 
   496     Returns true if marquee is enabled for  groupbox heading; 
   485     Returns true if marquee is enabled for  groupbox heading; 
   497     otherwise returns false.
   486     otherwise returns false.
   498 
   487 
   499     The default value is false.
   488     The default value is false.
   509     return false;
   498     return false;
   510 }
   499 }
   511 
   500 
   512 
   501 
   513 /*!
   502 /*!
   514     @alpha
   503     @beta
   515 
   504 
   516     Sets the groupbox content widget
   505     Sets the groupbox content widget
   517 
   506 
   518     Groupbox can set only one content widget at a time.
   507     Groupbox can set only one content widget at a time.
   519     Ownership of the content widget is transferred to groupbox.
   508     Ownership of the content widget is transferred to groupbox.
   520 
   509 
   521     If \a widget to set is NULL then content is removed.
   510     If \a widget to set is NULL then content is removed.
       
   511     And Groupbox type is changed to simpleLabel , if heading is present.
   522 
   512 
   523     contentWidget is valid only for richLabel & collapsing container type.
   513     contentWidget is valid only for richLabel & collapsing container type.
   524     If content Widget is set on simpleLabel type groupBox, it will be ignored
   514     If content Widget is set on simpleLabel type groupBox, it will be ignored
   525 
   515 
   526     Note:
   516     Note:
   535     Q_D( HbGroupBox );
   525     Q_D( HbGroupBox );
   536    
   526    
   537     if(!d->mContentWidget)
   527     if(!d->mContentWidget)
   538         d->createContentWidget();
   528         d->createContentWidget();
   539     
   529     
   540     d->mContentWidget->setContentWidget(widget);
   530     if(widget){
   541 
   531         d->mContentWidget->setContentWidget(widget);
   542     if(d->mHeadingWidget){
   532         if(d->mHeadingWidget){
   543         d->setGroupBoxType(GroupBoxCollapsingContainer);
   533             d->setGroupBoxType(GroupBoxCollapsingContainer);
   544     }else
   534         }else{
   545         d->setGroupBoxType(GroupBoxRichLabel);
   535             d->setGroupBoxType(GroupBoxRichLabel);
   546 
   536         }
   547      // collapsed property is set before setContentWidget
   537         // update content widget primitve
   548     if ( d->mGroupBoxType == GroupBoxCollapsingContainer && d->mHeadingWidget->collapsed ) {	
   538         d->mContentWidget->updatePrimitives();
   549         d->mContentWidget->setVisible(false);
   539 
   550         HbStyle::setItemName( d->mContentWidget , "");
   540     }else{
       
   541         delete d->mContentWidget;
       
   542         d->mContentWidget = 0;
       
   543         if(d->mHeadingWidget){
       
   544             d->setGroupBoxType(GroupBoxSimpleLabel);
       
   545         }else{
       
   546             d->setGroupBoxType(GroupBoxTypeUnknown);
       
   547         }
   551     }
   548     }
   552     // update content widget primitve
       
   553     d->mContentWidget->updatePrimitives();
       
   554     repolish();
   549     repolish();
   555 }
   550 }
   556 
   551 
   557 /*!
   552 /*!
   558     @alpha
   553     @beta
   559 
   554 
   560     Returns groupbox content widget
   555     Returns groupbox content widget
   561     
   556     
   562     There is no default content widget.	
   557     There is no default content widget.	
   563 
   558 
   606     return 0;	
   601     return 0;	
   607 }
   602 }
   608 
   603 
   609 /*!
   604 /*!
   610     \reimp
   605     \reimp
       
   606 */
       
   607 
       
   608 QSizeF HbGroupBox::sizeHint( Qt::SizeHint which, const QSizeF &constraint ) const
       
   609 {
       
   610     Q_D( const HbGroupBox );
       
   611 
       
   612     //group box will have size zero in case contentwidget and heading not their.
       
   613     if( !d->mHeadingWidget && !d->mContentWidget )
       
   614         return QSizeF( 0.f, 0.f );
       
   615     return HbWidget::sizeHint(which, constraint);
       
   616 }
       
   617 
       
   618 
       
   619 /*!
       
   620     \reimp
   611  */
   621  */
   612 void HbGroupBox::updatePrimitives()
   622 void HbGroupBox::updatePrimitives()
   613 {
   623 {
   614     Q_D( const HbGroupBox );
   624     Q_D( const HbGroupBox );
   615 
   625