1 2 3 #ifndef _RESOURCE_ITEM_ 4 #define _RESOURCE_ITEM_ 5 6 #include <afxcview.h> 7 8 class resource_tree; // forward reference 9 class resource_item_provider; 10 11 class resource_item 12 { 13 public: 14 resource_item(resource_tree *tree, res_info *get); 15 resource_item(resource_tree *tree, CString &name, CString &string_val); 16 17 ~resource_item(); 18 19 void Attach(resource_item *child); 20 void Detach(); 21 IsOpen()22 BOOL IsOpen() { return m_open;} IsVisible()23 BOOL IsVisible() { return m_visible;} 24 void Open(); 25 void Close(); 26 GetPos()27 CRect &GetPos() {return m_size;} 28 First()29 resource_item *First() {return m_first;} 30 resource_item* Last(); Next()31 resource_item *Next() {return m_next;} 32 resource_item *Previous(); 33 resource_item *SortFirst(); 34 resource_item *SortNext(resource_item *current); 35 Parent()36 resource_item *Parent() {return m_parent;} 37 38 resource_item* NavigateFirst(); 39 resource_item* NavigateLast(); 40 resource_item* NavigateNext(); 41 resource_item* NavigateParent(); 42 43 res_info *mpRes; 44 45 void Paint(CDC *dc); SetIndent(int Indent)46 void SetIndent(int Indent) {m_indent = Indent;} 47 void SetVisible(BOOL bVisible); 48 void SetIcon(int IconId, int IconIdHighlight = 0); SetPos(CRect & size)49 void SetPos(CRect &size) {m_size = size;} 50 void SetColorValue(GX_COLOR color); 51 void SetColorValue(BYTE red, BYTE green, BYTE blue); 52 void SetStringVal(CString &name, CString &val); 53 54 void RebuildPreview(); 55 56 int GetItemHeight(); 57 int GetHeight(); 58 int GetWidth(CDC *dc); 59 int LayoutFolderChildren(CDC *dc, int top); 60 int CheckClickCommand(CPoint &click); 61 GetStringId()62 CString &GetStringId() {return string_id;} 63 static COLORREF MakeColorRef(GX_COLOR val); 64 static int GetWin32CompatiblePixelWidth(int pixel_width, int color_format); GetColorRef()65 COLORREF GetColorRef() {return m_boxcolor;} 66 GX_COLOR GetRGBColor(int display_index = -1); 67 int GetResType(); 68 69 resource_item_provider* GetResItemProvider(); 70 CString GetName(); 71 CString GetDescription(); GetResTree()72 resource_tree* GetResTree() { return mpTree; } GetId()73 int GetId() { return m_Id; }; 74 resource_item* FindAddNewItem(); 75 76 private: 77 void Init(); 78 79 void MakeFontPreview(); 80 void MakePixelmapPreview(); 81 82 //int LayoutColorGrid(int top); 83 84 void PaintThemeHeader(CDC *dc); 85 86 void PaintIcon(CDC *dc, int icon_id, int x, int y); 87 void PaintGroupHeader(CDC *dc); 88 void PaintFolderHeader(CDC *dc); 89 90 void PaintColorGroupColumnHeader(CDC *dc); 91 void PaintColorItem(CDC *dc); 92 void PaintColorItemLines(CDC *dc, int offset); 93 94 void PaintFontGroupColumnHeader(CDC *dc); 95 void PaintFontItem(CDC *dc); 96 void PaintFontItemLines(CDC *dc, int offset); 97 98 void PaintPixelmapGroupColumnHeader(CDC *dc); 99 void PaintPixelmapItem(CDC *dc); 100 void PaintPixelmapItemLines(CDC *dc, int offset); 101 102 void PaintStringGroupColumnHeader(CDC *dc); 103 void PaintStringItem(CDC *dc); 104 void PaintStringItemLines(CDC *dc, int offset); 105 106 void PaintAddNewItem(CDC* dc); 107 108 void PaintHighlightRect(CDC* dc, CRect *rect); 109 BOOL IsSelected(); 110 BOOL IsAlphaFormat(int color_format); 111 112 BOOL m_selected; 113 BOOL m_visible; 114 BOOL m_open; 115 116 resource_tree *mpTree; 117 resource_item *m_next; 118 resource_item *m_first; 119 resource_item *m_parent; 120 121 UCHAR *m_preview_mem; 122 GX_BMP_INFO m_bitmap; 123 COLORREF m_boxcolor; 124 125 CString string_id; 126 CString display_id; 127 CString string_val; 128 129 CRect m_size; 130 int m_indent; 131 int m_icon_id; 132 int m_icon_id_highlight; 133 int m_icon_height; 134 int m_icon_width; 135 int m_string_arrow_icon_width; 136 137 CRect m_up_icon_rect; 138 CRect m_down_icon_rect; 139 140 int m_sys_dpi; 141 int m_item_height; 142 int m_header_height; 143 144 int m_font_preview_width; 145 int m_font_pixel_width; 146 int m_font_storage_width; 147 int m_pixelmap_dimension_width; 148 int m_pixelmap_storage_width; 149 int m_thumbnail_size; 150 int m_string_id_width; 151 152 resource_item_provider* m_pResItemProvider; 153 int m_Id; 154 }; 155 156 #endif