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

using System;
using System.Runtime.InteropServices;

namespace MyGUI.Sharp
{
    public  class ScrollBar :
		Widget
    {
        #region ScrollBar

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

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

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

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

		public delegate void HandleScrollChangePosition(
			ScrollBar _sender,
			uint _position);
			
		private HandleScrollChangePosition mEventScrollChangePosition;
		public event HandleScrollChangePosition EventScrollChangePosition
		{
			add
			{
				if (ExportEventScrollChangePosition.mDelegate == null)
				{
					ExportEventScrollChangePosition.mDelegate = new ExportEventScrollChangePosition.ExportHandle(OnExportScrollChangePosition);
					ExportEventScrollChangePosition.ExportScrollBarEvent_DelegateScrollChangePosition(ExportEventScrollChangePosition.mDelegate);
				}

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

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

		private static void OnExportScrollChangePosition(
			IntPtr _sender,
			uint _position)
		{
			ScrollBar sender = (ScrollBar)BaseWidget.GetByNative(_sender);

			if (sender.mEventScrollChangePosition != null)
				sender.mEventScrollChangePosition(
					sender ,
					_position);
		}

		#endregion
		#region Property MoveToClick

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

		public bool MoveToClick
		{
			get { return ExportScrollBar_GetMoveToClick(Native); }
			set { ExportScrollBar_SetMoveToClick(Native, value); }
		}

		#endregion
		#region Property MinTrackSize

		[DllImport(DllName.m_dllName, CallingConvention = CallingConvention.Cdecl)]
        
		private static extern int ExportScrollBar_GetMinTrackSize(IntPtr _widget);
		[DllImport(DllName.m_dllName, CallingConvention = CallingConvention.Cdecl)]
		private static extern void ExportScrollBar_SetMinTrackSize(IntPtr _widget, int _value);

		public int MinTrackSize
		{
			get { return ExportScrollBar_GetMinTrackSize(Native); }
			set { ExportScrollBar_SetMinTrackSize(Native, value); }
		}

		#endregion
		#region Property TrackSize

		[DllImport(DllName.m_dllName, CallingConvention = CallingConvention.Cdecl)]
        
		private static extern int ExportScrollBar_GetTrackSize(IntPtr _widget);
		[DllImport(DllName.m_dllName, CallingConvention = CallingConvention.Cdecl)]
		private static extern void ExportScrollBar_SetTrackSize(IntPtr _widget, int _value);

		public int TrackSize
		{
			get { return ExportScrollBar_GetTrackSize(Native); }
			set { ExportScrollBar_SetTrackSize(Native, value); }
		}

		#endregion
		#region Property LineSize

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

		public int LineSize
		{
			get { return ExportScrollBar_GetLineSize(Native); }
		}

		#endregion
		#region Property ScrollViewPage

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

		public uint ScrollViewPage
		{
			get { return ExportScrollBar_GetScrollViewPage(Native); }
			set { ExportScrollBar_SetScrollViewPage(Native, value); }
		}

		#endregion
		#region Property ScrollPage

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

		public uint ScrollPage
		{
			get { return ExportScrollBar_GetScrollPage(Native); }
			set { ExportScrollBar_SetScrollPage(Native, value); }
		}

		#endregion
		#region Property ScrollPosition

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

		public uint ScrollPosition
		{
			get { return ExportScrollBar_GetScrollPosition(Native); }
			set { ExportScrollBar_SetScrollPosition(Native, value); }
		}

		#endregion
		#region Property ScrollRange

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

		public uint ScrollRange
		{
			get { return ExportScrollBar_GetScrollRange(Native); }
			set { ExportScrollBar_SetScrollRange(Native, value); }
		}

		#endregion
		#region Property VerticalAlignment

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

		public bool VerticalAlignment
		{
			get { return ExportScrollBar_GetVerticalAlignment(Native); }
			set { ExportScrollBar_SetVerticalAlignment(Native, value); }
		}

		#endregion
		
    }
}