Exemplo 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);
		}
	}
}
Exemplo n.º 2
0
void CMainFrame::OnViewToolBar(UINT uNotifyCode, int nID, CWindow wndCtl)
{
	static BOOL bVisible = TRUE;	// initially visible
	bVisible = !bVisible;
	CReBarCtrl rebar = m_hWndToolBar;
	int nBandIndex = rebar.IdToIndex(ATL_IDW_BAND_FIRST + 1);	// toolbar is 2nd added band
	rebar.ShowBand(nBandIndex, bVisible);
	UISetCheck(ID_VIEW_TOOLBAR, bVisible);
	UpdateLayout();
}
Exemplo n.º 3
0
LRESULT CMainFrame::OnViewToolBar(WORD /*wNotifyCode*/, WORD /*wID*/, HWND /*hWndCtl*/, BOOL& /*bHandled*/)
{
	static BOOL bVisible = TRUE;	// initially visible
	bVisible = !bVisible;
	CReBarCtrl rebar = m_hWndToolBar;
	int nBandIndex = rebar.IdToIndex(ATL_IDW_BAND_FIRST + 1);	// toolbar is 2nd added band
	rebar.ShowBand(nBandIndex, bVisible);
	UISetCheck(ID_VIEW_TOOLBAR, bVisible);
	UpdateLayout();
	return 0;
}
Exemplo n.º 4
0
LRESULT CMainFrame::OnCreate(UINT /*uMsg*/, WPARAM /*wParam*/, LPARAM /*lParam*/, BOOL& /*bHandled*/)
{
	// create command bar window
	HWND hWndCmdBar = m_CmdBar.Create(m_hWnd, rcDefault, NULL, ATL_SIMPLE_CMDBAR_PANE_STYLE);
	// attach menu
	m_CmdBar.AttachMenu(GetMenu());
	// load command bar images
	m_CmdBar.LoadImages(IDR_MAINFRAME);
	// remove old menu
	SetMenu(NULL);

	HWND hWndToolBar = CreateSimpleToolBarCtrl(m_hWnd, IDR_MAINFRAME, FALSE, ATL_SIMPLE_TOOLBAR_PANE_STYLE);

	CreateSimpleReBar(ATL_SIMPLE_REBAR_NOBORDER_STYLE);
	AddSimpleReBarBand(hWndCmdBar);
	AddSimpleReBarBand(hWndToolBar, NULL, TRUE);
	
	CreateSimpleStatusBar();

	CReBarCtrl bar = m_hWndToolBar;
	int nBandIndex = bar.IdToIndex(ATL_IDW_BAND_FIRST + 1);	// toolbar is 2nd added band
	bar.ShowBand(nBandIndex, FALSE);
	::ShowWindow(m_hWndStatusBar, SW_HIDE);
	UpdateLayout();

	m_hWndClient = m_view.Create(m_hWnd, rcDefault, NULL, WS_CHILD | WS_VISIBLE | WS_CLIPSIBLINGS | WS_CLIPCHILDREN, WS_EX_CLIENTEDGE);

	UIAddToolBar(hWndToolBar);
	UISetCheck(ID_VIEW_TOOLBAR, 0);
	UISetCheck(ID_VIEW_STATUS_BAR, 0);
	UISetCheck(ID_VIEW_SHOWBALLVECTORS, m_simcontrol.GetShowVectors());

	// register object for message filtering and idle updates
	CMessageLoop* pLoop = _Module.GetMessageLoop();
	ATLASSERT(pLoop != NULL);
	pLoop->AddMessageFilter(this);
	pLoop->AddIdleHandler(this);

	m_simcontrol.SetView(&m_view);
	m_simcontrol.Init();
	SetTimer(TIMER_FRAME, 10);
	return 0;
}
Exemplo n.º 5
0
// この関数は何故か MtlMisc.h の中に存在し、CReBarCtrl といったコントロールクラスを
// 使用し、他の関数が使用しないヘッダファイルを要求するので隔離した次第である。
void MtlRefreshBandIdealSize(CReBarCtrl rebar, CToolBarCtrl toolbar)
{
	REBARBANDINFO rbBand;

	rbBand.cbSize = sizeof (REBARBANDINFO);
	rbBand.fMask  = RBBIM_IDEALSIZE
				  // | RBBIM_SIZE			//+++
				  ;

	// Calculate the size of the band
	int 		  nBtnCount = toolbar.GetButtonCount();

	if (nBtnCount > 0) {
		RECT	rcTmp;
		BOOL	bRet	= toolbar.GetItemRect(nBtnCount - 1, &rcTmp) != 0;
		ATLASSERT(bRet);
		rbBand.cxIdeal	= rcTmp.right;
		// rbBand.cx	= rcTmp.right;		//+++
		int 	nIndex	= rebar.IdToIndex( toolbar.GetDlgCtrlID() );
		rebar.SetBandInfo(nIndex, &rbBand);
	}
}