pgVirtualFrame.I 2.3 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182
  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 pgVirtualFrame.I
  10. * @author drose
  11. * @date 2005-08-17
  12. */
  13. /**
  14. * Sets the bounding rectangle of the clip frame. This is the size of the
  15. * small window through which we can see the virtual canvas. Normally, this
  16. * is the same size as the actual frame or smaller (typically it is smaller by
  17. * the size of the bevel, or to make room for scroll bars).
  18. */
  19. INLINE void PGVirtualFrame::
  20. set_clip_frame(PN_stdfloat left, PN_stdfloat right, PN_stdfloat bottom, PN_stdfloat top) {
  21. set_clip_frame(LVecBase4(left, right, bottom, top));
  22. }
  23. /**
  24. * Returns the bounding rectangle of the clip frame. See set_clip_frame().
  25. * If has_clip_frame() is false, this returns the item's actual frame.
  26. */
  27. INLINE const LVecBase4 &PGVirtualFrame::
  28. get_clip_frame() const {
  29. LightReMutexHolder holder(_lock);
  30. return _has_clip_frame ? _clip_frame : get_frame();
  31. }
  32. /**
  33. * Returns true if the clip frame has been set; see set_clip_frame(). If it
  34. * has not been set, objects in the virtual frame will not be clipped.
  35. */
  36. INLINE bool PGVirtualFrame::
  37. has_clip_frame() const {
  38. LightReMutexHolder holder(_lock);
  39. return _has_clip_frame;
  40. }
  41. /**
  42. * Changes the transform of the virtual canvas. This transform is applied to
  43. * all child nodes of the canvas_node.
  44. */
  45. INLINE void PGVirtualFrame::
  46. set_canvas_transform(const TransformState *transform) {
  47. LightReMutexHolder holder(_lock);
  48. _canvas_node->set_transform(transform);
  49. }
  50. /**
  51. * Returns the transform of the virtual canvas. This transform is applied to
  52. * all child nodes of the canvas_node.
  53. */
  54. INLINE const TransformState *PGVirtualFrame::
  55. get_canvas_transform() const {
  56. LightReMutexHolder holder(_lock);
  57. return _canvas_node->get_transform();
  58. }
  59. /**
  60. * Returns the special node that holds all of the children that appear in the
  61. * virtual canvas.
  62. */
  63. INLINE PandaNode *PGVirtualFrame::
  64. get_canvas_node() const {
  65. LightReMutexHolder holder(_lock);
  66. return _canvas_node;
  67. }
  68. /**
  69. * Returns the parent node of the canvas_node.
  70. */
  71. INLINE PandaNode *PGVirtualFrame::
  72. get_canvas_parent() const {
  73. LightReMutexHolder holder(_lock);
  74. return _canvas_parent;
  75. }