示例#1
0
void Modern_InitButtons()
{
	for (int i = 0; i < SIZEOF(BTNS); i++) {
		TTBButton tbb = { 0 };
		tbb.cbSize = sizeof(tbb);

		if (BTNS[i].pszButtonID) {
			tbb.name = LPGEN(BTNS[i].pszButtonName);
			tbb.pszService = BTNS[i].pszServiceName;
			tbb.pszTooltipUp = LPGEN(BTNS[i].pszTooltipUp);
			tbb.pszTooltipDn = LPGEN(BTNS[i].pszTooltipDn);

			char buf[255];
			if (i != 0) {
				mir_snprintf(buf, SIZEOF(buf), "%s%s%s", TTB_OPTDIR, BTNS[i].pszButtonID, "_dn");
				tbb.hIconHandleUp = RegisterIcolibIconHandle(buf, "Toolbar", BTNS[i].pszTooltipUp, _T("icons\\toolbar_icons.dll"), BTNS[i].icoDefIdx, g_hInst, BTNS[i].defResource);
			}
			else tbb.hIconHandleUp = RegisterIcolibIconHandle(buf, "Toolbar", BTNS[i].pszTooltipUp, NULL, 0, NULL, SKINICON_OTHER_MAINMENU);

			if (BTNS[i].pszTooltipDn) {
				mir_snprintf(buf, SIZEOF(buf), "%s%s%s", TTB_OPTDIR, BTNS[i].pszButtonID, "_up");
				tbb.hIconHandleDn = RegisterIcolibIconHandle(buf, "Toolbar", BTNS[i].pszTooltipDn, _T("icons\\toolbar_icons.dll"), BTNS[i].icoDefIdx + 1, g_hInst, BTNS[i].defResource2);
			}
			else tbb.hIconHandleDn = NULL;
		}
		else tbb.dwFlags |= TTBBF_ISSEPARATOR;

		tbb.dwFlags |= (BTNS[i].bVisByDefault ? TTBBF_VISIBLE : 0);
		BTNS[i].hButton = TopToolbar_AddButton(&tbb);
	}

	SetButtonPressed(3, db_get_b(NULL, "CList", "HideOffline", SETTING_HIDEOFFLINE_DEFAULT));
	SetButtonPressed(6, db_get_b(NULL, "CList", "UseGroups", SETTING_USEGROUPS_DEFAULT));
	SetButtonPressed(7, db_get_b(NULL, "Skin", "UseSound", SETTING_ENABLESOUNDS_DEFAULT));
}
示例#2
0
static void   sttRegisterToolBarButton(char * pszButtonID, char * pszButtonName, char * pszServiceName,
									   char * pszTooltipUp, char * pszTooltipDn, int icoDefIdx, int defResource, int defResource2, BOOL bVisByDefault)
{
	TBButton tbb;
	static int defPos=0;
	defPos+=100;
	memset(&tbb,0, sizeof(TBButton));
	tbb.cbSize=sizeof(TBButton);
	if (pszButtonID) 	
	{
		tbb.defPos=defPos;
		tbb.pszButtonID=pszButtonID;
		tbb.pszButtonName=pszButtonName;
		tbb.pszServiceName=pszServiceName;
		tbb.pszTooltipUp=pszTooltipUp;
		tbb.pszTooltipDn=pszTooltipDn;
		{
			char buf[255];
			mir_snprintf(buf,SIZEOF(buf),"%s%s%s",TOOLBARBUTTON_ICONIDPREFIX, pszButtonID, TOOLBARBUTTON_ICONIDPRIMARYSUFFIX);
			tbb.hPrimaryIconHandle=RegisterIcolibIconHandle( buf, "ToolBar", pszButtonName , _T("icons\\toolbar_icons.dll"),-icoDefIdx, g_hInst, defResource );
		}
		if (pszTooltipDn)
		{
			char buf[255];
			mir_snprintf(buf,SIZEOF(buf),"%s%s%s",TOOLBARBUTTON_ICONIDPREFIX, pszButtonID, TOOLBARBUTTON_ICONIDSECONDARYSUFFIX);
			tbb.hSecondaryIconHandle=RegisterIcolibIconHandle( buf, "ToolBar", pszTooltipDn , _T("icons\\toolbar_icons.dll"),-(icoDefIdx+1), g_hInst, defResource2 );
		}
	}
	else 
	{		
		if ( pszButtonName[0] == 'D' ) tbb.tbbFlags=TBBF_FLEXSIZESEPARATOR;
		else tbb.tbbFlags=TBBF_ISSEPARATOR;
	}
	tbb.tbbFlags|=(bVisByDefault ? TBBF_VISIBLE :0 );
	CallService(MS_TB_ADDBUTTON,0, (LPARAM)&tbb);
}