//--------------------------------------------------------------------- public MyFrame(string title, Point pos, Size size) : base(title, pos, size) { // Set the window icon Icon = new wx.Icon("../Samples/Minimal/mondrian.png"); // Set up a menu wx.Menu fileMenu = new wx.Menu(); //fileMenu.Append((int)Cmd.Dialog, "&Show dialog\tAlt-D", "Show test dialog"); fileMenu.Append((int)Cmd.Quit, "E&xit\tAlt-X", "Quit this program"); wx.Menu helpMenu = new wx.Menu(); helpMenu.Append((int)Cmd.About, "&About...\tF1", "Show about dialog"); wx.MenuBar menuBar = new wx.MenuBar(); menuBar.Append(fileMenu, "&File"); menuBar.Append(helpMenu, "&Help"); MenuBar = menuBar; // Set up a status bar CreateStatusBar(2); StatusText = "Welcome to wxWidgets!"; // Set up the event table EVT_MENU((int)Cmd.Quit, new EventListener(OnQuit)); EVT_MENU((int)Cmd.Dialog, new EventListener(OnDialog)); EVT_MENU((int)Cmd.About, new EventListener(OnAbout)); }
//--------------------------------------------------------------------- public MyFrame(string title, Point pos, Size size) : base(title, pos, size) { // Set the window icon and status bar Icon = new wx.Icon("../Samples/ListCtrl/mondrian.png"); // Make an image list containing large icons m_imageListNormal = new ImageList(32, 32, true); m_imageListSmall = new ImageList(16, 16, true); Image image = new Image("../Samples/ListCtrl/bitmaps/toolbrai.xpm"); m_imageListNormal.Add(new Bitmap(image)); image = new Image("../Samples/ListCtrl/bitmaps/toolchar.xpm"); m_imageListNormal.Add(new Bitmap(image)); image = new Image("../Samples/ListCtrl/bitmaps/tooldata.xpm"); m_imageListNormal.Add(new Bitmap(image)); image = new Image("../Samples/ListCtrl/bitmaps/toolnote.xpm"); m_imageListNormal.Add(new Bitmap(image)); image = new Image("../Samples/ListCtrl/bitmaps/tooltodo.xpm"); m_imageListNormal.Add(new Bitmap(image)); image = new Image("../Samples/ListCtrl/bitmaps/toolchec.xpm"); m_imageListNormal.Add(new Bitmap(image)); image = new Image("../Samples/ListCtrl/bitmaps/toolgame.xpm"); m_imageListNormal.Add(new Bitmap(image)); image = new Image("../Samples/ListCtrl/bitmaps/tooltime.xpm"); m_imageListNormal.Add(new Bitmap(image)); image = new Image("../Samples/ListCtrl/bitmaps/toolword.xpm"); m_imageListNormal.Add(new Bitmap(image)); image = new Image("../Samples/ListCtrl/bitmaps/small1.xpm"); m_imageListSmall.Add(new Bitmap(image)); // Make a menubar Menu menuFile = new Menu(); menuFile.Append((int)Cmd.LIST_ABOUT, _("&About")); menuFile.AppendSeparator(); menuFile.Append((int)Cmd.LIST_QUIT, _("E&xit\tAlt-X")); Menu menuView = new Menu(); menuView.Append((int)Cmd.LIST_LIST_VIEW, _("&List view\tF1")); menuView.Append((int)Cmd.LIST_REPORT_VIEW, _("&Report view\tF2")); menuView.Append((int)Cmd.LIST_ICON_VIEW, _("&Icon view\tF3")); menuView.Append((int)Cmd.LIST_ICON_TEXT_VIEW, _("Icon view with &text\tF4")); menuView.Append((int)Cmd.LIST_SMALL_ICON_VIEW, _("&Small icon view\tF5")); menuView.Append((int)Cmd.LIST_SMALL_ICON_TEXT_VIEW, _("Small icon &view with text\tF6")); menuView.Append((int)Cmd.LIST_VIRTUAL_VIEW, _("Virtual view\tF7")); Menu menuList = new Menu(); menuList.Append((int)Cmd.LIST_FOCUS_LAST, _("&Make last item current\tCtrl-L")); menuList.Append((int)Cmd.LIST_TOGGLE_FIRST, _("To&ggle first item\tCtrl-G")); menuList.Append((int)Cmd.LIST_DESELECT_ALL, _("&Deselect All\tCtrl-D")); menuList.Append((int)Cmd.LIST_SELECT_ALL, _("S&elect All\tCtrl-A")); menuList.AppendSeparator(); menuList.Append((int)Cmd.LIST_SHOW_COL_INFO, _("Show &column info\tCtrl-C")); menuList.Append((int)Cmd.LIST_SHOW_SEL_INFO, _("Show &selected items\tCtrl-S")); menuList.AppendSeparator(); menuList.Append((int)Cmd.LIST_SORT, _("&Sort\tCtrl-S")); menuList.AppendSeparator(); menuList.Append((int)Cmd.LIST_ADD, _("&Append an item\tCtrl-P")); menuList.Append((int)Cmd.LIST_EDIT, _("&Edit the item\tCtrl-E")); menuList.Append((int)Cmd.LIST_DELETE, _("&Delete first item\tCtrl-X")); menuList.Append((int)Cmd.LIST_DELETE_ALL, _("Delete &all items")); menuList.AppendSeparator(); menuList.Append((int)Cmd.LIST_FREEZE, _("Free&ze\tCtrl-Z")); menuList.Append((int)Cmd.LIST_THAW, _("Tha&w\tCtrl-W")); menuList.AppendSeparator(); menuList.AppendCheckItem((int)Cmd.LIST_TOGGLE_LINES, _("Toggle &lines\tCtrl-I")); menuList.AppendCheckItem((int)Cmd.LIST_TOGGLE_MULTI_SEL, _("&Multiple selection\tCtrl-M"), _("Toggle multiple selection")); Menu menuCol = new Menu(); menuCol.Append((int)Cmd.LIST_SET_FG_COL, _("&Foreground colour...")); menuCol.Append((int)Cmd.LIST_SET_BG_COL, _("&Background colour...")); MenuBar menubar = new MenuBar(); menubar.Append(menuFile, _("&File")); menubar.Append(menuView, _("&View")); menubar.Append(menuList, _("&List")); menubar.Append(menuCol, _("&Colour")); MenuBar = menubar; m_panel = new Panel(this, wxID_ANY); m_logWindow = new TextCtrl(m_panel, wxID_ANY, "", wxDefaultPosition, wxDefaultSize, wx.WindowStyles.TE_MULTILINE | wx.WindowStyles.BORDER_SUNKEN); Log.SetActiveTarget(m_logWindow); RecreateList(wx.WindowStyles.LC_REPORT | wx.WindowStyles.LC_SINGLE_SEL); CreateStatusBar(3); EVT_SIZE(new EventListener(OnSize)); EVT_MENU((int)Cmd.LIST_QUIT, new EventListener(OnQuit)); EVT_MENU((int)Cmd.LIST_ABOUT, new EventListener(OnAbout)); EVT_MENU((int)Cmd.LIST_LIST_VIEW, new EventListener(OnListView)); EVT_MENU((int)Cmd.LIST_REPORT_VIEW, new EventListener(OnReportView)); EVT_MENU((int)Cmd.LIST_ICON_VIEW, new EventListener(OnIconView)); EVT_MENU((int)Cmd.LIST_ICON_TEXT_VIEW, new EventListener(OnIconTextView)); EVT_MENU((int)Cmd.LIST_SMALL_ICON_VIEW, new EventListener(OnSmallIconView)); EVT_MENU((int)Cmd.LIST_SMALL_ICON_TEXT_VIEW, new EventListener(OnSmallIconTextView)); EVT_MENU((int)Cmd.LIST_VIRTUAL_VIEW, new EventListener(OnVirtualView)); EVT_MENU((int)Cmd.LIST_FOCUS_LAST, new EventListener(OnFocusLast)); EVT_MENU((int)Cmd.LIST_TOGGLE_FIRST, new EventListener(OnToggleFirstSel)); EVT_MENU((int)Cmd.LIST_DESELECT_ALL, new EventListener(OnDeselectAll)); EVT_MENU((int)Cmd.LIST_SELECT_ALL, new EventListener(OnSelectAll)); EVT_MENU((int)Cmd.LIST_DELETE, new EventListener(OnDelete)); EVT_MENU((int)Cmd.LIST_ADD, new EventListener(OnAdd)); EVT_MENU((int)Cmd.LIST_EDIT, new EventListener(OnEdit)); EVT_MENU((int)Cmd.LIST_DELETE_ALL, new EventListener(OnDeleteAll)); EVT_MENU((int)Cmd.LIST_SORT, new EventListener(OnSort)); EVT_MENU((int)Cmd.LIST_SET_FG_COL, new EventListener(OnSetFgColour)); EVT_MENU((int)Cmd.LIST_SET_BG_COL, new EventListener(OnSetBgColour)); EVT_MENU((int)Cmd.LIST_TOGGLE_MULTI_SEL, new EventListener(OnToggleMultiSel)); EVT_MENU((int)Cmd.LIST_SHOW_COL_INFO, new EventListener(OnShowColInfo)); EVT_MENU((int)Cmd.LIST_SHOW_SEL_INFO, new EventListener(OnShowSelInfo)); EVT_MENU((int)Cmd.LIST_FREEZE, new EventListener(OnFreeze)); EVT_MENU((int)Cmd.LIST_THAW, new EventListener(OnThaw)); EVT_MENU((int)Cmd.LIST_TOGGLE_LINES, new EventListener(OnToggleLines)); EVT_UPDATE_UI((int)Cmd.LIST_SHOW_COL_INFO, new EventListener(OnUpdateShowColInfo)); EVT_UPDATE_UI((int)Cmd.LIST_TOGGLE_MULTI_SEL, new EventListener(OnUpdateToggleMultiSel)); Closing += new EventListener(OnClosing); }