File: MyGUI_Sharp_ItemBox.cs

package info (click to toggle)
mygui 3.2.2%2Bdfsg-2
  • links: PTS, VCS
  • area: main
  • in suites: buster
  • size: 36,224 kB
  • sloc: cpp: 118,031; ansic: 30,202; xml: 15,544; cs: 12,602; tcl: 776; python: 417; makefile: 34
file content (632 lines) | stat: -rw-r--r-- 18,170 bytes parent folder | download | duplicates (7)
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
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
/*!
	@file
	@author		Generate utility by Albert Semenov
	@date		01/2009
	@module
*/

using System;
using System.Runtime.InteropServices;

namespace MyGUI.Sharp
{
    public  class ItemBox :
		DDContainer
    {
        #region ItemBox

        protected override string GetWidgetType() { return "ItemBox"; }

        internal static BaseWidget RequestWrapItemBox(BaseWidget _parent, IntPtr _widget)
        {
			ItemBox widget = new ItemBox();
			widget.WrapWidget(_parent, _widget);
            return widget;
        }

        internal static BaseWidget RequestCreateItemBox(BaseWidget _parent, WidgetStyle _style, string _skin, IntCoord _coord, Align _align, string _layer, string _name)
        {
			ItemBox widget = new ItemBox();
			widget.CreateWidgetImpl(_parent, _style, _skin, _coord, _align, _layer, _name);
            return widget;
        }
        
		#endregion
	
		
		//InsertPoint
		#region Event NotifyItem

		[DllImport(DllName.m_dllName, CallingConvention = CallingConvention.Cdecl)]
		private static extern void ExportItemBoxEvent_AdviseNotifyItem(IntPtr _native, bool _advise);

		public delegate void HandleNotifyItem(
			ItemBox _sender,
			ref IBNotifyItemData _info);
			
		private HandleNotifyItem mEventNotifyItem;
		public event HandleNotifyItem EventNotifyItem
		{
			add
			{
				if (ExportEventNotifyItem.mDelegate == null)
				{
					ExportEventNotifyItem.mDelegate = new ExportEventNotifyItem.ExportHandle(OnExportNotifyItem);
					ExportEventNotifyItem.ExportItemBoxEvent_DelegateNotifyItem(ExportEventNotifyItem.mDelegate);
				}

				if (mEventNotifyItem == null)
					ExportItemBoxEvent_AdviseNotifyItem(Native, true);
				mEventNotifyItem += value;
			}
			remove
			{
				mEventNotifyItem -= value;
				if (mEventNotifyItem == null)
					ExportItemBoxEvent_AdviseNotifyItem(Native, false);
			}
		}

		private struct ExportEventNotifyItem
		{
			[DllImport(DllName.m_dllName, CallingConvention = CallingConvention.Cdecl)]
			public static extern void ExportItemBoxEvent_DelegateNotifyItem(ExportHandle _delegate);
			[UnmanagedFunctionPointer(CallingConvention.StdCall)]
			public delegate void ExportHandle(
				IntPtr _sender,
				[In] ref IBNotifyItemData _info);
				
			public static ExportHandle mDelegate;
		}

		private static void OnExportNotifyItem(
			IntPtr _sender,
			ref IBNotifyItemData _info)
		{
			ItemBox sender = (ItemBox)BaseWidget.GetByNative(_sender);

			if (sender.mEventNotifyItem != null)
				sender.mEventNotifyItem(
					sender ,
					ref _info);
		}

		#endregion
		#region Event MouseItemActivate

		[DllImport(DllName.m_dllName, CallingConvention = CallingConvention.Cdecl)]
		private static extern void ExportItemBoxEvent_AdviseMouseItemActivate(IntPtr _native, bool _advise);

		public delegate void HandleMouseItemActivate(
			ItemBox _sender,
			uint _index);
			
		private HandleMouseItemActivate mEventMouseItemActivate;
		public event HandleMouseItemActivate EventMouseItemActivate
		{
			add
			{
				if (ExportEventMouseItemActivate.mDelegate == null)
				{
					ExportEventMouseItemActivate.mDelegate = new ExportEventMouseItemActivate.ExportHandle(OnExportMouseItemActivate);
					ExportEventMouseItemActivate.ExportItemBoxEvent_DelegateMouseItemActivate(ExportEventMouseItemActivate.mDelegate);
				}

				if (mEventMouseItemActivate == null)
					ExportItemBoxEvent_AdviseMouseItemActivate(Native, true);
				mEventMouseItemActivate += value;
			}
			remove
			{
				mEventMouseItemActivate -= value;
				if (mEventMouseItemActivate == null)
					ExportItemBoxEvent_AdviseMouseItemActivate(Native, false);
			}
		}

		private struct ExportEventMouseItemActivate
		{
			[DllImport(DllName.m_dllName, CallingConvention = CallingConvention.Cdecl)]
			public static extern void ExportItemBoxEvent_DelegateMouseItemActivate(ExportHandle _delegate);
			[UnmanagedFunctionPointer(CallingConvention.StdCall)]
			public delegate void ExportHandle(
				IntPtr _sender,
				uint _index);
				
			public static ExportHandle mDelegate;
		}

		private static void OnExportMouseItemActivate(
			IntPtr _sender,
			uint _index)
		{
			ItemBox sender = (ItemBox)BaseWidget.GetByNative(_sender);

			if (sender.mEventMouseItemActivate != null)
				sender.mEventMouseItemActivate(
					sender ,
					_index);
		}

		#endregion
		#region Event ChangeItemPosition

		[DllImport(DllName.m_dllName, CallingConvention = CallingConvention.Cdecl)]
		private static extern void ExportItemBoxEvent_AdviseChangeItemPosition(IntPtr _native, bool _advise);

		public delegate void HandleChangeItemPosition(
			ItemBox _sender,
			uint _index);
			
		private HandleChangeItemPosition mEventChangeItemPosition;
		public event HandleChangeItemPosition EventChangeItemPosition
		{
			add
			{
				if (ExportEventChangeItemPosition.mDelegate == null)
				{
					ExportEventChangeItemPosition.mDelegate = new ExportEventChangeItemPosition.ExportHandle(OnExportChangeItemPosition);
					ExportEventChangeItemPosition.ExportItemBoxEvent_DelegateChangeItemPosition(ExportEventChangeItemPosition.mDelegate);
				}

				if (mEventChangeItemPosition == null)
					ExportItemBoxEvent_AdviseChangeItemPosition(Native, true);
				mEventChangeItemPosition += value;
			}
			remove
			{
				mEventChangeItemPosition -= value;
				if (mEventChangeItemPosition == null)
					ExportItemBoxEvent_AdviseChangeItemPosition(Native, false);
			}
		}

		private struct ExportEventChangeItemPosition
		{
			[DllImport(DllName.m_dllName, CallingConvention = CallingConvention.Cdecl)]
			public static extern void ExportItemBoxEvent_DelegateChangeItemPosition(ExportHandle _delegate);
			[UnmanagedFunctionPointer(CallingConvention.StdCall)]
			public delegate void ExportHandle(
				IntPtr _sender,
				uint _index);
				
			public static ExportHandle mDelegate;
		}

		private static void OnExportChangeItemPosition(
			IntPtr _sender,
			uint _index)
		{
			ItemBox sender = (ItemBox)BaseWidget.GetByNative(_sender);

			if (sender.mEventChangeItemPosition != null)
				sender.mEventChangeItemPosition(
					sender ,
					_index);
		}

		#endregion
		#region Event SelectItemAccept

		[DllImport(DllName.m_dllName, CallingConvention = CallingConvention.Cdecl)]
		private static extern void ExportItemBoxEvent_AdviseSelectItemAccept(IntPtr _native, bool _advise);

		public delegate void HandleSelectItemAccept(
			ItemBox _sender,
			uint _index);
			
		private HandleSelectItemAccept mEventSelectItemAccept;
		public event HandleSelectItemAccept EventSelectItemAccept
		{
			add
			{
				if (ExportEventSelectItemAccept.mDelegate == null)
				{
					ExportEventSelectItemAccept.mDelegate = new ExportEventSelectItemAccept.ExportHandle(OnExportSelectItemAccept);
					ExportEventSelectItemAccept.ExportItemBoxEvent_DelegateSelectItemAccept(ExportEventSelectItemAccept.mDelegate);
				}

				if (mEventSelectItemAccept == null)
					ExportItemBoxEvent_AdviseSelectItemAccept(Native, true);
				mEventSelectItemAccept += value;
			}
			remove
			{
				mEventSelectItemAccept -= value;
				if (mEventSelectItemAccept == null)
					ExportItemBoxEvent_AdviseSelectItemAccept(Native, false);
			}
		}

		private struct ExportEventSelectItemAccept
		{
			[DllImport(DllName.m_dllName, CallingConvention = CallingConvention.Cdecl)]
			public static extern void ExportItemBoxEvent_DelegateSelectItemAccept(ExportHandle _delegate);
			[UnmanagedFunctionPointer(CallingConvention.StdCall)]
			public delegate void ExportHandle(
				IntPtr _sender,
				uint _index);
				
			public static ExportHandle mDelegate;
		}

		private static void OnExportSelectItemAccept(
			IntPtr _sender,
			uint _index)
		{
			ItemBox sender = (ItemBox)BaseWidget.GetByNative(_sender);

			if (sender.mEventSelectItemAccept != null)
				sender.mEventSelectItemAccept(
					sender ,
					_index);
		}

		#endregion
		#region Request DrawItem

		[DllImport(DllName.m_dllName, CallingConvention = CallingConvention.Cdecl)]
		private static extern void ExportItemBoxEvent_AdviseDrawItem(IntPtr _native, bool _advise);

		public delegate void HandleDrawItem(
			ItemBox _sender,
			Widget _item,
			ref IBDrawItemInfo _info);
			
		private HandleDrawItem mEventDrawItem;
		public event HandleDrawItem RequestDrawItem
		{
			add
			{
				if (ExportEventDrawItem.mDelegate == null)
				{
					ExportEventDrawItem.mDelegate = new ExportEventDrawItem.ExportHandle(OnExportDrawItem);
					ExportEventDrawItem.ExportItemBoxEvent_DelegateDrawItem(ExportEventDrawItem.mDelegate);
				}

				if (mEventDrawItem == null)
					ExportItemBoxEvent_AdviseDrawItem(Native, true);
				mEventDrawItem += value;
			}
			remove
			{
				mEventDrawItem -= value;
				if (mEventDrawItem == null)
					ExportItemBoxEvent_AdviseDrawItem(Native, false);
			}
		}

		private struct ExportEventDrawItem
		{
			[DllImport(DllName.m_dllName, CallingConvention = CallingConvention.Cdecl)]
			public static extern void ExportItemBoxEvent_DelegateDrawItem(ExportHandle _delegate);
			[UnmanagedFunctionPointer(CallingConvention.StdCall)]
			public delegate void ExportHandle(
				IntPtr _sender,
				IntPtr _item,
				[In] ref IBDrawItemInfo _info);
				
			public static ExportHandle mDelegate;
		}

		private static void OnExportDrawItem(
			IntPtr _sender,
			IntPtr _item,
			ref IBDrawItemInfo _info)
		{
			ItemBox sender = (ItemBox)BaseWidget.GetByNative(_sender);

			if (sender.mEventDrawItem != null)
				sender.mEventDrawItem(
					sender ,
					(Widget)BaseWidget.GetByNative(_item),
					ref _info);
		}

		#endregion
		#region Request CoordItem

		[DllImport(DllName.m_dllName, CallingConvention = CallingConvention.Cdecl)]
		private static extern void ExportItemBoxEvent_AdviseCoordItem(IntPtr _native, bool _advise);

		public delegate void HandleCoordItem(
			ItemBox _sender,
			ref IntCoord _coord,
			bool _drag);
			
		private HandleCoordItem mEventCoordItem;
		public event HandleCoordItem RequestCoordItem
		{
			add
			{
				if (ExportEventCoordItem.mDelegate == null)
				{
					ExportEventCoordItem.mDelegate = new ExportEventCoordItem.ExportHandle(OnExportCoordItem);
					ExportEventCoordItem.ExportItemBoxEvent_DelegateCoordItem(ExportEventCoordItem.mDelegate);
				}

				if (mEventCoordItem == null)
					ExportItemBoxEvent_AdviseCoordItem(Native, true);
				mEventCoordItem += value;
			}
			remove
			{
				mEventCoordItem -= value;
				if (mEventCoordItem == null)
					ExportItemBoxEvent_AdviseCoordItem(Native, false);
			}
		}

		private struct ExportEventCoordItem
		{
			[DllImport(DllName.m_dllName, CallingConvention = CallingConvention.Cdecl)]
			public static extern void ExportItemBoxEvent_DelegateCoordItem(ExportHandle _delegate);
			[UnmanagedFunctionPointer(CallingConvention.StdCall)]
			public delegate void ExportHandle(
				IntPtr _sender,
				ref IntCoord _coord,
				[MarshalAs(UnmanagedType.U1)] bool _drag);
				
			public static ExportHandle mDelegate;
		}

		private static void OnExportCoordItem(
			IntPtr _sender,
			ref IntCoord _coord,
			bool _drag)
		{
			ItemBox sender = (ItemBox)BaseWidget.GetByNative(_sender);

			if (sender.mEventCoordItem != null)
				sender.mEventCoordItem(
					sender ,
					ref _coord,
					_drag);
		}

		#endregion
		#region Request CreateWidgetItem

		[DllImport(DllName.m_dllName, CallingConvention = CallingConvention.Cdecl)]
		private static extern void ExportItemBoxEvent_AdviseCreateWidgetItem(IntPtr _native, bool _advise);

		public delegate void HandleCreateWidgetItem(
			ItemBox _sender,
			Widget _item);
			
		private HandleCreateWidgetItem mEventCreateWidgetItem;
		public event HandleCreateWidgetItem RequestCreateWidgetItem
		{
			add
			{
				if (ExportEventCreateWidgetItem.mDelegate == null)
				{
					ExportEventCreateWidgetItem.mDelegate = new ExportEventCreateWidgetItem.ExportHandle(OnExportCreateWidgetItem);
					ExportEventCreateWidgetItem.ExportItemBoxEvent_DelegateCreateWidgetItem(ExportEventCreateWidgetItem.mDelegate);
				}

				if (mEventCreateWidgetItem == null)
					ExportItemBoxEvent_AdviseCreateWidgetItem(Native, true);
				mEventCreateWidgetItem += value;
			}
			remove
			{
				mEventCreateWidgetItem -= value;
				if (mEventCreateWidgetItem == null)
					ExportItemBoxEvent_AdviseCreateWidgetItem(Native, false);
			}
		}

		private struct ExportEventCreateWidgetItem
		{
			[DllImport(DllName.m_dllName, CallingConvention = CallingConvention.Cdecl)]
			public static extern void ExportItemBoxEvent_DelegateCreateWidgetItem(ExportHandle _delegate);
			[UnmanagedFunctionPointer(CallingConvention.StdCall)]
			public delegate void ExportHandle(
				IntPtr _sender,
				IntPtr _item);
				
			public static ExportHandle mDelegate;
		}

		private static void OnExportCreateWidgetItem(
			IntPtr _sender,
			IntPtr _item)
		{
			ItemBox sender = (ItemBox)BaseWidget.GetByNative(_sender);

			if (sender.mEventCreateWidgetItem != null)
				sender.mEventCreateWidgetItem(
					sender ,
					(Widget)BaseWidget.GetByNative(_item));
		}

		#endregion
		#region Method GetWidgetByIndex

		[DllImport(DllName.m_dllName, CallingConvention = CallingConvention.Cdecl)]
        
		private static extern IntPtr ExportItemBox_GetWidgetByIndex__index(IntPtr _native,
			uint _index);

		public Widget GetWidgetByIndex(
			uint _index)
		{
			return (Widget)BaseWidget.GetByNative(ExportItemBox_GetWidgetByIndex__index(Native,
				_index));
		}

		#endregion
		#region Method GetIndexByWidget

		[DllImport(DllName.m_dllName, CallingConvention = CallingConvention.Cdecl)]
        
		private static extern uint ExportItemBox_GetIndexByWidget__widget(IntPtr _native,
			IntPtr _widget);

		public uint GetIndexByWidget(
			Widget _widget)
		{
			return ExportItemBox_GetIndexByWidget__widget(Native,
				_widget.Native);
		}

		#endregion
		#region Method ClearIndexSelected

		[DllImport(DllName.m_dllName, CallingConvention = CallingConvention.Cdecl)]
		private static extern void ExportItemBox_ClearIndexSelected(IntPtr _native);

		public void ClearIndexSelected( )
		{
			ExportItemBox_ClearIndexSelected(Native);
		}

		#endregion
		#region Method RedrawAllItems

		[DllImport(DllName.m_dllName, CallingConvention = CallingConvention.Cdecl)]
		private static extern void ExportItemBox_RedrawAllItems(IntPtr _native);

		public void RedrawAllItems( )
		{
			ExportItemBox_RedrawAllItems(Native);
		}

		#endregion
		#region Method RedrawItemAt

		[DllImport(DllName.m_dllName, CallingConvention = CallingConvention.Cdecl)]
		private static extern void ExportItemBox_RedrawItemAt__index(IntPtr _native,
			uint _index);

		public void RedrawItemAt(
			uint _index)
		{
			ExportItemBox_RedrawItemAt__index(Native,
				_index);
		}

		#endregion
		#region Method RemoveAllItems

		[DllImport(DllName.m_dllName, CallingConvention = CallingConvention.Cdecl)]
		private static extern void ExportItemBox_RemoveAllItems(IntPtr _native);

		public void RemoveAllItems( )
		{
			ExportItemBox_RemoveAllItems(Native);
		}

		#endregion
		#region Method RemoveItemAt

		[DllImport(DllName.m_dllName, CallingConvention = CallingConvention.Cdecl)]
		private static extern void ExportItemBox_RemoveItemAt__index(IntPtr _native,
			uint _index);

		public void RemoveItemAt(
			uint _index)
		{
			ExportItemBox_RemoveItemAt__index(Native,
				_index);
		}

		#endregion
		#region Method AddItem

		[DllImport(DllName.m_dllName, CallingConvention = CallingConvention.Cdecl)]
		private static extern void ExportItemBox_AddItem(IntPtr _native);

		public void AddItem( )
		{
			ExportItemBox_AddItem(Native);
		}

		#endregion
		#region Method InsertItemAt

		[DllImport(DllName.m_dllName, CallingConvention = CallingConvention.Cdecl)]
		private static extern void ExportItemBox_InsertItemAt__index(IntPtr _native,
			uint _index);

		public void InsertItemAt(
			uint _index)
		{
			ExportItemBox_InsertItemAt__index(Native,
				_index);
		}

		#endregion
		#region Property ViewOffset

		[DllImport(DllName.m_dllName, CallingConvention = CallingConvention.Cdecl)]
        
		private static extern IntPtr ExportItemBox_GetViewOffset(IntPtr _widget);
		[DllImport(DllName.m_dllName, CallingConvention = CallingConvention.Cdecl)]
		private static extern void ExportItemBox_SetViewOffset(IntPtr _widget, [In] ref IntPoint _value);

		public IntPoint ViewOffset
		{
			get { return (IntPoint)Marshal.PtrToStructure(ExportItemBox_GetViewOffset(Native), typeof(IntPoint)); }
			set { ExportItemBox_SetViewOffset(Native, ref value); }
		}

		#endregion
		#region Property WidgetDrag

		[DllImport(DllName.m_dllName, CallingConvention = CallingConvention.Cdecl)]
        
		private static extern IntPtr ExportItemBox_GetWidgetDrag(IntPtr _native);

		public Widget WidgetDrag
		{
			get { return (Widget)BaseWidget.GetByNative(ExportItemBox_GetWidgetDrag(Native)); }
		}

		#endregion
		#region Property VerticalAlignment

		[DllImport(DllName.m_dllName, CallingConvention = CallingConvention.Cdecl)]
        
		private static extern bool ExportItemBox_GetVerticalAlignment(IntPtr _widget);
		[DllImport(DllName.m_dllName, CallingConvention = CallingConvention.Cdecl)]
		private static extern void ExportItemBox_SetVerticalAlignment(IntPtr _widget, [MarshalAs(UnmanagedType.U1)] bool _value);

		public bool VerticalAlignment
		{
			get { return ExportItemBox_GetVerticalAlignment(Native); }
			set { ExportItemBox_SetVerticalAlignment(Native, value); }
		}

		#endregion
		#region Property IndexSelected

		[DllImport(DllName.m_dllName, CallingConvention = CallingConvention.Cdecl)]
        
		private static extern uint ExportItemBox_GetIndexSelected(IntPtr _widget);
		[DllImport(DllName.m_dllName, CallingConvention = CallingConvention.Cdecl)]
		private static extern void ExportItemBox_SetIndexSelected(IntPtr _widget, uint _value);

		public uint IndexSelected
		{
			get { return ExportItemBox_GetIndexSelected(Native); }
			set { ExportItemBox_SetIndexSelected(Native, value); }
		}

		#endregion
		#region Property ItemCount

		[DllImport(DllName.m_dllName, CallingConvention = CallingConvention.Cdecl)]
        
		private static extern uint ExportItemBox_GetItemCount(IntPtr _native);

		public uint ItemCount
		{
			get { return ExportItemBox_GetItemCount(Native); }
		}

		#endregion
		
    }
}