1 |
|
#include "WidgetPlace.hh" |
2 |
|
#include <gtk--/menuitem.h> |
3 |
|
#include <gtk--/menu.h> |
4 |
|
|
5 |
|
#define VALUES_SEPARATOR "," |
6 |
|
|
7 |
|
void WidgetPlace::set_text(std::string const &values) |
8 |
|
{ |
9 |
|
// set_usize(-1, 25); |
10 |
|
set_flags(GTK_CAN_FOCUS); |
11 |
|
Gtk::MenuItem * mi = 0; |
12 |
|
int cpt = 0; |
13 |
|
int cpt2 = 0; |
14 |
|
std::string tmp; |
15 |
|
Gtk::Menu *m(manage(new Gtk::Menu())); |
16 |
|
while (cpt2 < values.length()) |
17 |
|
{ |
18 |
|
cpt2 = values.find(VALUES_SEPARATOR, cpt); |
19 |
|
tmp.assign(values, cpt, cpt2 - cpt); |
20 |
|
mi = manage(new Gtk::MenuItem(tmp)); |
21 |
|
m->append(*mi); |
22 |
|
cpt = cpt2 + 1; |
23 |
|
} |
24 |
|
set_menu(*m); |
25 |
|
show_all(); |
26 |
|
return; |
27 |
|
} |
28 |
|
|
29 |
|
void WidgetPlace::clear(void) |
30 |
|
{ |
31 |
|
remove_menu(); |
32 |
|
return; |
33 |
|
} |