~clint-fewbar/ubuntu/precise/squid3/ignore-sighup-early

« back to all changes in this revision

Viewing changes to lib/cppunit-1.10.0/src/msvc6/testrunner/ListCtrlSetter.cpp

  • Committer: Bazaar Package Importer
  • Author(s): Luigi Gangitano
  • Date: 2006-11-11 10:32:06 UTC
  • Revision ID: james.westby@ubuntu.com-20061111103206-f3p0r9g0vq44rp3r
Tags: upstream-3.0.PRE5
ImportĀ upstreamĀ versionĀ 3.0.PRE5

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
#include "StdAfx.h"
 
2
#include "ListCtrlSetter.h"
 
3
 
 
4
 
 
5
ListCtrlSetter::ListCtrlSetter( CListCtrl &list ) :
 
6
    m_List( list ),
 
7
    m_nLineNo( -1 )
 
8
{
 
9
}
 
10
 
 
11
 
 
12
ListCtrlSetter::~ListCtrlSetter()
 
13
{
 
14
}
 
15
 
 
16
 
 
17
void 
 
18
ListCtrlSetter::modifyLine( int nLineNo )
 
19
{
 
20
  editLine( nLineNo, nLineNo >= m_List.GetItemCount() );
 
21
}
 
22
 
 
23
 
 
24
void 
 
25
ListCtrlSetter::addLine()
 
26
{
 
27
  editLine( m_List.GetItemCount(), true );
 
28
}
 
29
 
 
30
 
 
31
void 
 
32
ListCtrlSetter::insertLine( int nLineNo )
 
33
{
 
34
  editLine( nLineNo, true );
 
35
}
 
36
 
 
37
 
 
38
void 
 
39
ListCtrlSetter::editLine( int nLineNo, 
 
40
                          bool bInsertLine )
 
41
{
 
42
  m_nLineNo = nLineNo;
 
43
  m_bInsertLine = bInsertLine;
 
44
  m_nNextSubItem = 0;
 
45
}
 
46
 
 
47
 
 
48
void 
 
49
ListCtrlSetter::addSubItem( const CString &strText )
 
50
{
 
51
  doAddSubItem( LVIF_TEXT, strText, 0 );
 
52
}
 
53
 
 
54
 
 
55
void 
 
56
ListCtrlSetter::addSubItem( const CString &strText, 
 
57
                            void *lParam )
 
58
{
 
59
  doAddSubItem( LVIF_TEXT | LVIF_PARAM, strText, 0, lParam );
 
60
}
 
61
 
 
62
 
 
63
void 
 
64
ListCtrlSetter::addSubItem( const CString &strText,
 
65
                            int nImage )
 
66
{
 
67
  doAddSubItem( LVIF_TEXT | LVIF_IMAGE, strText, nImage );
 
68
}
 
69
 
 
70
 
 
71
void 
 
72
ListCtrlSetter::addSubItem( const CString &strText, 
 
73
                            void *lParam,
 
74
                            int nImage )
 
75
{
 
76
  doAddSubItem( LVIF_TEXT | LVIF_IMAGE | LVIF_PARAM, strText, 0, lParam );
 
77
}
 
78
 
 
79
 
 
80
void 
 
81
ListCtrlSetter::doAddSubItem( UINT nMask, 
 
82
                              CString strText, 
 
83
                              int nImage, 
 
84
                              void *lParam )
 
85
{
 
86
  int textLength = strText.GetLength();
 
87
 
 
88
  LVITEM item;
 
89
  item.mask = nMask;
 
90
  item.pszText = strText.GetBuffer( textLength );
 
91
  item.cchTextMax = textLength;
 
92
  item.iImage = nImage;
 
93
  item.lParam = (LPARAM)lParam;
 
94
  item.iItem = m_nLineNo;
 
95
  item.iSubItem = m_nNextSubItem++;
 
96
  if ( m_nNextSubItem == 1  &&
 
97
       m_bInsertLine )      // First item & new line
 
98
  {
 
99
    m_nLineNo = m_List.InsertItem( &item );
 
100
    VERIFY( m_nLineNo >= 0 );
 
101
  }
 
102
  else
 
103
  {
 
104
    VERIFY( m_List.SetItem( &item ) );
 
105
  }
 
106
 
 
107
  strText.ReleaseBuffer();
 
108
}
 
109
 
 
110
 
 
111
int 
 
112
ListCtrlSetter::getLineNo() const
 
113
{
 
114
  return m_nLineNo;
 
115
}