1 |
786 |
skrzyp |
// ####ECOSHOSTGPLCOPYRIGHTBEGIN####
|
2 |
|
|
// -------------------------------------------
|
3 |
|
|
// This file is part of the eCos host tools.
|
4 |
|
|
// Copyright (C) 1998, 1999, 2000 Free Software Foundation, Inc.
|
5 |
|
|
//
|
6 |
|
|
// This program is free software; you can redistribute it and/or modify
|
7 |
|
|
// it under the terms of the GNU General Public License as published by
|
8 |
|
|
// the Free Software Foundation; either version 2 or (at your option) any
|
9 |
|
|
// later version.
|
10 |
|
|
//
|
11 |
|
|
// This program is distributed in the hope that it will be useful, but
|
12 |
|
|
// WITHOUT ANY WARRANTY; without even the implied warranty of
|
13 |
|
|
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
14 |
|
|
// General Public License for more details.
|
15 |
|
|
//
|
16 |
|
|
// You should have received a copy of the GNU General Public License
|
17 |
|
|
// along with this program; if not, write to the
|
18 |
|
|
// Free Software Foundation, Inc., 51 Franklin Street,
|
19 |
|
|
// Fifth Floor, Boston, MA 02110-1301, USA.
|
20 |
|
|
// -------------------------------------------
|
21 |
|
|
// ####ECOSHOSTGPLCOPYRIGHTEND####
|
22 |
|
|
#if !defined(AFX_ADDREMOVEDIALOG_H__6D1D20B4_2BA5_11D3_8567_9AA54FC2F74D__INCLUDED_)
|
23 |
|
|
#define AFX_ADDREMOVEDIALOG_H__6D1D20B4_2BA5_11D3_8567_9AA54FC2F74D__INCLUDED_
|
24 |
|
|
|
25 |
|
|
#if _MSC_VER > 1000
|
26 |
|
|
#pragma once
|
27 |
|
|
#endif // _MSC_VER > 1000
|
28 |
|
|
// AddRemoveDialog.h : header file
|
29 |
|
|
//
|
30 |
|
|
#include "resource.h"
|
31 |
|
|
#include "eCosDialog.h"
|
32 |
|
|
/////////////////////////////////////////////////////////////////////////////
|
33 |
|
|
// CAddRemoveDialog dialog
|
34 |
|
|
|
35 |
|
|
class CAddRemoveDialog : public CeCosDialog
|
36 |
|
|
{
|
37 |
|
|
// Construction
|
38 |
|
|
private:
|
39 |
|
|
void AfxDataInit();
|
40 |
|
|
public:
|
41 |
|
|
void SetHorizontalResizingLimit (int nPercent=100);
|
42 |
|
|
void SetMessage (LPCTSTR pszText1,LPCTSTR pszText2);
|
43 |
|
|
void SetCaption (LPCTSTR pszCaption);
|
44 |
|
|
void SetSortMode (bool bSort) { m_bSort=bSort; }
|
45 |
|
|
|
46 |
|
|
// Use this function to prepopulate the two list boxes:
|
47 |
|
|
// The optional third parameter sets the descriptions (to be displayed
|
48 |
|
|
// when the given item is the sole selected in a listbox)
|
49 |
|
|
void Insert (LPCTSTR pszItem,bool bAdded,LPCTSTR pszDesc=NULL);
|
50 |
|
|
|
51 |
|
|
// Use these functions to determine results after the dialog has been run:
|
52 |
|
|
// (will assert for items not previously inserted)
|
53 |
|
|
bool IsAdded(LPCTSTR pszItem) const;
|
54 |
|
|
bool IsAdded(int nIndex) const { return 0!=m_arnItems[nIndex]; }
|
55 |
|
|
|
56 |
|
|
// Can be used at any time:
|
57 |
|
|
int GetCount() const { return m_arnItems.GetSize(); }
|
58 |
|
|
|
59 |
|
|
CAddRemoveDialog(CWnd* pParent = NULL); // standard constructor
|
60 |
|
|
CAddRemoveDialog(UINT nIDTemplate, CWnd* pParent = NULL); // template constructor
|
61 |
|
|
|
62 |
|
|
// Dialog Data
|
63 |
|
|
//{{AFX_DATA(CAddRemoveDialog)
|
64 |
|
|
enum { IDD = IDD_ADDREMOVE_DIALOG };
|
65 |
|
|
CEdit m_wndDesc;
|
66 |
|
|
CListBox m_List2;
|
67 |
|
|
CListBox m_List1;
|
68 |
|
|
CButton m_Add;
|
69 |
|
|
CButton m_Remove;
|
70 |
|
|
//}}AFX_DATA
|
71 |
|
|
|
72 |
|
|
|
73 |
|
|
// Overrides
|
74 |
|
|
// ClassWizard generated virtual function overrides
|
75 |
|
|
//{{AFX_VIRTUAL(CAddRemoveDialog)
|
76 |
|
|
public:
|
77 |
|
|
virtual BOOL PreTranslateMessage(MSG* pMsg);
|
78 |
|
|
protected:
|
79 |
|
|
virtual void DoDataExchange(CDataExchange* pDX); // DDX/DDV support
|
80 |
|
|
//}}AFX_VIRTUAL
|
81 |
|
|
|
82 |
|
|
// Implementation
|
83 |
|
|
protected:
|
84 |
|
|
int m_nHorizontalResizingLimit;
|
85 |
|
|
bool m_bHaveDescs;
|
86 |
|
|
void UpdateDescription (CListBox &lb);
|
87 |
|
|
enum MoveType {Move,Stretch,Up};
|
88 |
|
|
void MoveChild (UINT id,int delta,MoveType how);
|
89 |
|
|
void SetSortMode(CListBox &lb);
|
90 |
|
|
int * m_arbSel;
|
91 |
|
|
CString m_strMessage1,m_strMessage2;
|
92 |
|
|
CString m_strCaption;
|
93 |
|
|
|
94 |
|
|
// Move item from lb1 to lb2
|
95 |
|
|
void Xfer (CListBox &lb1,CListBox &lp2,int nItem);
|
96 |
|
|
// Clear all selected items in a list box:
|
97 |
|
|
static void ClearSel (CListBox &lb);
|
98 |
|
|
// I have doubleclicked on lb1. Item will be moved to lb2:
|
99 |
|
|
void OnDblclk(CListBox &lb1,CListBox &lb2);
|
100 |
|
|
// Move all selected items from lb1 to lb2:
|
101 |
|
|
int Add (CListBox &lb1,CListBox &lb2);
|
102 |
|
|
|
103 |
|
|
CStringArray m_arstrItems; // List of items
|
104 |
|
|
CStringArray m_arstrDescs; // List of descriptions
|
105 |
|
|
CDWordArray m_arnItems; // Whether selected (1) or not (0)
|
106 |
|
|
|
107 |
|
|
bool m_bSort; // Whether listboxes should be sorted
|
108 |
|
|
|
109 |
|
|
// Generated message map functions
|
110 |
|
|
//{{AFX_MSG(CAddRemoveDialog)
|
111 |
|
|
afx_msg void OnAdd();
|
112 |
|
|
afx_msg void OnRemove();
|
113 |
|
|
virtual BOOL OnInitDialog();
|
114 |
|
|
afx_msg void OnDblclkList1();
|
115 |
|
|
afx_msg void OnDblclkList2();
|
116 |
|
|
afx_msg void OnSelchangeList1();
|
117 |
|
|
afx_msg void OnSelchangeList2();
|
118 |
|
|
afx_msg void OnDestroy();
|
119 |
|
|
//}}AFX_MSG
|
120 |
|
|
DECLARE_MESSAGE_MAP()
|
121 |
|
|
};
|
122 |
|
|
|
123 |
|
|
//{{AFX_INSERT_LOCATION}}
|
124 |
|
|
// Microsoft Visual C++ will insert additional declarations immediately before the previous line.
|
125 |
|
|
|
126 |
|
|
#endif // !defined(AFX_ADDREMOVEDIALOG_H__6D1D20B4_2BA5_11D3_8567_9AA54FC2F74D__INCLUDED_)
|