]>
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" | |
3c054baf | 20 | #include "String++.h" |
97647369 RC |
21 | |
22 | #define HMARGIN 10 | |
23 | #define ROW_MARGIN 5 | |
24 | #define ICON_MARGIN 4 | |
25 | #define RTARROW_WIDTH 11 | |
26 | #define SPIN_WIDTH 11 | |
27 | #define NEW_COL_SIZE_SLOP (ICON_MARGIN + SPIN_WIDTH + RTARROW_WIDTH) | |
28 | ||
29 | #define CHECK_SIZE 11 | |
30 | ||
31 | class PickView; | |
32 | #include "PickCategoryLine.h" | |
33 | #include "package_meta.h" | |
34 | ||
35 | class PickView | |
36 | { | |
37 | public: | |
38 | class views; | |
39 | class Header; | |
40 | int num_columns; | |
41 | views get_view_mode () | |
42 | { | |
43 | return view_mode; | |
44 | }; | |
45 | void set_view_mode (views _mode); | |
46 | Header *headers; | |
47 | PickView (views mode, HWND listview, Category & cat); | |
49cf3899 | 48 | ~PickView(); |
97647369 RC |
49 | const char *mode_caption (); |
50 | void insert_pkg (packagemeta &); | |
51 | void insert_category (Category *, bool); | |
52 | void clear_view (void); | |
53 | int click (int row, int x); | |
54 | int current_col; | |
55 | int new_col; | |
2fa7c5a4 RC |
56 | int bintick_col; |
57 | int srctick_col; | |
97647369 RC |
58 | int cat_col; |
59 | int pkg_col; | |
60 | int last_col; | |
61 | int row_height; | |
62 | TEXTMETRIC tm; | |
63 | HDC bitmap_dc; | |
64 | HANDLE bm_spin,bm_rtarrow, bm_checkyes, bm_checkno, bm_checkna; | |
65 | trusts deftrust; | |
66 | HANDLE sysfont; | |
67 | int scroll_ulc_x, scroll_ulc_y; | |
68 | int header_height; | |
69 | PickCategoryLine contents; | |
70 | void scroll (HWND hwnd, int which, int *var, int code); | |
71 | HWND ListHeader (void) const | |
72 | { | |
73 | return listheader; | |
74 | } | |
75 | ||
97647369 RC |
76 | class views |
77 | { | |
78 | public: | |
79 | static const views Unknown; | |
80 | static const views PackageFull; | |
81 | static const views Package; | |
82 | static const views Category; | |
83 | static const views NView; | |
84 | views ():_value (0) | |
85 | { | |
86 | }; | |
87 | views (int aInt) | |
88 | { | |
89 | _value = aInt; | |
90 | if (_value < 0 || _value > 3) | |
91 | _value = 0; | |
92 | } | |
93 | views & operator++ (); | |
94 | bool operator == (views const &rhs) | |
95 | { | |
96 | return _value == rhs._value; | |
97 | } | |
98 | bool operator != (views const &rhs) | |
99 | { | |
100 | return _value != rhs._value; | |
101 | } | |
102 | const char *caption (); | |
103 | ||
104 | private: | |
105 | int _value; | |
106 | }; | |
107 | ||
108 | class Header | |
109 | { | |
110 | public: | |
111 | const char *text; | |
112 | int slen; | |
113 | int width; | |
114 | int x; | |
115 | }; | |
116 | ||
117 | private: | |
118 | HWND listview; | |
119 | HWND listheader; | |
120 | views view_mode; | |
121 | void set_headers (); | |
122 | void init_headers (HDC dc); | |
3c054baf | 123 | void note_width (Header *hdrs, HDC dc, String const &string, int addend, |
97647369 | 124 | int column); |
97647369 RC |
125 | }; |
126 | ||
127 | #endif // _PICKVIEW_H_ |