コード例 #1
0
/// <summary>
/// Create tab control
/// </summary>
/// <returns>Indicates success or failure</returns>
bool KinectWindow::CreateTabControl()
{
    if (!m_hWndTab)
    {
        m_hWndTab = CreateWindowW(WC_TABCONTROL,
                                  L"",
                                  WS_CHILD | WS_CLIPSIBLINGS,
                                  CW_USEDEFAULT,
                                  CW_USEDEFAULT,
                                  CW_USEDEFAULT,
                                  CW_USEDEFAULT,
                                  m_hWnd,
                                  nullptr,
                                  m_hInstance,
                                  nullptr);

        if (m_hWndTab)
        {
            TCITEMW tci     = {0};
            tci.mask        = TCIF_TEXT;
            tci.iImage      = -1;

            InsertTabItem(TAB_TITLE_RECORD,			TAB_INDEX_RECORD);
			InsertTabItem(TAB_TITLE_AUDIO,          TAB_INDEX_AUDIO);
            InsertTabItem(TAB_TITLE_ACCELEROMETER,  TAB_INDEX_ACCELEROMETER);
            InsertTabItem(TAB_TITLE_TILTANGLE,      TAB_INDEX_TILTANGLE);
        }
    }

    return (nullptr != m_hWndTab);
}
コード例 #2
0
ファイル: KinectWindow.cpp プロジェクト: thealexhong/starship
/**
 * Create tab control
 * @return  Indicates success or failure
 */
