本文整理汇总了C++中WidgetList类的典型用法代码示例。如果您正苦于以下问题:C++ WidgetList类的具体用法?C++ WidgetList怎么用?C++ WidgetList使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了WidgetList类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: add_from_list
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);
}
}
示例2: pickAtXY
// This method performs intersection testing at the given XY coords, and returns true if
// any intersections were found. It will break after processing the first pickable Window
// it finds.
bool WindowManager::pickAtXY(float x, float y, WidgetList& wl)
{
Intersections intr;
osg::Camera* camera = _view->getCamera();
osgViewer::GraphicsWindow* gw = dynamic_cast<osgViewer::GraphicsWindow*>(camera->getGraphicsContext());
if (gw)
{
_view->computeIntersections(camera, osgUtil::Intersector::WINDOW, x, y, intr, _nodeMask);
}
if (!intr.empty())
{
// Get the first Window at the XY coordinates; if you want a Window to be
// non-pickable, set the NodeMask to something else.
Window* activeWin = 0;
// Iterate over every picked result and create a list of Widgets that belong
// to that Window.
for(Intersections::iterator i = intr.begin(); i != intr.end(); i++) {
Window* win = dynamic_cast<Window*>(i->nodePath.back()->getParent(0));
// Make sure that our window is valid, and that our pick is within the
// "visible area" of the Window.
if(
!win ||
(win->getVisibilityMode() == Window::VM_PARTIAL && !win->isPointerXYWithinVisible(x, y))
) {
continue;
}
// Set our activeWin, so that we know when we've got all the Widgets
// that belong to it.
if(!activeWin) activeWin = win;
// If we've found a new Widnow, break out!
else if(activeWin != win) break;
Widget* widget = dynamic_cast<Widget*>(i->drawable.get());
if(!widget) continue;
// We need to return a list of every Widget that was picked, so
// that the handler can operate on it accordingly.
else wl.push_back(widget);
}
if(wl.size()) {
// Potentially VERY expensive; only to be used for debugging. :)
if(_flags & WM_PICK_DEBUG) _updatePickWindow(&wl, x, y);
return true;
}
}
if(_flags & WM_PICK_DEBUG) _updatePickWindow(0, x, y);
return false;
}
示例3: getWidgetList
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;
}
示例4: setFirstFocusable
bool Window::setFirstFocusable() {
WidgetList focusList;
if(getFocusList(focusList)) {
_setFocused(focusList.front().get());
return true;
}
return false;
}
示例5: getChildren
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);
}
}
示例6: registeredWidgets
//____________________________________________________________
BaseEngine::WidgetList WidgetStateEngine::registeredWidgets( AnimationModes mode ) const
{
WidgetList out;
// the typedef is needed to make Krazy happy
typedef DataMap<WidgetStateData>::Value Value;
if( mode&AnimationHover )
{
foreach( const Value& value, hoverData_ )
{ if( value ) out.insert( value.data()->target().data() ); }
}
示例7: RoundTextBox
WidgetList * WidgetList::clone(){
WidgetList * list = WidgetList::createNiceList(parent());
list->setStyle(style());
list->setLocation(mapToParent(Nimble::Vector2(0, 0)));
for (ItemList::iterator it = m_itemList.begin(); it != m_itemList.end(); ++it ) {
RoundTextBox * tb = dynamic_cast<RoundTextBox*>(*it);
RoundTextBox * tb2 = new RoundTextBox(0, 0, MultiWidgets::TextBox::HCENTER);
tb2->setCSSClass("FloatingWord_clone");
tb2->setStyle(tb->style());
tb2->setText(tb->text());
tb2->setWidth(tb->width());
tb2->setHeight(tb->height());
tb2->setAlignFlags(MultiWidgets::TextBox::HCENTER | MultiWidgets::TextBox::VCENTER);
list->addItem(tb2);
}
//layout();
list->layout();
list->setDepth(depth());
list->setScale(scale());
list->setRotation(rotation());
return list;
}
示例8:
void QFormScriptRunner::QFormScriptRunnerPrivate::initializeEngine(QWidget *w, const WidgetList &children, QScriptEngine &scriptEngine) {
// Populate the script variables. This pushes a context which must be popped.
QScriptContext *ctx = scriptEngine.pushContext();
QScriptValue widgetObject = scriptEngine.newQObject(w);
QScriptValue childrenArray = scriptEngine.newArray (children.size());
for(int i = 0; i < children.size(); i++) {
childrenArray.setProperty(i, scriptEngine.newQObject(children[i]));
}
const QFormBuilderStrings &strings = QFormBuilderStrings::instance();
ctx ->activationObject().setProperty(strings.scriptWidgetVariable, widgetObject);
ctx ->activationObject().setProperty(strings.scriptChildWidgetsVariable, childrenArray);
}
示例9: getChildren
/**
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;
}
示例10: getFocusList
bool Window::getFocusList(WidgetList& wl) const {
for(ConstIterator i = begin(); i != end(); i++) if(i->valid()) {
EmbeddedWindow* ew = dynamic_cast<EmbeddedWindow*>(i->get());
if(!ew) {
if(i->get()->canFocus()) wl.push_back(i->get());
}
else {
if(ew->getWindow()) ew->getWindow()->getFocusList(wl);
}
}
return wl.size() != 0;
}
示例11: getChildren
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();
}
示例12: PyErr_SetString
PyObject *viewList(PyObject *, PyObject *args)
{
if( !PyArg_ParseTuple(args, "") ){
PyErr_SetString(PyExc_TypeError, "no args required");
return NULL;
}
CUTE *cute = static_cast<CUTE*>(qApp->mainWidget());
PyObject *tuple = PyTuple_New(cute->windowsCount());
WidgetList list = cute->windows();
int i = 0;
for( QWidget* view = list.first(); view; view=list.next() ){
Buffer *buf = PyObject_New(Buffer, &buffer_type);
buf->view = static_cast<CUTEView*>(view)->scintilla();
Py_INCREF((PyObject*)buf);
PyTuple_SetItem(tuple, i, (PyObject*)buf);
i++;
}
return (PyObject*)tuple;
}
示例13: test
void test( lua_State* L )
{
getGlobalNamespace( L )
.beginClass<Widget>("Widget")
.addData("something", &Widget::something )
.endClass()
.addFunction( "getWidgets", &getWidgetList );
gWidgets.insert( std::pair<int, Widget::Ptr>( 1, new Widget(10) ) );
gWidgets.insert( std::pair<int, Widget::Ptr>( 2, new Widget(20) ) );
gWidgets.insert( std::pair<int, Widget::Ptr>( 3, new Widget(30) ) );
const char *source =
"print( _VERSION )\n"
"function dump(t)\n"
" print( 'Dump:' )\n"
" for k,v in pairs(t) do\n"
" print( k, v.something )\n"
" end\n"
"end\n";
cout << source << endl;
if( luaL_dostring( L, source ) )
{
cout << lua_tostring( L, -1 ) << endl;
lua_pop( L, 1 );
return;
}
for( int i=0; i <= 500; i++ )
{
luaL_dostring( L, "dump( getWidgets() )" );
lua_gc( L, LUA_GCCOLLECT, 0 );
}
return;
}
示例14: setNextFocusable
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;
}
示例15: WidgetList
WidgetList * WidgetList::createNiceList(Widget * parent, Widget * content) {
WidgetList * list = new WidgetList(parent);
if (content)
list->addItem(content);
list->setDepth(-1);
list->raiseFlag(WidgetList::LOCK_DEPTH);
list->addOperator(new MultiWidgets::StayInsideParentOperator);
//list->addOperator(new MultiWidgets::RotateTowardsHandsOperator);
list->addOperator(new MultiWidgets::LimitScaleOperator(MultiWidgets::LimitScaleOperator::COMPARE_SCALE,
1.0f, 2.0f));
return list;
}