⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 d_textsh.h

📁 这是数据结构和算法的国外经典书籍.清华大学出版社出版的<数据结构C++语言描述-应用模板库STL>陈君 译 英文名称是Data Structures with C++ Using STL.
💻 H
字号:
#ifndef TEXT_SHAPE_CLASS
#define TEXT_SHAPE_CLASS

#include <string>
#include "d_shape.h"

using namespace std;

class textShape: public shape
{
   public:
      textShape(double x = 0.0, double y = 0.0,
                const string& s ="", shapeColor c = darkgray);
			// constructor. has arguments for the base point,
			// text string and color

      string getText() const;
      void setText(const string& s);
	      // retrieve or set the text
      
      virtual void draw();
			// draw the text

   private:
      string text;
			// text to draw
};

textShape::textShape(double x, double y, const string& s,
                     shapeColor c):
   shape(x,y,c), text(s)
{}
      
string textShape::getText() const
{
   return text;
}

void textShape::setText(const string& s)
{
   text = s;
}

void textShape::draw()
{
   EZDCOLORVAL old_color;
   
   old_color = ezdSetColor(color.convertToEzdColor());
   // execute primitive function and draw the text
   shape_handle = ezdDrawText(text.c_str(), baseX, baseY);
   ezdSetColor(old_color);
}

#endif   // TEXT_SHAPE_CLASS

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -