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

Subversion Repositories openrisc

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

powered by: WebSVN 2.1.0

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