| Version: 3.2.5

Public Member Functions | Protected Attributes | List of all members
wxComboPopup Class Referenceabstract
Class List by Category » Controls

`#include <wx/combo.h>`

## Detailed Description

In order to use a custom popup with wxComboCtrl, an interface class must be derived from wxComboPopup.

For more information on how to use it, see Setting Custom Popup for wxComboCtrl.

##

Library: wxCore
Category: Controls

See also
  wxComboCtrl

## Public Member Functions

| wxComboPopup ()
| Default constructor. More...
virtual bool | Create (wxWindow *parent)=0
| The derived class must implement this to create the popup control. More...
virtual void | DestroyPopup ()
| You only need to implement this member function if you create your popup class in non-standard way. More...
void | Dismiss ()
| Utility function that hides the popup. More...
virtual bool | FindItem (const wxString &item, wxString *trueItem=NULL)
| Implement to customize matching of value string to an item container entry. More...
virtual wxSize | GetAdjustedSize (int minWidth, int prefHeight, int maxHeight)
| The derived class may implement this to return adjusted size for the popup control, according to the variables given. More...
wxComboCtrl * | GetComboCtrl () const
| Returns pointer to the associated parent wxComboCtrl. More...
virtual wxWindow * | GetControl ()=0
| The derived class must implement this to return pointer to the associated control created in Create(). More...
virtual wxString | GetStringValue () const =0
| The derived class must implement this to return string representation of the value. More...
virtual void | Init ()
| The derived class must implement this to initialize its internal variables. More...
bool | IsCreated () const
| Utility method that returns true if Create has been called. More...
virtual bool | LazyCreate ()
| The derived class may implement this to return true if it wants to delay call to Create() until the popup is shown for the first time. More...
virtual void | OnComboDoubleClick ()
| The derived class may implement this to do something when the parent wxComboCtrl gets double-clicked. More...
virtual void | OnComboKeyEvent (wxKeyEvent &event)
| The derived class may implement this to receive key events from the parent wxComboCtrl. More...
virtual void | OnDismiss ()
| The derived class may implement this to do special processing when popup is hidden. More...
virtual void | OnPopup ()
| The derived class may implement this to do special processing when popup is shown. More...
virtual void | PaintComboControl (wxDC &dc, const wxRect &rect)
| The derived class may implement this to paint the parent wxComboCtrl. More...
virtual void | SetStringValue (const wxString &value)
| The derived class must implement this to receive string value changes from wxComboCtrl. More...

## Protected Attributes

wxComboCtrl * | m_combo
| Parent wxComboCtrl. More...

## Constructor & Destructor Documentation

## ◆ wxComboPopup()

wxComboPopup::wxComboPopup | ( |  | ) |

Default constructor.

It is recommended that internal variables are prepared in Init() instead (because m_combo is not valid in constructor).

## Member Function Documentation

## ◆ Create()

virtual bool wxComboPopup::Create | ( | wxWindow * | parent | ) |

pure virtual

The derived class must implement this to create the popup control.

Returns
  true if the call succeeded, false otherwise.

## ◆ DestroyPopup()

virtual void wxComboPopup::DestroyPopup | ( |  | ) |

virtual

You only need to implement this member function if you create your popup class in non-standard way.

The default implementation can handle both multiple-inherited popup control (as seen in wxComboCtrl samples) and one allocated separately in heap.

If you do completely re-implement this function, make sure it calls Destroy() for the popup control and also deletes this object (usually as the last thing).

## ◆ Dismiss()

void wxComboPopup::Dismiss | ( |  | ) |

Utility function that hides the popup.

## ◆ FindItem()

virtual bool wxComboPopup::FindItem | ( | const wxString & | item,
|  | wxString * | trueItem = `NULL`
| ) |  |

virtual

Implement to customize matching of value string to an item container entry.

Parameters

  item | String entered, usually by user or from SetValue() call.
  trueItem | When item matches an entry, but the entry's string representation is not exactly the same (case mismatch, for example), then the true item string should be written back to here, if it is not a NULL pointer.

Remarks
  Default implementation always return true and does not alter trueItem.

## ◆ GetAdjustedSize()

virtual wxSize wxComboPopup::GetAdjustedSize | ( | int | minWidth,
|  | int | prefHeight,
|  | int | maxHeight
| ) |  |

virtual

The derived class may implement this to return adjusted size for the popup control, according to the variables given.

Parameters

  minWidth | Preferred minimum width.
  prefHeight | Preferred height. May be -1 to indicate no preference.
  maxHeight | Max height for window, as limited by screen size.

Remarks
  This function is called each time popup is about to be shown.

## ◆ GetComboCtrl()

wxComboCtrl* wxComboPopup::GetComboCtrl | ( |  | ) | const

Returns pointer to the associated parent wxComboCtrl.

## ◆ GetControl()

virtual wxWindow* wxComboPopup::GetControl | ( |  | ) |

pure virtual

The derived class must implement this to return pointer to the associated control created in Create().

## ◆ GetStringValue()

virtual wxString wxComboPopup::GetStringValue | ( |  | ) | const

pure virtual

The derived class must implement this to return string representation of the value.

## ◆ Init()

virtual void wxComboPopup::Init | ( |  | ) |

virtual

The derived class must implement this to initialize its internal variables.

This method is called immediately after construction finishes. m_combo member variable has been initialized before the call.

## ◆ IsCreated()

bool wxComboPopup::IsCreated | ( |  | ) | const

Utility method that returns true if Create has been called.

Useful in conjunction with LazyCreate().

## ◆ LazyCreate()

virtual bool wxComboPopup::LazyCreate | ( |  | ) |

virtual

The derived class may implement this to return true if it wants to delay call to Create() until the popup is shown for the first time.

It is more efficient, but on the other hand it is often more convenient to have the control created immediately.

Remarks
  Base implementation returns false.

## ◆ OnComboDoubleClick()

virtual void wxComboPopup::OnComboDoubleClick | ( |  | ) |

virtual

The derived class may implement this to do something when the parent wxComboCtrl gets double-clicked.

## ◆ OnComboKeyEvent()

virtual void wxComboPopup::OnComboKeyEvent | ( | wxKeyEvent & | event | ) |

virtual

The derived class may implement this to receive key events from the parent wxComboCtrl.

Events not handled should be skipped, as usual.

## ◆ OnDismiss()

virtual void wxComboPopup::OnDismiss | ( |  | ) |

virtual

The derived class may implement this to do special processing when popup is hidden.

## ◆ OnPopup()

virtual void wxComboPopup::OnPopup | ( |  | ) |

virtual

The derived class may implement this to do special processing when popup is shown.

## ◆ PaintComboControl()

virtual void wxComboPopup::PaintComboControl | ( | wxDC & | dc,
|  | const wxRect & | rect
| ) |  |

virtual

The derived class may implement this to paint the parent wxComboCtrl.

Default implementation draws value as string.

## ◆ SetStringValue()

virtual void wxComboPopup::SetStringValue | ( | const wxString & | value | ) |

virtual

The derived class must implement this to receive string value changes from wxComboCtrl.

## Member Data Documentation

## ◆ m_combo

wxComboCtrl* wxComboPopup::m_combo

protected

Parent wxComboCtrl.

This member variable is prepared automatically before Init() is called.