wx.SampleListCtrl.MyFrame Class Reference

List of all members.

Public Member Functions

bool CheckNonVirtual ()
void DoSize ()
void InitWithIconItems (bool withText, bool sameIcon)
void InitWithIconItems (bool withText)
void InitWithListItems ()
void InitWithReportItems ()
void InitWithVirtualItems ()
int MyCompareFunction (ClientData itemData1, ClientData itemData2, int sortData)
 MyFrame (string title, Point pos, Size size)
void OnAbout (object sender, Event e)
void OnAdd (object sender, Event e)
void OnClosing (object sender, Event e)
void OnDelete (object sender, Event e)
void OnDeleteAll (object sender, Event e)
void OnDeselectAll (object sender, Event e)
void OnEdit (object sender, Event e)
void OnFocusLast (object sender, Event e)
void OnFreeze (object sender, Event e)
void OnIconTextView (object sender, Event e)
void OnIconView (object sender, Event e)
void OnListView (object sender, Event e)
void OnQuit (object sender, Event e)
void OnReportView (object sender, Event e)
void OnSelectAll (object sender, Event e)
void OnSetBgColour (object sender, Event e)
void OnSetFgColour (object sender, Event e)
void OnShowColInfo (object sender, Event e)
void OnShowSelInfo (object sender, Event e)
void OnSize (object sender, Event e)
void OnSmallIconTextView (object sender, Event e)
void OnSmallIconView (object sender, Event e)
void OnSort (object sender, Event e)
void OnThaw (object sender, Event e)
void OnToggleFirstSel (object sender, Event e)
void OnToggleLines (object sender, Event e)
void OnToggleMultiSel (object sender, Event e)
void OnUpdateShowColInfo (object sender, Event e)
void OnUpdateToggleMultiSel (object sender, Event e)
void OnVirtualView (object sender, Event e)
void RecreateList (wx.WindowStyles flags, bool withText)
void RecreateList (wx.WindowStyles flags)

Public Attributes

ImageList m_imageListNormal
ImageList m_imageListSmall
MyListCtrl m_listCtrl
TextCtrl m_logWindow
Panel m_panel

Static Public Attributes

static int NUM_ICONS = 9
static int NUM_ITEMS = 30


Detailed Description

Definition at line 59 of file ListCtrl.cs.


Constructor & Destructor Documentation

wx.SampleListCtrl.MyFrame.MyFrame ( string  title,
Point  pos,
Size  size 
)

Definition at line 74 of file ListCtrl.cs.

00075             : base(title, pos, size)
00076         {
00077             // Set the window icon and status bar
00078 
00079             Icon = new wx.Icon("../Samples/ListCtrl/mondrian.png");
00080 
00081             // Make an image list containing large icons
00082             m_imageListNormal = new ImageList(32, 32, true);
00083             m_imageListSmall = new ImageList(16, 16, true);
00084 
00085             Image image = new Image("../Samples/ListCtrl/bitmaps/toolbrai.xpm");
00086             m_imageListNormal.Add(new Bitmap(image));
00087             image = new Image("../Samples/ListCtrl/bitmaps/toolchar.xpm");
00088             m_imageListNormal.Add(new Bitmap(image));
00089             image = new Image("../Samples/ListCtrl/bitmaps/tooldata.xpm");
00090             m_imageListNormal.Add(new Bitmap(image));
00091             image = new Image("../Samples/ListCtrl/bitmaps/toolnote.xpm");
00092             m_imageListNormal.Add(new Bitmap(image));
00093             image = new Image("../Samples/ListCtrl/bitmaps/tooltodo.xpm");
00094             m_imageListNormal.Add(new Bitmap(image));
00095             image = new Image("../Samples/ListCtrl/bitmaps/toolchec.xpm");
00096             m_imageListNormal.Add(new Bitmap(image));
00097             image = new Image("../Samples/ListCtrl/bitmaps/toolgame.xpm");
00098             m_imageListNormal.Add(new Bitmap(image));
00099             image = new Image("../Samples/ListCtrl/bitmaps/tooltime.xpm");
00100             m_imageListNormal.Add(new Bitmap(image));
00101             image = new Image("../Samples/ListCtrl/bitmaps/toolword.xpm");
00102             m_imageListNormal.Add(new Bitmap(image));
00103 
00104             image = new Image("../Samples/ListCtrl/bitmaps/small1.xpm");
00105             m_imageListSmall.Add(new Bitmap(image));
00106 
00107             // Make a menubar
00108             Menu menuFile = new Menu();
00109             menuFile.Append((int)Cmd.LIST_ABOUT, _("&About"));
00110             menuFile.AppendSeparator();
00111             menuFile.Append((int)Cmd.LIST_QUIT, _("E&xit\tAlt-X"));
00112 
00113             Menu menuView = new Menu();
00114             menuView.Append((int)Cmd.LIST_LIST_VIEW, _("&List view\tF1"));
00115             menuView.Append((int)Cmd.LIST_REPORT_VIEW, _("&Report view\tF2"));
00116             menuView.Append((int)Cmd.LIST_ICON_VIEW, _("&Icon view\tF3"));
00117             menuView.Append((int)Cmd.LIST_ICON_TEXT_VIEW, _("Icon view with &text\tF4"));
00118             menuView.Append((int)Cmd.LIST_SMALL_ICON_VIEW, _("&Small icon view\tF5"));
00119             menuView.Append((int)Cmd.LIST_SMALL_ICON_TEXT_VIEW, _("Small icon &view with text\tF6"));
00120             menuView.Append((int)Cmd.LIST_VIRTUAL_VIEW, _("Virtual view\tF7"));
00121 
00122             Menu menuList = new Menu();
00123             menuList.Append((int)Cmd.LIST_FOCUS_LAST, _("&Make last item current\tCtrl-L"));
00124             menuList.Append((int)Cmd.LIST_TOGGLE_FIRST, _("To&ggle first item\tCtrl-G"));
00125             menuList.Append((int)Cmd.LIST_DESELECT_ALL, _("&Deselect All\tCtrl-D"));
00126             menuList.Append((int)Cmd.LIST_SELECT_ALL, _("S&elect All\tCtrl-A"));
00127             menuList.AppendSeparator();
00128             menuList.Append((int)Cmd.LIST_SHOW_COL_INFO, _("Show &column info\tCtrl-C"));
00129             menuList.Append((int)Cmd.LIST_SHOW_SEL_INFO, _("Show &selected items\tCtrl-S"));
00130             menuList.AppendSeparator();
00131             menuList.Append((int)Cmd.LIST_SORT, _("&Sort\tCtrl-S"));
00132             menuList.AppendSeparator();
00133             menuList.Append((int)Cmd.LIST_ADD, _("&Append an item\tCtrl-P"));
00134             menuList.Append((int)Cmd.LIST_EDIT, _("&Edit the item\tCtrl-E"));
00135             menuList.Append((int)Cmd.LIST_DELETE, _("&Delete first item\tCtrl-X"));
00136             menuList.Append((int)Cmd.LIST_DELETE_ALL, _("Delete &all items"));
00137             menuList.AppendSeparator();
00138             menuList.Append((int)Cmd.LIST_FREEZE, _("Free&ze\tCtrl-Z"));
00139             menuList.Append((int)Cmd.LIST_THAW, _("Tha&w\tCtrl-W"));
00140             menuList.AppendSeparator();
00141             menuList.AppendCheckItem((int)Cmd.LIST_TOGGLE_LINES, _("Toggle &lines\tCtrl-I"));
00142             menuList.AppendCheckItem((int)Cmd.LIST_TOGGLE_MULTI_SEL, _("&Multiple selection\tCtrl-M"), _("Toggle multiple selection"));
00143 
00144             Menu menuCol = new Menu();
00145             menuCol.Append((int)Cmd.LIST_SET_FG_COL, _("&Foreground colour..."));
00146             menuCol.Append((int)Cmd.LIST_SET_BG_COL, _("&Background colour..."));
00147 
00148             MenuBar menubar = new MenuBar();
00149             menubar.Append(menuFile, _("&File"));
00150             menubar.Append(menuView, _("&View"));
00151             menubar.Append(menuList, _("&List"));
00152             menubar.Append(menuCol, _("&Colour"));
00153 
00154             MenuBar = menubar;
00155 
00156             m_panel = new Panel(this, wxID_ANY);
00157             m_logWindow = new TextCtrl(m_panel, wxID_ANY, "",
00158                     wxDefaultPosition, wxDefaultSize,
00159                     wx.WindowStyles.TE_MULTILINE|wx.WindowStyles.BORDER_SUNKEN);
00160 
00161             Log.SetActiveTarget(m_logWindow);
00162 
00163             RecreateList(wx.WindowStyles.LC_REPORT | wx.WindowStyles.LC_SINGLE_SEL);
00164 
00165             CreateStatusBar(3);
00166 
00167             EVT_SIZE(new EventListener(OnSize));
00168 
00169             EVT_MENU((int)Cmd.LIST_QUIT, new EventListener(OnQuit));
00170             EVT_MENU((int)Cmd.LIST_ABOUT, new EventListener(OnAbout));
00171             EVT_MENU((int)Cmd.LIST_LIST_VIEW, new EventListener(OnListView));
00172             EVT_MENU((int)Cmd.LIST_REPORT_VIEW, new EventListener(OnReportView));
00173             EVT_MENU((int)Cmd.LIST_ICON_VIEW, new EventListener(OnIconView));
00174             EVT_MENU((int)Cmd.LIST_ICON_TEXT_VIEW, new EventListener(OnIconTextView));
00175             EVT_MENU((int)Cmd.LIST_SMALL_ICON_VIEW, new EventListener(OnSmallIconView));
00176             EVT_MENU((int)Cmd.LIST_SMALL_ICON_TEXT_VIEW, new EventListener(OnSmallIconTextView));
00177             EVT_MENU((int)Cmd.LIST_VIRTUAL_VIEW, new EventListener(OnVirtualView));
00178 
00179             EVT_MENU((int)Cmd.LIST_FOCUS_LAST, new EventListener(OnFocusLast));
00180             EVT_MENU((int)Cmd.LIST_TOGGLE_FIRST, new EventListener(OnToggleFirstSel));
00181             EVT_MENU((int)Cmd.LIST_DESELECT_ALL, new EventListener(OnDeselectAll));
00182             EVT_MENU((int)Cmd.LIST_SELECT_ALL, new EventListener(OnSelectAll));
00183             EVT_MENU((int)Cmd.LIST_DELETE, new EventListener(OnDelete));
00184             EVT_MENU((int)Cmd.LIST_ADD, new EventListener(OnAdd));
00185             EVT_MENU((int)Cmd.LIST_EDIT, new EventListener(OnEdit));
00186             EVT_MENU((int)Cmd.LIST_DELETE_ALL, new EventListener(OnDeleteAll));
00187             EVT_MENU((int)Cmd.LIST_SORT, new EventListener(OnSort));
00188             EVT_MENU((int)Cmd.LIST_SET_FG_COL, new EventListener(OnSetFgColour));
00189             EVT_MENU((int)Cmd.LIST_SET_BG_COL, new EventListener(OnSetBgColour));
00190             EVT_MENU((int)Cmd.LIST_TOGGLE_MULTI_SEL, new EventListener(OnToggleMultiSel));
00191             EVT_MENU((int)Cmd.LIST_SHOW_COL_INFO, new EventListener(OnShowColInfo));
00192             EVT_MENU((int)Cmd.LIST_SHOW_SEL_INFO, new EventListener(OnShowSelInfo));
00193             EVT_MENU((int)Cmd.LIST_FREEZE, new EventListener(OnFreeze));
00194             EVT_MENU((int)Cmd.LIST_THAW, new EventListener(OnThaw));
00195             EVT_MENU((int)Cmd.LIST_TOGGLE_LINES, new EventListener(OnToggleLines));
00196 
00197             EVT_UPDATE_UI((int)Cmd.LIST_SHOW_COL_INFO, new EventListener(OnUpdateShowColInfo));
00198             EVT_UPDATE_UI((int)Cmd.LIST_TOGGLE_MULTI_SEL, new EventListener(OnUpdateToggleMultiSel));
00199 
00200             Closing += new EventListener(OnClosing);
00201         }


