예제 #1
0
        /// <summary>
        /// Show popups for each rectangle, using the now configured painter.
        /// </summary>
        private void showPopups(Rectangle[] rects, Rectangle bds, Rectangle visible, JComponent comp, JScrollPane view)
        {
            bool shown = false;

            for (int i = 0; i < rects.Length; i++)
            {
                Rectangle sect = rects[i];
                sect.translate(-bds.x, -bds.y);
                ImgComp part = painter.getPartial(sect, bds.x + rects[i].x < visible.x);
                Point   pos  = new Point(bds.x + rects[i].x, bds.y + rects[i].y);
                SwingUtilities.convertPointToScreen(pos, comp);
                if (comp is JList)
                {
                    //XXX off by one somewhere, only with JLists - where?
                    pos.y--;
                }
                if (pos.x > 0)
                {                 //Mac OS will reposition off-screen popups to x=0,
                    //so don't try to show them
                    popups[i] = PopupFactory.getPopup(view, part, pos.x, pos.y);
                    popups[i].show();
                    shown = true;
                }
            }
            if (shown)
            {
                setHideComponent(comp, view);
            }
            else
            {
                setHideComponent(null, null);                 //clear references
            }
        }