File: MyGUI_Sharp_Widget.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 (628 lines) | stat: -rw-r--r-- 16,865 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
/*!
	@file
	@author		Generate utility by Albert Semenov
	@date		01/2009
	@module
*/

using System;
using System.Runtime.InteropServices;

namespace MyGUI.Sharp
{
    public partial class Widget :
		BaseWidget
    {
        #region Widget

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

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

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

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

		public delegate void HandleChangeCoord(
			Widget _sender);
			
		private HandleChangeCoord mEventChangeCoord;
		public event HandleChangeCoord EventChangeCoord
		{
			add
			{
				if (ExportEventChangeCoord.mDelegate == null)
				{
					ExportEventChangeCoord.mDelegate = new ExportEventChangeCoord.ExportHandle(OnExportChangeCoord);
					ExportEventChangeCoord.ExportWidgetEvent_DelegateChangeCoord(ExportEventChangeCoord.mDelegate);
				}

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

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

		private static void OnExportChangeCoord(
			IntPtr _sender)
		{
			Widget sender = (Widget)BaseWidget.GetByNative(_sender);

			if (sender.mEventChangeCoord != null)
				sender.mEventChangeCoord(
					sender);
		}

		#endregion
		#region Event ChangeProperty

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

		public delegate void HandleChangeProperty(
			Widget _sender,
			string _key,
			string _value);
			
		private HandleChangeProperty mEventChangeProperty;
		public event HandleChangeProperty EventChangeProperty
		{
			add
			{
				if (ExportEventChangeProperty.mDelegate == null)
				{
					ExportEventChangeProperty.mDelegate = new ExportEventChangeProperty.ExportHandle(OnExportChangeProperty);
					ExportEventChangeProperty.ExportWidgetEvent_DelegateChangeProperty(ExportEventChangeProperty.mDelegate);
				}

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

		private struct ExportEventChangeProperty
		{
			[DllImport(DllName.m_dllName, CallingConvention = CallingConvention.Cdecl)]
			public static extern void ExportWidgetEvent_DelegateChangeProperty(ExportHandle _delegate);
			[UnmanagedFunctionPointer(CallingConvention.StdCall)]
			public delegate void ExportHandle(
				IntPtr _sender,
				[MarshalAs(UnmanagedType.LPStr)] string _key,
				[MarshalAs(UnmanagedType.LPStr)] string _value);
				
			public static ExportHandle mDelegate;
		}

		private static void OnExportChangeProperty(
			IntPtr _sender,
			string _key,
			string _value)
		{
			Widget sender = (Widget)BaseWidget.GetByNative(_sender);

			if (sender.mEventChangeProperty != null)
				sender.mEventChangeProperty(
					sender ,
					_key,
					_value);
		}

		#endregion
		#region Method SetWidgetStyle

		[DllImport(DllName.m_dllName, CallingConvention = CallingConvention.Cdecl)]
		private static extern void ExportWidget_SetWidgetStyle__style__layer(IntPtr _native,
			[MarshalAs(UnmanagedType.I4)] WidgetStyle _style,
			[MarshalAs(UnmanagedType.LPStr)] string _layer);

		public void SetWidgetStyle(
			WidgetStyle _style,
			string _layer)
		{
			ExportWidget_SetWidgetStyle__style__layer(Native,
				_style,
				_layer);
		}

		#endregion
		#region Method ChangeWidgetSkin

		[DllImport(DllName.m_dllName, CallingConvention = CallingConvention.Cdecl)]
		private static extern void ExportWidget_ChangeWidgetSkin__skinName(IntPtr _native,
			[MarshalAs(UnmanagedType.LPStr)] string _skinName);

		public void ChangeWidgetSkin(
			string _skinName)
		{
			ExportWidget_ChangeWidgetSkin__skinName(Native,
				_skinName);
		}

		#endregion
		#region Method AttachToWidget

		[DllImport(DllName.m_dllName, CallingConvention = CallingConvention.Cdecl)]
		private static extern void ExportWidget_AttachToWidget__parent__style__layer(IntPtr _native,
			IntPtr _parent,
			[MarshalAs(UnmanagedType.I4)] WidgetStyle _style,
			[MarshalAs(UnmanagedType.LPStr)] string _layer);

		public void AttachToWidget(
			Widget _parent,
			WidgetStyle _style,
			string _layer)
		{
			ExportWidget_AttachToWidget__parent__style__layer(Native,
				_parent.Native,
				_style,
				_layer);
		}

		#endregion
		#region Method DetachFromWidget

		[DllImport(DllName.m_dllName, CallingConvention = CallingConvention.Cdecl)]
		private static extern void ExportWidget_DetachFromWidget__layer(IntPtr _native,
			[MarshalAs(UnmanagedType.LPStr)] string _layer);

		public void DetachFromWidget(
			string _layer)
		{
			ExportWidget_DetachFromWidget__layer(Native,
				_layer);
		}

		#endregion
		#region Method SetEnabledSilent

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

		public void SetEnabledSilent(
			bool _value)
		{
			ExportWidget_SetEnabledSilent__value(Native,
				_value);
		}

		#endregion
		#region Method FindWidget

		[DllImport(DllName.m_dllName, CallingConvention = CallingConvention.Cdecl)]
        
		private static extern IntPtr ExportWidget_FindWidget__name(IntPtr _native,
			[MarshalAs(UnmanagedType.LPStr)] string _name);

		public Widget FindWidget(
			string _name)
		{
			return (Widget)BaseWidget.GetByNative(ExportWidget_FindWidget__name(Native,
				_name));
		}

		#endregion
		#region Method GetChildAt

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

		public Widget GetChildAt(
			uint _index)
		{
			return (Widget)BaseWidget.GetByNative(ExportWidget_GetChildAt__index(Native,
				_index));
		}

		#endregion
		#region Method SetColour

		[DllImport(DllName.m_dllName, CallingConvention = CallingConvention.Cdecl)]
		private static extern void ExportWidget_SetColour__value(IntPtr _native,
			[In] ref Colour _value);

		public void SetColour(
			Colour _value)
		{
			ExportWidget_SetColour__value(Native,
				ref _value);
		}

		#endregion
		#region Method SetRealCoord

		[DllImport(DllName.m_dllName, CallingConvention = CallingConvention.Cdecl)]
		private static extern void ExportWidget_SetRealCoord__left__top__width__height(IntPtr _native,
			float _left,
			float _top,
			float _width,
			float _height);

		public void SetRealCoord(
			float _left,
			float _top,
			float _width,
			float _height)
		{
			ExportWidget_SetRealCoord__left__top__width__height(Native,
				_left,
				_top,
				_width,
				_height);
		}

		#endregion
		#region Method SetRealSize

		[DllImport(DllName.m_dllName, CallingConvention = CallingConvention.Cdecl)]
		private static extern void ExportWidget_SetRealSize__width__height(IntPtr _native,
			float _width,
			float _height);

		public void SetRealSize(
			float _width,
			float _height)
		{
			ExportWidget_SetRealSize__width__height(Native,
				_width,
				_height);
		}

		#endregion
		#region Method SetRealPosition

		[DllImport(DllName.m_dllName, CallingConvention = CallingConvention.Cdecl)]
		private static extern void ExportWidget_SetRealPosition__left__top(IntPtr _native,
			float _left,
			float _top);

		public void SetRealPosition(
			float _left,
			float _top)
		{
			ExportWidget_SetRealPosition__left__top(Native,
				_left,
				_top);
		}

		#endregion
		#region Method SetRealCoord

		[DllImport(DllName.m_dllName, CallingConvention = CallingConvention.Cdecl)]
		private static extern void ExportWidget_SetRealCoord__value(IntPtr _native,
			[In] ref FloatCoord _value);

		public void SetRealCoord(
			FloatCoord _value)
		{
			ExportWidget_SetRealCoord__value(Native,
				ref _value);
		}

		#endregion
		#region Method SetRealSize

		[DllImport(DllName.m_dllName, CallingConvention = CallingConvention.Cdecl)]
		private static extern void ExportWidget_SetRealSize__value(IntPtr _native,
			[In] ref FloatSize _value);

		public void SetRealSize(
			FloatSize _value)
		{
			ExportWidget_SetRealSize__value(Native,
				ref _value);
		}

		#endregion
		#region Method SetRealPosition

		[DllImport(DllName.m_dllName, CallingConvention = CallingConvention.Cdecl)]
		private static extern void ExportWidget_SetRealPosition__value(IntPtr _native,
			[In] ref FloatPoint _value);

		public void SetRealPosition(
			FloatPoint _value)
		{
			ExportWidget_SetRealPosition__value(Native,
				ref _value);
		}

		#endregion
		#region Method SetCoord

		[DllImport(DllName.m_dllName, CallingConvention = CallingConvention.Cdecl)]
		private static extern void ExportWidget_SetCoord__left__top__width__height(IntPtr _native,
			int _left,
			int _top,
			int _width,
			int _height);

		public void SetCoord(
			int _left,
			int _top,
			int _width,
			int _height)
		{
			ExportWidget_SetCoord__left__top__width__height(Native,
				_left,
				_top,
				_width,
				_height);
		}

		#endregion
		#region Method SetSize

		[DllImport(DllName.m_dllName, CallingConvention = CallingConvention.Cdecl)]
		private static extern void ExportWidget_SetSize__width__height(IntPtr _native,
			int _width,
			int _height);

		public void SetSize(
			int _width,
			int _height)
		{
			ExportWidget_SetSize__width__height(Native,
				_width,
				_height);
		}

		#endregion
		#region Method SetPosition

		[DllImport(DllName.m_dllName, CallingConvention = CallingConvention.Cdecl)]
		private static extern void ExportWidget_SetPosition__left__top(IntPtr _native,
			int _left,
			int _top);

		public void SetPosition(
			int _left,
			int _top)
		{
			ExportWidget_SetPosition__left__top(Native,
				_left,
				_top);
		}

		#endregion
		#region Property WidgetStyle

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

		public WidgetStyle WidgetStyle
		{
			get { return ExportWidget_GetWidgetStyle(Native); }
		}

		#endregion
		#region Property ClientWidget

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

		public Widget ClientWidget
		{
			get { return (Widget)BaseWidget.GetByNative(ExportWidget_GetClientWidget(Native)); }
		}

		#endregion
		#region Property ClientCoord

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

		public IntCoord ClientCoord
		{
			get { return (IntCoord)Marshal.PtrToStructure(ExportWidget_GetClientCoord(Native), typeof(IntCoord)); }
		}

		#endregion
		#region Property InheritedEnabled

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

		public bool InheritedEnabled
		{
			get { return ExportWidget_GetInheritedEnabled(Native); }
		}

		#endregion
		#region Property Enabled

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

		public bool Enabled
		{
			get { return ExportWidget_GetEnabled(Native); }
			set { ExportWidget_SetEnabled(Native, value); }
		}

		#endregion
		#region Property ChildCount

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

		public uint ChildCount
		{
			get { return ExportWidget_GetChildCount(Native); }
		}

		#endregion
		#region Property ParentSize

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

		public IntSize ParentSize
		{
			get { return (IntSize)Marshal.PtrToStructure(ExportWidget_GetParentSize(Native), typeof(IntSize)); }
		}

		#endregion
		#region Property Parent

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

		public Widget Parent
		{
			get { return (Widget)BaseWidget.GetByNative(ExportWidget_GetParent(Native)); }
		}

		#endregion
		#region Property IsRootWidget

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

		public bool IsRootWidget
		{
			get { return ExportWidget_IsRootWidget(Native); }
		}

		#endregion
		#region Property InheritsAlpha

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

		public bool InheritsAlpha
		{
			get { return ExportWidget_GetInheritsAlpha(Native); }
			set { ExportWidget_SetInheritsAlpha(Native, value); }
		}

		#endregion
		#region Property Alpha

		[DllImport(DllName.m_dllName, CallingConvention = CallingConvention.Cdecl)]
        
		private static extern float ExportWidget_GetAlpha(IntPtr _widget);
		[DllImport(DllName.m_dllName, CallingConvention = CallingConvention.Cdecl)]
		private static extern void ExportWidget_SetAlpha(IntPtr _widget, float _value);

		public float Alpha
		{
			get { return ExportWidget_GetAlpha(Native); }
			set { ExportWidget_SetAlpha(Native, value); }
		}

		#endregion
		#region Property Align

		[DllImport(DllName.m_dllName, CallingConvention = CallingConvention.Cdecl)]
        
		private static extern Align ExportWidget_GetAlign(IntPtr _widget);
		[DllImport(DllName.m_dllName, CallingConvention = CallingConvention.Cdecl)]
		private static extern void ExportWidget_SetAlign(IntPtr _widget, [MarshalAs(UnmanagedType.I4)] Align _value);

		public Align Align
		{
			get { return ExportWidget_GetAlign(Native); }
			set { ExportWidget_SetAlign(Native, value); }
		}

		#endregion
		#region Property InheritedVisible

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

		public bool InheritedVisible
		{
			get { return ExportWidget_GetInheritedVisible(Native); }
		}

		#endregion
		#region Property Visible

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

		public bool Visible
		{
			get { return ExportWidget_GetVisible(Native); }
			set { ExportWidget_SetVisible(Native, value); }
		}

		#endregion
		#region Property Name

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

		public string Name
		{
			get { return Marshal.PtrToStringAnsi(ExportWidget_GetName(Native)); }
		}

		#endregion
		
    }
}