Esempio n. 1
0
INT CFlatHeaderCtrl::DrawImage(CDC* pDC, CRect rect, LPHDITEM lphdi, BOOL bRight)
{
	CImageList* pImageList = GetImageList();
	INT iWidth = 0;

	if(lphdi->mask&HDI_IMAGE && lphdi->fmt&HDF_IMAGE)
	{
		ASSERT(pImageList);
		ASSERT(lphdi->iImage>=0 && lphdi->iImage<pImageList->GetImageCount());

		if(rect.Width()>0)
		{
			POINT point;

			point.y = rect.CenterPoint().y - (m_sizeImage.cy>>1);

			if(bRight)
				point.x = rect.right - m_sizeImage.cx;
			else
				point.x = rect.left;

			SIZE size;
			size.cx = rect.Width()<m_sizeImage.cx ? rect.Width():m_sizeImage.cx;
			size.cy = m_sizeImage.cy;
			pImageList->DrawIndirect(pDC, lphdi->iImage, point, size, CPoint(0, 0));

			iWidth = m_sizeImage.cx;
		}
Esempio n. 2
0
BOOL CuDlgIpmTabCtrl::OnInitDialog() 
{
	CDialog::OnInitDialog();
	VERIFY (m_staticHeader.SubclassDlgItem (IDC_STATIC, this));
	m_staticHeader.SetImage (-1); // No Image for Now

	CWnd* pParent1 = GetParent();    // The view: CImView2
	ASSERT (pParent1);
	CdIpmDoc* pDoc = (CdIpmDoc*)((CView*)pParent1)->GetDocument();
	ASSERT (pDoc);
	if (!pDoc->GetCurrentProperty())
		return TRUE;

	//
	// When the document is Loaded ...
	try
	{
		CfIpmFrame* pFrame = (CfIpmFrame*)GetParentFrame();
		CvIpmLeft*  pIpmView1= (CvIpmLeft*)pFrame->GetLeftPane();
		CTreeCtrl& treeCtrl = pIpmView1->GetTreeCtrl();
		HTREEITEM  hSelected= treeCtrl.GetSelectedItem ();
		ASSERT (hSelected);
		if (!hSelected)
			return TRUE;
		CTreeItem* pItem = (CTreeItem*)treeCtrl.GetItemData (hSelected);
		CuPageInformation* pPageInfo = pDoc->GetCurrentProperty()->GetPageInfo();
		LPIPMUPDATEPARAMS pUps = pPageInfo->GetUpdateParam();
		pUps->nType   = pItem->GetType();
		pUps->pStruct = pItem->GetPTreeItemData()? pItem->GetPTreeItemData()->GetDataPtr(): NULL;
		pUps->pSFilter= pDoc->GetFilter();

		int nImage = -1, nSelectedImage = -1;
		CImageList* pImageList = treeCtrl.GetImageList (TVSIL_NORMAL);
		HICON hIcon = NULL;
		int nImageCount = pImageList? pImageList->GetImageCount(): 0;
		if (pImageList && treeCtrl.GetItemImage(hSelected, nImage, nSelectedImage))
		{
			if (nImage < nImageCount)
				hIcon = pImageList->ExtractIcon(nImage);
		}
		pPageInfo->SetImage  (hIcon);

		LoadPage (pDoc->GetCurrentProperty());
		m_bIsLoading = TRUE;
		if (m_pCurrentPage)
		{
			UINT nMask = IPMMASK_FONT|IPMMASK_SHOWGRID;
			m_pCurrentPage->SendMessage (WMUSRMSG_CHANGE_SETTING, (UINT)nMask, (LPARAM)&(pDoc->GetProperty()));
		}
	}
	catch (CMemoryException* e)
	{
		theApp.OutOfMemoryMessage ();
		m_pCurrentPage     = NULL;
		m_pCurrentProperty = NULL;
		e->Delete();
	}
	return TRUE;  // return TRUE unless you set the focus to a control
	              // EXCEPTION: OCX Property Pages should return FALSE
}
Esempio n. 3
0
bool CMainFrame::_CreateMeshPanel( CImageList& imageList, Ogre::StringVectorPtr& meshNames )
{
	if (!m_resourceSelector.Create(WS_CHILD|WS_VISIBLE, CRect(200,100,400,300), this, IDS_ResourceSelector))
		return false;

	m_resourceSelector.SetOwner(this);
	m_resourceSelector.SetIconSize(CSize(MESH_ICON_SIZE, MESH_ICON_SIZE));
	CXTPTaskPanelGroup* pGroup = m_resourceSelector.AddGroup(IDS_ResourceSelector_Mesh);

	int itemCount = imageList.GetImageCount();
 	m_resourceSelector.GetImageManager()->SetImageList(imageList.Detach(), 0);
	
	for (int i=0; i<itemCount; ++i)
	{
		std::wstring meshname(Utility::EngineToUnicode(meshNames->at(i)));
		meshname.erase(meshname.length()-5);
		// Add folder entries
		CXTPTaskPanelGroupItem* pItem = pGroup->AddLinkItem(i, 0);
		pItem->SetIconIndex(i);
		pItem->SetCaption(meshname.c_str());
	}
					
	m_resourceSelector.SetBehaviour(xtpTaskPanelBehaviourList);
	m_resourceSelector.SetSelectItemOnFocus(TRUE);
	m_resourceSelector.SetMultiColumn(TRUE);
	m_resourceSelector.SetColumnWidth(RES_SELECTOR_COLUMN_WIDTH);
	m_resourceSelector.GetAt(0)->SetExpanded(TRUE);
	//拖拽支持
	m_resourceSelector.AllowDrag(xtpTaskItemAllowDragCopyOutsideControl);

	return true;
}
Esempio n. 4
0
void CFolderListCtrl::ClearImageList()
{
	CImageList * pImgList = GetImageList( LVSIL_NORMAL );

	if( pImgList )
		for( int i = pImgList->GetImageCount() - 1; i > 0; i-- )
			pImgList->Remove( i );
}
Esempio n. 5
0
void CMuleToolbarCtrl::ChangeToolbarBitmap(const CString& path, bool bRefresh)
{
	bool bResult = false;
	CImageList ImageList;
	CEnBitmap Bitmap;
	if (!path.IsEmpty() && Bitmap.LoadImage(path))
	{
		BITMAP bm = {0};
		Bitmap.GetObject(sizeof(bm), &bm);
		if (bm.bmWidth == NUM_BUTTON_BITMAPS*m_sizBtnBmp.cx && bm.bmHeight == m_sizBtnBmp.cy)
		{
			bool bAlpha = bm.bmBitsPixel > 24;
			if (ImageList.Create(m_sizBtnBmp.cx, bm.bmHeight, bAlpha ? ILC_COLOR32 : (theApp.m_iDfltImageListColorFlags | ILC_MASK), 0, 1))
			{
				ImageList.Add(&Bitmap,  bAlpha ? 0xFF000000 : RGB(255, 0, 255));
				CImageList* pimlOld = SetImageList(&ImageList);
				ImageList.Detach();
				if (pimlOld)
					pimlOld->DeleteImageList();
				bResult = true;
			}
		}
		Bitmap.DeleteObject();
	}

	// if image file loading or image list creation failed, create default image list.
	if (!bResult)
	{
		// load from icon ressources
		ImageList.Create(m_sizBtnBmp.cx, m_sizBtnBmp.cy, theApp.m_iDfltImageListColorFlags | ILC_MASK, 0, 1);
		ImageList.Add(CTempIconLoader(_T("CONNECT"), m_sizBtnBmp.cx, m_sizBtnBmp.cy));
		ImageList.Add(CTempIconLoader(_T("DISCONNECT"), m_sizBtnBmp.cx, m_sizBtnBmp.cy));
		ImageList.Add(CTempIconLoader(_T("STOPCONNECTING"), m_sizBtnBmp.cx, m_sizBtnBmp.cy));
		ImageList.Add(CTempIconLoader(_T("KADEMLIA"), m_sizBtnBmp.cx, m_sizBtnBmp.cy));
		ImageList.Add(CTempIconLoader(_T("SERVER"), m_sizBtnBmp.cx, m_sizBtnBmp.cy));
		ImageList.Add(CTempIconLoader(_T("TRANSFER"), m_sizBtnBmp.cx, m_sizBtnBmp.cy));
		ImageList.Add(CTempIconLoader(_T("SEARCH"), m_sizBtnBmp.cx, m_sizBtnBmp.cy));
		ImageList.Add(CTempIconLoader(_T("SharedFiles"), m_sizBtnBmp.cx, m_sizBtnBmp.cy));
		ImageList.Add(CTempIconLoader(_T("MESSAGES"), m_sizBtnBmp.cx, m_sizBtnBmp.cy));
		ImageList.Add(CTempIconLoader(_T("IRC"), m_sizBtnBmp.cx, m_sizBtnBmp.cy));
		ImageList.Add(CTempIconLoader(_T("STATISTICS"), m_sizBtnBmp.cx, m_sizBtnBmp.cy));
		ImageList.Add(CTempIconLoader(_T("PREFERENCES"), m_sizBtnBmp.cx, m_sizBtnBmp.cy));
		ImageList.Add(CTempIconLoader(_T("TOOLS"), m_sizBtnBmp.cx, m_sizBtnBmp.cy));
		ImageList.Add(CTempIconLoader(_T("HELP"), m_sizBtnBmp.cx, m_sizBtnBmp.cy));
		ASSERT( ImageList.GetImageCount() == NUM_BUTTON_BITMAPS );
		CImageList* pimlOld = SetImageList(&ImageList);
		ImageList.Detach();
		if (pimlOld)
			pimlOld->DeleteImageList();
	}

	if (bRefresh)
	{
		UpdateBackground();
		Invalidate();
		Refresh();
	}
}
Esempio n. 6
0
UINT DllWrapper::GetImage(CImageList & il, UINT nID)
{
	CBitmap bmp;
	HBITMAP hBitmap = LoadBitmap(m_hInstance,MAKEINTRESOURCE(nID));
	CBitmap* pBmp = bmp.FromHandle(hBitmap);

	int ret = il.Add(pBmp,CXTPImageManager::GetBitmapMaskColor(*pBmp, CPoint(0, 0)));

	return il.GetImageCount();
}
Esempio n. 7
0
// @pymethod int|PyCImageList|GetImageCount|Retrieves the number of images in an image list.
PyObject *PyCImageList_GetImageCount( PyObject *self, PyObject *args )
{
	CImageList *pList;
	if (!(pList=PyCImageList::GetImageList(self)))
		return NULL;
	CHECK_NO_ARGS2(args, "GetImageCount");
	GUI_BGN_SAVE;
	int rc = pList->GetImageCount();
	GUI_END_SAVE;
	return Py_BuildValue("i", rc);
}
Esempio n. 8
0
bool 
CToolWindow::TryToIntegrate(HWND hWnd)
{
	if (m_hWnd) return true; // this is singleton, integrate only first time

	CFindWnd finder(hWnd, TOOLBARCLASSNAME); // TODO: do it safer
	if (!finder.m_hWnd) return false;
	SubclassWindow(finder.m_hWnd);

	if (!::IsWindow(this->m_hWnd)) return true; // HACK
	CImageList il = GetImageList();
	m_IconBase = il.GetImageCount();
	il.AddIcon(LoadIcon(GetBaseModule().GetModuleInstance(), MAKEINTRESOURCE(IDI_XREFRESHA))); 
	il.AddIcon(LoadIcon(GetBaseModule().GetModuleInstance(), MAKEINTRESOURCE(IDI_XREFRESHZ))); 
	return true;
}
//------------------------------------------------------------------------
//! Appends the checkbox state images to the list control image list
//!
//! @param owner The list control adding column
//! @param imagelist The image list assigned to the list control
//! @return Image index where the two state images (unchecked/checked) was inserted
//------------------------------------------------------------------------
int CGridColumnTraitImage::AppendStateImages(CGridListCtrlEx& owner, CImageList& imagelist)
{
	if (!(owner.GetExtendedStyle() & LVS_EX_SUBITEMIMAGES))
		owner.SetExtendedStyle(owner.GetExtendedStyle() | LVS_EX_SUBITEMIMAGES);

	if (!imagelist)
		imagelist.Create(16, 16, ILC_COLOR16 | ILC_MASK, 1, 0);

	if (!owner.GetImageList(LVSIL_SMALL))
		owner.SetImageList(&imagelist, LVSIL_SMALL);

	VERIFY( owner.GetImageList(LVSIL_SMALL)==&imagelist );

	bool createdStateImages = false;
	CImageList* pStateList = owner.GetImageList(LVSIL_STATE);
	if (pStateList==NULL)
	{
		if (!(owner.GetExtendedStyle() & LVS_EX_CHECKBOXES))
		{
			createdStateImages = true;
			owner.SetExtendedStyle(owner.GetExtendedStyle() | LVS_EX_CHECKBOXES);
			pStateList = owner.GetImageList(LVSIL_STATE);
		}
	}
	int imageCount = -1;
	ASSERT(pStateList!=NULL);
	if (pStateList!=NULL)
	{
		imageCount = imagelist.GetImageCount();
		HICON uncheckedIcon = pStateList->ExtractIcon(0);
		imagelist.Add(uncheckedIcon);
		DestroyIcon(uncheckedIcon);
		HICON checkedIcon = pStateList->ExtractIcon(1);
		imagelist.Add(checkedIcon);
		DestroyIcon(checkedIcon);
	}
	if (createdStateImages)
		owner.SetExtendedStyle(owner.GetExtendedStyle() & ~LVS_EX_CHECKBOXES);

	return imageCount;
}
Esempio n. 10
0
void CCommonAppUtils::ResizeAllListCtrlCols(CListCtrl * pListCtrl)
{
    int maxcol = ((CHeaderCtrl*)(pListCtrl->GetDlgItem(0)))->GetItemCount()-1;
    int nItemCount = pListCtrl->GetItemCount();
    TCHAR textbuf[MAX_PATH] = { 0 };
    CHeaderCtrl * pHdrCtrl = (CHeaderCtrl*)(pListCtrl->GetDlgItem(0));
    if (pHdrCtrl)
    {
        int imgWidth = 0;
        CImageList * pImgList = pListCtrl->GetImageList(LVSIL_SMALL);
        if ((pImgList)&&(pImgList->GetImageCount()))
        {
            IMAGEINFO imginfo;
            pImgList->GetImageInfo(0, &imginfo);
            imgWidth = (imginfo.rcImage.right - imginfo.rcImage.left) + 3;  // 3 pixels between icon and text
        }
        for (int col = 0; col <= maxcol; col++)
        {
            HDITEM hdi = {0};
            hdi.mask = HDI_TEXT;
            hdi.pszText = textbuf;
            hdi.cchTextMax = _countof(textbuf);
            pHdrCtrl->GetItem(col, &hdi);
            int cx = pListCtrl->GetStringWidth(hdi.pszText)+20; // 20 pixels for col separator and margin

            for (int index = 0; index<nItemCount; ++index)
            {
                // get the width of the string and add 14 pixels for the column separator and margins
                int linewidth = pListCtrl->GetStringWidth(pListCtrl->GetItemText(index, col)) + 14;
                // add the image size
                if (col == 0)
                    linewidth += imgWidth;
                if (cx < linewidth)
                    cx = linewidth;
            }
            pListCtrl->SetColumnWidth(col, cx);

        }
    }
}
//------------------------------------------------------------------------
//! Appends the checkbox state images to the list control image list
//!
//! @param owner The list control adding column
//! @param imagelist The image list assigned to the list control
//! @return Image index where the two state images (unchecked/checked) was inserted
//------------------------------------------------------------------------
int CGridColumnTraitImage::AppendStateImages(CGridListCtrlEx& owner, CImageList& imagelist)
{
	if (!(owner.GetExtendedStyle() & LVS_EX_SUBITEMIMAGES))
		owner.SetExtendedStyle(owner.GetExtendedStyle() | LVS_EX_SUBITEMIMAGES);

	if (!imagelist)
		imagelist.Create(16, 16, ILC_COLOR16 | ILC_MASK, 1, 0);

	if (!owner.GetImageList(LVSIL_SMALL))
		owner.SetImageList(&imagelist, LVSIL_SMALL);

	VERIFY(owner.GetImageList(LVSIL_SMALL) == &imagelist);

	bool createdStateImages = false;
	CImageList* pStateList = owner.GetImageList(LVSIL_STATE);
	if (pStateList == NULL)
	{
		if (!(owner.GetExtendedStyle() & LVS_EX_CHECKBOXES))
		{
			createdStateImages = true;
			owner.SetExtendedStyle(owner.GetExtendedStyle() | LVS_EX_CHECKBOXES);
			pStateList = owner.GetImageList(LVSIL_STATE);
		}
	}
	int imageCount = -1;
	ASSERT(pStateList != NULL);
	if (pStateList != NULL && pStateList->GetImageCount() >= 2)
	{
		imageCount = imagelist.GetImageCount();

		// Get the icon size of current imagelist
		CSize iconSize(16, 16);
		if (imageCount > 0)
		{
			IMAGEINFO iconSizeInfo = { 0 };
			VERIFY(imagelist.GetImageInfo(0, &iconSizeInfo));
			iconSize =
				CSize(iconSizeInfo.rcImage.right - iconSizeInfo.rcImage.left,
					iconSizeInfo.rcImage.bottom - iconSizeInfo.rcImage.top);
		}

		// Scale the icon-position if necessary
		CPoint iconPos(1, 0); // +1 pixel to avoid overlap with left-grid-line
		{
			IMAGEINFO stateSizeInfo = { 0 };
			VERIFY(pStateList->GetImageInfo(0, &stateSizeInfo));
			int stateIconHeight = stateSizeInfo.rcImage.bottom - stateSizeInfo.rcImage.top;
			if (iconSize.cy > stateIconHeight)
				iconPos.y = (iconSize.cy - stateIconHeight) / 2;
		}

		// Redraw the state-icon to match the icon size of the current imagelist (without scaling image)
		CClientDC clienDC(&owner);
		CDC memDC;
		VERIFY(memDC.CreateCompatibleDC(&clienDC));
		CBitmap dstBmp;
		VERIFY(dstBmp.CreateCompatibleBitmap(&clienDC, iconSize.cx, iconSize.cy));

		CBitmap* pBmpOld = memDC.SelectObject(&dstBmp);
		COLORREF oldBkColor = pStateList->SetBkColor(imagelist.GetBkColor());
		CBrush brush(imagelist.GetBkColor());
		memDC.FillRect(CRect(0, 0, iconSize.cx, iconSize.cy), &brush);
		VERIFY(pStateList->Draw(&memDC, 0, iconPos, ILD_NORMAL));
		memDC.SelectObject(pBmpOld);
		VERIFY(imagelist.Add(&dstBmp, oldBkColor) != -1);
		pBmpOld = memDC.SelectObject(&dstBmp);
		memDC.FillRect(CRect(0, 0, iconSize.cx, iconSize.cy), &brush);
		VERIFY(pStateList->Draw(&memDC, 1, iconPos, ILD_NORMAL));
		memDC.SelectObject(pBmpOld);
		VERIFY(imagelist.Add(&dstBmp, oldBkColor) != -1);
		pStateList->SetBkColor(oldBkColor);
	}
	if (createdStateImages)
		owner.SetExtendedStyle(owner.GetExtendedStyle() & ~LVS_EX_CHECKBOXES);

	return imageCount;
}
Esempio n. 12
0
void CvIpmLeft::OnSelchanged(NMHDR* pNMHDR, LRESULT* pResult) 
{
	IPMUPDATEPARAMS ups;
	NM_TREEVIEW* pNMTreeView = (NM_TREEVIEW*)pNMHDR;
	CdIpmDoc* pDoc = (CdIpmDoc *)GetDocument();

	try 
	{
		ASSERT(pDoc);
		if (!pDoc)
			return;
		if (pDoc->GetLockDisplayRightPane())
			return;
		CfIpmFrame* pFrame = (CfIpmFrame*)GetParentFrame();
		ASSERT (pFrame);
		if (!pFrame)
			return;
		if (!pFrame->IsAllViewCreated())
			return;

		CuDlgIpmTabCtrl* pTabDlg  = (CuDlgIpmTabCtrl*)pFrame->GetTabDialog();
		if (!pTabDlg)
			return;
		CWaitCursor doWaitCursor ;
		//
		// Notify the container of sel change:
		CIpmCtrl* pIpmCtrl = (CIpmCtrl*)pFrame->GetParent();
		if (pIpmCtrl)
			pIpmCtrl->ContainerNotifySelChange();

		memset (&ups, 0, sizeof (ups));
		CTreeCtrl& treeCtrl = GetTreeCtrl();
		CTreeItem* pItem = (CTreeItem*)treeCtrl.GetItemData (pNMTreeView->itemNew.hItem);
		if (pItem->IsNoItem() || pItem->IsErrorItem())
		{
			pTabDlg->DisplayPage (NULL);
			*pResult = 0;
			return;
		}
		if (pItem->ItemDisplaysNoPage()) {
			CString caption = pItem->ItemNoPageCaption();
			pTabDlg->DisplayPage (NULL, caption);
			*pResult = 0;
			return;
		}

		if (pItem->HasReplicMonitor())
		{
			pDoc->InitializeReplicator(pItem->GetDBName());
		}

		int nImage = -1, nSelectedImage = -1;
		CImageList* pImageList = treeCtrl.GetImageList (TVSIL_NORMAL);
		HICON hIcon = NULL;
		int nImageCount = pImageList? pImageList->GetImageCount(): 0;
		if (pImageList && treeCtrl.GetItemImage(pNMTreeView->itemNew.hItem, nImage, nSelectedImage))
		{
			if (nImage < nImageCount)
				hIcon = pImageList->ExtractIcon(nImage);
		}
		CuPageInformation* pPageInfo = pItem->GetPageInformation();

		CString strItem = pItem->GetRightPaneTitle();
		pItem->UpdateDataWhenSelChange(); // Has an effect only if the class has specialied the method.
		ups.nType   = pItem->GetType();
		ups.pStruct = pItem->GetPTreeItemData()? pItem->GetPTreeItemData()->GetDataPtr(): NULL;
		ups.pSFilter= pDoc->GetPTreeGD()->GetPSFilter();
		pPageInfo->SetUpdateParam (&ups);
		pPageInfo->SetTitle ((LPCTSTR)strItem, pItem, pDoc);

		pPageInfo->SetImage  (hIcon);
		pTabDlg->DisplayPage (pPageInfo);
	}
	catch(CMemoryException* e)
	{
		theApp.OutOfMemoryMessage();
		e->Delete();
	}
	catch(CResourceException* e)
	{
		AfxMessageBox (IDS_E_LOAD_DLG);
		e->Delete();
	}
	catch(...)
	{
		AfxMessageBox (IDS_E_CONSTRUCT_PROPERTY);
	}
	*pResult = 0;
}
void CXTPSkinObjectHeader::DrawItemEntry(CDC* pDC, int nIndex, CRect rcItem, int nState)
{
	CXTPSkinManagerClass* pClass = GetSkinClass();

	CHeaderCtrl* pHeaderCtrl = (CHeaderCtrl*)this;
	CImageList* pImageList = CImageList::FromHandle((HIMAGELIST)
		::SendMessage(pHeaderCtrl->m_hWnd, HDM_GETIMAGELIST, 0, 0L));

	// Set up the header item order array.
	HD_ITEM hdi;
	::ZeroMemory(&hdi, sizeof(HD_ITEM));

	hdi.fmt = HDF_STRING | HDF_IMAGE;
	hdi.mask = HDI_TEXT | HDI_FORMAT | HDI_IMAGE | HDI_LPARAM;

	// Get the header item text and format
	CString strCaption;
	LPTSTR pszText = strCaption.GetBuffer(256);
	pszText[0] = 0;
	hdi.pszText = pszText;
	hdi.cchTextMax = 255;

	BOOL bResult = pHeaderCtrl->GetItem(nIndex, &hdi);

	strCaption.ReleaseBuffer();

#ifdef _UNICODE
	if (!bResult)
	{
		char tText[256];
		tText[0] = 0;

		HD_ITEMA hdia;
		::ZeroMemory(&hdia, sizeof(HD_ITEMA));

		hdia.fmt = HDF_STRING | HDF_IMAGE;
		hdia.mask = HDI_TEXT | HDI_FORMAT | HDI_IMAGE | HDI_LPARAM;

		// Get the header item text and format
		hdia.pszText = tText;
		hdia.cchTextMax = 255;

		::SendMessage(pHeaderCtrl->m_hWnd, HDM_GETITEMA, nIndex, (LPARAM)&hdia);

		strCaption = tText;
		hdi.fmt = hdia.fmt;
		hdi.iImage = hdia.iImage;
		hdi.lParam = hdia.lParam;
	}
#else
	bResult;
#endif

	if (hdi.fmt & HDF_OWNERDRAW)
	{
		DRAWITEMSTRUCT dis;

		dis.CtlType = ODT_HEADER;
		dis.CtlID = (UINT)GetDlgCtrlID();
		dis.itemID = nIndex;
		dis.itemAction = ODA_DRAWENTIRE;
		dis.itemState = (nState == HIS_PRESSED) ? ODS_SELECTED : 0;
		dis.hwndItem = m_hWnd;
		dis.hDC = pDC->GetSafeHdc();
		dis.rcItem = rcItem;
		dis.itemData = hdi.lParam;

		// Now send it off to my parent...
		if (GetParent()->SendMessage(WM_DRAWITEM, dis.CtlID,
			(LPARAM)(DRAWITEMSTRUCT*)&dis))
		{
			return;
		}
	}

	CRect rcText(rcItem);

	if (pImageList && (hdi.fmt & HDF_IMAGE) && hdi.iImage >= 0 && hdi.iImage < pImageList->GetImageCount())
	{
		int iBitmapMargin = (int)SendMessage(HDM_GETBITMAPMARGIN);
		if (iBitmapMargin == 0)
			iBitmapMargin = GetMetrics()->m_cxEdge * 3;
		int cxBitmap = 16, cyBitmap = 16;
		ImageList_GetIconSize(pImageList->GetSafeHandle(), &cxBitmap, &cyBitmap);

		CPoint pt(rcItem.left + iBitmapMargin, (rcItem.bottom + rcItem.top - cyBitmap) / 2);

		if (hdi.fmt & HDF_BITMAP_ON_RIGHT)
		{
			CSize sz = pDC->GetTextExtent(strCaption);

			pt.x += sz.cx + iBitmapMargin + 9;
			if (pt.x + cxBitmap > rcItem.right - 3)
				pt.x = max(rcItem.left + 6, rcItem.right - 3 - cxBitmap);
			if (nState == HIS_PRESSED)
				pt.x ++;

			pImageList->Draw(pDC, hdi.iImage, pt, ILD_TRANSPARENT);
			rcText.right = pt.x + 6;
		}
		else
		{
			if (nState == HIS_PRESSED)
				pt.x ++;
			pImageList->Draw(pDC, hdi.iImage, pt, ILD_TRANSPARENT);

			rcText.left += cxBitmap + iBitmapMargin;
		}
	}

	if (((hdi.fmt & HDF_IMAGE) == 0) && ((hdi.fmt & HDF_SORTUP) || (hdi.fmt & HDF_SORTDOWN)))
	{
		int iBitmapMargin = GetMetrics()->m_cxEdge * 3;
		CSize sz = pDC->GetTextExtent(strCaption);

		CPoint pt(rcItem.left + iBitmapMargin, (rcItem.bottom + rcItem.top - 2) / 2);

		pt.x += sz.cx + iBitmapMargin + 9;
		if (pt.x + 9 > rcItem.right - 3)
			pt.x = max(rcItem.left + 6, rcItem.right - 3 - 9);

		if (hdi.fmt & HDF_SORTUP)
		{
			XTPDrawHelpers()->Triangle(pDC, CPoint(pt.x - 4, pt.y + 2),
				CPoint(pt.x, pt.y - 2), CPoint(pt.x + 4, pt.y + 2), GetColor(COLOR_3DSHADOW));
		}
		else
		{
			XTPDrawHelpers()->Triangle(pDC, CPoint(pt.x - 4, pt.y - 2),
				CPoint(pt.x, pt.y + 2), CPoint(pt.x + 4, pt.y - 2), GetColor(COLOR_3DSHADOW));
		}
		rcText.right = pt.x;
	}

	UINT nFormat = DT_SINGLELINE | DT_VCENTER | DT_END_ELLIPSIS | DT_NOPREFIX;

	// determine justification for text.
	switch (hdi.fmt & HDF_JUSTIFYMASK)
	{
	case HDF_LEFT:
		nFormat |= DT_LEFT;
		rcText.DeflateRect(9, 0, 6, 0);
		break;

	case HDF_CENTER:
		nFormat |= DT_CENTER;
		rcText.DeflateRect(6, 0, 6, 0);
		break;

	case HDF_RIGHT:
		nFormat |= DT_RIGHT;
		rcText.DeflateRect(6, 0, 9, 0);
		break;
	}

	if (rcText.Width() > 0)
	{
		if (nState == HIS_PRESSED)
			rcText.OffsetRect(1, 1);

		// draw text.
		pDC->SetTextColor(GetColor(COLOR_BTNTEXT));
		pClass->DrawThemeText(pDC, HP_HEADERITEM, nState, strCaption, nFormat, &rcText);
	}
}
Esempio n. 14
0
void CTreePropSheet::RefillPageTree()
{
	if (!IsWindow(m_hWnd))
		return;

	m_pwndPageTree->DeleteAllItems();

	CTabCtrl	*pTabCtrl = GetTabControl();
	if (!IsWindow(pTabCtrl->GetSafeHwnd()))
	{
		ASSERT(FALSE);
		return;
	}

	const int	nPageCount = pTabCtrl->GetItemCount();

	// rebuild image list
	if (m_bTreeImages)
	{
		for (int i = m_Images.GetImageCount()-1; i >= 0; --i)
			m_Images.Remove(i);

		// add page images
		CImageList	*pPageImages = pTabCtrl->GetImageList();
		if (pPageImages)
		{
			for (int nImage = 0; nImage < pPageImages->GetImageCount(); ++nImage)
			{
				HICON	hIcon = pPageImages->ExtractIcon(nImage);
				m_Images.Add(hIcon);
				DestroyIcon(hIcon);
			}
		}

		// add default images
		if (m_DefaultImages.GetSafeHandle())
		{	
			HICON	hIcon;

			// add default images
			hIcon = m_DefaultImages.ExtractIcon(0);
			if (hIcon)
			{
				m_Images.Add(hIcon);
				DestroyIcon(hIcon);
			}
			hIcon = m_DefaultImages.ExtractIcon(1);
			{
				m_Images.Add(hIcon);
				DestroyIcon(hIcon);
			}
		}
	}

	// insert tree items
	for (int nPage = 0; nPage < nPageCount; ++nPage)
	{
		// Get title and image of the page
		CString	strPagePath;

		TCITEM	ti;
		ZeroMemory(&ti, sizeof(ti));
		ti.mask = TCIF_TEXT|TCIF_IMAGE;
		ti.cchTextMax = MAX_PATH;
		ti.pszText = strPagePath.GetBuffer(ti.cchTextMax);
		ASSERT(ti.pszText);
		if (!ti.pszText)
			return;

		pTabCtrl->GetItem(nPage, &ti);
		strPagePath.ReleaseBuffer();

		// Create an item in the tree for the page
		HTREEITEM	hItem = CreatePageTreeItem(ti.pszText);
		ASSERT(hItem);
		if (hItem)
		{
			m_pwndPageTree->SetItemData(hItem, nPage);

			// set image
			if (m_bTreeImages)
			{
				int	nImage = ti.iImage;
				if (nImage < 0 || nImage >= m_Images.GetImageCount())
					nImage = m_DefaultImages.GetSafeHandle()? m_Images.GetImageCount()-1 : -1;

				m_pwndPageTree->SetItemImage(hItem, nImage, nImage);
			}
		}
	}
}
Esempio n. 15
0
BOOL CIpmCtrl::SelectItem(LPCTSTR lpszNode, LPCTSTR lpszServer, LPCTSTR lpszUser, LPCTSTR lpszKey, VARIANT FAR* pArrayItem, short nShowTree)
{
	class CaLockDisplayRightPaneProperty
	{
	public:
		CaLockDisplayRightPaneProperty(CdIpmDoc* pDoc):m_pDoc(pDoc), m_bLock(FALSE){}
		~CaLockDisplayRightPaneProperty(){UnLock();}

		void Lock(){m_pDoc->SetLockDisplayRightPane(TRUE);}
		void UnLock(){m_pDoc->SetLockDisplayRightPane(FALSE);}

	protected:
		BOOL m_bLock;
		CdIpmDoc* m_pDoc;
	};

	CWaitCursor doWaitCursor ;
	BOOL bOK = FALSE;
	try 
	{
		CdIpmDoc* pDoc = new CdIpmDoc(lpszKey, pArrayItem, (BOOL)nShowTree);

		if (m_pIpmFrame)
		{
			m_pIpmFrame->ShowWindow (SW_HIDE);
			m_pIpmFrame->DestroyWindow();
			m_pIpmFrame = NULL;
		}

		CaIpmProperty& property = pDoc->GetProperty();
		ConstructPropertySet (property);

		SFILTER* pFilter = theApp.GetFilter();
		SFILTER* pDocFilter = pDoc->GetFilter();
		memcpy (pDocFilter, pFilter, sizeof(SFILTER));
		CaLockDisplayRightPaneProperty lock(pDoc);
		if (nShowTree == 1)
		{
			//
			// During the process of expanding tree up to search item,
			// prohibit the display of the properties of the selected tree item
			lock.Lock();
		}

		CWnd* pParent = this;
		CRect r;
		GetClientRect (r);
		m_pIpmFrame = new CfIpmFrame(pDoc);
		m_pIpmFrame->Create (
			NULL,
			NULL,
			WS_CHILD,
			r,
			pParent);
		if (!m_pIpmFrame)
			return FALSE;

		m_pIpmFrame->InitialUpdateFrame(NULL, TRUE);
		m_pIpmFrame->ShowWindow(SW_SHOW);
		bOK = pDoc->Initiate(lpszNode, lpszServer, lpszUser, NULL);
		if (!bOK)
			return FALSE;

		CTypedPtrList<CObList, CuIpmTreeFastItem*> listItemPath;
		bOK = IPM_BuildItemPath (pDoc, listItemPath);
		if (!bOK)
		{
			while (!listItemPath.IsEmpty())
				delete listItemPath.RemoveHead();
			return FALSE;
		}
		ExpandUpToSearchedItem(m_pIpmFrame, listItemPath, TRUE);
		lock.UnLock();
		//
		// Cleanup:
		while (!listItemPath.IsEmpty())
			delete listItemPath.RemoveHead();

		//
		// Fetch the selected tree item and display the corresponding right pane:
		IPMUPDATEPARAMS ups;
		CTreeGlobalData* pGD = pDoc->GetPTreeGD();
		ASSERT (pGD);
		if (!pGD)
			return FALSE;
		CTreeCtrl* pTree = pGD->GetPTree();
		ASSERT (pTree);
		if (!pTree)
			return FALSE;
		CuDlgIpmTabCtrl* pTabDlg  = (CuDlgIpmTabCtrl*)m_pIpmFrame->GetTabDialog();
		if (!pTabDlg)
			return FALSE;
		HTREEITEM hSelected = pTree->GetSelectedItem();
		if (!hSelected)
			return FALSE;
		//
		// Notify the container of sel change:
		ContainerNotifySelChange();
		memset (&ups, 0, sizeof (ups));
		CTreeItem* pItem = (CTreeItem*)pTree->GetItemData (hSelected);
		if (pItem->IsNoItem() || pItem->IsErrorItem())
		{
			pTabDlg->DisplayPage (NULL);
			return TRUE;
		}
		if (pItem->ItemDisplaysNoPage()) 
		{
			CString caption = pItem->ItemNoPageCaption();
			pTabDlg->DisplayPage (NULL, caption);
			return TRUE;
		}

		if (pItem->HasReplicMonitor())
		{
			pDoc->InitializeReplicator(pItem->GetDBName());
		}

		int nImage = -1, nSelectedImage = -1;
		CImageList* pImageList = pTree->GetImageList (TVSIL_NORMAL);
		HICON hIcon = NULL;
		int nImageCount = pImageList? pImageList->GetImageCount(): 0;
		if (pImageList && pTree->GetItemImage(hSelected, nImage, nSelectedImage))
		{
			if (nImage < nImageCount)
				hIcon = pImageList->ExtractIcon(nImage);
		}
		CuPageInformation* pPageInfo = pItem->GetPageInformation();
		ASSERT(pPageInfo);
		if (!pPageInfo)
			return FALSE;
		int nSelectTab = GetDefaultSelectTab (pDoc);

		CString strItem = pItem->GetRightPaneTitle();
		pItem->UpdateDataWhenSelChange(); // Has an effect only if the class has specialied the method.
		ups.nType   = pItem->GetType();
		ups.pStruct = pItem->GetPTreeItemData()? pItem->GetPTreeItemData()->GetDataPtr(): NULL;
		ups.pSFilter= pDoc->GetPTreeGD()->GetPSFilter();
		pPageInfo->SetUpdateParam (&ups);
		pPageInfo->SetTitle ((LPCTSTR)strItem, pItem, pDoc);
		pPageInfo->SetImage  (hIcon);
		pTabDlg->DisplayPage (pPageInfo, NULL, nSelectTab);

		return TRUE;
	}
	catch(CMemoryException* e)
	{
		theApp.OutOfMemoryMessage();
		e->Delete();
	}
	catch(CResourceException* e)
	{
		AfxMessageBox (IDS_E_LOAD_DLG);
		e->Delete();
	}
	catch(...)
	{
		AfxMessageBox (IDS_E_CONSTRUCT_PROPERTY);
	}
	return FALSE;
}
Esempio n. 16
0
BOOL CdIpmDoc::UpdateDisplay()
{
	TRACE0("CdIpmDoc::UpdateDisplay()\n");
	try
	{
		m_pTreeGD->RefreshAllTreeBranches(); // refresh left pane
		
		IPMUPDATEPARAMS ups;
		memset (&ups, 0, sizeof (ups));
		CTreeItem* pItem = NULL;
		CTreeCtrl* pTree = m_pTreeGD->GetPTree();
		ASSERT (pTree);
		HTREEITEM hSelectedItem = pTree->GetSelectedItem();
		if (!hSelectedItem)
			return FALSE;
		pItem = (CTreeItem*)pTree->GetItemData(hSelectedItem);
		ASSERT (pItem);
		if (pItem->IsNoItem() || pItem->IsErrorItem())
		{
			m_pTabDialog->DisplayPage (NULL);
		}
		else 
		if (pItem->ItemDisplaysNoPage()) 
		{
			CString caption = pItem->ItemNoPageCaption();
			m_pTabDialog->DisplayPage (NULL, caption);
		}
		else 
		{
			int nImage = -1, nSelectedImage = -1;
			CImageList* pImageList = pTree->GetImageList (TVSIL_NORMAL);
			HICON hIcon = NULL;
			int nImageCount = pImageList? pImageList->GetImageCount(): 0;
			if (pImageList && pTree->GetItemImage(hSelectedItem, nImage, nSelectedImage))
			{
				if (nImage < nImageCount)
					hIcon = pImageList->ExtractIcon(nImage);
			}
			CuPageInformation* pPageInfo = pItem->GetPageInformation();
			CString strItem = pItem->GetRightPaneTitle();

			ups.nType   = pItem->GetType();
			ups.pStruct = pItem->GetPTreeItemData()? pItem->GetPTreeItemData()->GetDataPtr(): NULL;
			ups.pSFilter= m_pTreeGD->GetPSFilter();
			pPageInfo->SetUpdateParam (&ups);
			pPageInfo->SetTitle ((LPCTSTR)strItem, pItem, this);

			pPageInfo->SetImage  (hIcon);
			m_pTabDialog->DisplayPage (pPageInfo);
		}

		// Replicator Monitor special management
		// ASSUMES we did not change the current item!
		BOOL bReplMonWasOn = (m_hReplMonHandle != -1) ? TRUE: FALSE;
		BOOL bReplMonToBeOn = pItem->HasReplicMonitor();
		// 3 cases :
		//    - on to off ---> replicator has been uninstalled
		//    - off to on ---> replicator has been installed
		//    - on to on, or off to off: state has not changed
		if (bReplMonWasOn && !bReplMonToBeOn) 
		{
			BOOL bOK = TerminateReplicator();
			ASSERT (bOK);
		}
		else 
		if (!bReplMonWasOn && bReplMonToBeOn)
		{
			CString csDbName = pItem->GetDBName();
			BOOL bOK = InitializeReplicator(csDbName);
			ASSERT (bOK);
		}
		//
		// Refresh right pane
		CfIpmFrame* pIpmFrame = (CfIpmFrame*)pTree->GetParentFrame();
		UpdateAllViews((CView *)pIpmFrame->GetLeftPane());
	}
	catch(CMemoryException* e)
	{
		theApp.OutOfMemoryMessage();
		e->Delete();
		return FALSE;
	}
	catch(CResourceException* e)
	{
		//_T("Cannot load dialog box");
		AfxMessageBox (IDS_E_LOAD_DLG);
		e->Delete();
		return FALSE;
	}
	catch(...)
	{
		//_T("Cannot construct the property pane");
		AfxMessageBox (IDS_E_CONSTRUCT_PROPERTY);
		return FALSE;
	}

	return TRUE;
}
Esempio n. 17
0
//------------------------------------------------------------------------//
HICON CBCGPGlobalUtils::GetWndIcon (CWnd* pWnd, BOOL* bDestroyIcon, BOOL bNoDefault)
{
#ifdef _BCGSUITE_
	UNREFERENCED_PARAMETER(bNoDefault);
#endif
	ASSERT_VALID (pWnd);
	
	if (pWnd->GetSafeHwnd () == NULL)
	{
		return NULL;
	}

	if (bDestroyIcon != NULL)
	{
		*bDestroyIcon = FALSE;
	}

	HICON hIcon = pWnd->GetIcon (FALSE);

	if (hIcon == NULL)
	{
		hIcon = pWnd->GetIcon (TRUE);

		if (hIcon != NULL)
		{
			CImageList il;
			il.Create (16, 16, ILC_COLOR32 | ILC_MASK, 0, 1);
			il.Add (hIcon);

			if (il.GetImageCount () == 1)
			{
				hIcon = il.ExtractIcon (0);
				if (bDestroyIcon != NULL)
				{
					*bDestroyIcon = hIcon != NULL;
				}
			}
		}
	}

	if (hIcon == NULL)
	{
		hIcon = (HICON)(LONG_PTR)::GetClassLongPtr(pWnd->GetSafeHwnd (), GCLP_HICONSM);
	}

	if (hIcon == NULL)
	{
		hIcon = (HICON)(LONG_PTR)::GetClassLongPtr(pWnd->GetSafeHwnd (), GCLP_HICON);
	}

#ifndef _BCGSUITE_
	if (hIcon == NULL && !bNoDefault && 
		!pWnd->IsKindOf (RUNTIME_CLASS(CDialog)) && !pWnd->IsKindOf (RUNTIME_CLASS(CPropertySheet)))
	{
		hIcon = globalData.m_hiconApp;
		if (bDestroyIcon != NULL)
		{
			*bDestroyIcon = FALSE;
		}
	}
#endif
	return hIcon;
}
void CTreePropSheetBase::RefillPageTree()
{
	if (!IsWindow(m_hWnd))
		return;

  // TreePropSheetEx: OnPageTreeSelChanging does not process message.
  TreePropSheet::CIncrementScope RefillingPageTreeContentGuard( m_nRefillingPageTreeContent );
  // TreePropSheetEx: End OnPageTreeSelChanging does not process message.

	m_pwndPageTree->DeleteAllItems();

	CTabCtrl	*pTabCtrl = GetTabControl();
	if (!IsWindow(pTabCtrl->GetSafeHwnd()))
	{
		ASSERT(FALSE);
		return;
	}

	const int	nPageCount = pTabCtrl->GetItemCount();

	// rebuild image list
	if (m_bTreeImages)
	{
		for (int i = m_Images.GetImageCount()-1; i >= 0; --i)
			m_Images.Remove(i);

		// add page images
		CImageList	*pPageImages = pTabCtrl->GetImageList();
		if (pPageImages)
		{
			for (int nImage = 0; nImage < pPageImages->GetImageCount(); ++nImage)
			{
				HICON	hIcon = pPageImages->ExtractIcon(nImage);
				m_Images.Add(hIcon);
				DestroyIcon(hIcon);
			}
		}

		// add default images
		if (m_DefaultImages.GetSafeHandle())
		{	
			HICON	hIcon;

			// add default images
			hIcon = m_DefaultImages.ExtractIcon(0);
			if (hIcon)
			{
				m_Images.Add(hIcon);
				DestroyIcon(hIcon);
			}
			hIcon = m_DefaultImages.ExtractIcon(1);
			{
				m_Images.Add(hIcon);
				DestroyIcon(hIcon);
			}
		}
	}

	// insert tree items
	for (int nPage = 0; nPage < nPageCount; ++nPage)
	{
		// Get title and image of the page
		CString	strPagePath;

		TCITEM	ti;
		ZeroMemory(&ti, sizeof(ti));
		ti.mask = TCIF_TEXT|TCIF_IMAGE;
		ti.cchTextMax = MAX_PATH;
		ti.pszText = strPagePath.GetBuffer(ti.cchTextMax);
		ASSERT(ti.pszText);
		if (!ti.pszText)
			return;

		pTabCtrl->GetItem(nPage, &ti);
		strPagePath.ReleaseBuffer();

		// Create an item in the tree for the page
		HTREEITEM	hItem = CreatePageTreeItem(ti.pszText);
		ASSERT(hItem);
		if (hItem)
		{
			m_pwndPageTree->SetItemData(hItem, nPage);

			// set image
			if (m_bTreeImages)
			{
				int	nImage = ti.iImage;
				if (nImage < 0 || nImage >= m_Images.GetImageCount())
					nImage = m_DefaultImages.GetSafeHandle()? m_Images.GetImageCount()-1 : -1;

				m_pwndPageTree->SetItemImage(hItem, nImage, nImage);
			}

      // Set font if disabled.
      CPropertyPage* pPage = GetPage( nPage );
      ASSERT( pPage );
      if( NULL != pPage && !IsPageEnabled( pPage ) )
      {
        ::SendMessage( m_pwndPageTree->GetSafeHwnd(), WMU_ENABLETREEITEM, (WPARAM)hItem, (LPARAM)GetSysColor(COLOR_GRAYTEXT) );
      }
		}
	}
}
Esempio n. 19
0
void ToolBarCreator::populate(std::map <std::string, CToolBar*> wndtoolbar, Menu itemmenu, std::string parentmenu, IIdGenerator* idgenerator)
{

    TBBUTTON    btn;

    CImageList* imageList = nullptr;
for (auto toolbar : wndtoolbar)
    {
        int btnCount = toolbar.second->GetToolBarCtrl().GetButtonCount();
        if (toolbar.first == parentmenu)
        {
            switch (itemmenu.mMenuType)
            {
                case eMenuTypes::PopUp:
                {
for (auto submenu : itemmenu.submenulist)
                    {
                        populate(wndtoolbar, submenu, parentmenu, idgenerator);
                    }
                    break;
                }
                /*if (itemmenu.mMenuType == eMenuTypes::PopUp)
                {
                for (auto submenu : itemmenu.submenulist)
                {
                populate(wndtoolbar, submenu, parentmenu, idgenerator);
                }
                }*/
                case eMenuTypes::Separator:
                {
                    ZeroMemory(&btn, sizeof(btn));
                    btn.fsStyle = TBBS_SEPARATOR;
                    toolbar.second->GetToolBarCtrl().InsertButton(btnCount, &btn);
                    break;
                }
                /*else if (itemmenu.mMenuType == eMenuTypes::Separator)
                {
                ZeroMemory(&btn, sizeof(btn));
                btn.fsStyle = TBBS_SEPARATOR;
                toolbar.second->GetToolBarCtrl().InsertButton(btnCount, &btn);
                }*/
                case eMenuTypes::MenuItem:
                {
                    if (itemmenu.mToolbar.isToolButtonReq)
                    {
                        ZeroMemory(&btn, sizeof(btn));
                        toolbar.second->EnableDocking(CBRS_ALIGN_ANY);
                        imageList = toolbar.second->GetToolBarCtrl().GetImageList();
                        index = imageList->GetImageCount();

                        idgenerator->generateId(itemmenu.mId, idgenerator->id);
                        CBitmap* bmp = new CBitmap();

                        //Enabled image list
                        if (!FileExist(itemmenu.mToolbar.iconPathEnable.c_str()))
                        {
                            bmp->Attach(LoadImage(AfxGetInstanceHandle(), DEFAULT_IMAGE_PATH, IMAGE_BITMAP, 32, 32, (LR_DEFAULTSIZE | LR_CREATEDIBSECTION | LR_LOADFROMFILE)));
                        }
                        else
                        {
                            bmp->Attach(LoadImage(AfxGetInstanceHandle(), itemmenu.mToolbar.iconPathEnable.c_str(), IMAGE_BITMAP, 32, 32, (LR_DEFAULTSIZE | LR_CREATEDIBSECTION | LR_LOADFROMFILE)));
                        }

                        imageList->Add(bmp, RGB(255, 255, 255));
                        bmp->Detach();
                        btn.idCommand = idgenerator->id;
                        btn.iBitmap = index;
                        btn.fsStyle = TBSTYLE_BUTTON;



                        //Disabled image list
                        imageList = toolbar.second->GetToolBarCtrl().GetDisabledImageList();
                        index = imageList->GetImageCount();
                        if (!FileExist(itemmenu.mToolbar.iconPathDisable.c_str()))
                        {
                            bmp->Attach(LoadImage(AfxGetInstanceHandle(), itemmenu.mToolbar.iconPathEnable.c_str(), IMAGE_BITMAP, 32, 32, (LR_DEFAULTSIZE | LR_CREATEDIBSECTION | LR_LOADFROMFILE)));
                        }
                        else
                        {
                            bmp->Attach(LoadImage(AfxGetInstanceHandle(), itemmenu.mToolbar.iconPathDisable.c_str(), IMAGE_BITMAP, 32, 32, (LR_DEFAULTSIZE | LR_CREATEDIBSECTION | LR_LOADFROMFILE)));
                        }
                        imageList->Add(bmp, RGB(255, 255, 255));
                        bmp->Detach();
                        toolbar.second->GetToolBarCtrl().SetDisabledImageList(imageList);
                        btn.idCommand = idgenerator->id;
                        btn.iBitmap = index;
                        btn.fsStyle = TBSTYLE_BUTTON;


                        //Hotimage Image List
                        imageList = toolbar.second->GetToolBarCtrl().GetHotImageList();
                        index = imageList->GetImageCount();
                        if (!FileExist(itemmenu.mToolbar.iconPathHot.c_str()))
                        {
                            bmp->Attach(LoadImage(AfxGetInstanceHandle(), itemmenu.mToolbar.iconPathEnable.c_str(), IMAGE_BITMAP, 32, 32, (LR_DEFAULTSIZE | LR_CREATEDIBSECTION | LR_LOADFROMFILE)));
                        }
                        else
                        {
                            bmp->Attach(LoadImage(AfxGetInstanceHandle(), itemmenu.mToolbar.iconPathHot.c_str(), IMAGE_BITMAP, 32, 32, (LR_DEFAULTSIZE | LR_CREATEDIBSECTION | LR_LOADFROMFILE)));
                        }
                        imageList->Add(bmp, RGB(255, 255, 255));
                        bmp->Detach();
                        toolbar.second->GetToolBarCtrl().SetHotImageList(imageList);
                        btn.idCommand = idgenerator->id;
                        btn.iBitmap = index;
                        btn.fsStyle = TBSTYLE_BUTTON;

                        toolbar.second->GetToolBarCtrl().InsertButton(btnCount, &btn);
                        break;
                    }
                }

            }
            break;
        }


    }

}