Esempio n. 1
0
void ToolbarManager::applyTo(CReBarCtrl& ReBar, const string& aName) const {
	dcassert(ReBar.IsWindow());

	ToolbarEntry* t = getToolbarEntry(aName);
	if(t != NULL) {
		StringTokenizer<string> id(t->getID(), ',');
		StringList& idList = id.getTokens();
		StringTokenizer<string> cx(t->getCX(), ',');
		StringList& cxList = cx.getTokens();
		StringTokenizer<string> bl(t->getBreakLine(), ',');
		StringList& blList = bl.getTokens();

                const int bandCount = min(t->getBandCount(), (int) ReBar.GetBandCount());
		for(int i = 0; i < bandCount; i++) {
			ReBar.MoveBand(ReBar.IdToIndex(Util::toInt(idList[i])), i);
			REBARBANDINFO rbi;
			rbi.cbSize = sizeof(rbi);
			rbi.fMask = RBBIM_ID | RBBIM_SIZE | RBBIM_STYLE;
			ReBar.GetBandInfo(i, &rbi);

			rbi.cx = Util::toInt(cxList[i]);
			if(Util::toInt(blList[i]) > 0)
				rbi.fStyle|=RBBS_BREAK;
			else
				rbi.fStyle&= (~RBBS_BREAK);

			ReBar.SetBandInfo(i, &rbi);
		}
	}
}
Esempio n. 2
0
void ToolbarManager::getFrom(CReBarCtrl& ReBar, const string& aName) {
	dcassert(ReBar.IsWindow());
	removeToolbarEntry(getToolbarEntry(aName));

	ToolbarEntry* t = new ToolbarEntry();
	string id, cx, bl,dl;
	t->setName(aName);
	t->setBandCount(ReBar.GetBandCount());

	for(int i = 0; i < t->getBandCount(); i++) {
		dl = ((i > 0) ? "," : "");
		REBARBANDINFO rbi;
		rbi.cbSize = sizeof(rbi);
		rbi.fMask = RBBIM_ID | RBBIM_SIZE | RBBIM_STYLE;
		ReBar.GetBandInfo(i, &rbi);
		id += dl + Util::toString(rbi.wID);
		cx += dl + Util::toString(rbi.cx);
		bl += dl + (((rbi.fStyle & RBBS_BREAK) != 0) ? "1" : "0");

	}

	t->setID(id);
	t->setCX(cx);
	t->setBreakLine(bl);
	toolbarEntries.push_back(t);
}