]>
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 | ||
17 | #ifndef _PICKCATEGORYLINE_H_ | |
18 | #define _PICKCATEGORYLINE_H_ | |
19 | ||
20 | class PickView; | |
0cf68afd | 21 | #include <vector> |
97647369 RC |
22 | #include "PickLine.h" |
23 | #include "package_meta.h" | |
24 | ||
25 | class PickCategoryLine:public PickLine | |
26 | { | |
27 | public: | |
28 | PickCategoryLine (PickView & aView, Category & _cat, size_t thedepth = 0, bool aBool = | |
29 | true, bool aBool2 = | |
0cf68afd | 30 | true):PickLine (_cat.first), |
7e8fc33c | 31 | current_default (packagemeta::Default_action), cat (_cat), labellength (0), |
97647369 RC |
32 | depth (thedepth), theView (aView) |
33 | { | |
34 | if (aBool) | |
35 | { | |
36 | collapsed = true; | |
37 | show_label = true; | |
38 | } | |
39 | else | |
40 | { | |
41 | collapsed = false; | |
42 | show_label = aBool2; | |
43 | } | |
44 | }; | |
45 | ~PickCategoryLine () | |
46 | { | |
47 | empty (); | |
48 | } | |
49 | void ShowLabel (bool aBool = true) | |
50 | { | |
51 | show_label = aBool; | |
52 | if (!show_label) | |
53 | collapsed = false; | |
54 | } | |
55 | virtual void paint (HDC hdc, int x, int y, int row, int show_cat); | |
56 | virtual int click (int const myrow, int const ClickedRow, int const x); | |
57 | virtual int itemcount () const | |
58 | { | |
59 | if (collapsed) | |
60 | return 1; | |
61 | int t = show_label ? 1 : 0; | |
0cf68afd | 62 | for (size_t n = 0; n < bucket.size (); ++n) |
97647369 RC |
63 | t += bucket[n]->itemcount (); |
64 | return t; | |
65 | }; | |
66 | virtual bool IsContainer (void) const | |
67 | { | |
68 | return true; | |
69 | } | |
70 | virtual void insert (PickLine & aLine) | |
71 | { | |
0cf68afd | 72 | bucket.push_back (&aLine); |
97647369 RC |
73 | } |
74 | void empty (); | |
7e8fc33c | 75 | virtual int set_action (packagemeta::_actions); |
97647369 | 76 | private: |
7e8fc33c | 77 | packagemeta::_actions |
97647369 | 78 | current_default; |
97647369 RC |
79 | Category & cat; |
80 | bool collapsed; | |
81 | bool show_label; | |
82 | size_t labellength; | |
83 | size_t depth; | |
84 | PickCategoryLine (PickCategoryLine const &); | |
85 | PickCategoryLine & operator= (PickCategoryLine const &); | |
666bf37d | 86 | std::vector < PickLine * > bucket; |
97647369 RC |
87 | PickView& theView; |
88 | }; | |
89 | #endif // _PICKCATEGORYLINE_H_ |