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 633 634 635 636 637 638 639 640 641 642 643 644 645 646 647 648 649 650 651 652 653 654 655 656 657 658 659 660 661 662 663 664 665 666 667 668 669 670 671 672 673 674 675
|
/*!
@file
@author Generate utility by Albert Semenov
@date 01/2009
@module
*/
using System;
using System.Runtime.InteropServices;
namespace MyGUI.Sharp
{
public class ListBox :
Widget
{
#region ListBox
protected override string GetWidgetType() { return "ListBox"; }
internal static BaseWidget RequestWrapListBox(BaseWidget _parent, IntPtr _widget)
{
ListBox widget = new ListBox();
widget.WrapWidget(_parent, _widget);
return widget;
}
internal static BaseWidget RequestCreateListBox(BaseWidget _parent, WidgetStyle _style, string _skin, IntCoord _coord, Align _align, string _layer, string _name)
{
ListBox widget = new ListBox();
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 ExportListBoxEvent_AdviseNotifyItem(IntPtr _native, bool _advise);
public delegate void HandleNotifyItem(
ListBox _sender,
ref IBNotifyItemData _info);
private HandleNotifyItem mEventNotifyItem;
public event HandleNotifyItem EventNotifyItem
{
add
{
if (ExportEventNotifyItem.mDelegate == null)
{
ExportEventNotifyItem.mDelegate = new ExportEventNotifyItem.ExportHandle(OnExportNotifyItem);
ExportEventNotifyItem.ExportListBoxEvent_DelegateNotifyItem(ExportEventNotifyItem.mDelegate);
}
if (mEventNotifyItem == null)
ExportListBoxEvent_AdviseNotifyItem(Native, true);
mEventNotifyItem += value;
}
remove
{
mEventNotifyItem -= value;
if (mEventNotifyItem == null)
ExportListBoxEvent_AdviseNotifyItem(Native, false);
}
}
private struct ExportEventNotifyItem
{
[DllImport(DllName.m_dllName, CallingConvention = CallingConvention.Cdecl)]
public static extern void ExportListBoxEvent_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)
{
ListBox sender = (ListBox)BaseWidget.GetByNative(_sender);
if (sender.mEventNotifyItem != null)
sender.mEventNotifyItem(
sender ,
ref _info);
}
#endregion
#region Event ListChangeScroll
[DllImport(DllName.m_dllName, CallingConvention = CallingConvention.Cdecl)]
private static extern void ExportListBoxEvent_AdviseListChangeScroll(IntPtr _native, bool _advise);
public delegate void HandleListChangeScroll(
ListBox _sender,
uint _position);
private HandleListChangeScroll mEventListChangeScroll;
public event HandleListChangeScroll EventListChangeScroll
{
add
{
if (ExportEventListChangeScroll.mDelegate == null)
{
ExportEventListChangeScroll.mDelegate = new ExportEventListChangeScroll.ExportHandle(OnExportListChangeScroll);
ExportEventListChangeScroll.ExportListBoxEvent_DelegateListChangeScroll(ExportEventListChangeScroll.mDelegate);
}
if (mEventListChangeScroll == null)
ExportListBoxEvent_AdviseListChangeScroll(Native, true);
mEventListChangeScroll += value;
}
remove
{
mEventListChangeScroll -= value;
if (mEventListChangeScroll == null)
ExportListBoxEvent_AdviseListChangeScroll(Native, false);
}
}
private struct ExportEventListChangeScroll
{
[DllImport(DllName.m_dllName, CallingConvention = CallingConvention.Cdecl)]
public static extern void ExportListBoxEvent_DelegateListChangeScroll(ExportHandle _delegate);
[UnmanagedFunctionPointer(CallingConvention.StdCall)]
public delegate void ExportHandle(
IntPtr _sender,
uint _position);
public static ExportHandle mDelegate;
}
private static void OnExportListChangeScroll(
IntPtr _sender,
uint _position)
{
ListBox sender = (ListBox)BaseWidget.GetByNative(_sender);
if (sender.mEventListChangeScroll != null)
sender.mEventListChangeScroll(
sender ,
_position);
}
#endregion
#region Event ListMouseItemFocus
[DllImport(DllName.m_dllName, CallingConvention = CallingConvention.Cdecl)]
private static extern void ExportListBoxEvent_AdviseListMouseItemFocus(IntPtr _native, bool _advise);
public delegate void HandleListMouseItemFocus(
ListBox _sender,
uint _index);
private HandleListMouseItemFocus mEventListMouseItemFocus;
public event HandleListMouseItemFocus EventListMouseItemFocus
{
add
{
if (ExportEventListMouseItemFocus.mDelegate == null)
{
ExportEventListMouseItemFocus.mDelegate = new ExportEventListMouseItemFocus.ExportHandle(OnExportListMouseItemFocus);
ExportEventListMouseItemFocus.ExportListBoxEvent_DelegateListMouseItemFocus(ExportEventListMouseItemFocus.mDelegate);
}
if (mEventListMouseItemFocus == null)
ExportListBoxEvent_AdviseListMouseItemFocus(Native, true);
mEventListMouseItemFocus += value;
}
remove
{
mEventListMouseItemFocus -= value;
if (mEventListMouseItemFocus == null)
ExportListBoxEvent_AdviseListMouseItemFocus(Native, false);
}
}
private struct ExportEventListMouseItemFocus
{
[DllImport(DllName.m_dllName, CallingConvention = CallingConvention.Cdecl)]
public static extern void ExportListBoxEvent_DelegateListMouseItemFocus(ExportHandle _delegate);
[UnmanagedFunctionPointer(CallingConvention.StdCall)]
public delegate void ExportHandle(
IntPtr _sender,
uint _index);
public static ExportHandle mDelegate;
}
private static void OnExportListMouseItemFocus(
IntPtr _sender,
uint _index)
{
ListBox sender = (ListBox)BaseWidget.GetByNative(_sender);
if (sender.mEventListMouseItemFocus != null)
sender.mEventListMouseItemFocus(
sender ,
_index);
}
#endregion
#region Event ListMouseItemActivate
[DllImport(DllName.m_dllName, CallingConvention = CallingConvention.Cdecl)]
private static extern void ExportListBoxEvent_AdviseListMouseItemActivate(IntPtr _native, bool _advise);
public delegate void HandleListMouseItemActivate(
ListBox _sender,
uint _index);
private HandleListMouseItemActivate mEventListMouseItemActivate;
public event HandleListMouseItemActivate EventListMouseItemActivate
{
add
{
if (ExportEventListMouseItemActivate.mDelegate == null)
{
ExportEventListMouseItemActivate.mDelegate = new ExportEventListMouseItemActivate.ExportHandle(OnExportListMouseItemActivate);
ExportEventListMouseItemActivate.ExportListBoxEvent_DelegateListMouseItemActivate(ExportEventListMouseItemActivate.mDelegate);
}
if (mEventListMouseItemActivate == null)
ExportListBoxEvent_AdviseListMouseItemActivate(Native, true);
mEventListMouseItemActivate += value;
}
remove
{
mEventListMouseItemActivate -= value;
if (mEventListMouseItemActivate == null)
ExportListBoxEvent_AdviseListMouseItemActivate(Native, false);
}
}
private struct ExportEventListMouseItemActivate
{
[DllImport(DllName.m_dllName, CallingConvention = CallingConvention.Cdecl)]
public static extern void ExportListBoxEvent_DelegateListMouseItemActivate(ExportHandle _delegate);
[UnmanagedFunctionPointer(CallingConvention.StdCall)]
public delegate void ExportHandle(
IntPtr _sender,
uint _index);
public static ExportHandle mDelegate;
}
private static void OnExportListMouseItemActivate(
IntPtr _sender,
uint _index)
{
ListBox sender = (ListBox)BaseWidget.GetByNative(_sender);
if (sender.mEventListMouseItemActivate != null)
sender.mEventListMouseItemActivate(
sender ,
_index);
}
#endregion
#region Event ListChangePosition
[DllImport(DllName.m_dllName, CallingConvention = CallingConvention.Cdecl)]
private static extern void ExportListBoxEvent_AdviseListChangePosition(IntPtr _native, bool _advise);
public delegate void HandleListChangePosition(
ListBox _sender,
uint _index);
private HandleListChangePosition mEventListChangePosition;
public event HandleListChangePosition EventListChangePosition
{
add
{
if (ExportEventListChangePosition.mDelegate == null)
{
ExportEventListChangePosition.mDelegate = new ExportEventListChangePosition.ExportHandle(OnExportListChangePosition);
ExportEventListChangePosition.ExportListBoxEvent_DelegateListChangePosition(ExportEventListChangePosition.mDelegate);
}
if (mEventListChangePosition == null)
ExportListBoxEvent_AdviseListChangePosition(Native, true);
mEventListChangePosition += value;
}
remove
{
mEventListChangePosition -= value;
if (mEventListChangePosition == null)
ExportListBoxEvent_AdviseListChangePosition(Native, false);
}
}
private struct ExportEventListChangePosition
{
[DllImport(DllName.m_dllName, CallingConvention = CallingConvention.Cdecl)]
public static extern void ExportListBoxEvent_DelegateListChangePosition(ExportHandle _delegate);
[UnmanagedFunctionPointer(CallingConvention.StdCall)]
public delegate void ExportHandle(
IntPtr _sender,
uint _index);
public static ExportHandle mDelegate;
}
private static void OnExportListChangePosition(
IntPtr _sender,
uint _index)
{
ListBox sender = (ListBox)BaseWidget.GetByNative(_sender);
if (sender.mEventListChangePosition != null)
sender.mEventListChangePosition(
sender ,
_index);
}
#endregion
#region Event ListSelectAccept
[DllImport(DllName.m_dllName, CallingConvention = CallingConvention.Cdecl)]
private static extern void ExportListBoxEvent_AdviseListSelectAccept(IntPtr _native, bool _advise);
public delegate void HandleListSelectAccept(
ListBox _sender,
uint _index);
private HandleListSelectAccept mEventListSelectAccept;
public event HandleListSelectAccept EventListSelectAccept
{
add
{
if (ExportEventListSelectAccept.mDelegate == null)
{
ExportEventListSelectAccept.mDelegate = new ExportEventListSelectAccept.ExportHandle(OnExportListSelectAccept);
ExportEventListSelectAccept.ExportListBoxEvent_DelegateListSelectAccept(ExportEventListSelectAccept.mDelegate);
}
if (mEventListSelectAccept == null)
ExportListBoxEvent_AdviseListSelectAccept(Native, true);
mEventListSelectAccept += value;
}
remove
{
mEventListSelectAccept -= value;
if (mEventListSelectAccept == null)
ExportListBoxEvent_AdviseListSelectAccept(Native, false);
}
}
private struct ExportEventListSelectAccept
{
[DllImport(DllName.m_dllName, CallingConvention = CallingConvention.Cdecl)]
public static extern void ExportListBoxEvent_DelegateListSelectAccept(ExportHandle _delegate);
[UnmanagedFunctionPointer(CallingConvention.StdCall)]
public delegate void ExportHandle(
IntPtr _sender,
uint _index);
public static ExportHandle mDelegate;
}
private static void OnExportListSelectAccept(
IntPtr _sender,
uint _index)
{
ListBox sender = (ListBox)BaseWidget.GetByNative(_sender);
if (sender.mEventListSelectAccept != null)
sender.mEventListSelectAccept(
sender ,
_index);
}
#endregion
#region Method GetWidgetByIndex
[DllImport(DllName.m_dllName, CallingConvention = CallingConvention.Cdecl)]
private static extern IntPtr ExportListBox_GetWidgetByIndex__index(IntPtr _native,
uint _index);
public Widget GetWidgetByIndex(
uint _index)
{
return (Widget)BaseWidget.GetByNative(ExportListBox_GetWidgetByIndex__index(Native,
_index));
}
#endregion
#region Method GetItemNameAt
[DllImport(DllName.m_dllName, CallingConvention = CallingConvention.Cdecl)]
private static extern IntPtr ExportListBox_GetItemNameAt__index(IntPtr _native,
uint _index);
public string GetItemNameAt(
uint _index)
{
return Marshal.PtrToStringUni(ExportListBox_GetItemNameAt__index(Native,
_index));
}
#endregion
#region Method SetItemNameAt
[DllImport(DllName.m_dllName, CallingConvention = CallingConvention.Cdecl)]
private static extern void ExportListBox_SetItemNameAt__index__name(IntPtr _native,
uint _index,
[MarshalAs(UnmanagedType.LPWStr)] string _name);
public void SetItemNameAt(
uint _index,
string _name)
{
ExportListBox_SetItemNameAt__index__name(Native,
_index,
_name);
}
#endregion
#region Method SetScrollPosition
[DllImport(DllName.m_dllName, CallingConvention = CallingConvention.Cdecl)]
private static extern void ExportListBox_SetScrollPosition__position(IntPtr _native,
uint _position);
public void SetScrollPosition(
uint _position)
{
ExportListBox_SetScrollPosition__position(Native,
_position);
}
#endregion
#region Method SetScrollVisible
[DllImport(DllName.m_dllName, CallingConvention = CallingConvention.Cdecl)]
private static extern void ExportListBox_SetScrollVisible__visible(IntPtr _native,
[MarshalAs(UnmanagedType.U1)] bool _visible);
public void SetScrollVisible(
bool _visible)
{
ExportListBox_SetScrollVisible__visible(Native,
_visible);
}
#endregion
#region Method IsItemSelectedVisible
[DllImport(DllName.m_dllName, CallingConvention = CallingConvention.Cdecl)]
private static extern bool ExportListBox_IsItemSelectedVisible__fill(IntPtr _native,
[MarshalAs(UnmanagedType.U1)] bool _fill);
public bool IsItemSelectedVisible(
bool _fill)
{
return ExportListBox_IsItemSelectedVisible__fill(Native,
_fill);
}
#endregion
#region Method IsItemVisibleAt
[DllImport(DllName.m_dllName, CallingConvention = CallingConvention.Cdecl)]
private static extern bool ExportListBox_IsItemVisibleAt__index__fill(IntPtr _native,
uint _index,
[MarshalAs(UnmanagedType.U1)] bool _fill);
public bool IsItemVisibleAt(
uint _index,
bool _fill)
{
return ExportListBox_IsItemVisibleAt__index__fill(Native,
_index,
_fill);
}
#endregion
#region Method BeginToItemSelected
[DllImport(DllName.m_dllName, CallingConvention = CallingConvention.Cdecl)]
private static extern void ExportListBox_BeginToItemSelected(IntPtr _native);
public void BeginToItemSelected( )
{
ExportListBox_BeginToItemSelected(Native);
}
#endregion
#region Method BeginToItemLast
[DllImport(DllName.m_dllName, CallingConvention = CallingConvention.Cdecl)]
private static extern void ExportListBox_BeginToItemLast(IntPtr _native);
public void BeginToItemLast( )
{
ExportListBox_BeginToItemLast(Native);
}
#endregion
#region Method BeginToItemFirst
[DllImport(DllName.m_dllName, CallingConvention = CallingConvention.Cdecl)]
private static extern void ExportListBox_BeginToItemFirst(IntPtr _native);
public void BeginToItemFirst( )
{
ExportListBox_BeginToItemFirst(Native);
}
#endregion
#region Method BeginToItemAt
[DllImport(DllName.m_dllName, CallingConvention = CallingConvention.Cdecl)]
private static extern void ExportListBox_BeginToItemAt__index(IntPtr _native,
uint _index);
public void BeginToItemAt(
uint _index)
{
ExportListBox_BeginToItemAt__index(Native,
_index);
}
#endregion
#region Method ClearIndexSelected
[DllImport(DllName.m_dllName, CallingConvention = CallingConvention.Cdecl)]
private static extern void ExportListBox_ClearIndexSelected(IntPtr _native);
public void ClearIndexSelected( )
{
ExportListBox_ClearIndexSelected(Native);
}
#endregion
#region Method FindItemIndexWith
[DllImport(DllName.m_dllName, CallingConvention = CallingConvention.Cdecl)]
private static extern uint ExportListBox_FindItemIndexWith__name(IntPtr _native,
[MarshalAs(UnmanagedType.LPWStr)] string _name);
public uint FindItemIndexWith(
string _name)
{
return ExportListBox_FindItemIndexWith__name(Native,
_name);
}
#endregion
#region Method SwapItemsAt
[DllImport(DllName.m_dllName, CallingConvention = CallingConvention.Cdecl)]
private static extern void ExportListBox_SwapItemsAt__index1__index2(IntPtr _native,
uint _index1,
uint _index2);
public void SwapItemsAt(
uint _index1,
uint _index2)
{
ExportListBox_SwapItemsAt__index1__index2(Native,
_index1,
_index2);
}
#endregion
#region Method RemoveAllItems
[DllImport(DllName.m_dllName, CallingConvention = CallingConvention.Cdecl)]
private static extern void ExportListBox_RemoveAllItems(IntPtr _native);
public void RemoveAllItems( )
{
ExportListBox_RemoveAllItems(Native);
}
#endregion
#region Method RemoveItemAt
[DllImport(DllName.m_dllName, CallingConvention = CallingConvention.Cdecl)]
private static extern void ExportListBox_RemoveItemAt__index(IntPtr _native,
uint _index);
public void RemoveItemAt(
uint _index)
{
ExportListBox_RemoveItemAt__index(Native,
_index);
}
#endregion
#region Method AddItem
[DllImport(DllName.m_dllName, CallingConvention = CallingConvention.Cdecl)]
private static extern void ExportListBox_AddItem__name(IntPtr _native,
[MarshalAs(UnmanagedType.LPWStr)] string _name);
public void AddItem(
string _name)
{
ExportListBox_AddItem__name(Native,
_name);
}
#endregion
#region Method InsertItemAt
[DllImport(DllName.m_dllName, CallingConvention = CallingConvention.Cdecl)]
private static extern void ExportListBox_InsertItemAt__index__name(IntPtr _native,
uint _index,
[MarshalAs(UnmanagedType.LPWStr)] string _name);
public void InsertItemAt(
uint _index,
string _name)
{
ExportListBox_InsertItemAt__index__name(Native,
_index,
_name);
}
#endregion
#region Property OptimalHeight
[DllImport(DllName.m_dllName, CallingConvention = CallingConvention.Cdecl)]
private static extern int ExportListBox_GetOptimalHeight(IntPtr _native);
public int OptimalHeight
{
get { return ExportListBox_GetOptimalHeight(Native); }
}
#endregion
#region Property IndexSelected
[DllImport(DllName.m_dllName, CallingConvention = CallingConvention.Cdecl)]
private static extern uint ExportListBox_GetIndexSelected(IntPtr _widget);
[DllImport(DllName.m_dllName, CallingConvention = CallingConvention.Cdecl)]
private static extern void ExportListBox_SetIndexSelected(IntPtr _widget, uint _value);
public uint IndexSelected
{
get { return ExportListBox_GetIndexSelected(Native); }
set { ExportListBox_SetIndexSelected(Native, value); }
}
#endregion
#region Property ItemCount
[DllImport(DllName.m_dllName, CallingConvention = CallingConvention.Cdecl)]
private static extern uint ExportListBox_GetItemCount(IntPtr _native);
public uint ItemCount
{
get { return ExportListBox_GetItemCount(Native); }
}
#endregion
}
}
|