Audacity 3.2.0
Public Member Functions | Private Attributes | List of all members
ComboEditor Class Referencefinal
Inheritance diagram for ComboEditor:
[legend]
Collaboration diagram for ComboEditor:
[legend]

Public Member Functions

 ComboEditor (const wxArrayString &choices, bool allowOthers=false)
 
void PaintBackground (wxDC &, const wxRect &WXUNUSED(rectCell), const wxGridCellAttr &WXUNUSED(attr)) override
 
void SetParameters (const wxString &params) override
 
void SetSize (const wxRect &rectOrig) override
 
virtual void StartingKey (wxKeyEvent &event) override
 
wxGridCellEditor * Clone () const override
 

Private Attributes

wxArrayString m_choices
 
bool m_allowOthers
 

Detailed Description

Definition at line 40 of file TagsEditor.cpp.

Constructor & Destructor Documentation

◆ ComboEditor()

ComboEditor::ComboEditor ( const wxArrayString &  choices,
bool  allowOthers = false 
)
inline

Definition at line 43 of file TagsEditor.cpp.

44 : wxGridCellChoiceEditor(choices, allowOthers)
45 , m_choices( choices )
46 , m_allowOthers{ allowOthers }
47 {
48 }
wxArrayString m_choices
Definition: TagsEditor.cpp:137
bool m_allowOthers
Definition: TagsEditor.cpp:138

Member Function Documentation

◆ Clone()

wxGridCellEditor * ComboEditor::Clone ( ) const
inlineoverride

Definition at line 131 of file TagsEditor.cpp.

132 {
134 }
#define safenew
Definition: MemoryX.h:10

References m_allowOthers, m_choices, and safenew.

◆ PaintBackground()

void ComboEditor::PaintBackground ( wxDC &  ,
const wxRect &  WXUNUSEDrectCell,
const wxGridCellAttr &  WXUNUSEDattr 
)
inlineoverride

Definition at line 50 of file TagsEditor.cpp.

51 {
52 // Ignore it (a must on the Mac as the erasure causes problems.)
53 }

◆ SetParameters()

void ComboEditor::SetParameters ( const wxString &  params)
inlineoverride

Definition at line 55 of file TagsEditor.cpp.

56 {
57 wxGridCellChoiceEditor::SetParameters(params);
58
59 // Refresh the wxComboBox with NEW values
60 if (Combo()) {
61 Combo()->Clear();
62 Combo()->Append(m_choices);
63 }
64 }
EffectDistortionSettings params

References m_choices, and params.

◆ SetSize()

void ComboEditor::SetSize ( const wxRect &  rectOrig)
inlineoverride

Definition at line 66 of file TagsEditor.cpp.

67 {
68 wxRect rect(rectOrig);
69 wxRect r = Combo()->GetRect();
70
71 // Center the combo box in or over the cell
72 rect.y -= (r.GetHeight() - rect.GetHeight()) / 2;
73 rect.height = r.GetHeight();
74
75 wxGridCellChoiceEditor::SetSize(rect);
76 }

◆ StartingKey()

virtual void ComboEditor::StartingKey ( wxKeyEvent &  event)
inlineoverridevirtual

Definition at line 80 of file TagsEditor.cpp.

81 {
82 // Lifted from wxGridCellTextEditor and adapted to combo.
83
84 // [Below is comment from wxWidgets code]
85 // Since this is now happening in the EVT_CHAR event EmulateKeyPress is no
86 // longer an appropriate way to get the character into the text control.
87 // Do it ourselves instead. We know that if we get this far that we have
88 // a valid character, so not a whole lot of testing needs to be done.
89
90 //The only difference to wxGridCellTextEditor.
91 //wxTextCtrl* tc = (wxTextCtrl *)m_control;
92 wxComboBox * tc = Combo();
93 int ch;
94
95 bool isPrintable;
96
97 #if wxUSE_UNICODE
98 ch = event.GetUnicodeKey();
99 if ( ch != WXK_NONE )
100 isPrintable = true;
101 else
102 #endif // wxUSE_UNICODE
103 {
104 ch = event.GetKeyCode();
105 isPrintable = ch >= WXK_SPACE && ch < WXK_START;
106 }
107
108 switch (ch)
109 {
110 case WXK_DELETE:
111 // Delete the initial character when starting to edit with DELETE.
112 tc->Remove(0, 1);
113 break;
114
115 case WXK_BACK:
116 // Delete the last character when starting to edit with BACKSPACE.
117 {
118 const long pos = tc->GetLastPosition();
119 tc->Remove(pos - 1, pos);
120 }
121 break;
122
123 default:
124 if ( isPrintable )
125 tc->WriteText(static_cast<wxChar>(ch));
126 break;
127 }
128 }

Member Data Documentation

◆ m_allowOthers

bool ComboEditor::m_allowOthers
private

Definition at line 138 of file TagsEditor.cpp.

Referenced by Clone().

◆ m_choices

wxArrayString ComboEditor::m_choices
private

Definition at line 137 of file TagsEditor.cpp.

Referenced by Clone(), and SetParameters().


The documentation for this class was generated from the following file: