source: libcaca/trunk/cxx/caca++.h @ 2070

Last change on this file since 2070 was 2070, checked in by Sam Hocevar, 13 years ago
  • Added MSVC project files for the C++ bindings and the C++ test.
  • Property svn:keywords set to Id
File size: 2.2 KB
Line 
1/*
2 *  libcaca++      C++ bindings for libcaca
3 *  Copyright (c) 2006 Jean-Yves Lamoureux <jylam@lnxscene.org>
4 *                All Rights Reserved
5 *
6 *  $Id: caca++.h 2070 2007-11-25 20:23:03Z sam $
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
15/** \file caca++.h
16 *  \version \$Id: caca++.h 2070 2007-11-25 20:23:03Z sam $
17 *  \author Jean-Yves Lamoureux <jylam@lnxscene.org>
18 *  \brief The \e libcaca++ public header.
19 *
20 *  This header contains the public types and functions that applications
21 *  using \e libcaca++ may use.
22 */
23#ifndef _CACA_PP_H
24#define _CACA_PP_H
25
26#include <cucul.h>
27#include <caca.h>
28
29#include <cucul++.h>
30
31#if !defined(_DOXYGEN_SKIP_ME)
32#   undef __class
33#   if defined(_WIN32) && defined(__LIBCACA_PP__)
34#       define __class class __declspec(dllexport)
35#   else
36#       define __class class
37#   endif
38#endif
39
40__class Event
41{
42    friend class Caca;
43 public:
44    enum caca_event_type
45        {
46            CACA_EVENT_NONE =          0x0000, /**< No event. */
47
48            CACA_EVENT_KEY_PRESS =     0x0001, /**< A key was pressed. */
49            CACA_EVENT_KEY_RELEASE =   0x0002, /**< A key was released. */
50            CACA_EVENT_MOUSE_PRESS =   0x0004, /**< A mouse button was pressed. */
51            CACA_EVENT_MOUSE_RELEASE = 0x0008, /**< A mouse button was released. */
52            CACA_EVENT_MOUSE_MOTION =  0x0010, /**< The mouse was moved. */
53            CACA_EVENT_RESIZE =        0x0020, /**< The window was resized. */
54
55            CACA_EVENT_ANY =           0xffff  /**< Bitmask for any event. */
56        } type;
57
58 protected:
59    caca_event_t e;
60};
61
62__class Caca
63{
64 public:
65    Caca();
66    Caca(Cucul *cv);
67    ~Caca();
68
69    void Attach(Cucul *cv);
70    void Detach();
71    void setDisplayTime(unsigned int);
72
73    void Display();
74    unsigned int getDisplayTime();
75    unsigned int getWidth();
76    unsigned int getHeight();
77    int setTitle(char const *);
78    int getEvent(unsigned int, Event*, int);
79    unsigned int getMouseX();
80    unsigned int getMouseY();
81    void setMouse(int);
82
83 private:
84    caca_display_t *dp;
85};
86
87#endif /* _CACA_PP_H */
Note: See TracBrowser for help on using the repository browser.