Version: 3.0.2
wxComboPopup Class Referenceabstract

#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.
 
virtual bool Create (wxWindow *parent)=0
 The derived class must implement this to create the popup control.
 
virtual void DestroyPopup ()
 You only need to implement this member function if you create your popup class in non-standard way.
 
void Dismiss ()
 Utility function that hides the popup.
 
virtual bool FindItem (const wxString &item, wxString *trueItem=NULL)
 Implement to customize matching of value string to an item container entry.
 
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.
 
wxComboCtrlGetComboCtrl () const
 Returns pointer to the associated parent wxComboCtrl.
 
virtual wxWindowGetControl ()=0
 The derived class must implement this to return pointer to the associated control created in Create().
 
virtual wxString GetStringValue () const =0
 The derived class must implement this to return string representation of the value.
 
virtual void Init ()
 The derived class must implement this to initialize its internal variables.
 
bool IsCreated () const
 Utility method that returns true if Create has been called.
 
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.
 
virtual void OnComboDoubleClick ()
 The derived class may implement this to do something when the parent wxComboCtrl gets double-clicked.
 
virtual void OnComboKeyEvent (wxKeyEvent &event)
 The derived class may implement this to receive key events from the parent wxComboCtrl.
 
virtual void OnDismiss ()
 The derived class may implement this to do special processing when popup is hidden.
 
virtual void OnPopup ()
 The derived class may implement this to do special processing when popup is shown.
 
virtual void PaintComboControl (wxDC &dc, const wxRect &rect)
 The derived class may implement this to paint the parent wxComboCtrl.
 
virtual void SetStringValue (const wxString &value)
 The derived class must implement this to receive string value changes from wxComboCtrl.
 

Protected Attributes

wxComboCtrlm_combo
 Parent wxComboCtrl.
 

Constructor & Destructor Documentation

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

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.
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).

void wxComboPopup::Dismiss ( )

Utility function that hides the popup.

virtual bool wxComboPopup::FindItem ( const wxString item,
wxString trueItem = NULL 
)
virtual

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

Parameters
itemString entered, usually by user or from SetValue() call.
trueItemWhen 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.
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
minWidthPreferred minimum width.
prefHeightPreferred height. May be -1 to indicate no preference.
maxHeightMax height for window, as limited by screen size.
Remarks
This function is called each time popup is about to be shown.
wxComboCtrl* wxComboPopup::GetComboCtrl ( ) const

Returns pointer to the associated parent wxComboCtrl.

virtual wxWindow* wxComboPopup::GetControl ( )
pure virtual

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

virtual wxString wxComboPopup::GetStringValue ( ) const
pure virtual

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

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.

bool wxComboPopup::IsCreated ( ) const

Utility method that returns true if Create has been called.

Useful in conjunction with 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.
virtual void wxComboPopup::OnComboDoubleClick ( )
virtual

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

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.

virtual void wxComboPopup::OnDismiss ( )
virtual

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

virtual void wxComboPopup::OnPopup ( )
virtual

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

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.

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

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

Member Data Documentation

wxComboCtrl* wxComboPopup::m_combo
protected

Parent wxComboCtrl.

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