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.
 
 
 
 
 
 

86 line
2.2 KiB

  1. /*
  2. * libcaca++ C++ bindings for libcaca
  3. * Copyright (c) 2006 Jean-Yves Lamoureux <jylam@lnxscene.org>
  4. * All Rights Reserved
  5. *
  6. * $Id$
  7. *
  8. * This library is free software. It comes without any warranty, to
  9. * the extent permitted by applicable law. You can redistribute it
  10. * and/or modify it under the terms of the Do What The Fuck You Want
  11. * To Public License, Version 2, as published by Sam Hocevar. See
  12. * http://sam.zoy.org/wtfpl/COPYING for more details.
  13. */
  14. /** \file caca++.h
  15. * \version \$Id$
  16. * \author Jean-Yves Lamoureux <jylam@lnxscene.org>
  17. * \brief The \e libcaca++ public header.
  18. *
  19. * This header contains the public types and functions that applications
  20. * using \e libcaca++ may use.
  21. */
  22. #ifndef _CACA_PP_H
  23. #define _CACA_PP_H
  24. #include <cucul.h>
  25. #include <caca.h>
  26. #include <cucul++.h>
  27. #undef __class
  28. #if defined(_WIN32) && defined(__LIBCACA_PP__)
  29. # define __class class __declspec(dllexport)
  30. #else
  31. # define __class class
  32. #endif
  33. __class Event
  34. {
  35. friend class Caca;
  36. public:
  37. enum caca_event_type
  38. {
  39. CACA_EVENT_NONE = 0x0000, /**< No event. */
  40. CACA_EVENT_KEY_PRESS = 0x0001, /**< A key was pressed. */
  41. CACA_EVENT_KEY_RELEASE = 0x0002, /**< A key was released. */
  42. CACA_EVENT_MOUSE_PRESS = 0x0004, /**< A mouse button was pressed. */
  43. CACA_EVENT_MOUSE_RELEASE = 0x0008, /**< A mouse button was released. */
  44. CACA_EVENT_MOUSE_MOTION = 0x0010, /**< The mouse was moved. */
  45. CACA_EVENT_RESIZE = 0x0020, /**< The window was resized. */
  46. CACA_EVENT_ANY = 0xffff /**< Bitmask for any event. */
  47. } type;
  48. protected:
  49. caca_event_t e;
  50. };
  51. __class Caca
  52. {
  53. public:
  54. Caca();
  55. Caca(Cucul *cv);
  56. ~Caca();
  57. void Attach(Cucul *cv);
  58. void Detach();
  59. void setDisplayTime(unsigned int);
  60. void Display();
  61. unsigned int getDisplayTime();
  62. unsigned int getWidth();
  63. unsigned int getHeight();
  64. int setTitle(char const *);
  65. int getEvent(unsigned int, Event*, int);
  66. unsigned int getMouseX();
  67. unsigned int getMouseY();
  68. void setMouse(int);
  69. private:
  70. caca_display_t *dp;
  71. };
  72. #endif /* _CACA_PP_H */