Panda3D
pgVirtualFrame.I
1 // Filename: pgVirtualFrame.I
2 // Created by: drose (17Aug05)
3 //
4 ////////////////////////////////////////////////////////////////////
5 //
6 // PANDA 3D SOFTWARE
7 // Copyright (c) Carnegie Mellon University. All rights reserved.
8 //
9 // All use of this software is subject to the terms of the revised BSD
10 // license. You should have received a copy of this license along
11 // with this source code in a file named "LICENSE."
12 //
13 ////////////////////////////////////////////////////////////////////
14 
15 
16 ////////////////////////////////////////////////////////////////////
17 // Function: PGVirtualFrame::set_clip_frame
18 // Access: Published
19 // Description: Sets the bounding rectangle of the clip frame.
20 // This is the size of the small window through which we
21 // can see the virtual canvas. Normally, this is the
22 // same size as the actual frame or smaller (typically
23 // it is smaller by the size of the bevel, or to make
24 // room for scroll bars).
25 ////////////////////////////////////////////////////////////////////
26 INLINE void PGVirtualFrame::
27 set_clip_frame(PN_stdfloat left, PN_stdfloat right, PN_stdfloat bottom, PN_stdfloat top) {
28  set_clip_frame(LVecBase4(left, right, bottom, top));
29 }
30 
31 ////////////////////////////////////////////////////////////////////
32 // Function: PGVirtualFrame::get_clip_frame
33 // Access: Published
34 // Description: Returns the bounding rectangle of the clip frame.
35 // See set_clip_frame(). If has_clip_frame() is
36 // false, this returns the item's actual frame.
37 ////////////////////////////////////////////////////////////////////
38 INLINE const LVecBase4 &PGVirtualFrame::
39 get_clip_frame() const {
40  LightReMutexHolder holder(_lock);
41  return _has_clip_frame ? _clip_frame : get_frame();
42 }
43 
44 ////////////////////////////////////////////////////////////////////
45 // Function: PGVirtualFrame::has_clip_frame
46 // Access: Published
47 // Description: Returns true if the clip frame has been set; see
48 // set_clip_frame(). If it has not been set, objects in
49 // the virtual frame will not be clipped.
50 ////////////////////////////////////////////////////////////////////
51 INLINE bool PGVirtualFrame::
52 has_clip_frame() const {
53  LightReMutexHolder holder(_lock);
54  return _has_clip_frame;
55 }
56 
57 ////////////////////////////////////////////////////////////////////
58 // Function: PGVirtualFrame::set_canvas_transform
59 // Access: Published
60 // Description: Changes the transform of the virtual canvas. This
61 // transform is applied to all child nodes of the
62 // canvas_node.
63 ////////////////////////////////////////////////////////////////////
64 INLINE void PGVirtualFrame::
65 set_canvas_transform(const TransformState *transform) {
66  LightReMutexHolder holder(_lock);
67  _canvas_node->set_transform(transform);
68 }
69 
70 ////////////////////////////////////////////////////////////////////
71 // Function: PGVirtualFrame::get_canvas_transform
72 // Access: Published
73 // Description: Returns the transform of the virtual canvas. This
74 // transform is applied to all child nodes of the
75 // canvas_node.
76 ////////////////////////////////////////////////////////////////////
77 INLINE const TransformState *PGVirtualFrame::
79  LightReMutexHolder holder(_lock);
80  return _canvas_node->get_transform();
81 }
82 
83 ////////////////////////////////////////////////////////////////////
84 // Function: PGVirtualFrame::get_canvas_node
85 // Access: Published
86 // Description: Returns the special node that holds all of the
87 // children that appear in the virtual canvas.
88 ////////////////////////////////////////////////////////////////////
90 get_canvas_node() const {
91  LightReMutexHolder holder(_lock);
92  return _canvas_node;
93 }
94 
95 ////////////////////////////////////////////////////////////////////
96 // Function: PGVirtualFrame::get_canvas_parent
97 // Access: Published
98 // Description: Returns the parent node of the canvas_node.
99 ////////////////////////////////////////////////////////////////////
102  LightReMutexHolder holder(_lock);
103  return _canvas_parent;
104 }
bool has_clip_frame() const
Returns true if the clip frame has been set; see set_clip_frame().
A basic node of the scene graph or data graph.
Definition: pandaNode.h:72
void set_clip_frame(PN_stdfloat left, PN_stdfloat right, PN_stdfloat bottom, PN_stdfloat top)
Sets the bounding rectangle of the clip frame.
void set_canvas_transform(const TransformState *transform)
Changes the transform of the virtual canvas.
const TransformState * get_canvas_transform() const
Returns the transform of the virtual canvas.
const LVecBase4 & get_clip_frame() const
Returns the bounding rectangle of the clip frame.
PandaNode * get_canvas_parent() const
Returns the parent node of the canvas_node.
Similar to MutexHolder, but for a light reentrant mutex.
PandaNode * get_canvas_node() const
Returns the special node that holds all of the children that appear in the virtual canvas...
This is the base class for all three-component vectors and points.
Definition: lvecBase4.h:111
const LVecBase4 & get_frame() const
Returns the bounding rectangle of the item.
Definition: pgItem.I:131