]> cygwin.com Git - cygwin-apps/setup.git/blame - PickCategoryLine.h
2002-05-26 Ralf Habacker <ralf.habacker@freenet.de>
[cygwin-apps/setup.git] / PickCategoryLine.h
CommitLineData
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
20class PickView;
21#include "PickLine.h"
22#include "package_meta.h"
23
24class PickCategoryLine:public PickLine
25{
26public:
27 PickCategoryLine (PickView & aView, Category & _cat, size_t thedepth = 0, bool aBool =
28 true, bool aBool2 =
29 true):PickLine (_cat.key),
7e8fc33c 30 current_default (packagemeta::Default_action), cat (_cat), labellength (0),
97647369
RC
31 depth (thedepth), theView (aView)
32 {
33 if (aBool)
34 {
35 collapsed = true;
36 show_label = true;
37 }
38 else
39 {
40 collapsed = false;
41 show_label = aBool2;
42 }
43 };
44 ~PickCategoryLine ()
45 {
46 empty ();
47 }
48 void ShowLabel (bool aBool = true)
49 {
50 show_label = aBool;
51 if (!show_label)
52 collapsed = false;
53 }
54 virtual void paint (HDC hdc, int x, int y, int row, int show_cat);
55 virtual int click (int const myrow, int const ClickedRow, int const x);
56 virtual int itemcount () const
57 {
58 if (collapsed)
59 return 1;
60 int t = show_label ? 1 : 0;
61 for (size_t n = 1; n <= bucket.number (); n++)
62 t += bucket[n]->itemcount ();
63 return t;
64 };
65 virtual bool IsContainer (void) const
66 {
67 return true;
68 }
69 virtual void insert (PickLine & aLine)
70 {
71 bucket.registerbyobject (aLine);
72 }
73 void empty ();
7e8fc33c 74 virtual int set_action (packagemeta::_actions);
97647369 75private:
7e8fc33c 76 packagemeta::_actions
97647369 77 current_default;
97647369
RC
78 Category & cat;
79 bool collapsed;
80 bool show_label;
81 size_t labellength;
82 size_t depth;
83 PickCategoryLine (PickCategoryLine const &);
84 PickCategoryLine & operator= (PickCategoryLine const &);
3c054baf 85 list < PickLine, String, String::casecompare > bucket;
97647369
RC
86 PickView& theView;
87};
88#endif // _PICKCATEGORYLINE_H_
This page took 0.032285 seconds and 5 git commands to generate.