#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();
|
}
|