1 /*!
2 	@file
3 	@author		Generate utility by Albert Semenov
4 	@date		01/2009
5 	@module
6 */
7 
8 using System;
9 using System.Runtime.InteropServices;
10 
11 namespace MyGUI.Sharp
12 {
13     public  class ScrollBar :
14 		Widget
15     {
16         #region ScrollBar
17 
GetWidgetType()18         protected override string GetWidgetType() { return "ScrollBar"; }
19 
RequestWrapScrollBar(BaseWidget _parent, IntPtr _widget)20         internal static BaseWidget RequestWrapScrollBar(BaseWidget _parent, IntPtr _widget)
21         {
22 			ScrollBar widget = new ScrollBar();
23 			widget.WrapWidget(_parent, _widget);
24             return widget;
25         }
26 
RequestCreateScrollBar(BaseWidget _parent, WidgetStyle _style, string _skin, IntCoord _coord, Align _align, string _layer, string _name)27         internal static BaseWidget RequestCreateScrollBar(BaseWidget _parent, WidgetStyle _style, string _skin, IntCoord _coord, Align _align, string _layer, string _name)
28         {
29 			ScrollBar widget = new ScrollBar();
30 			widget.CreateWidgetImpl(_parent, _style, _skin, _coord, _align, _layer, _name);
31             return widget;
32         }
33 
34 		#endregion
35 
36 
37 		//InsertPoint
38 		#region Event ScrollChangePosition
39 
40 		[DllImport(DllName.m_dllName, CallingConvention = CallingConvention.Cdecl)]
ExportScrollBarEvent_AdviseScrollChangePosition(IntPtr _native, bool _advise)41 		private static extern void ExportScrollBarEvent_AdviseScrollChangePosition(IntPtr _native, bool _advise);
42 
HandleScrollChangePosition( ScrollBar _sender, uint _position)43 		public delegate void HandleScrollChangePosition(
44 			ScrollBar _sender,
45 			uint _position);
46 
47 		private HandleScrollChangePosition mEventScrollChangePosition;
48 		public event HandleScrollChangePosition EventScrollChangePosition
49 		{
50 			add
51 			{
52 				if (ExportEventScrollChangePosition.mDelegate == null)
53 				{
54 					ExportEventScrollChangePosition.mDelegate = new ExportEventScrollChangePosition.ExportHandle(OnExportScrollChangePosition);
55 					ExportEventScrollChangePosition.ExportScrollBarEvent_DelegateScrollChangePosition(ExportEventScrollChangePosition.mDelegate);
56 				}
57 
58 				if (mEventScrollChangePosition == null)
59 					ExportScrollBarEvent_AdviseScrollChangePosition(Native, true);
60 				mEventScrollChangePosition += value;
61 			}
62 			remove
63 			{
64 				mEventScrollChangePosition -= value;
65 				if (mEventScrollChangePosition == null)
66 					ExportScrollBarEvent_AdviseScrollChangePosition(Native, false);
67 			}
68 		}
69 
70 		private struct ExportEventScrollChangePosition
71 		{
72 			[DllImport(DllName.m_dllName, CallingConvention = CallingConvention.Cdecl)]
ExportScrollBarEvent_DelegateScrollChangePositionMyGUI.Sharp.ScrollBar.ExportEventScrollChangePosition73 			public static extern void ExportScrollBarEvent_DelegateScrollChangePosition(ExportHandle _delegate);
74 			[UnmanagedFunctionPointer(CallingConvention.StdCall)]
ExportHandleMyGUI.Sharp.ScrollBar.ExportEventScrollChangePosition75 			public delegate void ExportHandle(
76 				IntPtr _sender,
77 				uint _position);
78 
79 			public static ExportHandle mDelegate;
80 		}
81 
OnExportScrollChangePosition( IntPtr _sender, uint _position)82 		private static void OnExportScrollChangePosition(
83 			IntPtr _sender,
84 			uint _position)
85 		{
86 			ScrollBar sender = (ScrollBar)BaseWidget.GetByNative(_sender);
87 
88 			if (sender.mEventScrollChangePosition != null)
89 				sender.mEventScrollChangePosition(
90 					sender ,
91 					_position);
92 		}
93 
94 		#endregion
95 		#region Property MoveToClick
96 
97 		[DllImport(DllName.m_dllName, CallingConvention = CallingConvention.Cdecl)]
98 
ExportScrollBar_GetMoveToClick(IntPtr _widget)99 		private static extern bool ExportScrollBar_GetMoveToClick(IntPtr _widget);
100 		[DllImport(DllName.m_dllName, CallingConvention = CallingConvention.Cdecl)]
ExportScrollBar_SetMoveToClick(IntPtr _widget, [MarshalAs(UnmanagedType.U1)] bool _value)101 		private static extern void ExportScrollBar_SetMoveToClick(IntPtr _widget, [MarshalAs(UnmanagedType.U1)] bool _value);
102 
103 		public bool MoveToClick
104 		{
105 			get { return ExportScrollBar_GetMoveToClick(Native); }
106 			set { ExportScrollBar_SetMoveToClick(Native, value); }
107 		}
108 
109 		#endregion
110 		#region Property MinTrackSize
111 
112 		[DllImport(DllName.m_dllName, CallingConvention = CallingConvention.Cdecl)]
113 
ExportScrollBar_GetMinTrackSize(IntPtr _widget)114 		private static extern int ExportScrollBar_GetMinTrackSize(IntPtr _widget);
115 		[DllImport(DllName.m_dllName, CallingConvention = CallingConvention.Cdecl)]
ExportScrollBar_SetMinTrackSize(IntPtr _widget, int _value)116 		private static extern void ExportScrollBar_SetMinTrackSize(IntPtr _widget, int _value);
117 
118 		public int MinTrackSize
119 		{
120 			get { return ExportScrollBar_GetMinTrackSize(Native); }
121 			set { ExportScrollBar_SetMinTrackSize(Native, value); }
122 		}
123 
124 		#endregion
125 		#region Property TrackSize
126 
127 		[DllImport(DllName.m_dllName, CallingConvention = CallingConvention.Cdecl)]
128 
ExportScrollBar_GetTrackSize(IntPtr _widget)129 		private static extern int ExportScrollBar_GetTrackSize(IntPtr _widget);
130 		[DllImport(DllName.m_dllName, CallingConvention = CallingConvention.Cdecl)]
ExportScrollBar_SetTrackSize(IntPtr _widget, int _value)131 		private static extern void ExportScrollBar_SetTrackSize(IntPtr _widget, int _value);
132 
133 		public int TrackSize
134 		{
135 			get { return ExportScrollBar_GetTrackSize(Native); }
136 			set { ExportScrollBar_SetTrackSize(Native, value); }
137 		}
138 
139 		#endregion
140 		#region Property LineSize
141 
142 		[DllImport(DllName.m_dllName, CallingConvention = CallingConvention.Cdecl)]
143 
ExportScrollBar_GetLineSize(IntPtr _native)144 		private static extern int ExportScrollBar_GetLineSize(IntPtr _native);
145 
146 		public int LineSize
147 		{
148 			get { return ExportScrollBar_GetLineSize(Native); }
149 		}
150 
151 		#endregion
152 		#region Property ScrollViewPage
153 
154 		[DllImport(DllName.m_dllName, CallingConvention = CallingConvention.Cdecl)]
155 
ExportScrollBar_GetScrollViewPage(IntPtr _widget)156 		private static extern uint ExportScrollBar_GetScrollViewPage(IntPtr _widget);
157 		[DllImport(DllName.m_dllName, CallingConvention = CallingConvention.Cdecl)]
ExportScrollBar_SetScrollViewPage(IntPtr _widget, uint _value)158 		private static extern void ExportScrollBar_SetScrollViewPage(IntPtr _widget, uint _value);
159 
160 		public uint ScrollViewPage
161 		{
162 			get { return ExportScrollBar_GetScrollViewPage(Native); }
163 			set { ExportScrollBar_SetScrollViewPage(Native, value); }
164 		}
165 
166 		#endregion
167 		#region Property ScrollPage
168 
169 		[DllImport(DllName.m_dllName, CallingConvention = CallingConvention.Cdecl)]
170 
ExportScrollBar_GetScrollPage(IntPtr _widget)171 		private static extern uint ExportScrollBar_GetScrollPage(IntPtr _widget);
172 		[DllImport(DllName.m_dllName, CallingConvention = CallingConvention.Cdecl)]
ExportScrollBar_SetScrollPage(IntPtr _widget, uint _value)173 		private static extern void ExportScrollBar_SetScrollPage(IntPtr _widget, uint _value);
174 
175 		public uint ScrollPage
176 		{
177 			get { return ExportScrollBar_GetScrollPage(Native); }
178 			set { ExportScrollBar_SetScrollPage(Native, value); }
179 		}
180 
181 		#endregion
182 		#region Property ScrollPosition
183 
184 		[DllImport(DllName.m_dllName, CallingConvention = CallingConvention.Cdecl)]
185 
ExportScrollBar_GetScrollPosition(IntPtr _widget)186 		private static extern uint ExportScrollBar_GetScrollPosition(IntPtr _widget);
187 		[DllImport(DllName.m_dllName, CallingConvention = CallingConvention.Cdecl)]
ExportScrollBar_SetScrollPosition(IntPtr _widget, uint _value)188 		private static extern void ExportScrollBar_SetScrollPosition(IntPtr _widget, uint _value);
189 
190 		public uint ScrollPosition
191 		{
192 			get { return ExportScrollBar_GetScrollPosition(Native); }
193 			set { ExportScrollBar_SetScrollPosition(Native, value); }
194 		}
195 
196 		#endregion
197 		#region Property ScrollRange
198 
199 		[DllImport(DllName.m_dllName, CallingConvention = CallingConvention.Cdecl)]
200 
ExportScrollBar_GetScrollRange(IntPtr _widget)201 		private static extern uint ExportScrollBar_GetScrollRange(IntPtr _widget);
202 		[DllImport(DllName.m_dllName, CallingConvention = CallingConvention.Cdecl)]
ExportScrollBar_SetScrollRange(IntPtr _widget, uint _value)203 		private static extern void ExportScrollBar_SetScrollRange(IntPtr _widget, uint _value);
204 
205 		public uint ScrollRange
206 		{
207 			get { return ExportScrollBar_GetScrollRange(Native); }
208 			set { ExportScrollBar_SetScrollRange(Native, value); }
209 		}
210 
211 		#endregion
212 		#region Property VerticalAlignment
213 
214 		[DllImport(DllName.m_dllName, CallingConvention = CallingConvention.Cdecl)]
215 
ExportScrollBar_GetVerticalAlignment(IntPtr _widget)216 		private static extern bool ExportScrollBar_GetVerticalAlignment(IntPtr _widget);
217 		[DllImport(DllName.m_dllName, CallingConvention = CallingConvention.Cdecl)]
ExportScrollBar_SetVerticalAlignment(IntPtr _widget, [MarshalAs(UnmanagedType.U1)] bool _value)218 		private static extern void ExportScrollBar_SetVerticalAlignment(IntPtr _widget, [MarshalAs(UnmanagedType.U1)] bool _value);
219 
220 		public bool VerticalAlignment
221 		{
222 			get { return ExportScrollBar_GetVerticalAlignment(Native); }
223 			set { ExportScrollBar_SetVerticalAlignment(Native, value); }
224 		}
225 
226 		#endregion
227 
228     }
229 }
230