summaryrefslogtreecommitdiff
path: root/Bus/Ivy/IvySynchroWnd.h
blob: b21b2b3fbb36718a362fc66949209fe22b6720bb (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
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
//
// SynchroWnd.h : header file
//
#pragma once
/////////////////////////////////////////////////////////////////////////////
// IvySynchroWnd window

#include "IvyApplication.h"

class IvySynchronousCallback;

class IvySynchroWnd 
{
// Construction
public:
	IvySynchroWnd();

// Attributes
public:


// Operations
public:
	void PostIvyCB( IvySynchronousCallback *cb );

// Implementation
public:
	virtual ~IvySynchroWnd();
protected:
  HWND m_hWnd;

protected:
	// Unique instance of this class
	static IvySynchroWnd *m_synchro;
	// Generated message map functions
	static LRESULT CALLBACK WindowProc(
			HWND hwnd,      // handle to window
			UINT uMsg,      // message identifier
			WPARAM wParam,  // first message parameter
			LPARAM lParam   // second message parameter
			);
	// Buffer Emission
	CRITICAL_SECTION  m_CritSection;
	typedef ivy::list<IvySynchronousCallback*> IvySynchronousCallbackList;
	IvySynchronousCallbackList callbacklist;

protected:

	LRESULT OnIvyCB(WPARAM wParam, LPARAM lParam);
	friend class IvySynchronousMessageCallback;
	friend class IvySynchronousApplicationCallback;

};
class IvySynchronousCallback
{
protected:
	IvyApplication *app;
	static IvySynchroWnd *m_synchro;
	friend class Ivy;
public:
	virtual void CallCallback() = 0;
	
};
class IvySynchronousMessageCallback: public IvySynchronousCallback,  public IvyMessageCallback
{
public:
	IvySynchronousMessageCallback( IvyMessageCallback *cb );
	virtual ~IvySynchronousMessageCallback();
	virtual void CallCallback();
	virtual void OnMessage (IvyApplication *app, int argc, const char **argv );

protected:
	IvyMessageCallback *target;
	int argc;
	char **argv;

	friend class IvySynchroWnd;
};
class IvySynchronousApplicationCallback: public IvySynchronousCallback, public  IvyApplicationCallback
{
public:
	IvySynchronousApplicationCallback( IvyApplicationCallback *cb );
	virtual void CallCallback();
	virtual void OnApplicationConnected (IvyApplication *app);
	virtual void OnApplicationDisconnected (IvyApplication *app);
protected:
	IvyApplicationCallback *target;
	typedef enum { CONNECTED_CB, DISCONNECTED_CB } CallbackType;
	CallbackType type;
		
	friend class IvySynchroWnd;
};