]>
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 | ||
c93bc6d0 MB |
16 | #ifndef SETUP_PICKVIEW_H |
17 | #define SETUP_PICKVIEW_H | |
97647369 RC |
18 | |
19 | #include "win32.h" | |
3c054baf | 20 | #include "String++.h" |
693916f8 | 21 | #include "window.h" |
97647369 RC |
22 | |
23 | #define HMARGIN 10 | |
24 | #define ROW_MARGIN 5 | |
25 | #define ICON_MARGIN 4 | |
26 | #define RTARROW_WIDTH 11 | |
27 | #define SPIN_WIDTH 11 | |
28 | #define NEW_COL_SIZE_SLOP (ICON_MARGIN + SPIN_WIDTH + RTARROW_WIDTH) | |
97647369 RC |
29 | #define CHECK_SIZE 11 |
30 | ||
525531ca RC |
31 | #define CATEGORY_EXPANDED 0 |
32 | #define CATEGORY_COLLAPSED 1 | |
33 | ||
97647369 RC |
34 | class PickView; |
35 | #include "PickCategoryLine.h" | |
36 | #include "package_meta.h" | |
37 | ||
693916f8 | 38 | class PickView : public Window |
97647369 RC |
39 | { |
40 | public: | |
693916f8 RC |
41 | virtual bool Create (Window * Parent = NULL, DWORD Style = WS_OVERLAPPEDWINDOW | WS_VISIBLE | WS_CLIPCHILDREN, RECT * r = NULL); |
42 | virtual bool registerWindowClass (); | |
97647369 RC |
43 | class views; |
44 | class Header; | |
45 | int num_columns; | |
46 | views get_view_mode () | |
47 | { | |
48 | return view_mode; | |
49 | }; | |
22120c90 | 50 | void defaultTrust (trusts trust); |
97647369 | 51 | void set_view_mode (views _mode); |
525531ca | 52 | void setViewMode (PickView::views mode); |
d2be933d RC |
53 | void paint (HWND hwnd); |
54 | LRESULT CALLBACK list_click (HWND hwnd, BOOL dblclk, int x, int y, UINT hitCode); | |
55 | LRESULT CALLBACK list_hscroll (HWND hwnd, HWND hctl, UINT code, int pos); | |
56 | LRESULT CALLBACK list_vscroll (HWND hwnd, HWND hctl, UINT code, int pos); | |
693916f8 | 57 | virtual LRESULT WindowProc (UINT uMsg, WPARAM wParam, LPARAM lParam); |
97647369 | 58 | Header *headers; |
693916f8 RC |
59 | PickView (Category & cat); |
60 | void init(views _mode); | |
49cf3899 | 61 | ~PickView(); |
97647369 RC |
62 | const char *mode_caption (); |
63 | void insert_pkg (packagemeta &); | |
64 | void insert_category (Category *, bool); | |
65 | void clear_view (void); | |
66 | int click (int row, int x); | |
ec2dbbf0 | 67 | void refresh(); |
97647369 RC |
68 | int current_col; |
69 | int new_col; | |
2fa7c5a4 RC |
70 | int bintick_col; |
71 | int srctick_col; | |
97647369 RC |
72 | int cat_col; |
73 | int pkg_col; | |
74 | int last_col; | |
75 | int row_height; | |
76 | TEXTMETRIC tm; | |
77 | HDC bitmap_dc; | |
78 | HANDLE bm_spin,bm_rtarrow, bm_checkyes, bm_checkno, bm_checkna; | |
79 | trusts deftrust; | |
80 | HANDLE sysfont; | |
81 | int scroll_ulc_x, scroll_ulc_y; | |
82 | int header_height; | |
83 | PickCategoryLine contents; | |
84 | void scroll (HWND hwnd, int which, int *var, int code); | |
85 | HWND ListHeader (void) const | |
86 | { | |
87 | return listheader; | |
88 | } | |
89 | ||
97647369 RC |
90 | class views |
91 | { | |
92 | public: | |
93 | static const views Unknown; | |
94 | static const views PackageFull; | |
95 | static const views Package; | |
e0aec95e MB |
96 | static const views PackageKeeps; |
97 | static const views PackageSkips; | |
97647369 RC |
98 | static const views Category; |
99 | static const views NView; | |
100 | views ():_value (0) | |
101 | { | |
102 | }; | |
103 | views (int aInt) | |
104 | { | |
105 | _value = aInt; | |
e0aec95e | 106 | if (_value < 0 || _value > 5) |
97647369 RC |
107 | _value = 0; |
108 | } | |
109 | views & operator++ (); | |
110 | bool operator == (views const &rhs) | |
111 | { | |
112 | return _value == rhs._value; | |
113 | } | |
114 | bool operator != (views const &rhs) | |
115 | { | |
116 | return _value != rhs._value; | |
117 | } | |
118 | const char *caption (); | |
119 | ||
120 | private: | |
121 | int _value; | |
122 | }; | |
123 | ||
124 | class Header | |
125 | { | |
126 | public: | |
127 | const char *text; | |
128 | int slen; | |
129 | int width; | |
130 | int x; | |
131 | }; | |
132 | ||
133 | private: | |
693916f8 | 134 | static ATOM WindowClassAtom; |
97647369 RC |
135 | HWND listheader; |
136 | views view_mode; | |
137 | void set_headers (); | |
138 | void init_headers (HDC dc); | |
3c054baf | 139 | void note_width (Header *hdrs, HDC dc, String const &string, int addend, |
97647369 | 140 | int column); |
97647369 RC |
141 | }; |
142 | ||
c93bc6d0 | 143 | #endif /* SETUP_PICKVIEW_H */ |