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
|
<?xml version="1.0"?>
<!DOCTYPE gsmarkup>
<gsmarkup>
<objects>
<!-- the main window -->
<window title="Calculator" closable="no">
<vbox>
<textField editable="no" id="TextField" />
<vbox halign="expand">
<hbox halign="expand">
<hspace />
<button width="36" height="24" title="1" target="#Controller" action="digit:" />
<hspace />
<button width="36" height="24" title="2" target="#Controller" action="digit:" />
<hspace />
<button width="36" height="24" title="3" target="#Controller" action="digit:" />
<hspace />
<button width="36" height="24" title="4" target="#Controller" action="digit:" />
<hspace />
</hbox>
<hbox>
<hspace />
<button width="36" height="24" title="5" target="#Controller" action="digit:" />
<hspace />
<button width="36" height="24" title="6" target="#Controller" action="digit:" />
<hspace />
<button width="36" height="24" title="7" target="#Controller" action="digit:" />
<hspace />
<button width="36" height="24" title="8" target="#Controller" action="digit:" />
<hspace />
</hbox>
<hbox>
<hspace />
<button width="36" height="24" title="9" target="#Controller" action="digit:" />
<hspace />
<button width="36" height="24" title="0" target="#Controller" action="digit:" />
<hspace />
<button width="36" height="24" title="+" target="#Controller" action="add:" />
<hspace />
<button width="36" height="24" title="=" target="#Controller" action="total:" />
<hspace />
</hbox>
</vbox>
</vbox>
</window>
<!-- an object of a custom class, which is instantiated when the nib
is loaded. Key-value coding is used to set textField to #TextField.
In other words, the textField attribute is equivalent to having a
NSNibOutletConnector with source #Controller, target #TextField,
and key textField -->
<instance instanceOf="CalculatorController" id="Controller"
textField="#TextField" />
</objects>
<!-- in this example, connectors are not actually needed (or better
all connectors are embedded in the objects section) - but we add
the connectors section as an example. -->
<connectors>
<!-- an example of a standalone connector, needed to connect the Controller
to the controller ivar (or setController: method) of the NSOwner (the
object which loaded the nib). This connector must be standalone
because #NSOwner is not inside the nib. (you can reference objects
totally outside the nib in a connector, which are provided by the
nameTable dictionary when the nib is loaded) -->
<outlet source="#NSOwner" target="#Controller" key="controller" />
</connectors>
</gsmarkup>
|