| | |
| | | #include <wx/listctrl.h> |
| | | #include <wx/dataview.h> |
| | | #include <list> |
| | | #define MAIN_WINDOW_WIDTH 720 |
| | | #define PANNEL_TOP_HEIGHT 30 |
| | | #define PANNEL_TICK_HEIGHT 360 |
| | | #define PANNEL_MONEY_HEIGHT 60 |
| | | #define PANNEL_POSITION_HEIGHT 310 |
| | | #define PANNEL_SELL_HEIGHT 90 |
| | | #define MAIN_WINDOW_HEIGHT (PANNEL_TOP_HEIGHT + PANNEL_TICK_HEIGHT + PANNEL_MONEY_HEIGHT + PANNEL_POSITION_HEIGHT + PANNEL_SELL_HEIGHT + 38 + 5*2) |
| | | #include "TickChart.h" |
| | | #include <wx/richtext/richtextctrl.h> |
| | | #define DPI 1 |
| | | #define MAIN_WINDOW_WIDTH (int)(720*DPI) |
| | | #define PANNEL_TOP_HEIGHT (int)(30*DPI) |
| | | #define PANNEL_TICK_HEIGHT (int)(500*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 |
| | | { |
| | | wxButton* refreshBtn; |
| | | wxTextCtrl* codeEdit; |
| | | wxStaticText* msgLabel; |
| | | |
| | | wxTextCtrl* backTestDate;// 回测日期 |
| | | wxButton* btnBackTest;//回测按钮 |
| | | wxButton* btnAddZX;// 加自选 |
| | | }; |
| | | |
| | | struct TickWidgets |
| | | { |
| | | |
| | | |
| | | TickChart* tickChart; |
| | | wxRichTextCtrl* codeInfoLabel;// 代码信息 |
| | | }; |
| | | |
| | | struct MoneyWidgets |
| | |
| | | wxButton* sellBtn; |
| | | wxButton* buyBtn; |
| | | |
| | | wxCheckBox* showAllPosition; |
| | | |
| | | |
| | | std::list<wxButton*> sellNums; |
| | | }; |
| | |
| | | class ViewManager |
| | | { |
| | | |
| | | private: |
| | | public: |
| | | wxMenuBar* menuBar; |
| | | TopWidgets* topWidgets; |
| | | TickWidgets* tickWidgets; |
| | | MoneyWidgets* moneyWidgets; |
| | |
| | | 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 OnPositionSelectionChanged(wxDataViewEvent& event); |
| | | |
| | | void OnRefresh(wxCommandEvent& event); |
| | | |
| | | |
| | | |