15 using namespace kome::core;
20 #define new new( _NORMAL_BLOCK, __FILE__, __LINE__ )
21 #define malloc( s ) _malloc_dbg( s, _NORMAL_BLOCK, __FILE__, __LINE__ )
49 m_items.push_back( std::make_pair(
NVL( name,
"" ),
NVL( value,
"" ) ) );
63 return m_items[ index ].first.c_str();
71 return m_items[ index ].second.c_str();
101 const char** items =
NULL;
102 const char** values =
NULL;
103 bool* selected =
NULL;
104 unsigned int num =
m_items.size();
106 items =
new const char*[ num ];
107 values =
new const char*[ num ];
108 selected =
new bool[ num ];
110 for(
unsigned int i = 0; i < num; i++ ) {
111 items[ i ] =
m_items[ i ].first.c_str();
112 values[ i ] =
m_items[ i ].second.c_str();
118 bool ret =
onSelect( num, items, values, selected );
119 for(
unsigned int i = 0; i < num; i++ ) {
124 if( items !=
NULL ) {
127 if( values !=
NULL ) {
130 if( selected !=
NULL ) {
virtual ~Selector()
destructor
virtual bool onSelect(const unsigned int num, const char **items, const char **values, bool *selected)=0
This method is called by select method. (abstract method)
interfaces of Selector class
const char * getItemName(const unsigned int index)
gets item name
int getSelection()
[in] gets selected item
#define NVL(checkVal, replaceVal)
bool isSelected(const unsigned int index)
gets selection flag value
std::vector< bool > m_selected
const char * getItemValue(const unsigned int index)
gets item value
std::vector< std::pair< std::string, std::string > > m_items
void clearItems()
clear items
bool select()
selects item
void addItem(const char *name)
adds item
unsigned int getNumberOfItems()
gets the number of items