Welcome to mirror list, hosted at ThFree Co, Russian Federation.

FbBookEvent.h « MyRuLib « sources - github.com/lintest/myrulib.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
blob: 5430050a435e3cebc0f48506b14ad4cee9d36e7e (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
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
#ifndef __FBBOOKEVENT_H__
#define __FBBOOKEVENT_H__

#include <wx/wx.h>
#include <wx/wxsqlite3.h>
#include "FbBookTypes.h"
#include "FbMasterInfo.h"
#include "FbMasterTypes.h"

DECLARE_LOCAL_EVENT_TYPE( fbEVT_BOOK_ACTION,     1 )
DECLARE_LOCAL_EVENT_TYPE( fbEVT_MODEL_ACTION,    2 )
DECLARE_LOCAL_EVENT_TYPE( fbEVT_OPEN_ACTION,     3 )
DECLARE_LOCAL_EVENT_TYPE( fbEVT_FOLDER_ACTION,   4 )
DECLARE_LOCAL_EVENT_TYPE( fbEVT_PROGRESS_ACTION, 5 )
DECLARE_LOCAL_EVENT_TYPE( fbEVT_MASTER_ACTION,   6 )
DECLARE_LOCAL_EVENT_TYPE( fbEVT_EXPORT_ACTION,   7 )
DECLARE_LOCAL_EVENT_TYPE( fbEVT_ARRAY_ACTION,    8 )
DECLARE_LOCAL_EVENT_TYPE( fbEVT_COUNT_ACTION,    9 )
DECLARE_LOCAL_EVENT_TYPE( fbEVT_IMAGE_ACTION,   10 )
DECLARE_LOCAL_EVENT_TYPE( fbEVT_LETTERS_ACTION, 11 )
DECLARE_LOCAL_EVENT_TYPE( fbEVT_INIT_FRAMES,    12 )

class FbModel;

class FbMasterData;

class FbCommandEvent: public wxCommandEvent
{
	public:
		FbCommandEvent(wxEventType commandType, int winid, const wxString &sting = wxEmptyString)
			: wxCommandEvent(commandType, winid) { SetString(sting); };
		FbCommandEvent(wxEventType commandType, int winid, int id, const wxString &sting = wxEmptyString)
			: wxCommandEvent(commandType, winid) { SetInt(id); SetString(sting); };
		FbCommandEvent(const wxCommandEvent& event)
			: wxCommandEvent(event) {};
	public:
		void Post(wxEvtHandler *dest);
		void Post();
};

class FbModelEvent: public FbCommandEvent
{
	public:
		FbModelEvent(wxWindowID winid)
			: FbCommandEvent(fbEVT_MODEL_ACTION, winid), m_model(NULL) {}

		FbModelEvent(const FbModelEvent & event)
			: FbCommandEvent(event), m_model(event.m_model) {}

		FbModelEvent(wxWindowID winid, FbModel * model, int index = 0)
			: FbCommandEvent(fbEVT_MODEL_ACTION, winid, index), m_model(model) {}

		virtual wxEvent *Clone() const
			{ return new FbModelEvent(*this); }

		FbModel * GetModel() const
			{ return m_model; }

	public:
		FbModel * m_model;
};

class FbMasterEvent: public FbCommandEvent
{
	public:
		FbMasterEvent(wxWindowID id)
			: FbCommandEvent(fbEVT_MASTER_ACTION, id), m_book(0), m_add(true) {};

		FbMasterEvent(const FbMasterEvent & event)
			: FbCommandEvent(event), m_info(event.m_info), m_book(event.m_book), m_add(event.m_add) {};

		FbMasterEvent(wxWindowID id, const FbMasterInfo &info, int book, bool add)
			: FbCommandEvent(fbEVT_MASTER_ACTION, id), m_info(info), m_book(book), m_add(add) {};

		virtual wxEvent *Clone() const { return new FbMasterEvent(*this); }

	public:
		FbMasterInfo m_info;
		int m_book;
		bool m_add;
};

class FbOpenEvent: public FbCommandEvent
{
	public:
		FbOpenEvent(wxWindowID id, int code, int book = 0)
			: FbCommandEvent(fbEVT_OPEN_ACTION, id), m_code(code), m_book(book) {};

		FbOpenEvent(const FbOpenEvent & event)
			: FbCommandEvent(event), m_code(event.m_code), m_book(event.m_book) {};

		virtual wxEvent *Clone() const { return new FbOpenEvent(*this); }

	public:
		int m_code;
		int m_book;
};

class FbFolderEvent: public FbCommandEvent
{
	public:
		FbFolderEvent(wxWindowID id, int folder, FbFolderType type)
			: FbCommandEvent(fbEVT_FOLDER_ACTION, id), m_folder(folder), m_type(type) {};

		FbFolderEvent(const FbFolderEvent & event)
			: FbCommandEvent(event), m_folder(event.m_folder), m_type(event.m_type) {};

		virtual wxEvent *Clone() const { return new FbFolderEvent(*this); }

	public:
		int m_folder;
		FbFolderType m_type;
};

class FbProgressEvent: public FbCommandEvent
{
	public:
		FbProgressEvent(wxWindowID id, const wxString &str = wxEmptyString, const int pos = 0, const wxString &text = wxEmptyString)
			: FbCommandEvent(fbEVT_PROGRESS_ACTION, id), m_str(str), m_pos(pos), m_text(text) {};

		FbProgressEvent(const FbProgressEvent & event)
			: FbCommandEvent(event), m_str(event.m_str), m_pos(event.m_pos), m_text(event.m_text) {};

		virtual wxEvent *Clone() const { return new FbProgressEvent(*this); }

	public:
		wxString m_str;
		int m_pos;
		wxString m_text;
};

class FbArrayEvent: public FbCommandEvent
{
	public:
		static int CompareInt(int x, int y) { return x - y; }

		FbArrayEvent(wxWindowID winid)
			: FbCommandEvent(fbEVT_ARRAY_ACTION, winid), m_check(CompareInt) {}

		FbArrayEvent(const FbArrayEvent & event)
			: FbCommandEvent(event), m_array(event.m_array), m_check(event.m_check) {}

		FbArrayEvent(wxWindowID winid, const wxArrayInt & array, int index = 0)
			: FbCommandEvent(fbEVT_ARRAY_ACTION, winid, index), m_array(array), m_check(CompareInt) {}

		FbArrayEvent(wxWindowID winid, const wxArrayInt & array, const FbSortedArrayInt &check, int index = 0)
			: FbCommandEvent(fbEVT_ARRAY_ACTION, winid, index), m_array(array), m_check(check) {}

		virtual wxEvent *Clone() const
			{ return new FbArrayEvent(*this); }

		const wxArrayInt & GetArray() const
			{ return m_array; }

	private:
		wxArrayInt m_array;
		FbSortedArrayInt m_check;
};

class FbCountEvent: public FbCommandEvent
{
	public:
		FbCountEvent(wxWindowID winid)
			: FbCommandEvent(fbEVT_COUNT_ACTION, winid), m_count(0) {}

		FbCountEvent(const FbCountEvent & event)
			: FbCommandEvent(event), m_info(event.m_info), m_count(event.m_count) {}

		FbCountEvent(wxWindowID winid, const FbMasterInfo &info, int count)
			: FbCommandEvent(fbEVT_COUNT_ACTION, winid), m_info(info), m_count(count) {}

		virtual wxEvent *Clone() const
			{ return new FbCountEvent(*this); }

		const FbMasterInfo & GetInfo() const
			{ return m_info; }

		int GetCount() const
			{ return m_count; }

	private:
		FbMasterInfo m_info;
		int m_count;
};

class FbImageEvent: public FbCommandEvent
{
	public:
		FbImageEvent(wxWindowID winid)
			: FbCommandEvent(fbEVT_ARRAY_ACTION, winid) {}

		FbImageEvent(const FbImageEvent & event)
			: FbCommandEvent(event), m_image(event.m_image) {}

		FbImageEvent(wxWindowID winid, const wxImage & image, int id, const wxString &str = wxEmptyString)
			: FbCommandEvent(fbEVT_IMAGE_ACTION, winid, id, str), m_image(image) {}

		virtual wxEvent *Clone() const
			{ return new FbImageEvent(*this); }

		const wxImage & GetImage() const
			{ return m_image; }

	private:
		wxImage m_image;
};

class FbLettersEvent: public FbCommandEvent
{
	public:
		FbLettersEvent(const FbLettersEvent & event)
			: FbCommandEvent(event), m_letters(event.m_letters), m_position(event.m_position), m_divider(event.m_divider) {}

		FbLettersEvent(wxWindowID winid, const wxArrayString & letters, int position, int divider)
			: FbCommandEvent(fbEVT_LETTERS_ACTION, winid), m_letters(letters), m_position(position), m_divider(divider) {}

		virtual wxEvent *Clone() const
			{ return new FbLettersEvent(*this); }

		const wxArrayString & GetLetters() const
			{ return m_letters; }

		int GetPosition() const
			{ return m_position; }

		int GetDivider() const
			{ return m_divider; }

	private:
		wxArrayString m_letters;
		int m_position;
		int m_divider;
};

typedef void (wxEvtHandler::*FbModelEventFunction)(FbModelEvent&);

typedef void (wxEvtHandler::*FbOpenEventFunction)(FbOpenEvent&);

typedef void (wxEvtHandler::*FbFolderEventFunction)(FbFolderEvent&);

typedef void (wxEvtHandler::*FbProgressEventFunction)(FbProgressEvent&);

typedef void (wxEvtHandler::*FbMasterEventFunction)(FbMasterEvent&);

typedef void (wxEvtHandler::*FbArrayEventFunction)(FbArrayEvent&);

typedef void (wxEvtHandler::*FbCountEventFunction)(FbCountEvent&);

typedef void (wxEvtHandler::*FbImageEventFunction)(FbImageEvent&);

typedef void (wxEvtHandler::*FbLettersEventFunction)(FbLettersEvent&);

#define EVT_FB_BOOK(id, fn) \
	DECLARE_EVENT_TABLE_ENTRY( fbEVT_BOOK_ACTION, id, -1, \
	(wxObjectEventFunction) (wxEventFunction) (wxCommandEventFunction) (wxNotifyEventFunction) \
	wxStaticCastEvent( FbBookEventFunction, & fn ), (wxObject *) NULL ),

#define EVT_FB_MODEL(id, fn) \
	DECLARE_EVENT_TABLE_ENTRY( fbEVT_MODEL_ACTION, id, -1, \
	(wxObjectEventFunction) (wxEventFunction) (wxCommandEventFunction) (wxNotifyEventFunction) \
	wxStaticCastEvent( FbModelEventFunction, & fn ), (wxObject *) NULL ),

#define EVT_FB_OPEN(id, fn) \
	DECLARE_EVENT_TABLE_ENTRY( fbEVT_OPEN_ACTION, id, -1, \
	(wxObjectEventFunction) (wxEventFunction) (wxCommandEventFunction) (wxNotifyEventFunction) \
	wxStaticCastEvent( FbOpenEventFunction, & fn ), (wxObject *) NULL ),

#define EVT_FB_FOLDER(id, fn) \
	DECLARE_EVENT_TABLE_ENTRY( fbEVT_FOLDER_ACTION, id, -1, \
	(wxObjectEventFunction) (wxEventFunction) (wxCommandEventFunction) (wxNotifyEventFunction) \
	wxStaticCastEvent( FbFolderEventFunction, & fn ), (wxObject *) NULL ),

#define EVT_FB_PROGRESS(id, fn) \
	DECLARE_EVENT_TABLE_ENTRY( fbEVT_PROGRESS_ACTION, id, -1, \
	(wxObjectEventFunction) (wxEventFunction) (wxCommandEventFunction) (wxNotifyEventFunction) \
	wxStaticCastEvent( FbProgressEventFunction, & fn ), (wxObject *) NULL ),

#define EVT_FB_MASTER(id, fn) \
	DECLARE_EVENT_TABLE_ENTRY( fbEVT_MASTER_ACTION, id, -1, \
	(wxObjectEventFunction) (wxEventFunction) (wxCommandEventFunction) (wxNotifyEventFunction) \
	wxStaticCastEvent( FbMasterEventFunction, & fn ), (wxObject *) NULL ),

#define EVT_FB_ARRAY(id, fn) \
	DECLARE_EVENT_TABLE_ENTRY( fbEVT_ARRAY_ACTION, id, -1, \
	(wxObjectEventFunction) (wxEventFunction) (wxCommandEventFunction) (wxNotifyEventFunction) \
	wxStaticCastEvent( FbArrayEventFunction, & fn ), (wxObject *) NULL ),

#define EVT_FB_COUNT(id, fn) \
	DECLARE_EVENT_TABLE_ENTRY( fbEVT_COUNT_ACTION, id, -1, \
	(wxObjectEventFunction) (wxEventFunction) (wxCommandEventFunction) (wxNotifyEventFunction) \
	wxStaticCastEvent( FbCountEventFunction, & fn ), (wxObject *) NULL ),

#define EVT_FB_IMAGE(id, fn) \
	DECLARE_EVENT_TABLE_ENTRY( fbEVT_IMAGE_ACTION, id, -1, \
	(wxObjectEventFunction) (wxEventFunction) (wxCommandEventFunction) (wxNotifyEventFunction) \
	wxStaticCastEvent( FbImageEventFunction, & fn ), (wxObject *) NULL ),

#define EVT_FB_LETTERS(id, fn) \
	DECLARE_EVENT_TABLE_ENTRY( fbEVT_LETTERS_ACTION, id, -1, \
	(wxObjectEventFunction) (wxEventFunction) (wxCommandEventFunction) (wxNotifyEventFunction) \
	wxStaticCastEvent( FbLettersEventFunction, & fn ), (wxObject *) NULL ),

#endif // __FBBOOKEVENT_H__