NIREP
|
00001 //Added in one function, GetValue() 00002 00003 //Provides a wxGridCellEditor that is specific for combo’s and takes 00004 //care of some problems with the original combo for grids. 00005 //Got from http://wiki.wxwidgets.org/WxGrid 00006 00007 #ifndef _FASTCOMBOEDITOR_H_INCLUDED_ 00008 #define _FASTCOMBOEDITOR_H_INCLUDED_ 00009 00010 #include "wx/grid.h" 00011 00012 class wxSComboBox; 00013 00014 class wxFastComboEditor : public wxGridCellEditor 00015 { 00016 public: 00017 wxFastComboEditor(size_t count = 0, 00018 const wxString choices[] = NULL, bool allowOthers = FALSE); 00019 00020 virtual void Create(wxWindow* parent, 00021 wxWindowID id, 00022 wxEvtHandler* evtHandler); 00023 00024 virtual void PaintBackground(const wxRect& rectCell, wxGridCellAttr *attr); 00025 00026 virtual void BeginEdit(int row, int col, wxGrid* grid); 00027 virtual bool EndEdit(int row, int col, const wxGrid* grid, const wxString& oldval, wxString* newval); 00028 virtual void ApplyEdit(int row, int col, wxGrid* grid); 00029 00030 virtual void Reset(); 00031 00032 // parameters string format is "item1[,item2[...,itemN]]" 00033 virtual void SetParameters(const wxString& params); 00034 00035 virtual wxGridCellEditor *Clone() const; 00036 00037 //JAH had to add in 00038 // added GetValue so we can get the value which is in the control 00039 virtual wxString GetValue() const; 00040 00041 void SetParameters(size_t count, const wxString choices[]); 00042 00043 //JAH added 00044 void SetParameters(const wxArrayString& choices); 00045 00046 //JAH added 00047 void SetChoice(wxString& selection); 00048 00049 //JAH added 00050 void AppendToCombo(wxString& append); 00051 00052 protected: 00053 wxPoint m_pointActivate; 00054 wxSComboBox *Combo() const { return (wxSComboBox*)m_control; } 00055 wxString m_startValue; 00056 wxArrayString m_choices; 00057 bool m_allowOthers; 00058 wxString m_selection; 00059 }; 00060 00061 00062 #endif // _FASTCOMBOEDITOR_H_INCLUDED_