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 ComboBox : 14 EditBox 15 { 16 #region ComboBox 17 GetWidgetType()18 protected override string GetWidgetType() { return "ComboBox"; } 19 RequestWrapComboBox(BaseWidget _parent, IntPtr _widget)20 internal static BaseWidget RequestWrapComboBox(BaseWidget _parent, IntPtr _widget) 21 { 22 ComboBox widget = new ComboBox(); 23 widget.WrapWidget(_parent, _widget); 24 return widget; 25 } 26 RequestCreateComboBox(BaseWidget _parent, WidgetStyle _style, string _skin, IntCoord _coord, Align _align, string _layer, string _name)27 internal static BaseWidget RequestCreateComboBox(BaseWidget _parent, WidgetStyle _style, string _skin, IntCoord _coord, Align _align, string _layer, string _name) 28 { 29 ComboBox widget = new ComboBox(); 30 widget.CreateWidgetImpl(_parent, _style, _skin, _coord, _align, _layer, _name); 31 return widget; 32 } 33 34 #endregion 35 36 37 //InsertPoint 38 #region Event ComboChangePosition 39 40 [DllImport(DllName.m_dllName, CallingConvention = CallingConvention.Cdecl)] ExportComboBoxEvent_AdviseComboChangePosition(IntPtr _native, bool _advise)41 private static extern void ExportComboBoxEvent_AdviseComboChangePosition(IntPtr _native, bool _advise); 42 HandleComboChangePosition( ComboBox _sender, uint _index)43 public delegate void HandleComboChangePosition( 44 ComboBox _sender, 45 uint _index); 46 47 private HandleComboChangePosition mEventComboChangePosition; 48 public event HandleComboChangePosition EventComboChangePosition 49 { 50 add 51 { 52 if (ExportEventComboChangePosition.mDelegate == null) 53 { 54 ExportEventComboChangePosition.mDelegate = new ExportEventComboChangePosition.ExportHandle(OnExportComboChangePosition); 55 ExportEventComboChangePosition.ExportComboBoxEvent_DelegateComboChangePosition(ExportEventComboChangePosition.mDelegate); 56 } 57 58 if (mEventComboChangePosition == null) 59 ExportComboBoxEvent_AdviseComboChangePosition(Native, true); 60 mEventComboChangePosition += value; 61 } 62 remove 63 { 64 mEventComboChangePosition -= value; 65 if (mEventComboChangePosition == null) 66 ExportComboBoxEvent_AdviseComboChangePosition(Native, false); 67 } 68 } 69 70 private struct ExportEventComboChangePosition 71 { 72 [DllImport(DllName.m_dllName, CallingConvention = CallingConvention.Cdecl)] ExportComboBoxEvent_DelegateComboChangePositionMyGUI.Sharp.ComboBox.ExportEventComboChangePosition73 public static extern void ExportComboBoxEvent_DelegateComboChangePosition(ExportHandle _delegate); 74 [UnmanagedFunctionPointer(CallingConvention.StdCall)] ExportHandleMyGUI.Sharp.ComboBox.ExportEventComboChangePosition75 public delegate void ExportHandle( 76 IntPtr _sender, 77 uint _index); 78 79 public static ExportHandle mDelegate; 80 } 81 OnExportComboChangePosition( IntPtr _sender, uint _index)82 private static void OnExportComboChangePosition( 83 IntPtr _sender, 84 uint _index) 85 { 86 ComboBox sender = (ComboBox)BaseWidget.GetByNative(_sender); 87 88 if (sender.mEventComboChangePosition != null) 89 sender.mEventComboChangePosition( 90 sender , 91 _index); 92 } 93 94 #endregion 95 #region Event ComboAccept 96 97 [DllImport(DllName.m_dllName, CallingConvention = CallingConvention.Cdecl)] ExportComboBoxEvent_AdviseComboAccept(IntPtr _native, bool _advise)98 private static extern void ExportComboBoxEvent_AdviseComboAccept(IntPtr _native, bool _advise); 99 HandleComboAccept( ComboBox _sender, uint _index)100 public delegate void HandleComboAccept( 101 ComboBox _sender, 102 uint _index); 103 104 private HandleComboAccept mEventComboAccept; 105 public event HandleComboAccept EventComboAccept 106 { 107 add 108 { 109 if (ExportEventComboAccept.mDelegate == null) 110 { 111 ExportEventComboAccept.mDelegate = new ExportEventComboAccept.ExportHandle(OnExportComboAccept); 112 ExportEventComboAccept.ExportComboBoxEvent_DelegateComboAccept(ExportEventComboAccept.mDelegate); 113 } 114 115 if (mEventComboAccept == null) 116 ExportComboBoxEvent_AdviseComboAccept(Native, true); 117 mEventComboAccept += value; 118 } 119 remove 120 { 121 mEventComboAccept -= value; 122 if (mEventComboAccept == null) 123 ExportComboBoxEvent_AdviseComboAccept(Native, false); 124 } 125 } 126 127 private struct ExportEventComboAccept 128 { 129 [DllImport(DllName.m_dllName, CallingConvention = CallingConvention.Cdecl)] ExportComboBoxEvent_DelegateComboAcceptMyGUI.Sharp.ComboBox.ExportEventComboAccept130 public static extern void ExportComboBoxEvent_DelegateComboAccept(ExportHandle _delegate); 131 [UnmanagedFunctionPointer(CallingConvention.StdCall)] ExportHandleMyGUI.Sharp.ComboBox.ExportEventComboAccept132 public delegate void ExportHandle( 133 IntPtr _sender, 134 uint _index); 135 136 public static ExportHandle mDelegate; 137 } 138 OnExportComboAccept( IntPtr _sender, uint _index)139 private static void OnExportComboAccept( 140 IntPtr _sender, 141 uint _index) 142 { 143 ComboBox sender = (ComboBox)BaseWidget.GetByNative(_sender); 144 145 if (sender.mEventComboAccept != null) 146 sender.mEventComboAccept( 147 sender , 148 _index); 149 } 150 151 #endregion 152 #region Method BeginToItemSelected 153 154 [DllImport(DllName.m_dllName, CallingConvention = CallingConvention.Cdecl)] ExportComboBox_BeginToItemSelected(IntPtr _native)155 private static extern void ExportComboBox_BeginToItemSelected(IntPtr _native); 156 BeginToItemSelected( )157 public void BeginToItemSelected( ) 158 { 159 ExportComboBox_BeginToItemSelected(Native); 160 } 161 162 #endregion 163 #region Method BeginToItemLast 164 165 [DllImport(DllName.m_dllName, CallingConvention = CallingConvention.Cdecl)] ExportComboBox_BeginToItemLast(IntPtr _native)166 private static extern void ExportComboBox_BeginToItemLast(IntPtr _native); 167 BeginToItemLast( )168 public void BeginToItemLast( ) 169 { 170 ExportComboBox_BeginToItemLast(Native); 171 } 172 173 #endregion 174 #region Method BeginToItemFirst 175 176 [DllImport(DllName.m_dllName, CallingConvention = CallingConvention.Cdecl)] ExportComboBox_BeginToItemFirst(IntPtr _native)177 private static extern void ExportComboBox_BeginToItemFirst(IntPtr _native); 178 BeginToItemFirst( )179 public void BeginToItemFirst( ) 180 { 181 ExportComboBox_BeginToItemFirst(Native); 182 } 183 184 #endregion 185 #region Method BeginToItemAt 186 187 [DllImport(DllName.m_dllName, CallingConvention = CallingConvention.Cdecl)] ExportComboBox_BeginToItemAt__index(IntPtr _native, uint _index)188 private static extern void ExportComboBox_BeginToItemAt__index(IntPtr _native, 189 uint _index); 190 BeginToItemAt( uint _index)191 public void BeginToItemAt( 192 uint _index) 193 { 194 ExportComboBox_BeginToItemAt__index(Native, 195 _index); 196 } 197 198 #endregion 199 #region Method GetItemNameAt 200 201 [DllImport(DllName.m_dllName, CallingConvention = CallingConvention.Cdecl)] 202 ExportComboBox_GetItemNameAt__index(IntPtr _native, uint _index)203 private static extern IntPtr ExportComboBox_GetItemNameAt__index(IntPtr _native, 204 uint _index); 205 GetItemNameAt( uint _index)206 public string GetItemNameAt( 207 uint _index) 208 { 209 return Marshal.PtrToStringUni(ExportComboBox_GetItemNameAt__index(Native, 210 _index)); 211 } 212 213 #endregion 214 #region Method SetItemNameAt 215 216 [DllImport(DllName.m_dllName, CallingConvention = CallingConvention.Cdecl)] ExportComboBox_SetItemNameAt__index__name(IntPtr _native, uint _index, [MarshalAs(UnmanagedType.LPWStr)] string _name)217 private static extern void ExportComboBox_SetItemNameAt__index__name(IntPtr _native, 218 uint _index, 219 [MarshalAs(UnmanagedType.LPWStr)] string _name); 220 SetItemNameAt( uint _index, string _name)221 public void SetItemNameAt( 222 uint _index, 223 string _name) 224 { 225 ExportComboBox_SetItemNameAt__index__name(Native, 226 _index, 227 _name); 228 } 229 230 #endregion 231 #region Method ClearIndexSelected 232 233 [DllImport(DllName.m_dllName, CallingConvention = CallingConvention.Cdecl)] ExportComboBox_ClearIndexSelected(IntPtr _native)234 private static extern void ExportComboBox_ClearIndexSelected(IntPtr _native); 235 ClearIndexSelected( )236 public void ClearIndexSelected( ) 237 { 238 ExportComboBox_ClearIndexSelected(Native); 239 } 240 241 #endregion 242 #region Method FindItemIndexWith 243 244 [DllImport(DllName.m_dllName, CallingConvention = CallingConvention.Cdecl)] 245 ExportComboBox_FindItemIndexWith__name(IntPtr _native, [MarshalAs(UnmanagedType.LPWStr)] string _name)246 private static extern uint ExportComboBox_FindItemIndexWith__name(IntPtr _native, 247 [MarshalAs(UnmanagedType.LPWStr)] string _name); 248 FindItemIndexWith( string _name)249 public uint FindItemIndexWith( 250 string _name) 251 { 252 return ExportComboBox_FindItemIndexWith__name(Native, 253 _name); 254 } 255 256 #endregion 257 #region Method RemoveAllItems 258 259 [DllImport(DllName.m_dllName, CallingConvention = CallingConvention.Cdecl)] ExportComboBox_RemoveAllItems(IntPtr _native)260 private static extern void ExportComboBox_RemoveAllItems(IntPtr _native); 261 RemoveAllItems( )262 public void RemoveAllItems( ) 263 { 264 ExportComboBox_RemoveAllItems(Native); 265 } 266 267 #endregion 268 #region Method RemoveItemAt 269 270 [DllImport(DllName.m_dllName, CallingConvention = CallingConvention.Cdecl)] ExportComboBox_RemoveItemAt__index(IntPtr _native, uint _index)271 private static extern void ExportComboBox_RemoveItemAt__index(IntPtr _native, 272 uint _index); 273 RemoveItemAt( uint _index)274 public void RemoveItemAt( 275 uint _index) 276 { 277 ExportComboBox_RemoveItemAt__index(Native, 278 _index); 279 } 280 281 #endregion 282 #region Method AddItem 283 284 [DllImport(DllName.m_dllName, CallingConvention = CallingConvention.Cdecl)] ExportComboBox_AddItem__name(IntPtr _native, [MarshalAs(UnmanagedType.LPWStr)] string _name)285 private static extern void ExportComboBox_AddItem__name(IntPtr _native, 286 [MarshalAs(UnmanagedType.LPWStr)] string _name); 287 AddItem( string _name)288 public void AddItem( 289 string _name) 290 { 291 ExportComboBox_AddItem__name(Native, 292 _name); 293 } 294 295 #endregion 296 #region Method InsertItemAt 297 298 [DllImport(DllName.m_dllName, CallingConvention = CallingConvention.Cdecl)] ExportComboBox_InsertItemAt__index__name(IntPtr _native, uint _index, [MarshalAs(UnmanagedType.LPWStr)] string _name)299 private static extern void ExportComboBox_InsertItemAt__index__name(IntPtr _native, 300 uint _index, 301 [MarshalAs(UnmanagedType.LPWStr)] string _name); 302 InsertItemAt( uint _index, string _name)303 public void InsertItemAt( 304 uint _index, 305 string _name) 306 { 307 ExportComboBox_InsertItemAt__index__name(Native, 308 _index, 309 _name); 310 } 311 312 #endregion 313 #region Property FlowDirection 314 315 [DllImport(DllName.m_dllName, CallingConvention = CallingConvention.Cdecl)] 316 ExportComboBox_GetFlowDirection(IntPtr _widget)317 private static extern FlowDirection ExportComboBox_GetFlowDirection(IntPtr _widget); 318 [DllImport(DllName.m_dllName, CallingConvention = CallingConvention.Cdecl)] ExportComboBox_SetFlowDirection(IntPtr _widget, [MarshalAs(UnmanagedType.I4)] FlowDirection _value)319 private static extern void ExportComboBox_SetFlowDirection(IntPtr _widget, [MarshalAs(UnmanagedType.I4)] FlowDirection _value); 320 321 public FlowDirection FlowDirection 322 { 323 get { return ExportComboBox_GetFlowDirection(Native); } 324 set { ExportComboBox_SetFlowDirection(Native, value); } 325 } 326 327 #endregion 328 #region Property MaxListLength 329 330 [DllImport(DllName.m_dllName, CallingConvention = CallingConvention.Cdecl)] 331 ExportComboBox_GetMaxListLength(IntPtr _widget)332 private static extern int ExportComboBox_GetMaxListLength(IntPtr _widget); 333 [DllImport(DllName.m_dllName, CallingConvention = CallingConvention.Cdecl)] ExportComboBox_SetMaxListLength(IntPtr _widget, int _value)334 private static extern void ExportComboBox_SetMaxListLength(IntPtr _widget, int _value); 335 336 public int MaxListLength 337 { 338 get { return ExportComboBox_GetMaxListLength(Native); } 339 set { ExportComboBox_SetMaxListLength(Native, value); } 340 } 341 342 #endregion 343 #region Property SmoothShow 344 345 [DllImport(DllName.m_dllName, CallingConvention = CallingConvention.Cdecl)] 346 ExportComboBox_GetSmoothShow(IntPtr _widget)347 private static extern bool ExportComboBox_GetSmoothShow(IntPtr _widget); 348 [DllImport(DllName.m_dllName, CallingConvention = CallingConvention.Cdecl)] ExportComboBox_SetSmoothShow(IntPtr _widget, [MarshalAs(UnmanagedType.U1)] bool _value)349 private static extern void ExportComboBox_SetSmoothShow(IntPtr _widget, [MarshalAs(UnmanagedType.U1)] bool _value); 350 351 public bool SmoothShow 352 { 353 get { return ExportComboBox_GetSmoothShow(Native); } 354 set { ExportComboBox_SetSmoothShow(Native, value); } 355 } 356 357 #endregion 358 #region Property ComboModeDrop 359 360 [DllImport(DllName.m_dllName, CallingConvention = CallingConvention.Cdecl)] 361 ExportComboBox_GetComboModeDrop(IntPtr _widget)362 private static extern bool ExportComboBox_GetComboModeDrop(IntPtr _widget); 363 [DllImport(DllName.m_dllName, CallingConvention = CallingConvention.Cdecl)] ExportComboBox_SetComboModeDrop(IntPtr _widget, [MarshalAs(UnmanagedType.U1)] bool _value)364 private static extern void ExportComboBox_SetComboModeDrop(IntPtr _widget, [MarshalAs(UnmanagedType.U1)] bool _value); 365 366 public bool ComboModeDrop 367 { 368 get { return ExportComboBox_GetComboModeDrop(Native); } 369 set { ExportComboBox_SetComboModeDrop(Native, value); } 370 } 371 372 #endregion 373 #region Property IndexSelected 374 375 [DllImport(DllName.m_dllName, CallingConvention = CallingConvention.Cdecl)] 376 ExportComboBox_GetIndexSelected(IntPtr _widget)377 private static extern uint ExportComboBox_GetIndexSelected(IntPtr _widget); 378 [DllImport(DllName.m_dllName, CallingConvention = CallingConvention.Cdecl)] ExportComboBox_SetIndexSelected(IntPtr _widget, uint _value)379 private static extern void ExportComboBox_SetIndexSelected(IntPtr _widget, uint _value); 380 381 public uint IndexSelected 382 { 383 get { return ExportComboBox_GetIndexSelected(Native); } 384 set { ExportComboBox_SetIndexSelected(Native, value); } 385 } 386 387 #endregion 388 #region Property ItemCount 389 390 [DllImport(DllName.m_dllName, CallingConvention = CallingConvention.Cdecl)] 391 ExportComboBox_GetItemCount(IntPtr _native)392 private static extern uint ExportComboBox_GetItemCount(IntPtr _native); 393 394 public uint ItemCount 395 { 396 get { return ExportComboBox_GetItemCount(Native); } 397 } 398 399 #endregion 400 401 } 402 } 403