cgv
Loading...
Searching...
No Matches
choice_event.cxx
1#include "choice_event.h"
2
3namespace cgv {
4 namespace gui {
5
8{
9 switch (type) {
10 case CET_GRAB_FOCUS: return "grab_focus";
11 case CET_LOOSE_FOCUS: return "loose_focus";
12 case CET_SELECTED: return "selected";
13 case CET_UNSELECTED: return "unselected";
14 default: return "unknown";
15 }
16}
17
18choice_event::choice_event(ChoiceEventType _type, unsigned char _modifiers, unsigned char _toggle_keys, double _time)
19 : event(EID_CHOICE,_modifiers, _toggle_keys, _time), type(_type)
20{
21}
22
23// write to stream
24void choice_event::stream_out(std::ostream& os) const
25{
27 os << " " << get_choice_type_string(type);
28}
29
30// read from stream
31void choice_event::stream_in(std::istream&)
32{
33 std::cerr << "choice_event::stream_in not implemented yet" << std::endl;
34}
37{
38 return type;
39}
40
43{
44 type = _type;
45}
46
47 }
48}
ChoiceEventType get_type() const
return whether type of choice event
ChoiceEventType type
store type of choice event
void stream_out(std::ostream &os) const
write to stream
void set_type(ChoiceEventType _type)
set the type of the choice event
void stream_in(std::istream &is)
read from stream
choice_event(ChoiceEventType _type, unsigned char _modifiers=0, unsigned char _toggle_keys=0, double _time=0)
construct a choice
virtual void stream_out(std::ostream &os) const
write to stream
Definition event.cxx:139
ChoiceEventType
different choice event types
@ EID_CHOICE
id for focus or selection change events
Definition event.h:22
std::string get_choice_type_string(ChoiceEventType type)
convert a choice event type into a readable string
the cgv namespace
Definition print.h:11