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

📄 ccc_wxw.h

📁 BigC++的源码
💻 H
字号:
#ifndef CCC_WXW_H
#define CCC_WXW_H

#include <vector>

using namespace std;

#include "ccc_shap.h"

class GraphicCanvas;

class GraphicFrame;

/**
   A conduit to a display window.
*/
class GraphicWindow
{
public:
   /**
      Default constructor. Constructs a window with the standard 
      coordinate system with corners (-10, -10) and (10, 10).
   */
   GraphicWindow();
   /**
      Sets the coordinate system of this window.
      @param x1 the minimum x-value
      @param y1 the minimum y-value
      @param x2 the maximum x-value
      @param y2 the maximum y-value
   */
   void coord(double xmin, double ymin, double xmax, double ymax);
   /**
      Clears this window.
   */
   void clear();

   /**
      Displays a point on this window.
      @param p the point to display (as a small circle)
      @return a reference to this window
   */
   GraphicWindow& operator<<(Point p);
   /**
      Displays a circle on this window.
      @param c the circle to display
      @return a reference to this window
   */
   GraphicWindow& operator<<(Circle c);
   /**
      Displays a line on this window.
      @param s the line to display
      @return a reference to this window
   */
   GraphicWindow& operator<<(Line s);
   /**
      Displays a message on this window.
      @param t the message to display
      @return a reference to this window
   */
   GraphicWindow& operator<<(Message t);

   /**
      Prompts the user for a string.
      @param s the prompt text
      @return the string that the user entered.
   */
   string get_string(string out_string);
   /**
      Prompts the user for an integer.
      @param s the prompt text
      @return the number that the user entered
   */
   int get_int(const string& out_string);
   /**
      Prompts the user for a floating-point value.
      @param s the prompt text
      @return the number that the user entered
   */
   double get_double(const string& out_string);
   /**
      Prompts the user to click on a point.
      @param s the prompt text
      @return the point on which the user clicked.
   */
   Point get_mouse(string out_string);
   /**
      Opens the window.
      @param frame the application frame
      @param canvas the canvas to draw on
   */
   void open(GraphicFrame* frame, GraphicCanvas* canvas);
   /**
      Process mouse input.
      @param p the mouse click point 
   */
   void mouse_input(Point p);
   /**
      Process mouse input.
      @param p the string that the user entered.
   */
   void string_input(string p);
private:
   GraphicFrame* frame;
   GraphicCanvas* canvas;
   vector<Point> mouse_inputs;
   int mouse_input_count;
   bool waiting_for_mouse_input;
   vector<string> string_inputs;
   int string_input_count;
   bool waiting_for_string_input;
};

extern GraphicWindow cwin;

#endif

⌨️ 快捷键说明

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