pgButton.I 2.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475
  1. // Filename: pgButton.I
  2. // Created by: drose (13Mar02)
  3. //
  4. ////////////////////////////////////////////////////////////////////
  5. //
  6. // PANDA 3D SOFTWARE
  7. // Copyright (c) 2001 - 2004, Disney Enterprises, Inc. All rights reserved
  8. //
  9. // All use of this software is subject to the terms of the Panda 3d
  10. // Software license. You should have received a copy of this license
  11. // along with this source code; you will also find a current copy of
  12. // the license at http://etc.cmu.edu/panda3d/docs/license/ .
  13. //
  14. // To contact the maintainers of this program write to
  15. // [email protected] .
  16. //
  17. ////////////////////////////////////////////////////////////////////
  18. ////////////////////////////////////////////////////////////////////
  19. // Function: PGButton::setup
  20. // Access: Published
  21. // Description: Sets up the button using the indicated NodePath as
  22. // arbitrary geometry.
  23. ////////////////////////////////////////////////////////////////////
  24. INLINE void PGButton::
  25. setup(const NodePath &ready) {
  26. setup(ready, ready, ready, ready);
  27. }
  28. ////////////////////////////////////////////////////////////////////
  29. // Function: PGButton::setup
  30. // Access: Published
  31. // Description: Sets up the button using the indicated NodePath as
  32. // arbitrary geometry.
  33. ////////////////////////////////////////////////////////////////////
  34. INLINE void PGButton::
  35. setup(const NodePath &ready, const NodePath &depressed) {
  36. setup(ready, depressed, ready, ready);
  37. }
  38. ////////////////////////////////////////////////////////////////////
  39. // Function: PGButton::setup
  40. // Access: Published
  41. // Description: Sets up the button using the indicated NodePath as
  42. // arbitrary geometry.
  43. ////////////////////////////////////////////////////////////////////
  44. INLINE void PGButton::
  45. setup(const NodePath &ready, const NodePath &depressed,
  46. const NodePath &rollover) {
  47. setup(ready, depressed, rollover, ready);
  48. }
  49. ////////////////////////////////////////////////////////////////////
  50. // Function: PGButton::get_click_prefix
  51. // Access: Published, Static
  52. // Description: Returns the prefix that is used to define the click
  53. // event for all PGButtons. The click event is the
  54. // concatenation of this string followed by get_id().
  55. ////////////////////////////////////////////////////////////////////
  56. INLINE string PGButton::
  57. get_click_prefix() {
  58. return "click-";
  59. }
  60. ////////////////////////////////////////////////////////////////////
  61. // Function: PGButton::get_click_event
  62. // Access: Published
  63. // Description: Returns the event name that will be thrown when the
  64. // button is clicked normally.
  65. ////////////////////////////////////////////////////////////////////
  66. INLINE string PGButton::
  67. get_click_event(const ButtonHandle &button) const {
  68. return "click-" + button.get_name() + "-" + get_id();
  69. }