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

Subversion Repositories openrisc

[/] [openrisc/] [trunk/] [rtos/] [ecos-2.0/] [tools/] [src/] [tools/] [Utils/] [win32/] [ComboEdit.cpp] - Blame information for rev 578

Go to most recent revision | 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
// ComboEdit.cpp : implementation file
26
//
27
 
28
#include "stdafx.h"
29
#include "ComboEdit.h"
30
#include "cellview.h"
31
#include "Configtool.h"
32
 
33
#ifdef _DEBUG
34
#define new DEBUG_NEW
35
#undef THIS_FILE
36
static char THIS_FILE[] = __FILE__;
37
#endif
38
 
39
/////////////////////////////////////////////////////////////////////////////
40
// CComboEdit
41
 
42
CComboEdit::CComboEdit(LPCTSTR pszInitialValue,const CStringArray &arValues):
43
  CCell(pszInitialValue)
44
{
45
  m_arValues.Copy(arValues);
46
}
47
 
48
CComboEdit::~CComboEdit()
49
{
50
}
51
 
52
 
53
BEGIN_MESSAGE_MAP(CComboEdit, CCell)
54
        //{{AFX_MSG_MAP(CComboEdit)
55
        ON_WM_CREATE()
56
        ON_WM_KILLFOCUS()
57
        //}}AFX_MSG_MAP
58
END_MESSAGE_MAP()
59
 
60
/////////////////////////////////////////////////////////////////////////////
61
// CComboEdit message handlers
62
 
63
 
64
BOOL CComboEdit::Create(DWORD dwStyle, const RECT& rect, CWnd* pParentWnd, UINT nID, CCreateContext*)
65
{
66
  return CWnd::CreateEx(WS_EX_CLIENTEDGE,_T("COMBOBOX"), NULL, dwStyle, rect, pParentWnd, nID);
67
}
68
 
69
int CComboEdit::OnCreate(LPCREATESTRUCT lpCreateStruct)
70
{
71
        if (CCell::OnCreate(lpCreateStruct) == -1)
72
                return -1;
73
 
74
        SendMessage(WM_SETFONT,(WPARAM)(HFONT)GetStockObject(DEFAULT_GUI_FONT),0);
75
 
76
  CStringArray arEnum;
77
  for(int i=0;i<m_arValues.GetSize();i++){
78
    SendMessage(CB_ADDSTRING,0,(LPARAM)(LPCTSTR)m_arValues[i]);
79
  }
80
  int nIndex=SendMessage(CB_FINDSTRINGEXACT, (WPARAM)-1, (LPARAM)(LPCTSTR)m_strInitialValue);
81
  SendMessage(CB_SETCURSEL, nIndex == CB_ERR ? 0 : nIndex, 0);
82
 
83
        return 0;
84
}
85
 
86
void CComboEdit::OnKillFocus(CWnd*)
87
{
88
    CConfigTool::GetCellView()->CancelCellEdit();
89
}
90
 

powered by: WebSVN 2.1.0

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