bbtkWxGUIPackageBrowser2.h
Go to the documentation of this file.00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022
00023
00024
00025
00026
00027
00028
00029
00030
00031
00048 #ifdef _USE_WXWIDGETS_
00049
00050
00051 #ifndef __bbtkWxGUIPackageBrowser2_h__
00052 #define __bbtkWxGUIPackageBrowser2_h__
00053
00054
00055 #include "bbtkWx.h"
00056
00057 #include "bbtkInterpreter.h"
00058 #include <wx/aui/aui.h>
00059
00060
00061 #include <wx/dnd.h>
00062 #include <wx/dataobj.h>
00063 #include "wx/listctrl.h"
00064
00065
00066 #if defined(__WXMOTIF__) || defined(__WXPM__) || defined(__WXX11__) || defined(__WXMGL__)
00067 #define USE_CONTEXT_MENU 0
00068 #else
00069 #define USE_CONTEXT_MENU 1
00070 #endif
00071
00072
00073 namespace bbtk
00074 {
00075
00076 class WxGUIPackageBrowser2;
00077
00078
00079
00080
00082 class BBTK_EXPORT WxGUIPackageBrowser2User
00083 {
00084 public:
00085 WxGUIPackageBrowser2User() {}
00086 virtual ~WxGUIPackageBrowser2User() {}
00088 virtual void WxGUIPackageBrowser2Run() {}
00089 };
00090
00091
00092
00093
00094 class WxGUIBlackBoxInfo : public wxPanel
00095 {
00096 public:
00097 WxGUIBlackBoxInfo(wxWindow* parent);
00098 ~WxGUIBlackBoxInfo();
00099
00100 void UpdateInfo(BlackBoxDescriptor* descr);
00101 void InsertInputOutput(wxListCtrl* l, BlackBoxInputOutputDescriptor* i);
00102 private:
00103 BlackBoxDescriptor* mDescriptor;
00104 wxStaticText* mName;
00105 wxStaticText* mDescription;
00106 wxStaticText* mAuthor;
00107 wxStaticText* mCategory;
00108
00109 wxListCtrl* mInputList;
00110 wxListCtrl* mOutputList;
00111 } ;
00112
00113
00114
00115 class WxGUIBlackBoxListUser
00116 {
00117 public:
00118 WxGUIBlackBoxListUser() {}
00119 virtual ~WxGUIBlackBoxListUser() {}
00120
00121
00122 virtual void WxGUIBlackBoxListUserOnSelected( BlackBoxDescriptor* ) {}
00123 };
00124
00125
00126
00127 class WxGUIBlackBoxList: public wxListCtrl
00128 {
00129 public:
00130 WxGUIBlackBoxList(wxWindow *parent,
00131 const wxWindowID id,
00132 const wxPoint& pos,
00133 const wxSize& size,
00134 long style);
00135
00136
00137 void SetUser(WxGUIBlackBoxListUser* u) { mUser = u; }
00138
00139
00140 void Insert(BlackBoxDescriptor::Pointer d);
00141
00142
00143 void OnColClick(wxListEvent& event);
00144 void OnColRightClick(wxListEvent& event);
00145 void OnColBeginDrag(wxListEvent& event);
00146 void OnColDragging(wxListEvent& event);
00147 void OnColEndDrag(wxListEvent& event);
00148 void OnBeginDrag(wxListEvent& event);
00149 void OnBeginRDrag(wxListEvent& event);
00150 void OnBeginLabelEdit(wxListEvent& event);
00151 void OnEndLabelEdit(wxListEvent& event);
00152 void OnDeleteItem(wxListEvent& event);
00153 void OnDeleteAllItems(wxListEvent& event);
00154 #if WXWIN_COMPATIBILITY_2_4
00155 void OnGetInfo(wxListEvent& event);
00156 void OnSetInfo(wxListEvent& event);
00157 #endif
00158 void OnSelected(wxListEvent& event);
00159 void OnDeselected(wxListEvent& event);
00160 void OnListKeyDown(wxListEvent& event);
00161 void OnActivated(wxListEvent& event);
00162 void OnFocused(wxListEvent& event);
00163 void OnCacheHint(wxListEvent& event);
00164
00165 void OnChar(wxKeyEvent& event);
00166
00167 #if USE_CONTEXT_MENU
00168 void OnContextMenu(wxContextMenuEvent& event);
00169 #endif
00170
00171 void OnRightClick(wxMouseEvent& event);
00172
00173 private:
00174 void ShowContextMenu(const wxPoint& pos);
00175
00176 void SetColumnImage(int col, int image);
00177
00178 void LogEvent(const wxListEvent& event, const wxChar *eventName);
00179 void LogColEvent(const wxListEvent& event, const wxChar *eventName);
00180
00181 virtual wxString OnGetItemText(long item, long column) const;
00182 virtual int OnGetItemColumnImage(long item, long column) const;
00183 virtual wxListItemAttr *OnGetItemAttr(long item) const;
00184
00185 WxGUIBlackBoxListUser* mUser;
00186
00187 wxListItemAttr m_attr;
00188
00189
00190 DECLARE_EVENT_TABLE()
00191 };
00192
00193
00194
00196 class BBTK_EXPORT WxGUIPackageBrowser2 : public wxPanel,
00197 public WxGUIBlackBoxListUser
00198 {
00199 public:
00200 WxGUIPackageBrowser2( wxWindow *parent,
00201 WxGUIPackageBrowser2User* user = 0 );
00202 ~WxGUIPackageBrowser2();
00203
00204 void IncludeAll();
00205 void BuildFromFactory(Factory::Pointer f);
00206 void RebuildList();
00207 bool IsVisible(BlackBoxDescriptor::Pointer d);
00208
00209 void OnFilter(wxCommandEvent&);
00210
00211
00212 void WxGUIBlackBoxListUserOnSelected( BlackBoxDescriptor* );
00213
00214
00215 BlackBoxDescriptor* GetActualSelected();
00216 Factory::Pointer GetFactory();
00217
00218 private:
00219 wxAuiManager m_mgr;
00220 WxGUIPackageBrowser2User* mUser;
00221 Interpreter::Pointer mInterpreter;
00222 Factory::Pointer mFactory;
00223 WxGUIBlackBoxList* mBoxList;
00224 WxGUIBlackBoxInfo* mBoxInfo;
00225
00226 wxTextCtrl *mPackageFilter;
00227 wxTextCtrl *mNameFilter;
00228 wxTextCtrl *mDescriptionFilter;
00229 wxTextCtrl *mCategoryFilter;
00230 wxTextCtrl *mInputTypeFilter;
00231 wxTextCtrl *mOutputTypeFilter;
00232 wxTextCtrl *mInputNatureFilter;
00233 wxTextCtrl *mOutputNatureFilter;
00234
00235 wxCheckBox *mShowWidgetsFilter;
00236 wxCheckBox *mShowAdaptorsFilter;
00237 wxCheckBox *mShowGUIsFilter;
00238
00239
00240 BlackBoxDescriptor *_actualSelected;
00241
00242 bool findnpos(const std::string &strA, const std::string &strB );
00243
00244 DECLARE_EVENT_TABLE()
00245 };
00246
00247
00248
00249
00251 class BBTK_EXPORT WxGUIPackageBrowser2Window : public wxFrame
00252
00253 {
00254 public:
00255 WxGUIPackageBrowser2Window( wxWindow *parent, wxString title, wxSize size);
00256 ~WxGUIPackageBrowser2Window();
00257
00258
00259
00260
00261 private :
00262
00263 WxGUIPackageBrowser2* mBrowser;
00264
00265 };
00266
00267
00268
00269 }
00270
00271
00272 #endif // __bbtkWxGUIPackageBrowser_h__
00273
00274 #endif //_USE_WXWIDGETS_