xref: /haiku/src/tests/add-ons/print/ppd/ui/UIUtils.cpp (revision 4420c1ceffd7f2246e4303d59cf02ed122980e9d)
1*4420c1ceSMichael Pfeiffer /*
2*4420c1ceSMichael Pfeiffer  * Copyright 2008, Haiku.
3*4420c1ceSMichael Pfeiffer  * Distributed under the terms of the MIT license.
4*4420c1ceSMichael Pfeiffer  *
5*4420c1ceSMichael Pfeiffer  * Authors:
6*4420c1ceSMichael Pfeiffer  *		Michael Pfeiffer <laplace@users.sourceforge.net>
7*4420c1ceSMichael Pfeiffer  */
8*4420c1ceSMichael Pfeiffer 
9*4420c1ceSMichael Pfeiffer #include "UIUtils.h"
10*4420c1ceSMichael Pfeiffer 
MakeEmpty(BListView * list)11*4420c1ceSMichael Pfeiffer void MakeEmpty(BListView* list)
12*4420c1ceSMichael Pfeiffer {
13*4420c1ceSMichael Pfeiffer 	if (list != NULL) {
14*4420c1ceSMichael Pfeiffer 		BListItem* item;
15*4420c1ceSMichael Pfeiffer 		while ((item = list->RemoveItem((int32)0)) != NULL) {
16*4420c1ceSMichael Pfeiffer 			delete item;
17*4420c1ceSMichael Pfeiffer 		}
18*4420c1ceSMichael Pfeiffer 	}
19*4420c1ceSMichael Pfeiffer }
20*4420c1ceSMichael Pfeiffer 
RemoveChildren(BView * view)21*4420c1ceSMichael Pfeiffer void RemoveChildren(BView* view)
22*4420c1ceSMichael Pfeiffer {
23*4420c1ceSMichael Pfeiffer 	if (view != NULL) {
24*4420c1ceSMichael Pfeiffer 		BView* child;
25*4420c1ceSMichael Pfeiffer 		while ((child = view->ChildAt(0)) != NULL) {
26*4420c1ceSMichael Pfeiffer 			child->RemoveSelf();
27*4420c1ceSMichael Pfeiffer 			delete child;
28*4420c1ceSMichael Pfeiffer 		}
29*4420c1ceSMichael Pfeiffer 	}
30*4420c1ceSMichael Pfeiffer }
31*4420c1ceSMichael Pfeiffer 
32