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

📄 draw.h

📁 做为linux下图形用户界面支持系统之一的MicroWindows采用C++设计
💻 H
字号:
//
// Micro Windows Implementation
// draw.h
//
// $Revision: 1.1 $
// $Source: P:/MWINDOWS/INCLUDE/rcs/draw.h $
// $Date: 1993/10/03 15:22:22 $
//

#ifndef __draw_h
#define __draw_h

#include "global.h"
#include "model.h"
#include "window.h"
#include "button.h"
#include "shape.h"

enum DrawType
{
    DT_Line,
    DT_Box,
    DT_Solid
};

class ColorButton;
class ColorPalette;
class DrawApp;

class DrawWindow : public Model
{
public:
    DrawWindow (DrawApp *pap, View *pparent, Rect *drawRect = NULL);
    ~DrawWindow ();

    virtual void draw (View *from, Port *port, Rect *area);
    virtual void leftButtonDown (View *from, Point *pnt);
    virtual void leftButtonUp (View *from, Point *pnt);

protected:
    DrawApp *ap;
    Window *myWindow;

    List shapeList;
    Shape *currentShape;
    BOOL beingDrawn;
};

class DrawApp : public Model
{
public:
    DrawApp (View *pparent = desktop, Rect *drawRect = NULL);

    void createDrawWindow ();

protected:
    friend ColorPalette;
    friend DrawWindow;

    DrawType penType;
    PortPenColor penColor;
    Window *appWindow;
};

class ColorPalette : public Model
{
public:
    ColorPalette (DrawApp *servingAp, View *pparent,
                  Point *attachPoint = NULL);
    virtual void fromView (View *from);

protected:
    ColorButton *colorBtn[16];
    ColorButton *currentClrBtn;
    Button *createBtn, *lineBtn, *boxBtn, *solidBtn;
    DrawApp *ap;
    Window *paletteWindow;
};

class ColorButton : public Button
{
public:
    ColorButton (PortPenColor color, Rect *prect, View *pparent,
                 Model *client, BOOL attach = TRUE, BOOL killModel = FALSE);

    PortPenColor getColor ();
    void setColor (PortPenColor color);

protected:
    virtual void drawText (Port *port);
    PortPenColor btnColor;
};

class ColorObject : public Object
{
public:
    ColorObject (PortPenColor c)    { color = c; }

    PortPenColor color;
};

#endif

⌨️ 快捷键说明

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