]> git.kernelconcepts.de Git - karo-tx-redboot.git/blob - tools/src/tools/configtool/standalone/wxwin/packagesdlg.h
Initial revision
[karo-tx-redboot.git] / tools / src / tools / configtool / standalone / wxwin / packagesdlg.h
1 //####COPYRIGHTBEGIN####
2 //
3 // ----------------------------------------------------------------------------
4 // Copyright (C) 1998, 1999, 2000 Red Hat, Inc.
5 //
6 // This program is part of the eCos host tools.
7 //
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)
11 // any later version.
12 //
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
16 // more details.
17 //
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.
21 //
22 // ----------------------------------------------------------------------------
23 //
24 //####COPYRIGHTEND####
25 // packagesdlg.h :
26 //
27 //===========================================================================
28 //#####DESCRIPTIONBEGIN####
29 //
30 // Author(s):   julians
31 // Contact(s):  julians
32 // Date:        2000/09/28
33 // Version:     $Id$
34 // Purpose:
35 // Description: Header file for ecPackagesDialog
36 // Requires:
37 // Provides:
38 // See also:
39 // Known bugs:
40 // Usage:
41 //
42 //####DESCRIPTIONEND####
43 //
44 //===========================================================================
45
46 #ifndef _ECOS_PACKAGESDLG_H_
47 #define _ECOS_PACKAGESDLG_H_
48
49 #ifdef __GNUG__
50 #pragma interface "packagesdlg.cpp"
51 #endif
52
53 #include "ecutils.h"
54 #include "wx/timer.h"
55
56 /*
57  * ecPackagesTimer
58  * Just to force idle processing now and again
59  * so that the keyword search works under OSes that
60  * have unreliable OnIdle processing
61  */
62
63 class ecPackagesDialog;
64 class ecPackagesTimer: public wxTimer
65 {
66 public:
67     ecPackagesTimer(ecPackagesDialog* dialog) { m_dialog = dialog; }
68
69     virtual void Notify() ;
70  protected:
71     ecPackagesDialog* m_dialog;
72 };
73
74 /*
75  * Add/remove packages
76  */
77
78 class ecPackagesDialog : public ecDialog
79 {
80 public:
81 // Ctor(s)
82     ecPackagesDialog(wxWindow* parent);
83     ~ecPackagesDialog();
84
85 //// Event handlers
86
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);
97
98 //// Operations
99     void CreateControls(wxWindow* parent);
100     void InitControls();
101     void Fill();
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);
112
113     void OnClearKeywords(wxCommandEvent& event);
114     void OnUpdateKeywordText(wxCommandEvent& event);
115     void OnClickOmitHardwarePackages(wxCommandEvent& event);
116     void OnClickExactMatch(wxCommandEvent& event);
117
118     void OnIdle(wxIdleEvent& event);
119
120 //// Helpers
121     // For each word in keywords, is it contained in 'str'?
122     bool MatchesKeyword(wxArrayString& keywords, const wxString& str);
123
124 //// Accessors
125     bool IsAdded(const wxString& str) ;
126     int GetCount() const { return m_items.Number(); }
127     wxString GetVersion (const wxString& item);
128
129 protected:
130
131 private:
132     DECLARE_EVENT_TABLE()
133
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)
139
140     bool            m_bHardwarePackageSelected;
141     wxString        m_packageDescription;
142     wxString        m_keywords;
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;
146 };
147
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
158
159 #endif
160         // _ECOS_PACKAGESDLG_H_