Esempio n. 1
0
void CSearchParamsWnd::SetAllIcons()
{
	CImageList iml;
	iml.Create(16, 16, theApp.m_iDfltImageListColorFlags | ILC_MASK, 0, 1);
	iml.Add(CTempIconLoader(_T("SearchMethod_KadServer")));
	iml.Add(CTempIconLoader(_T("SearchMethod_SERVER")));
	iml.Add(CTempIconLoader(_T("SearchMethod_GLOBAL")));
	iml.Add(CTempIconLoader(_T("SearchMethod_KADEMLIA")));
	iml.Add(CTempIconLoader(_T("SearchMethod_FILEDONKEY")));
	m_ctlMethod.SetImageList(&iml);
	m_imlSearchMethods.DeleteImageList();
	m_imlSearchMethods.Attach(iml.Detach());

	iml.Create(16, 16, theApp.m_iDfltImageListColorFlags | ILC_MASK, 0, 1);
	iml.Add(CTempIconLoader(_T("SearchFileType_Any")));
	iml.Add(CTempIconLoader(_T("SearchFileType_Archive")));
	iml.Add(CTempIconLoader(_T("SearchFileType_Audio")));
	iml.Add(CTempIconLoader(_T("SearchFileType_CDImage")));
	iml.Add(CTempIconLoader(_T("SearchFileType_Picture")));
	iml.Add(CTempIconLoader(_T("SearchFileType_Program")));
	iml.Add(CTempIconLoader(_T("SearchFileType_Video")));
	iml.Add(CTempIconLoader(_T("SearchFileType_Document")));
	iml.Add(CTempIconLoader(_T("AABCollectionFileType")));
	m_ctlFileType.SetImageList(&iml);
	m_imlFileType.DeleteImageList();
	m_imlFileType.Attach(iml.Detach());
}
Esempio n. 2
0
void CEditDelayed::OnInit(CHeaderCtrl* pColumnHeader, CArray<int, int>* paIgnoredColums)
{
    SetEditRect(false);
    CRect rectWindow;
    GetClientRect(rectWindow);

    m_pctrlColumnHeader = pColumnHeader;
    m_hCursor = LoadCursor(NULL, IDC_ARROW);
    m_nCurrentColumnIdx = 0;

    CImageList* pImageList = new CImageList();
    pImageList->Create(16, 16, theApp.m_iDfltImageListColorFlags | ILC_MASK, 0, 1);
    if (pColumnHeader != NULL)
        pImageList->Add(CTempIconLoader(_T("SEARCHEDIT")));
    else
        pImageList->Add(CTempIconLoader(_T("KADNODESEARCH")));
    m_iwColumn.SetImageList(pImageList);
    m_iwColumn.Create(_T(""), WS_CHILD | WS_VISIBLE, CRect(0, 0, ICON_LEFTSPACE, rectWindow.bottom), this, 1);

    pImageList = new CImageList();
    pImageList->Create(16, 16, theApp.m_iDfltImageListColorFlags | ILC_MASK, 0, 1);
    pImageList->Add(CTempIconLoader(_T("FILTERCLEAR1")));
    pImageList->Add(CTempIconLoader(_T("FILTERCLEAR2")));
    m_iwReset.SetImageList(pImageList);
    m_iwReset.Create(_T(""), WS_CHILD , CRect(0, 0, ICON_LEFTSPACE, rectWindow.bottom), this, 1);

    if (paIgnoredColums != NULL)
        m_aIgnoredColums.Copy(*paIgnoredColums);
    ShowColumnText(true);
}
Esempio n. 3
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. 4
0
void CMainFrame::InitializeDefaultPanes(void)
{
	CRect rcClient;
	this->GetClientRect(&rcClient);

	CRect rcFloat(0,0,400,200);
	CRect rcDock(0,0,220,/*rcClient.Width()-200*/200);
	CRect rcFileTreeDock(0,0,220,10);
	CRect rcItemListDock(0,0,150,300);
	CRect rcvgmfileDock(0,0,220,/*rcClient.Width()-200*/300);
	CRect rcCollListDock(150,150,220,/*rcClient.Width()-200*/100);
	CRect rcLogListDock(0,0,400,80);
	//CRect rcDock();

	CImageList ilIcons;
	ilIcons.Create(16, 16, ILC_MASK | ILC_COLOR24, 0, 0);
	CBitmap bmpIcons;
	bmpIcons.LoadBitmap(IDB_TAB_ICONS);
	ilIcons.Add((HBITMAP)bmpIcons, RGB(0,255,0));

	HWND hWndFirst = 
	//CreateVGMFilesTreeViewPane(VGMFilesView, _T("Detected VGM Files"), ilIcons.ExtractIcon(10), rcFloat, rcvgmfileDock, NULL);
	CreateVGMFileListViewPane(theVGMFileListView, _T("Detected Music Files"), ilIcons.ExtractIcon(10), rcFloat, rcvgmfileDock, NULL);
	CreateFileListViewPane(rawFileListView,      _T("Scanned Files"),      ilIcons.ExtractIcon(6),  rcFloat, rcFileTreeDock, NULL);
	CreateVGMCollListViewPane(theVGMCollListView, _T("Collections"), ilIcons.ExtractIcon(10), rcFloat, rcCollListDock, NULL);

	//this->CreatePlainTextOutputPane(m_OutputView,        _T("Output"),         ilIcons.ExtractIcon(3),  rcFloat, rcDock, hWndFirst);
	//this->CreatePlainTextOutputPane(m_FindResultsView,   _T("Find Results 1"), ilIcons.ExtractIcon(11), rcFloat, rcDock, hWndFirst);
	CreateCollDialogPane(theCollDialog, _T("Coll Info"),  rcFloat, rcDock, NULL);

	CreateLogListViewPane(theLogListView, _T("Logs"), ilIcons.ExtractIcon(10), rcFloat, rcLogListDock, NULL);

}
Esempio n. 5
0
int CGuiFrameWnd::InitToolBar(UINT uIDMenu)
{

	if (!m_wndToolBar.CreateEx(this, TBSTYLE_FLAT, WS_CHILD | WS_VISIBLE | CBRS_TOP
		| CBRS_GRIPPER | CBRS_TOOLTIPS | CBRS_FLYBY | CBRS_SIZE_DYNAMIC,CRect(0,0,0,0),uIDMenu) ||
		!m_wndToolBar.LoadToolBar(uIDMenu))
		{
		TRACE0("Failed to create toolbar\n");
		return -1; // fail to create
	}
// new code:  Serge Koroleuve

	IMAGEINFO ii;
	m_wndToolBar.GetToolBarCtrl().GetImageList()->GetImageInfo(0, &ii);
	int cx = ii.rcImage.right - ii.rcImage.left;
	int cy = ii.rcImage.bottom - ii.rcImage.top;
	int nCount = m_wndToolBar.GetToolBarCtrl().GetImageList()->GetImageCount();

	CImageList imageList;
	CBitmap bitmap;

	bitmap.LoadBitmap(uIDMenu);
	imageList.Create(cx, cy, ILC_COLORDDB|ILC_MASK, nCount, 0);
	imageList.Add(&bitmap, RGB(192,192,192));
	m_wndToolBar.SendMessage(TB_SETIMAGELIST, 0, (LPARAM)imageList.m_hImageList);
	imageList.Detach();
	bitmap.Detach();
// end of new code
return 0;
}
Esempio n. 6
0
CPlayerToolBar::CPlayerToolBar()
	: fDisableImgListRemap(false)
	, m_pButtonsImages(NULL)
	, m_hDXVAIcon(NULL)
{
	HBITMAP hBmp = CMPCPngImage::LoadExternalImage(L"gpu", IDB_DXVA_ON, IMG_TYPE::UNDEF);
	BITMAP bm = { 0 };
	::GetObject(hBmp, sizeof(bm), &bm);

	if (CMPCPngImage::FileExists(CString(L"gpu")) && (bm.bmHeight > 32 || bm.bmWidth > 32)) {
		hBmp = CMPCPngImage::LoadExternalImage(L"", IDB_DXVA_ON, IMG_TYPE::UNDEF);
		::GetObject(hBmp, sizeof(bm), &bm);
	}

	if (bm.bmWidth <= 32 && bm.bmHeight <= 32) {
		CBitmap *bmp = DNew CBitmap();
		bmp->Attach(hBmp);

		CImageList *pButtonDXVA = DNew CImageList();
		pButtonDXVA->Create(bm.bmWidth, bm.bmHeight, ILC_COLOR32 | ILC_MASK, 1, 0);
		pButtonDXVA->Add(bmp, static_cast<CBitmap*>(NULL));

		m_hDXVAIcon = pButtonDXVA->ExtractIcon(0);

		delete pButtonDXVA;
		delete bmp;
	}

	iDXVAIconHeight	= bm.bmHeight;
	iDXVAIconWidth	= bm.bmWidth;

	DeleteObject(hBmp);
}
Esempio n. 7
0
HICON CXTPIconHandle::ScaleToFit(HICON hIcon, CSize desiredExtent)
{
	if (desiredExtent == CSize(0))
	{
		// invalid arg
		return NULL;
	}

	CSize realExtent = GetExtent(hIcon);
	if (realExtent == CSize(0))
	{
		// icon destroyed or not created yet
		return NULL;
	}


	// ensure icon retains aspect after scaling
	int delta = desiredExtent.cx * realExtent.cy - desiredExtent.cy * realExtent.cx;
	if (delta < 0)
	{
		desiredExtent.cy = MulDiv(realExtent.cy, desiredExtent.cx, realExtent.cx);
	}
	else
	if (delta > 0)
	{
		desiredExtent.cx = MulDiv(realExtent.cx, desiredExtent.cy, realExtent.cy);
	}

	// scale the icon
	CImageList images;
	VERIFY(images.Create(desiredExtent.cx, desiredExtent.cy, ILC_COLOR32 | ILC_MASK, 1, 1));
	images.Add(hIcon);
	return images.ExtractIcon(0);
}
void CDownloadClientsCtrl::Init()
{
	SetName(_T("DownloadClientsCtrl"));
	CImageList ilDummyImageList; //dummy list for getting the proper height of listview entries
	ilDummyImageList.Create(1, theApp.GetSmallSytemIconSize().cy,theApp.m_iDfltImageListColorFlags|ILC_MASK, 1, 1); 
	SetImageList(&ilDummyImageList, LVSIL_SMALL);
	ASSERT( (GetStyle() & LVS_SHAREIMAGELISTS) == 0 );
	ilDummyImageList.Detach();

	SetExtendedStyle(LVS_EX_FULLROWSELECT);

	InsertColumn(0,	GetResString(IDS_QL_USERNAME), LVCFMT_LEFT, 165);
	InsertColumn(1,	GetResString(IDS_CD_CSOFT), LVCFMT_LEFT, 90); 
	InsertColumn(2,	GetResString(IDS_FILE), LVCFMT_LEFT, 235);
	InsertColumn(3,	GetResString(IDS_DL_SPEED), LVCFMT_LEFT, 65);
	InsertColumn(4, GetResString(IDS_AVAILABLEPARTS), LVCFMT_LEFT, 150);
	InsertColumn(5,	GetResString(IDS_CL_TRANSFDOWN), LVCFMT_LEFT, 115);
	InsertColumn(6,	GetResString(IDS_CL_TRANSFUP), LVCFMT_LEFT, 115);
	InsertColumn(7,	GetResString(IDS_META_SRCTYPE), LVCFMT_LEFT, 60);


	SetAllIcons();
	Localize();
	LoadSettings();

	// Barry - Use preferred sort order from preferences
	SetSortArrow();
}
Esempio n. 9
0
BOOL CFindDlg::OnInitDialog()
{
	CDialog::OnInitDialog();
	m_FindMsg = RegisterWindowMessage(FINDMSGSTRING);

	m_FindCombo.LoadHistory(_T("Software\\TortoiseGit\\History\\Find"), _T("Search"));

	m_FindCombo.SetFocus();

	this->AddAnchor(IDC_STATIC_FIND, TOP_LEFT, TOP_RIGHT);
	this->AddAnchor(IDC_FINDCOMBO, TOP_LEFT, TOP_RIGHT);
	this->AddAnchor(IDOK, TOP_RIGHT);
	this->AddAnchor(IDCANCEL, TOP_RIGHT);
	this->AddAnchor(IDC_STATIC_GROUP_REF, TOP_LEFT, BOTTOM_RIGHT);
	this->AddAnchor(IDC_STATIC_FILTER, BOTTOM_LEFT);
	this->AddAnchor(IDC_EDIT_FILTER, BOTTOM_LEFT, BOTTOM_RIGHT);
	this->AddAnchor(IDC_LIST_REF, TOP_LEFT, BOTTOM_RIGHT);
	this->AddOthersToAnchor();

	EnableSaveRestore(_T("FindDlg"));

	CImageList *imagelist = new CImageList();
	imagelist->Create(IDB_BITMAP_REFTYPE,16,3,RGB(255,255,255));
	this->m_ctrlRefList.SetImageList(imagelist,LVSIL_SMALL);

	CRect rect;
	m_ctrlRefList.GetClientRect(&rect);

	this->m_ctrlRefList.InsertColumn(0,_T("Ref"),0, rect.Width()-50);
	g_Git.GetRefList(m_RefList);
	AddToList();
	return FALSE;
}
Esempio n. 10
0
//***************************************************************************************
BOOL CBCGPropertySheet::SetIconsList (UINT uiImageListResID, int cx,
							  COLORREF clrTransparent)
{
	ASSERT_VALID(this);

	LPCTSTR lpszResourceName = MAKEINTRESOURCE (uiImageListResID);
	ASSERT(lpszResourceName != NULL);

	HBITMAP hbmp = (HBITMAP) ::LoadImage (
		AfxGetResourceHandle (),
		lpszResourceName,
		IMAGE_BITMAP,
		0, 0,
		LR_CREATEDIBSECTION);

	if (hbmp == NULL)
	{
		TRACE(_T("Can't load bitmap: %x\n"), uiImageListResID);
		return FALSE;
	}

	CImageList icons;
	m_bAlphaBlendIcons = FALSE;

	BITMAP bmpObj;
	::GetObject (hbmp, sizeof (BITMAP), &bmpObj);

	UINT nFlags = (clrTransparent == (COLORREF) -1) ? 0 : ILC_MASK;

	switch (bmpObj.bmBitsPixel)
	{
	case 4:
	default:
		nFlags |= ILC_COLOR4;
		break;

	case 8:
		nFlags |= ILC_COLOR8;
		break;

	case 16:
		nFlags |= ILC_COLOR16;
		break;

	case 24:
		nFlags |= ILC_COLOR24;
		break;

	case 32:
		nFlags |= ILC_COLOR32;
		m_bAlphaBlendIcons = TRUE;
		break;
	}

	icons.Create (cx, bmpObj.bmHeight, nFlags, 0, 0);
	icons.Add (CBitmap::FromHandle (hbmp), clrTransparent);

	SetIconsList (icons);
	return TRUE;
}
Esempio n. 11
0
void CClientListCtrl::Init()
{
	SetName(_T("ClientListCtrl"));
	CImageList ilDummyImageList; //dummy list for getting the proper height of listview entries
	ilDummyImageList.Create(1, theApp.GetSmallSytemIconSize().cy,theApp.m_iDfltImageListColorFlags|ILC_MASK, 1, 1); 
	SetImageList(&ilDummyImageList, LVSIL_SMALL);
	ASSERT( (GetStyle() & LVS_SHAREIMAGELISTS) == 0 );
	ilDummyImageList.Detach();

	SetExtendedStyle(LVS_EX_FULLROWSELECT);
	InsertColumn(0,GetResString(IDS_QL_USERNAME),LVCFMT_LEFT,150,0);
	InsertColumn(1,GetResString(IDS_CL_UPLOADSTATUS),LVCFMT_LEFT,150,1);
	InsertColumn(2,GetResString(IDS_CL_TRANSFUP),LVCFMT_LEFT,150,2);
	InsertColumn(3,GetResString(IDS_CL_DOWNLSTATUS),LVCFMT_LEFT,150,3);
	InsertColumn(4,GetResString(IDS_CL_TRANSFDOWN),LVCFMT_LEFT,150,4);
	InsertColumn(5,GetResString(IDS_CD_CSOFT),LVCFMT_LEFT,150,5);
	InsertColumn(6,GetResString(IDS_CONNECTED),LVCFMT_LEFT,150,6);
	CString coltemp;
	coltemp=GetResString(IDS_CD_UHASH);coltemp.Remove(':');
	InsertColumn(7,coltemp,LVCFMT_LEFT,150,7);
	
	SetAllIcons();
	Localize();
	LoadSettings();
	SetSortArrow();
	SortItems(SortProc, GetSortItem()+ (GetSortAscending()? 0:100));
}
Esempio n. 12
0
BOOL CuDlgIpmPageLockLists::OnInitDialog() 
{
	CDialog::OnInitDialog();
	VERIFY (m_cListCtrl.SubclassDlgItem (IDC_LIST1, this));
	//
	// Initalize the Column Header of CListCtrl (CuListCtrl)
	LSCTRLHEADERPARAMS2 lsp[LAYOUT_NUMBER] =
	{
		{IDS_TC_LOCKLIST_ID, 91,  LVCFMT_LEFT, FALSE},
		{IDS_TC_SESSION,     60,  LVCFMT_LEFT, FALSE},
		{IDS_TC_LOCKS,       45,  LVCFMT_LEFT, FALSE},
		{IDS_TC_LOGICAL,     50,  LVCFMT_LEFT, FALSE},
		{IDS_TC_MAXL,        40,  LVCFMT_LEFT, FALSE},
		{IDS_TC_STATUS,     200,  LVCFMT_LEFT, FALSE}
	};
	
	InitializeHeader2(&m_cListCtrl, LVCF_FMT|LVCF_SUBITEM|LVCF_TEXT|LVCF_WIDTH, lsp, LAYOUT_NUMBER);

	m_ImageList.Create(IDB_TM_LOCKLIST, 16, 1, RGB(255, 0, 255));
	CImageList im;
	if (im.Create(IDB_TM_LOCKLIST_BLOCKED_YES, 16, 1, RGB(255, 0, 255)))
	{
		HICON hIconBlock = im.ExtractIcon(0);
		if (hIconBlock)
		{
			m_ImageList.Add (hIconBlock);
			DestroyIcon (hIconBlock);
		}
	}
	m_cListCtrl.SetImageList(&m_ImageList, LVSIL_SMALL);

	return TRUE;  // return TRUE unless you set the focus to a control
	              // EXCEPTION: OCX Property Pages should return FALSE
}
BOOL CDialogEpsGraph::OnInitDialog() 
{
	CDialog::OnInitDialog();
	
	CImageList* pImageList = new CImageList();
	pImageList->Create(16,16,ILC_COLOR|ILC_MASK, 4, 4);

	pImageList->Add(AfxGetApp()->LoadIcon(IDI_ICON_GREEN));
	pImageList->Add(AfxGetApp()->LoadIcon(IDI_ICON_RED));
	pImageList->Add(AfxGetApp()->LoadIcon(IDI_ICON_BLUE));
	pImageList->Add(AfxGetApp()->LoadIcon(IDI_ICON_YELLOW));
	m_Tab.SetImageList(pImageList);

	m_Tab.InsertItem(0, "EPS", 0);
	m_Tab.InsertItem(1, "ROC", 1);
	m_Tab.InsertItem(2, "ROE", 2);

	m_pGraph = new CViewGraph();
	m_pGraph->Create(NULL, NULL, WS_CHILD, CRect(0,0,1,1), this, 23457);
	m_pGraph->ShowWindow(SW_SHOW);

	InitChartEPS();	

	Resize();
	return TRUE; 
}
Esempio n. 14
0
void CQueueListCtrl::Init()
{
    SetName(_T("QueueListCtrl"));
    CImageList ilDummyImageList; //dummy list for getting the proper height of listview entries
    ilDummyImageList.Create(1, theApp.GetSmallSytemIconSize().cy,theApp.m_iDfltImageListColorFlags|ILC_MASK, 1, 1);
    SetImageList(&ilDummyImageList, LVSIL_SMALL);
    ASSERT( (GetStyle() & LVS_SHAREIMAGELISTS) == 0 );
    ilDummyImageList.Detach();

    SetExtendedStyle(LVS_EX_FULLROWSELECT);
    InsertColumn(0,GetResString(IDS_QL_USERNAME),LVCFMT_LEFT,150,0);
    InsertColumn(1,GetResString(IDS_FILE),LVCFMT_LEFT,275,1);
    InsertColumn(2,GetResString(IDS_FILEPRIO),LVCFMT_LEFT,110,2);
    InsertColumn(3,GetResString(IDS_QL_RATING),LVCFMT_LEFT,60,3);
    InsertColumn(4,GetResString(IDS_SCORE),LVCFMT_LEFT,60,4);
    InsertColumn(5,GetResString(IDS_ASKED),LVCFMT_LEFT,60,5);
    InsertColumn(6,GetResString(IDS_LASTSEEN),LVCFMT_LEFT,110,6);
    InsertColumn(7,GetResString(IDS_ENTERQUEUE),LVCFMT_LEFT,110,7);
    InsertColumn(8,GetResString(IDS_BANNED),LVCFMT_LEFT,60,8);
    InsertColumn(9,GetResString(IDS_UPSTATUS),LVCFMT_LEFT,100,9);
//==>Modversion [shadow2004]
#ifdef MODVERSION
    InsertColumn(10,GetResString(IDS_CLIENTSOFTWARE),LVCFMT_LEFT,100,10);
#endif //Modversion
//<==Modversion [shadow2004]

    SetAllIcons();
    Localize();
    LoadSettings();
    // Barry - Use preferred sort order from preferences
    SetSortArrow();
    SortItems(SortProc, GetSortItem() + (GetSortAscending() ? 0:100));
}
Esempio n. 15
0
inline bool addFile(CListCtrl *lFiles, string filename, __int64 size){
	char buffer[16];
	HICON ico = NULL;
	int ico_id;
	CImageList *imgLst = NULL;

	if(size >= (__int64)4*1024*1024*1024){
		MessageBox(0, loadString(IDS_TOO_BIG_FILE), "KGB Archiver", 0);
		return false;
	}

	ico = getIcon(filename);

	if(ico != NULL){
		imgLst = lFiles->GetImageList(LVSIL_SMALL);
		if(imgLst == NULL){
			imgLst = new CImageList();
			imgLst->Create(16, 16, ILC_COLORDDB, 0, INT_MAX);
			imgLst->SetBkColor(0x00FFFFFF);
		}
		ico_id = imgLst->Add(ico);
		lFiles->SetImageList(imgLst, LVSIL_SMALL);
		lFiles->InsertItem(lFiles->GetItemCount(), "", ico_id);
	}else
		lFiles->InsertItem(lFiles->GetItemCount(), ""); 


	lFiles->SetItemText(lFiles->GetItemCount()-1, 0, filename.c_str());
	
	sprintf(buffer, "%s", convertUnits(size));
	lFiles->SetItemText(lFiles->GetItemCount()-1, 1, buffer);

	return true;
}
Esempio n. 16
0
CImageList CObjectUIHandler::GetImageList()
{
	CImageList imageList;
	imageList.Create( 
					64, 32,
//					16, 16,
					ILC_COLOR8|ILC_MASK,
					sizeof(anIconIDs)/sizeof(anIconIDs[0]),
					1);
	for ( int i=0; i < sizeof(anIconIDs)/sizeof(anIconIDs[0]); i++ )
	{
		HICON hIcon = ::LoadIcon( 
							_Module.GetResourceInstance(), 
							MAKEINTRESOURCE(anIconIDs[i]) 
							);
		/* Uncomment this if you want 32x32 icon.
		HICON hIcon = (HICON)::LoadImage(
								_Module.GetResourceInstance(), 
								MAKEINTRESOURCE(anIconIDs[i]), 
								IMAGE_ICON,
								32, 32, LR_DEFAULTCOLOR
								);
								*/
		imageList.AddIcon( hIcon );
	}
	return imageList;
}
Esempio n. 17
0
void CSearchView::CreateTab(CString searchName, UINT cnt, UINT nImage)
{
	// 256 칼라 이상 적용(icon) 
	CImageList imageList;
	CBitmap bitmap;
	bitmap.LoadBitmap(IDB_BITMAP_SEARCH_TAB);
	imageList.Create(16, 16, ILC_COLORDDB  | ILC_MASK, 16, 1);
	imageList.Add(&bitmap, RGB(255, 255, 255)); 
	//m_wndToolBar.SendMessage(TB_SETIMAGELIST, 0, (LPARAM)imageList.m_hImageList);  // 활성이미지
	m_tabSearch.SetImageList(&imageList);
	imageList.Detach();
	bitmap.Detach();

	// 처음에 탭내용이 하나도 없으면 탭컨트롤이 안보이게 설정했으므로 탭컨트롤을 보이게 (처음부터 보이면 모양이 이상해짐)
	m_tabSearch.ShowWindow(TRUE);
	
	
	CString temp;
	temp.Format("%s [%d]", searchName, cnt);
	m_tabSearch.InsertItem(m_nTabCnt, temp, nImage);	
	m_tabSearch.SetCurSel(m_nTabCnt - 1);

	if(cnt == 0  ||  cnt == m_nTabCnt){	// 버튼클릭으로 생성되거나, OnInitialUpdate에서 마지막것만
		
	}
}
Esempio n. 18
0
BOOL CEditButton::Create(CWnd* pWnd, SEARCH_TYPE eType, UINT nMenu)
{
	ASSERT(eType != -1);
	ASSERT_VALID(pWnd);
	m_eType = eType;
	m_nMenu = nMenu;
	m_pWnd = pWnd;
	CWnd* pWndParent = m_pWnd->GetParent();
	ASSERT_VALID(pWndParent);
	
	CRect rc;
	m_pWnd->GetWindowRect(&rc);
	m_pWnd->SetWindowPos(NULL, 0, 0, rc.Width()-23,
		rc.Height(), SWP_NOZORDER|SWP_NOMOVE);
	pWndParent->ScreenToClient(&rc);
	rc.left = rc.right-18;

	DWORD dwStyle = WS_VISIBLE|WS_CHILD|WS_TABSTOP|BS_CENTER|BS_VCENTER;
	switch (m_eType)
	{
	case SEARCH_DIRECTORY:
	case SEARCH_FILE:
		{
			if (CButton::Create(_T("..."), dwStyle, rc,
				pWndParent, GetNextID(pWndParent)))
			{
				SetWindowPos(m_pWnd, 0,0,0,0, SWP_NOSIZE|SWP_NOMOVE);
				EnableWindow(m_pWnd->IsWindowEnabled());
				SetFont(&m_Font);
				return TRUE;
			}
		}

	case SEARCH_POPUP:
		{
			if (CButton::Create(_T("..."), dwStyle|BS_ICON, rc,
				pWndParent, GetNextID(pWndParent)))
			{
				SetWindowPos(m_pWnd, 0,0,0,0, SWP_NOSIZE|SWP_NOMOVE);
				EnableWindow(m_pWnd->IsWindowEnabled());
				SetFont(&m_Font);

				CImageList imageList;
				CBitmap    bitmap;

				bitmap.LoadBitmap(IDB_BTN_ARROW);
				imageList.Create(15, 17, ILC_COLORDDB|ILC_MASK, 1, 1);
				imageList.Add(&bitmap, RGB(255,0,255));

				SetIcon(imageList.ExtractIcon(0));

				imageList.Detach();
				bitmap.Detach();
				return TRUE;
			}
		}
	}

	return FALSE;
}
Esempio n. 19
0
BOOL CTrueColorToolBar::SetTrueColorToolBar(UINT uToolBarType, 
							     	        UINT uToolBar,
										    int  nBtnWidth)
{
	CImageList	cImageList;
	CBitmap		cBitmap;
	BITMAP		bmBitmap;
	
	if (!cBitmap.Attach(LoadImage(AfxGetResourceHandle(), MAKEINTRESOURCE(uToolBar),
								  IMAGE_BITMAP, 0, 0,
								  LR_DEFAULTSIZE|LR_CREATEDIBSECTION)) ||
	    !cBitmap.GetBitmap(&bmBitmap))
		return FALSE;

	CSize		cSize(bmBitmap.bmWidth, bmBitmap.bmHeight); 
	int			nNbBtn	= cSize.cx/nBtnWidth;
	RGBTRIPLE*	rgb		= (RGBTRIPLE*)(bmBitmap.bmBits);
	COLORREF	rgbMask	= RGB(rgb[0].rgbtRed, rgb[0].rgbtGreen, rgb[0].rgbtBlue);
	
	if (!cImageList.Create(nBtnWidth, cSize.cy, ILC_COLOR24|ILC_MASK, nNbBtn, 0))
		return FALSE;
	
	if (cImageList.Add(&cBitmap, rgbMask) == -1)
		return FALSE;

	SendMessage(uToolBarType, 0, (LPARAM)cImageList.m_hImageList);
	cImageList.Detach(); 
	cBitmap.Detach();
	
	return TRUE;
}
Esempio n. 20
0
BOOL CDropDownButton::Init(bool bSingleDropDownBtn, bool bWholeDropDown)
{
	DeleteAllButtons();
	m_bSingleDropDownBtn = bSingleDropDownBtn;

	// If a toolbar control was created indirectly via a dialog resource one can not
	// add any buttons without setting an image list before. (?)
	// So, for this to work, we have to attach an image list to the toolbar control!
	// The image list can be empty, and it does not need to be used at all, but it has
	// to be attached.
	CImageList* piml = GetImageList();
	if (piml == NULL || piml->m_hImageList == NULL)
	{
		CImageList iml;
		iml.Create(16, 16, ILC_COLOR, 0, 0);
		SetImageList(&iml);
		iml.Detach();
	}
	if (m_bSingleDropDownBtn)
	{
		TBBUTTON atb[1] = {0};
		atb[0].iBitmap = -1;
		atb[0].idCommand = GetWindowLong(m_hWnd, GWL_ID);
		atb[0].fsState = TBSTATE_ENABLED;
		atb[0].fsStyle = m_bSingleDropDownBtn ? (bWholeDropDown ? BTNS_WHOLEDROPDOWN : BTNS_DROPDOWN) : BTNS_BUTTON;
		atb[0].iString = -1;
		VERIFY( AddButtons(1, atb) );

		ResizeToMaxWidth();
		SetExtendedStyle(TBSTYLE_EX_DRAWDDARROWS);
	}
	return TRUE;
}
Esempio n. 21
0
void CDocMgr::InitListCtrlEx(void)
{
	CImageList img;
	img.Create(1, 21, ILC_COLOR8|ILC_MASK,2,2);
	img.Add(AfxGetApp()->LoadIcon(IDR_MAINFRAME));
	m_List.SetImageList(&img,LVSIL_SMALL);
	m_List.SetExtendedStyle( LVS_EX_GRIDLINES|LVS_EX_FULLROWSELECT );
	m_List.InsertColumn( ColALIAS, _T("名称"),LVCFMT_LEFT,120);
	m_List.InsertColumn( ColENCODE, _T("编码"),LVCFMT_LEFT,120);
	m_List.InsertColumn( ColPAGES, _T("页数"),LVCFMT_LEFT,120); // iPage
    m_List.InsertColumn( ColSIZE, _T("Size"), LVCFMT_LEFT,0);
	m_List.InsertColumn( ColTYPE, _T("Type"),LVCFMT_LEFT,0);
	m_List.InsertColumn( ColTITLE, _T("Title"),LVCFMT_LEFT,0);
	//m_List.InsertColumn( ColUPDATED, _T("Updated"),LVCFMT_LEFT,0);
	m_List.InsertColumn( ColEDITION, _T("Edition"),LVCFMT_LEFT,0);
	m_List.InsertColumn( ColURL, _T("URL"),LVCFMT_LEFT,0);
    m_List.InsertColumn( ColfURL, _T("fURL"), LVCFMT_LEFT, 0);
    m_List.InsertColumn( ColProcType, _T("ProcType"), LVCFMT_LEFT, 0);
    m_List.InsertColumn( ColContent, _T("Content"), LVCFMT_LEFT, 0);
    //m_List.InsertColumn( ColMossSiteURL, _T("MossSiteURL"), LVCFMT_LEFT, 0);
    m_List.InsertColumn( ColFolderName, _T("FolderName"), LVCFMT_LEFT, 0);
    m_List.InsertColumn( ColFileName, _T("FileName"), LVCFMT_LEFT, 0);
    m_List.InsertColumn( ColIsCopy, _T("IsCopy"),LVCFMT_LEFT,0);
    m_List.InsertColumn( ColWorkItemID, _T("WorkItemID"),LVCFMT_LEFT,0);

	m_List.InsertColumn( ColCHKOUT, _T(""),LVCFMT_LEFT,50);		//签出按钮列
	m_List.InsertColumn( ColCHKIN, _T(""),LVCFMT_LEFT,50);		//签入按钮列
	//m_List.InsertColumn( ColDELETE, _T(""),LVCFMT_LEFT,50);		//删除按钮列
}
Esempio n. 22
0
BOOL CMainFrame::CreateToolBar()
{
    const DWORD TOOLBAR_STYLE = WS_CHILD | WS_VISIBLE | CBRS_TOP | CBRS_GRIPPER | CBRS_TOOLTIPS | CBRS_FLYBY | CBRS_SIZE_DYNAMIC;

    // NOTE: LoadToolBar 只能加载 16 色位图, 如果加载 24bit 位图会显示为黑色
    if (!m_ToolBar.CreateEx(this, TBSTYLE_FLAT, TOOLBAR_STYLE) || !m_ToolBar.LoadToolBar(ID_TOOLBAR)) {
        SHOWBMP_TRACE("failed to create toolbar");
        return FALSE;
    }

    // 为 ToolBar 加载 24bit 位图
    CBitmap bmp;
    BITMAP bm;
    CImageList imgList;
    bmp.LoadBitmap(ID_TOOLBAR);
    bmp.GetBitmap(&bm);
    imgList.Create(bm.bmHeight, bm.bmHeight, ILC_COLOR24, bm.bmWidth / bm.bmHeight, 0);
    imgList.Add(&bmp, (CBitmap*) 0);
    m_ToolBar.GetToolBarCtrl().SetImageList(&imgList);
    imgList.Detach();
    bmp.Detach();

    // 使 ToolBar 变为可停靠的
    m_ToolBar.EnableDocking(CBRS_ALIGN_ANY);
    EnableDocking(CBRS_ALIGN_ANY);
    DockControlBar(&m_ToolBar);

    return TRUE;
}
Esempio n. 23
0
CImageList *GetImageList()
{
	static bool bPictureForIcon=0;
	static CBitmap BitmapForIcon2;
	static CBitmap BitmapForIcon3;
	static CBitmap BitmapForIcon4;
	static CBitmap BitmapForIcon5;
	static CBitmap BitmapForIcon6;
	static CBitmap BitmapForIcon7;
	static CBitmap BitmapForIcon8;
	static CImageList PictureForIcon;

	if(bPictureForIcon==0)
	{
		BitmapForIcon2.LoadBitmap(IDB_BITMAP2);
		BitmapForIcon3.LoadBitmap(IDB_BITMAP3);
		BitmapForIcon4.LoadBitmap(IDB_BITMAP4);
		BitmapForIcon5.LoadBitmap(IDB_BITMAP5);
		BitmapForIcon6.LoadBitmap(IDB_BITMAP6);
		BitmapForIcon7.LoadBitmap(IDB_BITMAP7);
		BitmapForIcon8.LoadBitmap(IDB_BITMAP8);
		PictureForIcon.Create(MAKEINTRESOURCE(IDB_BITMAP1), 16, 16, RGB(0,128,128));
		PictureForIcon.Add(&BitmapForIcon2,RGB(0,128,128));
		PictureForIcon.Add(&BitmapForIcon3,RGB(0,128,128));
		PictureForIcon.Add(&BitmapForIcon4,RGB(0,128,128));
		PictureForIcon.Add(&BitmapForIcon5,RGB(0,128,128));
		PictureForIcon.Add(&BitmapForIcon6,RGB(0,128,128));
		PictureForIcon.Add(&BitmapForIcon7,RGB(0,128,128));
		PictureForIcon.Add(&BitmapForIcon8,RGB(0,128,128));
		bPictureForIcon=1;
	}
	return &PictureForIcon;
}
Esempio n. 24
0
BOOL CDeleteMasterApp::InitInstance()
{
//	LOGFONT		lf;
	HANDLE		hMapping;
	BOOL		bPrevInstance = FALSE;
	CString		csError,csCaption;

	csCaption.LoadString (IDS_DM_ERROR);

	hMapping = CreateFileMapping((HANDLE)0xffffffff, NULL, PAGE_READONLY, 0, 32, _T("YGDM2003MAP"));
	if(hMapping)
	{
		if( GetLastError() == ERROR_ALREADY_EXISTS )
			bPrevInstance = TRUE;
	}
	else
	{
		// Some other error; handle error.
		csError.LoadString(IDS_APP_INIT_ERR);
		::MessageBox(NULL,csError,csCaption,MB_OK|MB_ICONSTOP);
		ExitProcess(1);
	}

	if(!bPrevInstance)
	{
		if(!IsUserAdmin())
		{
			csError.LoadString(IDS_NOT_ADMIN);
			::MessageBox(NULL,csError,csCaption,MB_OK|MB_ICONSTOP);
    		return FALSE;
		}
		if(!RegClass())	return FALSE;

		g_imgList_BOX.Create(IDB_BOX,16,0,RGB(255,255,255));
		g_imgList_LIST.Create(IDB_LIST,16,0,RGB(255,255,255));
		g_pFixDiskInfo = NULL;
		g_nDelMothed   = 0;
		g_nWipeMothed  = 0;
		g_bVerify	   = FALSE;
		g_bFormat	   = FALSE;
		g_dwMaxTry	   = 10;

		m_pMainWnd = new CMain();
		m_pMainWnd->ShowWindow(SW_SHOW);
	}
	return TRUE;
}
Esempio n. 25
0
// @pymethod int|win32ui|CreateImageList|Creates an image list.
PyObject *PyCImageList_Create( PyObject *self, PyObject *args )
{
	int cx, cy, nInitial, nGrow;
	COLORREF crMask;
	BOOL bMask;
	CImageList *pList = new PythonImageList();

	if (PyArg_ParseTuple(args, "iiiii", 
			&cx, // @pyparm int|cx||Dimension of each image, in pixels.
			&cy, // @pyparm int|cy||Dimension of each image, in pixels.
			&bMask, // @pyparm int|mask||TRUE if the image contains a mask; otherwise FALSE.
			&nInitial, // @pyparm int|initial||Number of images that the image list initially contains.
			&nGrow)){ // @pyparm int|grow||Number of images by which the image list can grow when the system needs to resize the list to make room for new images. This parameter represents the number of new images the resized image list can contain.
		if (pList->Create(cx, cy, bMask, nInitial, nGrow))
			return ui_assoc_object::make( PyCImageList::type, pList )->GetGoodRet();
		GUI_BGN_SAVE;
		delete pList;
		GUI_END_SAVE;
		RETURN_ERR("PyCImage::Create failed");
		}

	PyErr_Clear();
	BOOL bRet;
	PyObject *obID;
	TCHAR *bitmapID=NULL;
	if (PyArg_ParseTuple(args, "Oiii", 
			&obID, // @pyparmalt1 <o PyResourceId>|bitmapId||Resource name or ID of the bitmap to be associated with the image list.
			&cx, // @pyparmalt1 int|cx||Dimension of each image, in pixels.
			&nGrow, // @pyparmalt1 int|grow||Number of images by which the image list can grow when the system needs to resize the list to make room for new images. This parameter represents the number of new images the resized image list can contain.
			&crMask) // @pyparmalt1 int|crMask||Color used to generate a mask. Each pixel of this color in the specified bitmap is changed to black, and the corresponding bit in the mask is set to one.
		&&PyWinObject_AsResourceId(obID, &bitmapID, FALSE)){
		if (IS_INTRESOURCE(bitmapID))
			bRet = pList->Create(MAKEINTRESOURCE(bitmapID),cx,nGrow,crMask);
		else
			bRet = pList->Create(bitmapID,cx,nGrow,crMask);
		PyWinObject_FreeResourceId(bitmapID);
		if (bRet)
			return ui_assoc_object::make( PyCImageList::type, pList )->GetGoodRet();
		else
			PyErr_SetString(ui_module_error, "PyCImage::Create failed");
		}
	GUI_BGN_SAVE;
	delete pList;
	GUI_END_SAVE;
	return NULL;
}
Esempio n. 26
0
void CXTPEditListBoxToolBar::Initialize(bool bAutoFont/*= true*/)
{
	// Create the ToolTip control.
	m_tooltip.Create(this);
	m_tooltip.Activate(TRUE);

	CImageList imageList;
	imageList.Create(14, 12, ILC_COLOR8 | ILC_MASK, 0, 1);

	CBitmap bmp;
	CXTPResourceManager::AssertValid(XTPResourceManager()->LoadBitmap(&bmp, XTP_IDB_LISTEDIT));
	imageList.Add(&bmp, RGB(255, 0, 255));

	for (int i = 0; i < _countof(m_arButton); ++i)
	{
		if ((!m_bShowNewDeleteButtons) && ((i==0) || (i==1)))
			continue;

		if ((!m_bShowUpDownButtons) && ((i==2) || (i==3)))
			continue;

		if (!m_arButton[i].Create(NULL, WS_CHILD | WS_VISIBLE | BS_ICON | BS_CENTER | BS_VCENTER,
			CRect(0, 0, 0, 0), this, _arButtonID[i]))
		{
			TRACE0("Unable to create edit button.\n");
			continue;
		}

		m_arIcon[i] = imageList.ExtractIcon(i);
		m_arButton[i].SetIcon(CSize(0), m_arIcon[i]);

		CString strToolTip;
		CXTPResourceManager::AssertValid(XTPResourceManager()->LoadString(&strToolTip, _arButtonID[i]));
		// Add tooltips to group buttons.
		m_tooltip.AddTool(&m_arButton[i], strToolTip);

		// make sure the button is Windows XP theme compatible using
		// the toolbar button theme.
		if (m_arButton[i].SetTheme(xtpControlThemeFlat))
		{
			CXTPButtonTheme* pTheme = m_arButton[i].GetTheme();
			if (pTheme)
			{
				pTheme->EnableToolbarStyle(TRUE);
			}
			m_arButton[i].SetUseVisualStyle(TRUE);
		}
	}

	// Move the buttons to their correct location.
	MoveButtons();

	// Set the font for this window.
	if (bAutoFont)
	{
		SetFont(&XTPAuxData().font);
	}
}
Esempio n. 27
0
void CNineShowView::SetSortArrow(CDC *pDC,NineShowData *l_NineShowDat)
{

	int iddd = IDB_1;
	if(!(l_NineShowDat->bAscending)) iddd = IDB_2;
	CImageList list;
	list.Create (iddd,17,1,RGB(255,255,255));
	CPoint p;
	 p.y =(l_NineShowDat->rcTitle.bottom+l_NineShowDat->rcTitle.top)/2-8;
     p.x =l_NineShowDat->rcTitle.right -35;
	list.Draw(pDC,0,p,ILD_TRANSPARENT);
	return;

     CPen *poldpen;
	 CRect rect;

	 CPen pen_white(PS_SOLID,1,RGB(255,255,255));  
	 CPen pen_black(PS_SOLID,1,RGB(0,0,0));     
	 int nBackMode;
     nBackMode=pDC->GetBkMode();
     if(nBackMode==TRANSPARENT) pDC->SetBkMode(OPAQUE);


	 rect.top =(l_NineShowDat->rcTitle.bottom+l_NineShowDat->rcTitle.top)/2-8;
     rect.bottom =(l_NineShowDat->rcTitle.bottom+l_NineShowDat->rcTitle.top)/2+4;
     rect.left =l_NineShowDat->rcTitle.right -17+2;
	 rect.right =l_NineShowDat->rcTitle.right-8+2;


	 poldpen = pDC->SelectObject(&pen_white);
	 if(l_NineShowDat->bAscending)
	 {
		 pDC->MoveTo(rect.left,rect.bottom);
		 pDC->LineTo(rect.right,rect.bottom);
		 pDC->MoveTo(rect.right,rect.bottom);
		 pDC->LineTo((rect.left+rect.right)/2,rect.top);
	 }
	 else
	 {
		 pDC->MoveTo(rect.right,rect.top+4);
		 pDC->LineTo((rect.left+rect.right)/2,rect.bottom+4);
	 }
	 pDC->SelectObject(&pen_black);
     if(l_NineShowDat->bAscending)
	 {
		 pDC->MoveTo(rect.left,rect.bottom);
		 pDC->LineTo((rect.left+rect.right)/2,rect.top);
	 }
	 else
	 {
		 pDC->MoveTo(rect.left,rect.top+4);
		 pDC->LineTo(rect.right,rect.top+4);
		 pDC->MoveTo(rect.left,rect.top+4);
		 pDC->LineTo((rect.left+rect.right)/2,rect.bottom+4);
	 }	 
	 pDC->SelectObject(poldpen);
	 if(nBackMode==TRANSPARENT) pDC->SetBkMode(TRANSPARENT);
} 
Esempio n. 28
0
int CDownloadedListView::OnCreate(LPCREATESTRUCT lpCreateStruct)
{
	LRESULT lRes = DefWindowProc();

	if (Misc::IsVistalater())
		UxTheme_Wrap::SetWindowTheme(m_hWnd, L"Explorer", 0);

	SetExtendedListViewStyle(LVS_EX_FULLROWSELECT | LVS_EX_HEADERDRAGDROP | LVS_EX_INFOTIP | LVS_EX_DOUBLEBUFFER);

	CImageList ImageList;
	ImageList.Create(16, 16, ILC_COLOR32 | ILC_MASK, 2, 1);
	CBitmap bmpOK = AtlLoadBitmap(IDB_DLOK);
	CBitmap	bmpError = AtlLoadBitmap(IDB_DLERROR);
	ImageList.Add(bmpOK, RGB(255, 0, 255));
	ImageList.Add(bmpError, RGB(255, 0, 255));
	SetImageList(ImageList, LVSIL_SMALL);

	struct Column {
		LPCTSTR	columnName;
		int		columnType;
		int		columnFormat;
		int		defaultcolumnWidth;
	};
	Column	clm[] = {
		{ _T("!")			, LVCOLSORT_CUSTOM	, LVCFMT_LEFT	,  20 },
		{ _T("ファイル名")	, LVCOLSORT_TEXT	, LVCFMT_LEFT	, 160 },
		{ _T("URL")			, LVCOLSORT_TEXT	, LVCFMT_LEFT	, 300 },
		{ _T("ファイルパス"), LVCOLSORT_TEXT	, LVCFMT_LEFT	, 300 },
		{ _T("日付")		, LVCOLSORT_TEXT	, LVCFMT_LEFT	, 120 },
		{ _T("サイズ")		, LVCOLSORT_CUSTOM	, LVCFMT_RIGHT	, 100 },
	};

	int nCount = _countof(clm);
	for (int i = 0; i < nCount; ++i) {
		InsertColumn(i, clm[i].columnName, clm[i].columnFormat, clm[i].defaultcolumnWidth);
		SetColumnSortType(i, clm[i].columnType);
	}

	// 設定を読み込む
	CString strIniFile = Misc::GetFullPath_ForExe(_T("Download.ini"));
	CIniFileI pr(strIniFile, _T("DownloadedListView"));
	for (int i = 0; i < nCount; ++i) {
		CString strWidth = _T("ColumnWidth");
		strWidth.Append(i);
		
		SetColumnWidth(i, pr.GetValue(strWidth, clm[i].defaultcolumnWidth));
	}

	unique_ptr<int[]> pColumnOrder(new int[nCount]);
	for (int i = 0; i < nCount; i++) {
		CString strColumnOrder = _T("ColumnOrder");
		strColumnOrder.Append(i);
		pColumnOrder[i] = pr.GetValue(strColumnOrder, i);
	}
	SetColumnOrderArray(nCount, pColumnOrder.get());

	return 0;
}
AFX_INLINE BOOL  CreateImageListA(CImageList& il, UINT nID,CDC* m_DC, long sizeImage = 16)
{
	il.Create(sizeImage, sizeImage, ILC_MASK|ILC_COLOR24, 0, 0);//4,1
	CBitmap bmp;
	VERIFY(bmp.LoadBitmap(nID));
	il.Add(&bmp,RGB(255,0,255)); 
 
	return TRUE;
}
Esempio n. 30
0
void CServerListCtrl::SetAllIcons()
{
	CImageList iml;
	iml.Create(16, 16, theApp.m_iDfltImageListColorFlags | ILC_MASK, 0, 1);
	iml.Add(CTempIconLoader(_T("Server")));
	HIMAGELIST himl = ApplyImageList(iml.Detach());
	if (himl)
		ImageList_Destroy(himl);
}