update for HEAD-2003091401
[reactos.git] / subsys / system / explorer / shell / pane.h
1 /*
2  * Copyright 2003 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., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
17  */
18
19
20  //
21  // Explorer clone
22  //
23  // pane.h
24  //
25  // Martin Fuchs, 23.07.2003
26  //
27
28
29 #define COLOR_COMPRESSED        RGB(0,0,255)
30 #define COLOR_SELECTION         RGB(0,0,128)
31
32
33 #define IDW_TREE_LEFT           3
34 #define IDW_TREE_RIGHT          6
35 #define IDW_HEADER_LEFT         2
36 #define IDW_HEADER_RIGHT        5
37
38
39 enum COLUMN_FLAGS {
40         COL_SIZE                = 0x01,
41         COL_DATE                = 0x02,
42         COL_TIME                = 0x04,
43         COL_ATTRIBUTES  = 0x08,
44         COL_DOSNAMES    = 0x10,
45         COL_INDEX               = 0x20,
46         COL_LINKS               = 0x40,
47         COL_ALL = COL_SIZE|COL_DATE|COL_TIME|COL_ATTRIBUTES|COL_DOSNAMES|COL_INDEX|COL_LINKS
48 };
49
50
51 struct OutputWorker
52 {
53         OutputWorker();
54
55         void    init_output(HWND hwnd);
56         void    output_text(LPDRAWITEMSTRUCT dis, int* positions, int col, LPCTSTR str, DWORD flags);
57         void    output_tabbed_text(LPDRAWITEMSTRUCT dis, int* positions, int col, LPCTSTR str);
58         void    output_number(LPDRAWITEMSTRUCT dis, int* positions, int col, LPCTSTR str);
59
60         SIZE    _spaceSize;
61         TCHAR   _num_sep;
62         HFONT   _hfont;
63 };
64
65
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
72 #define COLUMNS 10
73         int     _widths[COLUMNS];
74         int     _positions[COLUMNS+1];
75                 
76         WindowHandle _hwndHeader;
77
78         bool    _treePane;
79         int     _visible_cols;
80         Entry*  _root;
81         Entry*  _cur;
82
83         void    init();
84         void    set_header();
85         bool    create_header(HWND parent, int id);
86
87         bool    calc_widths(bool anyway);
88         void    calc_single_width(int col);
89         void    draw_item(LPDRAWITEMSTRUCT dis, Entry* entry, int calcWidthCol=-1);
90
91         void    insert_entries(Entry* dir, int idx);
92         BOOL    command(UINT cmd);
93         int             Notify(int id, NMHDR* pnmh);
94
95 protected:
96         LRESULT WndProc(UINT nmsg, WPARAM wparam, LPARAM lparam);
97
98         void    calc_width(LPDRAWITEMSTRUCT dis, int col, LPCTSTR str);
99         void    calc_tabbed_width(LPDRAWITEMSTRUCT dis, int col, LPCTSTR str);
100         MainFrame* get_frame();
101
102 protected:
103         HIMAGELIST      _himl;
104         OutputWorker _out_wrkr;
105 };
106