2000-03-05 19:58:08 +00:00
|
|
|
/* --------------- lists.c -------------- */
|
|
|
|
|
|
|
|
#include "dflat.h"
|
|
|
|
|
|
|
|
/* ----- set focus to the next sibling ----- */
|
2003-06-19 02:48:13 +00:00
|
|
|
void DfSetNextFocus (void)
|
2000-03-05 19:58:08 +00:00
|
|
|
{
|
2003-06-19 02:48:13 +00:00
|
|
|
if (DfInFocus != NULL)
|
2000-03-05 19:58:08 +00:00
|
|
|
{
|
2003-06-19 02:48:13 +00:00
|
|
|
DFWINDOW wnd1 = DfInFocus, pwnd;
|
2000-03-05 19:58:08 +00:00
|
|
|
while (TRUE)
|
|
|
|
{
|
2003-06-19 02:48:13 +00:00
|
|
|
pwnd = DfGetParent(wnd1);
|
|
|
|
if (DfNextWindow(wnd1) != NULL)
|
|
|
|
wnd1 = DfNextWindow(wnd1);
|
2000-03-05 19:58:08 +00:00
|
|
|
else if (pwnd != NULL)
|
2003-06-19 02:48:13 +00:00
|
|
|
wnd1 = DfFirstWindow(pwnd);
|
|
|
|
if (wnd1 == NULL || wnd1 == DfInFocus)
|
2000-03-05 19:58:08 +00:00
|
|
|
{
|
|
|
|
wnd1 = pwnd;
|
|
|
|
break;
|
|
|
|
}
|
2003-06-19 02:48:13 +00:00
|
|
|
if (DfGetClass(wnd1) == DF_STATUSBAR || DfGetClass(wnd1) == DF_MENUBAR)
|
2000-03-05 19:58:08 +00:00
|
|
|
continue;
|
2003-06-19 02:48:13 +00:00
|
|
|
if (DfIsVisible(wnd1))
|
2000-03-05 19:58:08 +00:00
|
|
|
break;
|
|
|
|
}
|
|
|
|
if (wnd1 != NULL)
|
|
|
|
{
|
|
|
|
while (wnd1->childfocus != NULL)
|
|
|
|
wnd1 = wnd1->childfocus;
|
2003-06-19 02:48:13 +00:00
|
|
|
if (wnd1->condition != DF_ISCLOSING)
|
|
|
|
DfSendMessage(wnd1, DFM_SETFOCUS, TRUE, 0);
|
2000-03-05 19:58:08 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
/* ----- set focus to the previous sibling ----- */
|
2003-06-19 02:48:13 +00:00
|
|
|
void DfSetPrevFocus(void)
|
2000-03-05 19:58:08 +00:00
|
|
|
{
|
2003-06-19 02:48:13 +00:00
|
|
|
if (DfInFocus != NULL)
|
2000-03-05 19:58:08 +00:00
|
|
|
{
|
2003-06-19 02:48:13 +00:00
|
|
|
DFWINDOW wnd1 = DfInFocus, pwnd;
|
2000-03-05 19:58:08 +00:00
|
|
|
while (TRUE)
|
|
|
|
{
|
2003-06-19 02:48:13 +00:00
|
|
|
pwnd = DfGetParent(wnd1);
|
|
|
|
if (DfPrevWindow(wnd1) != NULL)
|
|
|
|
wnd1 = DfPrevWindow(wnd1);
|
2000-03-05 19:58:08 +00:00
|
|
|
else if (pwnd != NULL)
|
2003-06-19 02:48:13 +00:00
|
|
|
wnd1 = DfLastWindow(pwnd);
|
|
|
|
if (wnd1 == NULL || wnd1 == DfInFocus)
|
2000-03-05 19:58:08 +00:00
|
|
|
{
|
|
|
|
wnd1 = pwnd;
|
|
|
|
break;
|
|
|
|
}
|
2003-06-19 02:48:13 +00:00
|
|
|
if (DfGetClass(wnd1) == DF_STATUSBAR)
|
2000-03-05 19:58:08 +00:00
|
|
|
continue;
|
2003-06-19 02:48:13 +00:00
|
|
|
if (DfIsVisible(wnd1))
|
2000-03-05 19:58:08 +00:00
|
|
|
break;
|
|
|
|
}
|
|
|
|
if (wnd1 != NULL)
|
|
|
|
{
|
|
|
|
while (wnd1->childfocus != NULL)
|
|
|
|
wnd1 = wnd1->childfocus;
|
2003-06-19 02:48:13 +00:00
|
|
|
if (wnd1->condition != DF_ISCLOSING)
|
|
|
|
DfSendMessage(wnd1, DFM_SETFOCUS, TRUE, 0);
|
2000-03-05 19:58:08 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
/* ------- move a window to the end of its parents list ----- */
|
2003-06-19 02:48:13 +00:00
|
|
|
void DfReFocus(DFWINDOW wnd)
|
2000-03-05 19:58:08 +00:00
|
|
|
{
|
2003-06-19 02:48:13 +00:00
|
|
|
if (DfGetParent(wnd) != NULL)
|
2000-03-05 19:58:08 +00:00
|
|
|
{
|
2003-06-19 02:48:13 +00:00
|
|
|
DfRemoveWindow(wnd);
|
|
|
|
DfAppendWindow(wnd);
|
|
|
|
DfReFocus(DfGetParent(wnd));
|
2000-03-05 19:58:08 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
/* ---- remove a window from the linked list ---- */
|
2003-06-19 02:48:13 +00:00
|
|
|
void DfRemoveWindow(DFWINDOW wnd)
|
2000-03-05 19:58:08 +00:00
|
|
|
{
|
2000-03-08 01:49:37 +00:00
|
|
|
if (wnd != NULL)
|
|
|
|
{
|
2003-06-19 02:48:13 +00:00
|
|
|
DFWINDOW pwnd = DfGetParent(wnd);
|
2000-03-08 01:49:37 +00:00
|
|
|
|
2003-06-19 02:48:13 +00:00
|
|
|
if (DfPrevWindow(wnd) != NULL)
|
|
|
|
DfNextWindow(DfPrevWindow(wnd)) = DfNextWindow(wnd);
|
|
|
|
if (DfNextWindow(wnd) != NULL)
|
|
|
|
DfPrevWindow(DfNextWindow(wnd)) = DfPrevWindow(wnd);
|
2000-03-08 01:49:37 +00:00
|
|
|
if (pwnd != NULL)
|
|
|
|
{
|
2003-06-19 02:48:13 +00:00
|
|
|
if (wnd == DfFirstWindow(pwnd))
|
|
|
|
DfFirstWindow(pwnd) = DfNextWindow(wnd);
|
|
|
|
if (wnd == DfLastWindow(pwnd))
|
|
|
|
DfLastWindow(pwnd) = DfPrevWindow(wnd);
|
2000-03-05 19:58:08 +00:00
|
|
|
}
|
2000-03-08 01:49:37 +00:00
|
|
|
}
|
2000-03-05 19:58:08 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
/* ---- append a window to the linked list ---- */
|
2003-06-19 02:48:13 +00:00
|
|
|
void DfAppendWindow(DFWINDOW wnd)
|
2000-03-05 19:58:08 +00:00
|
|
|
{
|
|
|
|
if (wnd != NULL)
|
|
|
|
{
|
2003-06-19 02:48:13 +00:00
|
|
|
DFWINDOW pwnd = DfGetParent(wnd);
|
2000-03-05 19:58:08 +00:00
|
|
|
if (pwnd != NULL)
|
|
|
|
{
|
2003-06-19 02:48:13 +00:00
|
|
|
if (DfFirstWindow(pwnd) == NULL)
|
2000-03-05 19:58:08 +00:00
|
|
|
{
|
2003-06-19 02:48:13 +00:00
|
|
|
DfFirstWindow(pwnd) = wnd;
|
|
|
|
DfLastWindow(pwnd) = wnd;
|
|
|
|
DfPrevWindow(wnd) = NULL;
|
2000-03-05 19:58:08 +00:00
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
2003-06-19 02:48:13 +00:00
|
|
|
DfNextWindow(DfLastWindow(pwnd)) = wnd;
|
|
|
|
DfPrevWindow(wnd) = DfLastWindow(pwnd);
|
|
|
|
DfLastWindow(pwnd) = wnd;
|
2000-03-05 19:58:08 +00:00
|
|
|
}
|
|
|
|
}
|
2003-06-19 02:48:13 +00:00
|
|
|
DfNextWindow(wnd) = NULL;
|
2000-03-05 19:58:08 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2000-03-08 01:49:37 +00:00
|
|
|
/*
|
|
|
|
* if document windows and statusbar or menubar get the focus,
|
|
|
|
* pass it on
|
|
|
|
*/
|
2003-06-19 02:48:13 +00:00
|
|
|
void DfSkipApplicationControls(void)
|
2000-03-05 19:58:08 +00:00
|
|
|
{
|
|
|
|
BOOL EmptyAppl = FALSE;
|
|
|
|
int ct = 0;
|
2003-06-19 02:48:13 +00:00
|
|
|
while (!EmptyAppl && DfInFocus != NULL)
|
2000-03-05 19:58:08 +00:00
|
|
|
{
|
2003-06-19 02:48:13 +00:00
|
|
|
DFCLASS cl = DfGetClass(DfInFocus);
|
|
|
|
if (cl == DF_MENUBAR || cl == DF_STATUSBAR)
|
2000-03-05 19:58:08 +00:00
|
|
|
{
|
2003-06-19 02:48:13 +00:00
|
|
|
DfSetPrevFocus();
|
|
|
|
EmptyAppl = (cl == DF_MENUBAR && ct++);
|
2000-03-05 19:58:08 +00:00
|
|
|
}
|
|
|
|
else
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
/* EOF */
|