本文整理汇总了C++中Tab::getUri方法的典型用法代码示例。如果您正苦于以下问题:C++ Tab::getUri方法的具体用法?C++ Tab::getUri怎么用?C++ Tab::getUri使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Tab
的用法示例。
在下文中一共展示了Tab::getUri方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: mousedown
void TabBarElement::mousedown(int mouseButton, int x, int y) {
TabBarElement *tabBar = this;
x = tabBar->getAbsoluteBounds() != NULL ? x - tabBar->getAbsoluteBounds()->x : x;
y = tabBar->getAbsoluteBounds() != NULL ? y - tabBar->getAbsoluteBounds()->y : y;
FontStyle *font = (FontStyle *)tabBar->getAttributeObj("font");
int left = 0;
for(std::vector<Tab *>::iterator it = tabBar->getTabs()->begin(); it != tabBar->getTabs()->end(); ++it) {
Tab *tab = (Tab *)static_cast<Tab *>(*it);
string *title = tab->getName();
string *id = tab->getId();
string *uri = tab->getUri();
GraphicsContext *g = tabBar->createGraphics();
rectangle strSize = g->measureString((char *)title->c_str(), font);
int width = 20 + 100 + 20;
if (x > left && x < left + width) {
tabBar->activeTab = tab;
TabBarEventArgs *args = new TabBarEventArgs(tab);
tabBar->notify(string("tabselected"), (SPType *)tabBar, (EventArgs *)args);
cout << title->c_str();
break;
}
left += width;
}
tabBar->invalidate();
}
示例2: tabbar_mousedown
int tabbar_mousedown(SPType *sender, EventArgs *e) {
TabBarElement *tabBar = (TabBarElement *)sender;
MouseEventArgs *me = (MouseEventArgs *)e;
int x = tabBar->getAbsoluteBounds() != NULL ? me->getX() - tabBar->getAbsoluteBounds()->y : me->getX();
int y = tabBar->getAbsoluteBounds() != NULL ? me->getY() - tabBar->getAbsoluteBounds()->y : me->getY();
int left = 0;
;
for(std::vector<Tab *>::iterator it = tabBar->tabs->begin(); it != tabBar->tabs->end(); ++it) {
Tab *tab = (Tab *)dynamic_cast<Tab *>(*it);
string *title = tab->getName();
string *id = tab->getId();
string *uri = tab->getUri();
FontStyle *font = (FontStyle *)tabBar->getAttributeObj("font");
GraphicsContext *g = tabBar->createGraphics();
rectangle strSize = g->measureString((char *)title->c_str(), font);
int width = 20 + strSize.width + 20;
if (x > left && x < left + width) {
tabBar->activeTab = tab;
TabBarEventArgs *args = new TabBarEventArgs(tab);
tabBar->notify(string("tabselected"), (SPType *)tabBar, (EventArgs *)args);
}
left += width;
}
tabBar->invalidate();
}