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

Public Member Functions

 PluginDataViewStateRenderer ()
 
bool SetValue (const wxVariant &value) override
 
bool GetValue (wxVariant &) const override
 
bool Render (wxRect cell, wxDC *dc, int state) override
 
wxSize GetSize () const override
 
- Public Member Functions inherited from PluginDataViewRenderer
bool ActivateCell (const wxRect &cell, wxDataViewModel *model, const wxDataViewItem &item, unsigned col, const wxMouseEvent *mouseEvent) final
 

Private Member Functions

bool OnCellClicked (const wxRect &, wxDataViewModel *model, const wxDataViewItem &item, unsigned col, const wxMouseEvent *) override
 

Private Attributes

wxVariant mValue
 

Additional Inherited Members

virtual bool OnCellClicked (const wxRect &cell, wxDataViewModel *model, const wxDataViewItem &item, unsigned col, const wxMouseEvent *mouseEvent)
 

Detailed Description

Definition at line 113 of file PluginDataViewCtrl.cpp.

Constructor & Destructor Documentation

◆ PluginDataViewStateRenderer()

PluginDataViewStateRenderer::PluginDataViewStateRenderer ( )
inline

Definition at line 118 of file PluginDataViewCtrl.cpp.

119 : PluginDataViewRenderer("bool", wxDATAVIEW_CELL_ACTIVATABLE)
120 { }

Member Function Documentation

◆ GetSize()

wxSize PluginDataViewStateRenderer::GetSize ( ) const
inlineoverride

Definition at line 154 of file PluginDataViewCtrl.cpp.

155 {
156 return wxRendererNative::Get().GetCheckBoxSize(GetView());
157 }
Services * Get()
Fetch the global instance, or nullptr if none is yet installed.
Definition: BasicUI.cpp:202

References BasicUI::Get().

Referenced by Render().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ GetValue()

bool PluginDataViewStateRenderer::GetValue ( wxVariant &  ) const
inlineoverride

Definition at line 127 of file PluginDataViewCtrl.cpp.

128 {
129 return false;
130 }

◆ OnCellClicked()

bool PluginDataViewStateRenderer::OnCellClicked ( const wxRect &  ,
wxDataViewModel *  model,
const wxDataViewItem &  item,
unsigned  col,
const wxMouseEvent *   
)
inlineoverrideprivatevirtual

Reimplemented from PluginDataViewRenderer.

Definition at line 169 of file PluginDataViewCtrl.cpp.

174 {
175 if(!mValue.IsNull())
176 {
177 model->ChangeValue(!mValue.GetBool(), item, col);
178 return true;
179 }
180 return false;
181 }

References mValue.

◆ Render()

bool PluginDataViewStateRenderer::Render ( wxRect  cell,
wxDC *  dc,
int  state 
)
inlineoverride

Definition at line 131 of file PluginDataViewCtrl.cpp.

132 {
133 if(mValue.IsNull())
134 return false;
135 //Duplicated from wxDataViewToggleRenderer
136 int flags = 0;
137 if (mValue.GetBool())
138 flags |= wxCONTROL_CHECKED;
139 if (GetMode() != wxDATAVIEW_CELL_ACTIVATABLE ||
140 !(GetOwner()->GetOwner()->IsEnabled() && GetEnabled()))
141 {
142 flags |= wxCONTROL_DISABLED;
143 }
144 wxSize size = cell.GetSize();
145 size.IncTo(GetSize());
146 cell.SetSize(size);
147
148 wxRendererNative& renderer = wxRendererNative::Get();
149 wxWindow* const win = GetOwner()->GetOwner();
150 renderer.DrawCheckBox(win, *dc, cell, flags);
151 return true;
152 }
wxSize GetSize() const override

References BasicUI::Get(), GetSize(), mValue, and size.

Here is the call graph for this function:

◆ SetValue()

bool PluginDataViewStateRenderer::SetValue ( const wxVariant &  value)
inlineoverride

Definition at line 122 of file PluginDataViewCtrl.cpp.

123 {
124 mValue = value;
125 return true;
126 }

References mValue.

Member Data Documentation

◆ mValue

wxVariant PluginDataViewStateRenderer::mValue
private

Definition at line 115 of file PluginDataViewCtrl.cpp.

Referenced by OnCellClicked(), Render(), and SetValue().


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