本文整理汇总了C++中Popup::popup方法的典型用法代码示例。如果您正苦于以下问题:C++ Popup::popup方法的具体用法?C++ Popup::popup怎么用?C++ Popup::popup使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Popup
的用法示例。
在下文中一共展示了Popup::popup方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: _activate_submenu
void PopupMenu::_activate_submenu(int over) {
Node* n = get_node(items[over].submenu);
ERR_EXPLAIN("item subnode does not exist: "+items[over].submenu);
ERR_FAIL_COND(!n);
Popup *pm = n->cast_to<Popup>();
ERR_EXPLAIN("item subnode is not a Popup: "+items[over].submenu);
ERR_FAIL_COND(!pm);
if (pm->is_visible())
return; //already visible!
Point2 p = get_global_pos();
Rect2 pr(p,get_size());
Ref<StyleBox> style = get_stylebox("panel");
pm->set_pos(p+Point2(get_size().width,items[over]._ofs_cache-style->get_offset().y));
pm->popup();
PopupMenu *pum = pm->cast_to<PopupMenu>();
if (pum) {
pr.pos-=pum->get_global_pos();
pum->clear_autohide_areas();
pum->add_autohide_area(Rect2(pr.pos.x,pr.pos.y,pr.size.x,items[over]._ofs_cache));
if (over<items.size()-1) {
int from = items[over+1]._ofs_cache;
pum->add_autohide_area(Rect2(pr.pos.x,pr.pos.y+from,pr.size.x,pr.size.y-from));
}
}
}
示例2: _activate_submenu
void PopupMenu::_activate_submenu(int over) {
Node *n = get_node(items[over].submenu);
ERR_EXPLAIN("item subnode does not exist: " + items[over].submenu);
ERR_FAIL_COND(!n);
Popup *pm = Object::cast_to<Popup>(n);
ERR_EXPLAIN("item subnode is not a Popup: " + items[over].submenu);
ERR_FAIL_COND(!pm);
if (pm->is_visible_in_tree())
return; //already visible!
Point2 p = get_global_position();
Rect2 pr(p, get_size());
Ref<StyleBox> style = get_stylebox("panel");
Point2 pos = p + Point2(get_size().width, items[over]._ofs_cache - style->get_offset().y);
Size2 size = pm->get_size();
// fix pos
if (pos.x + size.width > get_viewport_rect().size.width)
pos.x = p.x - size.width;
pm->set_position(pos);
pm->popup();
PopupMenu *pum = Object::cast_to<PopupMenu>(pm);
if (pum) {
pr.position -= pum->get_global_position();
pum->clear_autohide_areas();
pum->add_autohide_area(Rect2(pr.position.x, pr.position.y, pr.size.x, items[over]._ofs_cache));
if (over < items.size() - 1) {
int from = items[over + 1]._ofs_cache;
pum->add_autohide_area(Rect2(pr.position.x, pr.position.y + from, pr.size.x, pr.size.y - from));
}
}
}