FS2_Open
Open source remastering of the Freespace 2 engine
shipchecklistbox.cpp
Go to the documentation of this file.
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 the
6  * source.
7  *
8 */
9 
10 
11 
12 #include "stdafx.h"
13 #include "ShipCheckListBox.h"
14 
15 BEGIN_MESSAGE_MAP(ShipCheckListBox, CCheckListBox)
16  //{{AFX_MSG_MAP(CCheckListBox)
17  ON_WM_KEYDOWN()
18  //}}AFX_MSG_MAP
19 END_MESSAGE_MAP()
20 
21 BOOL ShipCheckListBox::Create(DWORD dwStyle, const RECT& rect, CWnd* pParentWnd, UINT nID)
22 {
23  BOOL b;
24 
25  b = CCheckListBox::Create(LBS_OWNERDRAWFIXED | dwStyle, rect, pParentWnd, nID);
26  SetCheckStyle(BS_AUTOCHECKBOX);
27  return b;
28 }
29 
30 void ShipCheckListBox::OnKeyDown(UINT nChar, UINT nRepCnt, UINT nFlags)
31 {
32  if (nChar == VK_SPACE)
33  {
34  int i, list_size;
35 
36  list_size = GetCount();
37  for (i=0; i<list_size; i++)
38  if (GetSel(i) > 0)
39  {
40  if (GetCheck(i))
41  SetCheck(i, 0);
42  else
43  SetCheck(i, 1);
44  }
45 
46  } else
47  CCheckListBox::OnKeyDown(nChar, nRepCnt, nFlags);
48 }
int i
Definition: multi_pxo.cpp:466
unsigned int UINT
Definition: config.h:82
afx_msg void OnKeyDown(UINT nChar, UINT nRepCnt, UINT nFlags)
unsigned long DWORD
Definition: config.h:90
int BOOL
Definition: config.h:80
GLboolean GLboolean GLboolean b
Definition: Glext.h:5781