You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

96 lines
3.3KB

  1. /*
  2. ==============================================================================
  3. This file is part of the dRowAudio JUCE module
  4. Copyright 2004-13 by dRowAudio.
  5. ------------------------------------------------------------------------------
  6. dRowAudio is provided under the terms of The MIT License (MIT):
  7. Permission is hereby granted, free of charge, to any person obtaining a copy
  8. of this software and associated documentation files (the "Software"), to deal
  9. in the Software without restriction, including without limitation the rights
  10. to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
  11. copies of the Software, and to permit persons to whom the Software is
  12. furnished to do so, subject to the following conditions:
  13. The above copyright notice and this permission notice shall be included in all
  14. copies or substantial portions of the Software.
  15. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
  16. IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
  17. FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
  18. AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
  19. LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
  20. OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
  21. SOFTWARE.
  22. ==============================================================================
  23. */
  24. #ifndef __DROWAUDIO_CLOCK_H__
  25. #define __DROWAUDIO_CLOCK_H__
  26. //==============================================================================
  27. /** A handy digital graphical clock.
  28. Just add one of these to your component and it will display the time,
  29. continually updating itself. Set the look and feel of it as you would
  30. a normal label.
  31. */
  32. class Clock : public Label,
  33. public Timer
  34. {
  35. public:
  36. //==============================================================================
  37. /** A number of flags to set what sort of clock is displayed
  38. */
  39. enum TimeDisplayFormat
  40. {
  41. showDate = 1,
  42. showTime = 2,
  43. showSeconds = 4,
  44. show24Hr = 8,
  45. showDayShort = 16,
  46. showDayLong = 32,
  47. };
  48. //==============================================================================
  49. /** Constructor.
  50. Just add and make visible one of these to your component and it
  51. will display the current time and continually update itself.
  52. */
  53. Clock();
  54. /** Destructor.
  55. */
  56. ~Clock();
  57. /** Sets the display format of the clock.
  58. To specify what sort of clock to display pass in a number of the
  59. TimeDisplayFormat flags. This is semi-inteligent so may choose to
  60. ignore certain flags such as the short day name if you have also
  61. specified the long day name.
  62. */
  63. void setTimeDisplayFormat (const int newFormat);
  64. /** Returns the width required to display all of the clock's information.
  65. */
  66. int getRequiredWidth();
  67. //==============================================================================
  68. /** @internal */
  69. void timerCallback();
  70. private:
  71. //==============================================================================
  72. int displayFormat;
  73. String timeAsString;
  74. //==============================================================================
  75. JUCE_DECLARE_NON_COPYABLE_WITH_LEAK_DETECTOR (Clock);
  76. };
  77. #endif // __DROWAUDIO_CLOCK_H__