#pragma once #include "ControlWZ.h" //*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*- // CCtrlListWZ Class //*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*- typedef std::multimap STD_SORT_MULTIMAP; typedef std::pair STD_SORT_PAIR_VAIUE; #ifdef UNICODE #define SetItemWZ SetItemWZW #else #define SetItemWZ SetItemWZA #endif #ifdef UNICODE #define SetItemTextWZ SetItemTextWZW #else #define SetItemTextWZ SetItemTextWZA #endif #ifdef UNICODE #define SetReportButtonInfo SetReportButtonInfoW #else #define SetReportButtonInfo SetReportButtonInfoA #endif #ifdef UNICODE #define GetReportButtonInfo GetReportButtonInfoW #else #define GetReportButtonInfo GetReportButtonInfoA #endif class CCtrlListWZ : public CControlWZ { public: struct CListSellData; typedef std::map ListBoxSellMap; //------------------------------------------------------------------------------ //! Qualifier: DrawListSell ÇÔ¼ö¿¡¼­ ÄݹéÀ¸·Î È£Ãâ //! Parameter: CCtrlListWZ* list_control : ¸®½ºÆ® ÄÜÆ®·Ñ //! Parameter: CListSellData* sell_data : ±×·ÁÁú ¼¿ //! Parameter: int sell_index : ±×·ÁÁú ¼¿(·¹ÄÚµå) ¹øÈ£ //! Parameter: RECT& render_area : ±×·ÁÁú ¿µ¿ª typedef void (*fn_CallbackListBoxSellDraw)(CCtrlListWZ* list_control, CListSellData* sell_data, int sell_index, RECT& render_area); //! List Sell Á¤º¸ ±¸Á¶Ã¼. struct CListSellData { CListSellData() { BKColor = RGBA(0,0,0,0); SelFontColor = RGBA(217,128,0,255); FontColor = RGBA(255,255,255,255); dwTextStyle = DT_LEFT | DT_VCENTER; dwFontID = 0; user_data = NULL; callback_draw = NULL; } COLORREF BKColor; COLORREF FontColor; COLORREF SelFontColor; STD_STRING stdStrText; DWORD dwFontID; DWORD dwTextStyle; //! »ç¿ëÀÚ µ¥ÀÌÅ͸¦ ÀúÀåÇÒ¼ö ÀÖ´Â °ø°£ void* user_data; //! DrawListSell ¿¡¼­ Äݹé ÇÔ¼öÈ£Ãâ //! callback_draw != NULL À̸é sell¿¡ ÀÖ´Â ¸ðµç Á¤º¸¸¦ Äݹ鿡¼­ ±×¸² fn_CallbackListBoxSellDraw callback_draw; }; struct CListData {//. ¸®½ºÆ® µ¥ÀÌŸ ±¸Á¶Ã¼. CListData() { m_nMapCnt = 0; m_pVoid = NULL; } ~CListData() { ListBoxSellMap::iterator it = m_stdMapSellData.begin(); ListBoxSellMap::iterator end = m_stdMapSellData.end(); for(; it != end; ++it) { CListSellData* pSell = (CListSellData*)it->second; if(pSell) { delete pSell; pSell = NULL; } } m_stdMapSellData.clear(); } //. ¸®½ºÆ® Á¤º¸¸¦ Ãß°¡ ÇÏ´Â ÇÔ¼ö. bool Add(LPCSTR pszSZ, DWORD dwFontID=0, DWORD dwStyle=DT_LEFT|DT_VCENTER, COLORREF rgbBK=RGBA(255,255,255,255), COLORREF rgbText=RGBA(0,0,0,255), COLORREF rgbSelText=RGBA(255,255,255,255)) { CListSellData* pSell = new CListSellData; pSell->stdStrText = pszSZ; pSell->dwFontID = dwFontID; pSell->dwTextStyle = dwStyle; pSell->BKColor = rgbBK; pSell->FontColor = rgbText; pSell->SelFontColor = rgbSelText; m_stdMapSellData[m_nMapCnt++] = pSell; return true; } //. ¸®½ºÆ® Á¤º¸¸¦ Ãß°¡ ÇÏ´Â ÇÔ¼ö. bool Add(int nSubIndex, LPCSTR pszSZ, DWORD dwFontID = 0, DWORD dwStyle = DT_LEFT|DT_VCENTER, COLORREF rgbBK = RGBA(0,0,0,0), COLORREF rgbText = RGBA(255,255,255,255), COLORREF rgbSelText = RGBA(217,128,0,255)) { ListBoxSellMap::iterator it = m_stdMapSellData.find(nSubIndex); CListSellData* pSell = NULL; if(it == m_stdMapSellData.end()) { pSell = new CListSellData; } else { pSell = (CListSellData*)it->second; } pSell->stdStrText = pszSZ; pSell->dwFontID = dwFontID; pSell->dwTextStyle = dwStyle; pSell->BKColor = rgbBK; pSell->FontColor = rgbText; pSell->SelFontColor = rgbSelText; m_stdMapSellData[nSubIndex] = pSell; return true; } void SetDataPtr(VOID* ptr) { m_pVoid = ptr; } VOID* GetDataPtr() { return m_pVoid; } DWORD m_nMapCnt; //!< Map Ä«¿îÆ® ListBoxSellMap m_stdMapSellData; //!< CListSellData VOID* m_pVoid; //!< ÀÓÀÌÀÇ °ªÀ» °¡Áö°í Àִ´Ù. }; public: CCtrlListWZ(); virtual ~CCtrlListWZ(); virtual bool OnCreate(DWORD dwCtrlID,DWORD dwStyle,HWND hParentWnd,HINSTANCE hInstance,RECT* rtSize,void* pDraw); virtual void OnDestroy(); virtual bool OnDraw(bool bl); virtual void OnInitialize(); virtual bool MoveWindowWZ(float fx, float fy, float fWidth, float fHeight); virtual void UpdateWindowWZ(HWND hParent); virtual void ReleaseImage(); virtual void OnLoad(HANDLE hHandle); virtual void OnSave(HANDLE hHandle); virtual void EnableWindowWZ(bool bState); public: virtual void SetReportUseCnt(short nRowCnt); //. Report »ç¿ë °¹¼ö¸¦ ¼³Á¤ÇÑ´Ù. virtual short GetReportUseCnt(); virtual void SetSellHeight(int nHeight); //. »øÀÇ ³ôÀ̰ªÀ» ¼³Á¤ÇÑ´Ù. µðÆúÆ®´Â 20 ÀÌ´Ù. virtual int GetSellheight(); //. ¼¿ ³ôÀ̰ªÀ» ¸®ÅÏÇØÁØ´Ù. virtual int InsertItemBack(); //. µÚ¿¡ List Info¸¦ ¸¸µé¾î »ðÀÔÇÑ´Ù. virtual int InsertItemFront(); //. ¾Õ¿¡ List Info¸¦ ¸¸µé¾î »ðÀÔÇÑ´Ù. virtual bool SetItemWZA(int nIndex, LPCSTR pszText, DWORD dwFontID, DWORD dwTextStyle, COLORREF BKColor, COLORREF TextColor, COLORREF SelTextColor); virtual bool SetItemWZA(int nIndex, int nSubIndex, LPCSTR pszText, DWORD dwFontID, DWORD dwTextStyle, COLORREF BKColor, COLORREF TextColor, COLORREF SelTextColor); virtual bool SetItemWZW(int nIndex, LPCWSTR pwszText, DWORD dwFontID, DWORD dwTextStyle, COLORREF BKColor, COLORREF TextColor, COLORREF SelTextColor); virtual bool SetItemWZW(int nIndex, int nSubIndex, LPCWSTR pwszText, DWORD dwFontID, DWORD dwTextStyle, COLORREF BKColor, COLORREF TextColor, COLORREF SelTextColor); virtual bool SetItemTextWZA(int nIndex, LPCSTR pszSZ); //. List Index, ¸ÇµÚ¿¡ Text »ðÀÔ virtual bool SetItemTextWZA(int nIndex, int nSubIndex, LPCSTR pszSZ); //. ListÀÇ Text »ðÀÔ virtual bool SetItemTextWZW(int nIndex, LPCWSTR pwszSZ); //. List Index, ¸ÇµÚ¿¡ Text »ðÀÔ virtual bool SetItemTextWZW(int nIndex, int nSubIndex, LPCWSTR pwszSZ); //. ListÀÇ Text »ðÀÔ virtual bool SetItemBKColor(int nIndex, int nSubIndex, COLORREF BKColor); virtual bool SetItemTextColor(int nIndex, int nSubIndex, COLORREF TextColor); virtual bool SetItemSelTextColor(int nIndex, int nSubIndex, COLORREF SelTextColor); virtual bool SetItemUserData(int nIndex, int nSubIndex, void* user_data); virtual void* GetItemUserData(int nIndex, int nSubIndex); virtual bool SetItemCallbackDraw(int nIndex, int nSubIndex, fn_CallbackListBoxSellDraw fn); virtual bool SetItemFontID(int nIndex, int nSubIndex, DWORD dwFontID); virtual bool SetItemFontID(int nIndex, int nSubIndex, LPCSTR pszFontID){WzAssert(!"»ç¿ë¾ÈÇÔ : SetItemFontID(int nIndex, int nSubIndex, DWORD dwFontID)·Î »ç¿ë ¹Ù¶÷!");return false;} //.Àӽà ÄÚµå Á¶¸¸°£ »èÁ¦ virtual bool SetItemTextStyle(int nIndex, int nSubIndex, DWORD dwTextStyle); virtual bool SetItemData(int nIndex, VOID* pVoid); virtual VOID* GetItemData(int nIndex); virtual LPCTSTR GetItemText(int nIndex, int nSubIndex); virtual BOOL DeleteItem(int nIndex); virtual void DeleteItemAll(); virtual void SetReportButtonInfoA(int nIndex, int nLength, LPCSTR pszText, const DWORD dwTextStyle = 0); virtual void SetReportButtonInfoW(int nIndex, int nLength, LPCWSTR pwszText, const DWORD dwTextStyle = 0); virtual bool GetReportButtonInfoA(int nIndex, OUT int* pnLength, OUT LPSTR pszText, int nBufferLength, OUT DWORD* pdwTextStyle = NULL); virtual bool GetReportButtonInfoW(int nIndex, OUT int* pnLength, OUT LPWSTR pwszText, int nBufferLength, OUT DWORD* pdwTextStyle = NULL); public: virtual void SelectReportButton(int nSel); virtual void SetBeginDrawIndex(int nBegin); virtual int GetBeginDrawIndex() { return m_nBegin; } virtual void SetRoportButtonImageFormat(SI_TFORMAT* pFormat); //. Roport ¹öưÀÇ À̹ÌÁö Á¤º¸¸¦ ¼ÂÆÃ ÇØÁØ´Ù. virtual SI_TFORMAT* GetRoportButtonImageFormat(); //. Report ¹öưÀÇ ¹Ì¹ÌÁö Á¤º¸¸¦ ³Ñ°ÜÁÖ³®. virtual void SetCurSel(int nSel); //. ¼¿ ¼±Åà virtual int GetCurSel(); virtual void SetOverSel(int nSel) { m_nOverSel = nSel; } virtual int GetOverSel() { return m_nOverSel; } virtual void SetReportIsOutline(bool blIs); virtual bool GetReportIsOutline(); virtual void SetReportOutlineColor(COLORREF rgb); virtual COLORREF GetReportOutlineColor(); virtual bool GetUseReport(); virtual void SetUseReport(bool blUse); virtual int GetListRowCnt(); virtual int GetDrawRowCount(); //. color¸¦ º¯°æ ÇØÁÖ´Â ÇÔ¼öµé. virtual void SetColorText(COLORREF rgb); COLORREF GetColorText(){return m_rgbTextColor;} virtual void SetColorSelBar(COLORREF rgb); virtual void SetColorSelBarOnText(COLORREF rgb); //. FontID °ü·Ã ÇÔ¼öµé. virtual void SetFontID(DWORD dwFontID); virtual DWORD GetFontID(); virtual void SetUnuseSelBar(bool bl); //. ±Û¾¾ ¸ð¾çÀÇ Á¾·ù ¼³Á¤.(±âº», ±×¸²ÀÚ, Å׵θ®) virtual void SetTextKind(ENUM_TEXT_KIND eTK); virtual ENUM_TEXT_KIND GetTextKind(); void SetTextOutlineColor(COLORREF rgbColor){m_rgbTextOutlineColor = rgbColor;} COLORREF GetTextOutlineColor(){return m_rgbTextOutlineColor;} //. Report °ü·Ã ÇÔ¼öµé. void SetHideReportRender(bool blFlag){m_blHideReportRender=blFlag;} bool GetHideReportRender(){return m_blHideReportRender;} virtual void SetReportHeight(int nHeight); int GetReportHeight(){return m_nReportHeight;} void SetReportSortOn(bool bOn){ m_bResportSortOn = bOn; } bool GetReportSortOn(){ return m_bResportSortOn; } virtual void SetStartLineGapTop( int gap ) { m_nStartLineGapTop = gap; } virtual void SetStartLineGapLeft( int gap ) { m_nStartLineGapLeft = gap; } virtual void SetStartLineGapRight( int gap ) { m_nStartLineGapRight = gap; } void SetUseRButtonSelect(bool bUse) { m_bUseRButtonSelect = bUse; } void SetDrawTextUnderLineOverSell(bool draw_underline) { draw_underline_ = draw_underline;} bool GetDrawTextUnderLineOverSell() { return draw_underline_; } virtual bool IsTextReducing() const { return m_bTextReducing; } virtual void SetTextReducing(bool bReducing) { m_bTextReducing = bReducing; } protected: //. Mouse °ü·Ã ÇÔ¼öµé. virtual bool Message_MouseLButtonDown(SI_MESSAGE* pMsg); virtual bool Message_MouseLButtonUp(SI_MESSAGE* pMsg); virtual bool Message_MouseMove(SI_MESSAGE* pMsg); virtual bool Message_MouseRButtonDown(SI_MESSAGE* pMsg); VOID* GetReportButtonInfoPtr(int nIndex); VOID* GetListInfoDataToIndex(int nIndex); int UpdateListDate(VOID* pLD); int GetIndexToListDataPtr(VOID* pLD); void DrawListSell(int nSellCnt, CListSellData* pSell, RECT rtRect); void DrawListData(int nSellCnt, VOID* pVoid, int nHeight); //int ComputeCurSel(POINT point); int ComputeSel(POINT point); protected: int m_nBegin; //.Draw Begin. int m_nEnd; //.Draw End. int m_nReportUseCnt; //.ReportÀǰ¹¼ö. //int m_nLDataCnt; //.List data °¹¼ö. int m_nCurSelBT; //.SelectµÈ Report ¹öư. //int m_nDrawSelCnt; //.±×¸±¼ö ÀÖ´Â ÁÙ¼ö. int m_nStartLineGapTop; //.óÀ½ µå·Î¿ì½Ã µÎ´Â °£°Ý int m_nStartLineGapLeft; // ¿ÞÂÊ gap int m_nStartLineGapRight; // ¿À¸¥ÂÊ gap int m_nCurSel; //.ÇöÀç ¼±Åà µÈ ¼¿. int m_nOverSel; //.ÇöÀç ¸¶¿ì½º µÈ ¼¿. std::map m_StdButtonMap; //.Button Map. STD_SORT_MULTIMAP m_StdSortMap; //.Á¤·ÄÇØÁÖ±â À§ÇÑ ¸Ê. std::list m_StdDataList; //.Á¤º¸ ±¸Á¶Ã¼¸¦ °¡Áö°í Àִ´Ù. DWORD m_dwFontID; BOOL m_blGreater; //. true: ³»¸²Â÷¼ø, false: ¿Ã¸²Â÷¼ø. BOOL m_blSelChange; //. ¼¿ º¯°æ ¿ª¿ªÀ» Ŭ¸¯ ÇßÀ»¶§ True; POINT m_poLBDown; //. ¸¶¿ì½º LButtonDown Point HCURSOR m_hOldCursor; SI_FRECT m_sSrcRect; bool m_blUseReport; //. Report buttonÀ» »ç¿ëÇÏ³Ä OR ¾È Çϳª. COLORREF m_rgbTextColor; //. ±ÛÂ¥ »ö±ò. COLORREF m_rgbSelBarColor; //. ¼±Åù٠»ö±ò. COLORREF m_rgbSelBarOnTextColor; //. ¼±Åùٰ¡ À§¿¡ ÀÖÀ»¶§ ±Û¾¾ »ö±ò. COLORREF m_rgbTextOutlineColor; bool m_blUnuseSelBar; bool m_blHideReportRender; int m_nSellHeight; int m_nReportHeight; //. ¸®Æ÷Æ® ¹öư ³ôÀÌ. ENUM_TEXT_KIND m_eTextKind; bool m_bResportSortOn; bool m_bUseRButtonSelect; bool draw_underline_; //! ¹®ÀÚ¿­ÀÌ Ä¸¼Ç ¿µ¿ªÀ» ³Ñ¾î °¬À»´ë "..." À¸·Î Ç¥½Ã ÇÒ°ÇÁö¿©ºÎ bool m_bTextReducing; };