Update of /cvsroot/gcblue/gcb_wx/src/graphics
In directory sc8-pr-cvs1:/tmp/cvs-serv28745/src/graphics
Modified Files:
tcButton.cpp
Log Message:
Index: tcButton.cpp
===================================================================
RCS file: /cvsroot/gcblue/gcb_wx/src/graphics/tcButton.cpp,v
retrieving revision 1.1
retrieving revision 1.2
diff -C2 -d -r1.1 -r1.2
*** tcButton.cpp 3 Jan 2004 00:45:12 -0000 1.1
--- tcButton.cpp 3 Jan 2004 03:51:16 -0000 1.2
***************
*** 32,36 ****
#include <iostream>
!
using namespace Gdiplus;
--- 32,39 ----
#include <iostream>
! Gdiplus::Pen* tcButton::pen = NULL;
! Gdiplus::SolidBrush* tcButton::brush = NULL;
! Gdiplus::Font* tcButton::font = NULL;
! unsigned tcButton::ref_count = 0;
using namespace Gdiplus;
***************
*** 68,71 ****
--- 71,77 ----
brush->SetColor(textColor);
+ pen->SetColor(textColor);
+
+ graphics->DrawRectangle(pen, buttonRect);
tcWindow::DrawTextInRect(graphics, font, brush, caption.c_str(), buttonRect);
***************
*** 128,149 ****
fontSize = 16.0f;
! // init Gdiplus objects
! pen = new Pen(Color(255,100,255,100),2);
! if (pen == NULL) throw "tcObjectControl - mpPen creation failed\n";
! FontFamily ff(L"Arial");
! font = new Font(&ff,10,FontStyleBold,UnitPixel);
! if (font == NULL) throw "tcObjectControl - mpFont creation failed\n";
! brush = new SolidBrush(Color(254,100,255,100));
! if (brush == NULL) throw "tcObjectControl - mpBrush creation failed\n";
}
tcButton::~tcButton()
{
! if (pen) delete pen;
! if (brush) delete brush;
! if (font) delete font;
}
--- 134,188 ----
fontSize = 16.0f;
! // init static Gdiplus objects if necessary
! if (pen == NULL)
! {
! pen = new Pen(Color(255,100,255,100),1);
! if (pen == NULL) throw "tcButton - mpPen creation failed\n";
! }
! if (font == NULL)
! {
! FontFamily ff(L"Arial");
! font = new Font(&ff,10,FontStyleBold,UnitPixel);
! if (font == NULL) throw "tcButton - mpFont creation failed\n";
! }
! if (brush == NULL)
! {
! brush = new SolidBrush(Color(254,100,255,100));
! if (brush == NULL) throw "tcButton - mpBrush creation failed\n";
! }
+ ref_count++;
}
tcButton::~tcButton()
{
! wxASSERT(ref_count);
!
! ref_count--;
!
! // check if last button is being deleted
! // and delete Gdiplus objects if so
! if (ref_count == 0)
! {
! if (pen)
! {
! delete pen;
! pen = NULL;
! }
!
! if (brush)
! {
! delete brush;
! brush = NULL;
! }
!
! if (font)
! {
! delete font;
! font = NULL;
! }
! }
}
|