admin
2024-10-18 8ea6d363df77de2dca288397da8d4f9c3d3a5c4d
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
#pragma once
#include <wx/wx.h>
#include <wx/listctrl.h>
#include <wx/dataview.h>
#include <list>
#include "TickChart.h"
#include <wx/richtext/richtextctrl.h>
#include "MyDataViewListCtrl.h"
#define DPI 1
#define MAIN_WINDOW_WIDTH (int)(720*DPI)
#define PANNEL_TOP_HEIGHT (int)(120*DPI)
#define PANNEL_TICK_HEIGHT (int)(410*DPI)
#define PANNEL_MONEY_HEIGHT (int)(60*DPI)
#define PANNEL_POSITION_HEIGHT (int)(310*DPI)
#define PANNEL_SELL_HEIGHT (int)(120*DPI)
#define MAIN_WINDOW_HEIGHT (PANNEL_TOP_HEIGHT + PANNEL_TICK_HEIGHT + PANNEL_MONEY_HEIGHT + PANNEL_POSITION_HEIGHT + PANNEL_SELL_HEIGHT + (int)((38 + 5*2 + 20) * DPI) ) // 20Ϊ²Ëµ¥¸ß¶È
 
 
class  MyColorText : public wxObject {
public:
    MyColorText(){
 
    }
    MyColorText(wxString text, wxColor color):m_text(text), m_color(color){
    
    }
 
    void setText(wxString text) {
        m_text = text;
    }
 
    void setColor(wxColor color) {
        m_color = color;
    }
 
    wxString getText() {
        return m_text;
    }
 
    wxColor getColor() {
        return m_color;
    }
 
    bool IsSameAs(const MyColorText& other) const
    {
        return m_text == other.m_text && m_color.IsSameAs(other.m_color);
    }
 
    bool operator==(const MyColorText& other) const
    {
        return IsSameAs(other);
    }
 
    bool operator!=(const MyColorText& other) const
    {
        return !IsSameAs(other);
    }
 
 
private:
    wxString m_text;
    wxColor m_color;
};
DECLARE_VARIANT_OBJECT(MyColorText)
 
 
 
class  MyButton : public wxObject {
public:
    MyButton() {
 
    }
    MyButton(wxString code, wxString text, wxColor textColor, wxColor bgColor) :m_code(code),m_text(text), m_text_color(textColor), m_bg_color(bgColor) {
 
    }
 
    void setCode(wxString code) {
        m_code = code;
    }
 
    void setText(wxString text) {
        m_text = text;
    }
 
    void setBgColor(wxColor color) {
        m_bg_color = color;
    }
 
    void setTextColor(wxColor color) {
        m_text_color = color;
    }
 
    wxString getText() {
        return m_text;
    }
 
    wxColor getBgColor() {
        return m_bg_color;
    }
 
    wxColor getTextColor() {
        return m_text_color;
    }
 
    wxString getCode() {
        return m_code;
    }
 
    bool IsSameAs(const MyButton& other) const
    {
        return m_text == other.m_text && m_bg_color.IsSameAs(other.m_bg_color) && m_text_color.IsSameAs(other.m_text_color);
    }
 
    bool operator==(const MyButton& other) const
    {
        return IsSameAs(other);
    }
 
    bool operator!=(const MyButton& other) const
    {
        return !IsSameAs(other);
    }
 
 
private:
    wxString m_code;
    wxString m_text;
    wxColor m_text_color;
    wxColor m_bg_color;
 
};
DECLARE_VARIANT_OBJECT(MyButton)
 
 
 
 
struct TopWidgets
{
    wxRichTextCtrl* codeInfoLabel;// ´úÂëÐÅÏ¢
    wxButton* refreshBtn;
    wxTextCtrl* codeEdit;
    wxStaticText* msgLabel;
    wxTextCtrl* backTestDate;// »Ø²âÈÕÆÚ
    wxButton* btnBackTest;//»Ø²â°´Å¥
    wxButton* btnAddZX;// ¼Ó×ÔÑ¡
};
 
struct TickWidgets
{
    
    TickChart* tickChart;
 
};
 
struct MoneyWidgets
{
    wxStaticText* availableLabel;//¿ÉÓÃ×ʽð
    wxStaticText* positionLabel;//³Ö²Ö½ð¶î
    wxStaticText* frozenLabel; //¶³½á½ð¶î
    wxStaticText* totalLabel; // ÕË»§×ܽð¶î
    wxStaticText* todayCommissionLabel;// ½ñÈÕÊÖÐø·Ñ
    wxStaticText* todayProfitLabel;// Ó¯Àû½ð¶î 
    wxStaticText* todayProfitRateLabel;// ½ñÈÕÓ¯Àû±È
    wxStaticText* totalProfitLabel;// ÀÛ¼ÆÓ¯Àû
};
 
struct PositionWidgets
{
    MyDataViewListCtrl* listCtrlReport;
};
 
struct SellWidgets
{
 
    wxCheckBox* buyLock;
    wxTextCtrl* buyMoney;
    wxCheckBox* sellLock;
    wxTextCtrl* sellMoney;
    wxButton* openTrade;
    wxButton* closeTrade;
    // ÏëÂòµ¥
    wxButton* addWantBuy;
    wxButton* removeWantBuy;
    wxButton* wantBuyList;
 
    wxButton* setting;
    wxCheckBox* autoCancel;
 
    wxChoice* buyPrice;
    wxChoice* sellPrice;
 
    wxButton* sellBtn;
    wxButton* buyBtn;
 
    wxCheckBox* showAllPosition;
 
 
    std::list<wxButton*> sellNums;
};
 
class ViewManager
{
 
public:
        wxMenuBar* menuBar;
        TopWidgets* topWidgets;
        TickWidgets* tickWidgets;
        MoneyWidgets* moneyWidgets;
        PositionWidgets* positionWidgets;
        SellWidgets* sellWidgets;
public:
    ViewManager();
    static wxPanel* createSplitLine(wxWindow* parent);
    void initView(wxWindow* window);
private:
 
    /// <summary>
    /// ÏÔʾ¾ò½ð²ÎÊýÉèÖÃ
    /// </summary>
    /// <param name="event"></param>
    void ShowJueJinSetting(wxCommandEvent& event);
 
 
private:
    void initMenu(wxFrame* window);
    void initTopView(wxPanel* pancel);
    void initTickView(wxPanel* panel);
    void initMoneyView(wxPanel* panel);
    void initPositionView(wxPanel* panel);
    void initSellView(wxPanel* panel);
    void OnRefresh(wxCommandEvent& event);
 
 
 
};