]>
cygwin.com Git - cygwin-apps/setup.git/blob - PickCategoryLine.cc
2 * Copyright (c) 2002 Robert Collins.
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.
9 * A copy of the GNU General Public License can be found at
12 * Written by Robert Collins <robertc@hotmail.com>
16 #include "PickCategoryLine.h"
20 PickCategoryLine::actiontext ()
22 switch (current_default
)
28 case Reinstall_action
:
30 case Uninstall_action
:
33 // Pacify GCC: (all case options are checked above)
38 PickCategoryLine::empty (void)
40 while (bucket
.number ())
42 PickLine
*line
= bucket
.removebyindex (1);
48 PickCategoryLine::paint (HDC hdc
, int x
, int y
, int row
, int show_cat
)
50 int r
= y
+ row
* theView
.row_height
;
53 int by
= r
+ theView
.tm
.tmHeight
- 11;
55 x
+ theView
.headers
[theView
.cat_col
].x
+ HMARGIN
/ 2 +
56 depth
* 8, r
, cat
.name
, strlen (cat
.name
));
60 GetTextExtentPoint32 (hdc
, cat
.name
, strlen (cat
.name
), &s
);
63 SelectObject (theView
.bitmap_dc
, theView
.bm_spin
);
65 x
+ theView
.headers
[theView
.cat_col
].x
+
66 labellength
+ depth
* 8 +
68 HMARGIN
/ 2, by
, 11, 11, theView
.bitmap_dc
, 0, 0, SRCCOPY
);
70 x
+ theView
.headers
[theView
.cat_col
].x
+
71 labellength
+ depth
* 8 +
72 ICON_MARGIN
+ SPIN_WIDTH
+
73 HMARGIN
, r
, actiontext (), strlen (actiontext ()));
77 int accum_row
= row
+ (show_label
? 1 : 0);
78 for (size_t n
= 1; n
<= bucket
.number (); n
++)
80 bucket
[n
]->paint (hdc
, x
, y
, accum_row
, show_cat
);
81 accum_row
+= bucket
[n
]->itemcount ();
86 PickCategoryLine::click (int const myrow
, int const ClickedRow
, int const x
)
88 if (myrow
== ClickedRow
&& show_label
)
90 if ((size_t) x
>= theView
.headers
[theView
.cat_col
].x
+
91 labellength
+ depth
* 8 + ICON_MARGIN
+ HMARGIN
/ 2)
93 for (size_t n
= 1; n
<= bucket
.number (); n
++)
99 collapsed
= !collapsed
;
101 for (size_t n
= 1; n
<= bucket
.number (); n
++)
102 accum_row
+= bucket
[n
]->itemcount ();
103 return collapsed
? accum_row
: -accum_row
;
108 int accum_row
= myrow
+ (show_label
? 1 : 0);
109 for (size_t n
= 1; n
<= bucket
.number (); n
++)
111 if (accum_row
+ bucket
[n
]->itemcount () > ClickedRow
)
112 return bucket
[n
]->click (accum_row
, ClickedRow
, x
);
113 accum_row
+= bucket
[n
]->itemcount ();
This page took 0.043888 seconds and 6 git commands to generate.