本文整理汇总了C++中Filter::CheckIcons方法的典型用法代码示例。如果您正苦于以下问题:C++ Filter::CheckIcons方法的具体用法?C++ Filter::CheckIcons怎么用?C++ Filter::CheckIcons使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Filter
的用法示例。
在下文中一共展示了Filter::CheckIcons方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: OnLButtonUp
void DisplayView::OnLButtonUp(UINT nFlags, CPoint point)
{
point += GetScrollPosition();
// check for an overlay icon
if (drag_mode == DisplayView::DRAG_OVERLAY_ICON) {
Filter *current = graph.FindFilterByPos(point);
if (current && current == overlay_filter) {
int icon = current->CheckIcons(point);
if (icon >= 0) {
OnOverlayIconClick(current->overlay_icons[icon], point);
}
}
}
if (drag_mode == DisplayView::DRAG_CONNECTION) {
Pin *p1 = graph.FindPinByPos(new_connection_start);
Pin *p2 = graph.FindPinByPos(new_connection_end);
int ret = graph.ConnectPins(p1, p2);
if (ret < 0) {
// TODO: error message
}
}
new_connection_start = CPoint(-100,-100);
new_connection_end = CPoint(-101, -101);
drag_mode = DisplayView::DRAG_GROUP;
ReleaseCapture();
graph.Dirty();
Invalidate();
}
示例2: OnMouseMove
//.........这里部分代码省略.........
}
break;
case DisplayView::DRAG_CONNECTION:
{
new_connection_end = point;
Filter *current = graph.FindFilterByPos(point);
if (current) {
Pin *drop_end = current->FindPinByPos(point);
if (drop_end) {
drop_end->GetCenterPoint(&new_connection_end);
}
}
need_invalidate = true;
}
break;
case DisplayView::DRAG_SELECTION:
{
int minx = start_drag_point.x;
int miny = start_drag_point.y;
int maxx = point.x;
int maxy = point.y;
if (minx > maxx) {
minx = point.x;
maxx = start_drag_point.x;
}
if (miny > maxy) {
miny = point.y;
maxy = start_drag_point.y;
}
end_drag_point = point;
CRect rc(minx, miny, maxx, maxy);
for (int i=0; i<graph.filters.GetCount(); i++) {
Filter *filter = graph.filters[i];
CRect rc2(filter->posx, filter->posy,
filter->posx+filter->width,
filter->posy+filter->height);
CRect rc3;
rc3.IntersectRect(&rc, &rc2);
bool sel = (rc3.IsRectEmpty() ? false : true);
if (sel != filter->selected) {
filter->Select(sel);
need_invalidate = true;
}
}
if (!need_invalidate) {
Invalidate();
}
}
break;
}
if (need_invalidate) {
graph.Dirty();
Invalidate();
}
} else {
/*
No buttons are pressed. We only check for overlay icons
*/
Filter *current = graph.FindFilterByPos(point);
// if there was a filter active before
if (overlay_filter) {
// which was not ours
if (overlay_filter != current) {
// make it's overlay icon disappear
overlay_filter->overlay_icon_active = -1;
need_invalidate = true;
}
}
overlay_filter = current;
if (current) {
int cur_icon = current->overlay_icon_active;
int ret = current->CheckIcons(point);
if (ret != cur_icon) {
need_invalidate = true;
}
}
if (need_invalidate) {
graph.Dirty();
Invalidate();
}
}
}
示例3: OnLButtonDown
void DisplayView::OnLButtonDown(UINT nFlags, CPoint point)
{
point += GetScrollPosition();
SetCapture();
start_drag_point = point;
end_drag_point = point;
Filter *current = graph.FindFilterByPos(point);
if (!current) {
// deselect all filters
bool need_invalidate = false;
for (int i=0; i<graph.filters.GetCount(); i++) {
if (graph.filters[i]->selected) {
graph.filters[i]->Select(false);
}
graph.filters[i]->SelectConnection(nFlags, point);
need_invalidate = true;
}
// store the selection point
drag_mode = DisplayView::DRAG_SELECTION;
if (need_invalidate) {
graph.Dirty();
Invalidate();
}
return ;
}
// check if we hit a pin
Pin *hitpin = current->FindPinByPos(point);
if (hitpin) {
// deselect all filters
for (int i=0; i<graph.filters.GetCount(); i++) {
graph.filters[i]->Select(false);
}
// remember the start point
hitpin->GetCenterPoint(&new_connection_start);
new_connection_end = new_connection_start;
drag_mode = DisplayView::DRAG_CONNECTION;
} else {
int icon = current->CheckIcons(point);
if (icon >= 0) {
drag_mode = DisplayView::DRAG_OVERLAY_ICON;
return ;
}
if (current->selected) {
if (nFlags & MK_SHIFT) {
current->Select(false);
graph.Dirty();
Invalidate();
} else {
// nothing here...
}
} else {
if (nFlags & MK_SHIFT) {
current->Select(true);
graph.Dirty();
Invalidate();
} else {
// deselect all filters but this
for (int i=0; i<graph.filters.GetCount(); i++) {
graph.filters[i]->Select(false);
}
current->Select(true);
graph.Dirty();
Invalidate();
}
}
drag_mode = DisplayView::DRAG_GROUP;
// start dragging operation on all selected filters
start_drag_point = point;
for (int i=0; i<graph.filters.GetCount(); i++) {
graph.filters[i]->BeginDrag();
}
}
}