本文整理汇总了C++中Hit::event方法的典型用法代码示例。如果您正苦于以下问题:C++ Hit::event方法的具体用法?C++ Hit::event怎么用?C++ Hit::event使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Hit
的用法示例。
在下文中一共展示了Hit::event方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: pick
boolean StandardPicker::pick(Canvas* c, Glyph* glyph, int depth, Hit& h) {
if (!h.event()) {
return false;
}
const Event& e = *h.event();
if (e.grabber()) {
h.target(depth, glyph, 0, e.grabber());
return true;
}
event(e);
long cnt = handlers_[ms_]->count();
for (long i=0; i < cnt; ++i) {
ButtonHandler& b = *handlers_[ms_]->item(i);
if (b.eb_ == Event::any || b.eb_ == mb_) {
if (b.handler_) {
h.target(depth, glyph, 0, b.handler_);
}else{
b.rband_->canvas(c);
h.target(depth, glyph, 0, b.rband_);
}
return true;
}
}
return false;
}
示例2: pick
void XYView::pick(Canvas* c, const Allocation& a, int depth, Hit& h) {
canvas_ = c;
c->push_transform();
if (h.event()->type() == Event::down) {
#if 0
printf("XYView hit (%g, %g) event (%g, %g)\n", h.left(), h.bottom(),
h.event()->pointer_x(), h.event()->pointer_y());
#endif
}
TransformSetter::pick(c, a, depth, h);
c->pop_transform();
}
示例3: pick
void GlyphViewer::pick(Canvas* c, const Allocation& a, int depth, Hit& h) {
const Event* e = h.event();
if (e->control_is_down()) {
InputHandler::pick(c, a, depth, h);
} else if (e->type() == Event::down) {
h.begin(depth, this, 0, _grabber);
MonoGlyph::pick(c, a, depth, h);
h.end();
}
}
示例4: pick
void FieldStringEditor::pick(
Canvas*, const Allocation& a, int depth, Hit& h
) {
const Event* ep = h.event();
if (ep != nil && h.left() < a.right() && h.right() >= a.left() &&
h.bottom() < a.top() && h.top() >= a.bottom()
) {
h.target(depth, this, 0);
}
}
示例5: pick
void Text::pick(Canvas*, const Allocation&, int depth, Hit& h) {
const Event* e = h.event();
EventButton t = (e == nil) ? Event::none : e->pointer_button();
EventType t1 = (e == nil) ? Event::undefined : e->type();
if (t == Event::left || t == Event::right ||
t == Event::middle || t1 == Event::key) {
Coord x = e->pointer_x();
Coord y = e->pointer_y();
Allocation* a = allocation_;
if (x >= a->left() && x <= a->right() && y >= a->bottom() && y <= a->top()) {
h.target(depth, this, 0, handler());
}
}
}