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

Create successful ePaper yourself

Turn your PDF publications into a flip-book with our unique Google optimized e-Paper software.

A Text user <strong>in</strong>terface 313<br />

Note:<br />

The reason for this structure is to allow <strong>in</strong>itialization code for any declared w<strong>in</strong>dows to be run after the<br />

w<strong>in</strong>dow system has been <strong>in</strong>itiated by the procedure W<strong>in</strong>dow_Prolog and to allow any f<strong>in</strong>alization<br />

code for the elaborated w<strong>in</strong>dows to be executed before the procedure W<strong>in</strong>dow_Epilog is called.<br />

To avoid simultaneous access to a w<strong>in</strong>dow, program <strong>in</strong>itialization of a w<strong>in</strong>dow must occur before the<br />

user is allowed to <strong>in</strong>teract with the system.<br />

22.2.2 W<strong>in</strong>dow API calls<br />

A text w<strong>in</strong>dow is created with a declaration of the form:<br />

W<strong>in</strong> : W<strong>in</strong>dow;<br />

A text w<strong>in</strong>dow can be created and written to us<strong>in</strong>g the follow<strong>in</strong>g API calls:<br />

Notes Function / procedure<br />

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

ABS_X_CRD, ABS_Y_CRD: POSITIVE;<br />

Max_X_Crd, Max_Y_Crd: Positive;<br />

Cb:<strong>in</strong> P_Cbf := null );<br />

2 procedure Put( The:<strong>in</strong> out W<strong>in</strong>dow; Mes:<strong>in</strong> Str<strong>in</strong>g );<br />

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

2 procedure Put( The:<strong>in</strong> out W<strong>in</strong>dow; N:<strong>in</strong> Integer );<br />

3 Procedure Position( The:<strong>in</strong> out W<strong>in</strong>dow;X,Y:<strong>in</strong> Positive );<br />

4 procedure Clear( The:<strong>in</strong> out W<strong>in</strong>dow );<br />

5 procedure New_L<strong>in</strong>e( The:<strong>in</strong> out W<strong>in</strong>dow );<br />

6 procedure Make_W<strong>in</strong>dow( The:<strong>in</strong> out W<strong>in</strong>dow; Mo:<strong>in</strong> Mode );<br />

Notes:<br />

1 Sets the absolute position and size of the w<strong>in</strong>dow on the screen.<br />

The top left hand corner position is at: (abs_x_crd, abs_y_crd)<br />

The bottom right hand corner position is at:<br />

(abs_x_crd+max_x_crd-1, abs_y_crd+max_y_crd-1)<br />

2 Displays <strong>in</strong>formation <strong>in</strong> a w<strong>in</strong>dow. These functions are modelled after the procedures <strong>in</strong><br />

<strong>Ada</strong>.Text_Io.<br />

3 Sets the current output position <strong>in</strong> the w<strong>in</strong>dow.<br />

4 Clears the w<strong>in</strong>dow to all spaces.<br />

5 Writes a newl<strong>in</strong>e to the w<strong>in</strong>dow. This will cause the <strong>in</strong>formation <strong>in</strong> the w<strong>in</strong>dow to scroll up if the<br />

current position is at the last l<strong>in</strong>e of the w<strong>in</strong>dow.<br />

6 Makes the displayed w<strong>in</strong>dow visible or <strong>in</strong>visible.<br />

22.2.3 Dialog API calls<br />

A dialog w<strong>in</strong>dow is created with a declaration of the form:<br />

Diag : Dialog;<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!