Files
envi-code/SourceCode/Code2026/inc/PropItemCombo.h
T
2026-09-28 15:28:50 +08:00

122 lines
3.0 KiB
C++

#if !defined(__CPropITEMCOMBO_H__)
#define __CPropITEMCOMBO_H__
#if _MSC_VER > 1000
#pragma once
#endif // _MSC_VER > 1000
// PropTreeItemCombo.h : header file
//
// Copyright (C) 1998-2001 Scott Ramsay
// sramsay@gonavi.com
// http://www.gonavi.com
//
// This material is provided "as is", with absolutely no warranty expressed
// or implied. Any use is at your own risk.
//
// Permission to use or copy this software for any purpose is hereby granted
// without fee, provided the above notices are retained on all copies.
// Permission to modify the code and to distribute modified code is granted,
// provided the above notices are retained, and a notice that the code was
// modified is included with the above copyright notice.
//
// If you use this code, drop me an email. I'd like to know if you find the code
// useful.
#include "PropItem.h"
// 定义消息,在所在对话框中这样接受:
// .h afx_msg void OnSelectChanged(WPARAM iParam1, LPARAM iParam2);
// .cpp ON_MESSAGE(WM_SELECTCHANGED, OnSelectChanged)
#define WM_SELECTCHANGED 1982
class THVAC_UIAPI CPropItemCombo : public CComboBox, public CPropItem
{
public:
CPropItemCombo();
virtual ~CPropItemCombo();
public:
// The attribute area needs drawing
virtual void DrawAttribute(CDC* pDC, const RECT& rc);
// Retrieve the item's attribute value
// virtual LPARAM GetItemValue();
// Set the item's attribute value
// virtual void SetItemValue(LPARAM lParam);
// Called when attribute area has changed size
virtual void OnMove();
// Called when the item needs to refresh its data
virtual void OnRefresh();
// Called when the item needs to commit its changes
virtual void OnCommit();
// Called to activate the item
virtual void OnActivate();
// Create DropList ComboBox
BOOL CreateDropListComb(int* pInt);
BOOL CreateDropListComb(CString* pCString);
// Create DrowDown ComboBox band with CString
BOOL CreateDropDownComb(CString* pCString);
// Create DrowDown ComboBox band with double
BOOL CreateDropDownComb(double* pDouble);
// Create combo box with TRUE/FALSE selections
// BOOL CreateBoolComboBox();
// Set the height for the dropdown combo box
void SetDropDownHeight(LONG nDropHeight);
// Get the height of the dropdown combo box
LONG GetDropDownHeight();
// set the current text
void SetSelText(CString csText);
// Get the current text
CString GetValueText();
protected:
BOOL CreateComb(DWORD dwStyle);
void RecalcDropWidth();
protected:
// LPARAM m_lComboData;
LONG m_nDropHeight;
CString m_csEdit;
BOOL m_bEdit;
CString m_csTrue;
CString m_csFalse;
CString* m_pText;
double* m_pDouble;
int* m_pInt; // 表示GetCurSel(), 不是选项的值
protected:
LONG FindCBData(LPARAM lParam);
//{{AFX_VIRTUAL(CPropItemCombo)
//}}AFX_VIRTUAL
protected:
//{{AFX_MSG(CPropItemCombo)
afx_msg void OnSelchange();
afx_msg void OnEditchange();
afx_msg void OnKillfocus();
afx_msg void OnDropdown();
//}}AFX_MSG
DECLARE_MESSAGE_MAP()
};
//{{AFX_INSERT_LOCATION}}
#endif // !defined(__CPropITEMCOMBO_H__)