bool KinectWindow::CreateTabControl()
{
    if (!m_hWndTab)
    {
        m_hWndTab = CreateWindowW(WC_TABCONTROL,
                                  L"",
                                  WS_CHILD | WS_CLIPSIBLINGS,
                                  CW_USEDEFAULT,
                                  CW_USEDEFAULT,
                                  CW_USEDEFAULT,
                                  CW_USEDEFAULT,
                                  m_hWnd,
                                  nullptr,
                                  m_hInstance,
                                  nullptr);

        if (m_hWndTab)
        {
            TCITEMW tci     = {0};
            tci.mask        = TCIF_TEXT;
            tci.iImage      = -1;

			InsertTabItem(TAB_TITLE_SKELETON,         TAB_INDEX_SKELETON);
			InsertTabItem(TAB_TITLE_BLFEATURES,       TAB_INDEX_BLFEATURES);
			InsertTabItem(TAB_TITLE_BLCLASSIFICATION, TAB_INDEX_BLCLASSIFICATION);
			//InsertTabItem(TAB_TITLE_VFEATURES,        TAB_INDEX_VFEATURES); // TODO: unimportant for now
			// InsertTabItem(TAB_TITLE_VCLASSIFICATION,  TAB_INDEX_VCLASSIFICATION); // TODO: unimportant for now
			InsertTabItem(TAB_TITLE_MCLASSIFICATION,  TAB_INDEX_MCLASSIFICATION);
			
			/*
            InsertTabItem(TAB_TITLE_AUDIO,          TAB_INDEX_AUDIO);
            InsertTabItem(TAB_TITLE_ACCELEROMETER,  TAB_INDEX_ACCELEROMETER);
            InsertTabItem(TAB_TITLE_TILTANGLE,      TAB_INDEX_TILTANGLE);
			*/
        }
    }

    return (nullptr != m_hWndTab);
}
コード例 #3
0
ファイル: OXTabClientWnd.cpp プロジェクト: Spritutu/AiPI-1
// Scans through all MDIChild windows and refreshes window names and 
// current active window. If bAddNewWindows is set to TRUE then if any
// new MDIChild is found it will be added to the tab control
void COXTabWorkspace::UpdateContents(BOOL bAddNewWindows/*=FALSE*/, 
									 BOOL bUpdateWindowsInfo/*=FALSE*/)
{
	ASSERT(m_pTabClientWnd!=NULL);

    // Check MDI windows
    CMDIFrameWnd* pFrameWnd=GetParentFrame();
    if(pFrameWnd==NULL)
	{
		return;
	}

	BOOL bRecalc=m_pTabClientWnd->m_bForceToRecalc;

	// Get pointer to currently active MDIChild
    CWnd* pActiveChildWnd=pFrameWnd->MDIGetActive(NULL);

    CMDIChildWnd* pChildWnd=NULL;
    int nActiveIndex=-1;

	// Start enumerating from currently active MDIChild
    if(pActiveChildWnd!=NULL)
	{
		pChildWnd=(CMDIChildWnd*)pActiveChildWnd->GetWindow(GW_HWNDFIRST);
	}

    // Flag all current tabs as unfound (for debug purposes in order to check
	// the integrity of the framework)
#ifdef _DEBUG
	int nIndex=0;
    for(nIndex=0; nIndex<m_arrTab.GetSize(); nIndex++)
	{
		m_arrTab[nIndex].bFound=FALSE;
	}
#endif

	int nInsertIndex= PtrToInt(m_arrTab.GetSize());

	// Enumerate all child windows
    while(pChildWnd!=NULL)
    {
		// Window text
		CString sWindowText=GetTextForTabItem(pChildWnd);

		// see if can find it
		int nFoundItem=FindTabItem(pChildWnd->GetSafeHwnd());

		if(nFoundItem!=-1)
		{
			if((pChildWnd->GetStyle()&WS_VISIBLE)==WS_VISIBLE)
			{
				if(pChildWnd==pActiveChildWnd)
				{
					// Found currently active MDIChild
					nActiveIndex=nFoundItem;
				}

#ifdef _DEBUG
				m_arrTab[nFoundItem].bFound=TRUE;
#endif

				// Update text if necessary
				if(m_arrTab[nFoundItem].sText!=sWindowText)
				{
					m_arrTab[nFoundItem].sText=sWindowText;

					//replace "&" characters for doubles "&&"
					int nFind=sWindowText.Find(TEXT('&'));
					while (nFind != -1)
					{
						if (nFind<sWindowText.GetLength())
						{
//							if (sWindowText.GetAt(nFind+1)!=TEXT('&'))
							sWindowText.Insert(nFind+1,TEXT('&'));
							nFind=sWindowText.Find(TEXT('&'),nFind+2);
						}
						else
							nFind=-1;
					}


					TC_ITEM tci;
					tci.mask=TCIF_TEXT;
					tci.pszText=(LPTSTR)(LPCTSTR)sWindowText;
					SetItem(nFoundItem,&tci);

					bRecalc=TRUE;
				}

				if(bUpdateWindowsInfo)
				{
					TC_ITEM tci;
					tci.mask=TCIF_IMAGE;
					GetItem(nFoundItem,&tci);
					// Update icon if necessary
					HICON hIcon=GetWindowIcon(pChildWnd->GetSafeHwnd());
					int nImageIndex=(hIcon==NULL ? -1 : AddTabItemIcon(hIcon));
					if(nImageIndex!=tci.iImage)
					{
						tci.iImage=nImageIndex;
						SetItem(nFoundItem,&tci);
					}
				}
			}
			else
			{
				nInsertIndex--;
				if(nActiveIndex!=-1 && nActiveIndex>nFoundItem)
				{
					nActiveIndex--;
				}
				RemoveTabItem(pChildWnd,FALSE);
				bRecalc=TRUE;
			}
		}
		else if(bAddNewWindows)
		{
			if(nActiveIndex!=-1 && nActiveIndex>=nInsertIndex)
			{
				nActiveIndex++;
			}
			// add item
			InsertTabItem(nInsertIndex,pChildWnd,FALSE);
			bRecalc=TRUE;
		}

		// Get next MDIChild
		pChildWnd=(CMDIChildWnd*)pChildWnd->GetWindow(GW_HWNDNEXT);
    }

#ifdef _DEBUG
    for(nIndex=0; nIndex<m_arrTab.GetSize(); nIndex++)
	{
		ASSERT(m_arrTab[nIndex].bFound);
	}
#endif

	// Set the active item
    if(nActiveIndex>=0 && GetCurSel()!=nActiveIndex)
	{
		SetCurSel(nActiveIndex);
		bRecalc=TRUE;
	}

	if(bRecalc)
	{
		// Update the size and position of the tab control and MDIClient window
		if(::IsWindow(GetParentFrame()->GetSafeHwnd()))
		{
			GetParentFrame()->RecalcLayout();
		}
		m_pTabClientWnd->m_bForceToRecalc=FALSE;
	}
}