18.10.2014 Views

Object-oriented Software in Ada 95

Object-oriented Software in Ada 95

Object-oriented Software in Ada 95

SHOW MORE
SHOW LESS

You also want an ePaper? Increase the reach of your titles

YUMPU automatically turns print PDFs into web optimized ePapers that Google loves.

TUI the implementation 347<br />

procedure Mark_Border( The:<strong>in</strong> out W<strong>in</strong>dow;<br />

A_Border:<strong>in</strong> Attribute;<br />

Pos:<strong>in</strong> Positive; Ch:<strong>in</strong> Character ) is<br />

A_Y, A_X : Positive;<br />

beg<strong>in</strong><br />

case A_Border is<br />

when Top => A_X := Pos; A_Y := 1;<br />

when Bottom => A_X := Pos; A_Y := The.Max_Y+2;<br />

when Left => A_X := 1; A_Y := Pos;<br />

when Right => A_X := The.Max_X+2; A_Y := Pos;<br />

when others => null;<br />

end case;<br />

if A_X return The.Max_Y+2;<br />

when Abs_X => return The.Abs_X;<br />

when Abs_Y => return The.Abs_Y;<br />

when others => return 0;<br />

end case;<br />

end;<br />

Whilst publicly visible, the follow<strong>in</strong>g procedures are not <strong>in</strong>tended to be used by an application programmer. These<br />

procedures are used by the event loop to allow a w<strong>in</strong>dow to:<br />

• Clean up before the focus of user <strong>in</strong>put is removed from the w<strong>in</strong>dow.<br />

• Prepare for the focus of user <strong>in</strong>put to be directed at the w<strong>in</strong>dow.<br />

The effect of these procedures is to mark the w<strong>in</strong>dow with a visual <strong>in</strong>dicator of its state.<br />

procedure Switch_Away( The:<strong>in</strong> out W<strong>in</strong>dow ) is<br />

beg<strong>in</strong><br />

Mark_Border( The, Top, 1, C_W<strong>in</strong>_Pas );<br />

end Switch_Away;<br />

procedure Switch_To( The:<strong>in</strong> out W<strong>in</strong>dow ) is<br />

beg<strong>in</strong><br />

Mark_Border( The, Top, 1, C_W<strong>in</strong>_A );<br />

end Switch_To;<br />

When a user types a character which is not recognized by the system as a switch character it is sent to the<br />

w<strong>in</strong>dow which has the focus for <strong>in</strong>put. The procedure Send_To receives this character. The procedure is simply<br />

null, because an <strong>in</strong>stance of a W<strong>in</strong>dow does not process user <strong>in</strong>put.<br />

© M A Smith - May not be reproduced without permission

Hooray! Your file is uploaded and ready to be published.

Saved successfully!

Ooh no, something went wrong!