📄 c19---+
字号:
// 适配器例
class Shape
{
public:
Shape();
virtual void BoundingBox(Point& bl,Point& tr) const;
};
class TextView
{
public:
Textview();
void GetOrigin(int& x,int& y) const;
void GetExtent(int& w,int& h) const;
virtual bool IsEmpty() const;
};
//类适配器
class TextShape:public Shape,private TextView
{
pbuolic:
TextShape();
virtual void BoundingBox(Point& bl,Point& tr) const
{
int b,l,w,h;
GetOrigin(b,l);
GetExtent(w,h);
bl=Point(b,l);
tr=Point(b+h,l+w);
}
virtual bool IsEmpty() const
{
return TextView::IsEmpty();
}
};
//对象适配器
class TextShape:public Shape
{
public:
TextShape(TextView *);
virtual void BoundingBox(Point& bl,Point& tr) const
{
int b,l,w,h;
_text->GetOrigin(b,l);
_text->GetExtent(w,h);
bl=Point(b,l);
tr=Point(b+h,l+w);
}
virtual bool IsEmpty() cosnt
{
return _text->IsEmpty();
}
private:
TextView * _text;
};
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -