| Version: 3.2.5

Public Member Functions | List of all members
wxAddRemoveAdaptor Class Referenceabstract

`#include <wx/addremovectrl.h>`

## Detailed Description

Object used to mediate between wxAddRemoveCtrl and the control showing the list of items which can be added or removed.

This is a base class from which custom classes used with wxAddRemoveCtrl::SetAdaptor() must be derived. Object of this class are typically associated with the control showing the list of items on creation, i.e. the derived class constructor would normally take a pointer to the control which will be returned from GetItemsCtrl() later.

Since
  3.1.0

##

Library: wxCore

## Public Member Functions

| wxAddRemoveAdaptor ()
| Default and trivial constructor. More...
virtual | ~wxAddRemoveAdaptor ()
| Trivial but virtual destructor. More...
virtual wxWindow * | GetItemsCtrl () const =0
| Override to return the associated control. More...
virtual bool | CanAdd () const =0
| Override to return whether a new item can be added to the control. More...
virtual bool | CanRemove () const =0
| Override to return whether the currently selected item (if any) can be removed from the control. More...
virtual void | OnAdd ()=0
| Called when an item should be added. More...
virtual void | OnRemove ()=0
| Called when the current item should be removed. More...

## Constructor & Destructor Documentation

## ◆ wxAddRemoveAdaptor()

wxAddRemoveAdaptor::wxAddRemoveAdaptor | ( |  | ) |

Default and trivial constructor.

## ◆ ~wxAddRemoveAdaptor()

virtual wxAddRemoveAdaptor::~wxAddRemoveAdaptor | ( |  | ) |

virtual

Trivial but virtual destructor.

## Member Function Documentation

## ◆ CanAdd()

virtual bool wxAddRemoveAdaptor::CanAdd | ( |  | ) | const

pure virtual

Override to return whether a new item can be added to the control.

A typical implementation would simply always return true, but it is also possible to return false if the list is "full" and can't contain any more elements.

## ◆ CanRemove()

virtual bool wxAddRemoveAdaptor::CanRemove | ( |  | ) | const

pure virtual

Override to return whether the currently selected item (if any) can be removed from the control.

The implementation should check if there is a currently selected item and possibly if the user is allowed to remove this item.

## ◆ GetItemsCtrl()

virtual wxWindow* wxAddRemoveAdaptor::GetItemsCtrl | ( |  | ) | const

pure virtual

Override to return the associated control.

The control must be a child of the associated wxAddRemoveCtrl.

## ◆ OnAdd()

virtual void wxAddRemoveAdaptor::OnAdd | ( |  | ) |

pure virtual

Called when an item should be added.

A typical implementation would either add a new item to the list control and start editing it in place or ask the user for the item to add first and then add it to the control returned by GetItemsCtrl().

Notice that this method can only be called if CanAdd() currently returns true.

## ◆ OnRemove()

virtual void wxAddRemoveAdaptor::OnRemove | ( |  | ) |

pure virtual

Called when the current item should be removed.

The implementation should remove the currently selected item from the control and update the selection.

Notice that this method can only be called if CanRemove() currently returns true.