--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/PageList.cpp Wed Apr 02 21:47:47 2008 +0200
@@ -0,0 +1,59 @@
+#include <wx/wx.h>
+
+#include "PageList.hpp"
+
+BEGIN_EVENT_TABLE(PageList, wxListCtrl)
+ EVT_CONTEXT_MENU(PageList::on_context_menu)
+END_EVENT_TABLE()
+
+
+PageList::PageList(wxWindow *parent)
+ :wxListCtrl(parent, wxID_ANY, wxDefaultPosition, wxDefaultSize,
+ wxLC_REPORT)
+{
+ InsertColumn(0, _("File"));
+ InsertColumn(1, _("Crop area"));
+ InsertColumn(2, _("Binarizer"));
+ InsertColumn(3, _("Packing"));
+}
+
+void
+PageList::add_files(const wxArrayString &filenames)
+{
+ for(unsigned int i=0; i < filenames.GetCount(); ++i)
+ {
+ wxListItem item;
+ item.SetText(filenames[i]);
+ item.SetColumn(0);
+ long pos = InsertItem(item);
+ /* Test */
+ SetItem(pos, 1, wxT("test"));
+ }
+ SetColumnWidth(0, wxLIST_AUTOSIZE);
+}
+
+void
+PageList::on_context_menu(wxContextMenuEvent &event)
+{
+ wxString title;
+
+ /* Try to guess what we should apply actions to. */
+ if (GetSelectedItemCount() == 0)
+ {
+ return;
+ }
+ else if (GetSelectedItemCount() == 1)
+ {
+ title = GetItemText(GetNextItem(-1, wxLIST_NEXT_ALL,
+ wxLIST_STATE_SELECTED));
+ }
+ else
+ {
+ title = _("Selection");
+ }
+ wxMenu *menu = new wxMenu(title);
+
+ menu->Append(wxID_CLOSE, wxT("Hello"));
+
+ PopupMenu(menu);
+}