summaryrefslogtreecommitdiffhomepage
path: root/X-Plane-SDK/CHeaders/Wrappers/XPCWidget.h
blob: 788b56ac0052a527365c898a698da52148733acd (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
#ifndef _XPCWidget_h_
#define _XPCWidget_h_

#include <vector>
#include <algorithm>
#include "XPWidgets.h"

class	XPCWidget;

class	XPCWidgetAttachment {
public:

	virtual	int			HandleWidgetMessage(
								XPCWidget *		inObject,
								XPWidgetMessage	inMessage,
								XPWidgetID		inWidget,
								intptr_t		inParam1,
								intptr_t		inParam2)=0;
								
};

class	XPCWidget {
public:

						XPCWidget(
								int						inLeft,
								int						inTop,
								int						inRight,
								int						inBottom,
								bool					inVisible,
								const char *			inDescriptor,
								bool					inIsRoot,
								XPWidgetID				inParent,
								XPWidgetClass			inClass);
						XPCWidget(
								XPWidgetID				inWidget,
								bool					inOwnsWidget);
	virtual				~XPCWidget();
	
			void		SetOwnsWidget(
								bool 					inOwnsWidget);
			void		SetOwnsChildren(
								bool 					inOwnsChildren);

			operator XPWidgetID () const;
			
			XPWidgetID	Get(void) const;

			void		AddAttachment(
								XPCWidgetAttachment * 	inAttachment, 
								bool 					inOwnsAttachment,
								bool					inPrefilter);
			void		RemoveAttachment(
								XPCWidgetAttachment * 	inAttachment);

	virtual	int			HandleWidgetMessage(
								XPWidgetMessage			inMessage,
								XPWidgetID				inWidget,
								intptr_t				inParam1,
								intptr_t				inParam2);
		
private:

	static	int			WidgetCallback(
								XPWidgetMessage			inMessage,
								XPWidgetID				inWidget,
								intptr_t				inParam1,
								intptr_t				inParam2);
		
	typedef	std::pair<XPCWidgetAttachment *, bool>	AttachmentInfo;
	typedef	std::vector<AttachmentInfo>				AttachmentVector;
		
		AttachmentVector		mAttachments;
		XPWidgetID				mWidget;
		bool					mOwnsChildren;
		bool					mOwnsWidget;
	
	XPCWidget();							
	XPCWidget(const XPCWidget&);
	XPCWidget& operator=(const XPCWidget&);

};

#endif