wxGridCombo Class Reference

#include <gridcombo.h>

Inheritance diagram for wxGridCombo:

wxComboCtrl wxGenericComboControl wxComboCtrlBase List of all members.

Public Member Functions

 wxGridCombo ()
 wxGridCombo (wxWindow *pwndParent, wxWindowID wiID=wxID_ANY, const wxPoint &crptPos=wxDefaultPosition, const wxSize &crszSize=wxDefaultSize, long lStyle=0, const wxString &crstrName=wxT("wxSliderComboBox"))
bool Create (wxWindow *pwndParent, wxWindowID wiID=wxID_ANY, const wxPoint &crptPos=wxDefaultPosition, const wxSize &crszSize=wxDefaultSize, long lStyle=0, const wxString &crstrName=wxT("wxSliderComboBox"))
virtual ~wxGridCombo ()
virtual void AddItem (CGridComboUserData *pUserData)
virtual CGridComboUserDataGetUserData (int iIndex)
virtual void Clear ()
virtual void DeleteUserData ()
void SetColumns (int iCols)
int GetColumns () const
int GetRows ()
void SetSelected (int iSelected)
int GetSelected () const
int GetItemsNum () const
void SetItemSize (wxSize szItem)
wxSize GetItemSize () const

Protected Member Functions

void Init ()

Protected Attributes

std::vector< CGridComboUserData * > m_vecUserData

Private Attributes

int m_iColumns
int m_iSelected
wxSize m_szItem

Detailed Description

Class : wxGridCombo Base Class : public wxComboCtrl Author : Mikhail Tatarnikov Description : wxWidgit control extension that implements grid-like behaivor. Uses wxGridComboPopup or its derivitives. Pure Virtual : None Known Issues : None Usage Notes : None Override Notes:

Definition at line 155 of file gridcombo.h.


Constructor & Destructor Documentation

wxGridCombo::wxGridCombo  )  [inline]
 

Definition at line 160 of file gridcombo.h.

00160 {Init();}

wxGridCombo::wxGridCombo wxWindow *  pwndParent,
wxWindowID  wiID = wxID_ANY,
const wxPoint &  crptPos = wxDefaultPosition,
const wxSize &  crszSize = wxDefaultSize,
long  lStyle = 0,
const wxString &  crstrName = wxT("wxSliderComboBox")
 

Definition at line 693 of file gridcombo.cpp.

00699 {
00700     Init();
00701     Create(pwndParent, wiID, crptPos, crszSize, lStyle, crstrName);
00702 }

wxGridCombo::~wxGridCombo  )  [virtual]
 

Function : wxGridCombo::~wxGridCombo Author : Mikhail Tatarnikov Purpose : Destroys the object Returns : void Exceptions: Parameters: None Notes :

Definition at line 735 of file gridcombo.cpp.

00736 {
00737     DeleteUserData();
00738 }


Member Function Documentation

void wxGridCombo::AddItem CGridComboUserData pUserData  )  [virtual]
 

Function : wxGridCombo::AddItem Author : Mikhail Tatarnikov Purpose : Adds a new item (appended to the end) Returns : void Exceptions: Parameters: [in] CGridComboUserData* pUserData - a new item to add. Notes :

Definition at line 767 of file gridcombo.cpp.

00768 {
00769     m_vecUserData.push_back(pUserData);
00770     
00771     wxGridComboPopup* pPopup = (wxGridComboPopup*)GetPopupControl();
00772     if (pPopup)
00773         pPopup->UpdateScrollers();
00774 }

void wxGridCombo::Clear void   )  [virtual]
 

Function : wxGridCombo::Clear Author : Mikhail Tatarnikov Purpose : Removes all elements from the combobox Returns : void Exceptions: Parameters: None Notes :

Definition at line 785 of file gridcombo.cpp.

00786 {
00787     DeleteUserData();
00788     
00789     wxGridComboPopup* pPopup = (wxGridComboPopup*)GetPopupControl();
00790 
00791     if (pPopup)
00792         pPopup->UpdateScrollers();
00793 }

bool wxGridCombo::Create wxWindow *  pwndParent,
wxWindowID  wiID = wxID_ANY,
const wxPoint &  crptPos = wxDefaultPosition,
const wxSize &  crszSize = wxDefaultSize,
long  lStyle = 0,
const wxString &  crstrName = wxT("wxSliderComboBox")
 

Function : wxGridCombo::Create Author : Mikhail Tatarnikov Purpose : Creates the control Returns : bool - see wxWindow::Create Exceptions: Parameters: see wxWindow::Create. Notes :

Definition at line 713 of file gridcombo.cpp.

00719 {
00720     if (!wxComboCtrl::Create(pwndParent, wiID, wxEmptyString, crptPos, crszSize, lStyle, wxDefaultValidator, crstrName))
00721         return false;
00722 
00723     return true;
00724 }

void wxGridCombo::DeleteUserData  )  [virtual]
 

Function : wxGridCombo::DeleteUserData Author : Mikhail Tatarnikov Purpose : Deletes all user data for itmes. Returns : void Exceptions: Parameters: None Notes :

Definition at line 749 of file gridcombo.cpp.

