11#ifndef __AUDACITY_WIDGETS_GRID__
12#define __AUDACITY_WIDGETS_GRID__
22#if wxUSE_ACCESSIBILITY
36#define GRID_VALUE_TIME wxT("Time")
37#define GRID_VALUE_FREQUENCY wxT("Frequency")
49 void Create(wxWindow *parent, wxWindowID
id, wxEvtHandler *
handler)
override;
51 bool IsAcceptedKey(wxKeyEvent &event)
override;
53 void SetSize(
const wxRect &rect)
override;
55 void BeginEdit(
int row,
int col, wxGrid *grid)
override;
57 bool EndEdit(
int row,
int col,
const wxGrid *grid,
const wxString &oldval, wxString *newval)
override;
59 void ApplyEdit(
int row,
int col, wxGrid *grid)
override;
61 void Reset()
override;
66 wxGridCellEditor *Clone()
const override;
67 wxString GetValue()
const override;
97 void Draw(wxGrid &grid,
103 bool isSelected)
override;
106 wxGridCellAttr &attr,
111 wxGridCellRenderer *
Clone()
const override;
123#define GRID_VALUE_CHOICE wxT("Choice")
126 :
public wxGridCellEditor, wxEvtHandler
131 const wxString choices[] = NULL);
136 void Create(wxWindow *parent,
138 wxEvtHandler *evtHandler)
override;
140 void SetSize(
const wxRect &rect)
override;
141 void BeginEdit(
int row,
int col, wxGrid *grid)
override;
142 bool EndEdit(
int row,
int col, wxGrid *grid);
143 bool EndEdit(
int row,
int col,
const wxGrid *grid,
144 const wxString &oldval, wxString *newval)
override;
145 void ApplyEdit(
int row,
int col, wxGrid *grid)
override;
146 void Reset()
override;
148 wxGridCellEditor *Clone()
const override;
150 void SetChoices(
const wxArrayString &choices);
151 wxString GetValue()
const override;
155 wxChoice *
Choice()
const {
return (wxChoice *)m_control; }
167 w->GetEventHandler()->Bind(wxEVT_KILL_FOCUS, OnKillFocus);
171 w->GetEventHandler()->Unbind(wxEVT_KILL_FOCUS, OnKillFocus);
189class AUDACITY_DLL_API
Grid final :
public wxGrid
197 const wxPoint& pos = wxDefaultPosition,
198 const wxSize&
size = wxDefaultSize,
199 long style = wxWANTS_CHARS | wxBORDER,
200 const wxString&
name = wxPanelNameStr);
204#if wxUSE_ACCESSIBILITY
206 bool InsertRows(
int pos = 0,
int numRows = 1,
bool updateLabels =
true);
207 bool AppendRows(
int numRows = 1,
bool updateLabels =
true);
208 bool DeleteRows(
int pos = 0,
int numRows = 1,
bool updateLabels =
true);
209 bool InsertCols(
int pos = 0,
int numCols = 1,
bool updateLabels =
true);
210 bool AppendCols(
int numCols = 1,
bool updateLabels =
true);
211 bool DeleteCols(
int pos = 0,
int numCols = 1,
bool updateLabels =
true);
213 GridAx *GetNextAx(GridAx *parent, wxAccRole role,
int row,
int col);
218 void OnSetFocus(wxFocusEvent &event);
219 void OnSelectCell(wxGridEvent &event);
220 void OnEditorShown(wxGridEvent &event);
221 void OnKeyDown(wxKeyEvent &event);
227#if wxUSE_ACCESSIBILITY
229 std::vector<std::unique_ptr<GridAx>> mChildren;
235 DECLARE_EVENT_TABLE()
The top-level handle to an Audacity project. It serves as a source of events that other objects can b...
void ConnectEvent(wxWindow *w)
void DisconnectEvent(wxWindow *w)
static void OnKillFocus(wxFocusEvent &WXUNUSED(event))
Modified version of wxGridChoiceEditor using wxChoice instead of wxComboBox.
wxChoice * Choice() const
bool EndEdit(int row, int col, const wxGrid *grid, const wxString &oldval, wxString *newval) override
A context in which formatter operates.
Supplies an accessible grid based on wxGrid.
FormatterContext mContext
An explicitly nonlocalized string, not meant for the user to see.
wxGridCellEditor for the NumericTextCtrl.
NumericTextCtrl * GetNumericTextControl() const
NumericConverterType mType
FormatterContext mContext
wxGridCellRenderer for the NumericTextCtrl.
NumericRenderer(const FormatterContext &context, NumericConverterType type)
FormatterContext mContext
wxGridCellRenderer * Clone() const override
~NumericRenderer() override
void Draw(wxGrid &grid, wxGridCellAttr &attr, wxDC &dc, const wxRect &rect, int row, int col, bool isSelected) override
NumericConverterType mType
wxSize GetBestSize(wxGrid &grid, wxGridCellAttr &attr, wxDC &dc, int row, int col) override
AuthorizationHandler handler