Panda3D
Loading...
Searching...
No Matches
buttonEventList.h
Go to the documentation of this file.
1/**
2 * PANDA 3D SOFTWARE
3 * Copyright (c) Carnegie Mellon University. All rights reserved.
4 *
5 * All use of this software is subject to the terms of the revised BSD
6 * license. You should have received a copy of this license along
7 * with this source code in a file named "LICENSE."
8 *
9 * @file buttonEventList.h
10 * @author drose
11 * @date 2002-03-12
12 */
13
14#ifndef BUTTONEVENTLIST_H
15#define BUTTONEVENTLIST_H
16
17#include "pandabase.h"
18
19#include "buttonEvent.h"
20#include "typedReferenceCount.h"
21#include "eventParameter.h"
22#include "pvector.h"
23
24class ModifierButtons;
25class Datagram;
27
28/**
29 * Records a set of button events that happened recently. This class is
30 * usually used only in the data graph, to transmit the recent button presses,
31 * but it may be used anywhere a list of ButtonEvents is desired.
32 */
33class EXPCL_PANDA_EVENT ButtonEventList : public ParamValueBase {
34PUBLISHED:
35 INLINE ButtonEventList();
36 INLINE ButtonEventList(const ButtonEventList &copy);
37 INLINE void operator = (const ButtonEventList &copy);
38
39 INLINE void add_event(ButtonEvent event);
40 INLINE int get_num_events() const;
41 INLINE const ButtonEvent &get_event(int n) const;
42 INLINE void clear();
43
44 void add_events(const ButtonEventList &other);
45 void update_mods(ModifierButtons &mods) const;
46
47 virtual void output(std::ostream &out) const;
48 void write(std::ostream &out, int indent_level = 0) const;
49
50 MAKE_SEQ_PROPERTY(events, get_num_events, get_event);
51
52private:
54 Events _events;
55
56public:
57 static void register_with_read_factory();
58 virtual void write_datagram(BamWriter *manager, Datagram &dg);
59
60protected:
61 static TypedWritable *make_from_bam(const FactoryParams &params);
62
63public:
64 void fillin(DatagramIterator &scan, BamReader *manager);
65
66public:
67 static TypeHandle get_class_type() {
68 return _type_handle;
69 }
70 static void init_type() {
71 ParamValueBase::init_type();
72 register_type(_type_handle, "ButtonEventList",
73 ParamValueBase::get_class_type());
74 }
75 virtual TypeHandle get_type() const {
76 return get_class_type();
77 }
78 virtual TypeHandle force_init_type() {init_type(); return get_class_type();}
79
80private:
81 static TypeHandle _type_handle;
82};
83
84INLINE std::ostream &operator << (std::ostream &out, const ButtonEventList &buttonlist) {
85 buttonlist.output(out);
86 return out;
87}
88
89#include "buttonEventList.I"
90
91#endif
PANDA 3D SOFTWARE Copyright (c) Carnegie Mellon University.
PANDA 3D SOFTWARE Copyright (c) Carnegie Mellon University.
This is the fundamental interface for extracting binary objects from a Bam file, as generated by a Ba...
Definition bamReader.h:110
This is the fundamental interface for writing binary objects to a Bam file, to be extracted later by ...
Definition bamWriter.h:63
Records a set of button events that happened recently.
Records a button event of some kind.
Definition buttonEvent.h:49
A class to retrieve the individual data elements previously stored in a Datagram.
An ordered list of data elements, formatted in memory for transmission over a socket or writing to a ...
Definition datagram.h:38
An instance of this class is passed to the Factory when requesting it to do its business and construc...
This class monitors the state of a number of individual buttons and tracks whether each button is kno...
A non-template base class of ParamValue (below), which serves mainly to define the placeholder for th...
Definition paramValue.h:31
TypeHandle is the identifier used to differentiate C++ class types.
Definition typeHandle.h:81
Base class for objects that can be written to and read from Bam files.
virtual void fillin(DatagramIterator &scan, BamReader *manager)
This internal function is intended to be called by each class's make_from_bam() method to read in all...
virtual void write_datagram(BamWriter *manager, Datagram &dg)
Writes the contents of this object to the datagram for shipping out to a Bam file.
This is our own Panda specialization on the default STL vector.
Definition pvector.h:42
PANDA 3D SOFTWARE Copyright (c) Carnegie Mellon University.
PANDA 3D SOFTWARE Copyright (c) Carnegie Mellon University.
PANDA 3D SOFTWARE Copyright (c) Carnegie Mellon University.
void register_type(TypeHandle &type_handle, const std::string &name)
This inline function is just a convenient way to call TypeRegistry::register_type(),...
PANDA 3D SOFTWARE Copyright (c) Carnegie Mellon University.