TRect AknPopupLayouts::RectFromLayout(TRect aParent, const TAknWindowComponentLayout &aComponentLayout) { TAknWindowLineLayout lineLayout = aComponentLayout.LayoutLine(); TAknLayoutRect layoutRect; layoutRect.LayoutRect(aParent,lineLayout); return layoutRect.Rect(); }
// --------------------------------------------------------------------------- // CAknDiscreetPopupDrawer::RectFromLayout // Returns the specified layout rectangle. // --------------------------------------------------------------------------- // TRect CAknDiscreetPopupDrawer::RectFromLayout( const TRect& aParent, const TAknWindowComponentLayout& aComponentLayout ) { TAknLayoutRect layoutRect; layoutRect.LayoutRect( aParent, aComponentLayout.LayoutLine() ); return layoutRect.Rect(); }
static TInt GetMaxListHeight() { TAknLayoutRect temp, layout; TRect mainPane; TRect statusPane; TRect controlPane; AknLayoutUtils::LayoutMetricsRect( AknLayoutUtils::EPopupParent, mainPane ); AknLayoutUtils::LayoutMetricsRect( AknLayoutUtils::EStatusPane, statusPane ); AknLayoutUtils::LayoutMetricsRect( AknLayoutUtils::EControlPane, controlPane ); // in landscape orientation popuplist can't go on top of statuspane if ( !Layout_Meta_Data::IsLandscapeOrientation() ) { mainPane.iTl.iY -= statusPane.Height(); } // treat mainpane+statuspane area as popup window // too bad we can't use this, because e.g. QVGA landscape has border-size 7 // in avkon layout and border-size 9 in skin drawing... /*temp.LayoutRect( mainPane, AknLayoutScalable_Avkon::listscroll_menu_pane(0)); layout.LayoutRect( temp.Rect(), AknLayoutScalable_Avkon::list_menu_pane(0)); return layout.Rect().Height();*/ // shadow TInt varietyIndex = Layout_Meta_Data::IsLandscapeOrientation(); TAknLayoutRect insideArea; insideArea.LayoutRect( mainPane, AknLayoutScalable_Avkon::bg_popup_window_pane_g1(varietyIndex) ); return insideArea.Rect().Height(); }
// ---------------------------------------------------------------------------- // void CChangeConnectionDlg::HandleResourceChange( TInt aType ) // Handle resource change events. // ---------------------------------------------------------------------------- // void CChangeConnectionDlg::HandleResourceChange( TInt aType ) { if ( aType == KAknsMessageSkinChange ) { CAknListQueryDialog::HandleResourceChange( aType ); SizeChanged(); } else { if ( aType == KEikDynamicLayoutVariantSwitch ) { TRect mainPaneRect; AknLayoutUtils::LayoutMetricsRect( AknLayoutUtils::EMainPane, mainPaneRect ); TAknLayoutRect layoutRect; layoutRect.LayoutRect( TRect( TPoint( 0, 0 ), mainPaneRect.Size() ), AKN_LAYOUT_WINDOW_list_gen_pane( 0 ) ); ListBox()->SetRect( layoutRect.Rect() ); } // Base call CAknListQueryDialog::HandleResourceChange( aType ); } }
// ----------------------------------------------------------------------------- // RectFromLayout // // ----------------------------------------------------------------------------- // TRect CAknInfoPopupNote::RectFromLayout( const TRect& aParent, const TAknWindowComponentLayout& aComponentLayout ) const { TAknWindowLineLayout lineLayout = aComponentLayout.LayoutLine(); TAknLayoutRect layoutRect; layoutRect.LayoutRect(aParent, lineLayout); return layoutRect.Rect(); }
CAknDialogAttributes* CAknDialog::AttributesL() { if ( !iAttributes ) { iAttributes = new (ELeave) CAknDialogAttributes(); TRect windowRect = Rect(); TAknLayoutRect topLeft; topLeft.LayoutRect(windowRect, Popup_windows_skin_placing__frame_general__Line_2()); TAknLayoutRect bottomRight; bottomRight.LayoutRect(windowRect, ELayoutEmpty, 169, ELayoutEmpty, ELayoutEmpty, 2, 7,7); bottomRight.LayoutRect(windowRect, Popup_windows_skin_placing__frame_general__Line_5()); TRect outerRect = TRect(topLeft.Rect().iTl, bottomRight.Rect().iBr); TRect innerRect = TRect(topLeft.Rect().iBr, bottomRight.Rect().iTl); iAttributes->iBgContext = CAknsFrameBackgroundControlContext::NewL( KAknsIIDQsnFrPopup, outerRect, innerRect, ETrue ); if ( &Window() ) iAttributes->iBgContext->SetParentPos( PositionRelativeToScreen() ); } return iAttributes; }
// --------------------------------------------------------- // CAknChoiceListPopupList::SizeChanged() // --------------------------------------------------------- // void SizeChanged() { CEikFormattedCellListBox::SizeChanged(); TRAP_IGNORE( SizeChangedL() ); TAknLayoutRect cellRect; cellRect.LayoutRect( Rect(), AknLayoutScalable_Avkon::list_single_choice_list_pane(0) ); CFormattedCellListBoxItemDrawer *itemDrawer( ItemDrawer() ); itemDrawer->SetItemCellSize( cellRect.Rect().Size() ); }
EXPORT_C void AknPopupLayouts::ModifyWindowGraphicForMessageBox(TAknPopupWindowLayoutDef &aDef, TInt aNumberOfLines) { TInt varietyIndex = 0; switch (aNumberOfLines) { case (2): varietyIndex = 1; break; case (3): varietyIndex = 2; } TAknWindowLineLayout lay = AknLayoutScalable_Apps::loc_type_pane(varietyIndex).LayoutLine(); TAknLayoutRect layout; layout.LayoutRect( TRect(0,0,0,0), lay ); TRect messageRect( layout.Rect() ); aDef.iWindowRect.iTl.iY -= messageRect.Height(); }
void CAknNoteAttributes::CreateProgressBarL() { if (iProgressBar) { return; } TInt numLines = iNoteText->NumberOfLines(); // New parameter added to Wait_or_progress_note_pop_up_window_elements_Line_2 layout API. TInt tIndex = 0; if (numLines == 3) { tIndex = 1; } if (numLines >= 4) { tIndex = 2; } TRect mainPane = iAvkonAppUi->ClientRect(); TAknLayoutRect parent; AknLayoutUtils::TAknCbaLocation cbaLocation( AknLayoutUtils::CbaLocation() ); TInt variety( 0 ); if ( cbaLocation == AknLayoutUtils::EAknCbaLocationRight ) { variety = 3; } else if ( cbaLocation == AknLayoutUtils::EAknCbaLocationLeft ) { variety = 6; } else { variety = 0; } parent.LayoutRect(mainPane, AknLayoutScalable_Avkon::popup_note_wait_window( variety + tIndex )); TAknLayoutRect layRect; layRect.LayoutRect(parent.Rect(), AKN_LAYOUT_WINDOW_Wait_or_progress_note_pop_up_window_elements_Line_2(tIndex)); CEikProgressInfo::SInfo info; info.iHeight = layRect.Rect().Height();//lay.iH; info.iWidth = layRect.Rect().Width();//lay.iW; info.iFinalValue = 1; info.iSplitsInBlock = 0; info.iTextType = EEikProgressTextNone; iProgressBar = new(ELeave) CEikProgressInfo(info); iProgressBar->ConstructL(); TransferToControlL(iProgressBar); InvalidateLayout(); }
void CAknEcsNote::SetEmergencyNumber( const TDesC& aMatchedNumber ) { TRect screen(iAvkonAppUi->ApplicationRect()); TAknLayoutRect mainPane; mainPane.LayoutRect(screen, AKN_LAYOUT_WINDOW_main_pane(screen, 0, 1, 1)); TAknLayoutRect popupNoteWindow; AknLayoutUtils::TAknCbaLocation cbaLocation( AknLayoutUtils::CbaLocation() ); TInt variety( 0 ); if ( cbaLocation == AknLayoutUtils::EAknCbaLocationRight ) { variety = 5; } else if ( cbaLocation == AknLayoutUtils::EAknCbaLocationLeft ) { variety = 8; } else { variety = 2; } popupNoteWindow.LayoutRect(mainPane.Rect(), AknLayoutScalable_Avkon::popup_note_window( variety )); TAknLayoutText textRect; textRect.LayoutText(popupNoteWindow.Rect(), AKN_LAYOUT_TEXT_Note_pop_up_window_texts_Line_1(4)); // Size of a temporary buffer that contains new lines, spaces and // emergency number for a note. TBuf16<KAknEcsMaxMatchingLength+80> number; number.Append('\n'); number.Append('\n'); TInt spaceCharWidthInPixels = textRect.Font()->CharWidthInPixels(' '); if (spaceCharWidthInPixels < 1) { // Avoid divide by zero situation even the space char would have zero length. spaceCharWidthInPixels = 1; } TInt length = (textRect.TextRect().Width() - textRect.Font()->TextWidthInPixels(aMatchedNumber)) / spaceCharWidthInPixels; const TInt matchedNumberLength = aMatchedNumber.Length(); const TInt numberLength = number.Length(); const TInt numberMaxLength = number.MaxLength(); if ( numberLength + length + matchedNumberLength > numberMaxLength) { // To make sure that buffer overflow does not happen. length = numberMaxLength - numberLength - matchedNumberLength; } for (int i = 0; i < length ; i++) { number.Append(' '); } number.Append(aMatchedNumber); TRAP_IGNORE(SetTextL(number)); }
EXPORT_C void AknPopupLayouts::ModifyWindowGraphicForHeading(TAknPopupWindowLayoutDef &aDef) { TRect nullRect(0,0,0,0); TAknLayoutRect nullHeadingRect; // find out, how much space is needed for heading (spaceForHeading was 23) nullHeadingRect.LayoutRect(nullRect,AKN_LAYOUT_WINDOW_Pop_up_menu_with_heading_window_graphics_Line_1(nullRect)); TInt spaceForHeading = nullHeadingRect.Rect().Height(); aDef.iWindowRect.iTl.iY -= spaceForHeading; // This is necessary to position it correctly // this is because b=0 in parent of coverrect and because // parent's height is used in the child... TRect window_rect = aDef.iWindowRect; aDef.iCover.LayoutRect( window_rect, AKN_LAYOUT_WINDOW_Pop_up_menu_with_heading_window_graphics_Line_1(window_rect)); aDef.iSecond.LayoutRect( window_rect, AKN_LAYOUT_WINDOW_Pop_up_menu_with_heading_window_graphics_Line_2(window_rect)); aDef.iFirst.LayoutRect( window_rect, AKN_LAYOUT_WINDOW_Pop_up_menu_with_heading_window_graphics_Line_3(window_rect)); aDef.iOutline.LayoutRect(window_rect, AKN_LAYOUT_WINDOW_Pop_up_menu_with_heading_window_graphics_Line_4(window_rect)); aDef.iInside.LayoutRect( window_rect, AKN_LAYOUT_WINDOW_Pop_up_menu_with_heading_window_graphics_Line_5(window_rect)); aDef.iPopupMenuWindowOffset=TPoint(0,spaceForHeading); }
EXPORT_C void CAknPasswordSettingPage::SizeChanged() { StandardSettingPageLayout(); // Must be part of any re-implementation iSecretEditorLayoutRect.LayoutRect( CAknSettingPage::SettingItemContentRect( EFalse ), AknLayoutScalable_Avkon::setting_code_pane_copy1() ); TRect editorRect = iSecretEditorLayoutRect.Rect(); iHorizontalShadow.LayoutRect(editorRect, AKN_LAYOUT_WINDOW_Code_time_and_date_entry_pane_elements_Line_1); iVerticalShadow.LayoutRect(editorRect, AKN_LAYOUT_WINDOW_Code_time_and_date_entry_pane_elements_Line_2); iOutlineFrame.LayoutRect(editorRect, AKN_LAYOUT_WINDOW_Code_time_and_date_entry_pane_elements_Line_3); AknLayoutUtils::LayoutSecretEditor( ( CEikSecretEditor * )EditorControl(), editorRect, AknLayoutScalable_Avkon::setting_code_pane_t1_copy1() ); TRAP_IGNORE(((CEikSecretEditor*)EditorControl())->SetSkinTextColorL(EAknsCIQsnTextColorsCG26)); TAknLayoutRect layoutRect; layoutRect.LayoutRect( editorRect, AknLayoutScalable_Avkon::input_focus_pane_cp2_copy1() ); TRect editorFrameRect( layoutRect.Rect() ); layoutRect.LayoutRect( editorFrameRect, AknLayoutScalable_Avkon::set_opt_bg_pane_g1_copy1() ); SetEditedItemFrameRects( editorFrameRect, layoutRect.Rect() ); layoutRect.LayoutRect( editorRect, AknLayoutScalable_Avkon::indicator_popup_pane_cp6() ); SetEditorIndicatorRect( layoutRect.Rect() ); }
TReal CTouchInput::PortraitHeight() { iPortraitHeight = ProposedHeight(); if ( iPortraitHeight != KErrNotReady ) { return iPortraitHeight; } #if defined(HAVE_SYMBIAN_INTERNAL) TRect screenRect; TAknLayoutRect portraitRect; TAknLayoutRect indicatorRect; AknLayoutUtils::LayoutMetricsRect( AknLayoutUtils::EScreen, screenRect ); portraitRect.LayoutRect( screenRect, AknLayoutScalable_Avkon::popup_fep_ituss_window( 0 ).LayoutLine() ); indicatorRect.LayoutRect( screenRect, AknLayoutScalable_Avkon::icf_edit_indi_pane( 2 ).LayoutLine() ); iPortraitHeight = portraitRect.Rect().Height() + indicatorRect.Rect().Height(); #endif //HAVE_SYMBIAN_INTERNAL return iPortraitHeight; }
EXPORT_C void CAknDialog::SizeChanged() { if (iAttributes) { TRect windowRect = Rect(); TAknLayoutRect topLeft; topLeft.LayoutRect(windowRect, Popup_windows_skin_placing__frame_general__Line_2()); TAknLayoutRect bottomRight; bottomRight.LayoutRect(windowRect, Popup_windows_skin_placing__frame_general__Line_5()); TRect outerRect = TRect(topLeft.Rect().iTl, bottomRight.Rect().iBr); TRect innerRect = TRect(topLeft.Rect().iBr, bottomRight.Rect().iTl); iAttributes->iOuterRect = outerRect; iAttributes->iInnerRect = innerRect; iAttributes->iNeedsUpdate = ETrue; iAttributes->iBgContext->SetParentPos( PositionRelativeToScreen() ); } CEikDialog::SizeChanged(); }
TBool CEikCapCArray::CalcItemIndexes(TInt &aTopItemIndex, TInt &aMiddleItemIndex, TInt &aBottomItemIndex, TSize aAreaSize) { // calculates last item that still fits to the area's size TBool switchDir = EFalse; TInt i; TInt reservedHeight = 0; TInt newTop = aTopItemIndex, newMiddle = 1, newBottom = aBottomItemIndex; const TInt count = Count(); CEikCaptionedControl *firstCapCC = Count() > 0 ? (*this)[0] : NULL; TInt num = 0; if (newTop == -1) { newTop = Count() - newMiddle - newBottom; } if (newBottom == -1) { newBottom = Count() - newTop - newMiddle; } if (aTopItemIndex != -1) { num = count - aTopItemIndex; } if (aBottomItemIndex != -1) { num = count - aBottomItemIndex; } for (i = 0; i < num; i++) { TInt index = 0; if (aTopItemIndex != -1) { index = i + aTopItemIndex; } else if (aBottomItemIndex != -1) { index = count - 1 - aBottomItemIndex - i; } CEikCaptionedControl* line=(*this)[index]; const CEikDialogPage *dialogPage = firstCapCC->DialogPage(); CEikDialogPage::TFormLayoutSelection ret = CEikDialogPage::ESingle; if ( dialogPage ) ret = dialogPage->FormLayout(); TAknWindowLineLayout layout; if (ret == CEikDialogPage::ESingle) { TInt height = line->NumberOfLines(); if (height < 1) height = 1; if (IsPopupField(line)) { layout = AknLayoutScalable_Avkon::form_field_popup_pane(height-1).LayoutLine(); } else { layout = AknLayoutScalable_Avkon::form_field_data_pane(height-1).LayoutLine(); } } else if (ret == CEikDialogPage::EDouble) { TInt height = line->NumberOfLines(); if (height < 1) height = 1; if (IsPopupField(line)) { layout = AknLayoutScalable_Avkon::form_field_popup_wide_pane(height-1).LayoutLine(); } else { layout = AknLayoutScalable_Avkon::form_field_data_wide_pane(height-1).LayoutLine(); } } else { // should Panic() here } TRect rect = TRect(TPoint(0,0), aAreaSize); TAknLayoutRect layoutRect; layoutRect.LayoutRect(rect, layout); TInt height2 = layoutRect.Rect().Height(); reservedHeight += height2; if (reservedHeight > aAreaSize.iHeight) { break; } newMiddle = i + 1; if (aTopItemIndex == -1) { newTop = count - i - 1 - aBottomItemIndex; } if (aBottomItemIndex == -1) { newBottom = count - i - 1 - aTopItemIndex; } } if (reservedHeight <= aAreaSize.iHeight) { // 2nd loop for case where item sizes have changed; makes sure screen is full. for(int i = 0; newBottom > 0 && aTopItemIndex == -1 || newTop > 0 && aBottomItemIndex == -1; i++) { switchDir = ETrue; TInt index = 0; if (aBottomItemIndex == -1) { newMiddle ++; newTop --; index = newTop; } if (aTopItemIndex == -1) { newMiddle ++; newBottom --; index = count - 1 - newBottom; } CEikCaptionedControl* line=(*this)[index]; const CEikDialogPage *dialogPage = firstCapCC->DialogPage(); CEikDialogPage::TFormLayoutSelection ret = CEikDialogPage::ESingle; if ( dialogPage ) ret = dialogPage->FormLayout(); TAknWindowLineLayout layout; if (ret == CEikDialogPage::ESingle) { TInt height = line->NumberOfLines(); if (height < 1) height = 1; if (IsPopupField(line)) { layout = AknLayoutScalable_Avkon::form_field_popup_pane(height-1).LayoutLine(); } else { layout = AknLayoutScalable_Avkon::form_field_data_pane(height-1).LayoutLine(); } } else if (ret == CEikDialogPage::EDouble) { TInt height = line->NumberOfLines(); if (height < 1) height = 1; if (IsPopupField(line)) { layout = AknLayoutScalable_Avkon::form_field_popup_wide_pane(height-1).LayoutLine(); } else { layout = AknLayoutScalable_Avkon::form_field_data_wide_pane(height-1).LayoutLine(); } } else { // should Panic() here } TRect rect = TRect(TPoint(0,0), aAreaSize); TAknLayoutRect layoutRect; layoutRect.LayoutRect(rect, layout); TInt height2 = layoutRect.Rect().Height(); reservedHeight += height2; if (reservedHeight > aAreaSize.iHeight) break; } } aTopItemIndex = newTop; aMiddleItemIndex = newMiddle; aBottomItemIndex = newBottom; return switchDir; }
void CAknScrollIndicator::ConstructL() { iIsWindowOwningScrollBar = EFalse; if( AknLayoutUtils::PenEnabled() && (iTypeOfScrollBar == CAknScrollButton::ENormal) ) { // TODO: Load bitmaps for double span scroll bar buttons when they become available // Get the correct sizes from LAF when the support for the buttons is available // Initalize the bitmap devices and graphics contexts correctly TInt err; TAknsItemID indicator; TAknWindowComponentLayout buttonLayout; TAknWindowComponentLayout scrollpaneLayout; switch( iType ) { case CAknScrollButton::ENudgeUp: buttonLayout = AknLayoutScalable_Avkon::scroll_sc2_up_pane( 1 ); indicator = KAknsIIDQgnGrafScrollArrowUp; scrollpaneLayout = AknLayoutScalable_Avkon::scroll_pane(); break; case CAknScrollButton::ENudgeDown: buttonLayout = AknLayoutScalable_Avkon::scroll_sc2_down_pane( 1 ); indicator = KAknsIIDQgnGrafScrollArrowDown; scrollpaneLayout = AknLayoutScalable_Avkon::scroll_pane(); break; case CAknScrollButton::ENudgeLeft: buttonLayout = AknLayoutScalable_Avkon::scroll_sc2_left_pane(); indicator = KAknsIIDQgnGrafScrollArrowLeft; scrollpaneLayout = AknLayoutScalable_Avkon::scroll_pane(1); break; case CAknScrollButton::ENudgeRight: buttonLayout = AknLayoutScalable_Avkon::scroll_sc2_right_pane(); indicator = KAknsIIDQgnGrafScrollArrowRight; scrollpaneLayout = AknLayoutScalable_Avkon::scroll_pane(1); break; default: return; } TAknLayoutRect scrollpaneLayoutRect, buttonLayoutRect; // Using mainpanerect only for counting the size of button bitmap TRect mainpaneRect; AknLayoutUtils::LayoutMetricsRect( AknLayoutUtils::EMainPane, mainpaneRect ); scrollpaneLayoutRect.LayoutRect( mainpaneRect, scrollpaneLayout.LayoutLine() ); buttonLayoutRect.LayoutRect( scrollpaneLayoutRect.Rect(), buttonLayout.LayoutLine() ); // trapping possible leave in this phase when there's no bitmaps in other skins TRAP( err, iIcon = AknsUtils::CreateGulIconL( AknsUtils::SkinInstance(), indicator, EFalse ) ); if( err == KErrNone ) { AknIconUtils::SetSize( iIcon->Bitmap(), buttonLayoutRect.Rect().Size() ); AknIconUtils::SetSize( iIcon->Mask(), buttonLayoutRect.Rect().Size() ); } } else { TInt indicator; TSize indiSize; // screen TRect screenRect = iAvkonAppUi->ApplicationRect(); //TAknWindowLineLayout screenLayout = AknLayout::screen(); //TRect screenRect = screenLayout.Rect(); // app window TAknWindowLineLayout applicationWindowLayout = AknLayout::application_window(screenRect); TAknLayoutRect applicationWindowLayoutRect; applicationWindowLayoutRect.LayoutRect(screenRect, applicationWindowLayout); TRect applicationWindowRect = applicationWindowLayoutRect.Rect(); // control pane TAknWindowLineLayout controlPaneLayout = AknLayout::control_pane(applicationWindowRect); TAknLayoutRect controlPaneLayoutRect; controlPaneLayoutRect.LayoutRect(applicationWindowRect, controlPaneLayout); TRect controlPaneRect = controlPaneLayoutRect.Rect(); if (iType == CAknScrollButton::ENudgeUp) { // scroll up TAknWindowLineLayout scrollLayout = AknLayout::Control_pane_elements_Line_1(); TAknLayoutRect scrollLayoutRect; scrollLayoutRect.LayoutRect(controlPaneRect, scrollLayout); TRect scrollRect = scrollLayoutRect.Rect(); indicator=EMbmAvkonQgn_indi_scroll_a; indiSize = scrollRect.Size(); } else { // scroll down TAknWindowLineLayout scrollLayout = AknLayout::Control_pane_elements_Line_2(); TAknLayoutRect scrollLayoutRect; scrollLayoutRect.LayoutRect(controlPaneRect, scrollLayout); TRect scrollRect = scrollLayoutRect.Rect(); indicator=EMbmAvkonQgn_indi_scroll_b; indiSize = scrollRect.Size(); } // iBitmap = new (ELeave) CFbsBitmap(); // User::LeaveIfError(iBitmap->Load(KAvkonBitmapFile, // indicator,ETrue)); // iBitmap = AknIconUtils::CreateIconL(KAvkonBitmapFile, indicator); iBitmap = new (ELeave) CEikImage(); CFbsBitmap* mask = NULL; CFbsBitmap* bitmap = NULL; // Use bitmap id for both mask and bitmap because of 1-bit icons. AknIconUtils::CreateIconL( bitmap, mask, KAvkonBitmapFile, indicator, indicator ); AknIconUtils::SetSize(bitmap,indiSize); // Also note that in the drawing time mask is used as bitmap. We store the bitmap // only because AknIconUtils requires to do so. iBitmap->SetBitmap(bitmap); iBitmap->SetMask(mask); iColorBitmap = new (ELeave) CFbsBitmap(); User::LeaveIfError( iColorBitmap->Create( bitmap->SizeInPixels(), iEikonEnv->ScreenDevice()->DisplayMode() ) ); iColorBmpDev = CFbsBitmapDevice::NewL( iColorBitmap ); // User::LeaveIfError( iColorBmpDev->Resize( bitmap->SizeInPixels())); iColorBmpGc = CFbsBitGc::NewL(); iColorBmpGc->Activate( iColorBmpDev ); iMaskBitmap = new (ELeave) CFbsBitmap(); //8-bit bitmap User::LeaveIfError( iMaskBitmap->Create( bitmap->SizeInPixels(), EGray256 )); iMaskBmpDev = CFbsBitmapDevice::NewL( iMaskBitmap ); // User::LeaveIfError( iMaskBmpDev->Resize( bitmap->SizeInPixels())); iMaskBmpGc = CFbsBitGc::NewL(); iMaskBmpGc->Activate( iMaskBmpDev ); } }
EXPORT_C void CSettingsListBoxItemDrawer::DrawItemText( TInt aItemIndex, const TRect& aItemTextRect, TBool aItemIsCurrent, TBool /*aViewIsEmphasized*/, TBool /*aItemIsSelected*/) const { _AKNTRACE_FUNC_ENTER; _AKNTRACE("DrawItemText: aItemIndex=%d, aItemTextRect=(%d,%d,%d,%d), aItemIsCurrent=%d", aItemIndex, aItemTextRect.iTl.iX, aItemTextRect.iTl.iY, aItemTextRect.iBr.iX, aItemTextRect.iBr.iY, aItemIsCurrent); #ifdef RD_UI_TRANSITION_EFFECTS_LIST MAknListBoxTfxInternal* transApi = CAknListLoader::TfxApiInternal( iGc ); if ( transApi ) { transApi->StartDrawing( MAknListBoxTfxInternal::EListNotSpecified ); } #endif //RD_UI_TRANSITION_EFFECTS_LIST iGc->SetBrushColor( AKN_LAF_COLOR( 0 ) ); #ifdef RD_UI_TRANSITION_EFFECTS_LIST if ( transApi ) { transApi->StopDrawing(); } #endif //RD_UI_TRANSITION_EFFECTS_LIST DrawBackgroundAndSeparatorLines( aItemTextRect ); if ( aItemIsCurrent ) { FormattedCellData()->SetCurrentItemIndex( aItemIndex ); } FormattedCellData()->SetCurrentlyDrawnItemIndex( aItemIndex ); FormattedCellData()->DrawSettingHighlight( *iGc, aItemTextRect, aItemIsCurrent ); TBool drawBackground = ETrue; TPtrC temp = iModel->ItemText( aItemIndex ); TPtrC columnText; TextUtils::ColumnText( columnText, 3, &temp ); if ( columnText == KNullDesC ) { drawBackground = EFalse; } #ifdef RD_UI_TRANSITION_EFFECTS_LIST if ( transApi ) { transApi->StartDrawing( MAknListBoxTfxInternal::EListItem ); iGc->SetClippingRect( iViewRect ); } #endif // RD_UI_TRANSITION_EFFECTS_LIST // draw setting item's background if ( drawBackground ) { TAknLayoutRect outerRect; TAknWindowComponentLayout valuePane; #ifdef RD_LIST_STRETCH if ( Layout_Meta_Data::IsLandscapeOrientation() && Layout_Meta_Data::IsListStretchingEnabled() && FormattedCellData()->StretchingEnabled() ) { valuePane = AknLayoutScalable_Avkon::set_value_pane_cp_vc( 0 ); } else #endif // RD_LIST_STRETCH { valuePane = AknLayoutScalable_Avkon::set_value_pane_cp( 0 ); } outerRect.LayoutRect( aItemTextRect, TAknWindowComponentLayout::Compose( valuePane, AknLayoutScalable_Avkon::bg_set_opt_pane( 0 ) ).LayoutLine() ); TBool frameDrawn = EFalse; MAknsControlContext *cc = AknsDrawUtils::ControlContext( FormattedCellData()->Control() ); if ( !cc ) { cc = FormattedCellData()->SkinBackgroundContext(); } if ( cc ) { TAknLayoutRect innerRect; innerRect.LayoutRect( aItemTextRect, TAknWindowComponentLayout::Compose( valuePane, AknLayoutScalable_Avkon::bg_set_opt_pane_g1() ).LayoutLine() ); frameDrawn = AknsDrawUtils::DrawFrame( AknsUtils::SkinInstance(), *iGc, outerRect.Rect(), innerRect.Rect(), KAknsIIDQsnFrSetOptFoc, KAknsIIDQsnFrSetOptFocCenter ); } if ( !frameDrawn ) { iGc->SetBrushColor( AKN_LAF_COLOR( 243 ) ); iGc->Clear( outerRect.Rect() ); } } SetupGc( aItemIndex ); CFormattedCellListBoxData::TColors colors; TBufC<KMaxTotalDataLength> target; // Try to allocate buffer dynamically. If out of memory, use the fixed size stack buffer. // This size should be sufficient. TInt size = temp.Length() * 2; HBufC* buffer = NULL; if ( size > KMaxTotalDataLength ) { buffer = HBufC::New( size ); } TPtr des = ( buffer ? buffer->Des() : target.Des() ); TDesC* targetptr = &temp; if ( columnText == KNullDesC ) { #ifdef RD_LIST_STRETCH // If list stretching is used and the device is in landscape orientation // there is only one text cell available. Therefore, word wrapping // cannot be done. Instead the first text cell must be omitted and the // possible text moved to the second cell. If both text cells contain // data they are combined and the data is moved to the second cell (i.e. // the first cell is never drawn in landscape if list stretching is // turned on). if ( Layout_Meta_Data::IsLandscapeOrientation() && Layout_Meta_Data::IsListStretchingEnabled() && FormattedCellData()->StretchingEnabled() ) { TBool swapCells = ETrue; TPtrC itemText; // check if cell swapping should be done at all for ( TInt i = 2; i <= 4; ++i ) { if ( TextUtils::ColumnText( itemText, i, targetptr ) == KErrNotFound ) { break; } if ( itemText != KNullDesC ) { swapCells = EFalse; break; } } TextUtils::ColumnText( itemText, 1, targetptr ); if ( swapCells && itemText.Length() > 0 ) { TPtrC secondaryText; TextUtils::ColumnText( secondaryText, 5, targetptr ); // remove text from the first text cell AknLAFUtils::ReplaceColumn( des, targetptr, (TDesC16*)&KNullDesC, KColumnListSeparator, 1 ); // ReplaceColumn does not update descriptor's length :( des.Set( buffer ? buffer->Des() : target.Des() ); TInt secondaryPos = 0; TPtrC temp; temp.Set( des ); // add separators if needed for ( TInt i = 0; i < 5; ++i ) { TInt position = temp.Locate( KColumnListSeparator ); if ( position != KErrNotFound ) { if ( position < temp.Length() ) { ++position; } secondaryPos += position; } else { des.Append( KColumnListSeparator ); secondaryPos = des.Length(); } temp.Set( des.Mid( secondaryPos ) ); } des.Insert( secondaryPos, itemText ); if ( secondaryText != KNullDesC ) { _LIT( KEmptySpace, " " ); des.Insert( secondaryPos + itemText.Length(), KEmptySpace ); } targetptr = &des; } } else { WordWrapListItem( des, *targetptr, 1, 5, aItemIndex ); // Set again because ReplaceColumn in WordWrapListItem does not update the length to 'des' ! des.Set( buffer ? buffer->Des() : target.Des() ); targetptr = &des; } #else WordWrapListItem( des, temp, 1, 5, aItemIndex ); // Set again because ReplaceColumn in WordWrapListItem does not update the length to 'des' ! des.Set( buffer ? buffer->Des() : target.Des() ); targetptr = &des; #endif // RD_LIST_STRETCH } #ifdef RD_UI_TRANSITION_EFFECTS_LIST if ( transApi ) { iGc->CancelClippingRect(); transApi->StopDrawing(); } #endif // RD_UI_TRANSITION_EFFECTS_LIST if (FormattedCellData()->IsMarqueeOn() && FormattedCellData()->CurrentMarqueeItemIndex() != aItemIndex && aItemIsCurrent) { FormattedCellData()->ResetMarquee(); FormattedCellData()->SetCurrentMarqueeItemIndex(aItemIndex); } SettingsData()->Draw( Properties( aItemIndex ), *iGc, targetptr, aItemTextRect, aItemIsCurrent, colors ); delete buffer; _AKNTRACE_FUNC_EXIT; }
void CAknNoteAttributes::SetAnimationBackGroundFrameL() { // R_QGN_GRAF_WAIT_BAR_ANIM case is OK without background frame. if (iAnimation && iAnimationID != R_QGN_GRAF_WAIT_BAR_ANIM) { // Not set background frame, if there is only one frame in animation. CBitmapAnimClientData *animClientData = iAnimation->BitmapAnimData(); if (animClientData != NULL && animClientData->FrameArray().Count() <= 1) { return; } const TDisplayMode displayMode( CCoeEnv::Static()->ScreenDevice()->DisplayMode() ); // Create skinned background frame CFbsBitmap* bitmap = new(ELeave) CFbsBitmap; CleanupStack::PushL(bitmap); User::LeaveIfError( bitmap->Create( iAnimation->Rect().Size(), displayMode ) ); CFbsBitmapDevice* doubleBufferDev = CFbsBitmapDevice::NewL( bitmap ); CleanupStack::PushL(doubleBufferDev); CFbsBitGc* doubleBufferGc = 0; User::LeaveIfError( doubleBufferDev->CreateContext( doubleBufferGc ) ); CleanupStack::PushL(doubleBufferGc); MAknsSkinInstance* skin = AknsUtils::SkinInstance(); MAknsControlContext* cc = iBgContext; AknsDrawUtils::DrawBackground( skin, cc, iNoteControl, *doubleBufferGc, TPoint(0,0), iAnimation->Rect(), KAknsDrawParamDefault ); #if 0 // waitbar background border if ( iAnimationID == R_QGN_GRAF_WAIT_BAR_ANIM ) { CFbsBitmap* frameL = NULL; CFbsBitmap* frameCenter = NULL; CFbsBitmap* frameR = NULL; CFbsBitmap* lMask = NULL; CFbsBitmap* centerMask = NULL; CFbsBitmap* rMask = NULL; AknIconUtils::CreateIconLC( frameL, lMask, KAvkonBitmapFile, EMbmAvkonQgn_graf_bar_frame_side_l, EMbmAvkonQgn_graf_bar_frame_side_l_mask ); AknIconUtils::CreateIconLC( frameCenter, centerMask, KAvkonBitmapFile, EMbmAvkonQgn_graf_bar_frame_center, EMbmAvkonQgn_graf_bar_frame_center_mask); AknIconUtils::CreateIconLC( frameR, rMask, KAvkonBitmapFile, EMbmAvkonQgn_graf_bar_frame_side_r, EMbmAvkonQgn_graf_bar_frame_side_r_mask ); TAknLayoutRect frameGraphicLayout; frameGraphicLayout.LayoutRect( iAnimation->Rect(), AknLayoutScalable_Avkon::wait_border_pane_g1() ); User::LeaveIfError( AknIconUtils::SetSize( frameL, frameGraphicLayout.Rect().Size(), EAspectRatioNotPreserved ) ); frameGraphicLayout.LayoutRect( iAnimation->Rect(), AknLayoutScalable_Avkon::wait_border_pane_g2() ); User::LeaveIfError( AknIconUtils::SetSize( frameCenter, frameGraphicLayout.Rect().Size(), EAspectRatioNotPreserved ) ); frameGraphicLayout.LayoutRect( iAnimation->Rect(), AknLayoutScalable_Avkon::wait_border_pane_g3() ); User::LeaveIfError( AknIconUtils::SetSize( frameR, frameGraphicLayout.Rect().Size(), EAspectRatioNotPreserved ) ); TPoint centerPoint( frameL->SizeInPixels().iWidth, 0 ); TPoint rightPoint( centerPoint.iX + frameCenter->SizeInPixels().iWidth, 0 ); doubleBufferGc->BitBltMasked( TPoint( 0, 0), frameL, TRect( TPoint( 0, 0 ), frameL->SizeInPixels() ), lMask, EFalse ); doubleBufferGc->BitBltMasked( centerPoint, frameCenter, TRect( frameCenter->SizeInPixels() ), centerMask, EFalse ); doubleBufferGc->BitBltMasked( rightPoint, frameR, TRect( frameR->SizeInPixels() ), rMask, EFalse ); CleanupStack::PopAndDestroy( 6 ); if ( iAnimation->BitmapAnimData()->PlayMode() == CBitmapAnimClientData::EPlay ) iAnimation->BitmapAnimData()->SetPlayMode(CBitmapAnimClientData::ECycle); } #endif CleanupStack::PopAndDestroy(2); // doubleBufferGc, doubleBufferDev // finally set background frame CBitmapFrameData* data = CBitmapFrameData::NewL(); data->SetBitmapsOwnedExternally( EFalse ); data->SetBitmap( bitmap ); // Set frame to animation iAnimation->BitmapAnimData()->SetBackgroundFrame( data ); // gets ownership CleanupStack::Pop(bitmap); // bitmap } }
void CAknInputFrame::SizeChanged() { // There are 5 different layouts to be handled by this component: // -------------------------------------------------------------- // Standard ( fixed find pane in column lists ) // PopupLayout ( popup find pane in any mainpane list ) // PinbLayout ( used by pinboard app ) // ClockAppLayout ( has been removed from laf - fall back to standard ) // PopupWindowLayout ( used by list query and popuplist ) _AKNTRACE_FUNC_ENTER; TRect parent( Rect() ); // parent for components TRect editorParent( Rect() ); // parent for the editor TRect rect( Rect() ); // rect of the whole shebang TAknLayoutRect r; // common temporary layout rect TAknWindowComponentLayout outline(0); TAknWindowLineLayout iconPos(0); TAknTextComponentLayout editor(0); TBool apac( AknLayoutUtils::Variant() == EApacVariant && ( iFlags & EShowIndicators ) ); if ( iFlags & EPopupLayout ) // popup find box { _AKNTRACE( "[%s][%s] PopupLayout", "CAknInputFrame", __FUNCTION__ ); r.LayoutRect( parent, AknLayoutScalable_Avkon::find_popup_pane() ); parent = r.Rect(); r.LayoutRect( r.Rect(), AknLayoutScalable_Avkon::input_popup_find_pane_cp() ); editorParent = r.Rect(); outline = AknLayoutScalable_Avkon::input_popup_find_pane_cp(); iconPos = AknLayoutScalable_Avkon::find_popup_pane_g1().LayoutLine(); editor = AknLayoutScalable_Avkon::input_popup_find_pane_t1( apac ? 2 : 0 ); if ( iPopupFindCC ) { r.LayoutRect( rect, AknLayoutScalable_Avkon::find_popup_pane() ); iPopupFindCC->SetFrameRects( rect, r.Rect() ); } } else if ( iFlags & EPinbLayout ) // used by pinboard app { _AKNTRACE( "[%s][%s] PinbLayout", "CAknInputFrame", __FUNCTION__ ); outline = AknLayoutScalable_Apps::input_focus_pane_cp01(0); iconPos = AknLayoutScalable_Apps::find_pinb_pane_g1(0); editor = AknLayoutScalable_Apps::find_pinb_pane_t2( apac ? 1 : 0 ); } else if ( iFlags & EPopupWindowLayout ) // list query or popup list { _AKNTRACE( "[%s][%s] PopupWindowLayout", "CAknInputFrame", __FUNCTION__ ); outline = AknLayoutScalable_Avkon::input_popup_find_pane_cp(); iconPos = AknLayoutScalable_Avkon::find_popup_pane_g1(); TAknTextComponentLayout textComponentLayout( TAknWindowComponentLayout::ComposeText( outline, AknLayoutScalable_Avkon::input_popup_find_pane_t1( apac ? 2 : 0 ) ) ); editor = textComponentLayout; if ( iPopupListCC ) { iPopupListCC->SetRect( rect ); } } else // standard find pane { _AKNTRACE( "[%s][%s] Standard Layout", "CAknInputFrame", __FUNCTION__ ); outline = AknLayoutScalable_Avkon::input_find_pane(); iconPos = AknLayoutScalable_Avkon::find_pane_g1(); editor = AknLayoutScalable_Avkon::input_find_pane_t2( apac ? 1: 0 ); r.LayoutRect( rect, AknLayoutScalable_Avkon::input_find_pane() ); editorParent = r.Rect(); } // --- set size and position of the frame around editor --- r.LayoutRect( parent, outline ); iOutlineRect = r.Rect(); _AKNTRACE( "[%s][%s] iOutlineRect: %s:%d,%d %s:%d,%d", "CAknInputFrame", __FUNCTION__, "LT", iOutlineRect.iTl.iX, iOutlineRect.iTl.iY, "BR", iOutlineRect.iBr.iX, iOutlineRect.iBr.iY ); if ( !iInputContext ) { // we need to provide own context if one does not exist // because old style drawing did kind of work even // without calling SetInputContext( ... ) iInputContext = CAknsFrameBackgroundControlContext::NewL( KAknsIIDQsnFrInput, TRect(0,0,0,0), TRect(0,0,0,0), EFalse ); iFlags = iFlags | EOwnsInputContext; // also need to provide skin for the editor in this case static_cast<CEikEdwin*>( iField )->SetSkinBackgroundControlContextL( iInputContext ); } if ( iInputContext ) { // this layout is actually from form! // there exists no layout for find box :-/ but this should do // no help from adaptation layer either r.LayoutRect( iOutlineRect, AknLayoutScalable_Avkon::input_focus_pane_g1() ); iInputContext->SetFrameRects( iOutlineRect, r.Rect() ); // and chain transparent contexts properly MAknsControlContext* bg = iPopupFindCC ? iPopupFindCC : iPopupListCC; if( !bg ) { bg = AknsDrawUtils::ControlContext( this ); } iInputContext->SetParentContext( bg ); } // --- set magnifying glass icon size & position --- iMagnIconPos.LayoutRect( parent, iconPos); CFbsBitmap* iconBitmap = iIcon->Bitmap(); if ( iconBitmap ) { AknIconUtils::SetSize( iconBitmap, iMagnIconPos.Rect().Size() ); } // --- layout the editor --- AknLayoutUtils::LayoutEdwin( static_cast<CEikEdwin*>( iField ), editorParent, editor.LayoutLine(), EAknsCIQsnTextColorsCG25, 0, ETrue ); AknsUtils::RegisterControlPosition( iField ); // prevent flicker _AKNTRACE_FUNC_EXIT; }
/** * Places the dialog items according to the current visible window position. * When hiding items, uses SetExtent() instead of just SetPosition() in order to call * SizeChanged() of the moved item. For example, this is needed for the editor to * change its cursor accordingly. * * @param aRect Rectangle of the form window * @param aTop Number of items above the window * @param aMiddle Number of items inside the window * @param aBottom Number of items below the window * * Parameter value equal to -1 means that the parameter is not defined and will be * calculated automatically. Normally, either the top number or the bottom one * is only defined. If @a aTop is defined, the items will be placed from top downwards, leaving * @a aTop items above the window. If @a aBottom is defined, the items will be placed from bottom * upwards, leaving @a aBottom items below the window. * * This function panics, if neither @a aTop nor @a aBottom are defined. * * The function first checks if the provided @a aTop and @a aBottom are consistent with * the item sizes and the given window rectangle. If they are not, they will be * corrected. Usually, @a aTop and @a aBottom come out of sync with the item sizes * after the dynamic layout change. */ void CEikCapCArray::SetRect(const TRect& aRect, TInt aTop, TInt /*aMiddle*/, TInt aBottom) { TAknLayoutRect formtLayoutRect; formtLayoutRect.LayoutRect(aRect, AknLayoutScalable_Avkon::listscroll_form_pane().LayoutLine()); formtLayoutRect.LayoutRect(formtLayoutRect.Rect(), AknLayoutScalable_Avkon::list_form_gen_pane().LayoutLine()); TRect formRect = formtLayoutRect.Rect(); CEikCapCArrayExtension *extension_or_null = ExtensionOrNull(); if (extension_or_null) { extension_or_null->iRect = formRect; } // controls need to be placed in real locations if physics is enabled if ( Count() > 0 ) { CEikCaptionedControl* control = (*this)[0]; if ( control->DialogPage()->IsForm() ) { SetRealRect( aRect, aTop, aBottom ); return; } } TBool topDefined = EFalse; // top or bottom number defined? if( aTop > -1 ) { topDefined = ETrue; } else if( aBottom > -1 ) { topDefined = EFalse; } else // aBottom == aTop == -1 { User::Panic( _L("CEikCapCArray::SetRect(): Neither top nor bottom items number defined"), EAknPanicInvalidValue ); } const TInt count = Count(); const TInt rectHeight = aRect.Height(); /** * Special invisible points are used for placing the items that are * outside the window. CCoeControl's invisible flag cannot be used, * as it is controlled by third-party applications. */ const TPoint topInvisPoint( -10000, -10000 ); const TPoint bottomInvisPoint( 10000, 10000 ); CEikCaptionedControl *firstCapCC = count > 0 ? (*this)[0] : NULL; if( firstCapCC && firstCapCC->iIsFormControl ) // Forms { CEikCaptionedControl *selectedLine( NULL ); if( firstCapCC->DialogPage()) selectedLine = firstCapCC->DialogPage()->CurrentLine(); // Check height of items and the input parameters aTop and aBottom. TInt rest = 0; // number of the rest items without aTop or aBottom TInt index = 0; if( topDefined ) { rest = count - aTop; index = aTop; } else { rest = count - aBottom; index = rest - 1; } TInt height = 0; for( TInt ii = 0; ii < rest; ii++ ) { CEikCaptionedControl* line = (*this)[index]; height += line->MinimumSize().iHeight; // Use MinimumSize() here as a protection from dynamic layout change if( height >= rectHeight ) break; // Input params are OK topDefined? index++ : index--; } /** * If the window contains too few items inside and there are still items outside, * correct the input parameters @a aTop and @a aBottom to fill up the window. */ if( height < rectHeight ) { if( topDefined && aTop > 0 ) // For top-down placement and there are items above the window { // Calculate height of controls above the window also for( TInt ii = 0; ii < aTop; ii++ ) { CEikCaptionedControl* line = (*this)[ii]; height += line->MinimumSize().iHeight; if( height >= rectHeight ) // All items don't fit to the window anyway { topDefined = EFalse; // Reverse direction to bottom-up aBottom = 0; break; } } if( height < rectHeight ) // All items fit to the window { aTop = 0; // Just place them from the first item } } else if( !topDefined ) // For bottom-up placement { topDefined = ETrue; // Reverse direction to top-down aTop = 0; } } // Hiding items that are explicitly defined to be outside the window TInt start; TInt end; TPoint invisPoint; // current invisible point, depends on placement direction if( topDefined ) { start = 0; end = aTop; invisPoint = topInvisPoint; } else { start = count - aBottom; end = count; invisPoint = bottomInvisPoint; } for( TInt ii = start; ii < end; ii++ ) { CEikCaptionedControl* line = (*this)[ii]; line->SetPosition( invisPoint ); } // Setting rects for the rest of the items if( topDefined ) { rest = count - aTop; invisPoint = bottomInvisPoint; index = aTop; } else { rest = count - aBottom; invisPoint = topInvisPoint; index = rest - 1; } TInt reservedHeight = 0; // in pixels TBool insideWindow = ETrue; // The current item is still inside the window TInt topY = 0; for( TInt ii = 0; ii < rest; ii++ ) { CEikCaptionedControl* line = (*this)[index]; TSize lineSize( line->Size() ); if( insideWindow ) { ResetHides( line ); if( topDefined ) { // Top-down placement topY = aRect.iTl.iY + reservedHeight; } else { // Bottom-up placement topY = aRect.iBr.iY - reservedHeight - lineSize.iHeight; } line->SetExtent( TPoint( formRect.iTl.iX, topY ), lineSize ); AknsUtils::RegisterControlPosition( line ); AknsUtils::RegisterControlPosition( line->iCaption ); AknsUtils::RegisterControlPosition( line->iControl ); AknsUtils::RegisterControlPosition( line->iTrailer ); AknsUtils::RegisterControlPosition( line->iBitmap ); reservedHeight += lineSize.iHeight; /** * The control at a window edge is considered as partially-visible. * Its subcontrols must be checked for visibility individually. */ if( reservedHeight > rectHeight ) { TInt visibleSubctrls = HideLines( line, aRect ); // Check how many subcontrols stayed visible insideWindow = EFalse; /** * For the bottom-up placement: * if the window contains only an empty "partially-visible" control and a * a selected popup field, make the popup to hang at the top alone. */ if( !topDefined && index < count - 1 ) // bottom-up and not last { CEikCaptionedControl* lineBelow = (*this)[index+1]; if( visibleSubctrls == 0 && ii == 1 && IsPopupField( lineBelow ) && lineBelow == selectedLine ) { TRect popupRect( lineBelow->Rect() ); TInt diff = aRect.iTl.iY - popupRect.iTl.iY; // negative popupRect.Move( 0, diff ); lineBelow->SetRect( popupRect ); } } } } else { line->SetPosition( invisPoint ); } topDefined? index++ : index--; } } else // Dialogs other than forms: { TRect rect=aRect; const TInt fullWidth=rect.iBr.iX-rect.iTl.iX; const TInt count=Count(); const TInt topMargin=iDensePacking ? KAknNoTopMargin : KAknTopMargin; const TInt verticalSpacing=iDensePacking ? KVerticalSpacingSquash : KVerticalSpacing; rect.iTl.iY+=topMargin; TInt deltaHeight=0; for (TInt ii=0; ii<count; ++ii) { CEikCaptionedControl* line=(*this)[ii]; TSize thisSize=line->MinimumSize(); TInt thisDeltaHeight=thisSize.iHeight+verticalSpacing; if (deltaHeight<thisDeltaHeight) deltaHeight=thisDeltaHeight; if (!(line->iCaptionWidth)) thisSize.iWidth=fullWidth; else { CEikCapCArrayExtension *ext = ExtensionOrNull(); TInt deltaWidth = 0; if (ext) deltaWidth = ext->iCaptionWidth-line->iCaptionWidth; thisSize.iWidth+=deltaWidth; if (ext) line->iCaptionWidth=ext->iCaptionWidth; else line->iCaptionWidth = 0; line->iMinSize.iWidth+=deltaWidth; } line->iFullWidth=fullWidth; line->SetExtent(rect.iTl,thisSize); if (!(line->LatentGroupLineFollows())) { rect.iTl.iY+=deltaHeight; deltaHeight=0; } } } }
EXPORT_C void AknPopupLayouts::HandleSizeChanged( TAknPopupWindowLayoutDef &aDef, TAknPopupLayouts aLayout_1, TAknPopupLayoutsNode *aNode) { CAknPopupHeadingPane *aHeading = (CAknPopupHeadingPane*)FindControl(aNode, EHeadingNode); CEikListBox *aListBox = (CEikListBox*)FindControl(aNode, EListNode); CCoeControl *aWindowOwningControl = FindControl(aNode, EWindowOwningNode); CAknMessageQueryControl *aMsgQueryCtrl = (CAknMessageQueryControl*)FindControl(aNode, EMessageBoxNode); TInt aLayout = aLayout_1; TInt numofitems = aListBox->Model()->NumberOfItems(); aListBox->View()->ItemDrawer()->SetSkinEnabledL(ETrue); TInt maxListHeight = GetMaxListHeight(); // position popup window's bottom correctly TRect clientRect; AknLayoutUtils::LayoutMetricsRect(AknLayoutUtils::EPopupParent, clientRect); // set windowrect to minimum size - this will be adjusted later TAknLayoutRect windowRect; windowRect.LayoutRect( clientRect, AknLayoutScalable_Avkon::popup_menu_window(8)); aDef.iWindowRect = windowRect.Rect(); TRAP_IGNORE( aListBox->View()->ItemDrawer()->SetSkinEnabledL(ETrue) ); // Popup window when the size does not change based on // the number of items. TBool fixedWindowSize = EFalse; if ( (aLayout & EAknPopupLayoutsDynamic) || numofitems == 0 || (aLayout & EAknPopupLayoutsFind) ) { aLayout &= ~EAknPopupLayoutsDynamic; fixedWindowSize = ETrue; } // heading ============================================================= TInt spaceForHeading = 0; if (aHeading) { aHeading->SetLayout( CAknPopupHeadingPane::EListHeadingPane ); TAknLayoutRect tempHeadingRect; tempHeadingRect.LayoutRect(clientRect, AknLayoutScalable_Avkon::heading_pane(0)); spaceForHeading = tempHeadingRect.Rect().Height(); maxListHeight -= spaceForHeading; } aDef.iPopupMenuWindowOffset=TPoint(0,spaceForHeading); // findbox ============================================================= TBool windowSizeFind = EFalse; TInt spaceForFind = 0; if (aLayout & EAknPopupLayoutsFind) { aLayout &= ~EAknPopupLayoutsFind; windowSizeFind = ETrue; // calculate space needed for find TAknLayoutRect tempFindRect; tempFindRect.LayoutRect(clientRect,AknLayoutScalable_Avkon::find_popup_pane_cp2(0)); spaceForFind = tempFindRect.Rect().Height(); maxListHeight -= spaceForFind; } // messagebox ========================================================== TRect messageRect; TInt messageNumOfLines = 0; TBool messageBox = EFalse; if (aMsgQueryCtrl && aMsgQueryCtrl->Lines() > 0) { messageBox = ETrue; messageNumOfLines = aMsgQueryCtrl->Lines(); TInt varietyIndex = 0; switch(messageNumOfLines) { case (0): case (1): varietyIndex = 0; break; case (2): varietyIndex = 1; break; default : varietyIndex = 2; } TAknWindowLineLayout lay = AknLayoutScalable_Apps::loc_type_pane(varietyIndex).LayoutLine(); TAknLayoutRect layout; layout.LayoutRect( TRect(0,0,0,0), lay ); messageRect = layout.Rect(); maxListHeight -= messageRect.Height(); } TInt minItems = 1; TRect scrollBarRect(0,0,0,0); TAknWindowLineLayout listLayout; TAknLayoutScalableParameterLimits listLimits; switch(aLayout) { case EPopupSNotePopupWindow: case EMenuUnknownColumnWindow: case EMenuUnknownFormattedCellWindow: case EMenuWindow: { minItems = aHeading ? 5 : 6; listLayout = AknLayoutScalable_Avkon::list_single_pane_cp2(0); listLimits = AknLayoutScalable_Avkon::list_single_pane_cp2_ParamLimits(); break; } case EMenuGraphicWindow: { minItems = 5; listLayout = AknLayoutScalable_Avkon::list_single_graphic_pane_cp2(0); listLimits = AknLayoutScalable_Avkon::list_single_graphic_pane_cp2_ParamLimits(); break; } case EMenuGraphicHeadingWindow: { minItems = 5; listLayout = AknLayoutScalable_Avkon::list_single_graphic_heading_pane_cp2(0); listLimits = AknLayoutScalable_Avkon::list_single_graphic_heading_pane_cp2_ParamLimits(); break; } case EMenuDoubleWindow: { minItems = 3; listLayout = AknLayoutScalable_Avkon::list_double_pane_cp2(0); listLimits = AknLayoutScalable_Avkon::list_double_pane_cp2_ParamLimits(); break; } case EMenuDoubleLargeGraphicWindow: { minItems = 3; listLayout = AknLayoutScalable_Avkon::list_double_large_graphic_pane_cp2(0); listLimits = AknLayoutScalable_Avkon::list_double_large_graphic_pane_cp2_ParamLimits(); break; } } if (!fixedWindowSize) { minItems = 1; } TInt maxLayoutItems = listLimits.LastRow() + 1; // last row is a zero based index, we need num items which is 1 based //aDef.iVertLineExt1.LayoutRect(TRect(1,1,1,1), 0, 0,0, ELayoutEmpty, ELayoutEmpty, 0,0); //aDef.iVertLineExt2.LayoutRect(TRect(1,1,1,1), 0, 0,0, ELayoutEmpty, ELayoutEmpty, 0,0); TAknLayoutRect listItemRect; listItemRect.LayoutRect( aDef.iWindowRect, listLayout); TInt listItemHeight = listItemRect.Rect().Height(); TInt maxItems = maxListHeight / listItemHeight; // minItems == 1 only if the popuplist is dynamically changeable if ( (numofitems > 1) && (minItems == 1) ) { minItems = numofitems; } if (minItems > maxItems) { minItems = maxItems; } // maxItems might be greater than max items from layout -> use layout's maximum if (minItems > maxLayoutItems) { minItems = maxLayoutItems; } TRect window_rect = AknPopupLayouts::MenuRect(aDef); TAknLayoutRect temp, layout; TRect screenRect; AknLayoutUtils::LayoutMetricsRect( AknLayoutUtils::EScreen, screenRect ); TAknWindowLineLayout lineLayout = AknLayoutScalable_Avkon::listscroll_menu_pane(0).LayoutLine(); // Layout data of listscroll_menu_pane are changed for CR 417-35260. // The change is just for QHD landscape model. // The CR makes listscroll_menu_pane's ir or il bigger than normal, // so that width of list item is smaller than needs. Then, first cell // of list item can not be drawn on proper position. // Adjustment of layout is a solution for this problem. This is not a perfect idea, but // creating a new layout for popuplist is too complex to do that. Adjustment is a must. if(Layout_Meta_Data::IsLandscapeOrientation()) { TInt offset = AknListBoxLayouts::AdjustPopupLayoutData( screenRect ); if (!AknLayoutUtils::LayoutMirrored()) { lineLayout.ir -= offset; } else { lineLayout.il -= offset; } } temp.LayoutRect( window_rect, lineLayout); layout.LayoutRect( temp.Rect(), AknLayoutScalable_Avkon::list_menu_pane(0)); TRect tempListRect = layout.Rect(); // this is list's rect for the whole window // subtract heading, findbox and messagebox from tempListRect tempListRect.iBr.iY -= spaceForFind; tempListRect.iTl.iY += spaceForHeading; tempListRect.iTl.iY += messageRect.Height(); // We really don't want parent relative list layout here because findbox will be overwritten. // Just calculate list height and use that. TRect nullRect(0,0,0,0); listLayout.iH = (TInt16)(minItems * listItemHeight); listLayout.ib = ELayoutEmpty; aDef.iListRect.LayoutRect(tempListRect, listLayout); // we have to scale iWindowRect to list rect - layout is not (yet) correct TInt usedHeight = aDef.iListRect.Rect().Height() + spaceForFind + spaceForHeading + messageRect.Height(); // popupwindow's inside area TInt varietyIndex = Layout_Meta_Data::IsLandscapeOrientation(); TAknLayoutRect insideArea; insideArea.LayoutRect( window_rect, AknLayoutScalable_Avkon::bg_popup_window_pane_g1(varietyIndex) ); if (layout.Rect().Height() < usedHeight) { aDef.iWindowRect.iTl.iY -= (usedHeight - layout.Rect().Height()); } AknLayoutUtils::TAknCbaLocation cbaLocation = AknLayoutUtils::CbaLocation(); // In landscape we have to center (on y-axis) popup window (but not with bottom CBA) if (varietyIndex == 1 && cbaLocation != AknLayoutUtils::EAknCbaLocationBottom) { TRect mainPane; AknLayoutUtils::LayoutMetricsRect( AknLayoutUtils::EPopupParent, mainPane ); TInt diff = (mainPane.Height()-aDef.iWindowRect.Height()) / 2; aDef.iWindowRect.iTl.iY -= diff; aDef.iWindowRect.iBr.iY -= diff; // with right CBA, move window to the right side of the screen if (cbaLocation == AknLayoutUtils::EAknCbaLocationRight) { TInt offset = mainPane.Width()-aDef.iWindowRect.iBr.iX; aDef.iWindowRect.iTl.iX += offset; aDef.iWindowRect.iBr.iX += offset; } //should this be uncommented?? // If we have left CBA, we move window to left side of screen (on x-axis). /*else if (cbaLocation == AknLayoutUtils::EAknCbaLocationLeft) { TInt xOffset = aDef.iWindowRect.iTl.iX; if ( xOffset > 0 ) { aDef.iWindowRect.iTl.iX = 0; aDef.iWindowRect.iBr.iX -= xOffset; } }*/ } TRect screen; AknLayoutUtils::LayoutMetricsRect( AknLayoutUtils::EScreen, screen ); TAknLayoutRect cbaRect; cbaRect.LayoutRect( screen, AknLayoutScalable_Avkon::popup_sk_window( 0 ).LayoutLine() ); if ( AknLayoutUtils::PenEnabled() ) { TSize size( aDef.iWindowRect.Size() ); // add softkey height size.iHeight += cbaRect.Rect().Height(); // Reduce listbox's and popup's height if total height is more than // screen height. if ( size.iHeight > screen.Height() ) { listLayout.iH -= ( size.iHeight - screen.Height() ); aDef.iListRect.LayoutRect( tempListRect, listLayout ); size.iHeight = screen.Height(); } aDef.iWindowRect.SetRect( AknPopupUtils::Position( size, ETrue ), size ); } // now we finally know the window rect: first setup heading if (aHeading) { aDef.iHeadingRect.LayoutRect(AknPopupLayouts::MenuRect(aDef), AknLayoutScalable_Avkon::heading_pane(0)); } MenuPopupWindowGraphics(aDef); aWindowOwningControl->SetRect(WindowRect(aDef)); HandleSizeAndPositionOfComponents(aDef, aListBox, aHeading); layout.LayoutRect(MenuRect(aDef), lineLayout); TRect scrollBarClientRect(layout.Rect()); if ( AknLayoutUtils::PenEnabled() ) { // remove softkey height that was added earlier so that // scroll bar doesn't get behind the softkey scrollBarClientRect.iBr.iY -= cbaRect.Rect().Height(); } if (aHeading) { scrollBarClientRect.iTl.iY += spaceForHeading; } if (windowSizeFind) { scrollBarClientRect.iBr.iY -= spaceForFind; } if (messageBox) { scrollBarClientRect.iTl.iY += messageRect.Height(); } varietyIndex = 0; AknLayoutUtils::LayoutVerticalScrollBar( aListBox->ScrollBarFrame(), scrollBarClientRect, AknLayoutScalable_Avkon::scroll_pane_cp25(varietyIndex).LayoutLine() ) ; if (messageBox) { TAknLayoutRect msgQuery; TInt varietyIndex = 0; switch(messageNumOfLines) { case (0): case (1): varietyIndex = 0; break; case (2): varietyIndex = 1; break; default : varietyIndex = 2; } msgQuery.LayoutRect( AknPopupLayouts::MenuRect(aDef), AknLayoutScalable_Apps::loc_type_pane(varietyIndex).LayoutLine() ); aMsgQueryCtrl->SetRect(msgQuery.Rect()); } window_rect = WindowRect(aDef); MAknsControlContext *cc = AknsDrawUtils::ControlContext( aListBox ); TBool defaultContext = EFalse; if (!cc) { cc = aListBox->View()->ItemDrawer()->SkinBackgroundControlContext(); defaultContext = ETrue; } if (cc) { CAknsBasicBackgroundControlContext *bcc = (CAknsBasicBackgroundControlContext*)cc; TAknLayoutRect popupBgRect; popupBgRect.LayoutRect(window_rect, SkinLayout::Popup_windows_skin_placing__background_slice__Line_1(window_rect)); bcc->SetBitmap(KAknsIIDQsnFrPopupCenter); if (defaultContext) bcc->SetRect(popupBgRect.Rect()); bcc->SetParentPos(aWindowOwningControl->PositionRelativeToScreen()); if (defaultContext) bcc->SetParentPos(TPoint(0,0)); } // handled in CFormattedCellListBoxDataExtension, since listbox does not always cover whole // window rect (listquery/popup list), especially when items are added after construction /* // note, that cleanup is done in ~CFormattedCellListBoxData() // or ( shudder ) in ~CColumnListBoxData() MTouchFeedback* feedback = MTouchFeedback::Instance(); if( feedback ) { feedback->SetFeedbackArea( aListBox, 0, aListBox->Rect(), ETouchFeedbackBasic, ETouchEventStylusDown ); } */ }
EXPORT_C void AknPopupLayouts::HandleDraw(CEikonEnv* /*aEikEnv*/, CWindowGc &aGc, const TAknPopupWindowLayoutDef &aDef, CEikListBox* aListBox, CAknPopupHeadingPane* aHeading) { TRect windowRect = MenuRect(const_cast<TAknPopupWindowLayoutDef&>(aDef)); MAknsSkinInstance *skin = AknsUtils::SkinInstance(); MAknsControlContext *cc = AknsDrawUtils::ControlContext( aListBox ); TBool windowFrameDrawn = EFalse; if (!cc) cc = aListBox->View()->ItemDrawer()->SkinBackgroundControlContext(); TRegionFix<5> dontDrawRegion; TRegionFix<22> drawRegion; if ( aListBox ) { dontDrawRegion.AddRect( aListBox->Rect() ); // If there are scroll bars and they draw their own background, take // them out of clipping region CEikScrollBarFrame* scrollBarFrame = aListBox->ScrollBarFrame(); if (scrollBarFrame) { CEikScrollBar* hBar = scrollBarFrame->GetScrollBarHandle( CEikScrollBar::EHorizontal); CEikScrollBar* vBar = scrollBarFrame->GetScrollBarHandle( CEikScrollBar::EVertical); TBool drawHorizontal = ETrue; TBool drawVertical = ETrue; scrollBarFrame->DrawBackgroundState(drawHorizontal, drawVertical); drawHorizontal = drawHorizontal && hBar && hBar->IsVisible(); drawVertical = drawVertical && vBar && vBar->IsVisible(); if (drawHorizontal) { TRect scrollBarRect(hBar->Rect()); if (hBar->OwnsWindow()) { TPoint windowPos = aDef.iWindowRect.iTl; TPoint scrollBarPos = hBar->PositionRelativeToScreen(); scrollBarRect.Move(scrollBarPos - windowPos); } dontDrawRegion.AddRect(scrollBarRect); } if (drawVertical) { TRect scrollBarRect(vBar->Rect()); if (vBar->OwnsWindow()) { TPoint windowPos = aDef.iWindowRect.iTl; TPoint scrollBarPos = vBar->PositionRelativeToScreen(); scrollBarRect.Move(scrollBarPos - windowPos); } dontDrawRegion.AddRect(scrollBarRect); } } } if ( aHeading ) { dontDrawRegion.AddRect( aHeading->Rect() ); } drawRegion.AddRect( windowRect ); drawRegion.SubRegion( dontDrawRegion ); if (cc) { const TAknsItemID *popupBgId = &KAknsIIDQsnBgPopupBackground; TAknLayoutRect popupBgRect; popupBgRect.LayoutRect(windowRect, SkinLayout::Popup_windows_skin_placing__background_slice__Line_1(windowRect)); AknsDrawUtils::DrawCachedImage(skin, aGc, popupBgRect.Rect(), *popupBgId); const TAknsItemID *sliceId = &KAknsIIDQsnBgSlicePopup; TAknLayoutRect sliceRect; sliceRect.LayoutRect(windowRect, SkinLayout::Popup_windows_skin_placing__background_slice__Line_2()); AknsDrawUtils::DrawCachedImage(skin, aGc, sliceRect.Rect(), *sliceId); TAknLayoutRect topLeft; topLeft.LayoutRect(windowRect, SkinLayout::Popup_windows_skin_placing__frame_general__Line_2()); TAknLayoutRect bottomRight; bottomRight.LayoutRect(windowRect, SkinLayout::Popup_windows_skin_placing__frame_general__Line_5()); TRect outerRect = TRect(topLeft.Rect().iTl, bottomRight.Rect().iBr); TRect innerRect = TRect(topLeft.Rect().iBr, bottomRight.Rect().iTl); aGc.SetPenStyle(CGraphicsContext::ENullPen); const TAknsItemID *frameId = &KAknsIIDQsnFrPopup; const TAknsItemID *frameCenterId = &KAknsIIDQsnFrPopupCenter; aGc.SetClippingRegion( drawRegion ); windowFrameDrawn = AknsDrawUtils::DrawFrame(skin, aGc, outerRect, innerRect, *frameId, *frameCenterId); aGc.CancelClippingRegion(); } if (!windowFrameDrawn) { AknDraw::DrawWindowShadow(aGc, aDef.iCover, aDef.iSecond, aDef.iFirst, aDef.iOutline, aDef.iInside); } }