38 |
#include "resource.h" |
#include "resource.h" |
39 |
|
|
40 |
|
|
41 |
int |
void |
42 |
listview_new (listview_ctrl_t *ctx) |
listview_new (listview_ctrl_t *ctx, HWND ctrl) |
43 |
{ |
{ |
44 |
struct listview_ctrl_s *c; |
struct listview_ctrl_s *c; |
45 |
|
|
48 |
BUG (NULL); |
BUG (NULL); |
49 |
c->cols = 0; |
c->cols = 0; |
50 |
c->items = 0; |
c->items = 0; |
51 |
c->ctrl = NULL; |
c->ctrl = ctrl? ctrl : NULL; |
52 |
c->hil = NULL; |
c->hil = NULL; |
53 |
c->ext_chkbox = 0; |
c->ext_chkbox = 0; |
54 |
*ctx = c; |
*ctx = c; |
|
return 0; |
|
55 |
} |
} |
56 |
|
|
57 |
|
|
294 |
|
|
295 |
|
|
296 |
int |
int |
297 |
listview_sort_items( listview_ctrl_t ctx, int sortby, listview_cmp sort_cb ) |
listview_sort_items (listview_ctrl_t ctx, int sortby, listview_cmp sort_cb) |
298 |
{ |
{ |
299 |
HWND hheader; |
HWND hheader; |
300 |
HDITEM hdi; |
HDITEM hdi; |
330 |
/* Set image to currently sorted field */ |
/* Set image to currently sorted field */ |
331 |
memset (&hdi, 0, sizeof(hdi)); |
memset (&hdi, 0, sizeof(hdi)); |
332 |
hdi.mask = HDI_IMAGE | HDI_FORMAT; |
hdi.mask = HDI_IMAGE | HDI_FORMAT; |
333 |
Header_GetItem (hheader, idx, &hdi); |
Header_GetItem (hheader, idx, &hdi); |
334 |
hdi.fmt |= HDF_IMAGE | HDF_BITMAP_ON_RIGHT; |
hdi.fmt |= HDF_IMAGE | HDF_BITMAP_ON_RIGHT; |
335 |
hdi.iImage = imagelist_getindex((sortby & KEYLIST_SORT_DESC) ? |
if (!ctx->ext_chkbox) |
336 |
IMI_SORT_DOWNARROW : IMI_SORT_UPARROW); |
hdi.iImage = imagelist_getindex((sortby & KEYLIST_SORT_DESC) ? |
337 |
|
IMI_SORT_DOWNARROW : IMI_SORT_UPARROW); |
338 |
|
else |
339 |
|
hdi.iImage = (sortby & KEYLIST_SORT_DESC)? 2 : 3; |
340 |
Header_SetItem (hheader, idx, &hdi); |
Header_SetItem (hheader, idx, &hdi); |
341 |
return 0; |
return 0; |
342 |
} |
} |
421 |
|
|
422 |
|
|
423 |
int |
int |
424 |
listview_find (listview_ctrl_t ctx, const char * str) |
listview_find (listview_ctrl_t ctx, const char *str) |
425 |
{ |
{ |
426 |
LVFINDINFO inf; |
LVFINDINFO inf; |
427 |
int pos; |
int pos; |
428 |
|
|
429 |
|
/* XXX: allow to make a substring search. */ |
430 |
memset (&inf, 0, sizeof (inf)); |
memset (&inf, 0, sizeof (inf)); |
431 |
inf.flags = LVFI_STRING|LVFI_PARTIAL; |
inf.flags = LVFI_STRING|LVFI_PARTIAL; |
432 |
inf.psz = str; |
inf.psz = str; |