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 335<br />

with <strong>Ada</strong>.F<strong>in</strong>alization;<br />

use <strong>Ada</strong>.F<strong>in</strong>alization;<br />

package Class_Root_W<strong>in</strong>dow is<br />

type Root_W<strong>in</strong>dow is abstract tagged limited private;<br />

type P_Root_W<strong>in</strong>dow is access all Root_W<strong>in</strong>dow'Class;<br />

type Attribute is ( Top, Bottom, Left, Right, Abs_X, Abs_Y );<br />

procedure Send_To( The:<strong>in</strong> out Root_W<strong>in</strong>dow;<br />

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

procedure Switch_To( The:<strong>in</strong> out Root_W<strong>in</strong>dow ) is abstract;<br />

procedure Switch_Away( The:<strong>in</strong> out Root_W<strong>in</strong>dow ) is abstract;<br />

function About( The:<strong>in</strong> Root_W<strong>in</strong>dow;<br />

B:<strong>in</strong> Attribute) return Natural is abstract;<br />

private<br />

type Root_W<strong>in</strong>dow is<br />

abstract new Limited_Controlled with null record;<br />

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

23.4 The classes Input_manager and W<strong>in</strong>dow_control<br />

23.4.1 Specification of the class Input_manager<br />

The <strong>in</strong>put manager controls all <strong>in</strong>teractions between a user and the displayed w<strong>in</strong>dows. Currently the only <strong>in</strong>put<br />

device is the keyboard. The responsibilities of the <strong>in</strong>put manager are:<br />

Method<br />

W<strong>in</strong>dow_Prolog<br />

W<strong>in</strong>dow_Start<br />

W<strong>in</strong>dow_Epilog<br />

Responsibility<br />

Set up the <strong>in</strong>itial w<strong>in</strong>dow environment.<br />

Start the w<strong>in</strong>dow<strong>in</strong>g system by accept<strong>in</strong>g <strong>in</strong>put<br />

from a user of the TUI.<br />

Close down the w<strong>in</strong>dow<strong>in</strong>g system.<br />

The <strong>Ada</strong> specification for the class Input_manager is:<br />

with <strong>Ada</strong>.F<strong>in</strong>alization;<br />

use <strong>Ada</strong>.F<strong>in</strong>alization;<br />

package Class_Input_Manager is<br />

type Input_Manager is abstract tagged limited private;<br />

procedure W<strong>in</strong>dow_Prologue; --Initialize w<strong>in</strong>dow system<br />

procedure W<strong>in</strong>dow_Start; --Start tak<strong>in</strong>g user <strong>in</strong>put<br />

procedure W<strong>in</strong>dow_Epilogue; --Clean up<br />

private<br />

type Input_Manager is<br />

abstract new Limited_Controlled with null record;<br />

end Class_Input_Manager;<br />

Note:<br />

As there is only one screen the class Input_Manager has all class methods.<br />

23.4.2 Specification of the class W<strong>in</strong>dow_control<br />

The class W<strong>in</strong>dow_Control has overall control of the w<strong>in</strong>dows displayed on the TUI screen. The<br />

responsibilities of this class are:<br />

Method<br />

Add_To_List<br />

Remove_From_List<br />

Responsibility<br />

Add a new w<strong>in</strong>dow to the list of managed<br />

w<strong>in</strong>dows.<br />

Remove a w<strong>in</strong>dow from the list of managed<br />

w<strong>in</strong>dows.<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!