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####
27 //===========================================================================
28 //#####DESCRIPTIONBEGIN####
31 // Contact(s): julians
33 // Version: $Id: packagesdlg.h,v 1.6 2001/12/14 17:34:04 julians Exp $
35 // Description: Header file for ecPackagesDialog
42 //####DESCRIPTIONEND####
44 //===========================================================================
46 #ifndef _ECOS_PACKAGESDLG_H_
47 #define _ECOS_PACKAGESDLG_H_
50 #pragma interface "packagesdlg.cpp"
58 * Just to force idle processing now and again
59 * so that the keyword search works under OSes that
60 * have unreliable OnIdle processing
63 class ecPackagesDialog;
64 class ecPackagesTimer: public wxTimer
67 ecPackagesTimer(ecPackagesDialog* dialog) { m_dialog = dialog; }
69 virtual void Notify() ;
71 ecPackagesDialog* m_dialog;
78 class ecPackagesDialog : public ecDialog
82 ecPackagesDialog(wxWindow* parent);
87 void OnOK(wxCommandEvent& event);
88 void OnCancel(wxCommandEvent& event);
89 void OnAdd(wxCommandEvent& event);
90 void OnRemove(wxCommandEvent& event);
91 void OnClickListBox1(wxCommandEvent& event);
92 void OnClickListBox2(wxCommandEvent& event);
93 void OnDblClickListBox1(wxCommandEvent& event);
94 void OnDblClickListBox2(wxCommandEvent& event);
95 void OnSelectVersion(wxCommandEvent& event);
96 void OnInitDialog(wxInitDialogEvent& event);
99 void CreateControls(wxWindow* parent);
102 void Insert(const wxString& str, bool added, const wxString& descr = wxEmptyString, const wxString& version = wxEmptyString);
103 void Add(wxListBox* from, wxListBox* to);
104 void DisplayDescription(const wxString& item);
105 void ClearDescription();
106 void HardwarePackageMessageBox();
107 void UpdateHardwareSelectionFlag();
108 void UpdatePackageDescription();
109 void UpdateVersionList();
110 void UpdateAddRemoveButtons();
111 void ClearSelections(wxListBox& lbox);
113 void OnClearKeywords(wxCommandEvent& event);
114 void OnUpdateKeywordText(wxCommandEvent& event);
115 void OnClickOmitHardwarePackages(wxCommandEvent& event);
116 void OnClickExactMatch(wxCommandEvent& event);
118 void OnIdle(wxIdleEvent& event);
121 // For each word in keywords, is it contained in 'str'?
122 bool MatchesKeyword(wxArrayString& keywords, const wxString& str);
125 bool IsAdded(const wxString& str) ;
126 int GetCount() const { return m_items.Number(); }
127 wxString GetVersion (const wxString& item);
132 DECLARE_EVENT_TABLE()
134 wxStringList m_items;
135 wxStringList m_descriptions;
136 wxArrayString m_currentVersions;
137 wxArrayString m_added; // All those packages currently (or to-be) added
138 wxArrayInt m_arnItems; // Whether in 'use list' (1) or not (0)
140 bool m_bHardwarePackageSelected;
141 wxString m_packageDescription;
143 bool m_updateLists; // If true, the keyword changed and we need to update the lists
144 long m_updateInterval; // Interval before display is updated
145 ecPackagesTimer m_timer;
148 #define ecID_PACKAGES_DIALOG_AVAILABLE_LIST 10066
149 #define ecID_PACKAGES_DIALOG_ADD 10067
150 #define ecID_PACKAGES_DIALOG_REMOVE 10068
151 #define ecID_PACKAGES_DIALOG_USE_LIST 10069
152 #define ecID_PACKAGES_DIALOG_VERSION 10070
153 #define ecID_PACKAGES_DIALOG_DESCRIPTION 10071
154 #define ecID_PACKAGES_DIALOG_KEYWORDS 10072
155 #define ecID_PACKAGES_DIALOG_CLEAR 10073
156 #define ecID_PACKAGES_DIALOG_OMIT_HARDWARE 10074
157 #define ecID_PACKAGES_DIALOG_EXACT_MATCH 10075
160 // _ECOS_PACKAGESDLG_H_