Exemplo n.º 1
0
/* ----- set focus to the previous sibling ----- */
void SetPrevFocus()
{
    if (inFocus != NULL)    {
        WINDOW wnd1 = inFocus, pwnd;
        while (TRUE)    {
			pwnd = GetParent(wnd1);
            if (PrevWindow(wnd1) != NULL)
				wnd1 = PrevWindow(wnd1);
			else if (pwnd != NULL)
                wnd1 = LastWindow(pwnd);
            if (wnd1 == NULL || wnd1 == inFocus)	{
				wnd1 = pwnd;
				break;
			}
			if (GetClass(wnd1) == STATUSBAR)
				continue;
            if (isVisible(wnd1))
                break;
        }
        if (wnd1 != NULL)	{
			while (wnd1->childfocus != NULL)
				wnd1 = wnd1->childfocus;
            if (wnd1->condition != ISCLOSING)
	            SendMessage(wnd1, SETFOCUS, TRUE, 0);
		}
    }
}
Exemplo n.º 2
0
/* ---- remove a window from the linked list ---- */
void RemoveWindow(WINDOW wnd)
{
    if (wnd != NULL)    {
		WINDOW pwnd = GetParent(wnd);
        if (PrevWindow(wnd) != NULL)
            NextWindow(PrevWindow(wnd)) = NextWindow(wnd);
        if (NextWindow(wnd) != NULL)
            PrevWindow(NextWindow(wnd)) = PrevWindow(wnd);
		if (pwnd != NULL)	{
        	if (wnd == FirstWindow(pwnd))
            	FirstWindow(pwnd) = NextWindow(wnd);
        	if (wnd == LastWindow(pwnd))
            	LastWindow(pwnd) = PrevWindow(wnd);
		}
    }
}
Exemplo n.º 3
0
static WINDOW GetDocFocus(void)
{
	WINDOW wnd = ApplicationWindow;
	if (wnd != NULL)	{
		wnd = LastWindow(wnd);
		while (wnd != NULL && (GetClass(wnd) == MENUBAR ||
							GetClass(wnd) == STATUSBAR))
			wnd = PrevWindow(wnd);
		if (wnd != NULL)
			while (wnd->childfocus != NULL)
				wnd = wnd->childfocus;
	}
	return wnd ? wnd : ApplicationWindow;
}
Exemplo n.º 4
0
/* ---- append a window to the linked list ---- */
void AppendWindow(WINDOW wnd)
{
    if (wnd != NULL)    {
		WINDOW pwnd = GetParent(wnd);
		if (pwnd != NULL)	{
        	if (FirstWindow(pwnd) == NULL)
            	FirstWindow(pwnd) = wnd;
        	if (LastWindow(pwnd) != NULL)
            	NextWindow(LastWindow(pwnd)) = wnd;
        	PrevWindow(wnd) = LastWindow(pwnd);
	        LastWindow(pwnd) = wnd;
		}
        NextWindow(wnd) = NULL;
    }
}