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

Subversion Repositories openrisc

[/] [openrisc/] [trunk/] [rtos/] [ecos-3.0/] [host/] [tools/] [configtool/] [standalone/] [wxwin/] [solutionswin.cpp] - Blame information for rev 790

Go to most recent revision | Details | Compare with Previous | View Log

Line No. Rev Author Line
1 786 skrzyp
// ####ECOSHOSTGPLCOPYRIGHTBEGIN####                                        
2
// -------------------------------------------                              
3
// This file is part of the eCos host tools.                                
4
// Copyright (C) 1998, 1999, 2000 Free Software Foundation, Inc.            
5
//
6
// This program is free software; you can redistribute it and/or modify     
7
// it under the terms of the GNU General Public License as published by     
8
// the Free Software Foundation; either version 2 or (at your option) any   
9
// later version.                                                           
10
//
11
// This program is distributed in the hope that it will be useful, but      
12
// WITHOUT ANY WARRANTY; without even the implied warranty of               
13
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU        
14
// General Public License for more details.                                 
15
//
16
// You should have received a copy of the GNU General Public License        
17
// along with this program; if not, write to the                            
18
// Free Software Foundation, Inc., 51 Franklin Street,                      
19
// Fifth Floor, Boston, MA  02110-1301, USA.                                
20
// -------------------------------------------                              
21
// ####ECOSHOSTGPLCOPYRIGHTEND####                                          
22
// configtree.cpp :
23
//
24
//===========================================================================
25
//#####DESCRIPTIONBEGIN####
26
//
27
// Author(s):   julians
28
// Contact(s):  julians
29
// Date:        2000/09/08
30
// Version:     $Id: solutionswin.cpp,v 1.1 2001/02/08 18:06:52 julians Exp $
31
// Purpose:
32
// Description: Implementation file for ecSolutionListCtrl
33
// Requires:
34
// Provides:
35
// See also:
36
// Known bugs:
37
// Usage:
38
//
39
//####DESCRIPTIONEND####
40
//
41
//===========================================================================
42
 
43
// ============================================================================
44
// declarations
45
// ============================================================================
46
 
47
// ----------------------------------------------------------------------------
48
// headers
49
// ----------------------------------------------------------------------------
50
#ifdef __GNUG__
51
    #pragma implementation "solutionswin.h"
52
#endif
53
 
54
// Includes other headers for precompiled compilation
55
#include "ecpch.h"
56
 
57
#ifdef __BORLANDC__
58
    #pragma hdrstop
59
#endif
60
 
61
#include "solutionswin.h"
62
 
63
#include "bitmaps/checked.xpm"
64
#include "bitmaps/unchecked.xpm"
65
 
66
/*
67
 * ecSolutionListCtrl
68
 */
69
 
70
IMPLEMENT_CLASS(ecSolutionListCtrl, wxListCtrl)
71
 
72
BEGIN_EVENT_TABLE(ecSolutionListCtrl, wxListCtrl)
73
    EVT_LEFT_DOWN(ecSolutionListCtrl::OnMouseEvent)
74
END_EVENT_TABLE()
75
 
76
ecSolutionListCtrl::ecSolutionListCtrl(wxWindow* parent, wxWindowID id, const wxPoint& pt,
77
        const wxSize& sz, long style):
78
        wxListCtrl(parent, id, pt, sz, style), m_imageList(16, 16, TRUE)
79
 
80
{
81
    SetImageList(& m_imageList, wxIMAGE_LIST_SMALL);
82
 
83
    m_imageList.Add(wxICON(unchecked));
84
    m_imageList.Add(wxICON(checked));
85
 
86
    InsertColumn(0, _("Item"), wxLIST_FORMAT_LEFT, 200);
87
    InsertColumn(1, _("Value"), wxLIST_FORMAT_LEFT, 80);
88
 
89
#if 0
90
    int i = 0;
91
    int j;
92
 
93
    for (j = 0; j < 10; j++)
94
    {
95
        wxListItem info;
96
        info.m_text = _("CYGPKG_HAL_EXCEPTIONS");
97
        info.m_mask = wxLIST_MASK_TEXT | wxLIST_MASK_IMAGE ; // | wxLIST_MASK_DATA;
98
        info.m_itemId = i;
99
        info.m_image = 0;
100
        //info.m_data = (long) doc;
101
 
102
        long item = InsertItem(info);
103
 
104
        SetItem(i, 1, _("Disabled"));
105
        i ++;
106
 
107
        info.m_text = _("CYGPKG_KERNEL_EXCEPTIONS");
108
        info.m_mask = wxLIST_MASK_TEXT | wxLIST_MASK_IMAGE ; // | wxLIST_MASK_DATA;
109
        info.m_itemId = i;
110
        info.m_image = 1;
111
        //info.m_data = (long) doc;
112
        item = InsertItem(info);
113
 
114
        SetItem(item, 1, _("Disabled"));
115
        i ++;
116
    }
117
#endif
118
}
119
 
120
void ecSolutionListCtrl::OnMouseEvent(wxMouseEvent& event)
121
{
122
    if (event.LeftDown())
123
    {
124
        int flags;
125
        long item = HitTest(event.GetPosition(), flags);
126
        if (item > -1 && (flags & wxLIST_HITTEST_ONITEMICON))
127
        {
128
            SetChecked(item, !IsChecked(item));
129
        }
130
        else
131
            event.Skip();
132
    }
133
    else
134
    {
135
        event.Skip();
136
    }
137
}
138
 
139
bool ecSolutionListCtrl::IsChecked(long item) const
140
{
141
    wxListItem info;
142
    info.m_mask = wxLIST_MASK_IMAGE ;
143
    info.m_itemId = item;
144
 
145
    if (GetItem(info))
146
    {
147
        return (info.m_image == 1);
148
    }
149
    else
150
        return FALSE;
151
}
152
 
153
void ecSolutionListCtrl::SetChecked(long item, bool checked)
154
{
155
    SetItemImage(item, (checked ? 1 : 0), -1);
156
}

powered by: WebSVN 2.1.0

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