Member Function Documentation

bool wx.SampleListCtrl.MyFrame.CheckNonVirtual (  ) 

Definition at line 328 of file ListCtrl.cs.

00329         {
00330             if (!m_listCtrl.HasFlag(wx.WindowStyles.LC_VIRTUAL))
00331                 return true;
00332 
00333             Log.LogWarning("Can't do this in virtual view, sorry.");
00334             Log.LogMessage(string.Format(_("Number of allocated and stored objects: {0}, {1}."), wx.Object.InstancesCount, wx.Object.SavedInstancesCount));
00335 
00336             return false;
00337         }

void wx.SampleListCtrl.MyFrame.DoSize (  ) 

Definition at line 237 of file ListCtrl.cs.

00238         {
00239             if (m_logWindow == null) return;
00240 
00241             Size size = ClientSize;
00242             int y = (2 * size.Height) / 3;
00243             m_listCtrl.SetSize(0, 0, size.Width, y);
00244             m_logWindow.SetSize(0, y + 1, size.Width, size.Height - y);
00245         }

void wx.SampleListCtrl.MyFrame.InitWithIconItems ( bool  withText,
bool  sameIcon 
)

Definition at line 475 of file ListCtrl.cs.

00476         {
00477             m_listCtrl.SetImageList(m_imageListNormal, wxImageList.wxIMAGE_LIST_NORMAL);
00478             m_listCtrl.SetImageList(m_imageListSmall, wxImageList.wxIMAGE_LIST_SMALL);
00479 
00480             for (int i = 0; i < NUM_ICONS; i++)
00481             {
00482                 int image = sameIcon ? 0 : i;
00483 
00484                 if (withText)
00485                 {
00486                     m_listCtrl.InsertItem(i, "Label " + i, image);
00487                 }
00488                 else
00489                 {
00490                     m_listCtrl.InsertItem(i, image);
00491                 }
00492             }
00493         }

void wx.SampleListCtrl.MyFrame.InitWithIconItems ( bool  withText  ) 

Definition at line 470 of file ListCtrl.cs.

00471         {
00472             InitWithIconItems(withText, false);
00473         }

void wx.SampleListCtrl.MyFrame.InitWithListItems (  ) 

Definition at line 402 of file ListCtrl.cs.

00403         {
00404             for (int i = 0; i < NUM_ITEMS; i++)
00405             {
00406                 m_listCtrl.InsertItem(i, "Item " + i);
00407             }
00408         }

void wx.SampleListCtrl.MyFrame.InitWithReportItems (  ) 

Definition at line 419 of file ListCtrl.cs.

00420         {
00421             m_listCtrl.SetImageList(m_imageListSmall, wxImageList.wxIMAGE_LIST_SMALL);
00422 
00423             ListItem itemCol = new ListItem();
00424             itemCol.Text = "Column 1";
00425             itemCol.Image = -1;
00426             m_listCtrl.InsertColumn(0, itemCol);
00427 
00428             itemCol.Text = "Column 2";
00429             itemCol.Align = wx.ListColumnFormat.CENTRE;
00430             m_listCtrl.InsertColumn(1, itemCol);
00431 
00432             itemCol.Text = "Column 3";
00433             itemCol.Align = wx.ListColumnFormat.RIGHT;
00434             m_listCtrl.InsertColumn(2, itemCol);
00435 
00436             m_listCtrl.Hide();
00437 
00438             for (int i = 0; i < NUM_ITEMS; i++)
00439             {
00440                 m_listCtrl.InsertItemInReportView(i);
00441             }
00442 
00443             m_logWindow.WriteText(NUM_ITEMS + " items inserted");
00444             m_listCtrl.Show();
00445 
00446             ListItem item = new ListItem();
00447             item.Id = 0;
00448             item.TextColour = Colour.wxRED;
00449             m_listCtrl.SetItem(item);
00450 
00451             item.Id = 2;
00452             item.TextColour = Colour.wxGREEN;
00453             m_listCtrl.SetItem(item);
00454             item.Id = 4;
00455             item.TextColour = Colour.wxLIGHT_GREY;
00456             item.Font = Font.wxITALIC_FONT;
00457             item.BackgroundColour = Colour.wxRED;
00458             m_listCtrl.SetItem(item);
00459 
00460             m_listCtrl.TextColour = Colour.wxBLUE;
00461             m_listCtrl.BackgroundColour = Colour.wxLIGHT_GREY;
00462 
00463             m_listCtrl.SetColumnWidth(0, wx.ListCtrl.SymbolicColumnWidth.AUTOSIZE);
00464             m_listCtrl.SetColumnWidth(1, wx.ListCtrl.SymbolicColumnWidth.AUTOSIZE);
00465             m_listCtrl.SetColumnWidth(2, wx.ListCtrl.SymbolicColumnWidth.AUTOSIZE);
00466         }

void wx.SampleListCtrl.MyFrame.InitWithVirtualItems (  ) 

Definition at line 532 of file ListCtrl.cs.

00533         {
00534             m_listCtrl.SetImageList(m_imageListSmall, wxImageList.wxIMAGE_LIST_SMALL);
00535 
00536             m_listCtrl.InsertColumn(0, _("First Column"));
00537             m_listCtrl.InsertColumn(1, _("Second Column"));
00538             m_listCtrl.InsertColumn(2, _("Third Column"));
00539             m_listCtrl.SetColumnWidth(0, 150);
00540             m_listCtrl.SetColumnWidth(1, 150);
00541             m_listCtrl.SetColumnWidth(2, 150);
00542 
00543             m_listCtrl.ItemCount = 1000000;
00544         }

int wx.SampleListCtrl.MyFrame.MyCompareFunction ( ClientData  itemData1,
ClientData  itemData2,
int  sortData 
)

Definition at line 548 of file ListCtrl.cs.

00549         {
00550             // inverse the order
00551             int item1 = (int)((SystemObjectClientData)itemData1).Data;
00552             int item2 = (int)((SystemObjectClientData)itemData2).Data;
00553 
00554             int result = 0;
00555             string itemText1 = this.m_listCtrl.GetItemText(item1);
00556             string itemText2 = this.m_listCtrl.GetItemText(item2);
00557             if (result == 0)
00558                 result = itemText1.CompareTo(itemText2);
00559             this.m_logWindow.WriteText(string.Format("Compare {0}:<{4}> and {1}:<{5}> returns {2} on sort data {3}.\n", item1, item2, result, sortData, itemText1, itemText2));
00560             return -result;
00561         }

void wx.SampleListCtrl.MyFrame.OnAbout ( object  sender,
Event  e 
)

Definition at line 213 of file ListCtrl.cs.

00214         {
00215             MessageDialog.MessageBox("List test sample\nJulian Smart (c) 1997\nPorted to wx.NET by Alexander Olk\nVirtual lists by Harald Meyer auf'm Hofe", "About",
00216                 wx.WindowStyles.DIALOG_OK | wx.WindowStyles.ICON_INFORMATION);
00217         }

void wx.SampleListCtrl.MyFrame.OnAdd ( object  sender,
Event  e 
)

Definition at line 664 of file ListCtrl.cs.

00665         {
00666             m_listCtrl.InsertItem(m_listCtrl.ItemCount, _("Appended item"));
00667         }

void wx.SampleListCtrl.MyFrame.OnClosing ( object  sender,
Event  e 
)

Definition at line 205 of file ListCtrl.cs.

00206         {
00207             Log.IsEnabled=false;
00208             e.Skip();
00209         }

void wx.SampleListCtrl.MyFrame.OnDelete ( object  sender,
Event  e 
)

Definition at line 688 of file ListCtrl.cs.

00689         {
00690             if (m_listCtrl.ItemCount > 0)
00691             {
00692                 m_listCtrl.DeleteItem(0);
00693             }
00694             else
00695             {
00696                 m_logWindow.WriteText(_("Nothing to delete"));
00697             }
00698         }

void wx.SampleListCtrl.MyFrame.OnDeleteAll ( object  sender,
Event  e 
)

Definition at line 702 of file ListCtrl.cs.

00703         {
00704 
00705             m_listCtrl.DeleteAllItems();
00706 
00707             m_logWindow.WriteText("Deleted " + m_listCtrl.ItemCount + " items\n");
00708             Log.LogMessage(string.Format(_("Number of allocated and stored objects: {0}, {1}."), wx.Object.InstancesCount, wx.Object.SavedInstancesCount));
00709         }

void wx.SampleListCtrl.MyFrame.OnDeselectAll ( object  sender,
Event  e 
)

Definition at line 299 of file ListCtrl.cs.

00300         {
00301             if (!CheckNonVirtual())
00302                 return;
00303 
00304             int n = m_listCtrl.ItemCount;
00305             for (int i = 0; i < n; i++)
00306                 m_listCtrl.SetItemState(i, 0, ListItemState.SELECTED);
00307         }

void wx.SampleListCtrl.MyFrame.OnEdit ( object  sender,
Event  e 
)

Definition at line 671 of file ListCtrl.cs.

00672         {
00673             int itemCur = m_listCtrl.GetNextItem(-1, ListCtrl.NEXT.ALL,
00674                         ListItemState.FOCUSED);
00675 
00676             if (itemCur != -1)
00677             {
00678                 m_listCtrl.EditLabel(itemCur);
00679             }
00680             else
00681             {
00682                 m_logWindow.WriteText(_("No item to edit"));
00683             }
00684         }

void wx.SampleListCtrl.MyFrame.OnFocusLast ( object  sender,
Event  e 
)

Definition at line 278 of file ListCtrl.cs.

00279         {
00280             long index = m_listCtrl.ItemCount - 1;
00281             if (index == -1)
00282             {
00283                 return;
00284             }
00285 
00286             m_listCtrl.SetItemState((int)index, ListItemState.FOCUSED, ListItemState.FOCUSED);
00287             m_listCtrl.EnsureVisible((int)index);
00288         }

void wx.SampleListCtrl.MyFrame.OnFreeze ( object  sender,
Event  e 
)

Definition at line 249 of file ListCtrl.cs.

00250         {
00251             Log.LogMessage(_("Freezing the control"));
00252             Log.LogMessage(string.Format(_("Number of allocated and stored objects: {0}, {1}."), wx.Object.InstancesCount, wx.Object.SavedInstancesCount));
00253 
00254             m_listCtrl.Freeze();
00255         }

void wx.SampleListCtrl.MyFrame.OnIconTextView ( object  sender,
Event  e 
)

Definition at line 504 of file ListCtrl.cs.

00505         {
00506             RecreateList(wx.WindowStyles.LC_ICON);
00507         }

void wx.SampleListCtrl.MyFrame.OnIconView ( object  sender,
Event  e 
)

Definition at line 497 of file ListCtrl.cs.

00498         {
00499             RecreateList(wx.WindowStyles.LC_ICON, false);
00500         }

void wx.SampleListCtrl.MyFrame.OnListView ( object  sender,
Event  e 
)

Definition at line 395 of file ListCtrl.cs.

00396         {
00397             RecreateList(wx.WindowStyles.LC_LIST);
00398         }

void wx.SampleListCtrl.MyFrame.OnQuit ( object  sender,
Event  e 
)

Definition at line 221 of file ListCtrl.cs.

00222         {
00223             Close();
00224         }

void wx.SampleListCtrl.MyFrame.OnReportView ( object  sender,
Event  e 
)

Definition at line 412 of file ListCtrl.cs.

00413         {
00414             RecreateList(wx.WindowStyles.LC_REPORT);
00415         }

void wx.SampleListCtrl.MyFrame.OnSelectAll ( object  sender,
Event  e 
)

Definition at line 311 of file ListCtrl.cs.

00312         {
00313             if (!CheckNonVirtual())
00314                 return;
00315 
00316             int n = m_listCtrl.ItemCount;
00317             for (int i = 0; i < n; i++)
00318                 m_listCtrl.SetItemState(i, ListItemState.SELECTED, ListItemState.SELECTED);
00319 
00320             if (m_listCtrl.HasFlag(WindowStyles.LC_SINGLE_SEL))
00321             {
00322                 Log.LogWarning("Dialog is in single selection mode. I will select one item after another. Toggle selection mode.");
00323             }
00324         }

void wx.SampleListCtrl.MyFrame.OnSetBgColour ( object  sender,
Event  e 
)

Definition at line 656 of file ListCtrl.cs.

00657         {
00658             m_listCtrl.BackgroundColour = ColourDialog.GetColourFromUser(this);
00659             m_listCtrl.Refresh();
00660         }

void wx.SampleListCtrl.MyFrame.OnSetFgColour ( object  sender,
Event  e 
)

Definition at line 648 of file ListCtrl.cs.

00649         {
00650             m_listCtrl.ForegroundColour = ColourDialog.GetColourFromUser(this);
00651             m_listCtrl.Refresh();
00652         }

void wx.SampleListCtrl.MyFrame.OnShowColInfo ( object  sender,
Event  e 
)

Definition at line 601 of file ListCtrl.cs.

00602         {
00603             int count = m_listCtrl.ColumnCount;
00604             Log.LogMessage(string.Format(_("Number of allocated and stored objects: {0}, {1}."), wx.Object.InstancesCount, wx.Object.SavedInstancesCount));
00605             Log.LogMessage(count + " columns:");
00606             for (int c = 0; c < count; c++)
00607             {
00608                 Log.LogMessage("\tcolumn " + c + " has width " + m_listCtrl.GetColumnWidth(c));
00609             }
00610         }

