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