123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724 |
- // ComboBoxListCtrl4.cpp : implementation file
- //
- #include "stdafx.h"
- #include "ComboListCtrl6.h"
- #include <windowsx.h>
- #include "ylgl.h"
- #ifdef _DEBUG
- #define new DEBUG_NEW
- #undef THIS_FILE
- static char THIS_FILE[] = __FILE__;
- #endif
- #define IDC_ComboBox 0X01
- #define PROPERTY_ITEM 0x02
- #define PROPERTY_SUB 0x03
- /////////////////////////////////////////////////////////////////////////////
- // CComboBoxListCtrl6
- extern CFont g_listctrlfont;
- //ComboBox////////////////////////////////////////////////////////////////////////
- CListCtrlComboBox6::CListCtrlComboBox6()
- {
- }
- CListCtrlComboBox6::~CListCtrlComboBox6()
- {
- }
- BEGIN_MESSAGE_MAP(CListCtrlComboBox6, CComboBox)
- //{{AFX_MSG_MAP(CListCtrlComboBox6)
- ON_WM_KILLFOCUS()
- ON_WM_SETFOCUS()
- ON_CONTROL_REFLECT(CBN_CLOSEUP, OnCloseup)
- //}}AFX_MSG_MAP
- END_MESSAGE_MAP()
- /////////////////////////////////////////////////////////////////////////////
- // CListCtrlComboBox6 message handlers
- void CListCtrlComboBox6::SetCtrlData(DWORD dwData)
- {
- m_dwData = dwData;
- }
- DWORD CListCtrlComboBox6::GetCtrlData()
- {
- return m_dwData;
- }
- void CListCtrlComboBox6::OnKillFocus(CWnd* pNewWnd)
- {
- CComboBox::OnKillFocus(pNewWnd);
- CWnd* pParent = this->GetParent();
- // ::PostMessage(pParent->GetSafeHwnd(),WM_USER_ComboBox_END,m_bExchange,0);
- }
- BOOL CListCtrlComboBox6::PreTranslateMessage(MSG* pMsg)
- {
- if(pMsg->message == WM_KEYDOWN)
- {
- if(pMsg->wParam == VK_RETURN)
- {
- CWnd* pParent = this->GetParent();
- m_bExchange = TRUE;
- ::PostMessage(pParent->GetSafeHwnd(),WM_USER_ComboBox_END,m_bExchange,0);
- }
- else if(pMsg->wParam == VK_ESCAPE)
- {
- CWnd* pParent = this->GetParent();
- m_bExchange = FALSE;
- ::PostMessage(pParent->GetSafeHwnd(),WM_USER_ComboBox_END,m_bExchange,0);
- }
- }
- return CComboBox::PreTranslateMessage(pMsg);
- }
- void CListCtrlComboBox6::OnSetFocus(CWnd* pOldWnd)
- {
- CComboBox::OnSetFocus(pOldWnd);
- m_bExchange = TRUE;
- }
- void CListCtrlComboBox6::OnCloseup()
- {
- // TODO: Add your control notification handler code here
- CWnd* pParent = this->GetParent();
- ::PostMessage(pParent->GetSafeHwnd(),WM_USER_ComboBox_END,m_bExchange,0);
- }
- ///ListCtrl/////////////////////////////////////////////////////
- CComboBoxListCtrl6::CComboBoxListCtrl6()
- {
- // m_pComboBox->m_hWnd = NULL;
- }
- CComboBoxListCtrl6::~CComboBoxListCtrl6()
- {
- }
- BEGIN_MESSAGE_MAP(CComboBoxListCtrl6, CListCtrl)
- //{{AFX_MSG_MAP(CComboBoxListCtrl6)
- ON_WM_LBUTTONDBLCLK()
- ON_WM_LBUTTONDOWN()
- ON_WM_PARENTNOTIFY()
- ON_NOTIFY_REFLECT(NM_CUSTOMDRAW, OnCustomdrawList)
- //}}AFX_MSG_MAP
- ON_MESSAGE(WM_USER_ComboBox_END,OnComboBoxEnd)
- ON_MESSAGE(WM_USER_EDIT_END,OnEditEnd)
- END_MESSAGE_MAP()
- void CComboBoxListCtrl6::OnCustomdrawList ( NMHDR* pNMHDR, LRESULT* pResult )
- {
- NMLVCUSTOMDRAW* pLVCD = reinterpret_cast<NMLVCUSTOMDRAW*>( pNMHDR );
- // Take the default processing unless we set this to something else below.
- *pResult = 0;
- // First thing - check the draw stage. If it's the control's prepaint
- // stage, then tell Windows we want messages for every item.
- if ( CDDS_PREPAINT == pLVCD->nmcd.dwDrawStage )
- {
- *pResult = CDRF_NOTIFYITEMDRAW;
- }
- else if ( CDDS_ITEMPREPAINT == pLVCD->nmcd.dwDrawStage )
- {
- // This is the prepaint stage for an item. Here's where we set the
- // item's text color. Our return value will tell Windows to draw the
- // item itself, but it will use the new color we set here.
- // We'll cycle the colors through red, green, and light blue.
- COLORREF crText;
- int pos=pLVCD->nmcd.dwItemSpec;
- if(pos%2)
- {
- pLVCD->clrTextBk = g_gridcol1;
- }
- else
- {
- pLVCD->clrTextBk = g_gridcol2;
- }
- // Tell Windows to paint the control itself.
- *pResult = CDRF_DODEFAULT;
- }
- }
- void CComboBoxListCtrl6::OnLButtonDown(UINT nFlags, CPoint point)
- {
- ::PostMessage(this->GetSafeHwnd(),WM_USER_ComboBox_END,1,0);
- CListCtrl::OnLButtonDown( nFlags, point) ;
- }
- void CComboBoxListCtrl6::OnLButtonDblClk(UINT nFlags, CPoint point)
- {
- CRect rcCtrl;
- LVHITTESTINFO lvhti;
- lvhti.pt = point;
- int nItem = CListCtrl::SubItemHitTest(&lvhti);
- if(nItem == -1)
- return;
- int nSubItem = lvhti.iSubItem;
- CListCtrl::GetSubItemRect(nItem,nSubItem,LVIR_LABEL,rcCtrl);
- rcCtrl.top -=4;
- if(nSubItem==2 || nSubItem==7)
- {
- rcCtrl.bottom +=200;
- rcCtrl.top +=2;
- ShowComboBox2(TRUE,nItem,nSubItem,rcCtrl);
- }
- else if(nSubItem==8)
- {
- ShowEdit(TRUE,nItem,nSubItem,rcCtrl);
- }
- else if(nSubItem==4)
- {
- rcCtrl.bottom +=200;
- rcCtrl.top +=2;
- ShowComboBox3(TRUE,nItem,nSubItem,rcCtrl);
- }
- else if(nSubItem==5 || nSubItem==6)
- {
- rcCtrl.bottom +=200;
- rcCtrl.top +=2;
- ShowComboBox(TRUE,nItem,nSubItem,rcCtrl);
- }
- else if(nSubItem==3 )
- ShowDateCtrl(TRUE,nItem,nSubItem,rcCtrl);
- CListCtrl::OnLButtonDblClk(nFlags, point);
- }
- void CComboBoxListCtrl6::ShowEdit(BOOL bShow,int nItem,int nIndex,CRect rcCtrl)
- {
- if(m_edit.m_hWnd == NULL)
- {
- m_edit.Create(ES_AUTOHSCROLL|WS_CHILD|ES_LEFT|ES_WANTRETURN|WS_BORDER,CRect(0,0,0,0),this,101);
- m_edit.ShowWindow(SW_HIDE);
- CFont tpFont;
- tpFont.CreateStockObject(DEFAULT_GUI_FONT);
- m_edit.SetFont(&tpFont);
- tpFont.DeleteObject();
- }
- if(bShow == TRUE)
- {
- CString strItem = CListCtrl::GetItemText(nItem,nIndex);
- m_edit.MoveWindow(rcCtrl);
- m_edit.ShowWindow(SW_SHOW);
- m_edit.SetWindowText(strItem);
- ::SetFocus(m_edit.GetSafeHwnd());
- m_edit.SetSel(-1);
- m_edit.SetCtrlData(MAKEWPARAM(nIndex,nItem));
- }
- else
- m_edit.ShowWindow(SW_HIDE);
- }
- void CComboBoxListCtrl6::ShowDateCtrl(BOOL bShow,int nItem,int nIndex,CRect rcCtrl)
- {
- if(m_DateCtrl.m_hWnd == NULL)
- {
- m_DateCtrl.Create(WS_CHILD,CRect(0,0,0,0),this,IDC_ComboBox);
- m_DateCtrl.ShowWindow(SW_HIDE);
- }
- if(bShow == TRUE)
- {
- CString strItem = CListCtrl::GetItemText(nItem,nIndex);
- if(strItem.GetLength ()==10)
- {
- CTime tm(atoi(strItem.Mid (0,4)), atoi(strItem.Mid (5,2)), atoi(strItem.Mid (8,2)), 0,0,0);
- m_DateCtrl.SetTime(&tm);
- }
- else
- {
- CTime tm=CTime::GetCurrentTime ();
- // CTimeSpan dt(3, 0, 0, 0);
- // tm+=dt;
- m_DateCtrl.SetTime(&tm);
- }
- m_DateCtrl.MoveWindow(rcCtrl);
- m_DateCtrl.ShowWindow(SW_SHOW);
- ::SetFocus(m_DateCtrl.GetSafeHwnd());
- m_nSub=nIndex;
- m_nItem=nItem;
- }
- else
- m_DateCtrl.ShowWindow(SW_HIDE);
- }
- void CComboBoxListCtrl6::ShowComboBox2(BOOL bShow,int nItem,int nIndex,CRect rcCtrl)
- {
- if(m_ComboBox.m_hWnd == NULL)
- {
- m_ComboBox.Create(WS_VSCROLL|WS_CHILD|CBS_DROPDOWNLIST,CRect(0,0,0,0),this,IDC_ComboBox);
- m_ComboBox.ShowWindow(SW_HIDE);
- }
- if(bShow == TRUE)
- {
- CString strItem = CListCtrl::GetItemText(nItem,nIndex);
- m_ComboBox.MoveWindow(rcCtrl);
- m_ComboBox.ShowWindow(SW_SHOW);
- ::SetFocus(m_ComboBox.GetSafeHwnd());
- m_ComboBox.ResetContent ();
- if(nIndex==2)
- {
- m_ComboBox.AddString ("¹«Àú");
- m_ComboBox.AddString ("Å©Àú");
- }
- else if(nIndex==7)
- {
- m_ComboBox.AddString ("δ¿ªÊ¼");
- m_ComboBox.AddString ("½øÐÐÖÐ");
- m_ComboBox.AddString ("OK");
- }
- m_ComboBox.SetCurSel (m_ComboBox.FindString (0, strItem));
- m_ComboBox.SetCtrlData(MAKEWPARAM(nIndex,nItem));
- }
- else
- m_ComboBox.ShowWindow(SW_HIDE);
- }
- void CComboBoxListCtrl6::ShowComboBox3(BOOL bShow,int nItem,int nIndex,CRect rcCtrl)
- {
- if(m_ComboBox2.m_hWnd == NULL)
- {
- m_ComboBox2.Create(WS_VSCROLL|WS_CHILD|CBS_DROPDOWN,CRect(0,0,0,0),this,IDC_ComboBox);
- m_ComboBox2.ShowWindow(SW_HIDE);
- m_ComboBox2.AddString ("09:00");
- m_ComboBox2.AddString ("10:00");
- m_ComboBox2.AddString ("11:00");
- m_ComboBox2.AddString ("12:00");
- m_ComboBox2.AddString ("13:00");
- m_ComboBox2.AddString ("14:00");
- m_ComboBox2.AddString ("15:00");
- m_ComboBox2.AddString ("16:00");
- m_ComboBox2.AddString ("17:00");
- m_ComboBox2.AddString ("18:00");
- m_ComboBox2.AddString ("19:00");
- m_ComboBox2.AddString ("20:00");
- m_ComboBox2.AddString ("21:00");
- m_ComboBox2.AddString ("22:00");
- }
- if(bShow == TRUE)
- {
- CString strItem = CListCtrl::GetItemText(nItem,nIndex);
- m_ComboBox2.MoveWindow(rcCtrl);
- m_ComboBox2.ShowWindow(SW_SHOW);
- ::SetFocus(m_ComboBox2.GetSafeHwnd());
- // m_ComboBox2.SetCurSel (m_ComboBox2.FindString (0, strItem));
- m_ComboBox2.SetWindowText ( strItem );
- m_ComboBox2.SetCtrlData(MAKEWPARAM(nIndex,nItem));
- }
- else
- m_ComboBox2.ShowWindow(SW_HIDE);
- }
- void CComboBoxListCtrl6::ShowComboBox(BOOL bShow,int nItem,int nIndex,CRect rcCtrl)
- {
- if(0)//m_pComboBox->m_hWnd == NULL)
- {
- m_pComboBox->Create(WS_VSCROLL|WS_CHILD|CBS_DROPDOWNLIST,CRect(0,0,0,0),this,IDC_ComboBox);
- m_pComboBox->ShowWindow(SW_HIDE);
- for(int i=0; i<g_List1array.GetSize (); i++)
- m_pComboBox->AddString (g_List1array.ElementAt (i).ElementAt (0));
- m_pComboBox->AddString ("");
- }
- if(bShow == TRUE)
- {
- CString strItem = CListCtrl::GetItemText(nItem,nIndex);
- ClientToScreen(rcCtrl);
- GetParent()->ScreenToClient(rcCtrl);
- m_pComboBox->MoveWindow(rcCtrl);
- m_pComboBox->ShowWindow(SW_SHOW);
- m_pComboBox->SetWindowPos(&wndTopMost, 0, 0, 0, 0, SWP_NOSIZE | SWP_NOMOVE);
- ::SetFocus(m_pComboBox->GetSafeHwnd());
- m_pComboBox->ResetContent();
- m_pComboBox->AddString(strItem);
- m_pComboBox->SetCurSel (0);
- m_pComboBox->SetCtrlData(MAKEWPARAM(nIndex,nItem));
- m_pComboBox->RefDroppedWidth();
- }
- else
- m_pComboBox->ShowWindow(SW_HIDE);
- }
- #ifdef VC60
- void CComboBoxListCtrl6::OnEditEnd(WPARAM wParam,LPARAM lParam)
- {
- if(wParam == TRUE)
- {
- CString strText(_T(""));
- m_edit.GetWindowText(strText);
- DWORD dwData = m_edit.GetCtrlData();
- int nItem= dwData>>16;
- int nIndex = dwData&0x0000ffff;
- CListCtrl::SetItemText(nItem,nIndex,strText);
- }
- else
- {
- }
- if(lParam == FALSE)
- m_edit.ShowWindow(SW_HIDE);
- }
- void CComboBoxListCtrl6::OnComboBoxEnd(WPARAM wParam,LPARAM lParam)
- {
- if(m_DateCtrl.m_hWnd)
- {
- if(m_DateCtrl.IsWindowVisible ())
- {
- if(wParam == TRUE)
- {
- CString strText(_T(""));
- CTime tm;
- m_DateCtrl.GetTime(tm);
- strText=tm.Format ("%Y-%m-%d");
- CListCtrl::SetItemText(m_nItem,m_nSub,strText);
- }
- if(lParam == FALSE)
- m_DateCtrl.ShowWindow(SW_HIDE);
- return;
- }
- }
- if(m_ComboBox.m_hWnd)
- {
- if(m_ComboBox.IsWindowVisible ())
- {
- if(wParam == TRUE)
- {
- CString strText(_T(""));
- int pos=m_ComboBox.GetCurSel ();
- if(pos!=-1)
- {
- m_ComboBox.GetLBText (pos, strText);
- DWORD dwData = m_ComboBox.GetCtrlData();
- int nItem= dwData>>16;
- int nIndex = dwData&0x0000ffff;
- CListCtrl::SetItemText(nItem,nIndex,strText);
- }
- }
- else
- {
- }
- if(lParam == FALSE)
- m_ComboBox.ShowWindow(SW_HIDE);
- return;
- }
- }
- if(m_ComboBox2.m_hWnd)
- {
- if(m_ComboBox2.IsWindowVisible ())
- {
- if(wParam == TRUE)
- {
- CString strText(_T(""));
- /* int pos=m_ComboBox2.GetCurSel ();
- if(pos!=-1)
- {
- m_ComboBox2.GetLBText (pos, strText);*/
- m_ComboBox2.GetWindowText ( strText);
- DWORD dwData = m_ComboBox2.GetCtrlData();
- int nItem= dwData>>16;
- int nIndex = dwData&0x0000ffff;
- CListCtrl::SetItemText(nItem,nIndex,strText);
- // }
- }
- else
- {
- }
- if(lParam == FALSE)
- m_ComboBox2.ShowWindow(SW_HIDE);
- return;
- }
- }
- if(m_pComboBox->m_hWnd)
- {
- if(!m_pComboBox->IsWindowVisible ())return;
- if(wParam == TRUE)
- {
- CString strText(_T(""));
- int pos=m_pComboBox->GetCurSel ();
- if(pos!=-1)
- {
- m_pComboBox->GetLBText (pos, strText);
- DWORD dwData = m_pComboBox->GetCtrlData();
- int nItem= dwData>>16;
- int nIndex = dwData&0x0000ffff;
- CListCtrl::SetItemText(nItem,nIndex,strText);
- }
- }
- else
- {
- }
- if(lParam == FALSE)
- m_pComboBox->ShowWindow(SW_HIDE);
- }
- }
- #else
- LRESULT CComboBoxListCtrl6::OnEditEnd(WPARAM wParam,LPARAM lParam)
- {
- if(wParam == TRUE)
- {
- CString strText(_T(""));
- m_edit.GetWindowText(strText);
- DWORD dwData = m_edit.GetCtrlData();
- int nItem= dwData>>16;
- int nIndex = dwData&0x0000ffff;
- CListCtrl::SetItemText(nItem,nIndex,strText);
- }
- else
- {
- }
- if(lParam == FALSE)
- m_edit.ShowWindow(SW_HIDE);
- return 0;
- }
- LRESULT CComboBoxListCtrl6::OnComboBoxEnd(WPARAM wParam,LPARAM lParam)
- {
- if(m_DateCtrl.m_hWnd)
- {
- if(m_DateCtrl.IsWindowVisible ())
- {
- if(wParam == TRUE)
- {
- CString strText(_T(""));
- CTime tm;
- m_DateCtrl.GetTime(tm);
- strText=tm.Format ("%Y-%m-%d");
- CListCtrl::SetItemText(m_nItem,m_nSub,strText);
- }
- if(lParam == FALSE)
- m_DateCtrl.ShowWindow(SW_HIDE);
- return 0;
- }
- }
- if(m_ComboBox.m_hWnd)
- {
- if(m_ComboBox.IsWindowVisible ())
- {
- if(wParam == TRUE)
- {
- CString strText(_T(""));
- int pos=m_ComboBox.GetCurSel ();
- if(pos!=-1)
- {
- m_ComboBox.GetLBText (pos, strText);
- DWORD dwData = m_ComboBox.GetCtrlData();
- int nItem= dwData>>16;
- int nIndex = dwData&0x0000ffff;
- CListCtrl::SetItemText(nItem,nIndex,strText);
- }
- }
- else
- {
- }
- if(lParam == FALSE)
- m_ComboBox.ShowWindow(SW_HIDE);
- return 0;
- }
- }
- if(m_ComboBox2.m_hWnd)
- {
- if(m_ComboBox2.IsWindowVisible ())
- {
- if(wParam == TRUE)
- {
- CString strText(_T(""));
- /* int pos=m_ComboBox2.GetCurSel ();
- if(pos!=-1)
- {
- m_ComboBox2.GetLBText (pos, strText);*/
- m_ComboBox2.GetWindowText ( strText);
- DWORD dwData = m_ComboBox2.GetCtrlData();
- int nItem= dwData>>16;
- int nIndex = dwData&0x0000ffff;
- CListCtrl::SetItemText(nItem,nIndex,strText);
- // }
- }
- else
- {
- }
- if(lParam == FALSE)
- m_ComboBox2.ShowWindow(SW_HIDE);
- return 0;
- }
- }
- if(m_pComboBox->m_hWnd)
- {
- if(!m_pComboBox->IsWindowVisible ())return 0;
- if(wParam == TRUE)
- {
- CString strText(_T(""));
- int pos=m_pComboBox->GetCurSel ();
- if(pos!=-1)
- {
- m_pComboBox->GetLBText (pos, strText);
- DWORD dwData = m_pComboBox->GetCtrlData();
- int nItem= dwData>>16;
- int nIndex = dwData&0x0000ffff;
- CListCtrl::SetItemText(nItem,nIndex,strText);
- }
- }
- else
- {
- }
- if(lParam == FALSE)
- m_pComboBox->ShowWindow(SW_HIDE);
- }
- return 0;
- }
- #endif
- void CComboBoxListCtrl6::OnParentNotify(UINT message, LPARAM lParam)
- {
- CListCtrl::OnParentNotify(message, lParam);
- //////////////////////////////////////////////////////////////////////////
- CHeaderCtrl* pHeaderCtrl = CListCtrl::GetHeaderCtrl();
- if(pHeaderCtrl == NULL)
- return;
- CRect rcHeader;
- pHeaderCtrl->GetWindowRect(rcHeader);
- ScreenToClient(rcHeader);
- //The x coordinate is in the low-order word and the y coordinate is in the high-order word.
- CPoint pt;
- pt.x = GET_X_LPARAM(lParam);
- pt.y = GET_Y_LPARAM(lParam);
- if(rcHeader.PtInRect(pt) && message == WM_LBUTTONDOWN)
- {
- if(m_pComboBox->m_hWnd != NULL)
- {
- DWORD dwStyle = m_pComboBox->GetStyle();
- if((dwStyle&WS_VISIBLE) == WS_VISIBLE)
- {
- m_pComboBox->ShowWindow(SW_HIDE);
- }
- }
- if(m_DateCtrl.m_hWnd)
- {
- if(m_DateCtrl.IsWindowVisible ())m_DateCtrl.ShowWindow(SW_HIDE);
- }
- }
- }
- BOOL CComboBoxListCtrl6::PreTranslateMessage(MSG* pMsg)
- {
- /* if(pMsg->message == WM_LBUTTONUP)
- {
- if(m_DateCtrl.m_hWnd)
- {
- if(m_DateCtrl.IsWindowVisible ())
- {
- ::PostMessage(this->GetSafeHwnd(),WM_USER_ComboBox_END,1,0);
- m_DateCtrl.ShowWindow(SW_HIDE);
- }
- }
- }*/
- return CListCtrl::PreTranslateMessage(pMsg);
- }
- BOOL CComboBoxListCtrl6::Key_Shift(int& nItem,int& nSub)
- {
- int nItemCount = CListCtrl::GetItemCount();
- DWORD dwData = m_pComboBox->GetCtrlData();
- nItem= dwData>>16;
- nSub = dwData&0x0000ffff;
- CHeaderCtrl* pHeader = CListCtrl::GetHeaderCtrl();
- if(pHeader == NULL)
- return FALSE;
- short sRet = GetKeyState(VK_SHIFT);
- int nSubcCount = pHeader->GetItemCount();
- sRet = sRet >>15;
- if(sRet == 0)
- {
- nSub += 1;
- if(nSub >= nSubcCount)
- {
- if(nItem == nItemCount-1)
- {
- nItem = 0;
- nSub = 0;
- }
- else
- {
- nSub = 0;
- nItem += 1;
- }
- }
- if(nItem >= nItemCount)
- nItem = nItemCount-1;
- return FALSE;
- }
- else
- {
- nSub -= 1;
- if(nSub < 0)
- {
- nSub = nSubcCount -1;
- nItem --;
- }
- if(nItem < 0)
- nItem = nItemCount-1;
- return TRUE;
- }
- return FALSE;
- }
- BOOL CComboBoxListCtrl6::Key_Ctrl(int& nItem,int &nSub)
- {
- short sRet = GetKeyState(VK_CONTROL);
- DWORD dwData = m_pComboBox->GetCtrlData();
- nItem= dwData>>16;
- nSub = dwData&0x0000ffff;
- sRet = sRet >>15;
- int nItemCount = CListCtrl::GetItemCount();
- if(sRet == 0)
- {
- }
- else
- {
- nItem = nItem >=nItemCount-1? 0:nItem+=1;
- return TRUE;
- }
- return FALSE;
- }
- void CComboBoxListCtrl6::InitStyle()
- {
- SetFont (&g_listctrlfont);
- SetExtendedStyle(LVS_EX_FLATSB|LVS_EX_FULLROWSELECT|LVS_EX_GRIDLINES|LVS_EX_HEADERDRAGDROP);
- }
- #undef SubclassWindow
- void CComboBoxListCtrl6::PreSubclassWindow()
- {
- // the list control must have the report style.
- CListCtrl::PreSubclassWindow();
- m_ctlHeader.SubclassWindow ( GetHeaderCtrl()->GetSafeHwnd());
- }
|