/[winpt]/trunk/Src/wptListView.cpp
ViewVC logotype

Diff of /trunk/Src/wptListView.cpp

Parent Directory Parent Directory | Revision Log Revision Log | View Patch Patch

revision 304 by twoaday, Wed Mar 21 10:59:31 2007 UTC revision 328 by twoaday, Fri Sep 25 16:07:38 2009 UTC
# Line 1  Line 1 
1  /* wptListView.cpp - Dynamic list view control  /* wptListView.cpp - Dynamic list view control
2   *      Copyright (C) 2000-2007 Timo Schulz   *      Copyright (C) 2000-2007, 2009 Timo Schulz
3   *      Copyright (C) 2004 Andreas Jobs   *      Copyright (C) 2004 Andreas Jobs
4   *   *
5   * This file is part of WinPT.   * This file is part of WinPT.
# Line 199  listview_add_sub_item (listview_ctrl_t c Line 199  listview_add_sub_item (listview_ctrl_t c
199    
200    
201  int  int
202  listview_count_items( listview_ctrl_t ctx, int curr_sel )  listview_count_items (listview_ctrl_t ctx, int curr_sel)
203  {        {      
204      int n;      int n;
205    
# Line 320  listview_get_item_text (listview_ctrl_t Line 320  listview_get_item_text (listview_ctrl_t
320  void  void
321  listview_set_chkbox_style (listview_ctrl_t ctx)  listview_set_chkbox_style (listview_ctrl_t ctx)
322  {  {
323      ListView_SetExtendedListViewStyle (ctx->ctrl, LVS_EX_CHECKBOXES);      DWORD flag = LVS_EX_CHECKBOXES;
324        DWORD style;
325        style = ListView_GetExtendedListViewStyle (ctx->ctrl)|flag;    
326        ListView_SetExtendedListViewStyle (ctx->ctrl, style);
327      ctx->ext_chkbox = 1;      ctx->ext_chkbox = 1;
328  }  }
329    
# Line 328  listview_set_chkbox_style (listview_ctrl Line 331  listview_set_chkbox_style (listview_ctrl
331  /* Use extended style to select the entire row. */  /* Use extended style to select the entire row. */
332  void  void
333  listview_set_ext_style (listview_ctrl_t ctx)  listview_set_ext_style (listview_ctrl_t ctx)
334  {        {
335      ListView_SetExtendedListViewStyle (ctx->ctrl, LVS_EX_FULLROWSELECT);      DWORD flag = LVS_EX_FULLROWSELECT;
336        DWORD style;
337        style = ListView_GetExtendedListViewStyle (ctx->ctrl)|flag;
338        ListView_SetExtendedListViewStyle (ctx->ctrl, style);
339  }  }
340    
341    
342    void
343    listview_set_grid_style (listview_ctrl_t ctx)
344    {
345        DWORD flag = LVS_EX_GRIDLINES;
346        DWORD style;
347        style = ListView_GetExtendedListViewStyle (ctx->ctrl)|flag;
348        ListView_SetExtendedListViewStyle (ctx->ctrl, style);
349    }
350    
351  int  int
352  listview_set_column_order( listview_ctrl_t ctx, int *array )  listview_set_column_order (listview_ctrl_t ctx, int *array)
353  {        {      
354      return ListView_SetColumnOrderArray( ctx->ctrl, ctx->cols, array );      return ListView_SetColumnOrderArray (ctx->ctrl, ctx->cols, array);
355  }  }
356    
357    
358  void  void
359  listview_select_all (listview_ctrl_t ctx)  listview_select_all (listview_ctrl_t ctx)
360  {        {      
361      ListView_SetItemState( ctx->ctrl, -1, LVIS_SELECTED, LVIS_SELECTED );      ListView_SetItemState (ctx->ctrl, -1, LVIS_SELECTED, LVIS_SELECTED);
362  }  }
363    
364    
# Line 369  listview_scroll (listview_ctrl_t ctx, in Line 384  listview_scroll (listview_ctrl_t ctx, in
384            
385      if (oldpos == -1)      if (oldpos == -1)
386          oldpos = 0;          oldpos = 0;
     //log_box ("debug", 0, "oldpos=%d newpos=%d diff=%d",  
                 //oldpos, newpos, newpos-oldpos);  
387      ListView_Scroll (ctx->ctrl, 0, (newpos-oldpos)*size);      ListView_Scroll (ctx->ctrl, 0, (newpos-oldpos)*size);
388  }  }
389    
# Line 427  listview_set_image_list (listview_ctrl_t Line 440  listview_set_image_list (listview_ctrl_t
440                           HICON *ico, DWORD nicons)                           HICON *ico, DWORD nicons)
441  {  {
442      HIMAGELIST hil;      HIMAGELIST hil;
     DWORD i;  
443    
444      if (cx <= 0 || cy <= 0)      if (cx <= 0 || cy <= 0)
445          cx = cy = 16; /* default size. */          cx = cy = 16; /* default size. */
446    
447      hil = ImageList_Create (cx, cy, ILC_COLOR8|ILC_MASK, nicons, 1);      hil = ImageList_Create (cx, cy, ILC_COLOR8|ILC_MASK, nicons, 1);
448      ImageList_SetBkColor (hil, CLR_NONE);      ImageList_SetBkColor (hil, CLR_NONE);
449      for (i=0; i < nicons; i++)      for (DWORD i=0; i < nicons; i++)
450          ImageList_AddIcon (hil, ico[i]);              ImageList_AddIcon (hil, ico[i]);    
451      ListView_SetImageList (ctx->ctrl, hil, LVSIL_SMALL);          (void)ListView_SetImageList (ctx->ctrl, hil, LVSIL_SMALL);    
452  }  }

Legend:
Removed from v.304  
changed lines
  Added in v.328

[email protected]
ViewVC Help
Powered by ViewVC 1.1.26