admin
2024-07-05 3ef188e6075649f4c72e3e7588d8966e1071f2ff
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
#include "TickFrame.h"
#include "MyConfigUtil.h"
TickFrame::TickFrame(wxWindow* parent,const wxString& title, wxString code, wxString codeName, float preClosePrice, wxString xStartTime, wxString xEndTime, std::list<TickTradeData> buyPoints, std::list<TickTradeData> sellPoints, float costRate, wxPoint position, wxSize size):wxFrame(parent,wxID_ANY,title,position,size) {
 
    wxIcon icon;
    icon.LoadFile("logo.ico", wxBITMAP_TYPE_ICO); // Ìæ»» "app_icon.ico" ÎªÄãµÄÓ¦ÓóÌÐòͼ±êÎļþ·¾¶
    SetIcon(icon);
    //SetTransparent(225);
    SetWindowStyleFlag(GetWindowStyleFlag() | wxSTAY_ON_TOP);
 
 
    WindowPosSize rect = MyConfigUtil::getTickWindowPos();
    if (rect.x == -1 && rect.y == -1) {
    }
    else {
        wxPoint    p = wxPoint(rect.x, rect.y);
        cout << "ÉèÖõÄ×ø±ê£º" << p.x << "  " << p.y << endl;
        wxSize    s = wxSize(rect.width, rect.height);
        SetPosition(p);
        SetSize(s);
    }
    Bind(wxEVT_CLOSE_WINDOW, &TickFrame::OnClose, this);
 
 
    wxBoxSizer* sizer = new wxBoxSizer(wxHORIZONTAL);
    TickChart *tickChart=new TickChart(this, wxID_ANY, 3, TIME_SPACE_TICK , xStartTime, xEndTime);
    
    if (code.find("11") == 0 || code.find("12") == 0)
    {
        tickChart->Init(CodeBasicInfo({ code,codeName, preClosePrice }), CodeBasicInfo(), nullptr, NULL);
    }
    else {
        tickChart->Init(CodeBasicInfo(), CodeBasicInfo({ code,codeName, preClosePrice }), nullptr, NULL);
    }
    if (buyPoints.size() > 0) {
        for (std::list<TickTradeData>::iterator e = buyPoints.begin(); e != buyPoints.end(); e++) {
            tickChart->AddBuyPoint(*e);
        }
    }
 
    if (sellPoints.size() > 0) {
        for (std::list<TickTradeData>::iterator e = sellPoints.begin(); e != sellPoints.end(); e++) {
            tickChart->AddSellPoint(*e);
        }
    }
    sizer->Add(tickChart, 1, wxEXPAND);
    SetSizer(sizer);
}
 
void TickFrame::OnClose(wxCloseEvent& event) {
 
    MyConfigUtil::setTickWindowPos(GetPosition(), GetSize());
    event.Skip();
}