ToolMap
|
Deals with checkbox list. More...
#include <tmchecklistbox.h>
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 |
Deals with checkbox list.
This class enhance the wxChecklistBox by allowing the following operations :
tmCheckListBox::~tmCheckListBox | ( | ) |
Destructor.
Delete the popup menu if needed
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.
index | The zero based position of the item to add, -1 means add item to the end of the list |
id | the id to attach to this item |
name | the name of the item |
checked | Should we check this item, default is false |
void tmCheckListBox::ClearCheckMarks | ( | ) |
Uncheck all items.
void tmCheckListBox::ClearFilters | ( | ) |
Clear the filters and restore original arrays.
void tmCheckListBox::ClearItems | ( | ) |
Empty the checklist and associated array.
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.
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
index | zero based index of the item to modify |
id | the new id (or specify -1 for not changing the id) |
name | the new name (or specify wxEmptyString for not changing the name) |
checked | the new check state passed as short :
|
void tmCheckListBox::Filter | ( | wxString | filter | ) |
Filter the list and keep only the labels containing the string.
bool tmCheckListBox::GetItem | ( | long | index, |
long & | id, | ||
wxString & | name, | ||
bool & | bcheck | ||
) |
Get value for item at the specified position.
index | zero based index of the item we want to get |
id | the ID of the item stored in the corresponding array |
name | the string displayed in the list |
bcheck | the status of the check box |
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.
index1 | zero based index of item 1 |
index2 | zero based index of item 2, |
bool tmCheckListBox::RemoveItem | ( | long | index = -1 | ) |
Remove an item in the list.
the specified item is removed from the list and from the array
index | zero based index of item to remove. If default value (-1) is used, last item is removed |
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.
index1 | zero based index of item 1 |
index2 | zero based index of item 2, if -1 (default) is used, we use the last item from the list |