1 /* --------------- lists.c -------------- */
3 #include "dflat32/dflat.h"
5 /* ----- set focus to the next sibling ----- */
6 void SetNextFocus (void)
10 DFWINDOW wnd1
= inFocus
, pwnd
;
13 pwnd
= GetParent(wnd1
);
14 if (NextWindow(wnd1
) != NULL
)
15 wnd1
= NextWindow(wnd1
);
16 else if (pwnd
!= NULL
)
17 wnd1
= FirstWindow(pwnd
);
18 if (wnd1
== NULL
|| wnd1
== inFocus
)
23 if (GetClass(wnd1
) == STATUSBAR
|| GetClass(wnd1
) == MENUBAR
)
30 while (wnd1
->childfocus
!= NULL
)
31 wnd1
= wnd1
->childfocus
;
32 if (wnd1
->condition
!= ISCLOSING
)
33 DfSendMessage(wnd1
, SETFOCUS
, TRUE
, 0);
38 /* ----- set focus to the previous sibling ----- */
39 void SetPrevFocus(void)
43 DFWINDOW wnd1
= inFocus
, pwnd
;
46 pwnd
= GetParent(wnd1
);
47 if (PrevWindow(wnd1
) != NULL
)
48 wnd1
= PrevWindow(wnd1
);
49 else if (pwnd
!= NULL
)
50 wnd1
= LastWindow(pwnd
);
51 if (wnd1
== NULL
|| wnd1
== inFocus
)
56 if (GetClass(wnd1
) == STATUSBAR
)
63 while (wnd1
->childfocus
!= NULL
)
64 wnd1
= wnd1
->childfocus
;
65 if (wnd1
->condition
!= ISCLOSING
)
66 DfSendMessage(wnd1
, SETFOCUS
, TRUE
, 0);
71 /* ------- move a window to the end of its parents list ----- */
72 void ReFocus(DFWINDOW wnd
)
74 if (GetParent(wnd
) != NULL
)
78 ReFocus(GetParent(wnd
));
82 /* ---- remove a window from the linked list ---- */
83 void RemoveWindow(DFWINDOW wnd
)
87 DFWINDOW pwnd
= GetParent(wnd
);
89 if (PrevWindow(wnd
) != NULL
)
90 NextWindow(PrevWindow(wnd
)) = NextWindow(wnd
);
91 if (NextWindow(wnd
) != NULL
)
92 PrevWindow(NextWindow(wnd
)) = PrevWindow(wnd
);
95 if (wnd
== FirstWindow(pwnd
))
96 FirstWindow(pwnd
) = NextWindow(wnd
);
97 if (wnd
== LastWindow(pwnd
))
98 LastWindow(pwnd
) = PrevWindow(wnd
);
103 /* ---- append a window to the linked list ---- */
104 void AppendWindow(DFWINDOW wnd
)
108 DFWINDOW pwnd
= GetParent(wnd
);
111 if (FirstWindow(pwnd
) == NULL
)
113 FirstWindow(pwnd
) = wnd
;
114 LastWindow(pwnd
) = wnd
;
115 PrevWindow(wnd
) = NULL
;
119 NextWindow(LastWindow(pwnd
)) = wnd
;
120 PrevWindow(wnd
) = LastWindow(pwnd
);
121 LastWindow(pwnd
) = wnd
;
124 NextWindow(wnd
) = NULL
;
129 * if document windows and statusbar or menubar get the focus,
132 void SkipApplicationControls(void)
134 BOOL EmptyAppl
= FALSE
;
136 while (!EmptyAppl
&& inFocus
!= NULL
)
138 DFCLASS cl
= GetClass(inFocus
);
139 if (cl
== MENUBAR
|| cl
== STATUSBAR
)
142 EmptyAppl
= (cl
== MENUBAR
&& ct
++);