Beispiel #1
0
void CTabPanelWin::ShowTabsPane(bool bShow)
{
	if (bShow)
	{
		_ASSERTE(isMainThread());
		if (CreateTabbar())
		{
			RECT rcWnd = GetRect();

			REBARBANDINFO rbBand = {REBARBANDINFO_SIZE}; // не используем size, т.к. приходит "новый" размер из висты и в XP обламываемся

			rbBand.fMask  = RBBIM_SIZE | RBBIM_CHILD | RBBIM_CHILDSIZE | RBBIM_ID | RBBIM_STYLE;
			rbBand.fStyle = RBBS_CHILDEDGE | RBBS_FIXEDSIZE | RBBS_VARIABLEHEIGHT;

			#if 0
			rbBand.fMask |= RBBIM_COLORS;
			rbBand.clrFore = RGB(255,255,255);
			rbBand.clrBack = RGB(0,0,0);
			#endif

			rbBand.wID        = rbi_TabBar;
			rbBand.hwndChild  = mh_Tabbar;
			rbBand.cxMinChild = 100;
			rbBand.cx = /*rbBand.cxIdeal =*/ rcWnd.right - 20; // - sz.cx - 80 - iFindPanelWidth;
			rbBand.cyChild = rbBand.cyMinChild = rbBand.cyMaxChild = mn_TabHeight; // sz.cy;

			// Tabs are always on the first place
			if (!SendMessage(mh_Rebar, RB_INSERTBAND, (WPARAM)0, (LPARAM)&rbBand))
			{
				DisplayLastError(_T("Can't initialize rebar (tabbar)"));
			}
		}
	}
	else
	{
		_ASSERTE(FALSE && "Deletion is not supported yet");
	}
}
Beispiel #2
0
void CTabPanelWin::CreateRebar()
{
	RECT rcWnd = {-32000, -32000, -32000+300, -32000+100};
	if (ghWnd)
	{
		rcWnd = gpConEmu->GetGuiClientRect();
	}
	else
	{
		_ASSERTE(ghWnd!=NULL); // вроде ReBar для теста не создается.
	}

	gpSetCls->CheckTheming();

	if (NULL == (mh_Rebar = CreateWindowEx(WS_EX_TOOLWINDOW, REBARCLASSNAME, NULL,
								(ghWnd ? (WS_VISIBLE | WS_CHILD) : 0)
								|WS_CLIPSIBLINGS|WS_CLIPCHILDREN
	                            |/*CCS_NORESIZE|*/CCS_NOPARENTALIGN
	                            |RBS_FIXEDORDER|RBS_AUTOSIZE|/*RBS_VARHEIGHT|*/CCS_NODIVIDER,
	                            0,0,rcWnd.right,16, ghWnd, NULL, g_hInstance, NULL)))
		return;

#if !defined(__GNUC__)
#pragma warning (disable : 4312)
#endif
	// Надо
	TabPanelWinMap map = {this}; //{ CTabPanelWin* object; HWND hWnd; WNDPROC defaultProc; };
	map.defaultProc = (WNDPROC)SetWindowLongPtr(mh_Rebar, GWLP_WNDPROC, (LONG_PTR)_ReBarProc);
	map.hWnd = mh_Rebar;
	gp_TabPanelWinMap->Set(mh_Rebar, map);


	REBARINFO     rbi = {sizeof(REBARINFO)};
	REBARBANDINFO rbBand = {80}; // не используем size, т.к. приходит "новый" размер из висты и в XP обламываемся

	if (!SendMessage(mh_Rebar, RB_SETBARINFO, 0, (LPARAM)&rbi))
	{
		DisplayLastError(_T("Can't initialize rebar!"));
		DestroyWindow(mh_Rebar);
		mh_Rebar = NULL;
		return;
	}

	rbBand.fMask  = RBBIM_SIZE | RBBIM_CHILD | RBBIM_CHILDSIZE | RBBIM_ID | RBBIM_STYLE | RBBIM_COLORS;
	rbBand.fStyle = RBBS_CHILDEDGE | RBBS_FIXEDSIZE | RBBS_VARIABLEHEIGHT;
	rbBand.clrBack = GetSysColor(COLOR_BTNFACE);
	rbBand.clrFore = GetSysColor(COLOR_BTNTEXT);
	SendMessage(mh_Rebar, RB_SETBKCOLOR, 0, GetSysColor(COLOR_BTNFACE));
	SendMessage(mh_Rebar, RB_SETWINDOWTHEME, 0, (LPARAM)L" ");
	CreateTabbar();
	CreateToolbar();
	SIZE sz = {0,0};

	if (mh_Toolbar)
	{
		SendMessage(mh_Toolbar, TB_GETMAXSIZE, 0, (LPARAM)&sz);
	}
	else
	{
		RECT rcClient = gpConEmu->GetGuiClientRect();
		TabCtrl_AdjustRect(mh_Tabbar, FALSE, &rcClient);
		sz.cy = rcClient.top - 3 - mn_ThemeHeightDiff;
	}

	if (mh_Tabbar)
	{
		// Set values unique to the band with the toolbar.
		rbBand.wID          = 1;
		rbBand.hwndChild  = mh_Tabbar;
		rbBand.cxMinChild = 100;
		rbBand.cx = rbBand.cxIdeal = rcWnd.right - sz.cx - 80;
		rbBand.cyChild = rbBand.cyMinChild = rbBand.cyMaxChild = mn_TabHeight; // sz.cy;

		if (!SendMessage(mh_Rebar, RB_INSERTBAND, (WPARAM)-1, (LPARAM)&rbBand))
		{
			DisplayLastError(_T("Can't initialize rebar (tabbar)"));
		}
	}

	if (mh_Toolbar)
	{
		// Set values unique to the band with the toolbar.
		rbBand.wID        = 2;
		rbBand.hwndChild  = mh_Toolbar;
		rbBand.cx = rbBand.cxMinChild = rbBand.cxIdeal = mn_LastToolbarWidth = sz.cx;
		rbBand.cyChild = rbBand.cyMinChild = rbBand.cyMaxChild = sz.cy + mn_ThemeHeightDiff;

		// Add the band that has the toolbar.
		if (!SendMessage(mh_Rebar, RB_INSERTBAND, (WPARAM)-1, (LPARAM)&rbBand))
		{
			DisplayLastError(_T("Can't initialize rebar (toolbar)"));
		}

		//if (mn_ThemeHeightDiff) {
		//	POINT pt = {0,0};
		//	MapWindowPoints(mh_Toolbar, mh_Rebar, &pt, 1);
		//	pt.y = 0;
		//	SetWindowPos(mh_Toolbar, NULL, pt.x, pt.y, 0, 0, SWP_NOSIZE|SWP_NOZORDER);
		//}
	}

#ifdef _DEBUG
	RECT rc;
	GetWindowRect(mh_Rebar, &rc);
#endif
	//GetWindowRect(mh_Rebar, &rc);
	//mn_TabHeight = rc.bottom - rc.top;
	//if (gpSet->nTabsLocation == 1)
	//	m_Margins = MakeRect(0,0,0,mn_TabHeight);
	//else
	//	m_Margins = MakeRect(0,mn_TabHeight,0,0);
	//gpSet->UpdateMargins(m_Margins);
	//_hwndTab = mh_Rebar; // пока...
}