Class AbstractGridGroupRenderer

    • Field Detail

      • minMargin

        protected int minMargin
      • margin

        protected int margin
      • autoMargin

        protected boolean autoMargin
      • itemWidth

        protected int itemWidth
      • itemHeight

        protected int itemHeight
      • alwaysExpanded

        private boolean alwaysExpanded
        If true, groups are always expanded and toggle button is not displayed
    • Constructor Detail

      • AbstractGridGroupRenderer

        public AbstractGridGroupRenderer()
    • Method Detail

      • layout

        public void layout​(org.eclipse.swt.graphics.GC gc,
                           GalleryItem group)
        Description copied from class: AbstractGalleryGroupRenderer
        This method is called on each root item when the Gallery changes (resize, item addition or removal) in order to update the gallery size. The implementation must update the item internal size (px) using setGroupSize(item, size); before returning.
        Specified by:
        layout in class AbstractGalleryGroupRenderer
      • isAlwaysExpanded

        public boolean isAlwaysExpanded()
        If true, groups are always expanded and toggle button is not displayed
        Returns:
        true if groups are always expanded
      • isGroupExpanded

        protected boolean isGroupExpanded​(GalleryItem item)
        Return item expand state (item.isExpanded()) Returns always true is alwaysExpanded is set to true.
        Parameters:
        item -
        Returns:
      • setAlwaysExpanded

        public void setAlwaysExpanded​(boolean alwaysExpanded)
        If true, groups are always expanded and toggle button is not displayed if false, expand status depends on each item.
        Parameters:
        alwaysExpanded -
      • getMinMargin

        public int getMinMargin()
      • getItemWidth

        public int getItemWidth()
      • setItemWidth

        public void setItemWidth​(int itemWidth)
      • getItemHeight

        public int getItemHeight()
      • setItemHeight

        public void setItemHeight​(int itemHeight)
      • updateGallery

        private void updateGallery()
      • setItemSize

        public void setItemSize​(int width,
                                int height)
      • setMinMargin

        public void setMinMargin​(int minMargin)
      • isAutoMargin

        public boolean isAutoMargin()
      • setAutoMargin

        public void setAutoMargin​(boolean autoMargin)
      • calculateMargins

        protected int calculateMargins​(int size,
                                       int count,
                                       int itemSize)
      • getSize

        protected org.eclipse.swt.graphics.Point getSize​(int nbx,
                                                         int nby,
                                                         int itemSizeX,
                                                         int itemSizeY,
                                                         int minMargin,
                                                         int autoMargin)
      • drawItem

        protected void drawItem​(org.eclipse.swt.graphics.GC gc,
                                int index,
                                boolean selected,
                                GalleryItem parent,
                                int offsetY)
        Draw a child item. Only used when useGroup is true.
        Parameters:
        gc -
        index -
        selected -
        parent -
      • getVisibleItems

        protected int[] getVisibleItems​(GalleryItem group,
                                        int x,
                                        int y,
                                        int clipX,
                                        int clipY,
                                        int clipWidth,
                                        int clipHeight,
                                        int offset)
      • gridLayout

        protected org.eclipse.swt.graphics.Point gridLayout​(int size,
                                                            int nbItems,
                                                            int itemSize)
        Calculate how many items are displayed horizontally and vertically.
        Parameters:
        size -
        nbItems -
        itemSize -
        Returns:
      • mouseDown

        public boolean mouseDown​(GalleryItem group,
                                 org.eclipse.swt.events.MouseEvent e,
                                 org.eclipse.swt.graphics.Point coords)
      • getLayoutData

        protected org.eclipse.swt.graphics.Point getLayoutData​(GalleryItem item)
      • getSize

        protected org.eclipse.swt.graphics.Rectangle getSize​(GalleryItem item,
                                                             int offsetY)
      • getItem

        protected GalleryItem getItem​(GalleryItem group,
                                      org.eclipse.swt.graphics.Point coords,
                                      int offsetY)
        Get item at pixel position
        Parameters:
        coords -
        Returns:
      • goUp

        private GalleryItem goUp​(GalleryItem group,
                                 int posParam,
                                 int hCount)
        Get the next item, when going up.
        Parameters:
        group - current group
        posParam - index of currently selected item
        hCount - size of a line
        Returns:
      • goDown

        private GalleryItem goDown​(GalleryItem group,
                                   int posParam,
                                   int hCount)
        Get the next item, when going down.
        Parameters:
        group - current group
        posParam - index of currently selected item
        hCount - size of a line
        Returns:
      • getMaxVisibleLines

        private int getMaxVisibleLines()
        Get maximum visible lines.
        Returns:
      • getItemAt

        private GalleryItem getItemAt​(GalleryItem group,
                                      int pos,
                                      int from)
        Return the child item of group which is at column 'pos' starting from direction. If this item doesn't exists, returns the nearest item.
        Parameters:
        group -
        pos -
        from - START or END
        Returns: