MultiBtn.h 6.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190
  1. ////////////////////////////////////////////////////////////////////////////////
  2. //
  3. // Copyright 2016 RWS Inc, All Rights Reserved
  4. //
  5. // This program is free software; you can redistribute it and/or modify
  6. // it under the terms of version 2 of the GNU General Public License as published by
  7. // the Free Software Foundation
  8. //
  9. // This program is distributed in the hope that it will be useful,
  10. // but WITHOUT ANY WARRANTY; without even the implied warranty of
  11. // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  12. // GNU General Public License for more details.
  13. //
  14. // You should have received a copy of the GNU General Public License along
  15. // with this program; if not, write to the Free Software Foundation, Inc.,
  16. // 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
  17. //
  18. //////////////////////////////////////////////////////////////////////////////
  19. //
  20. // MultiBtn.h
  21. //
  22. // History:
  23. // 04/10/97 JMI Started this using RPushBtn as a template.
  24. //
  25. // 04/17/97 JMI Added Load and Save components.
  26. //
  27. // 04/22/97 JMI Added NextState().
  28. //
  29. // 09/22/97 JMI Also, added friend class CMultiBtnPropPage for GUI
  30. // editor.
  31. //
  32. //////////////////////////////////////////////////////////////////////////////
  33. //
  34. // Please see the CPP file for an explanation of this API.
  35. //
  36. //////////////////////////////////////////////////////////////////////////////
  37. #ifndef MULTIBTN_H
  38. #define MULTIBTN_H
  39. //////////////////////////////////////////////////////////////////////////////
  40. // Headers.
  41. //////////////////////////////////////////////////////////////////////////////
  42. #include "System.h"
  43. // If PATHS_IN_INCLUDES macro is defined, we can utilized relative
  44. // paths to a header file. In this case we generally go off of our
  45. // RSPiX root directory. System.h MUST be included before this macro
  46. // is evaluated. System.h is the header that, based on the current
  47. // platform (or more so in this case on the compiler), defines
  48. // PATHS_IN_INCLUDES. Blue.h includes system.h so you can include that
  49. // instead.
  50. #ifdef PATHS_IN_INCLUDES
  51. #include "ORANGE/GUI/btn.h"
  52. #else
  53. #include "btn.h"
  54. #endif // PATHS_IN_INCLUDES
  55. //////////////////////////////////////////////////////////////////////////////
  56. // Macros.
  57. //////////////////////////////////////////////////////////////////////////////
  58. //////////////////////////////////////////////////////////////////////////////
  59. // Typedefs.
  60. //////////////////////////////////////////////////////////////////////////////
  61. //////////////////////////////////////////////////////////////////////////////
  62. class RMultiBtn : public RBtn
  63. {
  64. public: // Construction/Destruction.
  65. // Default constructor.
  66. RMultiBtn(void);
  67. // Destructor.
  68. ~RMultiBtn(void);
  69. //////////////////////////////////////////////////////////////////////////////
  70. public: // Typedefs/enums.
  71. //////////////////////////////////////////////////////////////////////////////
  72. public: // Methods.
  73. ////////////////////////////////////////////////////////////////////////
  74. // Methods.
  75. ////////////////////////////////////////////////////////////////////////
  76. // Cursor event notification.
  77. // Events in event area.
  78. virtual // If you override this, call this base if possible.
  79. void CursorEvent( // Returns nothing.
  80. RInputEvent* pie); // In: Most recent user input event.
  81. // Out: pie->sUsed = TRUE, if used.
  82. // Draw background resource, if one is specified.
  83. // Utilizes m_*BkdRes* parameters to get, place, and BLiT the resource.
  84. virtual // Overridden here.
  85. void DrawBackgroundRes( // Returns nothing.
  86. RImage* pim = NULL); // Dest image, uses m_im, if NULL.
  87. // Set number of states.
  88. // This will clear all existing state images including the feedback
  89. // state.
  90. short SetNumStates( // Returns 0 on success.
  91. short sNumStates); // In: New number of states.
  92. // Set button state or feedback state image.
  93. // The feedback state image is always the first image.
  94. short SetState( // Returns 0 on success.
  95. RImage* pim, // In: Image for state sState.
  96. short sState); // In: State to update (0 == feedback state,
  97. // 1..n == state number).
  98. // Set button state or feedback state image.
  99. // The feedback state image is always the first image.
  100. short SetState( // Returns 0 on success.
  101. char* pszImageName, // In: File name of image for state sState.
  102. short sState); // In: State to update (0 == feedback state,
  103. // 1..n == state number).
  104. // Clear button state or feedback state image.
  105. // The feedback state image is always the first image.
  106. void ClearState( // Returns nothing.
  107. short sState); // In: State to clear (0 == feedback state,
  108. // 1..n == state number).
  109. // Go to the next logical state.
  110. short NextState(void); // Returns new state.
  111. ////////////////////////////////////////////////////////////////////////
  112. // Querries.
  113. ////////////////////////////////////////////////////////////////////////
  114. // Get the current image for the specified state.
  115. RImage* GetState( // Returns image, if available; NULL, otherwise.
  116. short sState); // In: State to get (0 == feedback state,
  117. // 1..n == state number).
  118. //////////////////////////////////////////////////////////////////////////////
  119. public: // Static
  120. //////////////////////////////////////////////////////////////////////////////
  121. public: // Querries.
  122. //////////////////////////////////////////////////////////////////////////////
  123. protected: // Internal functions.
  124. // Destroys current state bitmaps.
  125. void DestroyStates(void); // Returns nothing.
  126. // Read item's members from file.
  127. virtual // Overridden here.
  128. short ReadMembers( // Returns 0 on success.
  129. RFile* pfile, // File to read from.
  130. U32 u32Version); // File format version to use.
  131. // Write item's members to file.
  132. virtual // Overridden here.
  133. short WriteMembers( // Returns 0 on success.
  134. RFile* pfile); // File to write to.
  135. //////////////////////////////////////////////////////////////////////////////
  136. public: // Member variables.
  137. short m_sState; // The button's current state, 0..m_sNumStates - 1.
  138. short m_sNumStates; // Number of button states.
  139. RImage** m_papimStates; // Ptr to array of m_sNumStates + 1 ptrs to button
  140. // state images.
  141. protected: // Internal typedefs.
  142. protected: // Protected member variables.
  143. ///////////////////////////////////////////////////////////////////////////
  144. // Friends.
  145. ///////////////////////////////////////////////////////////////////////////
  146. friend class CMultiBtnPropPage;
  147. };
  148. #endif // MULTIBTN_H
  149. //////////////////////////////////////////////////////////////////////////////
  150. // EOF
  151. //////////////////////////////////////////////////////////////////////////////