本文整理汇总了C++中WMenuItem类的典型用法代码示例。如果您正苦于以下问题:C++ WMenuItem类的具体用法?C++ WMenuItem怎么用?C++ WMenuItem使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了WMenuItem类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的C++代码示例。
示例1: switch
bool WWindow::processMsg( UINT msg, UINT wparm, LONG lparm )
{
switch( msg ) {
case WM_CLOSE:
close();
return TRUE;
case WM_DESTROY:
ifnil( GetParent( _handle ) ) {
PostQuitMessage( 0 );
}
return TRUE;
case WM_PAINT:
{
PAINTSTRUCT ps;
_dcHandle = BeginPaint( _handle, &ps );
bool ret = paint(); // do the actual painting
_dcHandle = 0;
EndPaint( _handle, &ps );
return ret;
}
case WM_COMMAND:
if( LOWORD( lparm ) == 0 ) {
if( HIWORD( lparm ) == 0 ) {
//message is from a menu
WMenuItem* itm = (WMenuItem*)WWindow::_objMap.findThis( (HANDLE)wparm );
ifptr( itm ) {
itm->picked();
return TRUE;
}
} else {
//message is from an accelerator
}
} else {
开发者ID:ABratovic,项目名称:open-watcom-v2,代码行数:33,代码来源:wwindow.cpp
示例2: itemAt
void WMenu::selectVisual(int index, bool changePath, bool showContents)
{
if (contentsStack_)
previousStackIndex_ = contentsStack_->currentIndex();
WMenuItem *item = index >= 0 ? itemAt(index) : 0;
if (changePath && internalPathEnabled_ &&
index != -1 && item->internalPathEnabled()) {
WApplication *app = wApp;
previousInternalPath_ = app->internalPath();
std::string newPath = basePath_ + item->pathComponent();
if (newPath != app->internalPath())
emitPathChange_ = true;
// The change is emitted in select()
app->setInternalPath(newPath);
}
for (int i = 0; i < count(); ++i)
renderSelected(itemAt(i), (int)i == index);
if (index == -1)
return;
if (showContents && contentsStack_) {
WWidget *contents = item->contents();
if (contents)
contentsStack_->setCurrentWidget(contents);
}
itemSelectRendered_.emit(item);
}
开发者ID:LifeGo,项目名称:wt,代码行数:34,代码来源:WMenu.C
示例3: setCurrent
void WMenu::select(int index, bool changePath)
{
int last = current_;
setCurrent(index);
selectVisual(current_, changePath, true);
if (index != -1) {
WMenuItem *item = itemAt(index);
item->show();
item->loadContents();
DeletionTracker guard(this);
if (changePath && emitPathChange_) {
WApplication *app = wApp;
app->internalPathChanged().emit(app->internalPath());
if (guard.deleted())
return;
emitPathChange_ = false;
}
if (last != index) {
item->triggered().emit(item);
if (!guard.deleted()) {
// item may have been deleted too
if (ul()->indexOf(item) != -1)
itemSelected_.emit(item);
else
select(-1);
}
}
}
}
开发者ID:LifeGo,项目名称:wt,代码行数:34,代码来源:WMenu.C
示例4: addItem
WMenuItem *WMenu::addMenu(const std::string& iconPath,
const WString& text, WMenu *menu)
{
WMenuItem *item = addItem(iconPath, text);
item->setMenu(menu);
return item;
}
开发者ID:NeilNienaber,项目名称:wt,代码行数:7,代码来源:WMenu.C
示例5: WMenuItem
WMenuItem *WMenu::addMenu(const std::string& iconPath,
const WString& text, WMenu *menu)
{
WMenuItem *item = new WMenuItem(iconPath, text, 0, WMenuItem::LazyLoading);
item->setMenu(menu);
addItem(item);
return item;
}
开发者ID:LifeGo,项目名称:wt,代码行数:8,代码来源:WMenu.C
示例6: return
WMenuItem * WEXPORT WPopupMenu::removeItemAt( int index ) {
/*********************************************************/
if( index >= 0 ) {
WMenuItem *item = (WMenuItem *)_children.removeAt( index );
item->detachMenu();
item->setParent( NULL );
return( item );
}
return( NULL );
}
开发者ID:,项目名称:,代码行数:11,代码来源:
示例7: itemSelected
void WPopupMenu::connectSignals(WPopupMenu * const topLevel)
{
topLevel_ = topLevel;
itemSelected().connect(topLevel, &WPopupMenu::done);
for (int i = 0; i < count(); ++i) {
WMenuItem *item = itemAt(i);
WPopupMenu *subMenu = dynamic_cast<WPopupMenu *>(item->menu());
if (subMenu)
subMenu->connectSignals(topLevel);
}
}
开发者ID:yarmola,项目名称:wt,代码行数:13,代码来源:WPopupMenu.C
示例8: indexOf
void WTabWidget::removeTab(WWidget *child)
{
int tabIndex = indexOf(child);
if (tabIndex != -1) {
contentsWidgets_.erase(contentsWidgets_.begin() + tabIndex);
WMenuItem *item = menu_->items()[tabIndex];
menu_->removeItem(item);
item->takeContents();
delete item;
}
}
开发者ID:Spencerx,项目名称:wt,代码行数:14,代码来源:WTabWidget.C
示例9: indexOf
std::unique_ptr<WWidget> WTabWidget::removeTab(WWidget *child)
{
int tabIndex = indexOf(child);
if (tabIndex != -1) {
contentsWidgets_.erase(contentsWidgets_.begin() + tabIndex);
WMenuItem *item = menu_->itemAt(tabIndex);
std::unique_ptr<WWidget> result = item->removeContents();
menu_->removeItem(item);
return result;
} else
return std::unique_ptr<WWidget>();
}
开发者ID:AmesianX,项目名称:wt,代码行数:14,代码来源:WTabWidget.C
示例10: WMenuItem
void MenuManager::makeItem( WPopupMenu * pop, const SubMenuInfo * info,
int idx, bool disable )
//-------------------------------------------------------------------------------
{
WMenuItem * item;
if( info[ idx ].menuName != NULL ) {
item = new WMenuItem( info[ idx ].menuName, this, (cbm) &MenuManager::menuSelected,
(cbh) &MenuManager::hintText, info[ idx ].hint );
item->setTagPtr( (void *) (info + idx) );
} else {
item = new WMenuSeparator;
}
pop->insertItem( item );
if( disable ) {
pop->enableItem( FALSE, idx );
}
}
开发者ID:ABratovic,项目名称:open-watcom-v2,代码行数:20,代码来源:menumgr.cpp
示例11: WPopupMenu
void WsMenu::loadPopupMenu(NodePtr pNodeParent, Wt::WPopupMenu* menuParent)
{
std::vector<NodePtr> dirNode = pNodeParent->getAll();
for (std::vector<NodePtr>::iterator it = dirNode.begin(); it != dirNode.end(); ++it) {
NodePtr curNode = *it;
if (!curNode.get()->getDisplayInMenu())
continue;
bool popupAllowed = (curNode.get()->getProperties().get()->get("global", "allow_popup", "true") == "true" ? true : false);
if ( curNode.get()->isDirectory() && popupAllowed ) {
WPopupMenu* pSubPopupMenu = new WPopupMenu();
loadPopupMenu(curNode, pSubPopupMenu);
WMenuItem* pMenuItem = menuParent->addMenu(curNode.get()->getDisplayName(true), pSubPopupMenu);
if ( asString(option("directorySelectable")) == "true" )
pMenuItem->setLink(WLink(WLink::InternalPath, curNode.get()->getPath().string()));;
} else {
WPopupMenuItem* pPopupItem = menuParent->addItem(curNode.get()->getDisplayName(true));
pPopupItem->setLink(makeLink(curNode.get()->getPath().string(), true));
if ( pPopupItem->link().type() == WLink::Url )
pPopupItem->setLinkTarget(TargetNewWindow);
}
}
}
开发者ID:Wittyshare,项目名称:wittyshare,代码行数:22,代码来源:WsMenu.cpp
示例12: setCurrent
void WMenu::select(int index, bool changePath)
{
int last = current_;
setCurrent(index);
selectVisual(current_, changePath, true);
if (index != -1) {
WMenuItem *item = itemAt(index);
item->show();
item->loadContents();
if (changePath && emitPathChange_) {
WApplication *app = wApp;
app->internalPathChanged().emit(app->internalPath());
emitPathChange_ = false;
}
if (last != index) {
item->triggered().emit(item);
itemSelected_.emit(item);
}
}
}
开发者ID:NeilNienaber,项目名称:wt,代码行数:24,代码来源:WMenu.C
示例13: itemAt
void WPopupMenu::adjustPadding()
{
bool needPadding = false;
for (int i = 0; i < count(); ++i) {
WMenuItem *item = itemAt(i);
if (!item->icon().empty() || item->isCheckable()) {
needPadding = true;
break;
}
}
for (int i = 0; i < count(); ++i) {
WMenuItem *item = itemAt(i);
item->setItemPadding(needPadding);
WPopupMenu *subMenu = dynamic_cast<WPopupMenu *>(item->menu());
if (subMenu)
subMenu->adjustPadding();
}
}
开发者ID:yarmola,项目名称:wt,代码行数:21,代码来源:WPopupMenu.C
示例14: switch
//.........这里部分代码省略.........
}
WGoogleMap *map = dynamic_cast<WGoogleMap *>(widget);
if (map) {
element.addPropertyWord(PropertyClass, "Wt-googlemap");
return;
}
WAbstractItemView *itemView = dynamic_cast<WAbstractItemView *>(widget);
if (itemView) {
element.addPropertyWord(PropertyClass, "form-horizontal");
return;
}
}
break;
case DomElement_LABEL:
{
WCheckBox *cb = dynamic_cast<WCheckBox *>(widget);
if (cb) {
element.addPropertyWord(PropertyClass, "checkbox");
if (cb->isInline())
element.addPropertyWord(PropertyClass, "inline");
} else {
WRadioButton *rb = dynamic_cast<WRadioButton *>(widget);
if (rb) {
element.addPropertyWord(PropertyClass, "radio");
if (rb->isInline())
element.addPropertyWord(PropertyClass, "inline");
}
}
}
break;
case DomElement_LI:
{
WMenuItem *item = dynamic_cast<WMenuItem *>(widget);
if (item) {
if (item->isSeparator())
element.addPropertyWord(PropertyClass, "divider");
if (item->isSectionHeader())
element.addPropertyWord(PropertyClass, "nav-header");
}
}
break;
case DomElement_INPUT:
{
WAbstractSpinBox *spinBox = dynamic_cast<WAbstractSpinBox *>(widget);
if (spinBox) {
element.addPropertyWord(PropertyClass, "Wt-spinbox");
return;
}
WDateEdit *dateEdit = dynamic_cast<WDateEdit *>(widget);
if (dateEdit) {
element.addPropertyWord(PropertyClass, "Wt-dateedit");
return;
}
}
break;
case DomElement_UL:
{
WPopupMenu *popupMenu
= dynamic_cast<WPopupMenu *>(widget);
if (popupMenu)
element.addPropertyWord(PropertyClass, "dropdown-menu");
else {
WMenu *menu = dynamic_cast<WMenu *>(widget);
if (menu) {
element.addPropertyWord(PropertyClass, "nav");
WTabWidget *tabs
= dynamic_cast<WTabWidget *>(menu->parent()->parent());
if (tabs)
element.addPropertyWord(PropertyClass, "nav-tabs");
} else {
WSuggestionPopup *suggestions
= dynamic_cast<WSuggestionPopup *>(widget);
if (suggestions)
element.addPropertyWord(PropertyClass, "typeahead");
}
}
}
case DomElement_SPAN:
{
WInPlaceEdit *inPlaceEdit
= dynamic_cast<WInPlaceEdit *>(widget);
if (inPlaceEdit)
element.addPropertyWord(PropertyClass, "Wt-in-place-edit");
}
break;
default:
break;
}
}
开发者ID:patrickjwhite,项目名称:wt,代码行数:101,代码来源:WBootstrapTheme.C
示例15: switch
void WBootstrapTheme::apply(WWidget *widget, DomElement& element,
int elementRole) const
{
bool creating = element.mode() == DomElement::Mode::Create;
if (!widget->isThemeStyleEnabled())
return;
{
WPopupWidget *popup = dynamic_cast<WPopupWidget *>(widget);
if (popup) {
WDialog *dialog = dynamic_cast<WDialog *>(widget);
if (!dialog)
element.addPropertyWord(Property::Class, "dropdown-menu");
}
}
switch (element.type()) {
case DomElementType::A: {
if (creating && dynamic_cast<WPushButton *>(widget))
element.addPropertyWord(Property::Class, classBtn(widget));
WPushButton *btn = dynamic_cast<WPushButton *>(widget);
if (creating && btn && btn->isDefault())
element.addPropertyWord(Property::Class, "btn-primary");
if (element.getProperty(Property::Class).find("dropdown-toggle")
!= std::string::npos) {
WMenuItem *item = dynamic_cast<WMenuItem *>(widget->parent());
if (!dynamic_cast<WPopupMenu *>(item->parentMenu())) {
DomElement *b = DomElement::createNew(DomElementType::B);
b->setProperty(Property::Class, "caret");
element.addChild(b);
}
}
break;
}
case DomElementType::BUTTON: {
if (creating && !widget->hasStyleClass("list-group-item"))
element.addPropertyWord(Property::Class, classBtn(widget));
WPushButton *button = dynamic_cast<WPushButton *>(widget);
if (button) {
if (creating && button->isDefault())
element.addPropertyWord(Property::Class, "btn-primary");
if (button->menu() &&
element.properties().find(Property::InnerHTML) !=
element.properties().end()) {
element.addPropertyWord(Property::InnerHTML,
"<span class=\"caret\"></span>");
}
if (creating && !button->text().empty())
element.addPropertyWord(Property::Class, "with-label");
if (!button->link().isNull())
LOG_ERROR("Cannot use WPushButton::setLink() after the button has "
"been rendered with WBootstrapTheme");
}
break;
}
case DomElementType::DIV:
{
WDialog *dialog = dynamic_cast<WDialog *>(widget);
if (dialog) {
if (version_ == BootstrapVersion::v2)
element.addPropertyWord(Property::Class, "modal");
else
element.addPropertyWord(Property::Class, "modal-dialog Wt-dialog");
return;
}
WPanel *panel = dynamic_cast<WPanel *>(widget);
if (panel) {
element.addPropertyWord(Property::Class, classAccordionGroup());
return;
}
WProgressBar *bar = dynamic_cast<WProgressBar *>(widget);
if (bar) {
switch (elementRole) {
case MainElement:
element.addPropertyWord(Property::Class, "progress");
break;
case ProgressBarBar:
element.addPropertyWord(Property::Class, classBar());
break;
case ProgressBarLabel:
element.addPropertyWord(Property::Class, "bar-label");
}
return;
}
WGoogleMap *map = dynamic_cast<WGoogleMap *>(widget);
//.........这里部分代码省略.........
开发者ID:kdeforche,项目名称:wt,代码行数:101,代码来源:WBootstrapTheme.C
示例16: setTabText
void WTabWidget::setTabText(int index, const WString& label)
{
WMenuItem *item = menu_->itemAt(index);
item->setText(label);
}
开发者ID:DTidd,项目名称:wt,代码行数:5,代码来源:WTabWidget.C
示例17:
const WString& WTabWidget::tabText(int index) const
{
WMenuItem *item = menu_->itemAt(index);
return item->text();
}
开发者ID:DTidd,项目名称:wt,代码行数:5,代码来源:WTabWidget.C
示例18: WText
void WsMenu::createMenu(NodePtr curNode, WMenu* menuParent)
{
std::string path2Icon;
WsUser* pUser = WsApp->wsUser();
std::string sIcon = curNode.get()->getProperties().get()->get("global", "icon", "");
if ( sIcon.size() > 1 ) {
NodePtr tmpNode = curNode;
if ( tmpNode.get()->isRegularFile() )
tmpNode = curNode.get()->getParent();
if ( tmpNode.get() ) {
path2Icon = tmpNode.get()->getFullPath().string() + "/ws.res/icones/" + sIcon;
if ( !boost::filesystem::exists(path2Icon) )
path2Icon.clear();
else {
boost::algorithm::replace_first(path2Icon, WsApp->docRoot(), "");
}
}
}
if ( asString(option("useButtons")) == "true" ) {
if ( curNode.get()->getPath().string() != "/" )
if ( asString(option("useSeparator")) == "true" ) {
WText* pText = new WText("|", this);
pText->addStyleClass("WsMenuSep");
}
WPushButton* button = new WPushButton(curNode.get()->getDisplayName(true), this);
m_vPushButton.push_back(button);
if ( path2Icon.size() > 1 ) {
button->setIcon(WLink(WLink::Url, path2Icon));
if ( curNode.get()->getProperties().get()->get("global", "button_text", "true") == "false" )
button->setText("");
}
// TODO : Ameliorer cette fonction
if ( (curNode.get()->isDirectory() && asString(option("directorySelectable")) == "true") ||
pUser->isAdministrator() || pUser->isEditor() ||
(asString(option("showRoot")) == "true" && curNode.get()->getPath() == "/")
) {
button->setLink(WLink(WLink::InternalPath, curNode.get()->getPath().string()));
}
if ( curNode.get()->isRegularFile() ) {
button->setLink(makeLink(curNode.get()->getPath().string(), false));
if ( button->link().type() == WLink::Url )
button->setLinkTarget(TargetNewWindow);
}
bool popupAllowed = (curNode.get()->getProperties().get()->get("global", "allow_popup", "true") == "true" ? true : false);
if ( curNode.get()->isDirectory() && popupAllowed && asString(option("usePopupMenu")) == "true" ) {
if ( !(asString(option("noRootPopup")) == "true" && curNode.get()->getPath() == "/") ) {
WPopupMenu* pPopup = new WPopupMenu();
pPopup->addStyleClass("wt-no-reparent");
loadPopupMenu(curNode, pPopup);
button->setMenu(pPopup);
pPopup->setAutoHide(true);
button->mouseWentOver().connect(boost::bind(&WsMenu::onMouseWentOver, this, button));
button->setMouseOverDelay(50);
}
}
} else { // No buttons, standard menu
if ( curNode.get()->getPath().string() != "/" )
menuParent->addSeparator();
WMenuItem* pItem = menuParent->addItem(curNode.get()->getDisplayName(true));
pItem->setLink(WLink(WLink::InternalPath, curNode.get()->getPath().string()));
if ( path2Icon.size() > 1 )
pItem->setIcon(path2Icon);
if ( curNode.get()->isDirectory() && asString(option("usePopupMenu")) == "true" )
if ( curNode.get()->getDirectories().size() ) {
WPopupMenu* pPopup = new WPopupMenu();
pPopup->addStyleClass("wt-no-reparent");
loadPopupMenu(curNode, pPopup);
pItem->setMenu(pPopup);
}
}
}
开发者ID:Wittyshare,项目名称:wittyshare,代码行数:71,代码来源:WsMenu.cpp
示例19: setTabToolTip
void WTabWidget::setTabToolTip(int index, const WString& tip)
{
WMenuItem *item = menu_->itemAt(index);
item->setToolTip(tip);
}
开发者ID:DTidd,项目名称:wt,代码行数:5,代码来源:WTabWidget.C
示例20: tabToolTip
WString WTabWidget::tabToolTip(int index) const
{
WMenuItem *item = menu_->itemAt(index);
return item->toolTip();
}
开发者ID:DTidd,项目名称:wt,代码行数:5,代码来源:WTabWidget.C
注:本文中的WMenuItem类示例由纯净天空整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论