void XYView_helper::pick(Canvas* c, const Allocation& a, int depth, Hit& h) { if (MyMath::inside(h.left(), h.bottom(), v_->left(), v_->bottom(), v_->right(), v_->top())) { if (h.event()->grabber()) { // fixes a bug but I dont know why #if 1 //The above fix broke the handling of keystrokes for crosshairs and Rotate3D //It was needed so that buttons would appear normal when moving quickly from // a button through a box to a scene. Now we put in the right handler in //case event was a keystroke. if (h.event()->type() == Event::key) { h.target(depth, this, 0, h.event()->grabber()); } #endif return; } current_pick_view_ = v_; MonoGlyph::pick(c, a, depth, h); if (h.event()->type() == Event::down) { #if 0 printf("XYView_helper hit (%g, %g) event (%g, %g)\n", h.left(), h.bottom(), h.event()->pointer_x(), h.event()->pointer_y()); printf(" allocation lb=(%g, %g), rt=(%g,%g)\n", a.left(), a.bottom(), a.right(), a.top()); #endif } } }
void Character::pick(Canvas*, const Allocation& a, int depth, Hit& h) { Coord x = h.left(); Coord y = h.bottom(); Coord left = a.left(); Coord right = a.right(); if (x >= left && x < right) { h.target(depth, this, (x > (left+right)/2) ? 1 : 0); } }
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); } }
void MonoKitFrame::pick(Canvas* c, const Allocation& a, int depth, Hit& h) { if (target_) { Coord x = h.left(); Coord y = h.bottom(); if (x >= a.left() && x < a.right() && y >= a.bottom() && y < a.top()) { h.target(depth, this, 0); } } else { BevelFrame::pick(c, a, depth, h); } }
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(); }
void DebugGlyph::pick(Canvas* c, const Allocation& a, int depth, Hit& h) { if ((flags_ & trace_pick) != 0) { heading("pick "); printf( "at (%.2f,%.2f,%.2f,%.2f) ", h.left(), h.bottom(), h.right(), h.top() ); print_allotment(a.allotment(Dimension_X)); printf(", "); print_allotment(a.allotment(Dimension_Y)); printf("\n"); } MonoGlyph::pick(c, a, depth, h); }
void Page::pick(Canvas* c, const Allocation& a, int depth, Hit& h) { if (background_ != nil) { background_->pick(c, a, depth, h); } GlyphIndex count = info_->count(); for (GlyphIndex index = 0; index < count; ++index) { PageInfo& info = info_->item_ref(index); if (info.glyph_ != nil && !(info.status_ & PageInfoHidden)) { Allocation& a = info.allocation_; if (h.right() >= a.left() && h.left() < a.right() && h.top() >= a.bottom() && h.bottom() < a.top() ) { h.begin(depth, this, index); info.glyph_->pick(c, a, depth + 1, h); h.end(); } } } }
void TBScrollBox::pick(Canvas* c, const Allocation& a, int depth, Hit& h) { TBScrollBoxImpl& sb = *impl_; sb.check(c, a); if (h.left() < a.right() && h.right() >= a.left() && h.bottom() < a.top() && h.top() >= a.bottom() ) { if (sb.changed_) { sb.refresh(); } GlyphIndex n = sb.start_; for (ListItr(TBScrollBoxList) i(sb.visible_); i.more(); i.next()) { const TBScrollBoxInfo& info = i.cur_ref(); Glyph* g = info.glyph_; h.begin(depth, this, n); g->pick(c, info.allocation_, depth + 1, h); h.end(); ++n; } } }
void Box::pick(Canvas* c, const Allocation& a, int depth, Hit& h) { if (h.right() >= a.left() && h.left() < a.right() && h.top() >= a.bottom() && h.bottom() < a.top() ) { BoxImpl* b = impl_; Extension ext; ext.clear(); AllocationInfo& info = b->info(c, a, ext); Allocation* aa = info.component_allocations(); GlyphIndex n = count(); for (GlyphIndex i = 0; i < n; i++) { Glyph* g = component(i); if (g != nil) { h.begin(depth, this, i); g->pick(c, aa[i], depth + 1, h); h.end(); } } } }