| 1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889 |
- // Filename: onOffAttribute.I
- // Created by: drose (20Mar00)
- //
- ////////////////////////////////////////////////////////////////////
- ////////////////////////////////////////////////////////////////////
- // Function: OnOffAttribute::Constructor
- // Access: Public
- // Description:
- ////////////////////////////////////////////////////////////////////
- INLINE OnOffAttribute::
- OnOffAttribute(bool is_on) {
- _is_on = is_on;
- }
- ////////////////////////////////////////////////////////////////////
- // Function: OnOffAttribute::Copy Constructor
- // Access: Public
- // Description:
- ////////////////////////////////////////////////////////////////////
- INLINE OnOffAttribute::
- OnOffAttribute(const OnOffAttribute ©) :
- NodeAttribute(copy),
- _is_on(copy._is_on)
- {
- }
- ////////////////////////////////////////////////////////////////////
- // Function: OnOffAttribute::Copy Assignment Operator
- // Access: Public
- // Description:
- ////////////////////////////////////////////////////////////////////
- INLINE void OnOffAttribute::
- operator = (const OnOffAttribute ©) {
- NodeAttribute::operator = (copy);
- _is_on = copy._is_on;
- }
- ////////////////////////////////////////////////////////////////////
- // Function: OnOffAttribute::set_on
- // Access: Public
- // Description: Changes the attribute to an 'on' attribute;
- // this turns on the attribute for all nodes at this
- // point and below. However, this particular function
- // does not change the attribute value itself, and is
- // thus only appropriate for derived attribute types
- // that do not actually carry an attribute value.
- // Derived types that *do* have an attribute value
- // should override this function to accept a value
- // parameter of the appropriate type.
- ////////////////////////////////////////////////////////////////////
- INLINE void OnOffAttribute::
- set_on() {
- _is_on = true;
- }
- ////////////////////////////////////////////////////////////////////
- // Function: OnOffAttribute::set_off
- // Access: Public
- // Description: Changes the attribute to an 'off' attribute; this
- // turns off the attribute for all nodes at this point
- // and below.
- ////////////////////////////////////////////////////////////////////
- INLINE void OnOffAttribute::
- set_off() {
- _is_on = false;
- }
- ////////////////////////////////////////////////////////////////////
- // Function: OnOffAttribute::is_on
- // Access: Public
- // Description: Returns true if the attribute is on, false if it is
- // not.
- ////////////////////////////////////////////////////////////////////
- INLINE bool OnOffAttribute::
- is_on() const {
- return _is_on;
- }
- ////////////////////////////////////////////////////////////////////
- // Function: OnOffAttribute::is_off
- // Access: Public
- // Description: Returns true if the attribute is off, false if it is
- // not.
- ////////////////////////////////////////////////////////////////////
- INLINE bool OnOffAttribute::
- is_off() const {
- return !_is_on;
- }
|