OpenCores
URL https://opencores.org/ocsvn/openrisc/openrisc/trunk

Subversion Repositories openrisc

[/] [openrisc/] [trunk/] [rtos/] [ecos-2.0/] [tools/] [src/] [tools/] [configtool/] [standalone/] [wxwin/] [solutionswin.cpp] - Blame information for rev 174

Details | Compare with Previous | View Log

Line No. Rev Author Line
1 26 unneback
//####COPYRIGHTBEGIN####
2
//
3
// ----------------------------------------------------------------------------
4
// Copyright (C) 1998, 1999, 2000 Red Hat, Inc.
5
//
6
// This program is part of the eCos host tools.
7
//
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)
11
// any later version.
12
//
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
16
// more details.
17
//
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.
21
//
22
// ----------------------------------------------------------------------------
23
//
24
//####COPYRIGHTEND####
25
// configtree.cpp :
26
//
27
//===========================================================================
28
//#####DESCRIPTIONBEGIN####
29
//
30
// Author(s):   julians
31
// Contact(s):  julians
32
// Date:        2000/09/08
33
// Version:     $Id: solutionswin.cpp,v 1.1.1.1 2004-02-14 13:28:48 phoenix Exp $
34
// Purpose:
35
// Description: Implementation file for ecSolutionListCtrl
36
// Requires:
37
// Provides:
38
// See also:
39
// Known bugs:
40
// Usage:
41
//
42
//####DESCRIPTIONEND####
43
//
44
//===========================================================================
45
 
46
// ============================================================================
47
// declarations
48
// ============================================================================
49
 
50
// ----------------------------------------------------------------------------
51
// headers
52
// ----------------------------------------------------------------------------
53
#ifdef __GNUG__
54
    #pragma implementation "solutionswin.h"
55
#endif
56
 
57
// Includes other headers for precompiled compilation
58
#include "ecpch.h"
59
 
60
#ifdef __BORLANDC__
61
    #pragma hdrstop
62
#endif
63
 
64
#include "solutionswin.h"
65
 
66
#include "bitmaps/checked.xpm"
67
#include "bitmaps/unchecked.xpm"
68
 
69
/*
70
 * ecSolutionListCtrl
71
 */
72
 
73
IMPLEMENT_CLASS(ecSolutionListCtrl, wxListCtrl)
74
 
75
BEGIN_EVENT_TABLE(ecSolutionListCtrl, wxListCtrl)
76
    EVT_LEFT_DOWN(ecSolutionListCtrl::OnMouseEvent)
77
END_EVENT_TABLE()
78
 
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)
82
 
83
{
84
    SetImageList(& m_imageList, wxIMAGE_LIST_SMALL);
85
 
86
    m_imageList.Add(wxICON(unchecked));
87
    m_imageList.Add(wxICON(checked));
88
 
89
    InsertColumn(0, _("Item"), wxLIST_FORMAT_LEFT, 200);
90
    InsertColumn(1, _("Value"), wxLIST_FORMAT_LEFT, 80);
91
 
92
#if 0
93
    int i = 0;
94
    int j;
95
 
96
    for (j = 0; j < 10; j++)
97
    {
98
        wxListItem info;
99
        info.m_text = _("CYGPKG_HAL_EXCEPTIONS");
100
        info.m_mask = wxLIST_MASK_TEXT | wxLIST_MASK_IMAGE ; // | wxLIST_MASK_DATA;
101
        info.m_itemId = i;
102
        info.m_image = 0;
103
        //info.m_data = (long) doc;
104
 
105
        long item = InsertItem(info);
106
 
107
        SetItem(i, 1, _("Disabled"));
108
        i ++;
109
 
110
        info.m_text = _("CYGPKG_KERNEL_EXCEPTIONS");
111
        info.m_mask = wxLIST_MASK_TEXT | wxLIST_MASK_IMAGE ; // | wxLIST_MASK_DATA;
112
        info.m_itemId = i;
113
        info.m_image = 1;
114
        //info.m_data = (long) doc;
115
        item = InsertItem(info);
116
 
117
        SetItem(item, 1, _("Disabled"));
118
        i ++;
119
    }
120
#endif
121
}
122
 
123
void ecSolutionListCtrl::OnMouseEvent(wxMouseEvent& event)
124
{
125
    if (event.LeftDown())
126
    {
127
        int flags;
128
        long item = HitTest(event.GetPosition(), flags);
129
        if (item > -1 && (flags & wxLIST_HITTEST_ONITEMICON))
130
        {
131
            SetChecked(item, !IsChecked(item));
132
        }
133
        else
134
            event.Skip();
135
    }
136
    else
137
    {
138
        event.Skip();
139
    }
140
}
141
 
142
bool ecSolutionListCtrl::IsChecked(long item) const
143
{
144
    wxListItem info;
145
    info.m_mask = wxLIST_MASK_IMAGE ;
146
    info.m_itemId = item;
147
 
148
    if (GetItem(info))
149
    {
150
        return (info.m_image == 1);
151
    }
152
    else
153
        return FALSE;
154
}
155
 
156
void ecSolutionListCtrl::SetChecked(long item, bool checked)
157
{
158
    SetItemImage(item, (checked ? 1 : 0), -1);
159
}

powered by: WebSVN 2.1.0

© copyright 1999-2024 OpenCores.org, equivalent to Oliscience, all rights reserved. OpenCores®, registered trademark.