120 lines
2.8 KiB
C++
120 lines
2.8 KiB
C++
//## begin module.cm preserve=no
|
|
|
|
// %X% %Q% %Z% %W%
|
|
|
|
//## end module.cm
|
|
|
|
|
|
|
|
//## begin module.cp preserve=no
|
|
|
|
//## end module.cp
|
|
|
|
|
|
|
|
//## Module: Window; Pseudo Package body
|
|
|
|
//## Subsystem: lab7
|
|
|
|
//## Source file: H:\kurs\avC++\lab7\Window.cpp
|
|
|
|
|
|
|
|
//## begin module.additionalIncludes preserve=no
|
|
|
|
//## end module.additionalIncludes
|
|
|
|
|
|
|
|
//## begin module.includes preserve=yes
|
|
|
|
#include <iostream.h>
|
|
|
|
//## end module.includes
|
|
|
|
|
|
|
|
// Window
|
|
|
|
#include "Window.h"
|
|
|
|
//## begin module.additionalDeclarations preserve=yes
|
|
|
|
#include <string.h>
|
|
|
|
//## end module.additionalDeclarations
|
|
|
|
|
|
|
|
|
|
|
|
// Class Window
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
Window::Window()
|
|
|
|
//## begin Window::Window%.hasinit preserve=no
|
|
|
|
//## end Window::Window%.hasinit
|
|
|
|
//## begin Window::Window%.initialization preserve=yes
|
|
|
|
//## end Window::Window%.initialization
|
|
|
|
{
|
|
|
|
//## begin Window::Window%.body preserve=yes
|
|
|
|
//## end Window::Window%.body
|
|
|
|
}
|
|
|
|
|
|
|
|
Window::Window (int xpos, int ypos, int width, int height, char* name)
|
|
|
|
//## begin Window::Window%940854119.hasinit preserve=no
|
|
|
|
//## end Window::Window%940854119.hasinit
|
|
|
|
//## begin Window::Window%940854119.initialization preserve=yes
|
|
|
|
//## end Window::Window%940854119.initialization
|
|
|
|
{
|
|
|
|
//## begin Window::Window%940854119.body preserve=yes
|
|
|
|
|
|
|
|
Window::xpos = xpos;
|
|
|
|
Window::ypos = ypos;
|
|
|
|
Window::width = width;
|
|
|
|
Window::height = height;
|
|
|
|
//strcpy(Window::name, name);
|
|
|
|
Window::name = name;
|
|
|
|
|
|
|
|
panel = new Panel(xpos,ypos,width,height);
|
|
|
|
panel->setPpp((Panel*) 0);
|
|
|
|
//## end Window::Window%940854119.body
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
Window::~Window()
|
|
|
|
{
|
|
|
|
//## begin Window::~Window%.body preserve=yes
|
|
|
|
delete panel;
|
|
|
|
//## end Window::~Window%.body
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
//## Other Operations (implementation)
|
|
|
|
void Window::draw (Graphics& g)
|
|
|
|
{
|
|
|
|
//## begin Window::draw%940929792.body preserve=yes
|
|
|
|
g.drawWindow(xpos,ypos,width,height,name);
|
|
|
|
panel->draw(g);
|
|
|
|
//## end Window::draw%940929792.body
|
|
|
|
}
|
|
|
|
|
|
|
|
void Window::add (Component* c)
|
|
|
|
{
|
|
|
|
//## begin Window::add%940943118.body preserve=yes
|
|
|
|
panel->add(c);
|
|
|
|
//## end Window::add%940943118.body
|
|
|
|
}
|
|
|
|
|
|
|
|
bool Window::isHit (int x, int y)
|
|
|
|
{
|
|
|
|
//## begin Window::isHit%941013988.body preserve=yes
|
|
|
|
return panel->isHit(x,y);
|
|
|
|
//## end Window::isHit%941013988.body
|
|
|
|
}
|
|
|
|
|
|
|
|
void Window::handleKeyEvent (Event e)
|
|
|
|
{
|
|
|
|
//## begin Window::handleKeyEvent%941013989.body preserve=yes
|
|
|
|
|
|
|
|
//## end Window::handleKeyEvent%941013989.body
|
|
|
|
}
|
|
|
|
|
|
|
|
void Window::handleMouseEvent (Event e)
|
|
|
|
{
|
|
|
|
//## begin Window::handleMouseEvent%941013990.body preserve=yes
|
|
|
|
panel->handleMouseEvent(e);
|
|
|
|
|
|
|
|
//## end Window::handleMouseEvent%941013990.body
|
|
|
|
}
|
|
|
|
|
|
|
|
// Additional Declarations
|
|
|
|
//## begin Window.declarations preserve=yes
|
|
|
|
//## end Window.declarations
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
//## begin module.epilog preserve=yes
|
|
|
|
//## end module.epilog
|
|
|