]>
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::empty (void)
22 while (bucket
.number ())
24 PickLine
*line
= bucket
.removebyindex (1);
30 PickCategoryLine::paint (HDC hdc
, int x
, int y
, int row
, int show_cat
)
32 int r
= y
+ row
* theView
.row_height
;
35 int by
= r
+ theView
.tm
.tmHeight
- 11;
37 x
+ theView
.headers
[theView
.cat_col
].x
+ HMARGIN
/ 2 +
38 depth
* 8, r
, cat
.name
, strlen (cat
.name
));
42 GetTextExtentPoint32 (hdc
, cat
.name
, strlen (cat
.name
), &s
);
45 SelectObject (theView
.bitmap_dc
, theView
.bm_spin
);
47 x
+ theView
.headers
[theView
.cat_col
].x
+
48 labellength
+ depth
* 8 +
50 HMARGIN
/ 2, by
, 11, 11, theView
.bitmap_dc
, 0, 0, SRCCOPY
);
52 x
+ theView
.headers
[theView
.cat_col
].x
+
53 labellength
+ depth
* 8 +
54 ICON_MARGIN
+ SPIN_WIDTH
+
55 HMARGIN
, r
, current_default
.caption (), strlen (current_default
.caption ()));
59 int accum_row
= row
+ (show_label
? 1 : 0);
60 for (size_t n
= 1; n
<= bucket
.number (); n
++)
62 bucket
[n
]->paint (hdc
, x
, y
, accum_row
, show_cat
);
63 accum_row
+= bucket
[n
]->itemcount ();
68 PickCategoryLine::click (int const myrow
, int const ClickedRow
, int const x
)
70 if (myrow
== ClickedRow
&& show_label
)
72 if ((size_t) x
>= theView
.headers
[theView
.cat_col
].x
+
73 labellength
+ depth
* 8 + ICON_MARGIN
+ HMARGIN
/ 2)
77 return set_action (current_default
);
81 collapsed
= !collapsed
;
83 for (size_t n
= 1; n
<= bucket
.number (); n
++)
84 accum_row
+= bucket
[n
]->itemcount ();
85 return collapsed
? accum_row
: -accum_row
;
90 int accum_row
= myrow
+ (show_label
? 1 : 0);
91 for (size_t n
= 1; n
<= bucket
.number (); n
++)
93 if (accum_row
+ bucket
[n
]->itemcount () > ClickedRow
)
94 return bucket
[n
]->click (accum_row
, ClickedRow
, x
);
95 accum_row
+= bucket
[n
]->itemcount ();
102 PickCategoryLine::set_action (packagemeta::_actions action
)
104 current_default
= action
;
106 for (size_t n
= 1; n
<= bucket
.number (); n
++)
107 accum_diff
+= bucket
[n
]->set_action (current_default
);
This page took 0.040723 seconds and 6 git commands to generate.