-
Notifications
You must be signed in to change notification settings - Fork 163
/
Copy pathGridIBPositionDetails.h
95 lines (76 loc) · 3.55 KB
/
GridIBPositionDetails.h
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
/************************************************************************
* Copyright(c) 2015, One Unified. All rights reserved. *
* email: [email protected] *
* *
* This file is provided as is WITHOUT ANY WARRANTY *
* without even the implied warranty of *
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. *
* *
* This software may not be used nor distributed without proper license *
* agreement. *
* *
* See the file LICENSE.txt for redistribution information. *
************************************************************************/
// Started December 30, 2015, 3:40 PM
#pragma once
#include <memory>
#include <boost/archive/text_oarchive.hpp>
#include <boost/archive/text_iarchive.hpp>
#include <wx/grid.h>
#include <TFInteractiveBrokers/IBTWS.h>
namespace ou { // One Unified
namespace tf { // TradeFrame
#define GRID_PositionDetails_STYLE wxTAB_TRAVERSAL
#define GRID_PositionDetails_TITLE _("Grid IB Position Details")
#define GRID_PositionDetails_IDNAME ID_GRID_IB_POSITION_DETAILS
#define GRID_PositionDetails_SIZE wxSize(400, 300)
#define GRID_PositionDetails_POSITION wxDefaultPosition
class IBPositionDetailEvent: public wxEvent {
public:
IBPositionDetailEvent( wxEventType eventType, const ou::tf::ib::TWS::PositionDetail& pd )
: wxEvent( 0, eventType ), m_pd( pd ) {}
IBPositionDetailEvent( const IBPositionDetailEvent& event ): wxEvent( event ), m_pd( event.m_pd ) {}
~IBPositionDetailEvent( void ) {}
IBPositionDetailEvent* Clone( void ) const { return new IBPositionDetailEvent( *this ); }
const ou::tf::ib::TWS::PositionDetail& GetIBPositionDetail( void ) const { return m_pd; }
protected:
private:
const ou::tf::ib::TWS::PositionDetail m_pd;
};
class GridIBPositionDetails_impl; // Forward declaration
class GridIBPositionDetails: public wxGrid {
friend class GridIBPositionDetails_impl;
friend class boost::serialization::access;
public:
GridIBPositionDetails(void);
GridIBPositionDetails(
wxWindow* parent, wxWindowID id = GRID_PositionDetails_IDNAME,
const wxPoint& pos = GRID_PositionDetails_POSITION,
const wxSize& size = GRID_PositionDetails_SIZE,
long style = GRID_PositionDetails_STYLE,
const wxString& = GRID_PositionDetails_TITLE );
~GridIBPositionDetails(void);
bool Create( wxWindow* parent,
wxWindowID id = GRID_PositionDetails_IDNAME,
const wxPoint& pos = GRID_PositionDetails_POSITION,
const wxSize& size = GRID_PositionDetails_SIZE,
long style = GRID_PositionDetails_STYLE,
const wxString& = GRID_PositionDetails_TITLE );
void UpdatePositionDetailRow( const ou::tf::ib::TWS::PositionDetail& ad );
protected:
void Init();
void CreateControls();
private:
enum { ID_Null=wxID_HIGHEST, ID_GRID_IB_POSITION_DETAILS
};
std::unique_ptr<GridIBPositionDetails_impl> m_pimpl;
void HandleIBPositionDetail( IBPositionDetailEvent& event );
void OnDestroy( wxWindowDestroyEvent& event );
wxBitmap GetBitmapResource( const wxString& name );
wxIcon GetIconResource( const wxString& name );
static bool ShowToolTips() { return true; };
template<class Archive>
void serialize(Archive & ar, const unsigned int file_version);
};
} // namespace tf
} // namespace ou