00750 {
00751     std::vector<CGridComboUserData*>::const_iterator citCur = m_vecUserData.begin();
00752     for (; citCur != m_vecUserData.end(); ++citCur)
00753         delete *citCur;
00754 
00755     m_vecUserData.clear();
00756 }

int wxGridCombo::GetColumns  )  const [inline]
 

Definition at line 187 of file gridcombo.h.

00187 {return m_iColumns;}

wxSize wxGridCombo::GetItemSize  )  const [inline]
 

Definition at line 196 of file gridcombo.h.

00196 {return m_szItem;}

int wxGridCombo::GetItemsNum void   )  const [inline]
 

Definition at line 193 of file gridcombo.h.

00193 {return m_vecUserData.size();}

int wxGridCombo::GetRows  ) 
 

Function : wxGridCombo::GetRows Author : Mikhail Tatarnikov Purpose : Calculates the number of rows. Returns : int - the number of rows. Exceptions: Parameters: None Notes :

Definition at line 822 of file gridcombo.cpp.

00823 {
00824     // Calculate the full rows based on the item number and the columns requested.
00825     // Then add a partial row if required.
00826     int iRows = GetItemsNum() / GetColumns();
00827     if (GetItemsNum() % GetColumns() != 0)
00828         iRows++;
00829 
00830     return iRows;
00831 }

int wxGridCombo::GetSelected  )  const
 

Function : wxGridCombo::GetSelected Author : Mikhail Tatarnikov Purpose : Gets the selected item Returns : int - the index of the selected item, -1 otherwise. Exceptions: Parameters: None Notes :

Definition at line 915 of file gridcombo.cpp.

00916 {
00917     return m_iSelected;
00918 }

CGridComboUserData * wxGridCombo::GetUserData int  iIndex  )  [virtual]
 

Function : wxGridCombo::GetUserData Author : Mikhail Tatarnikov Purpose : Retrieves user data associated with an item. Returns : CGridComboUserData* - the user data for the item, if any. Exceptions: Parameters: [in] int iIndex - index of the item to retrieve associated user data for. Notes :

Definition at line 805 of file gridcombo.cpp.

00806 {
00807     if (iIndex < GetItemsNum())
00808         return m_vecUserData[iIndex];
00809 
00810     return NULL;
00811 }

void wxGridCombo::Init void   )  [protected]
 

Function : wxGridCombo::Init Author : Mikhail Tatarnikov Purpose : Initialization routine Returns : void Exceptions: Parameters: None Notes :

Reimplemented from wxGenericComboControl.

Definition at line 687 of file gridcombo.cpp.

00688 {
00689     m_iColumns  = 1;    // A standard list box with one column by default.
00690     m_iSelected = -1;
00691 }

void wxGridCombo::SetColumns int  iCols  ) 
 

Function : wxGridCombo::SetColumns Author : Mikhail Tatarnikov Purpose : Sets the number of columns Returns : void Exceptions: Parameters: [in] int iCols - new column number. Notes :

Definition at line 865 of file gridcombo.cpp.

00866 {
00867     m_iColumns = iCols;
00868     
00869     wxGridComboPopup* pPopup = (wxGridComboPopup*)GetPopupControl();
00870 
00871     if (!pPopup)
00872         return;
00873 
00874     pPopup->UpdateColumnsNum();
00875 }

void wxGridCombo::SetItemSize wxSize  szItem  ) 
 

Function : wxGridCombo::SetItemSize Author : Mikhail Tatarnikov Purpose : Sets the item size Returns : void Exceptions: Parameters: [in] wxSize szItem - a new size for items. Notes : All items have the same size.

Definition at line 843 of file gridcombo.cpp.

00844 {
00845     m_szItem = szItem;
00846 
00847     wxGridComboPopup* pPopup = (wxGridComboPopup*)GetPopupControl();
00848 
00849     if (!pPopup)
00850         return;
00851 
00852     pPopup->UpdateScrollers();
00853 }

void wxGridCombo::SetSelected int  iItem  ) 
 

Function : wxGridCombo::SetSelected Author : Mikhail Tatarnikov Purpose : Selects an item. Returns : void Exceptions: Parameters: [in] int iItem - an item to select, -1 for unselecting. Notes :

Definition at line 887 of file gridcombo.cpp.

00888 {
00889     // Check if we actually changed anything.
00890     if (GetSelected() == iItem)
00891         return;
00892 
00893     wxGridComboPopup* pPopup = (wxGridComboPopup*)GetPopupControl();
00894 
00895     if (!pPopup)
00896         return;
00897 
00898     pPopup->ChangeSelection(GetSelected(), iItem);
00899 
00900     m_iSelected = iItem;
00901 
00902     // Invalidate the combo control.
00903     Refresh(false);
00904 }


Member Data Documentation

int wxGridCombo::m_iColumns [private]
 

Definition at line 207 of file gridcombo.h.

int wxGridCombo::m_iSelected [private]
 

Definition at line 209 of file gridcombo.h.

wxSize wxGridCombo::m_szItem [private]
 

Definition at line 211 of file gridcombo.h.

std::vector<CGridComboUserData*> wxGridCombo::m_vecUserData [protected]
 

Definition at line 204 of file gridcombo.h.


The documentation for this class was generated from the following files:
Generated on Sat Nov 10 04:03:18 2007 for Camelot by  doxygen 1.4.4