1 /* --------------- lists.c -------------- */
5 /* ----- set focus to the next sibling ----- */
6 void DfSetNextFocus (void)
10 DFWINDOW wnd1
= DfInFocus
, pwnd
;
13 pwnd
= DfGetParent(wnd1
);
14 if (DfNextWindow(wnd1
) != NULL
)
15 wnd1
= DfNextWindow(wnd1
);
16 else if (pwnd
!= NULL
)
17 wnd1
= DfFirstWindow(pwnd
);
18 if (wnd1
== NULL
|| wnd1
== DfInFocus
)
23 if (DfGetClass(wnd1
) == DF_STATUSBAR
|| DfGetClass(wnd1
) == DF_MENUBAR
)
25 if (DfIsVisible(wnd1
))
30 while (wnd1
->childfocus
!= NULL
)
31 wnd1
= wnd1
->childfocus
;
32 if (wnd1
->condition
!= DF_ISCLOSING
)
33 DfSendMessage(wnd1
, DFM_SETFOCUS
, TRUE
, 0);
38 /* ----- set focus to the previous sibling ----- */
39 void DfSetPrevFocus(void)
41 if (DfInFocus
!= NULL
)
43 DFWINDOW wnd1
= DfInFocus
, pwnd
;
46 pwnd
= DfGetParent(wnd1
);
47 if (DfPrevWindow(wnd1
) != NULL
)
48 wnd1
= DfPrevWindow(wnd1
);
49 else if (pwnd
!= NULL
)
50 wnd1
= DfLastWindow(pwnd
);
51 if (wnd1
== NULL
|| wnd1
== DfInFocus
)
56 if (DfGetClass(wnd1
) == DF_STATUSBAR
)
58 if (DfIsVisible(wnd1
))
63 while (wnd1
->childfocus
!= NULL
)
64 wnd1
= wnd1
->childfocus
;
65 if (wnd1
->condition
!= DF_ISCLOSING
)
66 DfSendMessage(wnd1
, DFM_SETFOCUS
, TRUE
, 0);
71 /* ------- move a window to the end of its parents list ----- */
72 void DfReFocus(DFWINDOW wnd
)
74 if (DfGetParent(wnd
) != NULL
)
78 DfReFocus(DfGetParent(wnd
));
82 /* ---- remove a window from the linked list ---- */
83 void DfRemoveWindow(DFWINDOW wnd
)
87 DFWINDOW pwnd
= DfGetParent(wnd
);
89 if (DfPrevWindow(wnd
) != NULL
)
90 DfNextWindow(DfPrevWindow(wnd
)) = DfNextWindow(wnd
);
91 if (DfNextWindow(wnd
) != NULL
)
92 DfPrevWindow(DfNextWindow(wnd
)) = DfPrevWindow(wnd
);
95 if (wnd
== DfFirstWindow(pwnd
))
96 DfFirstWindow(pwnd
) = DfNextWindow(wnd
);
97 if (wnd
== DfLastWindow(pwnd
))
98 DfLastWindow(pwnd
) = DfPrevWindow(wnd
);
103 /* ---- append a window to the linked list ---- */
104 void DfAppendWindow(DFWINDOW wnd
)
108 DFWINDOW pwnd
= DfGetParent(wnd
);
111 if (DfFirstWindow(pwnd
) == NULL
)
113 DfFirstWindow(pwnd
) = wnd
;
114 DfLastWindow(pwnd
) = wnd
;
115 DfPrevWindow(wnd
) = NULL
;
119 DfNextWindow(DfLastWindow(pwnd
)) = wnd
;
120 DfPrevWindow(wnd
) = DfLastWindow(pwnd
);
121 DfLastWindow(pwnd
) = wnd
;
124 DfNextWindow(wnd
) = NULL
;
129 * if document windows and statusbar or menubar get the focus,
132 void DfSkipApplicationControls(void)
134 BOOL EmptyAppl
= FALSE
;
136 while (!EmptyAppl
&& DfInFocus
!= NULL
)
138 DFCLASS cl
= DfGetClass(DfInFocus
);
139 if (cl
== DF_MENUBAR
|| cl
== DF_STATUSBAR
)
142 EmptyAppl
= (cl
== DF_MENUBAR
&& ct
++);