Beispiel #1
0
UINT CDocSelector::DeliverMessage(DWORD dwID, UINT uMsg, WPARAM wParam, LPARAM lParam)
{

	for(int i = 0; i < m_Buttons.GetSize(); i++){

		if(GetButtonFromID(i)->m_AttachedView->m_hWnd == (HWND)dwID){

			return GetButtonFromID(i)->m_AttachedView->SendMessage(uMsg, wParam, lParam);
		}
	}
	return 1;
}
Beispiel #2
0
void CDocSelector::SetHiLite(CView* pView)
{

	int index = -1;
	
	for(int i = 0; i < m_Buttons.GetSize(); i++){

		if(GetButtonFromID(i)->m_AttachedView == pView){

			GetButtonFromID(i)->SetHiLite();
			break;
		}
	}
}
Beispiel #3
0
void CDocSelector::UpdateTitle(CWnd* pWnd, CString strTitle)
{

	int index = -1;
	
	for(int i = 0; i < m_Buttons.GetSize(); i++){

		if(GetButtonFromID(i)->m_AttachedView == pWnd){

			GetButtonFromID(i)->SetText(strTitle);
			break;
		}
	}
}
Beispiel #4
0
CView* CDocSelector::GetPMView(CString strTitle)
{

	CString strText;
	for(int i = 0; i < m_Buttons.GetSize(); i++){

		GetButtonFromID(i)->GetWindowText(strText);
		if(strText.Compare(strTitle) == 0){

			return (CView*)GetButtonFromID(i)->m_AttachedView;
		}
	}

	return NULL;
}
Beispiel #5
0
LRESULT CDocSelector::OnSelChange(WPARAM wParam, LPARAM)
{
	// Killing the timer, because timer can change the
	// selection in between the procedure...
	KillTimer( DS_TIMER_ID ); // Yogesh Jagota

	// sent when a button gets clicked
	CSwitcherButton* newsel = (CSwitcherButton*)wParam;

	// Yogesh Jagota
	CMDIFrameWnd *pFrame = (CMDIFrameWnd *)AfxGetMainWnd();
	//CWnd* Window = (CWnd*)newsel->m_FrameWnd;//Y.Ivanov
	CWnd* Window = (CWnd*)newsel->m_AttachedView->GetParentFrame();//Yuriy Ivanov
	pFrame->MDIActivate( Window );
	if(Window->IsIconic())
		Window->ShowWindow(SW_SHOWNORMAL);
	pFrame->Invalidate();

	// End Yogesh Jagota

	if (m_iSelectedButton > -1)
		GetButtonFromID(m_iSelectedButton)->Unselect();

	m_iSelectedButton = newsel->m_iID;

	// Reactivate the timer...
	SetTimer( DS_TIMER_ID, 10, NULL ); // Yogesh Jagota


	return 1;
}
Beispiel #6
0
void CDocSelector::CloseChannellist(DWORD dwID)
{

	for(int i = 0; i < m_Buttons.GetSize(); i++){

		if(GetButtonFromID(i)->m_AttachedView->m_hWnd == (HWND)dwID){

			CWnd* wnd = GetButtonFromID(i)->m_AttachedView->GetParent();
			
			if(wnd)
				wnd->SendMessage(WM_CLOSE);
			
			break;
		}
	}
 }
Beispiel #7
0
LRESULT CDocSelector::OnSelChange(WPARAM wParam, LPARAM)
{
	// Killing the timer, because timer can change the
	// selection in between the procedure...
	KillTimer( DS_TIMER_ID ); // Yogesh Jagota

	// sent when a button gets clicked
	CSwitcherButton* newsel = (CSwitcherButton*)wParam;

	// Yogesh Jagota
	CMDIFrameWnd *pFrame = (CMDIFrameWnd *)AfxGetMainWnd();
	CWnd* Window = (CWnd*)newsel->m_FrameWnd;

	WINDOWPLACEMENT	wndpl;

	Window->GetWindowPlacement( &wndpl);

	if(wndpl.showCmd == SW_SHOWMINIMIZED) Window->ShowWindow(SW_RESTORE);
	
	pFrame->MDIActivate( Window );
	// End Yogesh Jagota

	if (m_iSelectedButton > -1)
		GetButtonFromID(m_iSelectedButton)->Unselect();

	m_iSelectedButton = newsel->m_iID;

	// Reactivate the timer...
	SetTimer( DS_TIMER_ID, 10, NULL ); // Yogesh Jagota

	return 1;
}
Beispiel #8
0
void CDocSelector::BroadcastMessage(UINT uMsg, WPARAM wParam, LPARAM lParam)
{

	for(int i = 0; i < m_Buttons.GetSize(); i++){

		GetButtonFromID(i)->m_AttachedView->SendMessage(uMsg, wParam, lParam);
	}
}
Beispiel #9
0
void CDocSelector::OnUpdateDocmenuSetchannelpicture(CCmdUI *pCmdUI)
{

	if(m_iRID >= 0){

		CSwitcherButton* btn = GetButtonFromID(m_iRID);
		if(btn){

			pCmdUI->Enable(strstr(btn->m_AttachedView->GetRuntimeClass()->m_lpszClassName, "CChatView") != 0);
		}
	}
}
Beispiel #10
0
void CDocSelector::OnDocmenuActivate()
{

	if(m_iRID >= 0)
	{

		CSwitcherButton* btn = GetButtonFromID(m_iRID);
		m_iRID = -1;
		if(btn)
		{
			CMDIFrameWnd *pFrame = (CMDIFrameWnd *)AfxGetMainWnd();
			pFrame->MDIActivate(btn->m_FrameWnd);
		}	
	}
}
Beispiel #11
0
void CDocSelector::OnDocmenuClose()
{

	if(m_iRID >= 0)
	{

		CSwitcherButton* btn = GetButtonFromID(m_iRID);
		m_iRID = -1;
		if(btn)
		{

			CWnd* wnd = btn->m_AttachedView->GetParent();
			if(wnd)
				wnd->SendMessage(WM_CLOSE);
		}
	}
}
Beispiel #12
0
void CDocSelector::OnDocmenuSetchannelpicture()
{

	if(m_iRID >= 0){

		CSwitcherButton* btn = GetButtonFromID(m_iRID);
		m_iRID = -1;
		if(btn){

			if(strstr(btn->m_AttachedView->GetRuntimeClass()->m_lpszClassName, "CChatView") != 0){

				if(::SendMessage(btn->m_AttachedView->m_hWnd, UWM_SETCHANNELPIC, 0, 0) != 2){

					AfxMessageBox(IDS_PICINFO, MB_ICONINFORMATION);
				}
			}
		}
	}
}
Beispiel #13
0
BOOL CDocSelector::RemoveButton(CWnd* wnd)
{
	// Yogesh Jagota
	int index = -1;

	for ( int i = 0; i < m_Buttons.GetSize(); i++ )
	{
		if ( GetButtonFromID( i )->m_AttachedView == wnd )
		{
			index = i;
			break;
		}
	}

	if ( index == -1 )
		return FALSE;
	// End Yogesh Jagota

	if (index >= m_Buttons.GetSize() || index < 0)
	{
		ASSERT(0); // out of range
		return FALSE;
	}

	if (m_iSelectedButton == index)
		m_iSelectedButton = -1;
	if (m_iSelectedButton > index)
		m_iSelectedButton -= 1;

	delete GetButtonFromID(index);
	m_Buttons.RemoveAt(index);

	for (register int x = index; x < m_Buttons.GetSize(); x++)
		GetButtonFromID(x)->m_iID -= 1;

	m_iNextButtonStart -= m_iButtonWidth + 1;

	if (m_iButtonWidth != DS_WIDTH)
	{
		// do that funky animation thing
		CRect rect;
		GetClientRect(&rect);
		int newsize = ((rect.Width() - DS_MENU_BUTTON_WIDTH ) 
			/ (m_Buttons.GetSize())) - DS_SEPERATER_MARGIN;

		if (newsize > DS_WIDTH) newsize = DS_WIDTH;


//		Yogesh Jagota. Removed animation because did'nt liked it.
//		Remove if you want animated addition or removal of buttons.
//
//		this loop is shortened to make the following loop....
//		if (newsize > m_iButtonWidth)
//		{
//			register int y;
//			for (y = m_iButtonWidth; y <= newsize; y+=3)
//			{
//				ResizeButtons(y);
//				Sleep(15);
//			}
//			if (y != newsize)
//				ResizeButtons(newsize);
//		}
//		End Yogesh Jagota

		if (newsize > m_iButtonWidth)
			ResizeButtons(newsize);
	}

	ResizeButtons(m_iButtonWidth);

	return TRUE;
}