]> icculus.org git repositories - taylor/freespace2.git/blob - src/fred2/shipchecklistbox.cpp
fix issue with looping audio streams
[taylor/freespace2.git] / src / fred2 / shipchecklistbox.cpp
1 /*
2  * Copyright (C) Volition, Inc. 1999.  All rights reserved.
3  *
4  * All source code herein is the property of Volition, Inc. You may not sell 
5  * or otherwise commercially exploit the source or things you created based on
6  * the source.
7  */
8
9 /*
10  * $Logfile: /Freespace2/code/FRED2/ShipCheckListBox.cpp $
11  * $Revision$
12  * $Date$
13  * $Author$
14  *
15  * A custom check list box class that allows space bar to toggle the state of all
16  * the selected checkboxes.
17  *
18  * $Log$
19  * Revision 1.3  2002/06/09 04:41:17  relnev
20  * added copyright header
21  *
22  * Revision 1.2  2002/05/07 03:16:44  theoddone33
23  * The Great Newline Fix
24  *
25  * Revision 1.1.1.1  2002/05/03 03:28:08  root
26  * Initial import.
27  *
28  * 
29  * 2     10/07/98 6:28p Dave
30  * Initial checkin. Renamed all relevant stuff to be Fred2 instead of
31  * Fred. Globalized mission and campaign file extensions. Removed Silent
32  * Threat specific code.
33  * 
34  * 1     10/07/98 3:01p Dave
35  * 
36  * 1     10/07/98 3:00p Dave
37  * 
38  * 4     2/17/97 5:28p Hoffoss
39  * Checked RCS headers, added them were missing, changing description to
40  * something better, etc where needed.
41  *
42  * $NoKeywords: $
43  */
44
45 #include "stdafx.h"
46 #include "shipchecklistbox.h"
47
48 BEGIN_MESSAGE_MAP(ShipCheckListBox, CCheckListBox)
49         //{{AFX_MSG_MAP(CCheckListBox)
50         ON_WM_KEYDOWN()
51         //}}AFX_MSG_MAP
52 END_MESSAGE_MAP()
53
54 BOOL ShipCheckListBox::Create(DWORD dwStyle, const RECT& rect, CWnd* pParentWnd, UINT nID)
55 {
56         BOOL b;
57
58         b = CCheckListBox::Create(LBS_OWNERDRAWFIXED | dwStyle, rect, pParentWnd, nID);
59         SetCheckStyle(BS_AUTOCHECKBOX);
60         return b;
61 }
62
63 void ShipCheckListBox::OnKeyDown(UINT nChar, UINT nRepCnt, UINT nFlags)
64 {
65         if (nChar == VK_SPACE)
66         {
67                 int i, list_size;
68
69                 list_size = GetCount();
70                 for (i=0; i<list_size; i++)
71                         if (GetSel(i) > 0)
72                         {
73                                 if (GetCheck(i))
74                                         SetCheck(i, 0);
75                                 else
76                                         SetCheck(i, 1);
77                         }
78
79         } else
80                 CCheckListBox::OnKeyDown(nChar, nRepCnt, nFlags);
81 }
82