Skip to content

Commit

Permalink
added resizable combobox classes
Browse files Browse the repository at this point in the history
  • Loading branch information
ppescher committed Feb 18, 2002
1 parent aef5de7 commit e1311a2
Show file tree
Hide file tree
Showing 5 changed files with 573 additions and 0 deletions.
55 changes: 55 additions & 0 deletions ResizableLib/ResizableComboBox.cpp
Original file line number Diff line number Diff line change
@@ -0,0 +1,55 @@
// ResizableComboBox.cpp : implementation file
//

#include "stdafx.h"
#include "ResizableComboBox.h"

#ifdef _DEBUG
#define new DEBUG_NEW
#undef THIS_FILE
static char THIS_FILE[] = __FILE__;
#endif

/////////////////////////////////////////////////////////////////////////////
// CResizableComboBox

CResizableComboBox::CResizableComboBox()
{
}

CResizableComboBox::~CResizableComboBox()
{
if (m_ctrlListBox.GetSafeHwnd() != NULL)
m_ctrlListBox.UnsubclassWindow();
}


BEGIN_MESSAGE_MAP(CResizableComboBox, CComboBox)
//{{AFX_MSG_MAP(CResizableComboBox)
ON_WM_CTLCOLOR()
//}}AFX_MSG_MAP
END_MESSAGE_MAP()

/////////////////////////////////////////////////////////////////////////////
// CResizableComboBox message handlers

HBRUSH CResizableComboBox::OnCtlColor(CDC* pDC, CWnd* pWnd, UINT nCtlColor)
{
HBRUSH hbr = CComboBox::OnCtlColor(pDC, pWnd, nCtlColor);

if (nCtlColor == CTLCOLOR_LISTBOX)
{
if (!(GetStyle() & CBS_SIMPLE)
&& (m_ctrlListBox.GetSafeHwnd() == NULL))
{
TRACE("Combo: 0x%08X\n", pWnd->m_hWnd);

// attach to the owned listbox
m_ctrlListBox.m_pOwnerCombo = this;
m_ctrlListBox.SubclassWindow(pWnd->m_hWnd);
}
}

return hbr;
}

55 changes: 55 additions & 0 deletions ResizableLib/ResizableComboBox.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,55 @@
#if !defined(AFX_RESIZABLECOMBOBOX_H__CAEDF06D_C4F5_49E4_A783_AD7D894CF9A0__INCLUDED_)
#define AFX_RESIZABLECOMBOBOX_H__CAEDF06D_C4F5_49E4_A783_AD7D894CF9A0__INCLUDED_

#include "ResizableComboLBox.h" // Added by ClassView

#if _MSC_VER > 1000
#pragma once
#endif // _MSC_VER > 1000
// ResizableComboBox.h : header file
//

/////////////////////////////////////////////////////////////////////////////
// CResizableComboBox window

class CResizableComboBox : public CComboBox
{
// Construction
public:
CResizableComboBox();

// Attributes
public:

protected:
CResizableComboLBox m_ctrlListBox;

// Operations
public:

// Overrides
// ClassWizard generated virtual function overrides
//{{AFX_VIRTUAL(CResizableComboBox)
public:
protected:
//}}AFX_VIRTUAL

// Implementation
public:
virtual ~CResizableComboBox();

// Generated message map functions
protected:
//{{AFX_MSG(CResizableComboBox)
afx_msg HBRUSH OnCtlColor(CDC* pDC, CWnd* pWnd, UINT nCtlColor);
//}}AFX_MSG

DECLARE_MESSAGE_MAP()
};

/////////////////////////////////////////////////////////////////////////////

//{{AFX_INSERT_LOCATION}}
// Microsoft Visual C++ will insert additional declarations immediately before the previous line.

#endif // !defined(AFX_RESIZABLECOMBOBOX_H__CAEDF06D_C4F5_49E4_A783_AD7D894CF9A0__INCLUDED_)
Loading

0 comments on commit e1311a2

Please sign in to comment.