0
|
1 // Filename : custom.h
|
|
2 // Last Change: 2019-06-07 ‹à 16:39:35.
|
|
3 //
|
|
4 #pragma once
|
|
5
|
|
6 #include <wx/wx.h>
|
|
7 #include <wx/colour.h>
|
|
8 #include <wx/font.h>
|
|
9 #include <wx/bitmap.h>
|
|
10 #include <wx/image.h>
|
|
11 #include <wx/spinctrl.h>
|
|
12 #include "wx/dcclient.h"
|
|
13
|
|
14 class LookWindow : public wxWindow
|
|
15 {
|
|
16 DECLARE_EVENT_TABLE()
|
|
17 private:
|
|
18 int m_x0, m_y0, m_w0, m_h0; // default mask1 rect
|
|
19 int m_x1, m_y1, m_x2, m_y2; // variable mask1 rect
|
|
20
|
|
21 int m_s0, m_t0, m_u0, m_v0; // default mask2 rect
|
|
22 int m_s1, m_t1, m_s2, m_t2; // variable mask2 rect
|
|
23
|
|
24 int m_w, m_h, m_dcw, m_dch;
|
|
25 int m_scalex, m_scaley;
|
|
26
|
|
27 wxSpinCtrl *m_spnx, *m_spny, *m_spnw, *m_spnh;
|
|
28
|
|
29 wxString m_file;
|
|
30 wxBitmap m_bitmap;
|
|
31 int m_masknum = 1;
|
|
32
|
|
33 public:
|
|
34 LookWindow( wxWindow* parent, wxWindowID id = wxID_ANY, const wxPoint& pos = wxDefaultPosition, const wxSize& size = wxDefaultSize, long style = wxTAB_TRAVERSAL );
|
|
35 ~LookWindow();
|
|
36
|
|
37 void OnPaint( wxPaintEvent& event );
|
|
38 void OnMotion( wxMouseEvent& event );
|
|
39 void OnLeftDown( wxMouseEvent& event );
|
|
40 void OnLeftUp( wxMouseEvent& event );
|
|
41 void OnRightDown( wxMouseEvent& event );
|
|
42 void OnRightUp( wxMouseEvent& event );
|
|
43
|
|
44 void SetDefaultParams( int i, int w, int h, int dcw, int dch );
|
|
45 void AddMask( void );
|
|
46 void SetFile( wxString file ) { m_file = file; };
|
|
47 void AssignSpinControl( wxSpinCtrl* spnx, wxSpinCtrl* spny, wxSpinCtrl* spnw, wxSpinCtrl* spnh );
|
|
48
|
|
49 void LoadImage( void );
|
|
50 void ReloadImage( void );
|
|
51 void ResetMask1( void );
|
|
52 void ResetMask2( void );
|
|
53 void DoMask1( void );
|
|
54 void DoMask2( void );
|
|
55 wxRect GetRealMask1Rect( void );
|
|
56 wxRect GetRealMask2Rect( void );
|
|
57 };
|
|
58
|