summaryrefslogtreecommitdiff
path: root/Ivycpp.h
blob: abad2d7feace50bb14fa2356ffee6bc40d31af54 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
// Ivy.h: interface for the Ivy class.
//
//////////////////////////////////////////////////////////////////////

#if !defined(__IVY_H)
#define __IVY_H

#ifdef USE_GLFW
#include <GL/glfw.h>
#endif

namespace IvyC
{
 #include <Ivy/ivyloop.h>
 #include <Ivy/ivysocket.h>
 #include <Ivy/ivy.h>
}
#include "IvyCallback.h"

class IvyApplication;

class  Ivy  
{

public:

	Ivy();
#ifdef USE_GLFW
	Ivy( const char *name, const char* ready, IvyApplicationCallback *callback, 
	     bool argaFrc, GLFWmutex  _ivyCbmutex = NULL, IvyC::IvyDieCallback _dieCB = NULL);
#else
	Ivy( const char *name, const char* ready, IvyApplicationCallback *callback, 
	     bool argaFrc, IvyC::IvyDieCallback _dieCB = NULL);
#endif
	virtual ~Ivy();

	static long  BindMsg (const char *regexp, IvyMessageCallback *cb );
        static long  BindMsg (IvyMessageCallback *cb, const char *regexp, ... )
	  __attribute__((format(printf,2,3)));
	static void UnbindMsg( int id );

        static int  SendMsg(const char * message, ... )
	  __attribute__((format(printf,1,2))) ;
	static void SendDirectMsg( IvyApplication *app, int id, 
				   const char *message);
	static void BindDirectMsg( IvyDirectMessageCallback *callback );


	static void SetBindCallback(IvyBindingCallback* bind_callback );
	static void SetFilter( int argc, const char **argv );
	static void start(const char *domain);
	static void stop();
#ifndef USE_GLFW        
static void ivyMainLoop ();
#endif

protected:

	static void ApplicationCb( IvyC::IvyClientPtr app, void *user_data, 
				   IvyC::IvyApplicationEvent event ) ;
	static void DieCb( IvyC::IvyClientPtr app, void *user_data, int id ) ;
	static void MsgCb( IvyC::IvyClientPtr app, void *user_data, int argc, char **argv ) ;
	static void MsgDirectCb( IvyC::IvyClientPtr app, void *user_data, int id, char *msg ) ;
        static void BindCallbackCb( IvyC::IvyClientPtr app, void *user_data, int id, const char *regexp,
			            IvyC::IvyBindEvent event) ;
#ifdef USE_GLFW
  static void GLFWCALL ivyMainLoopInSeparateThread (void *arg);	

private:
  static GLFWmutex ivyCbmutex;

#endif
};

#endif // !defined(__IVY_H)