static const int W_FOLDER_SIZE = 334;
static const int H_FOLDER_SIZE = 334;
-static const int W_BUTTON_RENAME_SIZE = 64;
-static const int H_BUTTON_RENAME_SIZE = 64;
-
static const int GAP_W_POPUP_ITEM = 5;
static const int W_DELETE_POPUP = 600;
static const int H_DELETE_POPUP = 300;
, __pEditorFolderIconList(null)
, __pShareContextMenu(null)
, __pDeletePopup(null)
- , __pEditFolderBitmap(null)
, __pPresentationModel(null)
{
AppLogDebug("ENTER");
AlbumListEditorForm::OnInitializing(void)
{
AppLogDebug("ENTER");
- result r = E_SUCCESS;
-
- SetRenameButtonImage();
-
__pPresentationModel = AlbumListPresentationModel::GetInstance();
__pPresentationModel->ClearThumbnailRequests();
__pPresentationModel->AddPresentationModelListener(this);
- r = InitializeHeader();
- if (r != E_SUCCESS)
- {
- AppLogDebug("[%s] Unable to InitializeHeader.", GetErrorMessage(r));
- }
-
- r = InitializeFooter();
- if (r != E_SUCCESS)
- {
- AppLogDebug("[%s] Unable to set InitializeFooter.", GetErrorMessage(r));
- }
+ SetFormBackEventListener(this);
+ GetHeader()->AddActionEventListener(*this);
+ GetFooter()->AddActionEventListener(*this);
- r = InitializeControl();
+ result r = InitializeControl();
if (r != E_SUCCESS)
{
AppLogDebug("[%s] Unable to set InitializeControl.", GetErrorMessage(r));
delete __pDeletePopup;
__pDeletePopup = null;
}
-
- if (__pEditFolderBitmap != null)
- {
- delete __pEditFolderBitmap;
- __pEditFolderBitmap = null;
- }
AppLogDebug("EXIT(%s)", GetErrorMessage(GetLastResult()));
return E_SUCCESS;
}
result
-AlbumListEditorForm::SetRenameButtonImage(void)
-{
- AppLogDebug("ENTER");
- Bitmap* pSrcBitmap1 = ResourceManager::GetBitmapN(IDB_BUTTON_CIRCLE_BACKGROUND);
- Bitmap* pSrcBitmap2 = ResourceManager::GetBitmapN(IDB_BUTTON_RENAME);
-
- Bitmap* pBitmap = new (std::nothrow) Bitmap();
- BufferInfo bufferinfo;
- Canvas canvas;
- Dimension size(W_BUTTON_RENAME_SIZE, H_BUTTON_RENAME_SIZE);
- result r = pBitmap->Construct(size, BITMAP_PIXEL_FORMAT_ARGB8888);
- r = pBitmap->Lock(bufferinfo);
- r = canvas.Construct(bufferinfo);
-
- if (pSrcBitmap1 != null)
- {
- canvas.DrawBitmap(Point(0, 0), *pSrcBitmap1);
- delete pSrcBitmap1;
- pSrcBitmap1 = null;
- }
- if (pSrcBitmap2 != null)
- {
- canvas.DrawBitmap(Point(0, 0), *pSrcBitmap2);
- delete pSrcBitmap2;
- pSrcBitmap2 = null;
- }
-
- pBitmap->Unlock();
-
- __pEditFolderBitmap = pBitmap;
- AppLogDebug("EXIT(%s)", GetErrorMessage(GetLastResult()));
-
- return E_SUCCESS;
-}
-
-result
-AlbumListEditorForm::InitializeHeader(void)
-{
- AppLogDebug("ENTER");
- Header* pHeader = GetHeader();
- if (pHeader == null)
- {
- AppLogDebug("EXIT 1");
-
- return E_SYSTEM;
- }
-
- result r = pHeader->SetStyle(HEADER_STYLE_TITLE);
- if (r != E_SUCCESS)
- {
- AppLogDebug("EXIT 2");
-
- return r;
- }
-
- pHeader->SetTitleText(ResourceManager::GetString(L"IDS_COM_BODY_GALLERY"));
- pHeader->AddActionEventListener(*this);
-
- ButtonItem selectAll;
- selectAll.Construct(BUTTON_ITEM_STYLE_ICON, ACTION_ID_ALBUM_LIST_SELECT_ALL);
- Bitmap* pBitmapSelectAll = ResourceManager::GetBitmapN(IDB_ICON_SELECT_ALL);
- Bitmap* pBitmapSelectAllPress = ResourceManager::GetBitmapN(IDB_ICON_SELECT_ALL_PRESS);
- if (pBitmapSelectAll != null)
- {
- selectAll.SetIcon(BUTTON_ITEM_STATUS_NORMAL, pBitmapSelectAll);
- }
- if (pBitmapSelectAll != null)
- {
- selectAll.SetIcon(BUTTON_ITEM_STATUS_PRESSED, pBitmapSelectAllPress);
- }
- pHeader->SetButton(BUTTON_POSITION_RIGHT, selectAll);
- delete pBitmapSelectAll;
-
- AppLogDebug("EXIT(%s)", GetErrorMessage(GetLastResult()));
-
- return E_SUCCESS;
-}
-
-result
-AlbumListEditorForm::InitializeFooter(void)
-{
- AppLogDebug("ENTER");
- Footer* pFooter = GetFooter();
- if (pFooter == null)
- {
- AppLogDebug("EXIT 1");
-
- return E_SYSTEM;
- }
-
- pFooter->SetStyle(FOOTER_STYLE_BUTTON_ICON);
- pFooter->RemoveAllItems();
- pFooter->SetBackButtonEnabled(true);
- pFooter->SetBackButton();
- SetFormBackEventListener(this);
-
- FooterItem itemShare;
- itemShare.Construct(ACTION_ID_FOOTER_SHARE);
- itemShare.SetText(ResourceManager::GetString(L"EMPTY_SPACE"));
- Bitmap* pShareBitmap = ResourceManager::GetBitmapN(IDB_CONTROLBAR_SHARE);
- Bitmap* pShareBitmapDim = ResourceManager::GetBitmapN(IDB_CONTROLBAR_SHARE_DIM);
- if (pShareBitmap != null && pShareBitmapDim !=null )
- {
- itemShare.SetIcon(FOOTER_ITEM_STATUS_NORMAL, pShareBitmap);
- itemShare.SetIcon(FOOTER_ITEM_STATUS_DISABLED, pShareBitmapDim);
- }
-
- pFooter->AddItem(itemShare);
- delete pShareBitmap;
- delete pShareBitmapDim;
-
- FooterItem itemDelete;
- itemDelete.Construct(ACTION_ID_FOOTER_DELETE);
- itemDelete.SetText(ResourceManager::GetString(L"EMPTY_SPACE"));
- Bitmap* pBitmapDelete = ResourceManager::GetBitmapN(IDB_CONTROLBAR_DELETE);
- Bitmap* pBitmapDeleteDim = ResourceManager::GetBitmapN(IDB_CONTROLBAR_DELETE_DIM);
-
- if (pBitmapDelete != null)
- {
- itemDelete.SetIcon(FOOTER_ITEM_STATUS_NORMAL, pBitmapDelete);
- }
-
- if( pBitmapDeleteDim != null)
- {
- itemDelete.SetIcon(FOOTER_ITEM_STATUS_DISABLED, pBitmapDeleteDim);
- }
-
- pFooter->AddItem(itemDelete);
- delete pBitmapDelete;
- delete pBitmapDeleteDim;
-
- pFooter->AddActionEventListener(*this);
- AppLogDebug("EXIT(%s)", GetErrorMessage(GetLastResult()));
-
- return E_SUCCESS;
-}
-
-result
AlbumListEditorForm::InitializeControl()
{
AppLogDebug("ENTER");
switch (actionId)
{
case ACTION_ID_ALBUM_LIST_SELECT_ALL:
- SetAllCheckState(true);
+ if (__pPresentationModel->GetFolderCount() == GetCheckedFolder())
+ {
+ SetAllCheckState(false);
+ }
+ else
+ {
+ SetAllCheckState(true);
+ }
break;
case ACTION_ID_FOOTER_DELETE:
if (__checkedCount > 0)