Пример #1
0
 public override ListItemAttr OnGetItemAttr(int item)
 {
     if (item % 10 == 0)
     {
         if (this._itemAttrMod10 == null)
         {
             this._itemAttrMod10 = new ListItemAttr(ColourDatabase.TheColourDatabase.Find("WHITE"), ColourDatabase.TheColourDatabase.Find("DARK GREY"), this.Font);
         }
         return(this._itemAttrMod10);
     }
     else if (item % 2 == 0)
     {
         if (this._itemAttrMod2 == null)
         {
             this._itemAttrMod2 = new ListItemAttr(ColourDatabase.TheColourDatabase.Find("BLACK"), ColourDatabase.TheColourDatabase.Find("LIGHT GREY"), this.Font);
         }
         return(this._itemAttrMod2);
     }
     return(null);
 }
Пример #2
0
        //---------------------------------------------------------------------

        public void OnListKeyDown(object sender, Event e)
        {
            ListEvent le = e as ListEvent;

            switch (le.KeyCode)
            {
            case 'c':     // colorize
            case 'C':
            {
                ListItem info = new ListItem();
                info.Id = le.Index;
                GetItem(info);

                ListItemAttr attr = info.Attributes;
                if (attr == null || !attr.HasTextColour)
                {
                    info.TextColour = Colour.wxCYAN;

                    SetItem(info);

                    RefreshItem(info.Id);
                }
                info.Dispose();
            }
            break;

            case 'n':     // next
            case 'N':
            {
                int item = GetNextItem(-1,
                                       ListCtrl.NEXT.ALL, ListItemState.FOCUSED);
                if (item++ == ItemCount - 1)
                {
                    item = 0;
                }

                Log.LogMessage("Focusing item " + item);

                SetItemState(item, ListItemState.FOCUSED, ListItemState.FOCUSED);
                EnsureVisible(item);
            }
            break;

            case (int)KeyCode.WXK_DELETE:
            {
                int item = GetNextItem(-1,
                                       ListCtrl.NEXT.ALL, ListItemState.SELECTED);
                while (item != -1)
                {
                    DeleteItem(item);

                    Log.LogMessage("Item " + item + " deleted");

                    // -1 because the indices were shifted by DeleteItem()
                    item = GetNextItem(item - 1,
                                       ListCtrl.NEXT.ALL, ListItemState.SELECTED);
                }
            }
            break;

            case (int)KeyCode.WXK_INSERT:
                if ((StyleFlags & wx.WindowStyles.LC_REPORT) > 0)
                {
                    if ((StyleFlags & wx.WindowStyles.LC_VIRTUAL) > 0)
                    {
                        ItemCount = ItemCount + 1;
                    }
                    else     // !virtual
                    {
                        InsertItemInReportView(le.Index);
                    }
                }
                //else: fall through
                break;     //???

            default:
                LogEvent(sender, e, "OnListKeyDown");

                le.Skip();
                break;
            }
        }