Example #1
0
        /// <summary>
        /// When the header control sends a notification we need to 
        /// process the click to sort, button click for options menu,
        /// and filter change to update the items currently visible.
        /// </summary>
        /// <param name="h">NMHEADER</param>
        private void NotifyHeaderMessage( NMHEADER h )
        {
            // process only specific header notification messages
            switch( h.hdr.code )
            {

                // a header column was clicked, do the sort
                case ( int )W32_HDN.HDN_ITEMCLICKA:
                case ( int )W32_HDN.HDN_ITEMCLICKW:
                    _headerControl.SortColumn = _sortColumn = h.iItem;
                    _sortOrderAscending = _headerControl.SortOrder;
                    srt_datype = _headerControl.DataType[ _sortColumn ];
                    this.Sort();
                    SendMessage( this.Handle, W32_LVM.LVM_SETSELECTEDCOLUMN, _sortColumn, 0 );
                    SendMessage( this.Handle, W32_LVM.LVM_UPDATE, 0, 0 );
                    break;

                // a filter button was clicked display the popup menu
                // to handle setting filter options for the column
                case ( int )W32_HDN.HDN_FILTERBTNCLICK:
                    _activeColumn = h.iItem;
                    this.filterContextMenuStrip.Show( this, PointToClient( MousePosition ) );
                    break;

                // a filter content changed, update the items collection
                case ( int )W32_HDN.HDN_FILTERCHANGE:

                    // if this is for item -1 then this is a clear all filters
                    if( h.iItem < 0 ) _filters.Clear();

                   // if we are filtered this is a real filter data change
                    else if( _showFilters ) FilterBuild( h.iItem );

                    // update the items array with new filters applied
                    FilterUpdate();
                    break;

            }
        }
Example #2
0
 public TypedColumnHeader( ColumnHeaderDataType dataType )
 {
     _dataType = dataType;
 }