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.

348 TUI the implementation<br />

procedure Send_To( The:<strong>in</strong> out W<strong>in</strong>dow; Ch:<strong>in</strong> Character ) is<br />

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

null;<br />

end Send_To;<br />

The w<strong>in</strong>dow is registered with the <strong>in</strong>put manager by the procedure register and de-registered with<br />

De_Register.<br />

procedure Register( P_W:<strong>in</strong> P_Root_W<strong>in</strong>dow;<br />

Ch:<strong>in</strong> Character ) is<br />

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

Switch_Away_From_Top; --Register w<strong>in</strong>dow focus<br />

Add_To_List( P_W, Ch ); --Register w<strong>in</strong>dow<br />

Switch_To_Top; --Make focus<br />

end Register;<br />

procedure De_Register( P_W:<strong>in</strong> P_Root_W<strong>in</strong>dow ) is<br />

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

Top( P_W );<br />

--Make top<br />

Switch_Away_From_Top; -- prepare for demise<br />

Remove_From_List( P_W ); --De register w<strong>in</strong>dow<br />

Switch_To_Top; --Make focus<br />

end De_Register;<br />

The next procedure is used <strong>in</strong>ternally by the class to write directly to a position <strong>in</strong> a w<strong>in</strong>dow on the screen.<br />

This procedure uses Write_To <strong>in</strong> the class W<strong>in</strong>dow_Control to perform the actual write.<br />

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

X,Y:<strong>in</strong> Positive; Mes:<strong>in</strong> Str<strong>in</strong>g ) is<br />

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

Write_To( The'Unchecked_Access, X, Y, Mes );<br />

end Put;<br />

end Class_W<strong>in</strong>dow;<br />

23.7 The class Dialog<br />

A normal w<strong>in</strong>dow is specialized to a dialog w<strong>in</strong>dow by overload<strong>in</strong>g the follow<strong>in</strong>g w<strong>in</strong>dows methods with new<br />

responsibilities:<br />

Method<br />

Framework<br />

Send_To<br />

Responsibility<br />

Set up the w<strong>in</strong>dow as a dialog box.<br />

Process user <strong>in</strong>put sent to the dialog w<strong>in</strong>dow.<br />

The <strong>Ada</strong> specification for the class Dialog is as follows:<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!