View classes that derive from TDocumentComponentView send menu actions to the document component's presenter. Because TTilesView derives from TDocumentComponentView, this means that actions generated by the Tiles menu are handled by the TTilesPresenter class. TTilesPresenter, through its parent class TGUIPresenter, already derives from the class that defines the protocol for handling menu actions, MMenuActionHandler:
To handle an action, the Tiles presenter:
|
Action | Command |
|
"RedAction" |
TChangeColorCommand constructed with the color red (TRGBColor( 1,0,0 )) |
|
"GreenAction" |
TChangeColorCommand constructed with the color green (TRGBColor( 0,1,0 )) |
|
"BlueAction" |
TChangeColorCommand constructed with the color blue (TRGBColor( 0,0,1 )) |
|
"RockAction" |
TCreateTileCommand constructed to create a tile of type kRock at the position TGPoint( 10,10 ) |
|
"PaperAction" |
TCreateTileCommand constructed to create a tile of type kPaper at the position TGPoint( 70,10 ) |
|
"ScissorsAction" |
TCreateTileCommand constructed to create a tile of type kScissors at the position TGPoint( 130,10 ) |