00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022
00023
00024
00025
00026
00027
00028
00029
00030
00031
00032
00033
00034
00035
00036
00037
00038
00039
00040
00041
00042
00043
00044
00045
00046
00047
00048
00049
00050
00051
00052
00053
00054
00055
00056
00057
00058
00059
00060
00061
00062
00063
00064
00065
00066
00067
00068
00069
00070
00071
00072
00073
00074
00075
00076
00077
00078
00079
00080
00081
00082
00083
00084
00085
00086
00087
00088
00089
00090
00091
00092
00093
00094
00095
00096
00097
00098 #if !defined(AFX_CUSTOMLIST_H__32AE552D_C07B_4C09_9030_AB20E842FFD6__INCLUDED_)
00099 #define AFX_CUSTOMLIST_H__32AE552D_C07B_4C09_9030_AB20E842FFD6__INCLUDED_
00100
00101 #if _MSC_VER > 1000
00102 #pragma once
00103 #endif // _MSC_VER > 1000
00104
00105
00106
00107 class CCustomListScrollableArea;
00108 class CCustomListRowWnd;
00109
00111
00112
00113
00114 class CCustomList : public CWnd
00115 {
00116 friend class CCustomListScrollableArea;
00117 friend class CCustomListRowWnd;
00118 public:
00119
00120 static const INT32 MAXCOLUMNS ;
00121 static const INT32 MAXROWS ;
00122 static const INT32 FONTHEIGHT;
00123 static const INT32 ROWHEIGHT ;
00124 static const INT32 COLOUR_PATCH_WIDTH ;
00125 static const INT32 COLOUR_PATCH_HEIGHT;
00126 static const CString WNDCLASSNAME;
00127
00128
00129 public:
00130
00131 CCustomList();
00132 virtual ~CCustomList();
00133 static BOOL RegisterWindowClass();
00134 static LRESULT CALLBACK EXPORT CustomWindowProc(HWND hWnd, UINT32 nMsg, WPARAM wParam,LPARAM lParam);
00135 void SetColumnWidth(INT32 colnum,INT32 offset);
00136
00137
00138
00139
00140 static CCustomList* GetGadget(CWindowID parentID, CGadgetID gadgetID);
00141 BOOL CreateCustomHeader (UINT32 bitmapID);
00142
00143 BOOL GetSwitchState(UINT32 itemIndex, UINT32 switchIndex) const;
00144 INT32 GetItemCount() const;
00145 BOOL GetItemString(StringBase& itemString, UINT32 itemIndex, UINT32 columnIndex) const;
00146 INT32 GetSelectedItemIndex() const;
00147
00148 BOOL AddItem(StringBase& itemString, KernelBitmap* pItemImage = 0);
00149 BOOL AddItem(StringBase& itemString, UINT32 bitmapEnabledID, UINT32 bitmapDisabledID);
00150 BOOL AddRefsItem(UINT32 idStatusBitmap, StringBase& strItemName, StringBase& strDetails);
00151 BOOL AddColourListItem(StringBase& colourName, INT32 red, INT32 green, INT32 blue, BOOL IsSpotColour = FALSE);
00152 BOOL SetSwitchState(BOOL state, UINT32 itemIndex, UINT32 switchIndex);
00153 void SetSelectedItemIndex(INT32 NewSel);
00154 BOOL SetItemString(StringBase& itemString, UINT32 itemIndex, UINT32 columnIndex);
00155 BOOL SetEnabled(BOOL enabled);
00156 BOOL DeleteAllItems();
00157
00158 protected:
00159
00160 protected:
00161 virtual void PostNcDestroy();
00162
00163
00164
00165 afx_msg INT32 OnCreate(LPCREATESTRUCT lpCreateStruct);
00166 afx_msg void OnVScroll(UINT32 nSBCode, UINT32 nPos, CScrollBar* pScrollBar);
00167 afx_msg void OnSetFocus(CWnd* pOldWnd);
00168 afx_msg BOOL OnMouseWheel(UINT32 nFlags, short zDelta, CPoint pt);
00169
00170 DECLARE_MESSAGE_MAP()
00171 private:
00172
00173 void NewScrollableArea();
00174 CScrollBar* GetVScrollBar() const {return m_VScrollBar;}
00175 CCustomListScrollableArea* GetScrollableArea() const {return m_ScrollableArea;}
00176
00177 CCustomListScrollableArea* m_ScrollableArea;
00178 CScrollBar* m_VScrollBar;
00179 INT32* m_ColumnOffsetsArray;
00180 CBitmap m_hHeaderBitmap;
00181 CStatic m_hHeader;
00182 };
00183
00185
00186
00187
00188 class CCustomListScrollableArea : public CWnd
00189 {
00190 friend class CCustomListRowWnd;
00191 friend class CCustomList;
00192 ;
00193 protected:
00194
00195 CCustomListScrollableArea(CCustomList* parent);
00196 virtual ~CCustomListScrollableArea();
00197
00198 CCustomListRowWnd* AddRow();
00199 void SelectRow(INT32 RowNum);
00200 void HandleScrollMessage(UINT32 nSBCode, UINT32 nPos);
00201 CCustomListRowWnd* GetRow(INT32 row);
00202 INT32 GetHeight() const {return m_RowCount * CCustomList::ROWHEIGHT ;}
00203
00204
00205
00206 protected:
00207
00208
00209 protected:
00210 virtual void PostNcDestroy();
00211
00212
00213 afx_msg void OnSize(UINT32 nType, INT32 cx, INT32 cy);
00214
00215 DECLARE_MESSAGE_MAP()
00216
00217 private:
00218 CCustomListRowWnd** m_ListRowsArray;
00219 INT32 m_ScrollPos ;
00220 INT32 m_CurrentSelectedRow;
00221 CFont m_Font;
00222 INT32 m_RowCount;
00223 CCustomList* m_Parent;
00224 };
00225
00227
00228
00229
00230 class CCustomListRowWnd : public CWnd
00231 {
00232 friend CCustomListScrollableArea;
00233 public:
00234
00235 CCustomListRowWnd (INT32 i, CCustomListScrollableArea* parent);
00236 virtual ~CCustomListRowWnd();
00237
00238 void AddText(INT32 col, CString text);
00239 void SetText(INT32 col, CString text);
00240 void AddCheck(INT32 col);
00241 void AddBitmap(INT32 col, HBITMAP bmp1, HBITMAP bmp2, DWORD dwBackColour=0xFFFFFFFF);
00242 void SetChecked(INT32 col,BOOL checked);
00243 bool IsChecked(INT32 col) const;
00244 CString GetText(INT32 col) const;
00245
00246 private:
00247 HBRUSH GetBackgroundBrush(){return (m_Selected ? m_BackBrushSel:m_BackBrush ); }
00248
00249 const INT32 m_RowNum;
00250 CCustomListScrollableArea* m_Parent;
00251 CBrush m_BackBrush;
00252 CBrush m_BackBrushSel;
00253 CObject** m_ColumnObjects;
00254 bool m_Selected;
00255
00256
00257 protected:
00258
00259
00260
00261
00262 protected:
00263 virtual BOOL OnCommand(WPARAM wParam, LPARAM lParam);
00264 virtual void PostNcDestroy();
00265
00266
00267
00268
00269
00270 afx_msg void OnLButtonUp(UINT32 nFlags, CPoint point);
00271 afx_msg BOOL OnEraseBkgnd(CDC* pDC);
00272 afx_msg HBRUSH OnCtlColor(CDC* pDC, CWnd* pWnd, UINT32 nCtlColor);
00273 afx_msg void OnLButtonDblClk(UINT32 nFlags, CPoint point);
00274 afx_msg void OnKeyDown(UINT32 nChar, UINT32 nRepCnt, UINT32 nFlags);
00275 afx_msg UINT32 OnGetDlgCode();
00276 afx_msg void OnDestroy();
00277
00278 DECLARE_MESSAGE_MAP()
00279 };
00280
00281
00282
00283
00284
00285 #endif // !defined(AFX_CUSTOMLIST_H__32AE552D_C07B_4C09_9030_AB20E842FFD6__INCLUDED_)