ToolMap
Loading...
Searching...
No Matches
tmCheckListBox Class Reference

Deals with checkbox list. More...

#include <tmchecklistbox.h>

Inheritance diagram for tmCheckListBox:
tmCheckListBoxRank

Public Member Functions

 ~tmCheckListBox ()
 Destructor.
 
 tmCheckListBox (wxWindow *parent, wxWindowID id, const wxPoint &pos=wxDefaultPosition, const wxSize &size=wxDefaultSize, int nStrings=0, const wxString *choices=nullptr, long style=0, const wxValidator &validator=wxDefaultValidator, const wxString &name=wxListBoxNameStr)
 
bool Create (wxWindow *parent, wxWindowID id, const wxPoint &pos=wxDefaultPosition, const wxSize &size=wxDefaultSize, int nStrings=0, const wxString *choices=nullptr, long style=0, const wxValidator &validator=wxDefaultValidator, const wxString &name=wxListBoxNameStr)
 Creator for two steps creation.
 
bool AddItem (long index=-1, long id=-1, const wxString &name=wxEmptyString, bool checked=false, bool keepFilters=false)
 Add an item in the list.
 
bool RemoveItem (long index=-1)
 Remove an item in the list.
 
bool EditItem (long index, long id=-1, const wxString &name=wxEmptyString, short checked=2)
 Modify an item.
 
bool SwapItem (long index1, long index2=-1)
 Switch two items.
 
bool MoveItem (long index1, long index2)
 Move an items to a specified position.
 
bool GetItem (long index, long &id, wxString &name, bool &bcheck)
 Get value for item at the specified position.
 
bool GetItemId (long index, long &id)
 
bool SetItemCheck (long index, short checked=2)
 
void ClearItems ()
 Empty the checklist and associated array.
 
void ClearFilters ()
 Clear the filters and restore original arrays.
 
void ClearCheckMarks ()
 Uncheck all items.
 
void Filter (wxString filter)
 Filter the list and keep only the labels containing the string.
 
void ResetOriginalArrays ()
 
bool StoreActualChecks ()
 

Protected Member Functions

void Init ()
 
wxMenu * GetPopupMenu ()
 
virtual void EnableRelevantMenuEntries ()
 

Protected Attributes

bool m_IsFiltered
 

Detailed Description

Deals with checkbox list.

This class enhance the wxChecklistBox by allowing the following operations :

  • Adding items with related id's
  • Removing items (and related id's)
  • Moving items between positions
  • Dealing with right click on items for displaying a contextual menu containing options for moving items.
    Author
    Lucien Schreiber (c) CREALP 2008
    Date
    14 May 2008

Constructor & Destructor Documentation

◆ ~tmCheckListBox()

tmCheckListBox::~tmCheckListBox ( )

Destructor.

Delete the popup menu if needed

Author
Lucien Schreiber (c) CREALP 2008
Date
14 May 2008

Member Function Documentation

◆ AddItem()

bool tmCheckListBox::AddItem ( long  index = -1,
long  id = -1,
const wxString &  name = wxEmptyString,
bool  checked = false,
bool  keepFilters = false 
)

Add an item in the list.

This add the item in the list and join the ID to this item.

Parameters
indexThe zero based position of the item to add, -1 means add item to the end of the list
idthe id to attach to this item
namethe name of the item
checkedShould we check this item, default is false
Returns
TRUE if item was added succesfully
Author
Lucien Schreiber (c) CREALP 2008
Date
14 May 2008

◆ ClearCheckMarks()

void tmCheckListBox::ClearCheckMarks ( )

Uncheck all items.

Author
Lucien Schreiber (c) CREALP 2009
Date
13 February 2009

◆ ClearFilters()

void tmCheckListBox::ClearFilters ( )

Clear the filters and restore original arrays.

Author
Pascal Horton (c) TERRANUM 2018
Date
3 May 2018

◆ ClearItems()

void tmCheckListBox::ClearItems ( )

Empty the checklist and associated array.

Author
Lucien Schreiber (c) CREALP 2008
Date
16 May 2008

◆ Create()

bool tmCheckListBox::Create ( wxWindow *  parent,
wxWindowID  id,
const wxPoint &  pos = wxDefaultPosition,
const wxSize &  size = wxDefaultSize,
int  nStrings = 0,
const wxString *  choices = nullptr,
long  style = 0,
const wxValidator &  validator = wxDefaultValidator,
const wxString &  name = wxListBoxNameStr 
)

Creator for two steps creation.

Author
Lucien Schreiber (c) CREALP 2008 see docs of wxCheckBoxList for parameter documentations
Date
14 May 2008

◆ EditItem()

bool tmCheckListBox::EditItem ( long  index,
long  id = -1,
const wxString &  name = wxEmptyString,
short  checked = 2 
)

Modify an item.

With this function one can change values for an item only for usefull parameters. If using default

Parameters
indexzero based index of the item to modify
idthe new id (or specify -1 for not changing the id)
namethe new name (or specify wxEmptyString for not changing the name)
checkedthe new check state passed as short :
  • 0 = FALSE
  • 1 = TRUE
  • 2 = Don't change
Returns
TRUE if item exist and, FALSE otherwise
Author
Lucien Schreiber (c) CREALP 2008
Date
14 May 2008

◆ Filter()

void tmCheckListBox::Filter ( wxString  filter)

Filter the list and keep only the labels containing the string.

Author
Pascal Horton (c) TERRANUM 2018
Date
3 May 2018

◆ GetItem()

bool tmCheckListBox::GetItem ( long  index,
long &  id,
wxString &  name,
bool &  bcheck 
)

Get value for item at the specified position.

Parameters
indexzero based index of the item we want to get
idthe ID of the item stored in the corresponding array
namethe string displayed in the list
bcheckthe status of the check box
Returns
TRUE if all was correct, FALSE if we pass an index outside the limits
Author
Lucien Schreiber (c) CREALP 2008
Date
16 May 2008

◆ MoveItem()

bool tmCheckListBox::MoveItem ( long  index1,
long  index2 
)

Move an items to a specified position.

This functions may be used for moving items and keeping id's array organised.

Parameters
index1zero based index of item 1
index2zero based index of item 2,
Returns
TRUE if item exists and FALSE if trying to move items out of limits
Author
Lucien Schreiber (c) CREALP 2008
Date
16 May 2008

◆ RemoveItem()

bool tmCheckListBox::RemoveItem ( long  index = -1)

Remove an item in the list.

the specified item is removed from the list and from the array

Parameters
indexzero based index of item to remove. If default value (-1) is used, last item is removed
Returns
TRUE if item removed sucessfully, FALSE otherwise
Author
Lucien Schreiber (c) CREALP 2008
Date
14 May 2008

◆ SwapItem()

bool tmCheckListBox::SwapItem ( long  index1,
long  index2 = -1 
)

Switch two items.

This functions may be used for switching two items and keeping id's array organised.

Parameters
index1zero based index of item 1
index2zero based index of item 2, if -1 (default) is used, we use the last item from the list
Returns
TRUE if item exists and FALSE if trying to move items out of limits
Author
Lucien Schreiber (c) CREALP 2008
Date
14 May 2008

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