本文整理汇总了C++中zltoolbar::ItemPtr::isNull方法的典型用法代码示例。如果您正苦于以下问题:C++ ItemPtr::isNull方法的具体用法?C++ ItemPtr::isNull怎么用?C++ ItemPtr::isNull使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类zltoolbar::ItemPtr
的用法示例。
在下文中一共展示了ItemPtr::isNull方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: refreshToolbar
void ZLApplicationWindow::refreshToolbar() {
const ZLToolbar::ItemVector &items = application().toolbar().items();
bool canAddSeparator = false;
ZLToolbar::ItemPtr lastSeparator = 0;
for (ZLToolbar::ItemVector::const_iterator it = items.begin(); it != items.end(); ++it) {
if ((*it)->isSeparator()) {
if (canAddSeparator) {
lastSeparator = *it;
canAddSeparator = false;
} else {
setToolbarItemState(*it, false, true);
}
} else {
ZLToolbar::ButtonItem &button = (ZLToolbar::ButtonItem&)**it;
const std::string &id = button.actionId();
const bool visible = application().isActionVisible(id);
const bool enabled = application().isActionEnabled(id);
if (visible) {
if (!lastSeparator.isNull()) {
setToolbarItemState(lastSeparator, true, true);
lastSeparator = 0;
}
canAddSeparator = true;
}
setToolbarItemState(*it, visible, enabled);
}
}
if (!lastSeparator.isNull()) {
setToolbarItemState(lastSeparator, false, true);
}
}
示例2: toolbar
void ZLWin32ApplicationWindow::runPopup(const NMTOOLBAR &nmToolbar) {
Toolbar &tb = toolbar(isFullscreen() ? FULLSCREEN_TOOLBAR : WINDOW_TOOLBAR);
if (tb.hwnd == 0) {
return;
}
ZLToolbar::ItemPtr item = tb.TBItemByActionCode[nmToolbar.iItem];
if (!item.isNull()) {
const ZLToolbar::MenuButtonItem &button =
(const ZLToolbar::MenuButtonItem&)*item;
shared_ptr<ZLPopupData> popupData = button.popupData();
if (!popupData.isNull()) {
const int count = popupData->count();
if (count != 0) {
myPopupMenu = new ZLWin32PopupMenu(myMainWindow);
for (int i = 0; i < count; ++i) {
myPopupMenu->addItem(popupData->text(i), 0, true);
}
POINT p;
p.x = nmToolbar.rcButton.left;
p.y = nmToolbar.rcButton.bottom + 6;
ClientToScreen(myMainWindow, &p);
int code = myPopupMenu->run(p);
if (code > 0) {
popupData->run(code - 1);
}
myPopupMenu.reset();
}
}
}
}
示例3: SendMessage
void ZLWin32ApplicationWindow::processChevron(const NMREBARCHEVRON &chevron) {
RECT toolbarRect;
GetClientRect(myWindowToolbar.hwnd, &toolbarRect);
HIMAGELIST imageList = (HIMAGELIST)SendMessage(myWindowToolbar.hwnd, TB_GETIMAGELIST, 0, 0);
int imageIndex = 0;
const int len = SendMessage(myWindowToolbar.hwnd, TB_BUTTONCOUNT, 0, 0);
int index = 0;
for (; index < len; ++index) {
TBBUTTON info;
SendMessage(myWindowToolbar.hwnd, TB_GETBUTTON, index, (LPARAM)&info);
if ((info.fsState & TBSTATE_HIDDEN) == 0) {
RECT rect;
SendMessage(myWindowToolbar.hwnd, TB_GETITEMRECT, index, (LPARAM)&rect);
if (rect.right > toolbarRect.right) {
break;
}
}
if (info.idCommand > -100) {
++imageIndex;
}
}
myPopupMenu = new ZLWin32PopupMenu(myMainWindow);
for (; index < len; ++index) {
TBBUTTON info;
SendMessage(myWindowToolbar.hwnd, TB_GETBUTTON, index, (LPARAM)&info);
if ((info.fsState & TBSTATE_HIDDEN) == 0) {
ZLToolbar::ItemPtr item = myWindowToolbar.TBItemByActionCode[info.idCommand];
if (!item.isNull()) {
const ZLToolbar::AbstractButtonItem &button =
(const ZLToolbar::AbstractButtonItem&)*item;
myPopupMenu->addItem(
" " + button.tooltip(),
ImageList_GetIcon(imageList, imageIndex, ILD_NORMAL),
info.fsState & TBSTATE_ENABLED,
info.idCommand
);
} else if (info.idCommand >= -200) /* is a separator */ {
myPopupMenu->addSeparator();
}
}
if (info.idCommand > -100) {
++imageIndex;
}
}
POINT p;
p.x = chevron.rc.right - 2;
p.y = chevron.rc.bottom;
ClientToScreen(myMainWindow, &p);
onToolbarButtonRelease(myPopupMenu->run(p, true));
myPopupMenu.reset();
}
示例4: refreshToolbar
void ZLApplicationWindow::refreshToolbar(ToolbarType type) {
const ZLToolbar::ItemVector &items = application().toolbar(type).items();
bool canAddSeparator = false;
ZLToolbar::ItemPtr lastSeparator = 0;
for (ZLToolbar::ItemVector::const_iterator it = items.begin(); it != items.end(); ++it) {
switch ((*it)->type()) {
case ZLToolbar::Item::TEXT_FIELD:
case ZLToolbar::Item::COMBO_BOX:
case ZLToolbar::Item::SEARCH_FIELD:
case ZLToolbar::Item::PLAIN_BUTTON:
case ZLToolbar::Item::MENU_BUTTON:
{
ZLToolbar::ActionItem &button = (ZLToolbar::ActionItem&)**it;
const std::string &id = button.actionId();
const bool visible = application().isActionVisible(id);
const bool enabled = application().isActionEnabled(id);
if (visible) {
if (!lastSeparator.isNull()) {
setToolbarItemState(lastSeparator, true, true);
lastSeparator = 0;
}
canAddSeparator = true;
}
setToolbarItemState(*it, visible, enabled);
}
break;
case ZLToolbar::Item::TOGGLE_BUTTON:
{
ZLToolbar::ToggleButtonItem &button = (ZLToolbar::ToggleButtonItem&)**it;
const std::string &id = button.actionId();
const bool visible = application().isActionVisible(id);
const bool enabled = application().isActionEnabled(id);
if (visible) {
if (!lastSeparator.isNull()) {
setToolbarItemState(lastSeparator, true, true);
lastSeparator = 0;
}
canAddSeparator = true;
}
/*
if (!enabled && button.isPressed()) {
button.buttonGroup().press(0);
//application().doAction(group->UnselectAllButtonsActionId);
myToggleButtonLock = true;
setToggleButtonState(button);
myToggleButtonLock = false;
}
*/
setToolbarItemState(*it, visible, enabled);
setToggleButtonState(button);
}
break;
case ZLToolbar::Item::SEPARATOR:
if (canAddSeparator) {
lastSeparator = *it;
canAddSeparator = false;
} else {
setToolbarItemState(*it, false, true);
}
break;
case ZLToolbar::Item::FILL_SEPARATOR:
if (canAddSeparator) {
lastSeparator = *it;
canAddSeparator = false;
} else if (lastSeparator != 0) {
setToolbarItemState(lastSeparator, false, true);
lastSeparator = *it;
} else {
setToolbarItemState(*it, false, true);
}
break;
}
}
if (!lastSeparator.isNull()) {
setToolbarItemState(lastSeparator, false, true);
}
}