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

Last change on this file since 2821 was 2821, checked in by Sam Hocevar, 11 years ago

Starting refactoring to get rid of libcucul. The initial reason for the
split is rendered moot by the plugin system: when enabled, binaries do
not link directly with libX11 or libGL. I hope this is a step towards
more consisteny and clarity.

  • 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 2821 2008-09-27 13:12:46Z 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 2821 2008-09-27 13:12:46Z 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 <caca.h>
27#include <caca++.h>
28#include <cucul++.h>
29
30#undef __class
31#if defined(_WIN32) && defined(__LIBCACA_PP__)
32#   define __class class __declspec(dllexport)
33#else
34#   define __class class
35#endif
36
37__class Event
38{
39    friend class Caca;
40 public:
41    enum caca_event_type
42        {
43            CACA_EVENT_NONE =          0x0000, /**< No event. */
44
45            CACA_EVENT_KEY_PRESS =     0x0001, /**< A key was pressed. */
46            CACA_EVENT_KEY_RELEASE =   0x0002, /**< A key was released. */
47            CACA_EVENT_MOUSE_PRESS =   0x0004, /**< A mouse button was pressed. */
48            CACA_EVENT_MOUSE_RELEASE = 0x0008, /**< A mouse button was released. */
49            CACA_EVENT_MOUSE_MOTION =  0x0010, /**< The mouse was moved. */
50            CACA_EVENT_RESIZE =        0x0020, /**< The window was resized. */
51
52            CACA_EVENT_ANY =           0xffff  /**< Bitmask for any event. */
53        } type;
54
55 protected:
56    caca_event_t e;
57};
58
59__class Caca
60{
61 public:
62    Caca();
63    Caca(Canvas *cv);
64    ~Caca();
65
66    void Attach(Canvas *cv);
67    void Detach();
68    void setDisplayTime(unsigned int);
69
70    void Display();
71    unsigned int getDisplayTime();
72    unsigned int getWidth();
73    unsigned int getHeight();
74    int setTitle(char const *);
75    int getEvent(unsigned int, Event*, int);
76    unsigned int getMouseX();
77    unsigned int getMouseY();
78    void setMouse(int);
79
80    static char const * getVersion();
81 private:
82    caca_display_t *dp;
83};
84
85#endif /* _CACA_PP_H */
Note: See TracBrowser for help on using the repository browser.