mirror of
https://github.com/scp-fs2open/fs2open.github.com.git
synced 2026-11-07 08:15:59 -10:00
The overlapping checkboxes problem described in #5494 is the result of the checkbox list item height being slightly too small. A fix for this, which requires a subclass of `CCheckListBox`, is described in the following StackOverflow article: https://stackoverflow.com/questions/3147958/mfc-cchecklistbox-items-overlap It turns out there is already a subclass of `CCheckListBox` in the codebase: `ShipCheckListBox`, a class that was apparently left on the cutting room floor when DaveB refactored the team loadout dialog on 2/23/99. It allows an entire selected range of items to be toggled by pressing the spacebar. I've augmented it with the StackOverflow fix, and I've added it to the team loadout dialog as well as some other places that could benefit from it. Fixes the other half of #5494.
52 lines
1.2 KiB
C++
52 lines
1.2 KiB
C++
|
|
// CheckBoxListDlg.h : header file
|
|
//
|
|
|
|
#include <globalincs/vmallocator.h>
|
|
#include "shipchecklistbox.h"
|
|
|
|
|
|
/////////////////////////////////////////////////////////////////////////////
|
|
// CheckBoxListDlg dialog
|
|
|
|
class CheckBoxListDlg : public CDialog
|
|
{
|
|
// Construction
|
|
public:
|
|
CheckBoxListDlg(CWnd* pParent = nullptr); // standard constructor
|
|
|
|
void SetOptions(const SCP_vector<CString> &options);
|
|
void SetOptions(const SCP_vector<std::pair<CString, bool>> &options);
|
|
|
|
bool IsChecked(int index);
|
|
void SetChecked(int index, bool checked);
|
|
|
|
void SetCaption(const CString &caption);
|
|
|
|
// Dialog Data
|
|
//{{AFX_DATA(CheckBoxListDlg)
|
|
enum { IDD = IDD_CHECKLIST_VIEW };
|
|
ShipCheckListBox m_checklist;
|
|
//}}AFX_DATA
|
|
|
|
// Overrides
|
|
// ClassWizard generated virtual function overrides
|
|
//{{AFX_VIRTUAL(CheckBoxListDlg)
|
|
protected:
|
|
virtual void DoDataExchange(CDataExchange* pDX); // DDX/DDV support
|
|
//}}AFX_VIRTUAL
|
|
|
|
// Implementation
|
|
protected:
|
|
|
|
// Generated message map functions
|
|
//{{AFX_MSG(CheckBoxListDlg)
|
|
afx_msg BOOL OnInitDialog();
|
|
afx_msg void OnClose();
|
|
//}}AFX_MSG
|
|
DECLARE_MESSAGE_MAP()
|
|
|
|
SCP_vector<std::pair<CString, bool>> m_offline_options;
|
|
CString m_caption;
|
|
};
|