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