Mercurial > projects > dwt-mac
comparison dwt/widgets/Display.d @ 19:fba856099f87
Ported dwt.widgets.Display
author | Jacob Carlborg <doob@me.com> <jacob.carlborg@gmail.com> |
---|---|
date | Wed, 03 Sep 2008 20:59:39 +0200 |
parents | 5b53d338c709 |
children | db5a898b2119 |
comparison
equal
deleted
inserted
replaced
18:b55912b6771e | 19:fba856099f87 |
---|---|
22 import dwt.graphics.DeviceData; | 22 import dwt.graphics.DeviceData; |
23 import dwt.graphics.GCData; | 23 import dwt.graphics.GCData; |
24 import dwt.graphics.Image; | 24 import dwt.graphics.Image; |
25 import dwt.graphics.Point; | 25 import dwt.graphics.Point; |
26 import dwt.graphics.Rectangle; | 26 import dwt.graphics.Rectangle; |
27 import dwt.internal.Callback; | |
28 import dwt.internal.cocoa.CGPoint; | 27 import dwt.internal.cocoa.CGPoint; |
29 import dwt.internal.cocoa.NSApplication; | 28 import dwt.internal.cocoa.NSApplication; |
30 import dwt.internal.cocoa.NSArray; | 29 import dwt.internal.cocoa.NSArray; |
31 import dwt.internal.cocoa.NSAutoreleasePool; | 30 import dwt.internal.cocoa.NSAutoreleasePool; |
32 import dwt.internal.cocoa.NSBundle; | 31 import dwt.internal.cocoa.NSBundle; |
56 import dwt.internal.cocoa.SWTApplicationDelegate; | 55 import dwt.internal.cocoa.SWTApplicationDelegate; |
57 import dwt.internal.cocoa.SWTWindowDelegate; | 56 import dwt.internal.cocoa.SWTWindowDelegate; |
58 import dwt.internal.cocoa.id; | 57 import dwt.internal.cocoa.id; |
59 | 58 |
60 import tango.core.Thread; | 59 import tango.core.Thread; |
60 import tango.stdc.stringz; | |
61 | 61 |
62 import dwt.dwthelper.Runnable; | 62 import dwt.dwthelper.Runnable; |
63 import dwt.dwthelper.System; | 63 import dwt.dwthelper.System; |
64 import dwt.dwthelper.utils; | 64 import dwt.dwthelper.utils; |
65 | 65 |
66 import dwt.internal.c.carboncore.MacTypes; | 66 import dwt.internal.c.carboncore.MacTypes; |
67 | |
68 import dwt.internal.cocoa.NSInteger; | 67 import dwt.internal.cocoa.NSInteger; |
68 import objc = dwt.internal.objc.runtime; | |
69 | 69 |
70 import dwt.widgets.Caret; | 70 import dwt.widgets.Caret; |
71 import dwt.widgets.Control; | 71 import dwt.widgets.Control; |
72 import dwt.widgets.Dialog; | 72 import dwt.widgets.Dialog; |
73 import dwt.widgets.Event; | 73 import dwt.widgets.Event; |
175 | 175 |
176 NSApplication application; | 176 NSApplication application; |
177 NSAutoreleasePool pool; | 177 NSAutoreleasePool pool; |
178 | 178 |
179 NSPoint cascade = NSPoint(); | 179 NSPoint cascade = NSPoint(); |
180 | |
181 Callback applicationDelegateCallback3; | |
182 Callback windowDelegateCallback2, windowDelegateCallback3, windowDelegateCallback4, windowDelegateCallback5; | |
183 Callback windowDelegateCallback6; | |
184 Callback dialogCallback3; | |
185 | 180 |
186 /* Menus */ | 181 /* Menus */ |
187 // Menu menuBar; | 182 // Menu menuBar; |
188 // Menu [] menus, popups; | 183 // Menu [] menus, popups; |
189 // static final int ID_TEMPORARY = 1000; | 184 // static final int ID_TEMPORARY = 1000; |
1609 initApplicationDelegate(); | 1604 initApplicationDelegate(); |
1610 application.finishLaunching(); | 1605 application.finishLaunching(); |
1611 } | 1606 } |
1612 | 1607 |
1613 void initApplicationDelegate() { | 1608 void initApplicationDelegate() { |
1614 applicationDelegateCallback3 = new Callback(this, "applicationDelegateProc", 3); | 1609 auto appProc3 = &applicationDelegateProc; |
1615 int appProc3 = applicationDelegateCallback3.getAddress(); | |
1616 if (appProc3 is 0) error (DWT.ERROR_NO_MORE_CALLBACKS); | |
1617 | 1610 |
1618 String className = "SWTApplicationDelegate"; | 1611 String className = "SWTApplicationDelegate"; |
1619 objc.Class cls = OS.objc_allocateClassPair(OS.classinfo_NSObject, className, 0); | 1612 objc.Class cls = OS.objc_allocateClassPair(OS.class_NSObject, className, 0); |
1620 OS.class_addMethod(cls, OS.sel_applicationWillFinishLaunching_1, appProc3, "@:@"); | 1613 OS.class_addMethod(cls, OS.sel_applicationWillFinishLaunching_1, appProc3, "@:@"); |
1621 OS.class_addMethod(cls, OS.sel_terminate_1, appProc3, "@:@"); | 1614 OS.class_addMethod(cls, OS.sel_terminate_1, appProc3, "@:@"); |
1622 OS.class_addMethod(cls, OS.sel_orderFrontStandardAboutPanel_1, appProc3, "@:@"); | 1615 OS.class_addMethod(cls, OS.sel_orderFrontStandardAboutPanel_1, appProc3, "@:@"); |
1623 OS.class_addMethod(cls, OS.sel_hideOtherApplications_1, appProc3, "@:@"); | 1616 OS.class_addMethod(cls, OS.sel_hideOtherApplications_1, appProc3, "@:@"); |
1624 OS.class_addMethod(cls, OS.sel_hide_1, appProc3, "@:@"); | 1617 OS.class_addMethod(cls, OS.sel_hide_1, appProc3, "@:@"); |
1625 OS.class_addMethod(cls, OS.sel_unhideAllApplications_1, appProc3, "@:@"); | 1618 OS.class_addMethod(cls, OS.sel_unhideAllApplications_1, appProc3, "@:@"); |
1626 OS.class_addMethod(cls, OS.sel_applicationShouldTerminate_1, appProc3, "@:@"); | 1619 OS.class_addMethod(cls, OS.sel_applicationShouldTerminate_1, appProc3, "@:@"); |
1627 OS.class_addMethod(cls, OS.sel_applicationWillTerminate_1, appProc3, "@:@"); | 1620 OS.class_addMethod(cls, OS.sel_applicationWillTerminate_1, appProc3, "@:@"); |
1628 OS.objc_registerClassPair(cls); | 1621 OS.objc_registerClassPair(cls); |
1629 | 1622 |
1630 applicationDelegate = cast(SWTApplicationDelegate)(new SWTApplicationDelegate()).alloc().init(); | 1623 applicationDelegate = cast(SWTApplicationDelegate)(new SWTApplicationDelegate()).alloc().init(); |
1631 application.setDelegate(applicationDelegate); | 1624 application.setDelegate(applicationDelegate); |
1632 } | 1625 } |
1633 | 1626 |
1634 void initClasses () { | 1627 void initClasses () { |
1635 dialogCallback3 = new Callback(this, "dialogProc", 3); | 1628 auto dialogProc3 = &dialogProc; |
1636 int dialogProc3 = dialogCallback3.getAddress(); | 1629 |
1637 if (dialogProc3 is 0) error (DWT.ERROR_NO_MORE_CALLBACKS); | 1630 auto proc3 = &windowDelegateProc3; |
1638 | 1631 auto proc2 = &windowDelegateProc2; |
1639 windowDelegateCallback3 = new Callback(this, "windowDelegateProc", 3); | 1632 auto proc4 = &windowDelegateProc4; |
1640 int proc3 = windowDelegateCallback3.getAddress(); | 1633 auto proc5 = &windowDelegateProc5; |
1641 if (proc3 is 0) error (DWT.ERROR_NO_MORE_CALLBACKS); | 1634 auto proc6 = &windowDelegateProc6; |
1642 windowDelegateCallback2 = new Callback(this, "windowDelegateProc", 2); | 1635 |
1643 int proc2 = windowDelegateCallback2.getAddress(); | 1636 auto drawRectProc = OS.drawRect_CALLBACK(proc3); |
1644 if (proc2 is 0) error (DWT.ERROR_NO_MORE_CALLBACKS); | |
1645 windowDelegateCallback4 = new Callback(this, "windowDelegateProc", 4); | |
1646 int proc4 = windowDelegateCallback4.getAddress(); | |
1647 if (proc4 is 0) error (DWT.ERROR_NO_MORE_CALLBACKS); | |
1648 windowDelegateCallback5 = new Callback(this, "windowDelegateProc", 5); | |
1649 int proc5 = windowDelegateCallback5.getAddress(); | |
1650 if (proc5 is 0) error (DWT.ERROR_NO_MORE_CALLBACKS); | |
1651 windowDelegateCallback6 = new Callback(this, "windowDelegateProc", 6); | |
1652 int proc6 = windowDelegateCallback6.getAddress(); | |
1653 if (proc6 is 0) error (DWT.ERROR_NO_MORE_CALLBACKS); | |
1654 | |
1655 int drawRectProc = OS.drawRect_CALLBACK(proc3); | |
1656 | 1637 |
1657 String className = "SWTWindowDelegate"; | 1638 String className = "SWTWindowDelegate"; |
1658 objc.Class cls = OS.objc_allocateClassPair(OS.class_NSObject, className, 0); | 1639 objc.Class cls = OS.objc_allocateClassPair(OS.class_NSObject, className, 0); |
1659 OS.class_addIvar(cls, "tag", OS.PTR_SIZEOF, cast(byte)(Math.log(OS.PTR_SIZEOF) / Math.log(2)), "i"); | 1640 |
1641 static if ((void*).sizeof > int.sizeof) // 64bit target | |
1642 OS.class_addIvar(cls, "tag", OS.PTR_SIZEOF, cast(byte)(Math.log(OS.PTR_SIZEOF) / Math.log(2)), "q"); | |
1643 else | |
1644 OS.class_addIvar(cls, "tag", OS.PTR_SIZEOF, cast(byte)(Math.log(OS.PTR_SIZEOF) / Math.log(2)), "i"); | |
1645 | |
1660 OS.class_addMethod(cls, OS.sel_windowDidResize_1, proc3, "@:@"); | 1646 OS.class_addMethod(cls, OS.sel_windowDidResize_1, proc3, "@:@"); |
1661 OS.class_addMethod(cls, OS.sel_windowShouldClose_1, proc3, "@:@"); | 1647 OS.class_addMethod(cls, OS.sel_windowShouldClose_1, proc3, "@:@"); |
1662 OS.class_addMethod(cls, OS.sel_windowWillClose_1, proc3, "@:@"); | 1648 OS.class_addMethod(cls, OS.sel_windowWillClose_1, proc3, "@:@"); |
1663 OS.class_addMethod(cls, OS.sel_windowWillClose_1, proc3, "@:@"); | 1649 OS.class_addMethod(cls, OS.sel_windowWillClose_1, proc3, "@:@"); |
1664 OS.class_addMethod(cls, OS.sel_windowDidResignKey_1, proc3, "@:@"); | 1650 OS.class_addMethod(cls, OS.sel_windowDidResignKey_1, proc3, "@:@"); |
1716 OS.class_addMethod(cls, OS.sel_sendHorizontalSelection, proc2, "@:"); | 1702 OS.class_addMethod(cls, OS.sel_sendHorizontalSelection, proc2, "@:"); |
1717 // OS.class_addMethod(cls, OS.sel_menuForEvent_1, proc3, "@:@"); | 1703 // OS.class_addMethod(cls, OS.sel_menuForEvent_1, proc3, "@:@"); |
1718 OS.objc_registerClassPair(cls); | 1704 OS.objc_registerClassPair(cls); |
1719 | 1705 |
1720 className = "SWTButton"; | 1706 className = "SWTButton"; |
1721 cls = OS.objc_allocateClassPair(OS.classinfo_NSButton, className, 0); | 1707 cls = OS.objc_allocateClassPair(OS.class_NSButton, className, 0); |
1722 // OS.class_addMethod(cls, OS.sel_isFlipped, proc2, "@:"); | 1708 // OS.class_addMethod(cls, OS.sel_isFlipped, proc2, "@:"); |
1723 // OS.class_addMethod(cls, OS.sel_mouseDown_1, proc3, "@:@"); | 1709 // OS.class_addMethod(cls, OS.sel_mouseDown_1, proc3, "@:@"); |
1724 OS.class_addMethod(cls, OS.sel_drawRect_1, drawRectProc, "@:i"); | 1710 OS.class_addMethod(cls, OS.sel_drawRect_1, drawRectProc, "@:i"); |
1725 OS.class_addMethod(cls, OS.sel_sendSelection, proc2, "@:"); | 1711 OS.class_addMethod(cls, OS.sel_sendSelection, proc2, "@:"); |
1726 OS.class_addMethod(cls, OS.sel_sendArrowSelection, proc2, "@:"); | 1712 OS.class_addMethod(cls, OS.sel_sendArrowSelection, proc2, "@:"); |
1727 OS.class_addMethod(cls, OS.sel_menuForEvent_1, proc3, "@:@"); | 1713 OS.class_addMethod(cls, OS.sel_menuForEvent_1, proc3, "@:@"); |
1728 OS.objc_registerClassPair(cls); | 1714 OS.objc_registerClassPair(cls); |
1729 | 1715 |
1730 className = "SWTTableView"; | 1716 className = "SWTTableView"; |
1731 cls = OS.objc_allocateClassPair(OS.classinfo_NSTableView, className, 0); | 1717 cls = OS.objc_allocateClassPair(OS.class_NSTableView, className, 0); |
1732 OS.class_addMethod(cls, OS.sel_sendDoubleSelection, proc2, "@:"); | 1718 OS.class_addMethod(cls, OS.sel_sendDoubleSelection, proc2, "@:"); |
1733 // OS.class_addMethod(cls, OS.sel_isFlipped, proc2, "@:"); | 1719 // OS.class_addMethod(cls, OS.sel_isFlipped, proc2, "@:"); |
1734 OS.class_addMethod(cls, OS.sel_numberOfRowsInTableView_1, proc3, "@:@"); | 1720 OS.class_addMethod(cls, OS.sel_numberOfRowsInTableView_1, proc3, "@:@"); |
1735 OS.class_addMethod(cls, OS.sel_tableView_1objectValueForTableColumn_1row_1, proc5, "@:@:@:@"); | 1721 OS.class_addMethod(cls, OS.sel_tableView_1objectValueForTableColumn_1row_1, proc5, "@:@:@:@"); |
1736 OS.class_addMethod(cls, OS.sel_tableView_1shouldEditTableColumn_1row_1, proc5, "@:@:@:@"); | 1722 OS.class_addMethod(cls, OS.sel_tableView_1shouldEditTableColumn_1row_1, proc5, "@:@:@:@"); |
1739 OS.class_addMethod(cls, OS.sel_menuForEvent_1, proc3, "@:@"); | 1725 OS.class_addMethod(cls, OS.sel_menuForEvent_1, proc3, "@:@"); |
1740 OS.class_addMethod(cls, OS.sel_tableView_1setObjectValue_1forTableColumn_1row_1, proc6, "@:@@@i"); | 1726 OS.class_addMethod(cls, OS.sel_tableView_1setObjectValue_1forTableColumn_1row_1, proc6, "@:@@@i"); |
1741 OS.objc_registerClassPair(cls); | 1727 OS.objc_registerClassPair(cls); |
1742 | 1728 |
1743 className = "SWTOutlineView"; | 1729 className = "SWTOutlineView"; |
1744 cls = OS.objc_allocateClassPair(OS.classinfo_NSOutlineView, className, 0); | 1730 cls = OS.objc_allocateClassPair(OS.class_NSOutlineView, className, 0); |
1745 OS.class_addMethod(cls, OS.sel_sendDoubleSelection, proc2, "@:"); | 1731 OS.class_addMethod(cls, OS.sel_sendDoubleSelection, proc2, "@:"); |
1746 OS.class_addMethod(cls, OS.sel_outlineViewSelectionDidChange_1, proc3, "@:@"); | 1732 OS.class_addMethod(cls, OS.sel_outlineViewSelectionDidChange_1, proc3, "@:@"); |
1747 OS.class_addMethod(cls, OS.sel_outlineView_1shouldCollapseItem_1, proc4, "@:@@"); | 1733 OS.class_addMethod(cls, OS.sel_outlineView_1shouldCollapseItem_1, proc4, "@:@@"); |
1748 OS.class_addMethod(cls, OS.sel_outlineView_1shouldExpandItem_1, proc4, "@:@@"); | 1734 OS.class_addMethod(cls, OS.sel_outlineView_1shouldExpandItem_1, proc4, "@:@@"); |
1749 OS.class_addMethod(cls, OS.sel_outlineView_1child_1ofItem_1, proc5, "@:@i@"); | 1735 OS.class_addMethod(cls, OS.sel_outlineView_1child_1ofItem_1, proc5, "@:@i@"); |
1754 OS.class_addMethod(cls, OS.sel_outlineView_1setObjectValue_1forTableColumn_1byItem_1, proc6, "@:@@@@"); | 1740 OS.class_addMethod(cls, OS.sel_outlineView_1setObjectValue_1forTableColumn_1byItem_1, proc6, "@:@@@@"); |
1755 OS.class_addMethod(cls, OS.sel_menuForEvent_1, proc3, "@:@"); | 1741 OS.class_addMethod(cls, OS.sel_menuForEvent_1, proc3, "@:@"); |
1756 OS.objc_registerClassPair(cls); | 1742 OS.objc_registerClassPair(cls); |
1757 | 1743 |
1758 className = "SWTTreeItem"; | 1744 className = "SWTTreeItem"; |
1759 cls = OS.objc_allocateClassPair(OS.classinfo_NSObject, className, 0); | 1745 cls = OS.objc_allocateClassPair(OS.class_NSObject, className, 0); |
1760 // OS.class_addMethod(cls, OS.sel_isFlipped, proc2, "@:"); | 1746 // OS.class_addMethod(cls, OS.sel_isFlipped, proc2, "@:"); |
1761 OS.class_addIvar(cls, "tag", OS.PTR_SIZEOF, cast(byte)(Math.log(OS.PTR_SIZEOF) / Math.log(2)), "i"); | 1747 OS.class_addIvar(cls, "tag", OS.PTR_SIZEOF, cast(byte)(Math.log(OS.PTR_SIZEOF) / Math.log(2)), "i"); |
1762 OS.class_addMethod(cls, OS.sel_tag, proc2, "@:"); | 1748 OS.class_addMethod(cls, OS.sel_tag, proc2, "@:"); |
1763 OS.class_addMethod(cls, OS.sel_setTag_1, proc3, "@:i"); | 1749 OS.class_addMethod(cls, OS.sel_setTag_1, proc3, "@:i"); |
1764 OS.objc_registerClassPair(cls); | 1750 OS.objc_registerClassPair(cls); |
1765 | 1751 |
1766 className = "SWTTabView"; | 1752 className = "SWTTabView"; |
1767 cls = OS.objc_allocateClassPair(OS.classinfo_NSTabView, className, 0); | 1753 cls = OS.objc_allocateClassPair(OS.class_NSTabView, className, 0); |
1768 // OS.class_addMethod(cls, OS.sel_isFlipped, proc2, "@:"); | 1754 // OS.class_addMethod(cls, OS.sel_isFlipped, proc2, "@:"); |
1769 OS.class_addIvar(cls, "tag", OS.PTR_SIZEOF, cast(byte)(Math.log(OS.PTR_SIZEOF) / Math.log(2)), "i"); | 1755 OS.class_addIvar(cls, "tag", OS.PTR_SIZEOF, cast(byte)(Math.log(OS.PTR_SIZEOF) / Math.log(2)), "i"); |
1770 OS.class_addMethod(cls, OS.sel_tabView_1willSelectTabViewItem_1, proc4, "@:@@"); | 1756 OS.class_addMethod(cls, OS.sel_tabView_1willSelectTabViewItem_1, proc4, "@:@@"); |
1771 OS.class_addMethod(cls, OS.sel_tag, proc2, "@:"); | 1757 OS.class_addMethod(cls, OS.sel_tag, proc2, "@:"); |
1772 OS.class_addMethod(cls, OS.sel_setTag_1, proc3, "@:i"); | 1758 OS.class_addMethod(cls, OS.sel_setTag_1, proc3, "@:i"); |
1773 OS.class_addMethod(cls, OS.sel_menuForEvent_1, proc3, "@:@"); | 1759 OS.class_addMethod(cls, OS.sel_menuForEvent_1, proc3, "@:@"); |
1774 OS.objc_registerClassPair(cls); | 1760 OS.objc_registerClassPair(cls); |
1775 | 1761 |
1776 className = "SWTBox"; | 1762 className = "SWTBox"; |
1777 cls = OS.objc_allocateClassPair(OS.classinfo_NSBox, className, 0); | 1763 cls = OS.objc_allocateClassPair(OS.class_NSBox, className, 0); |
1778 // OS.class_addMethod(cls, OS.sel_isFlipped, proc2, "@:"); | 1764 // OS.class_addMethod(cls, OS.sel_isFlipped, proc2, "@:"); |
1779 OS.class_addIvar(cls, "tag", OS.PTR_SIZEOF, cast(byte)(Math.log(OS.PTR_SIZEOF) / Math.log(2)), "i"); | 1765 OS.class_addIvar(cls, "tag", OS.PTR_SIZEOF, cast(byte)(Math.log(OS.PTR_SIZEOF) / Math.log(2)), "i"); |
1780 OS.class_addMethod(cls, OS.sel_tag, proc2, "@:"); | 1766 OS.class_addMethod(cls, OS.sel_tag, proc2, "@:"); |
1781 OS.class_addMethod(cls, OS.sel_setTag_1, proc3, "@:i"); | 1767 OS.class_addMethod(cls, OS.sel_setTag_1, proc3, "@:i"); |
1782 OS.class_addMethod(cls, OS.sel_menuForEvent_1, proc3, "@:@"); | 1768 OS.class_addMethod(cls, OS.sel_menuForEvent_1, proc3, "@:@"); |
1783 OS.objc_registerClassPair(cls); | 1769 OS.objc_registerClassPair(cls); |
1784 | 1770 |
1785 className = "SWTProgressIndicator"; | 1771 className = "SWTProgressIndicator"; |
1786 cls = OS.objc_allocateClassPair(OS.classinfo_NSProgressIndicator, className, 0); | 1772 cls = OS.objc_allocateClassPair(OS.class_NSProgressIndicator, className, 0); |
1787 // OS.class_addMethod(cls, OS.sel_isFlipped, proc2, "@:"); | 1773 // OS.class_addMethod(cls, OS.sel_isFlipped, proc2, "@:"); |
1788 OS.class_addIvar(cls, "tag", OS.PTR_SIZEOF, cast(byte)(Math.log(OS.PTR_SIZEOF) / Math.log(2)), "i"); | 1774 OS.class_addIvar(cls, "tag", OS.PTR_SIZEOF, cast(byte)(Math.log(OS.PTR_SIZEOF) / Math.log(2)), "i"); |
1789 OS.class_addMethod(cls, OS.sel_tag, proc2, "@:"); | 1775 OS.class_addMethod(cls, OS.sel_tag, proc2, "@:"); |
1790 OS.class_addMethod(cls, OS.sel_setTag_1, proc3, "@:i"); | 1776 OS.class_addMethod(cls, OS.sel_setTag_1, proc3, "@:i"); |
1791 OS.class_addMethod(cls, OS.sel_menuForEvent_1, proc3, "@:@"); | 1777 OS.class_addMethod(cls, OS.sel_menuForEvent_1, proc3, "@:@"); |
1792 OS.objc_registerClassPair(cls); | 1778 OS.objc_registerClassPair(cls); |
1793 | 1779 |
1794 className = "SWTSlider"; | 1780 className = "SWTSlider"; |
1795 cls = OS.objc_allocateClassPair(OS.classinfo_NSSlider, className, 0); | 1781 cls = OS.objc_allocateClassPair(OS.class_NSSlider, className, 0); |
1796 // OS.class_addMethod(cls, OS.sel_isFlipped, proc2, "@:"); | 1782 // OS.class_addMethod(cls, OS.sel_isFlipped, proc2, "@:"); |
1797 OS.class_addMethod(cls, OS.sel_menuForEvent_1, proc3, "@:@"); | 1783 OS.class_addMethod(cls, OS.sel_menuForEvent_1, proc3, "@:@"); |
1798 OS.objc_registerClassPair(cls); | 1784 OS.objc_registerClassPair(cls); |
1799 | 1785 |
1800 className = "SWTPopUpButton"; | 1786 className = "SWTPopUpButton"; |
1801 cls = OS.objc_allocateClassPair(OS.classinfo_NSPopUpButton, className, 0); | 1787 cls = OS.objc_allocateClassPair(OS.class_NSPopUpButton, className, 0); |
1802 // OS.class_addMethod(cls, OS.sel_isFlipped, proc2, "@:"); | 1788 // OS.class_addMethod(cls, OS.sel_isFlipped, proc2, "@:"); |
1803 OS.class_addMethod(cls, OS.sel_sendSelection, proc2, "@:"); | 1789 OS.class_addMethod(cls, OS.sel_sendSelection, proc2, "@:"); |
1804 OS.class_addMethod(cls, OS.sel_menuForEvent_1, proc3, "@:@"); | 1790 OS.class_addMethod(cls, OS.sel_menuForEvent_1, proc3, "@:@"); |
1805 OS.objc_registerClassPair(cls); | 1791 OS.objc_registerClassPair(cls); |
1806 | 1792 |
1807 className = "SWTComboBox"; | 1793 className = "SWTComboBox"; |
1808 cls = OS.objc_allocateClassPair(OS.classinfo_NSComboBox, className, 0); | 1794 cls = OS.objc_allocateClassPair(OS.class_NSComboBox, className, 0); |
1809 // OS.class_addMethod(cls, OS.sel_isFlipped, proc2, "@:"); | 1795 // OS.class_addMethod(cls, OS.sel_isFlipped, proc2, "@:"); |
1810 OS.class_addMethod(cls, OS.sel_comboBoxSelectionDidChange_1, proc3, "@:@"); | 1796 OS.class_addMethod(cls, OS.sel_comboBoxSelectionDidChange_1, proc3, "@:@"); |
1811 OS.class_addMethod(cls, OS.sel_sendSelection, proc2, "@:"); | 1797 OS.class_addMethod(cls, OS.sel_sendSelection, proc2, "@:"); |
1812 OS.class_addMethod(cls, OS.sel_menuForEvent_1, proc3, "@:@"); | 1798 OS.class_addMethod(cls, OS.sel_menuForEvent_1, proc3, "@:@"); |
1813 OS.objc_registerClassPair(cls); | 1799 OS.objc_registerClassPair(cls); |
1814 | 1800 |
1815 className = "SWTDatePicker"; | 1801 className = "SWTDatePicker"; |
1816 cls = OS.objc_allocateClassPair(OS.classinfo_NSDatePicker, className, 0); | 1802 cls = OS.objc_allocateClassPair(OS.class_NSDatePicker, className, 0); |
1817 // OS.class_addMethod(cls, OS.sel_isFlipped, proc2, "@:"); | 1803 // OS.class_addMethod(cls, OS.sel_isFlipped, proc2, "@:"); |
1818 OS.class_addMethod(cls, OS.sel_sendSelection, proc2, "@:"); | 1804 OS.class_addMethod(cls, OS.sel_sendSelection, proc2, "@:"); |
1819 OS.class_addMethod(cls, OS.sel_menuForEvent_1, proc3, "@:@"); | 1805 OS.class_addMethod(cls, OS.sel_menuForEvent_1, proc3, "@:@"); |
1820 OS.objc_registerClassPair(cls); | 1806 OS.objc_registerClassPair(cls); |
1821 | 1807 |
1822 className = "SWTImageView"; | 1808 className = "SWTImageView"; |
1823 cls = OS.objc_allocateClassPair(OS.classinfo_NSImageView, className, 0); | 1809 cls = OS.objc_allocateClassPair(OS.class_NSImageView, className, 0); |
1824 // OS.class_addMethod(cls, OS.sel_isFlipped, proc2, "@:"); | 1810 // OS.class_addMethod(cls, OS.sel_isFlipped, proc2, "@:"); |
1825 OS.class_addMethod(cls, OS.sel_drawRect_1, OS.drawRect_CALLBACK(proc3), "@:i"); | 1811 OS.class_addMethod(cls, OS.sel_drawRect_1, OS.drawRect_CALLBACK(proc3), "@:i"); |
1826 OS.class_addMethod(cls, OS.sel_mouseDown_1, proc3, "@:@"); | 1812 OS.class_addMethod(cls, OS.sel_mouseDown_1, proc3, "@:@"); |
1827 OS.class_addMethod(cls, OS.sel_mouseUp_1, proc3, "@:@"); | 1813 OS.class_addMethod(cls, OS.sel_mouseUp_1, proc3, "@:@"); |
1828 OS.class_addMethod(cls, OS.sel_rightMouseDown_1, proc3, "@:@"); | 1814 OS.class_addMethod(cls, OS.sel_rightMouseDown_1, proc3, "@:@"); |
1829 OS.class_addMethod(cls, OS.sel_menuForEvent_1, proc3, "@:@"); | 1815 OS.class_addMethod(cls, OS.sel_menuForEvent_1, proc3, "@:@"); |
1830 OS.objc_registerClassPair(cls); | 1816 OS.objc_registerClassPair(cls); |
1831 | 1817 |
1832 className = "SWTStepper"; | 1818 className = "SWTStepper"; |
1833 cls = OS.objc_allocateClassPair(OS.classinfo_NSStepper, className, 0); | 1819 cls = OS.objc_allocateClassPair(OS.class_NSStepper, className, 0); |
1834 // OS.class_addMethod(cls, OS.sel_isFlipped, proc2, "@:"); | 1820 // OS.class_addMethod(cls, OS.sel_isFlipped, proc2, "@:"); |
1835 OS.class_addMethod(cls, OS.sel_sendSelection, proc2, "@:"); | 1821 OS.class_addMethod(cls, OS.sel_sendSelection, proc2, "@:"); |
1836 OS.class_addMethod(cls, OS.sel_menuForEvent_1, proc3, "@:@"); | 1822 OS.class_addMethod(cls, OS.sel_menuForEvent_1, proc3, "@:@"); |
1837 OS.objc_registerClassPair(cls); | 1823 OS.objc_registerClassPair(cls); |
1838 | 1824 |
1839 className = "SWTScroller"; | 1825 className = "SWTScroller"; |
1840 cls = OS.objc_allocateClassPair(OS.classinfo_NSScroller, className, 0); | 1826 cls = OS.objc_allocateClassPair(OS.class_NSScroller, className, 0); |
1841 // OS.class_addMethod(cls, OS.sel_isFlipped, proc2, "@:"); | 1827 // OS.class_addMethod(cls, OS.sel_isFlipped, proc2, "@:"); |
1842 OS.class_addMethod(cls, OS.sel_sendSelection, proc2, "@:"); | 1828 OS.class_addMethod(cls, OS.sel_sendSelection, proc2, "@:"); |
1843 OS.class_addMethod(cls, OS.sel_menuForEvent_1, proc3, "@:@"); | 1829 OS.class_addMethod(cls, OS.sel_menuForEvent_1, proc3, "@:@"); |
1844 OS.objc_registerClassPair(cls); | 1830 OS.objc_registerClassPair(cls); |
1845 | 1831 |
1846 className = "SWTMenuItem"; | 1832 className = "SWTMenuItem"; |
1847 cls = OS.objc_allocateClassPair(OS.classinfo_NSMenuItem, className, 0); | 1833 cls = OS.objc_allocateClassPair(OS.class_NSMenuItem, className, 0); |
1848 // OS.class_addMethod(cls, OS.sel_isFlipped, proc2, "@:"); | 1834 // OS.class_addMethod(cls, OS.sel_isFlipped, proc2, "@:"); |
1849 OS.class_addMethod(cls, OS.sel_sendSelection, proc2, "@:"); | 1835 OS.class_addMethod(cls, OS.sel_sendSelection, proc2, "@:"); |
1850 OS.objc_registerClassPair(cls); | 1836 OS.objc_registerClassPair(cls); |
1851 | 1837 |
1852 className = "SWTTextView"; | 1838 className = "SWTTextView"; |
1853 cls = OS.objc_allocateClassPair(OS.classinfo_NSTextView, className, 0); | 1839 cls = OS.objc_allocateClassPair(OS.class_NSTextView, className, 0); |
1854 // OS.class_addMethod(cls, OS.sel_isFlipped, proc2, "@:"); | 1840 // OS.class_addMethod(cls, OS.sel_isFlipped, proc2, "@:"); |
1855 // OS.class_addMethod(cls, OS.sel_sendSelection, proc2, "@:"); | 1841 // OS.class_addMethod(cls, OS.sel_sendSelection, proc2, "@:"); |
1856 OS.class_addIvar(cls, "tag", OS.PTR_SIZEOF, cast(byte)(Math.log(OS.PTR_SIZEOF) / Math.log(2)), "i"); | 1842 OS.class_addIvar(cls, "tag", OS.PTR_SIZEOF, cast(byte)(Math.log(OS.PTR_SIZEOF) / Math.log(2)), "i"); |
1857 OS.class_addMethod(cls, OS.sel_tag, proc2, "@:"); | 1843 OS.class_addMethod(cls, OS.sel_tag, proc2, "@:"); |
1858 OS.class_addMethod(cls, OS.sel_setTag_1, proc3, "@:i"); | 1844 OS.class_addMethod(cls, OS.sel_setTag_1, proc3, "@:i"); |
1859 OS.class_addMethod(cls, OS.sel_menuForEvent_1, proc3, "@:@"); | 1845 OS.class_addMethod(cls, OS.sel_menuForEvent_1, proc3, "@:@"); |
1860 OS.class_addMethod(cls, OS.sel_textView_1clickedOnLink_1atIndex_1, proc5, "@:@@i"); | 1846 OS.class_addMethod(cls, OS.sel_textView_1clickedOnLink_1atIndex_1, proc5, "@:@@i"); |
1861 OS.objc_registerClassPair(cls); | 1847 OS.objc_registerClassPair(cls); |
1862 | 1848 |
1863 className = "SWTTextField"; | 1849 className = "SWTTextField"; |
1864 cls = OS.objc_allocateClassPair(OS.classinfo_NSTextField, className, 0); | 1850 cls = OS.objc_allocateClassPair(OS.class_NSTextField, className, 0); |
1865 OS.class_addMethod(cls, OS.sel_drawRect_1, drawRectProc, "@:i"); | 1851 OS.class_addMethod(cls, OS.sel_drawRect_1, drawRectProc, "@:i"); |
1866 OS.objc_registerClassPair(cls); | 1852 OS.objc_registerClassPair(cls); |
1867 | 1853 |
1868 className = "SWTWindow"; | 1854 className = "SWTWindow"; |
1869 cls = OS.objc_allocateClassPair(OS.class_NSWindow, className, 0); | 1855 cls = OS.objc_allocateClassPair(OS.class_NSWindow, className, 0); |
2486 /* Release the System Cursors */ | 2472 /* Release the System Cursors */ |
2487 for (int i = 0; i < cursors.length; i++) { | 2473 for (int i = 0; i < cursors.length; i++) { |
2488 if (cursors [i] !is null) cursors [i].dispose (); | 2474 if (cursors [i] !is null) cursors [i].dispose (); |
2489 } | 2475 } |
2490 cursors = null; | 2476 cursors = null; |
2491 | |
2492 if (windowDelegateCallback2 !is null) windowDelegateCallback2.dispose (); | |
2493 if (windowDelegateCallback3 !is null) windowDelegateCallback3.dispose (); | |
2494 if (windowDelegateCallback4 !is null) windowDelegateCallback4.dispose (); | |
2495 if (windowDelegateCallback5 !is null) windowDelegateCallback5.dispose (); | |
2496 if (windowDelegateCallback6 !is null) windowDelegateCallback6.dispose (); | |
2497 if (dialogCallback3 !is null) dialogCallback3.dispose (); | |
2498 windowDelegateCallback2 = windowDelegateCallback3 = windowDelegateCallback4 = null; | |
2499 windowDelegateCallback6 = windowDelegateCallback5 = null; | |
2500 } | 2477 } |
2501 | 2478 |
2502 /** | 2479 /** |
2503 * Removes the listener from the collection of listeners who will | 2480 * Removes the listener from the collection of listeners who will |
2504 * be notified when an event of the given type occurs anywhere in | 2481 * be notified when an event of the given type occurs anywhere in |
3076 void wakeThread () { | 3053 void wakeThread () { |
3077 NSObject object = (new NSObject()).alloc().init(); | 3054 NSObject object = (new NSObject()).alloc().init(); |
3078 object.performSelectorOnMainThread_withObject_waitUntilDone_(OS.sel_release, null, false); | 3055 object.performSelectorOnMainThread_withObject_waitUntilDone_(OS.sel_release, null, false); |
3079 } | 3056 } |
3080 | 3057 |
3081 int applicationDelegateProc(int ID, String sel, int arg0) { | 3058 extern (C) private static: |
3082 if (sel is OS.sel_applicationWillFinishLaunching_1) { | 3059 |
3060 objc.id applicationDelegateProc(objc.id ID, objc.SEL selector, objc.id arg0) { | |
3061 Display display = Display.findDisplay(Thread.getThis); | |
3062 String sel = fromStringz(selector); | |
3063 with (display) { | |
3064 | |
3065 if (sel == OS.sel_applicationWillFinishLaunching_1) { | |
3083 id dict = NSDictionary.dictionaryWithObject(applicationDelegate, NSString.stringWith("NSOwner")); | 3066 id dict = NSDictionary.dictionaryWithObject(applicationDelegate, NSString.stringWith("NSOwner")); |
3084 NSString nibFile = NSString.stringWith("/System/Library/Frameworks/JavaVM.framework/Resources/English.lproj/DefaultApp.nib"); | 3067 NSString nibFile = NSString.stringWith("/System/Library/Frameworks/JavaVM.framework/Resources/English.lproj/DefaultApp.nib"); |
3085 if (!NSBundle.loadNibFile(nibFile, dict, null)) { | 3068 if (!NSBundle.loadNibFile(nibFile, dict, null)) { |
3086 nibFile = NSString.stringWith("/System/Library/Frameworks/JavaVM.framework/Versions/1.5.0/Resources/English.lproj/DefaultApp.nib"); | 3069 nibFile = NSString.stringWith("/System/Library/Frameworks/JavaVM.framework/Versions/1.5.0/Resources/English.lproj/DefaultApp.nib"); |
3087 NSBundle.loadNibFile(nibFile, dict, null); | 3070 NSBundle.loadNibFile(nibFile, dict, null); |
3096 NSMenuItem ni = new NSMenuItem(ia.objectAtIndex(i)); | 3079 NSMenuItem ni = new NSMenuItem(ia.objectAtIndex(i)); |
3097 NSString title = ni.title().stringByReplacingOccurrencesOfString_withString_(NSString.stringWith("%@"), NSString.stringWith(APP_NAME)); | 3080 NSString title = ni.title().stringByReplacingOccurrencesOfString_withString_(NSString.stringWith("%@"), NSString.stringWith(APP_NAME)); |
3098 ni.setTitle(title); | 3081 ni.setTitle(title); |
3099 } | 3082 } |
3100 } | 3083 } |
3101 } else if (sel is OS.sel_terminate_1) { | 3084 } else if (sel == OS.sel_terminate_1) { |
3102 application.terminate(application); | 3085 application.terminate(application); |
3103 } else if (sel is OS.sel_orderFrontStandardAboutPanel_1) { | 3086 } else if (sel == OS.sel_orderFrontStandardAboutPanel_1) { |
3104 Event event = new Event (); | 3087 Event event = new Event (); |
3105 sendEvent (DWT.ABORT, event); | 3088 sendEvent (DWT.ABORT, event); |
3106 } else if (sel is OS.sel_hideOtherApplications_1) { | 3089 } else if (sel == OS.sel_hideOtherApplications_1) { |
3107 application.hideOtherApplications(application); | 3090 application.hideOtherApplications(application); |
3108 } else if (sel is OS.sel_hide_1) { | 3091 } else if (sel == OS.sel_hide_1) { |
3109 application.hide(application); | 3092 application.hide(application); |
3110 } else if (sel is OS.sel_unhideAllApplications_1) { | 3093 } else if (sel == OS.sel_unhideAllApplications_1) { |
3111 application.unhideAllApplications(application); | 3094 application.unhideAllApplications(application); |
3112 } else if (sel is OS.sel_applicationShouldTerminate_1) { | 3095 } else if (sel == OS.sel_applicationShouldTerminate_1) { |
3113 if (!disposing) { | 3096 if (!disposing) { |
3114 Event event = new Event (); | 3097 Event event = new Event (); |
3115 sendEvent (DWT.Close, event); | 3098 sendEvent (DWT.Close, event); |
3116 if (event.doit) { | 3099 if (event.doit) { |
3117 return OS.NSTerminateNow; | 3100 return cast(objc.id) OS.NSTerminateNow; |
3118 } | 3101 } |
3119 } | 3102 } |
3120 return OS.NSTerminateCancel; | 3103 return cast(objc.id) OS.NSTerminateCancel; |
3121 } else if (sel is OS.sel_applicationWillTerminate_1) { | 3104 } else if (sel == OS.sel_applicationWillTerminate_1) { |
3122 dispose(); | 3105 dispose(); |
3123 } | 3106 } |
3124 return 0; | 3107 return null; |
3125 } | 3108 } |
3126 | 3109 } |
3127 | 3110 |
3128 int dialogProc(int id, String sel, int arg0) { | 3111 |
3112 objc.id dialogProc(objc.id id, objc.SEL selector, objc.id arg0) { | |
3113 String sel = fromStringz(selector); | |
3114 | |
3129 NSIntger jniRef = cast(NSIntger) OS.objc_msgSend(id, OS.sel_tag); | 3115 NSIntger jniRef = cast(NSIntger) OS.objc_msgSend(id, OS.sel_tag); |
3130 if (jniRef is 0 || jniRef is -1) return 0; | 3116 if (jniRef is 0 || jniRef is -1) return 0; |
3131 if (sel == OS.sel_changeColor_1) { | 3117 if (sel == OS.sel_changeColor_1) { |
3132 ColorDialog dialog = cast(ColorDialog)OS.JNIGetObject(jniRef); | 3118 ColorDialog dialog = cast(ColorDialog)OS.JNIGetObject(jniRef); |
3133 if (dialog is null) return 0; | 3119 if (dialog is null) return 0; |
3142 (cast(FontDialog)object).windowWillClose(arg0); | 3128 (cast(FontDialog)object).windowWillClose(arg0); |
3143 } else if (cast(ColorDialog) object) { | 3129 } else if (cast(ColorDialog) object) { |
3144 (cast(ColorDialog)object).windowWillClose(arg0); | 3130 (cast(ColorDialog)object).windowWillClose(arg0); |
3145 } | 3131 } |
3146 } | 3132 } |
3147 return 0; | 3133 return null; |
3148 } | 3134 } |
3149 | 3135 |
3150 int windowDelegateProc(objc.id delegatee, String sel) { | 3136 objc.id windowDelegateProc2(objc.id delegatee, objc.SEL selector) { |
3137 String sel = fromStringz(selector); | |
3138 | |
3151 if (sel == OS.sel_tag) { | 3139 if (sel == OS.sel_tag) { |
3152 int[1] tag; | 3140 NSInteger* tag; |
3153 OS.object_getInstanceVariable(delegatee, "tag", tag); | 3141 OS.object_getInstanceVariable(delegatee, "tag", tag); |
3154 return tag[0]; | 3142 return tag[0]; |
3155 } | 3143 } |
3156 NSInteger jniRef = cast(NSInteger) OS.objc_msgSend(delegatee, OS.sel_tag); | 3144 NSInteger jniRef = cast(NSInteger) OS.objc_msgSend(delegatee, OS.sel_tag); |
3157 if (jniRef is 0 || jniRef is -1) return 0; | 3145 if (jniRef is 0 || jniRef is -1) return null; |
3158 Widget widget = cast(Widget)OS.JNIGetObject(jniRef); | 3146 Widget widget = cast(Widget)OS.JNIGetObject(jniRef); |
3159 if (widget is null) return 0; | 3147 if (widget is null) return null; |
3160 if (sel == OS.sel_isFlipped) { | 3148 if (sel == OS.sel_isFlipped) { |
3161 return widget.isFlipped() ? 1 : 0; | 3149 return widget.isFlipped() ? cast(objc.id) 1 : null; |
3162 } | 3150 } |
3163 if (sel == OS.sel_sendSelection) { | 3151 if (sel == OS.sel_sendSelection) { |
3164 widget.sendSelection(); | 3152 widget.sendSelection(); |
3165 return 0; | 3153 return null; |
3166 } | 3154 } |
3167 if (sel == OS.sel_sendArrowSelection) { | 3155 if (sel == OS.sel_sendArrowSelection) { |
3168 widget.sendArrowSelection(); | 3156 widget.sendArrowSelection(); |
3169 return 0; | 3157 return null; |
3170 } | 3158 } |
3171 if (sel == OS.sel_sendDoubleSelection) { | 3159 if (sel == OS.sel_sendDoubleSelection) { |
3172 widget.sendDoubleSelection(); | 3160 widget.sendDoubleSelection(); |
3173 return 0; | 3161 return null; |
3174 } | 3162 } |
3175 if (sel == OS.sel_sendVerticalSelection) { | 3163 if (sel == OS.sel_sendVerticalSelection) { |
3176 widget.sendVerticalSelection(); | 3164 widget.sendVerticalSelection(); |
3177 return 0; | 3165 return null; |
3178 } | 3166 } |
3179 if (sel == OS.sel_sendHorizontalSelection) { | 3167 if (sel == OS.sel_sendHorizontalSelection) { |
3180 widget.sendHorizontalSelection(); | 3168 widget.sendHorizontalSelection(); |
3181 return 0; | 3169 return null; |
3182 } | 3170 } |
3183 if (sel == OS.sel_acceptsFirstResponder) { | 3171 if (sel == OS.sel_acceptsFirstResponder) { |
3184 return widget.acceptsFirstResponder() ? 1 : 0; | 3172 return widget.acceptsFirstResponder() ? cast(objc.id) 1 : null; |
3185 } | 3173 } |
3186 if (sel == OS.sel_becomeFirstResponder) { | 3174 if (sel == OS.sel_becomeFirstResponder) { |
3187 return widget.becomeFirstResponder() ? 1 : 0; | 3175 return widget.becomeFirstResponder() ? cast(objc.id) 1 : null; |
3188 } | 3176 } |
3189 if (sel == OS.sel_resignFirstResponder) { | 3177 if (sel == OS.sel_resignFirstResponder) { |
3190 return widget.resignFirstResponder() ? 1 : 0; | 3178 return widget.resignFirstResponder() ? cast(objc.id) 1 : null; |
3191 } | 3179 } |
3192 return 0; | 3180 return null; |
3193 } | 3181 } |
3194 | 3182 |
3195 int windowDelegateProc(objc.id ID, int sel, int arg0) { | 3183 objc.id windowDelegateProc3(objc.id ID, objc.SEL selector, objc.id arg0) { |
3184 String sel = fromStringz(selector); | |
3185 | |
3196 if (sel == OS.sel_timerProc_1) { | 3186 if (sel == OS.sel_timerProc_1) { |
3197 return timerProc (arg0); | 3187 return timerProc (arg0); |
3198 } | 3188 } |
3199 if (sel == OS.sel_setTag_1) { | 3189 if (sel == OS.sel_setTag_1) { |
3200 OS.object_setInstanceVariable(id, "tag", arg0); | 3190 OS.object_setInstanceVariable(ID, "tag", cast(NSInteger) arg0); |
3201 return 0; | 3191 return 0; |
3202 } | 3192 } |
3203 int jniRef = OS.objc_msgSend(ID, OS.sel_tag); | 3193 NSInteger jniRef = OS.objc_msgSend(ID, OS.sel_tag); |
3204 if (jniRef is 0 || jniRef is -1) return 0; | 3194 if (jniRef is 0 || jniRef is -1) return 0; |
3205 Widget widget = cast(Widget)OS.JNIGetObject(jniRef); | 3195 Widget widget = cast(Widget)OS.JNIGetObject(jniRef); |
3206 if (widget is null) return 0; | 3196 if (widget is null) return 0; |
3207 if (sel == OS.sel_windowWillClose_1) { | 3197 if (sel == OS.sel_windowWillClose_1) { |
3208 widget.windowWillClose(arg0); | 3198 widget.windowWillClose(arg0); |
3247 } else if (sel == OS.sel_menuNeedsUpdate_1) { | 3237 } else if (sel == OS.sel_menuNeedsUpdate_1) { |
3248 widget.menuNeedsUpdate(arg0); | 3238 widget.menuNeedsUpdate(arg0); |
3249 } else if (sel == OS.sel_outlineViewSelectionDidChange_1) { | 3239 } else if (sel == OS.sel_outlineViewSelectionDidChange_1) { |
3250 widget.outlineViewSelectionDidChange(arg0); | 3240 widget.outlineViewSelectionDidChange(arg0); |
3251 } else if (sel == OS.sel_sendEvent_1) { | 3241 } else if (sel == OS.sel_sendEvent_1) { |
3252 widget.windowSendEvent(id, arg0); | 3242 widget.windowSendEvent(ID, arg0); |
3253 } else if (sel == OS.sel_helpRequested_1) { | 3243 } else if (sel == OS.sel_helpRequested_1) { |
3254 widget.helpRequested(arg0); | 3244 widget.helpRequested(arg0); |
3255 } | 3245 } |
3256 return 0; | 3246 return null; |
3257 } | 3247 } |
3258 | 3248 |
3259 | 3249 |
3260 int windowDelegateProc(objc.id delegatee, String sel, int arg0, int arg1) { | 3250 objc.id windowDelegateProc4(objc.id delegatee, objc.SEL selector, objc.id arg0, objc.id arg1) { |
3251 String sel = fromStringz(selector); | |
3252 | |
3261 NSInteger jniRef = cast(NSInteger) OS.objc_msgSend(delegatee, OS.sel_tag); | 3253 NSInteger jniRef = cast(NSInteger) OS.objc_msgSend(delegatee, OS.sel_tag); |
3262 if (jniRef is 0 || jniRef is -1) return 0; | 3254 if (jniRef is 0 || jniRef is -1) return 0; |
3263 Widget widget = cast(Widget)OS.JNIGetObject(jniRef); | 3255 Widget widget = cast(Widget)OS.JNIGetObject(jniRef); |
3264 if (widget is null) return 0; | 3256 if (widget is null) return 0; |
3265 if (sel == OS.sel_tabView_1willSelectTabViewItem_1) { | 3257 if (sel == OS.sel_tabView_1willSelectTabViewItem_1) { |
3266 widget.willSelectTabViewItem(arg0, arg1); | 3258 widget.willSelectTabViewItem(arg0, arg1); |
3267 } else if (sel == OS.sel_outlineView_1isItemExpandable_1) { | 3259 } else if (sel == OS.sel_outlineView_1isItemExpandable_1) { |
3268 return widget.outlineView_isItemExpandable(arg0, arg1) ? 1 : 0; | 3260 return widget.outlineView_isItemExpandable(arg0, arg1) ? cast(objc.id) 1 : null; |
3269 } else if (sel == OS.sel_outlineView_1numberOfChildrenOfItem_1) { | 3261 } else if (sel == OS.sel_outlineView_1numberOfChildrenOfItem_1) { |
3270 return widget.outlineView_numberOfChildrenOfItem(arg0, arg1); | 3262 return widget.outlineView_numberOfChildrenOfItem(arg0, arg1); |
3271 } else if (sel == OS.sel_outlineView_1shouldCollapseItem_1) { | 3263 } else if (sel == OS.sel_outlineView_1shouldCollapseItem_1) { |
3272 return widget.outlineView_shouldCollapseItem(arg0, arg1) ? 1 : 0; | 3264 return widget.outlineView_shouldCollapseItem(arg0, arg1) ? cast(objc.id) 1 : null; |
3273 } else if (sel == OS.sel_outlineView_1shouldExpandItem_1) { | 3265 } else if (sel == OS.sel_outlineView_1shouldExpandItem_1) { |
3274 return widget.outlineView_shouldExpandItem(arg0, arg1) ? 1 : 0; | 3266 return widget.outlineView_shouldExpandItem(arg0, arg1) ? cast(objc.id) 1 : null; |
3275 } else if (sel == OS.sel_menu_1willHighlightItem_1) { | 3267 } else if (sel == OS.sel_menu_1willHighlightItem_1) { |
3276 widget.menu_willHighlightItem(arg0, arg1); | 3268 widget.menu_willHighlightItem(arg0, arg1); |
3277 } | 3269 } |
3278 return 0; | 3270 return null; |
3279 } | 3271 } |
3280 | 3272 |
3281 int windowDelegateProc(objc.id delegatee, int sel, int arg0, int arg1, int arg2) { | 3273 objc.id windowDelegateProc5(objc.id delegatee, objc.SEL selector, objc.id arg0, objc.id arg1, objc.id arg2) { |
3274 String sel = fromStringz(selector); | |
3275 | |
3282 NSInteger jniRef = cast(NSInteger) OS.objc_msgSend(delegatee, OS.sel_tag); | 3276 NSInteger jniRef = cast(NSInteger) OS.objc_msgSend(delegatee, OS.sel_tag); |
3283 if (jniRef is 0 || jniRef is -1) return 0; | 3277 if (jniRef is 0 || jniRef is -1) return 0; |
3284 Widget widget = cast(Widget)OS.JNIGetObject(jniRef); | 3278 Widget widget = cast(Widget)OS.JNIGetObject(jniRef); |
3285 if (widget is null) return 0; | 3279 if (widget is null) return 0; |
3286 if (sel == OS.sel_tableView_1objectValueForTableColumn_1row_1) { | 3280 if (sel == OS.sel_tableView_1objectValueForTableColumn_1row_1) { |
3287 return widget.tableView_objectValueForTableColumn_row(arg0, arg1, arg2); | 3281 return widget.tableView_objectValueForTableColumn_row(arg0, arg1, cast(NSInteger) arg2); |
3288 } | 3282 } |
3289 if (sel == OS.sel_tableView_1shouldEditTableColumn_1row_1) { | 3283 if (sel == OS.sel_tableView_1shouldEditTableColumn_1row_1) { |
3290 return widget.tableView_shouldEditTableColumn_row(arg0, arg1, arg2) ? 1 : 0; | 3284 return widget.tableView_shouldEditTableColumn_row(arg0, arg1, cast(NSInteger) arg2) ? cast(objc.id) 1 : null; |
3291 } else if (sel == OS.sel_textView_1clickedOnLink_1atIndex_1) { | 3285 } else if (sel == OS.sel_textView_1clickedOnLink_1atIndex_1) { |
3292 return widget.clickOnLink(arg0, arg1, arg2) ? 1 : 0; | 3286 return widget.clickOnLink(arg0, arg1, cast(NSUInteger) arg2) ? cast(objc.id) 1 : null; |
3293 } else if (sel == OS.sel_outlineView_1child_1ofItem_1) { | 3287 } else if (sel == OS.sel_outlineView_1child_1ofItem_1) { |
3294 return widget.outlineView_child_ofItem(arg0, arg1, arg2); | 3288 return widget.outlineView_child_ofItem(arg0, arg1, cast(NSInteger) arg2); |
3295 } else if (sel == OS.sel_outlineView_1objectValueForTableColumn_1byItem_1) { | 3289 } else if (sel == OS.sel_outlineView_1objectValueForTableColumn_1byItem_1) { |
3296 return widget.outlineView_objectValueForTableColumn_byItem(arg0, arg1, arg2); | 3290 return widget.outlineView_objectValueForTableColumn_byItem(arg0, arg1, arg2); |
3297 } | 3291 } |
3298 return 0; | 3292 return null; |
3299 } | 3293 } |
3300 | 3294 |
3301 int windowDelegateProc(objc.id delegatee, int sel, int arg0, int arg1, int arg2, int arg3) { | 3295 objc.id windowDelegateProc6(objc.id delegatee, int sel, int arg0, int arg1, int arg2, int arg3) { |
3296 String sel = fromStringz(selector); | |
3297 | |
3302 NSInteger jniRef = cast(NSInteger) OS.objc_msgSend(delegatee, OS.sel_tag); | 3298 NSInteger jniRef = cast(NSInteger) OS.objc_msgSend(delegatee, OS.sel_tag); |
3303 if (jniRef is 0 || jniRef is -1) return 0; | 3299 if (jniRef is 0 || jniRef is -1) return 0; |
3304 Widget widget = cast(Widget)OS.JNIGetObject(jniRef); | 3300 Widget widget = cast(Widget)OS.JNIGetObject(jniRef); |
3305 if (widget is null) return 0; | 3301 if (widget is null) return 0; |
3306 if (sel == OS.sel_tableView_1willDisplayCell_1forTableColumn_1row_1) { | 3302 if (sel == OS.sel_tableView_1willDisplayCell_1forTableColumn_1row_1) { |
3307 widget.tableView_willDisplayCell_forTableColumn_row(arg0, arg1, arg2, arg3); | 3303 widget.tableView_willDisplayCell_forTableColumn_row(arg0, arg1, arg2, cast(NSInteger) arg3); |
3308 } else if (sel == OS.sel_outlineView_1willDisplayCell_1forTableColumn_1item_1) { | 3304 } else if (sel == OS.sel_outlineView_1willDisplayCell_1forTableColumn_1item_1) { |
3309 widget.outlineView_willDisplayCell_forTableColumn_item(arg0, arg1, arg2, arg3); | 3305 widget.outlineView_willDisplayCell_forTableColumn_item(arg0, arg1, arg2, arg3); |
3310 } else if (sel == OS.sel_outlineView_1setObjectValue_1forTableColumn_1byItem_1) { | 3306 } else if (sel == OS.sel_outlineView_1setObjectValue_1forTableColumn_1byItem_1) { |
3311 widget.outlineView_setObjectValue_forTableColumn_byItem(arg0, arg1, arg2, arg3); | 3307 widget.outlineView_setObjectValue_forTableColumn_byItem(arg0, arg1, arg2, arg3); |
3312 } else if (sel == OS.sel_tableView_1setObjectValue_1forTableColumn_1row_1) { | 3308 } else if (sel == OS.sel_tableView_1setObjectValue_1forTableColumn_1row_1) { |
3313 widget.tableView_setObjectValue_forTableColumn_row(arg0, arg1, arg2, arg3); | 3309 widget.tableView_setObjectValue_forTableColumn_row(arg0, arg1, arg2, cast(NSInteger) arg3); |
3314 } | 3310 } |
3315 return 0; | 3311 return null; |
3316 } | 3312 } |
3317 } | 3313 } |