|
|
|
|
/**
|
|
|
|
|
* Copyright (C) 2014-2050 SOUI<EFBFBD>Ŷ<EFBFBD>
|
|
|
|
|
* All rights reserved.
|
|
|
|
|
*
|
|
|
|
|
* @file SItembox.h
|
|
|
|
|
* @brief
|
|
|
|
|
* @version v1.0
|
|
|
|
|
* @author soui
|
|
|
|
|
* @date 2014-07-03
|
|
|
|
|
*
|
|
|
|
|
* Describe
|
|
|
|
|
*/
|
|
|
|
|
#pragma once
|
|
|
|
|
#include <core/SPanel.h>
|
|
|
|
|
|
|
|
|
|
namespace SOUI
|
|
|
|
|
{
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* @class SItemBox
|
|
|
|
|
* @brief ItemBox
|
|
|
|
|
*
|
|
|
|
|
* Describe ItemBox
|
|
|
|
|
*/
|
|
|
|
|
class SItemBox
|
|
|
|
|
: public SScrollView
|
|
|
|
|
{
|
|
|
|
|
SOUI_CLASS_NAME(SItemBox, L"itembox")
|
|
|
|
|
public:
|
|
|
|
|
/**
|
|
|
|
|
* SItemBox::SItemBox
|
|
|
|
|
* @brief <EFBFBD><EFBFBD><EFBFBD>캯<EFBFBD><EFBFBD>
|
|
|
|
|
*
|
|
|
|
|
* Describe <EFBFBD><EFBFBD><EFBFBD>캯<EFBFBD><EFBFBD>
|
|
|
|
|
*/
|
|
|
|
|
SItemBox();
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* SItemBox::~SItemBox
|
|
|
|
|
* @brief <EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
|
|
|
|
*
|
|
|
|
|
* Describe <EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
|
|
|
|
*/
|
|
|
|
|
virtual ~SItemBox() {}
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* SItemBox::InsertItem
|
|
|
|
|
* @brief <EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
|
|
|
|
* @param LPCWSTR pszXml -- xml<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ļ<EFBFBD>
|
|
|
|
|
* @param int iItem -- <EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
|
|
|
|
* @param BOOL bEnsureVisible -- <EFBFBD>Ƿ<EFBFBD><EFBFBD><EFBFBD>ʾ
|
|
|
|
|
* @return <EFBFBD><EFBFBD><EFBFBD><EFBFBD>SWindow
|
|
|
|
|
*
|
|
|
|
|
* Describe <EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
|
|
|
|
*/
|
|
|
|
|
SWindow* InsertItem(LPCWSTR pszXml,int iItem=-1,BOOL bEnsureVisible=FALSE);
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* SItemBox::InsertItem
|
|
|
|
|
* @brief <EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
|
|
|
|
* @param LPCWSTR pszXml -- xml<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ļ<EFBFBD>
|
|
|
|
|
* @param int iItem -- <EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
|
|
|
|
* @param BOOL bEnsureVisible -- <EFBFBD>Ƿ<EFBFBD><EFBFBD><EFBFBD>ʾ
|
|
|
|
|
* @return <EFBFBD><EFBFBD><EFBFBD><EFBFBD>SWindow
|
|
|
|
|
*
|
|
|
|
|
* Describe <EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
|
|
|
|
*/
|
|
|
|
|
SWindow* InsertItem(pugi::xml_node xmlNode, int iItem=-1,BOOL bEnsureVisible=FALSE);
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* SItemBox::RemoveItem
|
|
|
|
|
* @brief ɾ<EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
|
|
|
|
* @param UINT iItem -- <EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
|
|
|
|
* @return <EFBFBD><EFBFBD><EFBFBD><EFBFBD>BOOL
|
|
|
|
|
*
|
|
|
|
|
* Describe ɾ<EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
|
|
|
|
*/
|
|
|
|
|
BOOL RemoveItem(UINT iItem);
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* SItemBox::RemoveItem
|
|
|
|
|
* @brief ɾ<EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
|
|
|
|
* @param SWindow * pChild -- <EFBFBD><EFBFBD><EFBFBD>ڽڵ<EFBFBD>
|
|
|
|
|
* @return <EFBFBD><EFBFBD><EFBFBD><EFBFBD>BOOL
|
|
|
|
|
*
|
|
|
|
|
* Describe ɾ<EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
|
|
|
|
*/
|
|
|
|
|
BOOL RemoveItem(SWindow * pChild);
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* SItemBox::SetNewPosition
|
|
|
|
|
* @brief <EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
|
|
|
|
* @param SWindow * pChild -- <EFBFBD>ڵ<EFBFBD>
|
|
|
|
|
* @param DWORD nPos -- λ<EFBFBD><EFBFBD>
|
|
|
|
|
* @param BOOL bEnsureVisible -- <EFBFBD>Ƿ<EFBFBD><EFBFBD><EFBFBD>ʾ
|
|
|
|
|
* @return <EFBFBD><EFBFBD><EFBFBD><EFBFBD>BOOL
|
|
|
|
|
*
|
|
|
|
|
* Describe <EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
|
|
|
|
*/
|
|
|
|
|
BOOL SetNewPosition(SWindow * pChild, DWORD nPos, BOOL bEnsureVisible = TRUE);
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* SItemBox::RemoveAllItems
|
|
|
|
|
* @brief ɾ<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
|
|
|
|
*
|
|
|
|
|
* Describe ɾ<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
|
|
|
|
*/
|
|
|
|
|
void RemoveAllItems();
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* SItemBox::GetItemCount
|
|
|
|
|
* @brief <EFBFBD><EFBFBD>ȡ<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
|
|
|
|
* @return UINT
|
|
|
|
|
*
|
|
|
|
|
* Describe <EFBFBD><EFBFBD>ȡ<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
|
|
|
|
*/
|
|
|
|
|
UINT GetItemCount();
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* SItemBox::PageUp
|
|
|
|
|
* @brief <EFBFBD><EFBFBD>һҳ
|
|
|
|
|
*
|
|
|
|
|
* Describe <EFBFBD><EFBFBD>һҳ
|
|
|
|
|
*/
|
|
|
|
|
void PageUp();
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* SItemBox::PageDown
|
|
|
|
|
* @brief <EFBFBD><EFBFBD>һҳ
|
|
|
|
|
*
|
|
|
|
|
* Describe <EFBFBD><EFBFBD>һҳ
|
|
|
|
|
*/
|
|
|
|
|
void PageDown();
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* SItemBox::EnsureVisible
|
|
|
|
|
* @brief <EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ʾ
|
|
|
|
|
* @param SWindow *pItem -- ij<EFBFBD><EFBFBD>ָ<EFBFBD><EFBFBD>
|
|
|
|
|
*
|
|
|
|
|
* Describe <EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ʾ
|
|
|
|
|
*/
|
|
|
|
|
void EnsureVisible(SWindow *pItem);
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* SItemBox::GetItemPos
|
|
|
|
|
* @brief <EFBFBD><EFBFBD>ȡij<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
|
|
|
|
* @return <EFBFBD><EFBFBD><EFBFBD><EFBFBD>int
|
|
|
|
|
*
|
|
|
|
|
* Describe <EFBFBD><EFBFBD>ȡij<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
|
|
|
|
*/
|
|
|
|
|
int GetItemPos(SWindow * lpCurItem);
|
|
|
|
|
|
|
|
|
|
protected:
|
|
|
|
|
int m_nItemWid; /**< Item<EFBFBD><EFBFBD><EFBFBD><EFBFBD> */
|
|
|
|
|
int m_nItemHei; /**< Item<EFBFBD>߶<EFBFBD>*/
|
|
|
|
|
int m_nSepWid; /**< */
|
|
|
|
|
int m_nSepHei; /**< */
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* SItemBox::UpdateScroll
|
|
|
|
|
* @brief <EFBFBD><EFBFBD><EFBFBD>¹<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
|
|
|
|
*
|
|
|
|
|
* Describe <EFBFBD><EFBFBD><EFBFBD>¹<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
|
|
|
|
*/
|
|
|
|
|
void UpdateScroll();
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* SItemBox::GetItemRect
|
|
|
|
|
* @brief <EFBFBD><EFBFBD>ȡij<EFBFBD><EFBFBD>λ<EFBFBD><EFBFBD>
|
|
|
|
|
* @param int iItem -- ij<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
|
|
|
|
* @return <EFBFBD><EFBFBD><EFBFBD><EFBFBD>int
|
|
|
|
|
*
|
|
|
|
|
* Describe <EFBFBD><EFBFBD>ȡij<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
|
|
|
|
*/
|
|
|
|
|
|
|
|
|
|
CRect GetItemRect(int iItem);
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* SItemBox::BringWindowAfter
|
|
|
|
|
* @brief <EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>½ڵ<EFBFBD>
|
|
|
|
|
* @param SWindow * pChild -- <EFBFBD>½ڵ<EFBFBD>
|
|
|
|
|
* @param SWindow * pInsertAfter -- λ<EFBFBD>ýڵ<EFBFBD>
|
|
|
|
|
*
|
|
|
|
|
* Describe <EFBFBD><EFBFBD>ij<EFBFBD><EFBFBD><EFBFBD>ڵ<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>½ڵ<EFBFBD>
|
|
|
|
|
*/
|
|
|
|
|
void BringWindowAfter(SWindow * pChild, SWindow * pInsertAfter);
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* SItemBox::OnSize
|
|
|
|
|
* @brief <EFBFBD><EFBFBD>Ϣ<EFBFBD><EFBFBD>Ӧ<EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
|
|
|
|
* @param UINT nType --
|
|
|
|
|
* @param CSize size --
|
|
|
|
|
*
|
|
|
|
|
* Describe <EFBFBD><EFBFBD>ȡij<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
|
|
|
|
*/
|
|
|
|
|
void OnSize(UINT nType, CSize size);
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* SItemBox::UpdateChildrenPosition
|
|
|
|
|
* @brief <EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ӽڵ<EFBFBD>λ<EFBFBD><EFBFBD>
|
|
|
|
|
*
|
|
|
|
|
* Describe <EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ӽڵ<EFBFBD>λ<EFBFBD><EFBFBD>
|
|
|
|
|
*/
|
|
|
|
|
virtual void UpdateChildrenPosition(){}//leave it empty
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* SItemBox::ReLayout
|
|
|
|
|
* @brief <EFBFBD><EFBFBD><EFBFBD>²<EFBFBD><EFBFBD><EFBFBD>
|
|
|
|
|
*
|
|
|
|
|
* Describe <EFBFBD><EFBFBD><EFBFBD>²<EFBFBD><EFBFBD><EFBFBD>
|
|
|
|
|
*/
|
|
|
|
|
void ReLayout();
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* SItemBox::OnScroll
|
|
|
|
|
* @brief <EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>¼<EFBFBD>
|
|
|
|
|
* @param BOOL bVertical -- <EFBFBD>Ƿ<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ֱ
|
|
|
|
|
* @param UINT uCode -- <EFBFBD><EFBFBD>Ϣ<EFBFBD><EFBFBD>
|
|
|
|
|
* @param int nPos -- λ<EFBFBD><EFBFBD>
|
|
|
|
|
* @retur <EFBFBD><EFBFBD><EFBFBD><EFBFBD>int
|
|
|
|
|
*
|
|
|
|
|
* Describe <EFBFBD><EFBFBD>ȡij<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
|
|
|
|
*/
|
|
|
|
|
virtual BOOL OnScroll(BOOL bVertical,UINT uCode,int nPos);
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* SItemBox::GetScrollLineSize
|
|
|
|
|
* @brief <EFBFBD><EFBFBD>ȡ<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>С
|
|
|
|
|
* @param BOOL bVertical -- <EFBFBD>Ƿ<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ֱ<EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
|
|
|
|
* @retur <EFBFBD><EFBFBD><EFBFBD><EFBFBD>int
|
|
|
|
|
*
|
|
|
|
|
* Describe <EFBFBD><EFBFBD>ȡ<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>С
|
|
|
|
|
*/
|
|
|
|
|
virtual int GetScrollLineSize(BOOL bVertical);
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* SItemBox::CreateChildren
|
|
|
|
|
* @brief <EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
|
|
|
|
* @param pugi::xml_node xmlNode
|
|
|
|
|
* @return <EFBFBD><EFBFBD><EFBFBD><EFBFBD>BOOL
|
|
|
|
|
*
|
|
|
|
|
* Describe <EFBFBD><EFBFBD>ȡij<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
|
|
|
|
*/
|
|
|
|
|
virtual BOOL CreateChildren(pugi::xml_node xmlNode);
|
|
|
|
|
|
|
|
|
|
SOUI_ATTRS_BEGIN()
|
|
|
|
|
ATTR_INT(L"itemWidth", m_nItemWid, TRUE)
|
|
|
|
|
ATTR_INT(L"itemHeight", m_nItemHei, TRUE)
|
|
|
|
|
ATTR_INT(L"sepWidth", m_nSepWid, TRUE)
|
|
|
|
|
ATTR_INT(L"sepHeight", m_nSepHei, TRUE)
|
|
|
|
|
SOUI_ATTRS_END()
|
|
|
|
|
|
|
|
|
|
SOUI_MSG_MAP_BEGIN()
|
|
|
|
|
MSG_WM_SIZE(OnSize)
|
|
|
|
|
SOUI_MSG_MAP_END()
|
|
|
|
|
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
}//namespace SOUI
|