161 lines
3.9 KiB
C++
161 lines
3.9 KiB
C++
//## begin module.cm preserve=no
|
|
|
|
// %X% %Q% %Z% %W%
|
|
|
|
//## end module.cm
|
|
|
|
|
|
|
|
//## begin module.cp preserve=no
|
|
|
|
//## end module.cp
|
|
|
|
|
|
|
|
//## Module: Button; Pseudo Package specification
|
|
|
|
//## Subsystem: lab7
|
|
|
|
//## Source file: H:\kurs\avC++\lab7\Button.h
|
|
|
|
|
|
|
|
#ifndef Button_h
|
|
|
|
#define Button_h 1
|
|
|
|
|
|
|
|
//## begin module.additionalIncludes preserve=no
|
|
|
|
//## end module.additionalIncludes
|
|
|
|
|
|
|
|
//## begin module.includes preserve=yes
|
|
|
|
//## end module.includes
|
|
|
|
|
|
|
|
// Component
|
|
|
|
#include "Compnent.h"
|
|
|
|
// Panel
|
|
|
|
#include "Panel.h"
|
|
|
|
// BH
|
|
|
|
#include "BttnHndl.h"
|
|
|
|
//## begin module.additionalDeclarations preserve=yes
|
|
|
|
//## end module.additionalDeclarations
|
|
|
|
|
|
|
|
|
|
|
|
//## Class: Button
|
|
|
|
//## Category: lab7
|
|
|
|
//## Subsystem: lab7
|
|
|
|
//## Persistence: Transient
|
|
|
|
//## Cardinality/Multiplicity: n
|
|
|
|
|
|
|
|
//## Uses: <unnamed>; Panel { -> }
|
|
|
|
|
|
|
|
class Button : public Component //## Inherits: <unnamed>
|
|
|
|
{
|
|
|
|
//## begin Button.initialDeclarations preserve=yes
|
|
|
|
//## end Button.initialDeclarations
|
|
|
|
|
|
|
|
public:
|
|
|
|
//## Constructors (generated)
|
|
|
|
Button();
|
|
|
|
|
|
|
|
//## Constructors (specified)
|
|
|
|
//## Operation: Button%940854117
|
|
|
|
Button (int xpos, int ypos, int width, int height, char* text);
|
|
|
|
|
|
|
|
//## Destructor (generated)
|
|
|
|
~Button();
|
|
|
|
|
|
|
|
|
|
|
|
//## Other Operations (specified)
|
|
|
|
//## Operation: handleMouseEvent%940929796
|
|
|
|
void handleMouseEvent (Event e);
|
|
|
|
|
|
|
|
//## Operation: draw%940929797
|
|
|
|
void draw (Graphics& g);
|
|
|
|
|
|
|
|
//## Operation: handleKeyEvent%941013995
|
|
|
|
void handleKeyEvent (Event e);
|
|
|
|
|
|
|
|
//## Operation: isHit%941013997
|
|
|
|
bool isHit (int x, int y);
|
|
|
|
|
|
|
|
//## Operation: setAction%941013999
|
|
|
|
void setAction (BH* bh);
|
|
|
|
|
|
|
|
// Additional Public Declarations
|
|
|
|
//## begin Button.public preserve=yes
|
|
|
|
//## end Button.public
|
|
|
|
|
|
|
|
protected:
|
|
|
|
// Additional Protected Declarations
|
|
|
|
//## begin Button.protected preserve=yes
|
|
|
|
//## end Button.protected
|
|
|
|
|
|
|
|
private:
|
|
|
|
//## Get and Set Operations for Has Relationships (generated)
|
|
|
|
|
|
|
|
//## Documentation Button::<the_BH>.has
|
|
|
|
const BH * get_the_BH () const;
|
|
|
|
void set_the_BH (BH * value);
|
|
|
|
|
|
|
|
//## Get and Set Operations for Class Attributes (generated)
|
|
|
|
|
|
|
|
//## Attribute: text
|
|
|
|
const char* get_text () const;
|
|
|
|
void set_text (char* value);
|
|
|
|
|
|
|
|
// Additional Private Declarations
|
|
|
|
//## begin Button.private preserve=yes
|
|
|
|
//## end Button.private
|
|
|
|
|
|
|
|
private: //## implementation
|
|
|
|
// Data Members for Has Relationships
|
|
|
|
|
|
|
|
//## begin Button::<the_BH>.has preserve=no private: BH {1 -> 1RO}
|
|
|
|
BH *the_BH;
|
|
|
|
//## end Button::<the_BH>.has
|
|
|
|
|
|
|
|
// Data Members for Class Attributes
|
|
|
|
|
|
|
|
//## begin Button::text.attr preserve=no private: char* {U}
|
|
|
|
char* text;
|
|
|
|
//## end Button::text.attr
|
|
|
|
|
|
|
|
// Additional Implementation Declarations
|
|
|
|
//## begin Button.implementation preserve=yes
|
|
|
|
//## end Button.implementation
|
|
|
|
|
|
|
|
};
|
|
|
|
|
|
|
|
//## begin Button.postscript preserve=yes
|
|
|
|
//## end Button.postscript
|
|
|
|
|
|
|
|
// Class Button
|
|
|
|
|
|
|
|
//## Get and Set Operations for Has Relationships (inline)
|
|
|
|
|
|
|
|
inline const BH * Button::get_the_BH () const
|
|
|
|
{
|
|
|
|
//## begin Button::get_the_BH%.get preserve=no
|
|
|
|
return the_BH;
|
|
|
|
//## end Button::get_the_BH%.get
|
|
|
|
}
|
|
|
|
|
|
|
|
inline void Button::set_the_BH (BH * value)
|
|
|
|
{
|
|
|
|
//## begin Button::set_the_BH%.set preserve=no
|
|
|
|
the_BH = value;
|
|
|
|
//## end Button::set_the_BH%.set
|
|
|
|
}
|
|
|
|
|
|
|
|
//## Get and Set Operations for Class Attributes (inline)
|
|
|
|
|
|
|
|
inline const char* Button::get_text () const
|
|
|
|
{
|
|
|
|
//## begin Button::get_text%.get preserve=no
|
|
|
|
return text;
|
|
|
|
//## end Button::get_text%.get
|
|
|
|
}
|
|
|
|
|
|
|
|
inline void Button::set_text (char* value)
|
|
|
|
{
|
|
|
|
//## begin Button::set_text%.set preserve=no
|
|
|
|
text = value;
|
|
|
|
//## end Button::set_text%.set
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
//## begin module.epilog preserve=yes
|
|
|
|
//## end module.epilog
|
|
|
|
|
|
|
|
|
|
|
|
#endif
|
|
|