📄 adapter.c
字号:
/**/#include "Geom.H"// Compilation Instructions// With ClassAdapter defined and not defined#define ClassAdapter 0/**/class Manipulator;/**/class Shape {public: Shape(); virtual void BoundingBox( Point& bottomLeft, Point& topRight ) const; virtual Manipulator* CreateManipulator() const;};/**/class TextView {public: TextView(); void GetOrigin(Coord& x, Coord& y) const; void GetExtent(Coord& width, Coord& height) const; virtual bool IsEmpty() const;};/**/#ifdef ClassAdapter/**/class TextShape : public Shape, private TextView {public: TextShape(); virtual void BoundingBox( Point& bottomLeft, Point& topRight ) const; virtual bool IsEmpty() const; virtual Manipulator* CreateManipulator() const;};/**/void TextShape::BoundingBox ( Point& bottomLeft, Point& topRight) const { Coord bottom, left, width, height; GetOrigin(bottom, left); GetExtent(width, height);/**/ bottomLeft = Point(bottom, left); topRight = Point(bottom + height, left + width);}/**/bool TextShape::IsEmpty () const { return TextView::IsEmpty();}/**/class Manipulator {};class TextManipulator : public Manipulator { public: TextManipulator(const TextShape*);};/**/Manipulator* TextShape::CreateManipulator () const { return new TextManipulator(this);}/**/#endif#ifndef ClassAdapterclass TextView;class Manipulator {};class TextManipulator : public Manipulator { public: TextManipulator();};/**/class TextShape : public Shape {public: TextShape(TextView*); virtual void BoundingBox( Point& bottomLeft, Point& topRight ) const; virtual bool IsEmpty() const; virtual Manipulator* CreateManipulator() const;private: TextView* _text;};/**/TextShape::TextShape (TextView* t) { _text = t;}/**/void TextShape::BoundingBox ( Point& bottomLeft, Point& topRight) const { Coord bottom, left, width, height; _text->GetOrigin(bottom, left); _text->GetExtent(width, height); bottomLeft = Point(bottom, left); topRight = Point(bottom + height, left + width);}/**/bool TextShape::IsEmpty () const { return _text->IsEmpty();}/**/Manipulator* TextShape::CreateManipulator () const { return new TextManipulator(this);}/**/#endif/**/
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -