Пример #1
0
const int CWnd::SearchChild(const int offsetx,const int offsety)const
{
	if (GetFocusedChild()==-1)return -1;
	CWnd* akt=child[GetFocusedChild()];

	int x=akt->x+akt->w/2;
	int y=akt->y+akt->h/2;

	int n=SearchChildPos(x,y,offsetx,offsety);
	if (n==-1)
	{
		if (offsetx>0)x=0;
		if (offsetx<0)x=w;
		if (offsety>0)y=0;
		if (offsety<0)y=h;
		n=SearchChildPos(x,y,offsetx,offsety);
		if (n==GetFocusedChild())return n;
	}

	if (n!=-1)
	{
		child[n]->focused=TRUE;
		akt->focused=FALSE;
		child[n]->Invalidate();
		akt->Invalidate();
	}
	return n;
}
Пример #2
0
BOOLEAN CWnd::PerformMessage(HWND hWnd,UINT uMsg,WPARAM wParam,LPARAM lParam)
{
	if (childwindow)if (childwindow->PerformMessage(hWnd,uMsg,wParam,lParam))return TRUE;
	const int c=GetFocusedChild();
	if (c!=-1)if (child[c]->PerformMessage(hWnd,uMsg,wParam,lParam))return TRUE;

	for (int i=0;i<MAX_CHILD;i++)if (child[i]!=NULL)
	{
		if (child[i]->PerformMessage(hWnd,uMsg,wParam,lParam))return TRUE;
	}

	return FALSE;
}
Пример #3
0
bool Control::OnUpdate(void)
{
	unsigned long focused = GetFocusedChild();

	for(unsigned long i = 0; i < mChilds.GetSize(); ++i)
		if(i != focused)
			mChilds[i]->OnUpdate();

	if(focused != 0xFFFFFFFF)
		mChilds[focused]->OnUpdate();

	return true;
}
Пример #4
0
bool Control::SetFocusPrevious(void)
{
	if(!GetChildCount())
		return false;

	unsigned long focused = GetFocusedChild();

	if(!focused || focused == 0xFFFFFFFF)
		FocusChild(mChilds.GetSize() - 1);
	else
		FocusChild(focused - 1);

	return true;
}
Пример #5
0
bool Control::SetFocusNext(void)
{
	if(!GetChildCount())
		return false;

	unsigned long focused = GetFocusedChild();

	if(focused == 0xFFFFFFFF)
		FocusChild(0);
	else
		FocusChild((focused + 1) % mChilds.GetSize());

	return true;
}
Пример #6
0
bool Control::OnRender(void)
{
	if(GetEditorMode())
		OnRenderEditorMode();

	unsigned long focused = GetFocusedChild();

	for(unsigned long i = 0; i < mChilds.GetSize(); ++i)
		if(i != focused)
			mChilds[i]->OnRender();

	if(focused != 0xFFFFFFFF)
		mChilds[focused]->OnRender();

	return true;
}
Пример #7
0
void CServerPage::Execute(float elapsed)
{
	CPage::Execute(elapsed);

	lasttime+=elapsed;

	if (lasttime>1.5f)
	{
		lasttime=0.0f;
		if (game->IsServer)
		{
			if (mustsend)game->SendVariables();
			mustsend=FALSE;
		}else{
			int last=GetFocusedChild();
			DeleteChilds();
			Create();
			SetFocus(last);
		}
	}
}
Пример #8
0
BOOLEAN CPage::PerformMessage(HWND hWnd,UINT uMsg,WPARAM wParam,LPARAM lParam)
{
	switch (uMsg)
	{
	case WM_SIZE:
		{
			RECT r;
			GetClientRect(hWnd,&r);
			sx=r.right;
			sy=r.bottom;
		}
		break;
	}

	if (childwindow)
	{
		if (childwindow->PerformMessage(hWnd,uMsg,wParam,lParam))return TRUE;
		return FALSE;
	}

	if (CWnd::PerformMessage(hWnd,uMsg,wParam,lParam))return TRUE;

	int i;

	switch (uMsg)
	{
	case WM_KEYDOWN:
		switch(wParam)
		{
		case VK_ESCAPE:
			Close(0);
			closed=TRUE;
			break;
		case VK_LEFT:SearchChild(-1,0);
			break;
		case VK_RIGHT:SearchChild(1,0);
			break;
		case VK_UP:SearchChild(0,-1);
			break;
		case VK_DOWN:SearchChild(0,1);
			break;
		case VK_TAB:
			{
				i=GetFocusedChild();
				if (i!=-1)
				{
					int j=i;
					do
					{
						j=GetNextChild(j);
					}while ((j!=-1)&&(!child[j]->canfocus));
					if (j!=-1)
					{
						child[j]->focused=TRUE;
						child[i]->focused=FALSE;
						child[i]->Invalidate();
						child[j]->Invalidate();
					}else{
						j=0;
						while ((j!=-1)&&(!child[j]->canfocus))
						{
							j=GetNextChild(j);
						}
						if (j!=-1)
						{
							child[i]->focused=FALSE;
							child[j]->focused=TRUE;
							child[i]->Invalidate();
							child[j]->Invalidate();
						}
					}
				}
			}
			break;
		default: return TRUE;
		}
		break;
	default:return FALSE;
	}
	return TRUE;
}