void wx.SampleListCtrl.MyFrame.OnShowSelInfo ( object  sender,
Event  e 
)

Definition at line 574 of file ListCtrl.cs.

00575         {
00576             int selCount = m_listCtrl.SelectedItemCount;
00577             Log.LogMessage(selCount + " items selected:");
00578             Log.LogMessage(string.Format(_("Number of allocated and stored objects: {0}, {1}."), wx.Object.InstancesCount, wx.Object.SavedInstancesCount));
00579 
00580             int shownCount = 0;
00581 
00582             int item = m_listCtrl.GetNextItem(-1, ListCtrl.NEXT.ALL,
00583                         ListItemState.SELECTED);
00584             while (item != -1)
00585             {
00586                 Log.LogMessage("\t" + item + "d (" + m_listCtrl.GetItemText(item) + ")");
00587 
00588                 if (++shownCount > 10)
00589                 {
00590                     Log.LogMessage(_("\t... more selected items snipped..."));
00591                     break;
00592                 }
00593 
00594                 item = m_listCtrl.GetNextItem(item, ListCtrl.NEXT.ALL,
00595                     ListItemState.SELECTED);
00596             }
00597         }

void wx.SampleListCtrl.MyFrame.OnSize ( object  sender,
Event  e 
)

Definition at line 228 of file ListCtrl.cs.

00229         {
00230             DoSize();
00231 
00232             e.Skip();
00233         }

void wx.SampleListCtrl.MyFrame.OnSmallIconTextView ( object  sender,
Event  e 
)

Definition at line 518 of file ListCtrl.cs.

00519         {
00520             RecreateList(wx.WindowStyles.LC_SMALL_ICON);
00521         }

void wx.SampleListCtrl.MyFrame.OnSmallIconView ( object  sender,
Event  e 
)

Definition at line 511 of file ListCtrl.cs.

00512         {
00513             RecreateList(wx.WindowStyles.LC_SMALL_ICON, false);
00514         }

void wx.SampleListCtrl.MyFrame.OnSort ( object  sender,
Event  e 
)

Definition at line 565 of file ListCtrl.cs.

00566         {
00567             m_listCtrl.SortItems(new ListCtrl.wxListCtrlCompare(MyCompareFunction), 0);
00568 
00569             m_logWindow.WriteText("Sorting " + m_listCtrl.ItemCount + " items");
00570         }

void wx.SampleListCtrl.MyFrame.OnThaw ( object  sender,
Event  e 
)

Definition at line 259 of file ListCtrl.cs.

00260         {
00261             Log.LogMessage(_("Thawing the control"));
00262             Log.LogMessage(string.Format(_("Number of allocated and stored objects: {0}, {1}."), wx.Object.InstancesCount, wx.Object.SavedInstancesCount));
00263 
00264             m_listCtrl.Thaw();
00265         }

void wx.SampleListCtrl.MyFrame.OnToggleFirstSel ( object  sender,
Event  e 
)

Definition at line 292 of file ListCtrl.cs.

00293         {
00294             m_listCtrl.SetItemState(0, (~m_listCtrl.GetItemState(0, ListItemState.SELECTED)) & ListItemState.SELECTED, ListItemState.SELECTED);
00295         }

void wx.SampleListCtrl.MyFrame.OnToggleLines ( object  sender,
Event  e 
)

Definition at line 269 of file ListCtrl.cs.

00270         {
00271             CommandEvent ce = e as CommandEvent;
00272 
00273             m_listCtrl.SetSingleStyle(wx.WindowStyles.LC_HRULES | wx.WindowStyles.LC_VRULES, ce.IsChecked);
00274         }

void wx.SampleListCtrl.MyFrame.OnToggleMultiSel ( object  sender,
Event  e 
)

Definition at line 623 of file ListCtrl.cs.

00624         {
00625             WindowStyles flags = m_listCtrl.StyleFlags;
00626             if ((flags & wx.WindowStyles.LC_SINGLE_SEL) > 0)
00627                 flags &= ~wx.WindowStyles.LC_SINGLE_SEL;
00628             else
00629                 flags |= wx.WindowStyles.LC_SINGLE_SEL;
00630 
00631             m_logWindow.WriteText("Current selection mode: " +
00632                 (((flags & wx.WindowStyles.LC_SINGLE_SEL) > 0) ? "sing" : "multip") + "le\n");
00633 
00634             RecreateList(flags);
00635         }

