]> Shamusworld >> Repos - ttedit/blob - src/editwindow.h
f31298cc1305d5d041d200d6a1806194e11ec4a9
[ttedit] / src / editwindow.h
1 //
2 // EDITWINDOW.H: Header file
3 //
4 // by James L. Hammons
5 // (C) 2008 Underground Software
6 //
7
8 #ifndef __EDITWINDOW_H__
9 #define __EDITWINDOW_H__
10
11 #include <QtGui>
12 #include "types.h"
13 //#include "ttedit.h"                                                           // For TTEditApp
14 #include "toolwindow.h"                                                 // For ToolType enum
15 #include "glyphpoints.h"
16
17 class EditWindow: public QWidget
18 {
19         Q_OBJECT
20
21         public:
22                 EditWindow(QWidget * parent = NULL);
23                 QSize minimumSizeHint() const;
24                 QSize sizeHint() const;
25
26         protected:
27                 void paintEvent(QPaintEvent * event);
28                 void mousePressEvent(QMouseEvent * event);
29                 void mouseMoveEvent(QMouseEvent * event);
30                 void mouseReleaseEvent(QMouseEvent * event);
31
32         private:
33                 void CreateCursors(void);
34                 QPoint GetAdjustedMousePosition(QMouseEvent * event);
35                 QPoint GetAdjustedClientPosition(int x, int y);
36
37                 QImage image;
38                 QPoint pt, ptOffset, ptPrevious;
39 //              TTEditApp & app;                                                // Reference to the application object
40                 double scale;                                                   // Window scaling factor
41                 int32 offsetX, offsetY;                                 // Window offsets
42                 ToolType tool;                                                  // Current tool
43                 GlyphPoints pts;                                                // Glyph point structure
44                 int32 ptHighlight, oldPtHighlight, ptNextHighlight, oldPtNextHighlight;
45                 bool polyFirstPoint;
46
47                 ToolWindow * toolPalette;
48                 QCursor cur[8];
49 };
50
51 #if 0
52 #include <wx/wx.h>                                                              // So that whoever uses this can without having
53                                                                                                 // to pull in a bunch of references manually
54 #include "types.h"
55 #include "ttedit.h"                                                             // For TTEditApp
56 #include "toolwindow.h"                                                 // For ToolType enum
57 #include "glyphpoints.h"
58
59 class TTEditWindow: public wxWindow
60 {
61         private:
62                 TTEditApp & app;                                                // Reference to the application object
63                 double scale;                                                   // Window scaling factor
64                 int32 offsetX, offsetY;                                 // Window offsets
65                 ToolType tool;                                                  // Current tool
66                 GlyphPoints pts;                                                // Glyph point structure
67                 int32 ptHighlight, oldPtHighlight, ptNextHighlight, oldPtNextHighlight;
68                 bool polyFirstPoint;
69
70         protected:
71         public:
72                 wxBitmap * bmp;
73                 wxPoint pt, ptOffset, ptPrevious;
74
75                 // Constructor and destructor
76                 TTEditWindow(wxFrame * parent, const wxPoint &pos = wxDefaultPosition, const wxSize &size = wxDefaultSize, long style = 0);
77                 ~TTEditWindow(void);
78
79                 void OnPaint(wxPaintEvent &e);
80                 void OnMouseEvent(wxMouseEvent &e);
81
82         protected:
83                 wxPoint GetAdjustedMousePosition(wxMouseEvent &e);
84                 wxPoint GetAdjustedClientPosition(wxCoord x, wxCoord y);
85
86         DECLARE_EVENT_TABLE()
87 };
88 #endif
89
90 #endif  // __EDITWINDOW_H__