From 3ef188e6075649f4c72e3e7588d8966e1071f2ff Mon Sep 17 00:00:00 2001
From: admin <weikou2014>
Date: 星期五, 05 七月 2024 15:50:40 +0800
Subject: [PATCH] update .gitignore

---
 DelegateQueue/TradeQueueListControl.cpp |   50 ++++++++++++++++++++++++++++++++++++--------------
 1 files changed, 36 insertions(+), 14 deletions(-)

diff --git a/DelegateQueue/TradeQueueListControl.cpp b/DelegateQueue/TradeQueueListControl.cpp
index e5b3445..aa25014 100644
--- a/DelegateQueue/TradeQueueListControl.cpp
+++ b/DelegateQueue/TradeQueueListControl.cpp
@@ -1,5 +1,6 @@
 #include "TradeQueueListControl.h"
 #include "common.h"
+#include <wx\dcbuffer.h>
 using namespace std;
 
 //wxDEFINE_EVENT(wxEVT_UPDATE_UI, wxCommandEvent);
@@ -10,26 +11,23 @@
 
 
 TradeQueueListControl::TradeQueueListControl(wxWindow* parent, wxWindowID id,
-	const wxPoint& pos, const wxSize& size)
-	: wxControl(parent, id, pos, size, wxBORDER_NONE) {
+	const wxPoint& pos, const wxSize& size, wxSize queueItemSize)
+	: wxControl(parent, id, pos, size, wxBORDER_NONE), suitHeight(false),queueItemSize(queueItemSize){
 	Bind(wxEVT_PAINT, &TradeQueueListControl::OnPaint, this);
 }
 
 void TradeQueueListControl::OnPaint(wxPaintEvent& event) {
 	cout <<"OnPaint"<< endl;
 	try {
-		wxPaintDC dc(this);
-		dc.SetBackground(wxBrush(GetBackgroundColour()));
+		wxBufferedPaintDC  dc(this);
+		PrepareDC(dc);
+
+		dc.SetBackground(wxBrush(*wxBLACK));
 		dc.Clear();
-
-		dc.SetPen(*wxBLACK_PEN);
-		dc.SetBrush(*wxLIGHT_GREY_BRUSH);
-		dc.DrawRectangle(GetClientRect());
-
-		wxSize queueSize(50*DPI/100, 22*DPI/100);
+		wxSize queueSize(queueItemSize.GetWidth() *DPI/100, queueItemSize.GetHeight() *DPI/100);
 
 		// 绘制背景颜色
-		wxRect	queueRect = wxRect(GetPosition(), GetSize());
+		wxRect	queueRect = wxRect(wxPoint(0, 0), GetSize());//wxRect(GetPosition(), GetSize());
 		dc.SetPen(*wxBLACK);
 		dc.SetBrush(*wxBLACK);
 		dc.DrawRectangle(queueRect);
@@ -39,19 +37,24 @@
 
 		int padding = 3*DPI/100;
 		int countPerLine = (width+padding) / (queueSize.x+padding);
+		if (countPerLine == 0) {
+			countPerLine = 1;
+		}
 		int lineCount = queueList.size() % countPerLine == 0 ? queueList.size() / countPerLine : queueList.size() / countPerLine + 1;
 
 
 		std::list<TradeQueue>::iterator e = queueList.begin();
 
 
-		int startx = GetPosition().x + padding;
-		int starty = GetPosition().y + padding;
+		int startx = padding;
+		int starty = padding;
 
 		wxFont font = dc.GetFont();
 		//font.SetNumericWeight(wxFONTWEIGHT_BOLD);
 		font.SetPointSize(10);
 		dc.SetFont(font);
+
+		int height = startx;
 
 		for (int r = 0; r < lineCount; r++) {
 
@@ -76,16 +79,25 @@
 				case 2:
 					color = wxColor(209, 135, 252);
 					break;
+				case 3:
+					color = wxColor(225, 225, 225);
+					break;
+
 				default:
 					color = *wxRED;
 					break;
 				}
 				// wxColor(66,32,33)
-				WidgetsRenderUtil::drawBtn(&dc, (*e).num, rect, color, *wxBLACK);
+				WidgetsRenderUtil::drawBtn(&dc, (*e).num, rect, color, *wxBLACK,wxALIGN_RIGHT);
 				if (e != queueList.end()) {
 					++e;
 				}
+				height = rect.y + rect.GetHeight() + padding;
 			}
+		}
+		this->contentHeight = height;
+		if (suitHeight) {
+			//GetSize().SetHeight(height);
 		}
 		dc.SetTextForeground(*wxBLACK);
 
@@ -104,3 +116,13 @@
 		Refresh();
 	}
 }
+
+int TradeQueueListControl::getContentHeight()
+{
+	return this->contentHeight;
+}
+
+int TradeQueueListControl::getDataCount()
+{
+	return this->queueList.size();
+}

--
Gitblit v1.8.0