Main Page Modules Namespace List Class Hierarchy Alphabetical List Compound List File List Namespace Members Compound Members File Members Related Pages

# XComboList.h

Go to the documentation of this file.

    00001 // XComboList.h
    00002 //
    00003 // Author:  Hans Dietrich
    00004 //          hdietrich2@hotmail.com
    00005 //
    00006 // This software is released into the public domain.
    00007 // You are free to use it in any way you like.
    00008 //
    00009 // This software is provided "as is" with no expressed
    00010 // or implied warranty.  I accept no liability for any
    00011 // damage or loss of business that this software may cause.
    00012 //
    00013 ///////////////////////////////////////////////////////////////////////////////
    00014
    00015 #ifndef XCOMBOLIST_H
    00016 #define XCOMBOLIST_H
    00017
    00018 extern UINT NEAR WM_XCOMBOLIST_VK_RETURN;
    00019 extern UINT NEAR WM_XCOMBOLIST_VK_ESCAPE;
    00020 extern UINT NEAR WM_XCOMBOLIST_KEYDOWN;
    00021 extern UINT NEAR WM_XCOMBOLIST_LBUTTONUP;
    00022
    00023 /////////////////////////////////////////////////////////////////////////////
    00024 // CXComboList window
    00025
    00026 class CXComboList : public CWnd
    00027 {
    00028 // Construction
    00029 public:
    00030     CXComboList(CWnd *pParent);
    00031     virtual ~CXComboList();
    00032
    00033 // Attributes
    00034 public:
    00035
    00036 // Operations
    00037 public:
    00038     void SetActive(int nScrollBarWidth);
    00039
    00040     int AddString(LPCTSTR lpszItem)
    00041     {
    00042         return m_ListBox.AddString(lpszItem);
    00043     }
    00044     int GetCount()
    00045     {
    00046         return m_ListBox.GetCount();
    00047     }
    00048     void GetText(int nIndex, CString& rString)
    00049     {
    00050         m_ListBox.GetText(nIndex, rString);
    00051     }
    00052     int FindStringExact(int nIndexStart, LPCTSTR lpszFind)
    00053     {
    00054         return m_ListBox.FindStringExact(nIndexStart, lpszFind);
    00055     }
    00056     int SetCurSel(int nSelect)
    00057     {
    00058         return m_ListBox.SetCurSel(nSelect);
    00059     }
    00060     int GetCurSel()
    00061     {
    00062         return m_ListBox.GetCurSel();
    00063     }
    00064     void SetFont(CFont* pFont, BOOL bRedraw = TRUE)
    00065     {
    00066         m_ListBox.SetFont(pFont, bRedraw);
    00067     }
    00068
    00069 // Overrides
    00070     // ClassWizard generated virtual function overrides
    00071     //{{AFX_VIRTUAL(CXComboList)
    00072 public:
    00073     virtual BOOL PreTranslateMessage(MSG* pMsg);
    00074     virtual CScrollBar* GetScrollBarCtrl(int nBar);
    00075     //}}AFX_VIRTUAL
    00076
    00077 // Implementation
    00078 protected:
    00079     CListBox    m_ListBox;
    00080     CScrollBar  m_wndSBVert;
    00081     CWnd *      m_pParent;
    00082     int         m_nCount;
    00083     BOOL        m_bFirstTime;
    00084
    00085     void SendRegisteredMessage(UINT nMsg, WPARAM wParam, LPARAM lParam);
    00086
    00087     // Generated message map functions
    00088 protected:
    00089     //{{AFX_MSG(CXComboList)
    00090     afx_msg void OnLButtonDown(UINT nFlags, CPoint point);
    00091     afx_msg void OnKillFocus(CWnd* pNewWnd);
    00092     afx_msg int OnCreate(LPCREATESTRUCT lpCreateStruct);
    00093     afx_msg void OnVScroll(UINT nSBCode, UINT nPos, CScrollBar* pScrollBar);
    00094     afx_msg void OnDestroy();
    00095     afx_msg void OnTimer(UINT nIDEvent);
    00096     //}}AFX_MSG
    00097
    00098     DECLARE_MESSAGE_MAP()
    00099 };
    00100
    00101 /////////////////////////////////////////////////////////////////////////////
    00102
    00103 //{{AFX_INSERT_LOCATION}}
    00104 // Microsoft Visual C++ will insert additional declarations immediately before the previous line.
    00105
    00106 #endif //XCOMBOLIST_H