1 //####COPYRIGHTBEGIN####
3 // ----------------------------------------------------------------------------
4 // Copyright (C) 1998, 1999, 2000 Red Hat, Inc.
6 // This program is part of the eCos host tools.
8 // This program is free software; you can redistribute it and/or modify it
9 // under the terms of the GNU General Public License as published by the Free
10 // Software Foundation; either version 2 of the License, or (at your option)
13 // This program is distributed in the hope that it will be useful, but WITHOUT
14 // ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
15 // FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
18 // You should have received a copy of the GNU General Public License along with
19 // this program; if not, write to the Free Software Foundation, Inc.,
20 // 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
22 // ----------------------------------------------------------------------------
24 //####COPYRIGHTEND####
25 #if !defined(AFX_ADDREMOVEDIALOG_H__6D1D20B4_2BA5_11D3_8567_9AA54FC2F74D__INCLUDED_)
26 #define AFX_ADDREMOVEDIALOG_H__6D1D20B4_2BA5_11D3_8567_9AA54FC2F74D__INCLUDED_
30 #endif // _MSC_VER > 1000
31 // AddRemoveDialog.h : header file
34 #include "eCosDialog.h"
35 /////////////////////////////////////////////////////////////////////////////
36 // CAddRemoveDialog dialog
38 class CAddRemoveDialog : public CeCosDialog
44 void SetHorizontalResizingLimit (int nPercent=100);
45 void SetMessage (LPCTSTR pszText1,LPCTSTR pszText2);
46 void SetCaption (LPCTSTR pszCaption);
47 void SetSortMode (bool bSort) { m_bSort=bSort; }
49 // Use this function to prepopulate the two list boxes:
50 // The optional third parameter sets the descriptions (to be displayed
51 // when the given item is the sole selected in a listbox)
52 void Insert (LPCTSTR pszItem,bool bAdded,LPCTSTR pszDesc=NULL);
54 // Use these functions to determine results after the dialog has been run:
55 // (will assert for items not previously inserted)
56 bool IsAdded(LPCTSTR pszItem) const;
57 bool IsAdded(int nIndex) const { return 0!=m_arnItems[nIndex]; }
59 // Can be used at any time:
60 int GetCount() const { return m_arnItems.GetSize(); }
62 CAddRemoveDialog(CWnd* pParent = NULL); // standard constructor
63 CAddRemoveDialog(UINT nIDTemplate, CWnd* pParent = NULL); // template constructor
66 //{{AFX_DATA(CAddRemoveDialog)
67 enum { IDD = IDD_ADDREMOVE_DIALOG };
77 // ClassWizard generated virtual function overrides
78 //{{AFX_VIRTUAL(CAddRemoveDialog)
80 virtual BOOL PreTranslateMessage(MSG* pMsg);
82 virtual void DoDataExchange(CDataExchange* pDX); // DDX/DDV support
87 int m_nHorizontalResizingLimit;
89 void UpdateDescription (CListBox &lb);
90 enum MoveType {Move,Stretch,Up};
91 void MoveChild (UINT id,int delta,MoveType how);
92 void SetSortMode(CListBox &lb);
94 CString m_strMessage1,m_strMessage2;
97 // Move item from lb1 to lb2
98 void Xfer (CListBox &lb1,CListBox &lp2,int nItem);
99 // Clear all selected items in a list box:
100 static void ClearSel (CListBox &lb);
101 // I have doubleclicked on lb1. Item will be moved to lb2:
102 void OnDblclk(CListBox &lb1,CListBox &lb2);
103 // Move all selected items from lb1 to lb2:
104 int Add (CListBox &lb1,CListBox &lb2);
106 CStringArray m_arstrItems; // List of items
107 CStringArray m_arstrDescs; // List of descriptions
108 CDWordArray m_arnItems; // Whether selected (1) or not (0)
110 bool m_bSort; // Whether listboxes should be sorted
112 // Generated message map functions
113 //{{AFX_MSG(CAddRemoveDialog)
114 afx_msg void OnAdd();
115 afx_msg void OnRemove();
116 virtual BOOL OnInitDialog();
117 afx_msg void OnDblclkList1();
118 afx_msg void OnDblclkList2();
119 afx_msg void OnSelchangeList1();
120 afx_msg void OnSelchangeList2();
121 afx_msg void OnDestroy();
123 DECLARE_MESSAGE_MAP()
126 //{{AFX_INSERT_LOCATION}}
127 // Microsoft Visual C++ will insert additional declarations immediately before the previous line.
129 #endif // !defined(AFX_ADDREMOVEDIALOG_H__6D1D20B4_2BA5_11D3_8567_9AA54FC2F74D__INCLUDED_)