20#ifndef _TM_CHECKLISTBOX_H_
21#define _TM_CHECKLISTBOX_H_
31#include <wx/checklst.h>
32#include <wx/listctrl.h>
35#define tmLB_MENU 0x10000
38const int tmCHECK_MENU_MOVE_TOP = 13001;
39const int tmCHECK_MENU_MOVE_BOTTOM = 13002;
40const int tmCHECK_MENU_MOVE_UP = 13003;
41const int tmCHECK_MENU_MOVE_DOWN = 13004;
42const int tmCHECK_MENU_TOGGLE_FREQUENT = 13005;
59 wxArrayLong m_originalIds;
60 wxArrayString m_originalLabels;
61 wxArrayShort m_originalChecks;
64 bool CreateStandardMenu();
67 void OnDisplayPopupMenu(wxMouseEvent& event);
69 void OnMoveItemInList(wxCommandEvent& event);
71 void OnToggleFrequent(wxCommandEvent& event);
78 m_PopupMenu =
nullptr;
82 wxMenu* GetPopupMenu() {
86 virtual void EnableRelevantMenuEntries();
96 tmCheckListBox(wxWindow* parent, wxWindowID
id,
const wxPoint& pos = wxDefaultPosition,
97 const wxSize& size = wxDefaultSize,
int nStrings = 0,
const wxString* choices =
nullptr,
98 long style = 0,
const wxValidator& validator = wxDefaultValidator,
99 const wxString& name = wxListBoxNameStr) {
101 Create(parent,
id, pos, size, nStrings, choices, style, validator, name);
104 bool Create(wxWindow* parent, wxWindowID
id,
const wxPoint& pos = wxDefaultPosition,
105 const wxSize& size = wxDefaultSize,
int nStrings = 0,
const wxString* choices =
nullptr,
long style = 0,
106 const wxValidator& validator = wxDefaultValidator,
const wxString& name = wxListBoxNameStr);
109 bool AddItem(
long index = -1,
long id = -1,
const wxString& name = wxEmptyString,
bool checked =
false,
110 bool keepFilters =
false);
114 bool EditItem(
long index,
long id = -1,
const wxString& name = wxEmptyString,
short checked = 2);
116 bool SwapItem(
long index1,
long index2 = -1);
118 bool MoveItem(
long index1,
long index2);
120 bool GetItem(
long index,
long&
id, wxString& name,
bool& bcheck);
122 bool GetItemId(
long index,
long&
id);
124 bool SetItemCheck(
long index,
short checked = 2);
132 void Filter(wxString filter);
134 void ResetOriginalArrays();
136 bool StoreActualChecks();
Deals with checkbox list.
Definition tmchecklistbox.h:56
bool EditItem(long index, long id=-1, const wxString &name=wxEmptyString, short checked=2)
Modify an item.
Definition tmchecklistbox.cpp:279
void Filter(wxString filter)
Filter the list and keep only the labels containing the string.
Definition tmchecklistbox.cpp:481
void ClearCheckMarks()
Uncheck all items.
Definition tmchecklistbox.cpp:470
void ClearItems()
Empty the checklist and associated array.
Definition tmchecklistbox.cpp:438
~tmCheckListBox()
Destructor.
Definition tmchecklistbox.cpp:58
void ClearFilters()
Clear the filters and restore original arrays.
Definition tmchecklistbox.cpp:451
bool AddItem(long index=-1, long id=-1, const wxString &name=wxEmptyString, bool checked=false, bool keepFilters=false)
Add an item in the list.
Definition tmchecklistbox.cpp:212
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.
Definition tmchecklistbox.cpp:30
bool RemoveItem(long index=-1)
Remove an item in the list.
Definition tmchecklistbox.cpp:242
bool MoveItem(long index1, long index2)
Move an items to a specified position.
Definition tmchecklistbox.cpp:352
bool SwapItem(long index1, long index2=-1)
Switch two items.
Definition tmchecklistbox.cpp:319
bool GetItem(long index, long &id, wxString &name, bool &bcheck)
Get value for item at the specified position.
Definition tmchecklistbox.cpp:382