]> cygwin.com Git - cygwin-apps/setup.git/blob - PickCategoryLine.h
2005-05-21 Brian Dessent <brian@dessent.net>
[cygwin-apps/setup.git] / PickCategoryLine.h
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 SETUP_PICKCATEGORYLINE_H
17 #define SETUP_PICKCATEGORYLINE_H
18
19
20 class PickView;
21 #include <vector>
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 =
30 true):PickLine (_cat.first),
31 current_default (packagemeta::Default_action), cat (_cat), labellength (0),
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, HRGN hUpdRgn, 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;
62 for (size_t n = 0; n < bucket.size (); ++n)
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 {
72 bucket.push_back (&aLine);
73 }
74 void empty ();
75 virtual int set_action (packagemeta::_actions);
76 private:
77 packagemeta::_actions
78 current_default;
79 Category & cat;
80 bool collapsed;
81 bool show_label;
82 size_t labellength;
83 size_t spin_x; // x-coord where the spin button starts
84 size_t depth;
85 PickCategoryLine (PickCategoryLine const &);
86 PickCategoryLine & operator= (PickCategoryLine const &);
87 std::vector < PickLine * > bucket;
88 PickView& theView;
89 };
90 #endif /* SETUP_PICKCATEGORYLINE_H */
This page took 0.038577 seconds and 5 git commands to generate.