예제 #1
0
 /// <summary>
 ///   Constructor
 /// </summary>
 /// <param name = "hovertype"></param>
 /// <param name = "itemindex"></param>
 /// <param name = "columnindex"></param>
 /// <param name = "region"></param>
 public HoverEventArgs(HoverTypes hovertype, int itemindex, int columnindex, GLListRegion region)
 {
     m_Region       = region;
     m_nItemIndex   = itemindex;
     m_nColumnIndex = columnindex;
     m_HoverType    = hovertype;
 }
		/// <summary>
		/// Constructor
		/// </summary>
		/// <param name="hovertype"></param>
		/// <param name="itemindex"></param>
		/// <param name="columnindex"></param>
		/// <param name="region"></param>
		public HoverEventArgs( HoverTypes hovertype, int itemindex, int columnindex, GLListRegion region )
		{
			m_Region = region;
			m_nItemIndex = itemindex;
			m_nColumnIndex = columnindex;
			m_HoverType = hovertype;
		}
예제 #3
0
        /// <summary>
        /// interpret mouse coordinates
        /// 
        /// ok, I've violated the spirit of this routine a couple times (but no more!).  Do NOT put anything
        /// functional in this routine.  It is ONLY for analyzing the mouse coordinates.  Do not break this again!
        /// </summary>
        /// <param name="nScreenX"></param>
        /// <param name="nScreenY"></param>
        /// <param name="listRegion"></param>
        /// <param name="nCellX"></param>
        /// <param name="nCellY"></param>
        /// <param name="nItem"></param>
        /// <param name="nColumn"></param>
        /// <param name="nState"></param>
        public void InterpretCoords( int nScreenX, int nScreenY, out GLListRegion listRegion, out int nCellX, out int nCellY, out int nItem, out int nColumn, out ListStates nState )
        {
            DW("Interpret Coords");

            nState = ListStates.stateNone;
            nColumn = 0;		// compiler forces me to set this since it sometimes wont get set if routine falls through early
            nItem = 0;
            nCellX = 0;
            nCellY = 0;

            listRegion = GLListRegion.nonclient;

            /*
             * Calculate horizontal subitem
             */
            int nCurrentX = -hPanelScrollBar.Value;						// offset the starting point by the current scroll point

            for ( nColumn=0; nColumn < Columns.Count; nColumn++ )
            {
                GLColumn col = Columns[nColumn];
                // lets find the inner X for the cell
                nCellX = nScreenX - nCurrentX;

                if ( (nScreenX > nCurrentX) && (nScreenX < (nCurrentX+col.Width-RESIZE_ARROW_PADDING)) )
                {
                    nState = ListStates.stateColumnSelect;

                    break;
                }
                if ( (nScreenX >= (nCurrentX+col.Width-RESIZE_ARROW_PADDING)) && (nScreenX <= (nCurrentX+col.Width+RESIZE_ARROW_PADDING)) )
                {
                    // here we need to check see if this is a 0 length column (which we skip to next on) or if this is the last column (which we can't skip)
                    if ( (nColumn+1 == Columns.Count) || ( Columns[nColumn+1].Width != 0 ) )
                    {
                        if ( AllowColumnResize == true )
                            nState = ListStates.stateColumnResizing;

                        //Debug.WriteLine( "Sending our column number " + nColumn.ToString() );
                        return;				// no need for this to fall through
                    }
                }

                nCurrentX += col.Width;
            }

            if ( ( nScreenY >= RowsInnerClientRect.Y ) && ( nScreenY < RowsInnerClientRect.Bottom ) )
            {	// we are in the client area
                listRegion = GLListRegion.client;

                Columns.ClearHotStates();
                this.HotColumnIndex = -1;

                nItem = ((nScreenY - RowsInnerClientRect.Y) / ItemHeight) + vPanelScrollBar.Value;

                // get inner cell Y
                nCellY = (nScreenY - RowsInnerClientRect.Y) % ItemHeight;

                this.HotItemIndex = nItem;

                if ( ( nItem >= Items.Count ) || ( nItem > (this.vPanelScrollBar.Value + this.VisibleRowsCount) ) )
                {
                    nState = ListStates.stateNone;
                    listRegion = GLListRegion.nonclient;
                }
                else
                {
                    nState = ListStates.stateSelecting;

                    // handle case of where FullRowSelect is OFF and we click on the second part of a spanned column
                    for ( int nSubIndex = 0; nSubIndex < Columns.Count; nSubIndex++ )
                    {
                        //if ( ( nSubIndex + (Items[nItem].SubItems[nSubIndex].Span-1) ) >= nColumn )
                        if ( nSubIndex >= nColumn )
                        {
                            nColumn = nSubIndex;
                            return;
                        }
                    }
                }

                //Debug.WriteLine( "returning client from interpretcoords" );

                return;
            }
            else
            {
                if ( ( nScreenY >= this.HeaderRect.Y ) && ( nScreenY < this.HeaderRect.Bottom ) )
                {
                    //Debug.WriteLine( "Found header from interpret coords" );

                    listRegion = GLListRegion.header;

                    this.HotItemIndex = -1;			// we are in the header
                    this.HotColumnIndex = nColumn;

                    if ( ( ( nColumn > -1 ) && ( nColumn < Columns.Count ) ) && (!Columns.AnyPressed() ) )
                        if ( Columns[nColumn].State == ColumnStates.csNone)
                        {
                            Columns.ClearHotStates();
                            Columns[nColumn].State = ColumnStates.csHot;
                        }
                }
            }
            return;
        }