当前位置: 首页>>代码示例>>C++>>正文


C++ WContainerWidget::removeWidget方法代码示例

本文整理汇总了C++中wt::WContainerWidget::removeWidget方法的典型用法代码示例。如果您正苦于以下问题:C++ WContainerWidget::removeWidget方法的具体用法?C++ WContainerWidget::removeWidget怎么用?C++ WContainerWidget::removeWidget使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在wt::WContainerWidget的用法示例。


在下文中一共展示了WContainerWidget::removeWidget方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。

示例1: setMenu

void WMenuItem::setMenu(WMenu *menu)
{
  subMenu_ = menu;
  subMenu_->parentItem_ = this;

  Wt::WContainerWidget *sparent
    = dynamic_cast<Wt::WContainerWidget *>(subMenu_->parent());
  if (sparent)
    sparent->removeWidget(subMenu_);

  addWidget(subMenu_);
  if (subMenu_->isPopup() &&
      parentMenu() && parentMenu()->isPopup()) {
    subMenu_->webWidget()->setZIndex(std::max(parentMenu()->zIndex() + 100, subMenu_->zIndex()));
  }

  WPopupMenu *popup = dynamic_cast<WPopupMenu *>(subMenu_);
  if (popup) {
    popup->setJavaScriptMember("wtNoReparent", "true");
    setSelectable(false);
    popup->setButton(anchor());
    updateInternalPath();
    // WPopupMenus are hidden by default, 'show' this WPopupMenu
    // but not really, since the parent is still hidden. This fixes
    // an issue where child widgets would remain unexposed, even
    // though this submenu was open (e.g. in a submenu where items
    // are checkable)
    if (dynamic_cast<WPopupMenu*>(menu_))
      popup->show();
  }
}
开发者ID:chr-thien,项目名称:wt,代码行数:31,代码来源:WMenuItem.C

示例2: setMenu

void WMenuItem::setMenu(WMenu *menu)
{
  subMenu_ = menu;
  subMenu_->parentItem_ = this;

  Wt::WContainerWidget *sparent
    = dynamic_cast<Wt::WContainerWidget *>(subMenu_->parent());
  if (sparent)
    sparent->removeWidget(subMenu_);

  addWidget(subMenu_);

  WPopupMenu *popup = dynamic_cast<WPopupMenu *>(subMenu_);
  if (popup) {
    popup->setJavaScriptMember("wtNoReparent", "true");
    setSelectable(false);
    popup->setButton(anchor());
    updateInternalPath();
  }
}
开发者ID:bend,项目名称:wt,代码行数:20,代码来源:WMenuItem.C

示例3: MyTreeTableNode

MyTreeTableNode *MyTreeTableNode::addNode(MyTreeTableNode *parent, Wt::WString name, const long start, const long stop, bool mini ) {
	MyTreeTableNode *node = new MyTreeTableNode(name, 0, parent);
	Wt::WContainerWidget *labelArea = node->labelArea();
	Wt::WWidget *labelWidget = labelArea->widget(0); //See source of WTreeNode.
	labelArea->removeWidget(labelWidget);
	node->startWidget = new TimeWidget(); //We make these, even if we're doing the mini-tree. We use these widgets to store the actual data, so that if we need the start or stop time, we can get them out of the widget and get the right numbers, even if we haven't saved the fragment set yet.
	node->startWidget->setTime(start);
	node->stopWidget = new TimeWidget();
	node->stopWidget->setTime(stop);
	
	if (mini)
	{
		node->startButton = new Wt::WPushButton(name);
	}
	else
	{
		node->editWidget = new Wt::WInPlaceEdit();
		std::string str = name.toUTF8();
		str.erase(std::remove(str.begin(), str.end(), ' '), str.end()); //This removes whitespace
		if(str.length()<1)
		{
			node->editWidget->setText(Wt::WString::Empty);	
			node->editWidget->setPlaceholderText("New Node");	
		
		}
		else
		{
			node->editWidget->setText(name);	
		}
		node->editWidget->valueChanged().connect(std::bind([=]() {
			
			std::string str = node->editWidget->text().toUTF8();
			str.erase(std::remove(str.begin(), str.end(), ' '), str.end()); //This removes whitespace
			if(str.length()<1)
			{
				node->editWidget->setText(Wt::WString::Empty);	
			}
			node->text = node->editWidget->text();
		}));
	
		node->text = node->editWidget->text();
	
		node->startButton = new Wt::WPushButton("|>");
	}
//todo: add doubleclick trick to allow modal edit
	node->startButton->clicked().connect(std::bind([=]() { 
		if(start == -1)
		{	//We've clicked the startbutton on a group, so we need to find the first non-group widget. 
			if (node->childNodes().size() > 0)
			{
 				//So, there are children.. In this case take the first child and pretend we've clicked that startButton. It'll be recursive. 
				MyTreeTableNode *firstChild = dynamic_cast<MyTreeTableNode*> (*(node->childNodes()).begin());
				return firstChild->startButton->clicked().emit(Wt::WMouseEvent());
			}
			else
			{ //Where in a childless group, so we cannot play anything!
				return;
			}

		}
		Wt::Json::Object jStartBefore = zmq_conn::interact("inputs?"); 
		Wt::Json::Array aStartBefore = jStartBefore.get("before");
		signed long long startBefore = aStartBefore[2];
		zmq_conn::interact(Wt::WString("event:stop")); //Probably needed to help stop the track from stopping the middle of a play

		Wt::WString command="play:"+std::to_string(start - startBefore * 1000); 
		zmq_conn::interact(command);
	}));
	labelArea->addWidget(node->startButton);
	if(mini)
	{
	}
	else
	{ //0 is startbutton now
		//node->setColumnWidget(1, node->startButton);
		node->setColumnWidget(1,node->editWidget );
		node->setColumnWidget(2, node->startWidget); 
		node->setColumnWidget(3, node->stopWidget);
	}
	return node;
    }
开发者ID:wijnen,项目名称:ear,代码行数:81,代码来源:fragmentTree.C


注:本文中的wt::WContainerWidget::removeWidget方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。