const IBFact* IBFactVisitor::Next() { // ici j'ai fait tout ce que j'avais à faire avec le dernier node // -> on passe à l'enfant suivant if (NextChild() == false) { // on a parcouru tout les enfants if (m_Stack.size() == 0) return NULL; // -> On pop m_Stack.pop_back(); // -> on s'occupe du parent return LastFact(); } else { // on push tout les enfants possible while (HasChildren(LastFact())) { m_Stack.push_back(IBFactVisitor::Iterator(LastFact())); } return LastFact(); } }
/**\brief Generic keyboard key press function. */ bool Container::KeyPress( SDLKey key ) { Widget *next; if( keyboardFocus ) { // If this key is a TAB and the keyboard is currently focused on a Textbox, // then move to the next textbox if( (key == SDLK_TAB) && ( keyboardFocus->GetMask() & (WIDGET_TEXTBOX) ) ) { next = NextChild( keyboardFocus, WIDGET_TEXTBOX ); if( next == NULL ) { // Wrap around to the top next = ChildFromBottom( 0, WIDGET_TEXTBOX ); } if( next ) { keyboardFocus->KeyboardLeave(); keyboardFocus = next; keyboardFocus->KeyboardEnter(); } return true; } // Otherwise, pass the key Press normally return keyboardFocus->KeyPress( key ); } //LogMsg(INFO,"Key press detect in %s.",this->name.c_str()); return false; }
BOOL Object::CanClose() { Object *Child=FirstChild(); while (Child) { if (!Child->CanClose()) return FALSE; Child=NextChild(Child); } return TRUE; }
TEST_F(ConfigNodeTest, Children) { const auto node = config.LoadFromStringAndGetFirstChild(ConfigNodeData_1); const std::string expect[3] = { "a", "b", "c" }; int idx = 0; for (auto child = node.FirstChild(); !child.Empty(); child = child.NextChild()) { EXPECT_EQ(expect[idx++], child.Name()); } }
TEST_F(ConfigNodeTest, Children_2) { const auto node = config.LoadFromStringAndGetFirstChild(ConfigNodeData_3); int idx = 0; for (auto child = node.Child("w"); !child.Empty(); child = child.NextChild("w")) { EXPECT_EQ(idx++, child.Value<int>()); } EXPECT_EQ(3, idx); }
static PROJECTITEM *ExtractLeaf(void) { PROJECTITEM *list = workArea->children; while (list) { if (!list->visited) { PROJECTITEM *rv = NextChild(list); if (rv) { return rv; } else { list->visited = TRUE; return list; } } list = list->next; } return NULL; }
static PROJECTITEM *NextChild(PROJECTITEM *proj) { PROJECTITEMLIST *list = proj->depends; if (!proj->visited) { while (list) { if (!list->item->visited) { PROJECTITEM *rv = NextChild(list->item); if (rv) { return rv; } } list = list->next; } proj->visited = TRUE; return proj; } return NULL; }
static Busy * CreateBusy( Tcl_Interp *interp, /* Interpreter to report error to */ Tk_Window tkRef) /* Window hosting the busy window */ { Busy *busyPtr; int length, x, y; const char *fmt; char *name; Tk_Window tkBusy, tkChild, tkParent; Window parent; Tk_FakeWin *winPtr; busyPtr = (Busy *) ckalloc(sizeof(Busy)); x = y = 0; length = strlen(Tk_Name(tkRef)); name = ckalloc(length + 6); if (Tk_IsTopLevel(tkRef)) { fmt = "_Busy"; /* Child */ tkParent = tkRef; } else { Tk_Window tkwin; fmt = "%s_Busy"; /* Sibling */ tkParent = Tk_Parent(tkRef); for (tkwin = tkRef; (tkwin != NULL) && !Tk_IsTopLevel(tkwin); tkwin = Tk_Parent(tkwin)) { if (tkwin == tkParent) { break; } x += Tk_X(tkwin) + Tk_Changes(tkwin)->border_width; y += Tk_Y(tkwin) + Tk_Changes(tkwin)->border_width; } } for (tkChild = FirstChild(tkParent); tkChild != NULL; tkChild = NextChild(tkChild)) { Tk_MakeWindowExist(tkChild); } sprintf(name, fmt, Tk_Name(tkRef)); tkBusy = Tk_CreateWindow(interp, tkParent, name, NULL); ckfree(name); if (tkBusy == NULL) { return NULL; } Tk_MakeWindowExist(tkRef); busyPtr->display = Tk_Display(tkRef); busyPtr->interp = interp; busyPtr->tkRef = tkRef; busyPtr->tkParent = tkParent; busyPtr->tkBusy = tkBusy; busyPtr->width = Tk_Width(tkRef); busyPtr->height = Tk_Height(tkRef); busyPtr->x = Tk_X(tkRef); busyPtr->y = Tk_Y(tkRef); busyPtr->cursor = None; Tk_SetClass(tkBusy, "Busy"); busyPtr->optionTable = Tk_CreateOptionTable(interp, busyOptionSpecs); if (Tk_InitOptions(interp, (char *) busyPtr, busyPtr->optionTable, tkBusy) != TCL_OK) { Tk_DestroyWindow(tkBusy); return NULL; } SetWindowInstanceData(tkBusy, busyPtr); winPtr = (Tk_FakeWin *) tkRef; TkpCreateBusy(winPtr, tkRef, &parent, tkParent, busyPtr); MakeTransparentWindowExist(tkBusy, parent); Tk_MoveResizeWindow(tkBusy, x, y, busyPtr->width, busyPtr->height); /* * Only worry if the busy window is destroyed. */ Tk_CreateEventHandler(tkBusy, StructureNotifyMask, BusyEventProc, busyPtr); /* * Indicate that the busy window's geometry is being managed. This will * also notify us if the busy window is ever packed. */ Tk_ManageGeometry(tkBusy, &busyMgrInfo, busyPtr); if (busyPtr->cursor != None) { Tk_DefineCursor(tkBusy, busyPtr->cursor); } /* * Track the reference window to see if it is resized or destroyed. */ Tk_CreateEventHandler(tkRef, StructureNotifyMask, RefWinEventProc, busyPtr); return busyPtr; }