]>
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
.size ())
24 PickLine
*line
= *bucket
.begin ();
26 bucket
.erase (bucket
.begin ());
31 PickCategoryLine::paint (HDC hdc
, int x
, int y
, int row
, int show_cat
)
33 int r
= y
+ row
* theView
.row_height
;
36 int by
= r
+ theView
.tm
.tmHeight
- 11;
37 String temp
=(String("+ ") +cat
.first
);
39 x
+ theView
.headers
[theView
.cat_col
].x
+ HMARGIN
/ 2 +
40 depth
* 8, r
, temp
.cstr_oneuse(), temp
.size());
44 GetTextExtentPoint32 (hdc
, temp
.cstr_oneuse(), temp
.size(), &s
);
47 SelectObject (theView
.bitmap_dc
, theView
.bm_spin
);
49 x
+ theView
.headers
[theView
.cat_col
].x
+
50 labellength
+ depth
* 8 +
52 HMARGIN
/ 2, by
, 11, 11, theView
.bitmap_dc
, 0, 0, SRCCOPY
);
54 x
+ theView
.headers
[theView
.cat_col
].x
+
55 labellength
+ depth
* 8 +
56 ICON_MARGIN
+ SPIN_WIDTH
+
57 HMARGIN
, r
, current_default
.caption (), strlen (current_default
.caption ()));
61 int accum_row
= row
+ (show_label
? 1 : 0);
62 for (size_t n
= 0; n
< bucket
.size (); ++n
)
64 bucket
[n
]->paint (hdc
, x
, y
, accum_row
, show_cat
);
65 accum_row
+= bucket
[n
]->itemcount ();
70 PickCategoryLine::click (int const myrow
, int const ClickedRow
, int const x
)
72 if (myrow
== ClickedRow
&& show_label
)
74 if ((size_t) x
>= theView
.headers
[theView
.cat_col
].x
+
75 labellength
+ depth
* 8 + ICON_MARGIN
+ HMARGIN
/ 2)
79 return set_action (current_default
);
83 collapsed
= !collapsed
;
85 for (size_t n
= 0; n
< bucket
.size (); ++n
)
86 accum_row
+= bucket
[n
]->itemcount ();
87 return collapsed
? accum_row
: -accum_row
;
92 int accum_row
= myrow
+ (show_label
? 1 : 0);
93 for (size_t n
= 0; n
< bucket
.size (); ++n
)
95 if (accum_row
+ bucket
[n
]->itemcount () > ClickedRow
)
96 return bucket
[n
]->click (accum_row
, ClickedRow
, x
);
97 accum_row
+= bucket
[n
]->itemcount ();
104 PickCategoryLine::set_action (packagemeta::_actions action
)
106 current_default
= action
;
108 for (size_t n
= 0; n
< bucket
.size (); n
++)
109 accum_diff
+= bucket
[n
]->set_action (current_default
);
This page took 0.039748 seconds and 5 git commands to generate.