static void add_from_list(WidgetList &lst, Panel *self, int &X, bool inc) { WidgetListIt it = lst.begin(), ite = lst.end(); Fl_Widget *o; while(it != ite) { o = *it; /* 'inc == false' means we are going from right to left */ if(!inc) X -= o->w(); /* place it correctly */ o->position(X, o->y()); self->add(o); if(inc) { X += DEFAULT_SPACING; X += o->w(); } else { X -= DEFAULT_SPACING; } it = lst.erase(it); } }
void SplitBar::updateChildrenVisibility() { // Hide children that aren't first or second WidgetList children = getChildren(); for (WidgetList::iterator it = children.begin(); it != children.end(); ++it) { Widget* child = *it; child->setVisible(child == m_pane1 || child == m_pane2); } }
LuaRef getWidgetList( lua_State* L ) { LuaRef table = newTable(L); for( WidgetListIter i = gWidgets.begin(); i != gWidgets.end(); i++ ) { table[i->first] = i->second; } return table; }
/** Returns a MdiChild by its ID. */ MdiChild* MdiClient::getChildById(int wID) { WidgetList children = getChildren(); for (WidgetList::iterator it=children.begin(); it!=children.end(); ++it) { HWND hChild = (*it)->getHandle(); assert(hChild != NULL); if (GetWindowLong(hChild, GWL_ID) == wID) return static_cast<MdiChild*>(*it); } return NULL; }
void Tab::onPageChange(Event& ev) { TabBase::onPageChange(ev); WidgetList pages = getChildren(); int pageIndex = 0; int selectedPage = getActivePage(); for (WidgetList::iterator it = pages.begin(); it != pages.end(); ++it, ++pageIndex) { TabPage* page = dynamic_cast<TabPage*>(*it); assert(page != NULL); page->setVisible(pageIndex == selectedPage); } layout(); }
bool Window::setNextFocusable() { WidgetList focusList; if(!getFocusList(focusList)) return false; WidgetList::iterator w = focusList.begin(); // TODO: This needs to be a more complicated object, since the focus may be // in a child Window instead of a Widget. unsigned int focusedIndex = 0; for(unsigned int i = 0; w != focusList.end(); w++, i++) if(*w == _focused) { focusedIndex = i; break; } if(focusedIndex < focusList.size() - 1) _setFocused((++w)->get()); else _setFocused(focusList.front().get()); return true; }