]>
Commit | Line | Data |
---|---|---|
8f53e82a RC |
1 | /* |
2 | * Copyright (c) 2000, Red Hat, Inc. | |
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 <rbtcollins@hotmail.com> | |
13 | * | |
14 | */ | |
15 | ||
16 | #ifndef _CHOOSE_H_ | |
17 | #define _CHOOSE_H_ | |
18 | ||
d0fa1c4e | 19 | class Category; |
d4a4527d | 20 | class Package; |
8f53e82a RC |
21 | |
22 | #define CATEGORY_EXPANDED 0 | |
23 | #define CATEGORY_COLLAPSED 1 | |
24 | ||
55e204f6 RC |
25 | typedef enum |
26 | { | |
27 | /* Note that the next four items must be in the same order as the | |
28 | TRUST items in ini.h. */ | |
29 | ACTION_UNKNOWN, | |
30 | ACTION_PREV, | |
31 | ACTION_CURR, | |
32 | ACTION_TEST, | |
33 | ACTION_SKIP, | |
34 | ACTION_UNINSTALL, | |
35 | ACTION_REDO, | |
36 | ACTION_SRC_ONLY, | |
37 | ACTION_LAST, | |
38 | ACTION_ERROR, | |
39 | /* Use ACTION_SAME when you want to leve the current version unaltered | |
40 | * even if it that version is not in setup.ini | |
41 | */ | |
42 | ACTION_SAME = 100, | |
43 | /* Actions taken when installed version matches the selected version. */ | |
44 | ACTION_SAME_PREV = ACTION_PREV + ACTION_SAME, | |
45 | ACTION_SAME_CURR = ACTION_CURR + ACTION_SAME, | |
46 | ACTION_SAME_TEST = ACTION_TEST + ACTION_SAME, | |
47 | /* Last action. */ | |
48 | ACTION_SAME_LAST | |
b24c88b3 RC |
49 | } |
50 | actions; | |
55e204f6 RC |
51 | |
52 | typedef enum | |
53 | { | |
54 | VIEW_UNKNOWN, | |
55 | VIEW_PACKAGE_FULL, | |
56 | VIEW_PACKAGE, | |
57 | VIEW_CATEGORY, | |
58 | NVIEW | |
b24c88b3 RC |
59 | } |
60 | views; | |
8f53e82a RC |
61 | |
62 | struct _header | |
63 | { | |
4bb38dfa | 64 | const char *text; |
8f53e82a RC |
65 | int slen; |
66 | int width; | |
67 | int x; | |
68 | }; | |
69 | ||
55e204f6 RC |
70 | #ifdef __cplusplus |
71 | ||
8f53e82a RC |
72 | typedef class _view view; |
73 | ||
74 | class pick_line | |
75 | { | |
b24c88b3 | 76 | public: |
d4a4527d | 77 | void set_line (Package * _pkg); |
b24c88b3 RC |
78 | void set_line (Category * _cat); |
79 | void paint (HDC hdc, int x, int y, int row, int show_cat); | |
d4a4527d | 80 | Package *get_pkg (void) |
b24c88b3 RC |
81 | { |
82 | return pkg; | |
83 | }; | |
84 | Category *get_category (void) | |
85 | { | |
86 | return cat; | |
87 | }; | |
88 | int click (int x); | |
89 | private: | |
d4a4527d | 90 | Package * pkg; |
b24c88b3 | 91 | Category *cat; |
8f53e82a RC |
92 | }; |
93 | ||
94 | class _view | |
95 | { | |
b24c88b3 RC |
96 | public: |
97 | int num_columns; | |
98 | views get_view_mode () | |
99 | { | |
100 | return view_mode; | |
101 | }; | |
102 | void set_view_mode (views _mode); | |
103 | struct _header *headers; | |
8f53e82a | 104 | _view (views mode, HDC dc); |
b24c88b3 | 105 | const char *mode_caption (); |
d4a4527d | 106 | void insert_pkg (Package *); |
b24c88b3 RC |
107 | void insert_category (Category *, int); |
108 | void clear_view (void); | |
109 | int click (int row, int x); | |
110 | int current_col; | |
111 | int new_col; | |
112 | int src_col; | |
113 | int cat_col; | |
114 | int pkg_col; | |
115 | int last_col; | |
116 | pick_line *lines; | |
117 | int nlines; | |
8f53e82a | 118 | |
b24c88b3 | 119 | private: |
8f53e82a | 120 | views view_mode; |
b24c88b3 RC |
121 | void set_headers (void); |
122 | void init_headers (HDC dc); | |
123 | void insert_at (int, pick_line); | |
124 | void insert_under (int linen, pick_line line); | |
8f53e82a RC |
125 | |
126 | }; | |
55e204f6 | 127 | #endif /* __cplusplus */ |
8f53e82a | 128 | #endif /* _CHOOSE_H_ */ |