1 //####COPYRIGHTBEGIN####
3 // ----------------------------------------------------------------------------
4 // Copyright (C) 1998, 1999, 2000 Red Hat, Inc.
6 // This program is part of the eCos host tools.
8 // This program is free software; you can redistribute it and/or modify it
9 // under the terms of the GNU General Public License as published by the Free
10 // Software Foundation; either version 2 of the License, or (at your option)
13 // This program is distributed in the hope that it will be useful, but WITHOUT
14 // ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
15 // FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
18 // You should have received a copy of the GNU General Public License along with
19 // this program; if not, write to the Free Software Foundation, Inc.,
20 // 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
22 // ----------------------------------------------------------------------------
24 //####COPYRIGHTEND####
27 //===========================================================================
28 //#####DESCRIPTIONBEGIN####
31 // Contact(s): julians
33 // Version: $Id: solutionswin.cpp,v 1.1 2001/02/08 18:06:52 julians Exp $
35 // Description: Implementation file for ecSolutionListCtrl
42 //####DESCRIPTIONEND####
44 //===========================================================================
46 // ============================================================================
48 // ============================================================================
50 // ----------------------------------------------------------------------------
52 // ----------------------------------------------------------------------------
54 #pragma implementation "solutionswin.h"
57 // Includes other headers for precompiled compilation
64 #include "solutionswin.h"
66 #include "bitmaps/checked.xpm"
67 #include "bitmaps/unchecked.xpm"
73 IMPLEMENT_CLASS(ecSolutionListCtrl, wxListCtrl)
75 BEGIN_EVENT_TABLE(ecSolutionListCtrl, wxListCtrl)
76 EVT_LEFT_DOWN(ecSolutionListCtrl::OnMouseEvent)
79 ecSolutionListCtrl::ecSolutionListCtrl(wxWindow* parent, wxWindowID id, const wxPoint& pt,
80 const wxSize& sz, long style):
81 wxListCtrl(parent, id, pt, sz, style), m_imageList(16, 16, TRUE)
84 SetImageList(& m_imageList, wxIMAGE_LIST_SMALL);
86 m_imageList.Add(wxICON(unchecked));
87 m_imageList.Add(wxICON(checked));
89 InsertColumn(0, _("Item"), wxLIST_FORMAT_LEFT, 200);
90 InsertColumn(1, _("Value"), wxLIST_FORMAT_LEFT, 80);
96 for (j = 0; j < 10; j++)
99 info.m_text = _("CYGPKG_HAL_EXCEPTIONS");
100 info.m_mask = wxLIST_MASK_TEXT | wxLIST_MASK_IMAGE ; // | wxLIST_MASK_DATA;
103 //info.m_data = (long) doc;
105 long item = InsertItem(info);
107 SetItem(i, 1, _("Disabled"));
110 info.m_text = _("CYGPKG_KERNEL_EXCEPTIONS");
111 info.m_mask = wxLIST_MASK_TEXT | wxLIST_MASK_IMAGE ; // | wxLIST_MASK_DATA;
114 //info.m_data = (long) doc;
115 item = InsertItem(info);
117 SetItem(item, 1, _("Disabled"));
123 void ecSolutionListCtrl::OnMouseEvent(wxMouseEvent& event)
125 if (event.LeftDown())
128 long item = HitTest(event.GetPosition(), flags);
129 if (item > -1 && (flags & wxLIST_HITTEST_ONITEMICON))
131 SetChecked(item, !IsChecked(item));
142 bool ecSolutionListCtrl::IsChecked(long item) const
145 info.m_mask = wxLIST_MASK_IMAGE ;
146 info.m_itemId = item;
150 return (info.m_image == 1);
156 void ecSolutionListCtrl::SetChecked(long item, bool checked)
158 SetItemImage(item, (checked ? 1 : 0), -1);