Ejemplo n.º 1
0
///////////////////////////////////////////////////////////////////////////////
// OpenThemeData
HTHEME CXThemeHelper::OpenThemeData(HWND hWnd, LPCTSTR lpszClassList)
{
	XLISTCTRL_TRACE(_T("in CXThemeHelper::OpenThemeData\n"));

	HTHEME hTheme = NULL;

	if (m_bThemeLibLoaded)
	{

#ifdef _UNICODE

		hTheme = m_OpenThemeData(hWnd, lpszClassList);

#else

		int nLen = MultiByteToWideChar(CP_ACP, MB_PRECOMPOSED, lpszClassList, 
			_tcslen(lpszClassList)+1, NULL, 0);
		nLen += 2;
		WCHAR * pszWide = new WCHAR [nLen];
		if (pszWide)
		{
			MultiByteToWideChar(CP_ACP, MB_PRECOMPOSED, lpszClassList, 
				_tcslen(lpszClassList)+1, pszWide, nLen);
			hTheme = m_OpenThemeData(hWnd, pszWide);
			delete pszWide;
		}

#endif

	}

	XLISTCTRL_TRACE(_T("m_hTheme=%X\n"), hTheme);

	return hTheme;
}
int CAdvComboBox::FindStringExact(int nIndexStart, LPCTSTR lpszFind)
{
	XLISTCTRL_TRACE(_T("in CAdvComboBox::FindStringExact:  nIndexStart=%d\n"), nIndexStart);

	if( nIndexStart > (int)m_list.size() && nIndexStart != -1 )
		return CB_ERR;

	int nPos = 0;
	m_iter = m_list.begin();
	if( nIndexStart != -1 )
	{
		advance( m_iter, nIndexStart );
		nPos = nIndexStart;
	}
	for( m_iter; m_iter != m_list.end(); ++m_iter )
	{
		if( _tcscmp( m_iter->strText.c_str(), lpszFind ) == 0 )
		{
			XLISTCTRL_TRACE(_T("CAdvComboBox::FindStringExact returning %d\n"), nPos);
			return nPos;
		}
		nPos++;
	}
	return CB_ERR;
}
Ejemplo n.º 3
0
void CAdvComboBox::PreSubclassWindow() 
{
	XLISTCTRL_TRACE(_T("in CAdvComboBox::PreSubclassWindow\n"));

	if (m_pParent == NULL)
		m_pParent = GetParent();
	ASSERT(m_pParent);

	// TODO: Add your specialized code here and/or call the base class
	LoadString();

	if( !m_pFont )
	{
		LOGFONT logFont;
		memset( &logFont, 0, sizeof(LOGFONT) );
		CFont* pF = m_pParent->GetFont();
		ASSERT(pF);
		pF->GetLogFont( &logFont );
		m_pFont = new CFont;
		m_pFont->CreateFontIndirect(&logFont);
		SetFont( m_pFont );
	}

	if( !m_bCodeCreate )
	{
		//
		// Do we need to show an edit control. (CBS_DROPDOWN)
		if( (GetStyle() & CBS_DROPDOWN) && !(GetStyle() & CBS_SIMPLE) )	// == CBS_DROPDOWN
		{
			if( !m_pEdit )
			{
				CRect rect;
				GetClientRect(rect);
				rect.right = rect.right - ::GetSystemMetrics(SM_CXHSCROLL);
				if( m_dwACBStyle & ACBS_STANDARD )
				{
					rect.DeflateRect( 2, 2 );
					rect.left += 1;
					rect.top += 2;
					//rect.bottom += 2;
				}

				XLISTCTRL_TRACE(_T("creating edit\n"));
				m_pEdit = new CAdvComboEdit;	//+++
				ASSERT(m_pEdit);
				DWORD dwStyle = 0;
				dwStyle = WS_VISIBLE | WS_CHILD;
				if( GetStyle() & CBS_AUTOHSCROLL )
				{
					dwStyle |= ES_AUTOHSCROLL;
				}
				VERIFY(m_pEdit->Create( dwStyle, rect, this, IDC_COMBOEDIT ));
				m_pEdit->SetFont( m_pFont );
				m_pEdit->SetWindowText( m_strEdit.c_str() );
			}
		}
	}
	CWnd::PreSubclassWindow();
}
Ejemplo n.º 4
0
///////////////////////////////////////////////////////////////////////////////
// ctor
CXThemeHelper::CXThemeHelper()
{
	m_nUseCount++;

	XLISTCTRL_TRACE(_T("in CXThemeHelper: m_nUseCount=%d\n"), m_nUseCount);

	if (!m_bThemeLibLoaded)
	{
		Init();
	}
	else
	{
		XLISTCTRL_TRACE(_T("already initialized\n"));
	}
}
Ejemplo n.º 5
0
///////////////////////////////////////////////////////////////////////////////
// Init
void CXThemeHelper::Init()
{
	XLISTCTRL_TRACE(_T("in CXThemeHelper::Init\n"));

	m_hThemeLib = LoadLibrary(_T("UXTHEME.DLL"));

	if (m_hThemeLib)
	{
		m_CloseThemeData                = (PFNCLOSETHEMEDATA)GetProcAddress(m_hThemeLib,
																			"CloseThemeData");
		m_DrawThemeBackground           = (PFNDRAWTHEMEBACKGROUND)GetProcAddress(m_hThemeLib,
																			"DrawThemeBackground");
		m_DrawThemeText                 = (PFNDRAWTHEMETEXT)GetProcAddress(m_hThemeLib,
																			"DrawThemeText");
		m_GetThemeBackgroundContentRect = (PFNGETTHEMEBACKGROUNDCONTENTRECT)GetProcAddress(m_hThemeLib,
																			"GetThemeBackgroundContentRect");
		m_GetThemeColor                 = (PFNGETTHEMECOLOR)GetProcAddress(m_hThemeLib,
																			"GetThemeColor");
		m_IsAppThemed                   = (PFNISAPPTHEMED)GetProcAddress(m_hThemeLib,
																			"IsAppThemed");
		m_IsThemeActive                 = (PFNISTHEMEACTIVE)GetProcAddress(m_hThemeLib,
																			"IsThemeActive");
		m_OpenThemeData                 = (PFNOPENTHEMEDATA)GetProcAddress(m_hThemeLib,
																			"OpenThemeData");
		if (m_CloseThemeData &&
			m_DrawThemeBackground &&
			m_DrawThemeText &&
			m_GetThemeBackgroundContentRect &&
			m_GetThemeColor &&
			m_IsAppThemed &&
			m_IsThemeActive &&
			m_OpenThemeData)
		{
			XLISTCTRL_TRACE(_T("UXTHEME.DLL loaded ok\n"));
			m_bThemeLibLoaded = TRUE;
		}
		else
		{
			TRACE(_T("ERROR - failed to locate theme library function\n"));
			FreeLibrary(m_hThemeLib);
			m_hThemeLib = NULL;
		}
	}
	else
	{
		TRACE(_T("UXTHEME.DLL not accessible\n"));
	}
}
Ejemplo n.º 6
0
void CAdvComboBox::OnKillFocus(CWnd* pNewWnd) 
{
	XLISTCTRL_TRACE(_T("in CAdvComboBox::OnKillFocus\n"));
	CWnd::OnKillFocus(pNewWnd);

	OnEscapeKey();

	//+++
#if 0  // -----------------------------------------------------------
	// Needed for keydown's like 'Alt-C'("&Cancel" button)
	if( m_pDropWnd ) 
	{
		OnDestroyDropdownList(0,0);
	//}
	m_bHasFocus = false;
	Invalidate();

	BOOL bDropdownList = (GetStyle() & CBS_DROPDOWN) && (GetStyle() & CBS_SIMPLE);
	if( bDropdownList && !m_pDropWnd )
	{
		// Send message to parent(dialog)
		int nId = GetDlgCtrlID();
		m_pParent->SendMessage( WM_COMMAND, MAKEWPARAM(nId,CBN_SELENDCANCEL), (LPARAM)m_hWnd );
		m_pParent->SendMessage( WM_COMMAND, MAKEWPARAM(nId,CBN_KILLFOCUS), (LPARAM)m_hWnd );
	}
	}
	else
	{
		OnEscapeKey();
	}
#endif // -----------------------------------------------------------
}
Ejemplo n.º 7
0
///////////////////////////////////////////////////////////////////////////////
// OnCreate
int CXEdit::OnCreate(LPCREATESTRUCT lpCreateStruct)
{
	XLISTCTRL_TRACE(_T("in CXEdit::OnCreate\n"));

	if (CEdit::OnCreate(lpCreateStruct) == -1)
	{
		return -1;
	}

	// set the proper font
	if (!m_pParent)
	{
		m_pParent = GetParent();
	}

	if (m_pParent && ::IsWindow(m_pParent->m_hWnd))
	{
		CFont* pFont = m_pParent->GetFont();
		if (pFont)
		{
			SetFont(pFont);
		}
	}
	else
	{
		m_pParent = NULL;
	}

	SetWindowText(m_strText);
	SetSel(0, -1);
	SetFocus();
	SetCapture();

	return 0;
}
Ejemplo n.º 8
0
///////////////////////////////////////////////////////////////////////////////
// ctor
CXEdit::CXEdit(CWnd* pParent, LPCTSTR lpszText) :
m_pParent(pParent),
m_strText(lpszText),
m_bMessageSent(FALSE)
{
	XLISTCTRL_TRACE(_T("in CXEdit::CXEdit\n"));
}
Ejemplo n.º 9
0
CAdvComboBox::CAdvComboBox( BOOL bInst, CWnd * pParent ) :
	m_pDropWnd(0),
	m_bDropListVisible(0),
	m_bInst( bInst ),
	m_pParent(pParent)
{
	XLISTCTRL_TRACE(_T("in CAdvComboBox::CAdvComboBox\n"));
	RegisterWindowClass();
	m_pEdit = NULL;
	m_zDelta = 0;
	m_nCurSel = -1;
	m_bDropRectStored= false;
	m_bHasFocus = false;
	m_bHasSentFocus = false;
	m_bSelItem = false;
	m_bFirstPaint = true;
	m_nMinVisItems = 5;
	m_bCodeCreate = false;
	m_bAutoAppend = TRUE;
	m_bDropButtonHot = false;
	m_bTrackMouseLeave = false;
	m_nDefaultDropItems = -1;

	m_dwACBStyle = 0;
	m_dwACBStyle |= ACBS_STANDARD;

	m_pFont = NULL;
}
Ejemplo n.º 10
0
LONG CAdvComboBox::OnDropdownButton( WPARAM /*wParam*/, LPARAM /*lParam*/ )
{
	XLISTCTRL_TRACE(_T("in CAdvComboBox::OnDropdownButton\n"));
	//
	//
	if( !m_bDropListVisible )
	{
		//
		// Button is pressed
		//
		// Create list
		if( !m_pDropWnd )
		{
			CreateDropList( m_list );
		}
		m_pDropWnd->ShowWindow( SW_SHOW );
		m_bDropListVisible = TRUE;
	}
	else
	{
		OnDestroyDropdownList(0,0);
	}

	// Return TRUE if OK to go back, else return FALSE.
	return TRUE;
}
Ejemplo n.º 11
0
void CAdvComboBox::OnActivateApp(BOOL bActive, HTASK hTask) 
{
	XLISTCTRL_TRACE(_T("in CAdvComboBox::OnActivateApp\n"));
	//xlistctrl.pubb
	//CWnd::OnActivateApp(bActive, hTask);
	CWnd::OnActivateApp(bActive, (DWORD)hTask);
}
Ejemplo n.º 12
0
LONG CAdvComboBox::OnDestroyDropdownList( WPARAM /*wParam*/, LPARAM /*lParam*/ )
{
	XLISTCTRL_TRACE(_T("in CAdvComboBox::OnDestroyDropdownList\n"));
	//
	// 
	if( m_pDropWnd )
	{
		m_pDropWnd->GetWindowRect( &m_rcDropWnd );
		m_bDropRectStored = true;
		m_pDropWnd->ShowWindow( SW_HIDE );
		m_bDropListVisible = FALSE;
		m_pDropWnd->DestroyWindow();
		delete m_pDropWnd;
		m_pDropWnd = NULL;

		InvalidateRect( &m_rcDropButton );
		int nId = GetDlgCtrlID();
		if( !m_bSelItem )
		{
			m_pParent->SendMessage( WM_COMMAND, MAKEWPARAM(nId,CBN_SELENDCANCEL), 
				(LPARAM)m_hWnd );
		}
		else
		{
			m_bSelItem = false;
		}
		m_pParent->SendMessage( WM_COMMAND, MAKEWPARAM(nId,CBN_CLOSEUP), (LPARAM)m_hWnd );
	}
	else
	{
		OnComboComplete();
	}

	return TRUE;
}
Ejemplo n.º 13
0
///////////////////////////////////////////////////////////////////////////////
// dtor
CXThemeHelper::~CXThemeHelper()
{
	XLISTCTRL_TRACE(_T("in CXThemeHelper::~CXThemeHelper\n"));

	if (m_nUseCount > 0)
		m_nUseCount--;

	if (m_nUseCount == 0)
	{
		XLISTCTRL_TRACE(_T("unloading theme dll\n"));
		if (m_hThemeLib)
			FreeLibrary(m_hThemeLib);
		m_hThemeLib = NULL;
		m_bThemeLibLoaded = FALSE;
	}
	XLISTCTRL_TRACE(_T("m_nUseCount=%d\n"), m_nUseCount);
}
Ejemplo n.º 14
0
///////////////////////////////////////////////////////////////////////////////
// CloseThemeData
BOOL CXThemeHelper::CloseThemeData(HTHEME hTheme)
{
	XLISTCTRL_TRACE(_T("in CXThemeHelper::CloseThemeData\n"));

	BOOL ok = FALSE;

	if (m_bThemeLibLoaded && hTheme)
	{
		HRESULT hr = m_CloseThemeData(hTheme);
		if (SUCCEEDED(hr))
			ok = TRUE;
	}

	return ok;
}
Ejemplo n.º 15
0
BOOL CAdvComboBox::Create( DWORD dwStyle, const RECT& rect, CWnd* pParentWnd, UINT nID )
{
	XLISTCTRL_TRACE(_T("in CAdvComboBox::Create\n"));
	m_rcCombo = rect;
	m_bCodeCreate = true;

	m_dwACBStyle |= ACBS_STANDARD;
	m_dwStyle = dwStyle;

	LoadString( nID );
	
	BOOL bRet = CWnd::Create(NULL, _T(""), dwStyle, m_rcCombo, pParentWnd, nID );

	return bRet;
}
Ejemplo n.º 16
0
void CAdvComboBox::OnKeyDown(UINT nChar, UINT nRepCnt, UINT nFlags) 
{
	XLISTCTRL_TRACE(_T("in CAdvComboBox::OnKeyDown\n"));

	if (nChar == VK_DOWN)
		SelNextItem();
	else if (nChar == VK_UP)
		SelPrevItem();
	else if (nChar == VK_NEXT)
		SelNextPage();
	else if (nChar == VK_PRIOR)
		SelPrevPage();

	CWnd::OnKeyDown(nChar, nRepCnt, nFlags);
}
Ejemplo n.º 17
0
CAdvComboBox::~CAdvComboBox()
{
	XLISTCTRL_TRACE(_T("in CAdvComboBox::~CAdvComboBox\n"));

	delete m_pFont;
	if( m_pDropWnd )
	{
		m_pDropWnd->ShowWindow( SW_HIDE );
		m_bDropListVisible = FALSE;
		m_pDropWnd->DestroyWindow();
		delete m_pDropWnd;
		m_pDropWnd = NULL;
	}
	if( m_pEdit )
	{
		m_pEdit->DestroyWindow();
		delete m_pEdit;
	}
}
Ejemplo n.º 18
0
///////////////////////////////////////////////////////////////////////////////
// GetThemeColor
BOOL CXThemeHelper::GetThemeColor(HTHEME hTheme,
								  int iPartId,
								  int iStateId,
								  int iPropId,
								  COLORREF * pColor)
{
	XLISTCTRL_TRACE(_T("in CXThemeHelper::GetThemeColor\n"));

	BOOL ok = FALSE;

	if (m_bThemeLibLoaded && hTheme)
	{
		HRESULT hr = m_GetThemeColor(hTheme, iPartId, iStateId, iPropId, pColor);
		if (SUCCEEDED(hr))
			ok = TRUE;
	}

	return ok;
}
Ejemplo n.º 19
0
///////////////////////////////////////////////////////////////////////////////
// GetThemeBackgroundContentRect
BOOL CXThemeHelper::GetThemeBackgroundContentRect(HTHEME hTheme,
												  HDC hdc,
												  int iPartId,
												  int iStateId,
												  const RECT *pBoundingRect,
												  RECT *pContentRect)
{
	XLISTCTRL_TRACE(_T("in CXThemeHelper::GetThemeBackgroundContentRect\n"));

	BOOL ok = FALSE;

	if (m_bThemeLibLoaded && hTheme)
	{
		HRESULT hr = m_GetThemeBackgroundContentRect(hTheme, hdc, iPartId, 
							iStateId, pBoundingRect, pContentRect);
		if (SUCCEEDED(hr))
			ok = TRUE;
	}

	return ok;
}
Ejemplo n.º 20
0
int CAdvComboBox::OnCreate(LPCREATESTRUCT lpCreateStruct) 
{
	XLISTCTRL_TRACE(_T("in CAdvComboBox::OnCreate\n"));

	if (CWnd::OnCreate(lpCreateStruct) == -1)
		return -1;
	
	if( !m_pFont )
	{
		LOGFONT logFont;
		memset( &logFont, 0, sizeof(LOGFONT) );
		CFont* pF = m_pParent->GetFont();
		ASSERT(pF);
		pF->GetLogFont( &logFont );
		m_pFont = new CFont;
		m_pFont->CreateFontIndirect(&logFont);
		SetFont( m_pFont );
	}

	return 0;
}
Ejemplo n.º 21
0
void CAdvComboBox::CreateDropList( list<LIST_ITEM> &droplist)
{
	XLISTCTRL_TRACE(_T("in CAdvComboBox::CreateDropList\n"));
	CRect rc;
	if( m_pDropWnd )
		ASSERT(0);
	m_pDropWnd = new CDropWnd( this, droplist, m_dwACBStyle );
	GetWindowRect( &rc );
	rc.top = rc.bottom ;

	//
	// Get screen size
	CRect rcWorkArea;
	SystemParametersInfo( SPI_GETWORKAREA, 0, (LPRECT)rcWorkArea, 0) ;
	if( rc.bottom >= rcWorkArea.bottom )
	{
		rc.bottom = rcWorkArea.bottom;
	}
	else
	{
	}

	int nStyle = WS_CHILD|/*WS_BORDER|*/LBS_DISABLENOSCROLL|LBS_NOTIFY;
	m_pDropWnd->Create( 0, 0, nStyle , rc, 1 ? GetDesktopWindow() : this, 6 );

	//+++
	if (m_nCurSel > ((int)droplist.size() - 1))
		m_nCurSel = 0;

	m_pDropWnd->GetListBoxPtr()->SetCurSel( m_nCurSel );

	m_pDropWnd->SetFont( m_pFont );

	// Send message to parent(dialog)
	int nId = GetDlgCtrlID();
	m_pParent->SendMessage( WM_COMMAND, MAKEWPARAM(nId,CBN_DROPDOWN), (LPARAM)m_hWnd );

}
Ejemplo n.º 22
0
///////////////////////////////////////////////////////////////////////////////
// OnDestroy
void CXEdit::OnDestroy()
{
	XLISTCTRL_TRACE(_T("in CXEdit::OnDestroy\n"));
	ReleaseCapture();
	CEdit::OnDestroy();
}
Ejemplo n.º 23
0
///////////////////////////////////////////////////////////////////////////////
// dtor
CXEdit::~CXEdit()
{
	XLISTCTRL_TRACE(_T("in CXEdit::~CXEdit\n"));
}
Ejemplo n.º 24
0
BOOL CAdvComboBox::PreTranslateMessage(MSG* pMsg) 
{
	if( pMsg->message == WM_KEYDOWN )
	{
		m_bAutoAppend = TRUE;

		XLISTCTRL_TRACE(_T("CAdvComboBox: Key was pressed(AdvComboBox)\n"));

		if( pMsg->wParam == VK_RETURN )
		{
			XLISTCTRL_TRACE(_T("CAdvComboBox: VK_RETURN\n"));
			if( m_pDropWnd )
			{
				int nPos = m_pDropWnd->GetListBoxPtr()->GetCurSel();
				if (nPos != LB_ERR)	//+++
					SendMessage( WM_SELECTED_ITEM, (WPARAM)nPos );
				//else				//+++
					OnDestroyDropdownList(0,0);	//+++
			}
			else
			{
				return CWnd::PreTranslateMessage(pMsg);
			}
		}
		else
		if( pMsg->wParam == VK_ESCAPE )
		{
			XLISTCTRL_TRACE(_T("CAdvComboBox: VK_ESCAPE\n"));
			if( m_pDropWnd )
			{
				OnDestroyDropdownList(0,0);
				Invalidate();
			}
			else	//+++
			{
				OnEscapeKey();
				return CWnd::PreTranslateMessage(pMsg);
			}
		}
		else
		if( pMsg->wParam == VK_F4 )
		{
			SendMessage( WM_ON_DROPDOWN_BUTTON );
			Invalidate();
		}
		else
		if( pMsg->wParam == VK_UP )
		{
			SelPrevItem();
		}
		else
		if( pMsg->wParam == VK_DOWN )
		{
			SelNextItem();
		}
		else
		if( pMsg->wParam == VK_PRIOR )	//+++
		{
			SelPrevPage();
		}
		else
		if( pMsg->wParam == VK_NEXT )	//+++
		{
			SelNextPage();
		}
		else
		if( pMsg->wParam == VK_DELETE || pMsg->wParam == VK_BACK )
		{
			m_bAutoAppend = FALSE;
			return CWnd::PreTranslateMessage(pMsg);
		}
		else
		if( pMsg->wParam == VK_RIGHT )
		{
			if( m_dwACBStyle & ACBS_AUTOAPPEND )
			{
				// If the cursor is at the end of the text, show autosuggest text
				if( m_pEdit )
				{
					int nS, nE;
					m_pEdit->GetSel( nS, nE );
					if( nS == nE && nS == m_pEdit->LineLength() )
					{
						OnUpdateEdit();
					}
					else
					{
						return CWnd::PreTranslateMessage(pMsg);
					}
				}
			}
			else
			{
				return CWnd::PreTranslateMessage(pMsg);
			}
		}
		else
		{
			return CWnd::PreTranslateMessage(pMsg);
		}
		return TRUE;
	}
	else
	if( pMsg->message == WM_SYSKEYDOWN )
	{
		if( pMsg->wParam == VK_DOWN ||
			pMsg->wParam == VK_UP )
		{
			SendMessage( WM_ON_DROPDOWN_BUTTON );
			Invalidate();
		}
	}

	return CWnd::PreTranslateMessage(pMsg);
}
Ejemplo n.º 25
0
//+++
void CAdvComboBox::SelNextPage()
{
	XLISTCTRL_TRACE(_T("in CAdvComboBox::SelNextPage\n"));
	if (m_pDropWnd)
	{
		CDropListBox * pListBox = m_pDropWnd->GetListBoxPtr();
		ASSERT(pListBox);

		int nPos        = pListBox->GetCurSel();
		int nCount      = pListBox->GetCount();
		int nMaxVisible = pListBox->GetMaxVisibleItems();
		int nTop        = pListBox->GetTopIndex();

		if (nPos == LB_ERR)							// no selection
			nPos = 0;
		else if (nPos == (nCount - 1))				// end of list
			/*nPos = -1*/;
		else if (nPos < (nTop + nMaxVisible - 1))	// middle of listbox window
			nPos = nTop + nMaxVisible - 1;
		else										// at end of listbox window
			nPos = nTop + nMaxVisible + nMaxVisible - 2;

		if (nPos >= nCount)							// moved past end, reset
			nPos = nCount - 1;

		pListBox->SetCurSel(nPos);
		
		int nSel = pListBox->GetCurSel();
		if (nSel == LB_ERR)
		{
		}
		else
		{
			CString str = _T("");
			pListBox->GetText(nSel, str);
			SetWindowText(str);
		}
	}
	else
	{
		// combo list not dropped

		int nSize = m_list.size();
		m_iter = m_list.begin();
		if (m_nCurSel < 0 || m_nCurSel >= nSize)
			m_nCurSel = 0;
		advance(m_iter, m_nCurSel);
		int nOldSel = m_nCurSel;
		int nPos = m_nCurSel;

		// Page Down goes forward by 10
		for (int i = 0; i < 10; i++)  
		{
			if (nPos >= (nSize-1))
			{
				nPos = nSize - 1;
				break;
			}

			nPos++;
			m_iter++;
		}

		if (nOldSel != nPos)
		{
			m_strEdit = m_iter->strText;
			if (m_pEdit)
				m_pEdit->SetWindowText(m_strEdit.c_str());
			Invalidate();
			m_nCurSel = nPos;

			// Send message to parent(dialog)
			int nId = GetDlgCtrlID();
			m_pParent->SendMessage( WM_COMMAND, MAKEWPARAM(nId,CBN_SELENDOK), (LPARAM)m_hWnd );
			m_pParent->SendMessage( WM_COMMAND, MAKEWPARAM(nId,CBN_SELCHANGE), (LPARAM)m_hWnd );
		}
	}
}
void CAdvComboBox::OnActivateApp(BOOL bActive, DWORD hTask) 
#endif
{
	XLISTCTRL_TRACE(_T("in CAdvComboBox::OnActivateApp\n"));
	CWnd::OnActivateApp(bActive, hTask);
}
Ejemplo n.º 27
0
CAdvComboEdit::~CAdvComboEdit()
{
	XLISTCTRL_TRACE(_T("in CAdvComboEdit::~CAdvComboEdit\n"));
}
Ejemplo n.º 28
0
void CAdvComboEdit::PreSubclassWindow() 
{
	XLISTCTRL_TRACE(_T("in CAdvComboEdit::PreSubclassWindow\n"));
	SetTimer(1, 100, NULL);	
	CEdit::PreSubclassWindow();
}
Ejemplo n.º 29
0
void CDropWnd::OnLButtonDown(UINT nFlags, CPoint point) 
{
	XLISTCTRL_TRACE(_T("in CDropWnd::OnLButtonDown\n"));
	if( m_rcSizeHandle.PtInRect( point ) )
	{
		m_bResizing = true;

		m_ptLastResize = point;

		CRect rcClient;
		GetClientRect( &rcClient );
		m_nMouseDiffX = rcClient.Width() - point.x;
		m_nMouseDiffY = rcClient.Height() - point.y;
		return;
	}

//
// Clean up the code below...
//

	CRect rc;
	CRect rcVScroll(0,0,0,0);
	GetClientRect( &rc );
	
	// Take away vertical scroll

	if( rc.PtInRect( point ) )
	{
	}
	else
	{
		//
		// Calc the point in the parent(PropertyListBox)
		CWnd* pParent = m_pComboParent->GetParent();
		CRect rcParentClient;
		CRect rcParentWnd;
		pParent->GetClientRect( &rcParentClient );
		pParent->GetWindowRect( &rcParentWnd );

		CPoint pt = point;
		ClientToScreen( &pt );
			pt.x -= rcParentWnd.left;
			pt.y -= rcParentWnd.top;

		CAdvComboBox* pList = static_cast<CAdvComboBox*>(m_pComboParent);
		if( !pList->PointInWindow( pt ) )
		{
			
			ReleaseCapture();

			m_pComboParent->PostMessage( WM_DESTROY_DROPLIST );
		}
		else
		{
			ReleaseCapture();
			m_pComboParent->PostMessage( WM_DESTROY_DROPLIST );
		}
	}

	LPARAM l = MAKELPARAM(point.x, point.y);
	m_pComboParent->SendMessage(WM_LBUTTONDOWN, nFlags, l);

	CWnd::OnLButtonDown(nFlags, point);
}