]>
Commit | Line | Data |
---|---|---|
97647369 RC |
1 | /* |
2 | * Copyright (c) 2002 Robert Collins. | |
3 | * | |
4 | * This program is free software; you can redistribute it and/or modify | |
5 | * it under the terms of the GNU General Public License as published by | |
6 | * the Free Software Foundation; either version 2 of the License, or | |
7 | * (at your option) any later version. | |
8 | * | |
9 | * A copy of the GNU General Public License can be found at | |
10 | * http://www.gnu.org/ | |
11 | * | |
12 | * Written by Robert Collins <robertc@hotmail.com> | |
13 | * | |
14 | */ | |
15 | ||
16 | #ifndef _PICKVIEW_H_ | |
17 | #define _PICKVIEW_H_ | |
18 | ||
19 | #include "win32.h" | |
20 | ||
21 | #define HMARGIN 10 | |
22 | #define ROW_MARGIN 5 | |
23 | #define ICON_MARGIN 4 | |
24 | #define RTARROW_WIDTH 11 | |
25 | #define SPIN_WIDTH 11 | |
26 | #define NEW_COL_SIZE_SLOP (ICON_MARGIN + SPIN_WIDTH + RTARROW_WIDTH) | |
27 | ||
28 | #define CHECK_SIZE 11 | |
29 | ||
30 | class PickView; | |
31 | #include "PickCategoryLine.h" | |
32 | #include "package_meta.h" | |
33 | ||
34 | class PickView | |
35 | { | |
36 | public: | |
37 | class views; | |
38 | class Header; | |
39 | int num_columns; | |
40 | views get_view_mode () | |
41 | { | |
42 | return view_mode; | |
43 | }; | |
44 | void set_view_mode (views _mode); | |
45 | Header *headers; | |
46 | PickView (views mode, HWND listview, Category & cat); | |
47 | const char *mode_caption (); | |
48 | void insert_pkg (packagemeta &); | |
49 | void insert_category (Category *, bool); | |
50 | void clear_view (void); | |
51 | int click (int row, int x); | |
52 | int current_col; | |
53 | int new_col; | |
54 | int src_col; | |
55 | int cat_col; | |
56 | int pkg_col; | |
57 | int last_col; | |
58 | int row_height; | |
59 | TEXTMETRIC tm; | |
60 | HDC bitmap_dc; | |
61 | HANDLE bm_spin,bm_rtarrow, bm_checkyes, bm_checkno, bm_checkna; | |
62 | trusts deftrust; | |
63 | HANDLE sysfont; | |
64 | int scroll_ulc_x, scroll_ulc_y; | |
65 | int header_height; | |
66 | PickCategoryLine contents; | |
67 | void scroll (HWND hwnd, int which, int *var, int code); | |
68 | HWND ListHeader (void) const | |
69 | { | |
70 | return listheader; | |
71 | } | |
72 | ||
73 | ||
74 | class views | |
75 | { | |
76 | public: | |
77 | static const views Unknown; | |
78 | static const views PackageFull; | |
79 | static const views Package; | |
80 | static const views Category; | |
81 | static const views NView; | |
82 | views ():_value (0) | |
83 | { | |
84 | }; | |
85 | views (int aInt) | |
86 | { | |
87 | _value = aInt; | |
88 | if (_value < 0 || _value > 3) | |
89 | _value = 0; | |
90 | } | |
91 | views & operator++ (); | |
92 | bool operator == (views const &rhs) | |
93 | { | |
94 | return _value == rhs._value; | |
95 | } | |
96 | bool operator != (views const &rhs) | |
97 | { | |
98 | return _value != rhs._value; | |
99 | } | |
100 | const char *caption (); | |
101 | ||
102 | private: | |
103 | int _value; | |
104 | }; | |
105 | ||
106 | class Header | |
107 | { | |
108 | public: | |
109 | const char *text; | |
110 | int slen; | |
111 | int width; | |
112 | int x; | |
113 | }; | |
114 | ||
115 | private: | |
116 | HWND listview; | |
117 | HWND listheader; | |
118 | views view_mode; | |
119 | void set_headers (); | |
120 | void init_headers (HDC dc); | |
121 | void note_width (Header *hdrs, HDC dc, const char *string, int addend, | |
122 | int column); | |
123 | ||
124 | }; | |
125 | ||
126 | #endif // _PICKVIEW_H_ |