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

Last change on this file since 2304 was 2074, checked in by Sam Hocevar, 12 years ago
  • Add cucul_get_version() and caca_get_version() and updated C++ bindings accordingly.
  • The C++ test example no longer needs "config.h".
  • 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 2074 2007-11-26 01:04:32Z 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 2074 2007-11-26 01:04:32Z 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#undef __class
32#if defined(_WIN32) && defined(__LIBCACA_PP__)
33#   define __class class __declspec(dllexport)
34#else
35#   define __class class
36#endif
37
38__class Event
39{
40    friend class Caca;
41 public:
42    enum caca_event_type
43        {
44            CACA_EVENT_NONE =          0x0000, /**< No event. */
45
46            CACA_EVENT_KEY_PRESS =     0x0001, /**< A key was pressed. */
47            CACA_EVENT_KEY_RELEASE =   0x0002, /**< A key was released. */
48            CACA_EVENT_MOUSE_PRESS =   0x0004, /**< A mouse button was pressed. */
49            CACA_EVENT_MOUSE_RELEASE = 0x0008, /**< A mouse button was released. */
50            CACA_EVENT_MOUSE_MOTION =  0x0010, /**< The mouse was moved. */
51            CACA_EVENT_RESIZE =        0x0020, /**< The window was resized. */
52
53            CACA_EVENT_ANY =           0xffff  /**< Bitmask for any event. */
54        } type;
55
56 protected:
57    caca_event_t e;
58};
59
60__class Caca
61{
62 public:
63    Caca();
64    Caca(Cucul *cv);
65    ~Caca();
66
67    void Attach(Cucul *cv);
68    void Detach();
69    void setDisplayTime(unsigned int);
70
71    void Display();
72    unsigned int getDisplayTime();
73    unsigned int getWidth();
74    unsigned int getHeight();
75    int setTitle(char const *);
76    int getEvent(unsigned int, Event*, int);
77    unsigned int getMouseX();
78    unsigned int getMouseY();
79    void setMouse(int);
80
81    static char const * getVersion();
82 private:
83    caca_display_t *dp;
84};
85
86#endif /* _CACA_PP_H */
Note: See TracBrowser for help on using the repository browser.