49 |
c->items = 0; |
c->items = 0; |
50 |
c->ctrl = NULL; |
c->ctrl = NULL; |
51 |
c->hil = NULL; |
c->hil = NULL; |
52 |
|
c->ext_chkbox = 0; |
53 |
*ctx = c; |
*ctx = c; |
54 |
return 0; |
return 0; |
55 |
} /* listview_new */ |
} |
56 |
|
|
57 |
|
|
58 |
void |
void |
248 |
} |
} |
249 |
|
|
250 |
|
|
251 |
|
/* Return if the given element is selected or if the ext |
252 |
|
style is used, if the checkbox is activated. */ |
253 |
int |
int |
254 |
listview_get_item_state( listview_ctrl_t ctx, int pos ) |
listview_get_item_state (listview_ctrl_t ctx, int pos) |
255 |
{ |
{ |
256 |
return ListView_GetItemState( ctx->ctrl, pos, LVIS_SELECTED ); |
int ret; |
257 |
} /* listview_get_item_state */ |
if (ctx->ext_chkbox) |
258 |
|
ret = ListView_GetCheckState (ctx->ctrl, pos); |
259 |
|
else |
260 |
|
ret = ListView_GetItemState (ctx->ctrl, pos, LVIS_SELECTED); |
261 |
|
return ret; |
262 |
|
} |
263 |
|
|
264 |
|
|
265 |
int |
int |
329 |
} /* listview_get_item_text */ |
} /* listview_get_item_text */ |
330 |
|
|
331 |
|
|
332 |
|
/* Use extended style with checkboxes for each item. */ |
333 |
|
void |
334 |
|
listview_set_chkbox_style (listview_ctrl_t ctx) |
335 |
|
{ |
336 |
|
ListView_SetExtendedListViewStyle (ctx->ctrl, LVS_EX_CHECKBOXES); |
337 |
|
ctx->ext_chkbox = 1; |
338 |
|
} |
339 |
|
|
340 |
|
|
341 |
|
/* Use extended style to select the entire row. */ |
342 |
void |
void |
343 |
listview_set_ext_style( listview_ctrl_t ctx ) |
listview_set_ext_style (listview_ctrl_t ctx) |
344 |
{ |
{ |
345 |
ListView_SetExtendedListViewStyle( ctx->ctrl, LVS_EX_FULLROWSELECT ); |
ListView_SetExtendedListViewStyle (ctx->ctrl, LVS_EX_FULLROWSELECT); |
346 |
} /* listview_set_ext_style */ |
} |
347 |
|
|
348 |
|
|
349 |
int |
int |