1 /* 2 * Copyright 2003, 2004 Martin Fuchs 3 * 4 * This library is free software; you can redistribute it and/or 5 * modify it under the terms of the GNU Lesser General Public 6 * License as published by the Free Software Foundation; either 7 * version 2.1 of the License, or (at your option) any later version. 8 * 9 * This library is distributed in the hope that it will be useful, 10 * but WITHOUT ANY WARRANTY; without even the implied warranty of 11 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 12 * Lesser General Public License for more details. 13 * 14 * You should have received a copy of the GNU Lesser General Public 15 * License along with this library; if not, write to the Free Software 16 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA 17 */ 18 19 20 // 21 // Explorer clone 22 // 23 // pane.h 24 // 25 // Martin Fuchs, 23.07.2003 26 // 27 28 29 #define IDW_TREE_LEFT 3 30 #define IDW_TREE_RIGHT 6 31 #define IDW_HEADER_LEFT 2 32 #define IDW_HEADER_RIGHT 5 33 34 35 enum COLUMN_FLAGS { 36 COL_TYPE = 0x0001, 37 COL_SIZE = 0x0002, 38 COL_DATE = 0x0004, 39 COL_TIME = 0x0008, 40 COL_ATTRIBUTES = 0x0010, 41 COL_DOSNAMES = 0x0020, 42 COL_INDEX = 0x0040, 43 COL_LINKS = 0x0080, 44 COL_CONTENT = 0x0100, 45 COL_ALL = COL_TYPE|COL_SIZE|COL_DATE|COL_TIME|COL_ATTRIBUTES|COL_DOSNAMES|COL_INDEX|COL_LINKS|COL_CONTENT 46 }; 47 48 49 /// Worker for drawing contents of file lists in child pane 50 struct OutputWorker 51 { 52 OutputWorker(); 53 54 void init_output(HWND hwnd); 55 void output_text(LPDRAWITEMSTRUCT dis, int* positions, int col, LPCTSTR str, DWORD flags); 56 void output_tabbed_text(LPDRAWITEMSTRUCT dis, int* positions, int col, LPCTSTR str); 57 void output_number(LPDRAWITEMSTRUCT dis, int* positions, int col, LPCTSTR str); 58 59 SIZE _spaceSize; 60 TCHAR _num_sep; 61 HFONT _hfont; 62 }; 63 64 65 /// child window pane for displaying file lists 66 struct Pane : public SubclassedWindow 67 { 68 typedef SubclassedWindow super; 69 70 Pane(HWND hparent, int id, int id_header, Entry* rool, bool treePane, int visible_cols); 71 ~Pane(); 72 73 #define COLUMNS 12 74 int _widths[COLUMNS]; 75 int _positions[COLUMNS+1]; 76 77 WindowHandle _hwndHeader; 78 79 Entry* _root; 80 Entry* _cur; 81 82 COLORREF _clrCompressed; 83 84 int _visible_cols; 85 bool _treePane; 86 87 void init(); 88 void set_header(); 89 bool create_header(HWND parent, int id); 90 91 bool calc_widths(bool anyway); 92 void calc_single_width(int col); 93 void draw_item(LPDRAWITEMSTRUCT dis, Entry* entry, int calcWidthCol=-1); 94 95 int insert_entries(Entry* dir, int idx=-1); 96 BOOL command(UINT cmd); 97 virtual int Notify(int id, NMHDR* pnmh); 98 99 protected: 100 virtual LRESULT WndProc(UINT nmsg, WPARAM wparam, LPARAM lparam); 101 102 void calc_width(LPDRAWITEMSTRUCT dis, int col, LPCTSTR str); 103 void calc_tabbed_width(LPDRAWITEMSTRUCT dis, int col, LPCTSTR str); 104 struct MainFrameBase* get_frame(); 105 106 protected: 107 HIMAGELIST _himl; 108 OutputWorker _out_wrkr; 109 }; 110 111