Rename feature added
[apps/osp/Gallery.git] / src / GlAlbumListEditorForm.cpp
index d089956..d58538d 100644 (file)
@@ -57,13 +57,15 @@ static const int Y_POSITION_SHARE_CONTEXTMENU = 1180;
 static const Color COLOR_FOLDER_BITMAP_DIM(Color::GetColor(COLOR_ID_BLACK));
 static const int ALPHA_FOLDER_BITMAP_DIM = 70;
 
+static const int IDA_ALBUM_EDIT = 503 ;
+
 AlbumListEditorForm::AlbumListEditorForm()
-       : __checkedCount(0)
-       , __pSelectCountLabel(null)
-       , __pEditorFolderIconList(null)
-       , __pShareContextMenu(null)
-       , __pDeletePopup(null)
-       , __pPresentationModel(null)
+: __checkedCount(0)
+, __pSelectCountLabel(null)
+, __pEditorFolderIconList(null)
+, __pShareContextMenu(null)
+, __pDeletePopup(null)
+, __pPresentationModel(null)
 {
        AppLogDebug("ENTER");
        __overlayMsg = false;
@@ -234,7 +236,14 @@ AlbumListEditorForm::CreateItem(int index)
 {
        AppLogDebug("ENTER : index(%d)", index);
        Bitmap* pBitmap = null;
-       IconListViewItem* pIconListview = new IconListViewItem();
+       Canvas* pEditAlbumCanvas = null;
+       Bitmap* pEditAlbumBitmap = null;
+       Bitmap* pBitmapRenameBg = null;
+       Bitmap* pBitmapRename = null;
+       int canvasWidth = 64;
+       int canvasHeight = 64;
+
+       IconListViewItem* pIconListviewItem = new IconListViewItem();
 
        IList* pAlbumInfoList = __pPresentationModel->GetAlbumInfoList();
        AlbumInfo* pAlbumInfo = static_cast<AlbumInfo*>(pAlbumInfoList->GetAt(index));
@@ -261,22 +270,47 @@ AlbumListEditorForm::CreateItem(int index)
                        canvas.FillRectangle(dimColor, canvas.GetBounds());
                        Bitmap* pSelectedBitmap = new (std::nothrow) Bitmap();
                        pSelectedBitmap->Construct(canvas, canvas.GetBounds());
-                       pIconListview->Construct(*pBitmap, null, pSelectedBitmap);
+                       pIconListviewItem->Construct(*pBitmap, null, pSelectedBitmap);
                        delete pSelectedBitmap;
                }
        }
        else
        {
-               pIconListview->Construct(*pBitmap);
+               pIconListviewItem->Construct(*pBitmap);
        }
 
        if (pBitmap != null)
        {
                delete pBitmap;
        }
+
+       pBitmapRenameBg = ResourceManager::GetBitmapN(IDB_ALBUM_EDIT_RENAME_BG);
+       pBitmapRename = ResourceManager::GetBitmapN(IDB_ALBUM_EDIT_RENAME);
+
+       if ( pBitmapRenameBg != null &&  pBitmapRename != null)
+       {
+
+               pEditAlbumCanvas = new (std::nothrow) Canvas();
+               pEditAlbumCanvas->Construct(Rectangle(0,0,canvasWidth,canvasHeight));
+               pEditAlbumCanvas->DrawBitmap(Point(0,0),*pBitmapRenameBg);
+               pEditAlbumCanvas->DrawBitmap(Point(0,0),*pBitmapRename);
+
+
+               pEditAlbumBitmap = new (std::nothrow) Bitmap();
+
+               if ( pEditAlbumBitmap != NULL)
+               {
+                       pEditAlbumBitmap->Construct(*pEditAlbumCanvas,Rectangle(0,0,canvasWidth,canvasHeight));
+                       delete pEditAlbumCanvas;
+               }
+
+               pIconListviewItem->SetOverlayBitmap(IDA_ALBUM_EDIT, pEditAlbumBitmap, ALIGNMENT_RIGHT, ALIGNMENT_TOP);
+       }
+
+
        AppLogDebug("EXIT(%s)", GetErrorMessage(GetLastResult()));
 
-       return pIconListview;
+       return pIconListviewItem;
 }
 
 void
@@ -288,11 +322,11 @@ AlbumListEditorForm::OnIconListViewItemStateChanged(IconListView& view, int inde
        {
                if (status == ICON_LIST_VIEW_ITEM_CHECKED)
                {
-                       --__checkedCount;
+                       ++__checkedCount;
                }
                else if (status == ICON_LIST_VIEW_ITEM_UNCHECKED)
                {
-                       ++__checkedCount;
+                       --__checkedCount;
                }
 
                String tempString;
@@ -325,14 +359,13 @@ AlbumListEditorForm::OnIconListViewOverlayBitmapSelected (IconListView &iconList
        AppLogDebug("ENTER");
        SceneManager* pSceneManager = SceneManager::GetInstance();
 
-       if (overlayBitmapId == ACTION_ID_EDITE_FOLDER)
-       {
-               ArrayList* pSelectedIndex = new (std::nothrow) ArrayList(SingleObjectDeleter);
-               pSelectedIndex->Construct();
-               pSelectedIndex->Add(new (std::nothrow) Integer(index));
+       ArrayList* pSelectedIndex = new (std::nothrow) ArrayList(SingleObjectDeleter);
+       pSelectedIndex->Construct();
+       //Adding the Action Type
+       pSelectedIndex->Add(new (std::nothrow) Integer(ALBUM_RENAME));
+       pSelectedIndex->Add(new (std::nothrow) Integer(index));
 
-               pSceneManager->GoForward(ForwardSceneTransition(IDSCN_ALBUM_NAME_EDITOR), pSelectedIndex);
-       }
+       pSceneManager->GoForward(ForwardSceneTransition(IDSCN_ALBUM_NAME_EDITOR), pSelectedIndex);
        AppLogDebug("EXIT(%s)", GetErrorMessage(GetLastResult()));
 }