--- /dev/null
+// Win32++ Version 7.3\r
+// Released: 30th November 2011\r
+//\r
+// David Nash\r
+// url: https://sourceforge.net/projects/win32-framework\r
+//\r
+//\r
+// Copyright (c) 2005-2011 David Nash\r
+//\r
+// Permission is hereby granted, free of charge, to\r
+// any person obtaining a copy of this software and\r
+// associated documentation files (the "Software"),\r
+// to deal in the Software without restriction, including\r
+// without limitation the rights to use, copy, modify,\r
+// merge, publish, distribute, sublicense, and/or sell\r
+// copies of the Software, and to permit persons to whom\r
+// the Software is furnished to do so, subject to the\r
+// following conditions:\r
+//\r
+// The above copyright notice and this permission notice\r
+// shall be included in all copies or substantial portions\r
+// of the Software.\r
+//\r
+// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF\r
+// ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED\r
+// TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A\r
+// PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT\r
+// SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR\r
+// ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN\r
+// ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,\r
+// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE\r
+// OR OTHER DEALINGS IN THE SOFTWARE.\r
+//\r
+////////////////////////////////////////////////////////\r
+\r
+\r
+////////////////////////////////////////////////////////\r
+// controls.h\r
+// Declaration of the following classes:\r
+// CAnimation, CComboBox, CComboBoxEx, CDateTime, CIPAddress,\r
+// CHeader, CHotKey, CMonthCalendar, CProgressBar, CScrollBar,\r
+// CSlider, CSpinButton, and CToolTip.\r
+\r
+\r
+#ifndef _WIN32XX_CONTROLS_H_\r
+#define _WIN32XX_CONTROLS_H_\r
+\r
+#include "wincore.h"\r
+#include "stdcontrols.h"\r
+\r
+namespace Win32xx\r
+{\r
+\r
+ // Forward declarations\r
+ class CMonthCalendar;\r
+ class CToolTip;\r
+\r
+ class CAnimation : public CWnd\r
+ {\r
+ public:\r
+ CAnimation() {}\r
+ virtual ~CAnimation() {}\r
+\r
+ BOOL Close() const;\r
+ BOOL Open(LPTSTR lpszName) const;\r
+ BOOL Play(UINT wFrom, UINT wTo, UINT cRepeat) const;\r
+ BOOL Seek(UINT wFrame) const;\r
+ BOOL Stop() const;\r
+\r
+ protected:\r
+ // Overridables\r
+ virtual void PreRegisterClass(WNDCLASS &wc) { wc.lpszClassName = ANIMATE_CLASS; }\r
+ };\r
+\r
+\r
+ class CComboBox : public CWnd\r
+ {\r
+ public:\r
+ CComboBox() {}\r
+ virtual ~CComboBox() { ::InitCommonControls(); }\r
+\r
+ int AddString(LPCTSTR lpszString) const;\r
+ void Clear() const;\r
+ void Copy() const;\r
+ void Cut() const;\r
+ int DeleteString(int nIndex) const;\r
+ int Dir(UINT attr, LPCTSTR lpszWildCard ) const;\r
+ int FindString(int nIndexStart, LPCTSTR lpszString) const;\r
+ int FindStringExact(int nIndexStart, LPCTSTR lpszString) const;\r
+ int GetCount() const;\r
+ int GetCurSel() const;\r
+ CRect GetDroppedControlRect() const;\r
+ BOOL GetDroppedState() const;\r
+ int GetDroppedWidth() const;\r
+ DWORD GetEditSel() const;\r
+ BOOL GetExtendedUI() const;\r
+ int GetHorizontalExtent() const;\r
+ DWORD GetItemData(int nIndex) const;\r
+ int GetItemHeight(int nIndex) const;\r
+ int GetLBText(int nIndex, LPTSTR lpszText) const;\r
+ int GetLBTextLen(int nIndex) const;\r
+ LCID GetLocale() const;\r
+ int GetTopIndex() const;\r
+ int InitStorage(int nItems, int nBytes) const;\r
+ int InsertString(int nIndex, LPCTSTR lpszString) const;\r
+ void LimitText(int nMaxChars) const;\r
+ void Paste() const;\r
+ void ResetContent() const;\r
+ int SelectString(int nStartAfter, LPCTSTR lpszString) const;\r
+ int SetCurSel(int nIndex) const;\r
+ int SetDroppedWidth(int nWidth) const;\r
+ BOOL SetEditSel(int nStartChar, int nEndChar) const;\r
+ int SetExtendedUI(BOOL bExtended = TRUE) const;\r
+ void SetHorizontalExtent(UINT nExtent ) const;\r
+ int SetItemData(int nIndex, DWORD dwItemData) const;\r
+ int SetItemHeight(int nIndex, UINT cyItemHeight) const;\r
+ LCID SetLocale( LCID NewLocale ) const;\r
+ int SetTopIndex(int nIndex) const;\r
+ void ShowDropDown(BOOL bShow = TRUE) const;\r
+\r
+ protected:\r
+ // Overridables\r
+ virtual void PreRegisterClass(WNDCLASS &wc) { wc.lpszClassName = _T("ComboBox"); }\r
+ };\r
+\r
+\r
+ class CComboBoxEx : public CComboBox\r
+ {\r
+ public:\r
+ CComboBoxEx() \r
+ {\r
+ INITCOMMONCONTROLSEX icce;\r
+ icce.dwSize = sizeof(INITCOMMONCONTROLSEX);\r
+ icce.dwICC = ICC_USEREX_CLASSES;\r
+ ::InitCommonControlsEx(&icce); \r
+ }\r
+ virtual ~CComboBoxEx() {}\r
+\r
+ int DeleteItem(int nIndex ) const;\r
+ CWnd* GetComboBoxCtrl() const;\r
+ CEdit* GetEditCtrl() const;\r
+ DWORD GetExtendedStyle() const;\r
+ HIMAGELIST GetImageList() const;\r
+ BOOL GetItem(COMBOBOXEXITEM* pCBItem) const;\r
+ BOOL HasEditChanged () const;\r
+ int InsertItem(COMBOBOXEXITEM* lpcCBItem) const;\r
+ DWORD SetExtendedStyle(DWORD dwExMask, DWORD dwExStyles ) const;\r
+ HIMAGELIST SetImageList(HIMAGELIST himl) const;\r
+ BOOL SetItem(PCOMBOBOXEXITEM lpcCBItem) const;\r
+\r
+ protected:\r
+ // Overridables\r
+ virtual void PreRegisterClass(WNDCLASS &wc) { wc.lpszClassName = WC_COMBOBOXEX; }\r
+ };\r
+\r
+\r
+ class CDateTime : public CWnd\r
+ {\r
+ public:\r
+ CDateTime()\r
+ {\r
+ INITCOMMONCONTROLSEX icce;\r
+ icce.dwSize = sizeof(INITCOMMONCONTROLSEX);\r
+ icce.dwICC = ICC_DATE_CLASSES;\r
+ ::InitCommonControlsEx(&icce);\r
+ }\r
+ virtual ~CDateTime() {}\r
+\r
+ COLORREF GetMonthCalColor(int iColor) const;\r
+ COLORREF SetMonthCalColor(int iColor, COLORREF ref);\r
+ BOOL SetFormat(LPCTSTR pstrFormat);\r
+ CMonthCalendar* GetMonthCalCtrl() const;\r
+ CFont* GetMonthCalFont() const;\r
+ void SetMonthCalFont(HFONT hFont, BOOL bRedraw = TRUE);\r
+ DWORD GetRange(LPSYSTEMTIME lpSysTimeArray) const;\r
+ BOOL SetRange(DWORD flags, LPSYSTEMTIME lpSysTimeArray);\r
+ DWORD GetTime(LPSYSTEMTIME pTimeDest) const;\r
+ BOOL SetTime(DWORD flag, LPSYSTEMTIME pTimeNew = NULL);\r
+\r
+ protected:\r
+ // Overridables\r
+ virtual void PreRegisterClass(WNDCLASS &wc) { wc.lpszClassName = DATETIMEPICK_CLASS; }\r
+ };\r
+\r
+ class CHeader : public CWnd\r
+ {\r
+ public:\r
+ CHeader()\r
+ {\r
+ INITCOMMONCONTROLSEX icex;\r
+ icex.dwSize = sizeof(INITCOMMONCONTROLSEX);\r
+ icex.dwICC = ICC_WIN95_CLASSES;\r
+ ::InitCommonControlsEx(&icex);\r
+ }\r
+ virtual ~CHeader() {}\r
+\r
+ // Attributes\r
+ HIMAGELIST GetImageList() const;\r
+ BOOL GetItem(int nPos, HDITEM* pHeaderItem) const;\r
+ int GetItemCount() const;\r
+ CRect GetItemRect(int nIndex) const;\r
+ BOOL GetOrderArray(LPINT piArray, int iCount);\r
+ int OrderToIndex(int nOrder) const;\r
+ HIMAGELIST SetImageList(HIMAGELIST himl);\r
+ BOOL SetItem(int nPos, HDITEM* pHeaderItem);\r
+ BOOL SetOrderArray(int iCount, LPINT piArray);\r
+ int GetBitmapMargin() const;\r
+ int SetBitmapMargin(int nWidth);\r
+\r
+ // Operations\r
+ HIMAGELIST CreateDragImage(int nIndex);\r
+ BOOL DeleteItem(int nPos);\r
+ int InsertItem(int nPos, HDITEM* phdi);\r
+ BOOL Layout(HDLAYOUT* pHeaderLayout);\r
+#ifdef Header_SetHotDivider\r
+ int SetHotDivider(CPoint pt);\r
+ int SetHotDivider(int nIndex);\r
+#endif\r
+#ifdef Header_ClearFilter\r
+ int ClearAllFilters();\r
+ int ClearFilter(int nColumn);\r
+ int EditFilter(int nColumn, BOOL bDiscardChanges);\r
+ int SetFilterChangeTimeout(DWORD dwTimeOut);\r
+#endif\r
+\r
+ protected:\r
+ // Overridables\r
+ virtual void PreRegisterClass(WNDCLASS &wc) { wc.lpszClassName = WC_HEADER ; }\r
+ };\r
+\r
+ class CHotKey : public CWnd\r
+ {\r
+ public:\r
+ CHotKey() { ::InitCommonControls(); }\r
+ virtual ~CHotKey() {}\r
+\r
+ DWORD GetHotKey() const;\r
+ CString GetKeyName(UINT vk, BOOL fExtended) const;\r
+ void SetHotKey(DWORD dwKey);\r
+ void SetRules(WORD wInvalidComb, WORD wModifiers);\r
+\r
+ protected:\r
+ // Overridables\r
+ virtual void PreRegisterClass(WNDCLASS &wc) { wc.lpszClassName = HOTKEY_CLASS; }\r
+ };\r
+\r
+ class CIPAddress : public CWnd\r
+ {\r
+ public:\r
+ CIPAddress()\r
+ {\r
+ INITCOMMONCONTROLSEX icex;\r
+ icex.dwSize = sizeof(INITCOMMONCONTROLSEX);\r
+ icex.dwICC = ICC_INTERNET_CLASSES;\r
+ ::InitCommonControlsEx(&icex);\r
+ }\r
+ virtual ~CIPAddress() {}\r
+\r
+ void ClearAddress();\r
+ int GetAddress(BYTE& nField0, BYTE& nField1, BYTE& nField2, BYTE& nField3);\r
+ int GetAddress(DWORD* dwAddress);\r
+ BOOL IsBlank() const;\r
+ void SetAddress(BYTE nField0, BYTE nField1, BYTE nField2, BYTE nField3);\r
+ void SetAddress(DWORD dwAddress);\r
+ void SetFieldFocus(WORD nField);\r
+ void SetFieldRange(int nField, BYTE nLower, BYTE nUpper);\r
+\r
+ protected:\r
+ // Overridables\r
+ virtual void PreRegisterClass(WNDCLASS &wc) { wc.lpszClassName = WC_IPADDRESS; }\r
+\r
+ };\r
+\r
+ class CMonthCalendar : public CWnd\r
+ {\r
+ public:\r
+ CMonthCalendar()\r
+ {\r
+ INITCOMMONCONTROLSEX icex;\r
+ icex.dwSize = sizeof(icex);\r
+ icex.dwICC = ICC_DATE_CLASSES;\r
+ InitCommonControlsEx(&icex);\r
+ }\r
+ virtual ~CMonthCalendar() {}\r
+\r
+ // Attributes\r
+ COLORREF GetColor(int nRegion) const;\r
+ int GetFirstDayOfWeek(BOOL* pbLocal = NULL) const;\r
+ CRect GetMinReqRect() const;\r
+ int GetMonthDelta() const;\r
+ COLORREF SetColor(int nRegion, COLORREF ref);\r
+ BOOL SetFirstDayOfWeek(int iDay, int* lpnOld = NULL);\r
+ int SetMonthDelta(int iDelta);\r
+\r
+ // Operations\r
+ BOOL GetCurSel(LPSYSTEMTIME pDateTime) const;\r
+ int GetMaxSelCount() const;\r
+ int GetMonthRange(LPSYSTEMTIME pMinRange, LPSYSTEMTIME pMaxRange, DWORD dwFlags) const;\r
+ DWORD GetRange(LPSYSTEMTIME pMinRange, LPSYSTEMTIME pMaxRange) const;\r
+ BOOL GetSelRange(LPSYSTEMTIME pMinRange, LPSYSTEMTIME pMaxRange) const;\r
+ BOOL GetToday(LPSYSTEMTIME pDateTime) const;\r
+ DWORD HitTest(PMCHITTESTINFO pMCHitTest);\r
+ BOOL SetCurSel(const LPSYSTEMTIME pDateTime);\r
+ BOOL SetDayState(int nMonths, LPMONTHDAYSTATE pStates);\r
+ BOOL SetMaxSelCount(int nMax);\r
+ BOOL SetRange(const LPSYSTEMTIME pMinRange, const LPSYSTEMTIME pMaxRange);\r
+ BOOL SetSelRange(const LPSYSTEMTIME pMinRange, const LPSYSTEMTIME pMaxRange);\r
+ void SetToday(const LPSYSTEMTIME pDateTime);\r
+\r
+ protected:\r
+ // Overridables\r
+ virtual void PreRegisterClass(WNDCLASS &wc) { wc.lpszClassName = MONTHCAL_CLASS; }\r
+ };\r
+\r
+ class CProgressBar : public CWnd\r
+ {\r
+ public:\r
+ CProgressBar() { ::InitCommonControls(); }\r
+ virtual ~CProgressBar() {}\r
+\r
+ int GetPos() const;\r
+ int GetRange(BOOL fWhichLimit, PPBRANGE ppBRange) const;\r
+ int OffsetPos(int nIncrement) const;\r
+ int SetPos(int nNewPos) const;\r
+ int SetRange(short nMinRange, short nMaxRange) const;\r
+ int SetStep(int nStepInc) const;\r
+ int StepIt() const;\r
+\r
+ protected:\r
+ // Overridables\r
+ virtual void PreRegisterClass(WNDCLASS &wc) { wc.lpszClassName = PROGRESS_CLASS; }\r
+ };\r
+\r
+ class CScrollBar : public CWnd\r
+ {\r
+ public:\r
+ CScrollBar() {}\r
+ virtual ~CScrollBar() {}\r
+\r
+ BOOL EnableScrollBar( UINT nArrowFlags = ESB_ENABLE_BOTH ) const;\r
+ BOOL GetScrollInfo(LPSCROLLINFO lpsi) const;\r
+ int GetScrollPos() const;\r
+ BOOL GetScrollRange(LPINT lpMinPos, LPINT lpMaxPos ) const;\r
+ BOOL SetScrollInfo(LPSCROLLINFO lpsi, BOOL bRedraw = TRUE ) const;\r
+ int SetScrollPos(int nPos, BOOL bRedraw) const;\r
+ BOOL SetScrollRange( int nMinPos, int nMaxPos, BOOL bRedraw = TRUE ) const;\r
+ BOOL ShowScrollBar(BOOL bShow) const;\r
+\r
+ protected:\r
+ // Overridables\r
+ virtual void PreRegisterClass(WNDCLASS &wc) { wc.lpszClassName = _T("SCROLLBAR"); ; }\r
+ };\r
+\r
+ class CSlider : public CWnd\r
+ {\r
+ public:\r
+ CSlider() { ::InitCommonControls(); }\r
+ virtual ~CSlider() {}\r
+\r
+ void ClearSel() const;\r
+ void ClearTics(BOOL bRedraw = FALSE ) const;\r
+ CWnd* GetBuddy(BOOL fLocation = TRUE ) const;\r
+ CRect GetChannelRect() const;\r
+ int GetLineSize() const;\r
+ int GetNumTics() const;\r
+ int GetPageSize() const;\r
+ int GetPos() const;\r
+ int GetRangeMax() const;\r
+ int GetRangeMin() const;\r
+ int GetSelEnd() const;\r
+ int GetSelStart() const;\r
+ int GetThumbLength() const;\r
+ CRect GetThumbRect() const;\r
+ int GetTic(int nTic ) const;\r
+ int GetTicPos(int nTic) const;\r
+ CToolTip* GetToolTips() const;\r
+ CWnd* SetBuddy(CWnd* pBuddy, BOOL fLocation = TRUE ) const;\r
+ int SetLineSize(int nSize) const;\r
+ int SetPageSize(int nSize) const;\r
+ void SetPos(int nPos, BOOL bRedraw = FALSE) const;\r
+ void SetRangeMax(int nMax, BOOL bRedraw = FALSE) const;\r
+ void SetRangeMin(int nMax, BOOL bRedraw = FALSE) const;\r
+ void SetSelection(int nMin, int nMax, BOOL bRedraw = FALSE) const;\r
+ BOOL SetTic(int nTic) const;\r
+ void SetTicFreq(int nFreq) const;\r
+ int SetTipSide(int nLocation) const;\r
+ void SetToolTips(CToolTip* pToolTip) const;\r
+\r
+ protected:\r
+ // Overridables\r
+ virtual void PreRegisterClass(WNDCLASS &wc) { wc.lpszClassName = TRACKBAR_CLASS; }\r
+ };\r
+\r
+\r
+ // Also known as an Up/Down control\r
+ class CSpinButton : public CWnd\r
+ {\r
+ public:\r
+ CSpinButton() { ::InitCommonControls(); }\r
+ virtual ~CSpinButton() {}\r
+\r
+ int GetAccel(int cAccels, LPUDACCEL paAccels) const;\r
+ int GetBase() const;\r
+ CWnd* GetBuddy() const;\r
+ int GetPos() const;\r
+ DWORD GetRange() const;\r
+ BOOL SetAccel(int cAccels, LPUDACCEL paAccels) const;\r
+ int SetBase(int nBase) const;\r
+ CWnd* SetBuddy(CWnd* hwndBuddy) const;\r
+ int SetPos(int nPos) const;\r
+ void SetRange(int nLower, int nUpper) const;\r
+\r
+ protected:\r
+ // Overridables\r
+ virtual void PreCreate(CREATESTRUCT &cs);\r
+ virtual void PreRegisterClass(WNDCLASS &wc);\r
+ };\r
+\r
+ class CToolTip : public CWnd\r
+ {\r
+ public:\r
+ CToolTip();\r
+ virtual ~CToolTip();\r
+\r
+ //Attributes\r
+ int GetDelayTime(DWORD dwDuration) const;\r
+ void GetMargin(LPRECT lprc) const;\r
+ int GetMaxTipWidth() const;\r
+ void GetText(CString& str, CWnd* pWnd, UINT_PTR nIDTool = 0) const;\r
+ COLORREF GetTipBkColor() const;\r
+ COLORREF GetTipTextColor() const;\r
+ int GetToolCount() const;\r
+ BOOL GetToolInfo(TOOLINFO& ToolInfo, CWnd* pWnd, UINT_PTR nIDTool = 0) const;\r
+ void SetDelayTime(UINT nDelay);\r
+ void SetDelayTime(DWORD dwDuration, int iTime);\r
+ void SetMargin(LPRECT lprc);\r
+ int SetMaxTipWidth(int iWidth);\r
+ void SetTipBkColor(COLORREF clr);\r
+ void SetTipTextColor(COLORREF clr);\r
+ void SetToolInfo(LPTOOLINFO lpToolInfo);\r
+#if (defined TTM_SETTITLE) && (_WIN32_IE >=0x0500)\r
+ CSize GetBubbleSize(LPTOOLINFO lpToolInfo) const;\r
+#endif\r
+\r
+ //Operations\r
+ void Activate(BOOL bActivate);\r
+ BOOL AddTool(CWnd* pWnd, UINT nIDText, LPCRECT lpRectTool = NULL, UINT_PTR nIDTool = 0);\r
+ BOOL AddTool(CWnd* pWnd, LPCTSTR lpszText = LPSTR_TEXTCALLBACK, LPCRECT lpRectTool = NULL, UINT_PTR nIDTool = 0);\r
+ void DelTool(CWnd* pWnd, UINT_PTR nIDTool = 0);\r
+ BOOL HitTest(CWnd* pWnd, CPoint pt, LPTOOLINFO lpToolInfo) const;\r
+ void Pop();\r
+ void RelayEvent(LPMSG lpMsg);\r
+\r
+ void SetToolRect(CWnd* pWnd, UINT_PTR nIDTool, LPCRECT lpRect);\r
+ void Update();\r
+ void UpdateTipText(LPCTSTR lpszText, CWnd* pWnd, UINT_PTR nIDTool = 0);\r
+ void UpdateTipText(UINT nIDText, CWnd* pWnd, UINT_PTR nIDTool = 0);\r
+\r
+#if (defined TTM_SETTITLE) && (_WIN32_IE >=0x0500)\r
+ BOOL AdjustRect(LPRECT lprc, BOOL bLarger = TRUE);\r
+ BOOL SetTitle(UINT uIcon, LPCTSTR lpstrTitle);\r
+#endif\r
+#if (defined TTM_SETWINDOWTHEME) && (WINVER >= 0x0501)\r
+ HRESULT SetWindowTheme(LPCWSTR lpstrTheme);\r
+#endif\r
+\r
+ protected:\r
+ // Overridables\r
+ virtual void PreRegisterClass(WNDCLASS &wc) { wc.lpszClassName = TOOLTIPS_CLASS; ; }\r
+ virtual void PreCreate(CREATESTRUCT &cs) \r
+ { \r
+ cs.dwExStyle = WS_EX_TOOLWINDOW; \r
+ cs.style = WS_POPUP | TTS_NOPREFIX | TTS_ALWAYSTIP;\r
+ }\r
+\r
+ private:\r
+ void LoadToolInfo(TOOLINFO& ti, CWnd* pWnd, UINT_PTR nIDTool) const;\r
+ };\r
+\r
+\r
+} // namespace Win32xx\r
+\r
+//~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~\r
+\r
+namespace Win32xx\r
+{\r
+\r
+ ////////////////////////////////////////\r
+ // Definitions for the CAnimation class\r
+ //\r
+ inline BOOL CAnimation::Close() const\r
+ // Closes an AVI clip.\r
+ {\r
+ assert(IsWindow());\r
+ return Animate_Close(m_hWnd);\r
+ }\r
+\r
+ inline BOOL CAnimation::Open(LPTSTR lpszName) const\r
+ // Opens an AVI clip and displays its first frame in an animation control.\r
+ {\r
+ assert(IsWindow());\r
+ return Animate_Open(m_hWnd, lpszName);\r
+ }\r
+\r
+ inline BOOL CAnimation::Play(UINT wFrom, UINT wTo, UINT cRepeat) const\r
+ // Plays an AVI clip in an animation control. The control plays the clip\r
+ // in the background while the thread continues executing.\r
+ {\r
+ assert(IsWindow());\r
+ return Animate_Play(m_hWnd, wFrom, wTo, cRepeat);\r
+ }\r
+\r
+ inline BOOL CAnimation::Seek(UINT wFrame) const\r
+ // Directs an animation control to display a particular frame of an AVI clip.\r
+ // The control displays the clip in the background while the thread continues executing.\r
+ {\r
+ assert(IsWindow());\r
+ return Animate_Seek(m_hWnd, wFrame);\r
+ }\r
+\r
+ inline BOOL CAnimation::Stop() const\r
+ // Stops playing an AVI clip in an animation control.\r
+ {\r
+ assert(IsWindow());\r
+ return Animate_Stop(m_hWnd);\r
+ }\r
+\r
+\r
+ ////////////////////////////////////////\r
+ // Definitions for the CComboBox class\r
+ //\r
+ inline int CComboBox::AddString(LPCTSTR lpszString) const\r
+ // Adds a string to the list box of a combo box. If the combo box does not\r
+ // have the CBS_SORT style, the string is added to the end of the list.\r
+ // Otherwise, the string is inserted into the list, and the list is sorted.\r
+ {\r
+ assert(IsWindow());\r
+ return (int)SendMessage(CB_ADDSTRING, 0, (LPARAM)lpszString);\r
+ }\r
+\r
+ inline void CComboBox::Clear() const\r
+ // Deletes the current selection, if any, from the combo box's edit control.\r
+ {\r
+ assert(IsWindow());\r
+ SendMessage(WM_CLEAR, 0, 0);\r
+ }\r
+\r
+ inline void CComboBox::Copy() const\r
+ // Copies the current selection to the clipboard in CF_TEXT format.\r
+ {\r
+ assert(IsWindow());\r
+ SendMessage(WM_COPY, 0, 0);\r
+ }\r
+\r
+ inline void CComboBox::Cut() const\r
+ // Deletes the current selection, if any, in the edit control and copies\r
+ // the deleted text to the clipboard in CF_TEXT format.\r
+ {\r
+ assert(IsWindow());\r
+ SendMessage(WM_CUT, 0, 0);\r
+ }\r
+\r
+ inline int CComboBox::DeleteString(int nIndex) const\r
+ // Deletes a string in the list box of a combo box.\r
+ {\r
+ assert(IsWindow());\r
+ return (int)SendMessage(CB_DELETESTRING, (WPARAM)nIndex, 0);\r
+ }\r
+\r
+ inline int CComboBox::Dir(UINT attr, LPCTSTR lpszWildCard ) const\r
+ // Adds the names of directories and files that match a specified string\r
+ // and set of file attributes.\r
+ {\r
+ assert(IsWindow());\r
+ return (int)SendMessage(CB_DIR, (WPARAM)attr, (LPARAM)lpszWildCard);\r
+ }\r
+\r
+ inline int CComboBox::FindString(int nIndexStart, LPCTSTR lpszString) const\r
+ // Search the list box of a combo box for an item beginning with the\r
+ // characters in a specified string.\r
+ {\r
+ assert(IsWindow());\r
+ return (int)SendMessage(CB_FINDSTRING, (WPARAM)nIndexStart, (LPARAM)lpszString);\r
+ }\r
+\r
+ inline int CComboBox::FindStringExact(int nIndexStart, LPCTSTR lpszString) const\r
+ // Find the first list box string in a combo box that matches the string specified in lpszString.\r
+ {\r
+ assert(IsWindow());\r
+ return (int)SendMessage(CB_FINDSTRINGEXACT, (WPARAM)nIndexStart, (LPARAM)lpszString);\r
+ }\r
+\r
+ inline int CComboBox::GetCount() const\r
+ // Retrieves the number of items in the list box of the combo box.\r
+ {\r
+ assert(IsWindow());\r
+ return (int)SendMessage(CB_GETCOUNT, 0,0);\r
+ }\r
+\r
+ inline int CComboBox::GetCurSel() const\r
+ // Retrieves the index of the currently selected item, if any, in the list box of the combo box.\r
+ {\r
+ assert(IsWindow());\r
+ return (int)SendMessage(CB_GETCURSEL, 0,0);\r
+ }\r
+\r
+ inline CRect CComboBox::GetDroppedControlRect() const\r
+ // Retrieves the screen coordinates of the combo box in its dropped-down state.\r
+ {\r
+ assert(IsWindow());\r
+ CRect rc;\r
+ SendMessage(CB_GETDROPPEDCONTROLRECT, 0, (LPARAM)&rc);\r
+ return rc;\r
+ }\r
+\r
+ inline BOOL CComboBox::GetDroppedState() const\r
+ // Determines whether the list box of the combo box is dropped down.\r
+ {\r
+ assert(IsWindow());\r
+ return (BOOL)SendMessage(CB_GETDROPPEDSTATE, 0, 0);\r
+ }\r
+\r
+ inline int CComboBox::GetDroppedWidth() const\r
+ // Retrieves the minimum allowable width, in pixels, of the list box of the combo box\r
+ // with the CBS_DROPDOWN or CBS_DROPDOWNLIST style.\r
+ {\r
+ assert(IsWindow());\r
+ return (int)SendMessage(CB_GETDROPPEDWIDTH, 0, 0);\r
+ }\r
+\r
+ inline DWORD CComboBox::GetEditSel() const\r
+ // Gets the starting and ending character positions of the current selection\r
+ // in the edit control of the combo box.\r
+ {\r
+ assert(IsWindow());\r
+ return (int)SendMessage(CB_GETEDITSEL, 0, 0);\r
+ }\r
+\r
+ inline BOOL CComboBox::GetExtendedUI() const\r
+ // Determines whether the combo box has the default user interface or the extended user interface.\r
+ {\r
+ assert(IsWindow());\r
+ return (BOOL)SendMessage(CB_GETEXTENDEDUI, 0, 0);\r
+ }\r
+\r
+ inline int CComboBox::GetHorizontalExtent() const\r
+ // Retrieve from the combo box the width, in pixels, by which the list box can\r
+ // be scrolled horizontally (the scrollable width).\r
+ {\r
+ assert(IsWindow());\r
+ return (int)SendMessage(CB_GETHORIZONTALEXTENT, 0, 0);\r
+ }\r
+\r
+ inline DWORD CComboBox::GetItemData(int nIndex) const\r
+ // Retrieves the application-supplied value associated with the specified item in the combo box.\r
+ {\r
+ assert(IsWindow());\r
+ return (DWORD)SendMessage(CB_GETITEMDATA, (WPARAM)nIndex, 0);\r
+ }\r
+\r
+ inline int CComboBox::GetItemHeight(int nIndex) const\r
+ // Determines the height of list items or the selection field in the combo box.\r
+ {\r
+ assert(IsWindow());\r
+ return (int)SendMessage(CB_GETITEMHEIGHT, (WPARAM)nIndex, 0);\r
+ }\r
+\r
+ inline int CComboBox::GetLBText(int nIndex, LPTSTR lpszText) const\r
+ // Retrieves a string from the list of the combo box.\r
+ {\r
+ assert(IsWindow());\r
+ return (int)SendMessage(CB_GETLBTEXT, (WPARAM)nIndex, (LPARAM)lpszText);\r
+ }\r
+\r
+ inline int CComboBox::GetLBTextLen(int nIndex) const\r
+ // Retrieves the length, in characters, of a string in the list of the combo box.\r
+ {\r
+ assert(IsWindow());\r
+ return (int)SendMessage(CB_GETLBTEXTLEN, (WPARAM)nIndex, 0);\r
+ }\r
+\r
+ inline LCID CComboBox::GetLocale() const\r
+ // Retrieves the current locale of the combo box.\r
+ {\r
+ assert(IsWindow());\r
+ return (LCID)SendMessage(CB_GETLOCALE, 0, 0);\r
+ }\r
+\r
+ inline int CComboBox::GetTopIndex() const\r
+ // Retrieves the zero-based index of the first visible item in the list box portion of the combo box.\r
+ {\r
+ assert(IsWindow());\r
+ return (int)SendMessage(CB_GETTOPINDEX, 0, 0);\r
+ }\r
+\r
+ inline int CComboBox::InitStorage(int nItems, int nBytes) const\r
+ // Allocates memory for storing list box items. Use this before adding a\r
+ // large number of items to the list box portion of a combo box.\r
+ {\r
+ assert(IsWindow());\r
+ return (int)SendMessage(CB_INITSTORAGE, (WPARAM)nItems, (LPARAM)nBytes);\r
+ }\r
+\r
+ inline int CComboBox::InsertString(int nIndex, LPCTSTR lpszString) const\r
+ // Inserts a string into the list box of the combo box. Unlike the AddString,\r
+ // a list with the CBS_SORT style is not sorted.\r
+ {\r
+ assert(IsWindow());\r
+ return (int)SendMessage(CB_INSERTSTRING, (WPARAM)nIndex, (LPARAM)lpszString);\r
+ }\r
+\r
+ inline void CComboBox::Paste() const\r
+ // Copies the current content of the clipboard to the combo box's edit control at the current caret position.\r
+ {\r
+ assert(IsWindow());\r
+ SendMessage(WM_PASTE, 0, 0);\r
+ }\r
+\r
+ inline void CComboBox::LimitText(int nMaxChars) const\r
+ // Limits the length of the text the user may type into the edit control of the combo box.\r
+ {\r
+ assert(IsWindow());\r
+ SendMessage(CB_LIMITTEXT, (WPARAM)nMaxChars, 0);\r
+ }\r
+\r
+ inline void CComboBox::ResetContent() const\r
+ // Removes all items from the list box and edit control of the combo box.\r
+ {\r
+ assert(IsWindow());\r
+ SendMessage(CB_RESETCONTENT, 0, 0);\r
+ }\r
+\r
+ inline int CComboBox::SelectString(int nStartAfter, LPCTSTR lpszString) const\r
+ // Searches the list of a combo box for an item that begins with the characters in a\r
+ // specified string. If a matching item is found, it is selected and copied to the edit control.\r
+ {\r
+ assert(IsWindow());\r
+ return (int)SendMessage(CB_SELECTSTRING, (WPARAM)nStartAfter, (LPARAM)lpszString);\r
+ }\r
+\r
+ inline int CComboBox::SetCurSel(int nIndex) const\r
+ // Selects a string in the list of the combo box. If necessary, the list scrolls the string into view.\r
+ {\r
+ assert(IsWindow());\r
+ return (int)SendMessage(CB_SETCURSEL, (WPARAM)nIndex, 0);\r
+ }\r
+\r
+ inline int CComboBox::SetDroppedWidth(int nWidth) const\r
+ // Sets the maximum allowable width, in pixels, of the list box of the combo box with\r
+ // the CBS_DROPDOWN or CBS_DROPDOWNLIST style.\r
+ {\r
+ assert(IsWindow());\r
+ return (int)SendMessage(CB_SETDROPPEDWIDTH, (WPARAM)nWidth, 0);\r
+ }\r
+\r
+ inline BOOL CComboBox::SetEditSel(int nStartChar, int nEndChar) const\r
+ // Selects characters in the edit control of the combo box.\r
+ {\r
+ assert(IsWindow());\r
+ return (BOOL)SendMessage(CB_SETEDITSEL, 0, (LPARAM)MAKELONG(nStartChar,nEndChar));\r
+ }\r
+\r
+ inline int CComboBox::SetExtendedUI(BOOL bExtended) const\r
+ // Selects either the default user interface or the extended user interface for the combo box that\r
+ // has the CBS_DROPDOWN or CBS_DROPDOWNLIST style.\r
+ {\r
+ assert(IsWindow());\r
+ return (int)SendMessage(CB_SETEXTENDEDUI, (WPARAM)bExtended, 0);\r
+ }\r
+\r
+ inline void CComboBox::SetHorizontalExtent(UINT nExtent ) const\r
+ // Sets the width, in pixels, by which the list box can be scrolled horizontally (the scrollable width).\r
+ {\r
+ assert(IsWindow());\r
+ SendMessage(CB_SETHORIZONTALEXTENT, (WPARAM)nExtent, 0);\r
+ }\r
+\r
+ inline int CComboBox::SetItemData(int nIndex, DWORD dwItemData) const\r
+ // Sets the value associated with the specified item in the combo box.\r
+ {\r
+ assert(IsWindow());\r
+ return (int)SendMessage(CB_SETITEMDATA, (WPARAM)nIndex, (LPARAM)dwItemData);\r
+ }\r
+\r
+ inline int CComboBox::SetItemHeight(int nIndex, UINT cyItemHeight) const\r
+ // Sets the height of list items or the selection field in the combo box.\r
+ {\r
+ assert(IsWindow());\r
+ return (int)SendMessage(CB_SETITEMHEIGHT, (WPARAM)nIndex, (LPARAM)cyItemHeight);\r
+ }\r
+\r
+ inline LCID CComboBox::SetLocale( LCID NewLocale ) const\r
+ // Sets the current locale of the combo box.\r
+ {\r
+ assert(IsWindow());\r
+ return (LCID)SendMessage(CB_SETLOCALE, (WPARAM)NewLocale, 0);\r
+ }\r
+\r
+ inline int CComboBox::SetTopIndex(int nIndex) const\r
+ // Ensure that a particular item is visible in the list box of the combo box.\r
+ {\r
+ assert(IsWindow());\r
+ return (int)SendMessage(CB_SETTOPINDEX, (WPARAM)nIndex, 0);\r
+ }\r
+\r
+ inline void CComboBox::ShowDropDown(BOOL bShow) const\r
+ // Shows or hides the list box of the combo box that has the CBS_DROPDOWN or CBS_DROPDOWNLIST style.\r
+ {\r
+ assert(IsWindow());\r
+ SendMessage(CB_SHOWDROPDOWN, (WPARAM)bShow, 0);\r
+ }\r
+\r
+\r
+ ////////////////////////////////////////\r
+ // Definitions for the CComboBoxEx class\r
+ //\r
+ inline int CComboBoxEx::DeleteItem(int nIndex ) const\r
+ // Removes an item from the ComboBoxEx control.\r
+ {\r
+ assert(IsWindow());\r
+ return (int)SendMessage(CBEM_DELETEITEM, (WPARAM)nIndex, 0);\r
+ }\r
+\r
+ inline CWnd* CComboBoxEx::GetComboBoxCtrl() const\r
+ // Retrieves the handle to the child combo box control.\r
+ {\r
+ assert(IsWindow());\r
+ return FromHandle((HWND)SendMessage(CBEM_GETCOMBOCONTROL, 0, 0));\r
+ }\r
+\r
+ inline CEdit* CComboBoxEx::GetEditCtrl() const\r
+ // Retrieves the handle to the edit control portion of the ComboBoxEx control.\r
+ {\r
+ assert(IsWindow());\r
+ return (CEdit*)FromHandle((HWND)SendMessage(CBEM_GETEDITCONTROL, 0, 0));\r
+ }\r
+\r
+ inline DWORD CComboBoxEx::GetExtendedStyle() const\r
+ // Retrieves the extended styles that are in use for the ComboBoxEx control.\r
+ {\r
+ assert(IsWindow());\r
+ return (DWORD)SendMessage(CBEM_GETEXTENDEDSTYLE, 0, 0);\r
+ }\r
+\r
+ inline HIMAGELIST CComboBoxEx::GetImageList() const\r
+ // Retrieves the handle to an image list assigned to the ComboBoxEx control.\r
+ {\r
+ assert(IsWindow());\r
+ return (HIMAGELIST)SendMessage(CBEM_GETIMAGELIST, 0, 0);\r
+ }\r
+\r
+ inline BOOL CComboBoxEx::GetItem(COMBOBOXEXITEM* pCBItem) const\r
+ // Retrieves item information for the given ComboBoxEx item.\r
+ {\r
+ assert(IsWindow());\r
+ return (BOOL)SendMessage(CBEM_GETITEM, 0, (LPARAM)pCBItem);\r
+ }\r
+\r
+ inline BOOL CComboBoxEx::HasEditChanged () const\r
+ // Determines whether or not the user has changed the text of the ComboBoxEx edit control.\r
+ {\r
+ assert(IsWindow());\r
+ return (BOOL)SendMessage(CBEM_HASEDITCHANGED, 0, 0);\r
+ }\r
+\r
+ inline int CComboBoxEx::InsertItem(COMBOBOXEXITEM* lpcCBItem) const\r
+ // Inserts a new item in the ComboBoxEx control.\r
+ {\r
+ assert(IsWindow());\r
+ return (int)SendMessage(CBEM_INSERTITEM, 0, (LPARAM)lpcCBItem);\r
+ }\r
+\r
+ inline DWORD CComboBoxEx::SetExtendedStyle(DWORD dwExMask, DWORD dwExStyles ) const\r
+ // Sets extended styles within the ComboBoxEx control.\r
+ {\r
+ assert(IsWindow());\r
+ return (DWORD)SendMessage(CBEM_SETEXTENDEDSTYLE, (WPARAM)dwExMask, (LPARAM)dwExStyles);\r
+ }\r
+\r
+ inline HIMAGELIST CComboBoxEx::SetImageList(HIMAGELIST himl) const\r
+ // Sets an image list for the ComboBoxEx control.\r
+ {\r
+ assert(IsWindow());\r
+ return (HIMAGELIST)SendMessage(CBEM_SETIMAGELIST, 0, (LPARAM)himl);\r
+ }\r
+\r
+ inline BOOL CComboBoxEx::SetItem(PCOMBOBOXEXITEM lpcCBItem) const\r
+ // Sets the attributes for an item in the ComboBoxEx control.\r
+ {\r
+ assert(IsWindow());\r
+ return (BOOL)SendMessage(CBEM_SETITEM, 0, (LPARAM)lpcCBItem);\r
+ }\r
+\r
+ ////////////////////////////////////////\r
+ // Definitions for the CDateTime class\r
+ //\r
+ inline COLORREF CDateTime::GetMonthCalColor(int iColor) const\r
+ {\r
+ assert(IsWindow());\r
+ return (COLORREF)DateTime_GetMonthCalColor(m_hWnd, iColor);\r
+ }\r
+\r
+ inline COLORREF CDateTime::SetMonthCalColor(int iColor, COLORREF clr)\r
+ {\r
+ assert(IsWindow());\r
+ return (COLORREF)DateTime_SetMonthCalColor(m_hWnd, iColor, clr);\r
+ }\r
+\r
+ inline BOOL CDateTime::SetFormat(LPCTSTR pszFormat)\r
+ {\r
+ assert(IsWindow());\r
+ return DateTime_SetFormat(m_hWnd, pszFormat);\r
+ }\r
+\r
+ inline CMonthCalendar* CDateTime::GetMonthCalCtrl() const\r
+ {\r
+ assert(IsWindow());\r
+ return (CMonthCalendar*)FromHandle((HWND)DateTime_GetMonthCal(m_hWnd));\r
+ }\r
+\r
+ inline CFont* CDateTime::GetMonthCalFont() const\r
+ {\r
+ assert(IsWindow());\r
+ return FromHandle((HFONT)DateTime_GetMonthCalFont(m_hWnd));\r
+ }\r
+\r
+ inline void CDateTime::SetMonthCalFont(HFONT hFont, BOOL bRedraw /*= TRUE*/)\r
+ {\r
+ assert(IsWindow());\r
+ DateTime_SetMonthCalFont(m_hWnd, hFont, MAKELONG(bRedraw, 0));\r
+ }\r
+\r
+ inline DWORD CDateTime::GetRange(LPSYSTEMTIME lpSysTimeArray) const\r
+ {\r
+ assert(IsWindow());\r
+ return DateTime_GetRange(m_hWnd, lpSysTimeArray);\r
+ }\r
+\r
+ inline BOOL CDateTime::SetRange(DWORD flags, LPSYSTEMTIME lpSysTimeArray)\r
+ {\r
+ assert(IsWindow());\r
+ return DateTime_SetRange(m_hWnd, flags, lpSysTimeArray);\r
+ }\r
+\r
+ inline DWORD CDateTime::GetTime(LPSYSTEMTIME pTimeDest) const\r
+ {\r
+ assert(IsWindow());\r
+ return DateTime_GetSystemtime(m_hWnd, pTimeDest);\r
+ }\r
+\r
+ inline BOOL CDateTime::SetTime(DWORD flag, LPSYSTEMTIME pTimeNew /*= NULL*/)\r
+ {\r
+ assert(IsWindow());\r
+ return DateTime_SetSystemtime(m_hWnd, flag, pTimeNew);\r
+ }\r
+\r
+\r
+ ////////////////////////////////////////\r
+ // Definitions for the CHotKey class\r
+ //\r
+ inline DWORD CHotKey::GetHotKey() const\r
+ {\r
+ assert(IsWindow());\r
+ return (DWORD)SendMessage(HKM_GETHOTKEY, 0, 0);\r
+ }\r
+\r
+ inline CString CHotKey::GetKeyName(UINT vk, BOOL fExtended) const\r
+ {\r
+ // Translate the virtual-key code to a scan code\r
+ LONG lScan = MapVirtualKey(vk, 0);\r
+\r
+ // Construct an LPARAM with the scan code in Bits 16-23, and an extended flag in bit 24\r
+ LPARAM lParam = lScan << 16;\r
+ if (fExtended)\r
+ lParam |= 0x01000000L;\r
+\r
+ CString str;\r
+ int nBufferLen = 64;\r
+ int nStrLen = nBufferLen;\r
+\r
+ // Loop until we have retrieved the entire string\r
+ while(nStrLen == nBufferLen)\r
+ {\r
+ nBufferLen *= 4;\r
+ LPTSTR pszStr = str.GetBuffer(nBufferLen);\r
+ nStrLen = ::GetKeyNameText((LONG)lParam, pszStr, nBufferLen + 1);\r
+ str.ReleaseBuffer();\r
+ }\r
+\r
+ return str;\r
+ }\r
+\r
+ inline void CHotKey::SetHotKey(DWORD dwKey)\r
+ {\r
+ assert(IsWindow());\r
+ SendMessage(HKM_SETHOTKEY, (WPARAM)dwKey, 0);\r
+ }\r
+\r
+ inline void CHotKey::SetRules(WORD wInvalidComb, WORD wModifiers)\r
+ {\r
+ assert(IsWindow());\r
+ SendMessage(HKM_SETRULES, wInvalidComb, wModifiers);\r
+ }\r
+\r
+\r
+ ////////////////////////////////////////\r
+ // Definitions for the CHeader class\r
+ //\r
+ inline HIMAGELIST CHeader::CreateDragImage(int nIndex)\r
+ {\r
+ assert(IsWindow());\r
+ return Header_CreateDragImage(m_hWnd, nIndex);\r
+ }\r
+\r
+ inline BOOL CHeader::DeleteItem(int nPos)\r
+ {\r
+ assert(IsWindow());\r
+ return Header_DeleteItem(m_hWnd, nPos);\r
+ }\r
+\r
+ inline HIMAGELIST CHeader::GetImageList() const\r
+ {\r
+ assert(IsWindow());\r
+ return Header_GetImageList(m_hWnd);\r
+ }\r
+\r
+ inline BOOL CHeader::GetItem(int nPos, HDITEM* pHeaderItem) const\r
+ {\r
+ assert(IsWindow());\r
+ return Header_GetItem(m_hWnd, nPos, pHeaderItem);\r
+ }\r
+\r
+ inline int CHeader::GetItemCount() const\r
+ {\r
+ assert(IsWindow());\r
+ return Header_GetItemCount(m_hWnd);\r
+ }\r
+\r
+ inline CRect CHeader::GetItemRect(int nIndex) const\r
+ {\r
+ assert(IsWindow());\r
+ RECT rc;\r
+ Header_GetItemRect(m_hWnd, nIndex, &rc);\r
+ return rc;\r
+ }\r
+\r
+ inline BOOL CHeader::GetOrderArray(LPINT piArray, int iCount)\r
+ {\r
+ assert(IsWindow());\r
+ return Header_GetOrderArray(m_hWnd, piArray, iCount);\r
+ }\r
+\r
+ inline int CHeader::InsertItem(int nPos, HDITEM* phdi)\r
+ {\r
+ assert(IsWindow());\r
+ return Header_InsertItem(m_hWnd, nPos, phdi);\r
+ }\r
+\r
+ inline BOOL CHeader::Layout(HDLAYOUT* pHeaderLayout)\r
+ {\r
+ assert(IsWindow());\r
+ return Header_Layout(m_hWnd, pHeaderLayout);\r
+ }\r
+\r
+ inline int CHeader::OrderToIndex(int nOrder) const\r
+ {\r
+ assert(IsWindow());\r
+ return Header_OrderToIndex( m_hWnd, nOrder);\r
+ }\r
+\r
+#ifdef Header_SetHotDivider\r
+ inline int CHeader::SetHotDivider(CPoint pt)\r
+ {\r
+ assert(IsWindow());\r
+ return Header_SetHotDivider(m_hWnd, TRUE, MAKELPARAM(pt.x, pt.y));\r
+ }\r
+\r
+ inline int CHeader::SetHotDivider(int nIndex)\r
+ {\r
+ assert(IsWindow());\r
+ return Header_SetHotDivider(m_hWnd, FALSE, nIndex);\r
+ }\r
+#endif\r
+\r
+ inline HIMAGELIST CHeader::SetImageList(HIMAGELIST himl)\r
+ {\r
+ assert(IsWindow());\r
+ return Header_SetImageList(m_hWnd, himl);\r
+ }\r
+\r
+ inline BOOL CHeader::SetItem(int nPos, HDITEM* pHeaderItem)\r
+ {\r
+ assert(IsWindow());\r
+ return Header_SetItem(m_hWnd, nPos, pHeaderItem);\r
+ }\r
+\r
+ inline BOOL CHeader::SetOrderArray(int iCount, LPINT piArray)\r
+ {\r
+ assert(IsWindow());\r
+ return Header_SetOrderArray(m_hWnd, iCount, piArray);\r
+ }\r
+\r
+#ifdef Header_ClearFilter\r
+ inline int CHeader::ClearFilter(int nColumn)\r
+ {\r
+ assert(IsWindow());\r
+ return Header_ClearFilter(m_hWnd, nColumn);\r
+ }\r
+\r
+ inline int CHeader::ClearAllFilters()\r
+ {\r
+ assert(IsWindow());\r
+ return Header_ClearAllFilters(m_hWnd);\r
+ }\r
+\r
+ inline int CHeader::EditFilter(int nColumn, BOOL bDiscardChanges)\r
+ {\r
+ assert(IsWindow());\r
+ return Header_EditFilter(m_hWnd, nColumn, LPARAM MAKELPARAM(bDiscardChanges, 0));\r
+ }\r
+\r
+ inline int CHeader::GetBitmapMargin() const\r
+ {\r
+ assert(IsWindow());\r
+ return Header_GetBitmapMargin(m_hWnd);\r
+ }\r
+\r
+ inline int CHeader::SetBitmapMargin(int nWidth)\r
+ {\r
+ assert(IsWindow());\r
+ return Header_SetBitmapMargin(m_hWnd, nWidth);\r
+ }\r
+\r
+ inline int CHeader::SetFilterChangeTimeout(DWORD dwTimeOut)\r
+ {\r
+ assert(IsWindow());\r
+ return Header_SetFilterChangeTimeout(m_hWnd, dwTimeOut);\r
+ }\r
+#endif\r
+\r
+ ////////////////////////////////////////\r
+ // Definitions for the CIPAddress class\r
+ //\r
+ inline void CIPAddress::ClearAddress()\r
+ {\r
+ assert(IsWindow());\r
+ SendMessage(IPM_CLEARADDRESS, 0, 0);\r
+ }\r
+\r
+ inline int CIPAddress::GetAddress(BYTE& nField0, BYTE& nField1, BYTE& nField2, BYTE& nField3)\r
+ {\r
+ DWORD dwAddr;\r
+ int iValue = GetAddress(&dwAddr);\r
+ nField0 = (BYTE)FIRST_IPADDRESS(dwAddr);\r
+ nField1 = (BYTE)SECOND_IPADDRESS(dwAddr);\r
+ nField2 = (BYTE)THIRD_IPADDRESS(dwAddr);\r
+ nField3 = (BYTE)FOURTH_IPADDRESS(dwAddr);\r
+ return iValue;\r
+ }\r
+\r
+ inline int CIPAddress::GetAddress(DWORD* dwAddress)\r
+ {\r
+ assert(IsWindow());\r
+ return (int)SendMessage(IPM_GETADDRESS, 0, (LPARAM)&dwAddress);\r
+ }\r
+\r
+ inline BOOL CIPAddress::IsBlank() const\r
+ {\r
+ assert(IsWindow());\r
+ return (BOOL)SendMessage(IPM_ISBLANK, 0, 0);\r
+ }\r
+\r
+ inline void CIPAddress::SetAddress(BYTE nField0, BYTE nField1, BYTE nField2, BYTE nField3)\r
+ {\r
+ assert(IsWindow());\r
+ SendMessage(IPM_SETADDRESS, 0, (LPARAM)MAKEIPADDRESS(nField0, nField1, nField2, nField3));\r
+ }\r
+\r
+ inline void CIPAddress::SetAddress(DWORD dwAddress)\r
+ {\r
+ assert(IsWindow());\r
+ SendMessage(IPM_SETADDRESS, 0, (LPARAM)dwAddress);\r
+ }\r
+\r
+ inline void CIPAddress::SetFieldFocus(WORD nField)\r
+ {\r
+ assert(IsWindow());\r
+ SendMessage(IPM_SETFOCUS, nField, 0);\r
+ }\r
+\r
+ inline void CIPAddress::SetFieldRange(int nField, BYTE nLower, BYTE nUpper)\r
+ {\r
+ assert(IsWindow());\r
+ SendMessage(IPM_SETRANGE, MAKEIPRANGE(nLower, nUpper), nField);\r
+ }\r
+\r
+\r
+ ///////////////////////////////////////////\r
+ // Definitions for the CMonthCalendar class\r
+ //\r
+ inline COLORREF CMonthCalendar::GetColor(int nRegion) const\r
+ {\r
+ assert(IsWindow());\r
+ return (COLORREF)MonthCal_GetColor(m_hWnd, nRegion);\r
+ }\r
+\r
+ inline BOOL CMonthCalendar::GetCurSel(LPSYSTEMTIME pDateTime) const\r
+ {\r
+ assert(IsWindow());\r
+ return MonthCal_GetCurSel(m_hWnd, pDateTime);\r
+ }\r
+\r
+ inline int CMonthCalendar::GetFirstDayOfWeek(BOOL* pbLocal /*= NULL*/) const\r
+ {\r
+ assert(IsWindow());\r
+ DWORD dwValue = MonthCal_GetFirstDayOfWeek(m_hWnd);\r
+\r
+ if (pbLocal)\r
+ *pbLocal = HIWORD(dwValue);\r
+\r
+ return LOWORD(dwValue);\r
+ }\r
+\r
+ inline int CMonthCalendar::GetMaxSelCount() const\r
+ {\r
+ assert(IsWindow());\r
+ return MonthCal_GetMaxSelCount(m_hWnd);\r
+ }\r
+\r
+ inline CRect CMonthCalendar::GetMinReqRect() const\r
+ {\r
+ assert(IsWindow());\r
+ RECT rc;\r
+ MonthCal_GetMinReqRect(m_hWnd, &rc);\r
+ return rc;\r
+ }\r
+\r
+ inline int CMonthCalendar::GetMonthDelta() const\r
+ {\r
+ assert(IsWindow());\r
+ return MonthCal_GetMonthDelta(m_hWnd);\r
+ }\r
+\r
+ inline int CMonthCalendar::GetMonthRange(LPSYSTEMTIME pMinRange, LPSYSTEMTIME pMaxRange, DWORD dwFlags) const\r
+ {\r
+ assert(IsWindow());\r
+ SYSTEMTIME MinMax[2];\r
+ memcpy(&MinMax[0], pMinRange, sizeof(SYSTEMTIME));\r
+ memcpy(&MinMax[1], pMaxRange, sizeof(SYSTEMTIME));\r
+ int nCount = MonthCal_GetMonthRange(m_hWnd, dwFlags, MinMax);\r
+ return nCount;\r
+ }\r
+\r
+ inline DWORD CMonthCalendar::GetRange(LPSYSTEMTIME pMinRange, LPSYSTEMTIME pMaxRange) const\r
+ {\r
+ assert(IsWindow());\r
+ SYSTEMTIME MinMax[2];\r
+ DWORD dwValue = MonthCal_GetRange(m_hWnd, &MinMax);\r
+ memcpy(pMinRange, &MinMax[0], sizeof(SYSTEMTIME));\r
+ memcpy(pMaxRange, &MinMax[1], sizeof(SYSTEMTIME));\r
+ return dwValue;\r
+ }\r
+\r
+ inline BOOL CMonthCalendar::GetSelRange(LPSYSTEMTIME pMinRange, LPSYSTEMTIME pMaxRange) const\r
+ {\r
+ assert(IsWindow());\r
+ SYSTEMTIME MinMax[2];\r
+ memcpy(&MinMax[0], pMinRange, sizeof(SYSTEMTIME));\r
+ memcpy(&MinMax[1], pMaxRange, sizeof(SYSTEMTIME));\r
+ return (BOOL)MonthCal_GetSelRange(m_hWnd, &MinMax);\r
+ }\r
+\r
+ inline BOOL CMonthCalendar::GetToday(LPSYSTEMTIME pDateTime) const\r
+ {\r
+ assert(IsWindow());\r
+ return MonthCal_GetToday(m_hWnd, pDateTime);\r
+ }\r
+\r
+ inline DWORD CMonthCalendar::HitTest(PMCHITTESTINFO pMCHitTest)\r
+ {\r
+ assert(IsWindow());\r
+ return (DWORD)MonthCal_HitTest(m_hWnd, pMCHitTest);\r
+ }\r
+\r
+ inline COLORREF CMonthCalendar::SetColor(int nRegion, COLORREF clr)\r
+ {\r
+ assert(IsWindow());\r
+ return (COLORREF)MonthCal_SetColor(m_hWnd, nRegion, clr);\r
+ }\r
+\r
+ inline BOOL CMonthCalendar::SetCurSel(const LPSYSTEMTIME pDateTime)\r
+ {\r
+ assert(IsWindow());\r
+ return MonthCal_SetCurSel(m_hWnd, pDateTime);\r
+ }\r
+\r
+ inline BOOL CMonthCalendar::SetDayState(int nMonths, LPMONTHDAYSTATE pStates)\r
+ {\r
+ assert(IsWindow());\r
+ return (BOOL)MonthCal_SetDayState(m_hWnd, nMonths, pStates);\r
+ }\r
+\r
+ inline BOOL CMonthCalendar::SetFirstDayOfWeek(int iDay, int* pnOld/* = NULL*/)\r
+ {\r
+ assert(IsWindow());\r
+ DWORD dwValue = (DWORD)MonthCal_SetFirstDayOfWeek(m_hWnd, iDay);\r
+\r
+ if(pnOld)\r
+ *pnOld = LOWORD(dwValue);\r
+\r
+ return (BOOL)HIWORD(dwValue);\r
+ }\r
+\r
+ inline BOOL CMonthCalendar::SetMaxSelCount(int nMax)\r
+ {\r
+ assert(IsWindow());\r
+ return MonthCal_SetMaxSelCount(m_hWnd, nMax);\r
+ }\r
+\r
+ inline int CMonthCalendar::SetMonthDelta(int iDelta)\r
+ {\r
+ assert(IsWindow());\r
+ return MonthCal_SetMonthDelta(m_hWnd, iDelta);\r
+ }\r
+\r
+ inline BOOL CMonthCalendar::SetRange(const LPSYSTEMTIME pMinRange, const LPSYSTEMTIME pMaxRange)\r
+ {\r
+\r
+ SYSTEMTIME MinMax[2];\r
+ DWORD dwLimit;\r
+\r
+ if (pMinRange != NULL)\r
+ {\r
+ memcpy(&MinMax[0], pMinRange, sizeof(SYSTEMTIME));\r
+ dwLimit = GDTR_MIN;\r
+ }\r
+\r
+ if (pMaxRange)\r
+ {\r
+ memcpy(&MinMax[1], pMaxRange, sizeof(SYSTEMTIME));\r
+ dwLimit |= GDTR_MAX;\r
+ }\r
+\r
+ return (BOOL)MonthCal_SetRange(m_hWnd, dwLimit, &MinMax);\r
+ }\r
+\r
+ inline BOOL CMonthCalendar::SetSelRange(const LPSYSTEMTIME pMinRange, const LPSYSTEMTIME pMaxRange)\r
+ {\r
+ SYSTEMTIME MinMax[2];\r
+ memcpy(&MinMax[0], pMinRange, sizeof(SYSTEMTIME));\r
+ memcpy(&MinMax[1], pMaxRange, sizeof(SYSTEMTIME));\r
+ return (BOOL)MonthCal_SetSelRange(m_hWnd, &MinMax);\r
+ }\r
+\r
+ inline void CMonthCalendar::SetToday(const LPSYSTEMTIME pDateTime)\r
+ {\r
+ assert(IsWindow());\r
+ MonthCal_SetToday(m_hWnd, pDateTime);\r
+ }\r
+\r
+\r
+ ////////////////////////////////////////\r
+ // Definitions for the CProgressBar class\r
+ //\r
+ inline int CProgressBar::GetPos() const\r
+ // Retrieves the current position of the progress bar.\r
+ {\r
+ assert(IsWindow());\r
+ return (int)SendMessage(PBM_GETPOS, 0, 0);\r
+ }\r
+\r
+ inline int CProgressBar::GetRange(BOOL fWhichLimit, PPBRANGE ppBRange) const\r
+ // Retrieves information about the current high and low limits of the progress bar control.\r
+ {\r
+ assert(IsWindow());\r
+ return (int)SendMessage(PBM_GETRANGE, (WPARAM)fWhichLimit, (LPARAM) (PPBRANGE) ppBRange);\r
+ }\r
+\r
+ inline int CProgressBar::OffsetPos(int nIncrement) const\r
+ // Advances the current position of the progress bar by a specified increment and redraws\r
+ // the bar to reflect the new position.\r
+ {\r
+ assert(IsWindow());\r
+ return (int)SendMessage(PBM_DELTAPOS, (WPARAM)nIncrement, 0);\r
+ }\r
+\r
+ inline int CProgressBar::SetPos(int nNewPos) const\r
+ // Sets the current position for the progress bar and redraws the bar to reflect the new position.\r
+ {\r
+ assert(IsWindow());\r
+ return (int)SendMessage(PBM_SETPOS, (WPARAM)nNewPos, 0);\r
+ }\r
+\r
+ inline int CProgressBar::SetRange(short nMinRange, short nMaxRange) const\r
+ // Sets the minimum and maximum values for the progress bar and redraws the bar to reflect the new range.\r
+ {\r
+ assert(IsWindow());\r
+ return (int)SendMessage(PBM_SETRANGE, 0, (LPARAM) MAKELPARAM (nMinRange, nMaxRange));\r
+ }\r
+\r
+ inline int CProgressBar::SetStep(int nStepInc) const\r
+ // Specifies the step increment for the progress bar.\r
+ {\r
+ assert(IsWindow());\r
+ return (int)SendMessage(PBM_SETSTEP, (WPARAM)nStepInc, 0);\r
+ }\r
+\r
+ inline int CProgressBar::StepIt() const\r
+ // Advances the current position for a progress bar by the step increment and\r
+ // redraws the bar to reflect the new position.\r
+ {\r
+ assert(IsWindow());\r
+ return (int)SendMessage(PBM_STEPIT, 0, 0);\r
+ }\r
+\r
+\r
+ ////////////////////////////////////////\r
+ // Definitions for the CScrollBar class\r
+ //\r
+ inline BOOL CScrollBar::EnableScrollBar( UINT nArrowFlags ) const\r
+ // Enables or disables the scroll bar arrows.\r
+ {\r
+ assert(IsWindow());\r
+ return ::EnableScrollBar(m_hWnd, SB_CTL, nArrowFlags);\r
+ }\r
+\r
+ inline BOOL CScrollBar::GetScrollInfo(LPSCROLLINFO lpsi) const\r
+ // Retrieves the parameters of a scroll bar, including the minimum and maximum\r
+ // scrolling positions, the page size, and the position of the scroll box (thumb).\r
+ {\r
+ assert(IsWindow());\r
+ return ::GetScrollInfo(m_hWnd, SB_CTL, lpsi);\r
+ }\r
+\r
+ inline int CScrollBar::GetScrollPos() const\r
+ // Retrieves the current position of the scroll box (thumb) in the scroll bar.\r
+ {\r
+ assert(IsWindow());\r
+ return ::GetScrollPos(m_hWnd, SB_CTL);\r
+ }\r
+\r
+ inline BOOL CScrollBar::GetScrollRange(LPINT lpMinPos, LPINT lpMaxPos ) const\r
+ // Retrieves the current minimum and maximum scroll box (thumb) positions for the scroll bar.\r
+ {\r
+ assert(IsWindow());\r
+ return ::GetScrollRange(m_hWnd, SB_CTL, lpMinPos, lpMaxPos);\r
+ }\r
+\r
+ inline BOOL CScrollBar::SetScrollInfo(LPSCROLLINFO lpsi, BOOL bRedraw ) const\r
+ // Sets the parameters of the scroll bar, including the minimum and maximum scrolling positions,\r
+ // the page size, and the position of the scroll box (thumb).\r
+ {\r
+ assert(IsWindow());\r
+ return ::SetScrollInfo(m_hWnd, SB_CTL, lpsi, bRedraw);\r
+ }\r
+\r
+ inline int CScrollBar::SetScrollPos(int nPos, BOOL bRedraw) const\r
+ // Sets the position of the scroll box (thumb) in the scroll bar and, if requested,\r
+ // redraws the scroll bar to reflect the new position of the scroll box.\r
+ {\r
+ assert(IsWindow());\r
+ return ::SetScrollPos(m_hWnd, SB_CTL, nPos, bRedraw);\r
+ }\r
+\r
+ inline BOOL CScrollBar::SetScrollRange( int nMinPos, int nMaxPos, BOOL bRedraw ) const\r
+ // Sets the minimum and maximum scroll box positions for the scroll bar.\r
+ {\r
+ assert(IsWindow());\r
+ return ::SetScrollRange(m_hWnd, SB_CTL, nMinPos, nMaxPos, bRedraw);\r
+ }\r
+\r
+ inline BOOL CScrollBar::ShowScrollBar(BOOL bShow) const\r
+ // Shows or hides the scroll bar.\r
+ {\r
+ assert(IsWindow());\r
+ return ::ShowScrollBar(m_hWnd, SB_CTL, bShow);\r
+ }\r
+\r
+ ////////////////////////////////////////\r
+ // Definitions for the CSlider class\r
+ //\r
+ inline void CSlider::ClearSel() const\r
+ // Clears the current selection range in the trackbar.\r
+ {\r
+ assert(IsWindow());\r
+ SendMessage(TBM_CLEARSEL, 0, 0);\r
+ }\r
+\r
+ inline void CSlider::ClearTics(BOOL bRedraw) const\r
+ // Removes the current tick marks from the trackbar.\r
+ {\r
+ assert(IsWindow());\r
+ SendMessage(TBM_CLEARTICS, (WPARAM)bRedraw, 0);\r
+ }\r
+\r
+ inline CWnd* CSlider::GetBuddy(BOOL fLocation) const\r
+ // Retrieves the handle to the trackbar control buddy window at a given location.\r
+ {\r
+ assert(IsWindow());\r
+ return FromHandle((HWND)SendMessage(TBM_GETBUDDY, (WPARAM)fLocation, 0));\r
+ }\r
+\r
+ inline CRect CSlider::GetChannelRect() const\r
+ // Retrieves the size and position of the bounding rectangle for the trackbar's channel.\r
+ {\r
+ assert(IsWindow());\r
+ CRect rc;\r
+ SendMessage(TBM_GETCHANNELRECT, 0, (LPARAM)&rc);\r
+ return rc;\r
+ }\r
+\r
+ inline int CSlider::GetLineSize() const\r
+ // Retrieves the number of logical positions the trackbar's slider moves in response\r
+ // to keyboard input from the arrow keys.\r
+ {\r
+ assert(IsWindow());\r
+ return (int)SendMessage(TBM_GETLINESIZE, 0, 0);\r
+ }\r
+\r
+ inline int CSlider::GetNumTics() const\r
+ // Retrieves the number of tick marks in the trackbar.\r
+ {\r
+ assert(IsWindow());\r
+ return (int)SendMessage(TBM_GETNUMTICS, 0, 0);\r
+ }\r
+\r
+ inline int CSlider::GetPageSize() const\r
+ // Retrieves the number of logical positions the trackbar's slider moves in response to\r
+ // keyboard input, or mouse input, such as clicks in the trackbar's channel.\r
+ {\r
+ assert(IsWindow());\r
+ return (int)SendMessage(TBM_GETPAGESIZE, 0, 0);\r
+ }\r
+\r
+ inline int CSlider::GetPos() const\r
+ // Retrieves the current logical position of the slider in the trackbar.\r
+ {\r
+ assert(IsWindow());\r
+ return (int)SendMessage(TBM_GETPOS, 0, 0);\r
+ }\r
+\r
+ inline int CSlider::GetRangeMax() const\r
+ // Retrieves the maximum position for the slider in the trackbar.\r
+ {\r
+ assert(IsWindow());\r
+ return (int)SendMessage(TBM_GETRANGEMAX, 0, 0);\r
+ }\r
+\r
+ inline int CSlider::GetRangeMin() const\r
+ // Retrieves the minimum position for the slider in the trackbar.\r
+ {\r
+ assert(IsWindow());\r
+ return (int)SendMessage(TBM_GETRANGEMIN, 0, 0);\r
+ }\r
+\r
+ inline int CSlider::GetSelEnd() const\r
+ // Retrieves the ending position of the current selection range in the trackbar.\r
+ {\r
+ assert(IsWindow());\r
+ return (int)SendMessage(TBM_GETSELEND, 0, 0);\r
+ }\r
+\r
+ inline int CSlider::GetSelStart() const\r
+ // Retrieves the starting position of the current selection range in the trackbar.\r
+ {\r
+ assert(IsWindow());\r
+ return (int)SendMessage(TBM_GETSELSTART, 0, 0);\r
+ }\r
+\r
+ inline int CSlider::GetThumbLength() const\r
+ // Retrieves the length of the slider in the trackbar.\r
+ {\r
+ assert(IsWindow());\r
+ return (int)SendMessage(TBM_GETTHUMBLENGTH, 0, 0);\r
+ }\r
+\r
+ inline CRect CSlider::GetThumbRect() const\r
+ // Retrieves the size and position of the bounding rectangle for the slider in the trackbar.\r
+ {\r
+ CRect rc;\r
+ SendMessage(TBM_GETTHUMBRECT, 0, (LPARAM)&rc);\r
+ return rc;\r
+ }\r
+\r
+ inline int CSlider::GetTic(int nTic ) const\r
+ // Retrieves the logical position of a tick mark in the trackbar.\r
+ {\r
+ assert(IsWindow());\r
+ return (int)SendMessage(TBM_GETTIC, (WPARAM)nTic, 0);\r
+ }\r
+\r
+ inline int CSlider::GetTicPos(int nTic) const\r
+ // Retrieves the current physical position of a tick mark in the trackbar.\r
+ {\r
+ assert(IsWindow());\r
+ return (int)SendMessage(TBM_GETTICPOS, (WPARAM)nTic, 0);\r
+ }\r
+\r
+ inline CToolTip* CSlider::GetToolTips() const\r
+ // Retrieves the handle to the ToolTip control assigned to the trackbar, if any.\r
+ {\r
+ assert(IsWindow());\r
+ return (CToolTip*)FromHandle((HWND)SendMessage(TBM_GETTOOLTIPS, 0, 0));\r
+ }\r
+\r
+ inline CWnd* CSlider::SetBuddy(CWnd* pBuddy, BOOL fLocation /*= TRUE*/ ) const\r
+ // Assigns a window as the buddy window for the trackbar control.\r
+ {\r
+ assert(IsWindow());\r
+ return FromHandle((HWND)SendMessage(TBM_SETBUDDY, (WPARAM)fLocation, (LPARAM)pBuddy->GetHwnd()));\r
+ }\r
+\r
+ inline int CSlider::SetLineSize(int nSize) const\r
+ // Sets the number of logical positions the trackbar's slider moves in response to\r
+ // keyboard input from the arrow keys.\r
+ {\r
+ assert(IsWindow());\r
+ return(int)SendMessage(TBM_SETLINESIZE, 0, (LPARAM)nSize);\r
+ }\r
+\r
+ inline int CSlider::SetPageSize(int nSize) const\r
+ // Sets the number of logical positions the trackbar's slider moves in response to\r
+ // keyboard input, or mouse input such as clicks in the trackbar's channel.\r
+ {\r
+ assert(IsWindow());\r
+ return(int)SendMessage(TBM_SETPAGESIZE, 0, (LPARAM)nSize);\r
+ }\r
+\r
+ inline void CSlider::SetPos(int nPos, BOOL bRedraw) const\r
+ // Sets the current logical position of the slider in the trackbar.\r
+ {\r
+ assert(IsWindow());\r
+ SendMessage(TBM_SETPOS, (WPARAM)bRedraw, (LPARAM)nPos);\r
+ }\r
+\r
+ inline void CSlider::SetRangeMax(int nMax, BOOL bRedraw) const\r
+ // Sets the maximum logical position for the slider in the trackbar.\r
+ {\r
+ assert(IsWindow());\r
+ SendMessage(TBM_SETRANGEMAX, (WPARAM)bRedraw, (LPARAM)nMax);\r
+ }\r
+\r
+ inline void CSlider::SetRangeMin(int nMax, BOOL bRedraw) const\r
+ // Sets the minimum logical position for the slider in the trackbar.\r
+ {\r
+ assert(IsWindow());\r
+ SendMessage(TBM_SETRANGEMIN, (WPARAM)bRedraw, (LPARAM)nMax);\r
+ }\r
+\r
+ inline void CSlider::SetSelection(int nMin, int nMax, BOOL bRedraw) const\r
+ // Sets the starting and ending positions for the available selection range in the trackbar.\r
+ {\r
+ assert(IsWindow());\r
+ SendMessage(TBM_SETSEL, (WPARAM)bRedraw, (LPARAM)MAKELONG(nMax, nMin));\r
+ }\r
+\r
+ inline BOOL CSlider::SetTic(int nTic) const\r
+ // Sets a tick mark in the trackbar at the specified logical position.\r
+ {\r
+ assert(IsWindow());\r
+ return (BOOL)SendMessage(TBM_SETTIC, 0, nTic);\r
+ }\r
+\r
+ inline void CSlider::SetTicFreq(int nFreq) const\r
+ // Sets the interval frequency for tick marks in the trackbar.\r
+ {\r
+ assert(IsWindow());\r
+ SendMessage(TBM_SETTICFREQ, (WPARAM)nFreq, 0);\r
+ }\r
+\r
+ inline int CSlider::SetTipSide(int nLocation) const\r
+ // Positions a ToolTip control used by the trackbar control.\r
+ {\r
+ assert(IsWindow());\r
+ return (int)SendMessage(TBM_SETTIPSIDE, (WPARAM)nLocation, 0);\r
+ }\r
+\r
+ inline void CSlider::SetToolTips(CToolTip* pToolTip) const\r
+ // Assigns a ToolTip control to the trackbar control.\r
+ {\r
+ assert(IsWindow());\r
+ HWND hToolTip = pToolTip? pToolTip->GetHwnd() : 0;\r
+ SendMessage(TBM_SETTOOLTIPS, (WPARAM)hToolTip, 0);\r
+ }\r
+\r
+ ////////////////////////////////////////\r
+ // Definitions for the CSpinButton class\r
+ //\r
+ inline int CSpinButton::GetAccel(int cAccels, LPUDACCEL paAccels) const\r
+ // Retrieves acceleration information for the up-down control.\r
+ {\r
+ assert(IsWindow());\r
+ return (int)SendMessage(UDM_GETACCEL, (WPARAM)cAccels, (LPARAM)paAccels);\r
+ }\r
+\r
+ inline int CSpinButton::GetBase() const\r
+ // Retrieves the current radix base (that is, either base 10 or 16) for the up-down control.\r
+ {\r
+ assert(IsWindow());\r
+ return (int)SendMessage(UDM_GETBASE, 0, 0);\r
+ }\r
+\r
+ inline CWnd* CSpinButton::GetBuddy() const\r
+ // Retrieves the handle to the current buddy window.\r
+ {\r
+ assert(IsWindow());\r
+ return FromHandle((HWND)SendMessage(UDM_GETBUDDY, 0, 0));\r
+ }\r
+\r
+ inline int CSpinButton::GetPos() const\r
+ // Retrieves the current position of the up-down control with 16-bit precision.\r
+ {\r
+ assert(IsWindow());\r
+ return (int)SendMessage(UDM_GETPOS, 0, 0);\r
+ }\r
+\r
+ inline DWORD CSpinButton::GetRange() const\r
+ // Retrieves the minimum and maximum positions (range) for the up-down control.\r
+ {\r
+ assert(IsWindow());\r
+ return (DWORD)SendMessage(UDM_GETRANGE, 0, 0);\r
+ }\r
+\r
+ inline void CSpinButton::PreCreate(CREATESTRUCT &cs)\r
+ {\r
+ cs.style = WS_CHILD | WS_VISIBLE | WS_BORDER | WS_VISIBLE |UDS_SETBUDDYINT;\r
+ }\r
+\r
+ inline void CSpinButton::PreRegisterClass(WNDCLASS &wc)\r
+ {\r
+ wc.lpszClassName = UPDOWN_CLASS;\r
+ }\r
+\r
+ inline BOOL CSpinButton::SetAccel(int cAccels, LPUDACCEL paAccels) const\r
+ // Sets the acceleration for the up-down control.\r
+ {\r
+ assert(IsWindow());\r
+ return (BOOL)SendMessage(UDM_SETACCEL, (WPARAM)cAccels, (LPARAM)paAccels);\r
+ }\r
+\r
+ inline int CSpinButton::SetBase(int nBase) const\r
+ // Sets the radix base for the up-down control.\r
+ {\r
+ assert(IsWindow());\r
+ return (int)SendMessage(UDM_SETBASE, (WPARAM)nBase, 0);\r
+ }\r
+\r
+ inline CWnd* CSpinButton::SetBuddy(CWnd* pBuddy) const\r
+ // Sets the buddy window for the up-down control.\r
+ {\r
+ assert(IsWindow());\r
+ return FromHandle((HWND)SendMessage(UDM_SETBUDDY, (WPARAM)pBuddy->GetHwnd(), 0));\r
+ }\r
+\r
+ inline int CSpinButton::SetPos(int nPos) const\r
+ // Sets the current position for the up-down control with 16-bit precision.\r
+ {\r
+ assert(IsWindow());\r
+ return (int)SendMessage(UDM_SETPOS, 0, (LPARAM)MAKELONG ((short) nPos, 0));\r
+ }\r
+\r
+ inline void CSpinButton::SetRange(int nLower, int nUpper) const\r
+ // Sets the minimum and maximum positions (range) for the up-down control.\r
+ {\r
+ assert(IsWindow());\r
+ SendMessage(UDM_SETRANGE, 0, (LPARAM)MAKELONG(nUpper, nLower));\r
+ }\r
+\r
+ ////////////////////////////////////////\r
+ // Definitions for the CToolTip class\r
+ //\r
+\r
+ inline CToolTip::CToolTip()\r
+ {}\r
+\r
+ inline CToolTip::~CToolTip()\r
+ {}\r
+\r
+ inline void CToolTip::Activate(BOOL bActivate)\r
+ // Activates or deactivates a ToolTip control.\r
+ {\r
+ assert(IsWindow());\r
+ SendMessage(TTM_ACTIVATE, bActivate, 0);\r
+ }\r
+\r
+ inline BOOL CToolTip::AddTool(CWnd* pWnd, UINT nIDText, LPCRECT lpRectTool /*= NULL*/, UINT_PTR nIDTool /*= 0*/)\r
+ // Registers a tool with a ToolTip control.\r
+ {\r
+ assert(IsWindow());\r
+ assert(pWnd);\r
+ TOOLINFO ti;\r
+ LoadToolInfo(ti, pWnd, nIDTool);\r
+ ti.hinst = GetApp()->GetResourceHandle();\r
+ ti.lpszText = (LPTSTR)MAKEINTRESOURCE(nIDText);\r
+ if (lpRectTool)\r
+ ti.rect = *lpRectTool;\r
+ return (BOOL)SendMessage(TTM_ADDTOOL, 0, (LPARAM)&ti);\r
+ }\r
+\r
+ inline BOOL CToolTip::AddTool(CWnd* pWnd, LPCTSTR lpszText /*= LPSTR_TEXTCALLBACK*/, LPCRECT lpRectTool /*= NULL*/, UINT_PTR nIDTool /*= 0*/)\r
+ // Registers a tool with a ToolTip control.\r
+ {\r
+ assert(IsWindow());\r
+ assert(pWnd);\r
+ TOOLINFO ti;\r
+ LoadToolInfo(ti, pWnd, nIDTool);\r
+ ti.lpszText = (LPTSTR)lpszText;\r
+ if (lpRectTool)\r
+ ti.rect = *lpRectTool;\r
+ return (BOOL)SendMessage(TTM_ADDTOOL, 0, (LPARAM)&ti);\r
+ }\r
+\r
+ inline void CToolTip::DelTool(CWnd* pWnd, UINT_PTR nIDTool /*= 0*/)\r
+ // Removes a tool from a ToolTip control.\r
+ {\r
+ assert(IsWindow());\r
+ TOOLINFO ti;\r
+ LoadToolInfo(ti, pWnd, nIDTool);\r
+ SendMessage(TTM_DELTOOL, 0, (LPARAM)&ti);\r
+ }\r
+\r
+ inline int CToolTip::GetDelayTime(DWORD dwDuration) const\r
+ // Retrieves the initial, pop-up, and reshow durations currently set for a ToolTip control.\r
+ {\r
+ assert(IsWindow());\r
+ return (int)SendMessage(TTM_GETDELAYTIME, dwDuration, 0);\r
+ }\r
+\r
+ inline void CToolTip::GetMargin(LPRECT lprc) const\r
+ // Retrieves the top, left, bottom, and right margins set for a ToolTip window.\r
+ {\r
+ assert(IsWindow());\r
+ SendMessage(TTM_GETMARGIN, 0, (LPARAM)lprc);\r
+ }\r
+\r
+ inline int CToolTip::GetMaxTipWidth() const\r
+ // Retrieves the maximum width for a ToolTip window.\r
+ {\r
+ assert(IsWindow());\r
+ return (int)SendMessage(TTM_GETMAXTIPWIDTH, 0, 0);\r
+ }\r
+\r
+ inline void CToolTip::GetText(CString& str, CWnd* pWnd, UINT_PTR nIDTool /*= 0*/) const\r
+ // Retrieves the information a ToolTip control maintains about a tool.\r
+ {\r
+ assert(IsWindow());\r
+ assert(pWnd);\r
+ LPTSTR pszText = str.GetBuffer(80); // Maximum allowed Tooltip is 80 characters for Windows XP and below\r
+ TOOLINFO ti;\r
+ LoadToolInfo(ti, pWnd, nIDTool);\r
+ ti.lpszText = pszText;\r
+ SendMessage(TTM_GETTEXT, 0, (LPARAM)&ti);\r
+ str.ReleaseBuffer();\r
+ }\r
+\r
+ inline COLORREF CToolTip::GetTipBkColor() const\r
+ // Retrieves the background color in a ToolTip window.\r
+ {\r
+ assert(IsWindow());\r
+ return (COLORREF)SendMessage(TTM_GETTIPBKCOLOR, 0,0);\r
+ }\r
+\r
+ inline COLORREF CToolTip::GetTipTextColor() const\r
+ // Retrieves the text color in a ToolTip window.\r
+ {\r
+ assert(IsWindow());\r
+ return (COLORREF)SendMessage(TTM_GETTIPTEXTCOLOR, 0, 0);\r
+ }\r
+\r
+ inline int CToolTip::GetToolCount() const\r
+ // Retrieves a count of the tools maintained by a ToolTip control.\r
+ {\r
+ assert(IsWindow());\r
+ return (int)SendMessage(TTM_GETTOOLCOUNT, 0, 0);\r
+ }\r
+\r
+ inline BOOL CToolTip::GetToolInfo(TOOLINFO& ToolInfo, CWnd* pWnd, UINT_PTR nIDTool /*= 0*/) const\r
+ // Retrieves the information that a ToolTip control maintains about a tool.\r
+ {\r
+ assert(IsWindow());\r
+ assert(pWnd);\r
+ LoadToolInfo(ToolInfo, pWnd, nIDTool);\r
+ return (BOOL)SendMessage(TTM_GETTOOLINFO, 0, (LPARAM)&ToolInfo);\r
+ }\r
+\r
+ inline BOOL CToolTip::HitTest(CWnd* pWnd, CPoint pt, LPTOOLINFO lpToolInfo) const\r
+ // Tests a point to determine whether it is within the bounding rectangle of the \r
+ // specified tool and, if it is, retrieves information about the tool.\r
+ {\r
+ assert(IsWindow());\r
+ assert(pWnd);\r
+ assert(lpToolInfo);\r
+ TTHITTESTINFO hti = {0};\r
+ hti.hwnd = pWnd->GetHwnd();\r
+ hti.pt = pt;\r
+ hti.ti = *lpToolInfo;\r
+ return (BOOL)SendMessage(TTM_HITTEST, 0, (LPARAM)&hti);\r
+ }\r
+\r
+ inline void CToolTip::LoadToolInfo(TOOLINFO& ti, CWnd* pWnd, UINT_PTR nIDTool) const\r
+ {\r
+ ZeroMemory(&ti, sizeof(TOOLINFO));\r
+ ti.cbSize = sizeof(TOOLINFO);\r
+ HWND hWnd = pWnd->GetHwnd();\r
+ if (nIDTool == 0)\r
+ {\r
+ ti.hwnd = ::GetParent(hWnd);\r
+ ti.uFlags = TTF_IDISHWND | TTF_SUBCLASS;\r
+ ti.uId = (UINT)hWnd;\r
+ }\r
+ else\r
+ {\r
+ ti.hwnd = hWnd;\r
+ ti.uId = nIDTool;\r
+ }\r
+ }\r
+\r
+ inline void CToolTip::Pop()\r
+ // Removes a displayed ToolTip window from view.\r
+ {\r
+ assert(IsWindow());\r
+ SendMessage(TTM_POP, 0, 0);\r
+ }\r
+\r
+ inline void CToolTip::RelayEvent(LPMSG lpMsg)\r
+ // Passes a mouse message to a ToolTip control for processing.\r
+ {\r
+ assert(IsWindow());\r
+ SendMessage(TTM_RELAYEVENT, 0, (LPARAM)lpMsg);\r
+ }\r
+\r
+ inline void CToolTip::SetDelayTime(UINT nDelay)\r
+ // Sets the initial delay for a ToolTip control.\r
+ {\r
+ assert(IsWindow());\r
+ SendMessage(TTM_SETDELAYTIME, TTDT_INITIAL, nDelay);\r
+ }\r
+\r
+ inline void CToolTip::SetDelayTime(DWORD dwDuration, int iTime)\r
+ // Sets the initial, pop-up, and reshow durations for a ToolTip control.\r
+ {\r
+ assert(IsWindow());\r
+ SendMessage(TTM_SETDELAYTIME, dwDuration, iTime);\r
+ }\r
+\r
+ inline void CToolTip::SetMargin(LPRECT lprc)\r
+ // Sets the top, left, bottom, and right margins for a ToolTip window.\r
+ {\r
+ assert(IsWindow());\r
+ assert(lprc);\r
+ SendMessage(TTM_SETMARGIN, 0, (LPARAM)lprc);\r
+ }\r
+\r
+ inline int CToolTip::SetMaxTipWidth(int iWidth)\r
+ // Sets the maximum width for a ToolTip window.\r
+ {\r
+ assert(IsWindow());\r
+ return (int)SendMessage(TTM_SETMAXTIPWIDTH, 0, iWidth);\r
+ }\r
+\r
+ inline void CToolTip::SetTipBkColor(COLORREF clr)\r
+ // Sets the background color in a ToolTip window.\r
+ // Ignored when XP themes are active.\r
+ {\r
+ assert(IsWindow());\r
+ SendMessage(TTM_SETTIPBKCOLOR, clr, 0);\r
+ }\r
+\r
+ inline void CToolTip::SetTipTextColor(COLORREF clr)\r
+ // Sets the text color in a ToolTip window.\r
+ // Ignored when XP themes are active.\r
+ {\r
+ assert(IsWindow());\r
+ SendMessage(TTM_SETTIPTEXTCOLOR, clr, 0);\r
+ }\r
+\r
+ inline void CToolTip::SetToolInfo(LPTOOLINFO lpToolInfo)\r
+ // Sets the information that a ToolTip control maintains for a tool.\r
+ {\r
+ assert(IsWindow());\r
+ SendMessage(TTM_SETTOOLINFO, 0, (LPARAM)lpToolInfo);\r
+ }\r
+\r
+ inline void CToolTip::SetToolRect(CWnd* pWnd, UINT_PTR nIDTool, LPCRECT lpRect)\r
+ // Sets a new bounding rectangle for a tool.\r
+ {\r
+ assert(IsWindow());\r
+ assert(pWnd);\r
+ assert(lpRect);\r
+ TOOLINFO ti;\r
+ LoadToolInfo(ti, pWnd, nIDTool);\r
+ ti.rect = *lpRect;\r
+ SendMessage(TTM_NEWTOOLRECT, 0, (LPARAM)&ti);\r
+ }\r
+\r
+ inline void CToolTip::Update()\r
+ // Forces the current tool to be redrawn.\r
+ {\r
+ assert(IsWindow());\r
+ SendMessage(TTM_UPDATE, 0, 0);\r
+ }\r
+\r
+ inline void CToolTip::UpdateTipText(LPCTSTR lpszText, CWnd* pWnd, UINT_PTR nIDTool /*= 0*/)\r
+ // Sets the ToolTip text for a tool.\r
+ {\r
+ assert(IsWindow());\r
+ assert(pWnd);\r
+ TOOLINFO ti;\r
+ LoadToolInfo(ti, pWnd, nIDTool);\r
+ ti.lpszText = (LPTSTR)lpszText;\r
+ SendMessage(TTM_UPDATETIPTEXT, 0, (LPARAM)&ti);\r
+ }\r
+\r
+ inline void CToolTip::UpdateTipText(UINT nIDText, CWnd* pWnd, UINT_PTR nIDTool /*= 0*/)\r
+ // Sets the ToolTip text for a tool.\r
+ {\r
+ assert(IsWindow());\r
+ assert(pWnd);\r
+ TOOLINFO ti;\r
+ LoadToolInfo(ti, pWnd, nIDTool);\r
+ ti.hinst = GetApp()->GetResourceHandle();\r
+ ti.lpszText = (LPTSTR)MAKEINTRESOURCE(nIDText);\r
+ SendMessage(TTM_UPDATETIPTEXT, 0, (LPARAM)&ti);\r
+ }\r
+\r
+#if (defined TTM_SETTITLE) && (_WIN32_IE >=0x0500)\r
+ inline BOOL CToolTip::AdjustRect(LPRECT lprc, BOOL bLarger /*= TRUE*/)\r
+ // Calculates a ToolTip control's text display rectangle from its window rectangle, or the \r
+ // ToolTip window rectangle needed to display a specified text display rectangle.\r
+ {\r
+ assert(IsWindow());\r
+ return (BOOL)SendMessage(TTM_ADJUSTRECT, bLarger, (LPARAM)lprc);\r
+ }\r
+\r
+ inline CSize CToolTip::GetBubbleSize(LPTOOLINFO lpToolInfo) const\r
+ // Returns the width and height of a ToolTip control.\r
+ {\r
+ assert(IsWindow());\r
+ LRESULT lr = SendMessage(TTM_GETBUBBLESIZE, (LPARAM)lpToolInfo);\r
+ CSize sz(LOWORD(lr), HIWORD(lr));\r
+ return sz;\r
+ }\r
+\r
+ inline BOOL CToolTip::SetTitle(UINT uIcon, LPCTSTR lpstrTitle)\r
+ // Adds a standard icon and title string to a ToolTip.\r
+ {\r
+ assert(IsWindow());\r
+ return (BOOL)SendMessage(TTM_SETTITLE, uIcon, (LPARAM)lpstrTitle);\r
+ }\r
+#endif\r
+\r
+#if (defined TTM_SETWINDOWTHEME) && (WINVER >= 0x0501)\r
+ inline HRESULT CToolTip::SetWindowTheme(LPCWSTR lpstrTheme)\r
+ // Sets the visual style of a ToolTip control.\r
+ {\r
+ assert(IsWindow());\r
+ SendMessage(TTM_SETWINDOWTHEME, 0, (LPARAM)lpstrTheme);\r
+ }\r
+#endif\r
+\r
+\r
+} // namespace Win32xx\r
+\r
+#endif // define _WIN32XX_CONTROLS_H_\r
+\r