void wx.SampleListCtrl.MyFrame.OnUpdateShowColInfo ( object  sender,
Event  e 
)

Definition at line 614 of file ListCtrl.cs.

00615         {
00616             UpdateUIEvent ue = e as UpdateUIEvent;
00617 
00618             ue.Enabled = (m_listCtrl.StyleFlags & wx.WindowStyles.LC_REPORT) != 0;
00619         }

void wx.SampleListCtrl.MyFrame.OnUpdateToggleMultiSel ( object  sender,
Event  e 
)

Definition at line 639 of file ListCtrl.cs.

00640         {
00641             UpdateUIEvent ue = e as UpdateUIEvent;
00642 
00643             ue.Check = (m_listCtrl.StyleFlags & wx.WindowStyles.LC_SINGLE_SEL) == 0;
00644         }

void wx.SampleListCtrl.MyFrame.OnVirtualView ( object  sender,
Event  e 
)

Definition at line 525 of file ListCtrl.cs.

00526         {
00527             RecreateList(wx.WindowStyles.LC_REPORT | wx.WindowStyles.LC_VIRTUAL);
00528         }

void wx.SampleListCtrl.MyFrame.RecreateList ( wx.WindowStyles  flags,
bool  withText 
)

Definition at line 346 of file ListCtrl.cs.

00347         {
00348             /* HMaH: This here replaces statement "delete m_listCtrl" in the original.
00349              * You have to call this in C# because deletion will be deferred by garbage
00350              * collection and the old control will still be active after recreation.
00351              * You should not dispose the old control because there might be some open
00352              * events generated by this control.
00353              */
00354             if (m_listCtrl != null)
00355                 m_listCtrl.Destroy();
00356 
00357             m_listCtrl = new MyListCtrl(m_panel, (int)Cmd.LIST_CTRL,
00358                     wxDefaultPosition, wxDefaultSize,
00359                     flags |
00360                     wx.WindowStyles.BORDER_SUNKEN |  wx.WindowStyles.LC_EDIT_LABELS );
00361 
00362             switch (flags & wx.WindowStyles.LC_MASK_TYPE)
00363             {
00364                 case wx.WindowStyles.LC_LIST:
00365                     InitWithListItems();
00366                     break;
00367 
00368                 case wx.WindowStyles.LC_ICON:
00369                     InitWithIconItems(withText);
00370                     break;
00371 
00372                 case wx.WindowStyles.LC_SMALL_ICON:
00373                     InitWithIconItems(withText, true);
00374                     break;
00375 
00376                 case wx.WindowStyles.LC_REPORT:
00377                     if ((flags & wx.WindowStyles.LC_VIRTUAL) > 0)
00378                         InitWithVirtualItems();
00379                     else
00380                         InitWithReportItems();
00381                     break;
00382 
00383                 default:
00384                     Console.WriteLine("unknown listctrl mode");
00385                     break;
00386             }
00387 
00388             DoSize();
00389 
00390             m_logWindow.Clear();
00391         }

void wx.SampleListCtrl.MyFrame.RecreateList ( wx.WindowStyles  flags  ) 

Definition at line 341 of file ListCtrl.cs.

00342         {
00343             RecreateList(flags, true);
00344         }


Member Data Documentation

ImageList wx.SampleListCtrl.MyFrame.m_imageListNormal

Definition at line 61 of file ListCtrl.cs.

ImageList wx.SampleListCtrl.MyFrame.m_imageListSmall

Definition at line 62 of file ListCtrl.cs.

MyListCtrl wx.SampleListCtrl.MyFrame.m_listCtrl

Definition at line 65 of file ListCtrl.cs.

TextCtrl wx.SampleListCtrl.MyFrame.m_logWindow

Definition at line 64 of file ListCtrl.cs.

Panel wx.SampleListCtrl.MyFrame.m_panel

Definition at line 66 of file ListCtrl.cs.

int wx.SampleListCtrl.MyFrame.NUM_ICONS = 9 [static]

Definition at line 70 of file ListCtrl.cs.

int wx.SampleListCtrl.MyFrame.NUM_ITEMS = 30 [static]

Definition at line 68 of file ListCtrl.cs.


Manual of the wx.NET   (c) 2003-2010 the wx.NET project