]> git.saurik.com Git - wxWidgets.git/blobdiff - samples/forty/card.cpp
Much improved wxHelpControllerHtml, works under Solaris, too now.
[wxWidgets.git] / samples / forty / card.cpp
index b38056ead03786135619e7523e184a59ce0686bf..37999de3ed26f478e7dda87a6c0a61a21d3c5f79 100644 (file)
@@ -41,7 +41,7 @@
 #include "forty.h"
 #include "card.h"
 
 #include "forty.h"
 #include "card.h"
 
-#ifdef __WXGTK__
+#if defined(__WXGTK__) || defined(__WXMOTIF__)
 #include "pictures.xpm"
 #include "symbols.xbm"
 #endif
 #include "pictures.xpm"
 #include "symbols.xbm"
 #endif
@@ -138,11 +138,11 @@ Card::~Card()
 void Card::Erase(wxDC& dc, int x, int y)
 {
        wxPen* pen = wxThePenList->FindOrCreatePen(
 void Card::Erase(wxDC& dc, int x, int y)
 {
        wxPen* pen = wxThePenList->FindOrCreatePen(
-                                               *FortyApp::BackgroundColour(),
+                                               FortyApp::BackgroundColour(),
                                                1,
                                                wxSOLID
                                                );
                                                1,
                                                wxSOLID
                                                );
-       dc.SetPen(pen);
+       dc.SetPen(pen);
        dc.SetBrush(FortyApp::BackgroundBrush());
        dc.DrawRectangle(x, y, CardWidth, CardHeight);
 } // Card::Erase()
        dc.SetBrush(FortyApp::BackgroundBrush());
        dc.DrawRectangle(x, y, CardWidth, CardHeight);
 } // Card::Erase()
@@ -171,18 +171,18 @@ void Card::Erase(wxDC& dc, int x, int y)
 //+-------------------------------------------------------------+
 void Card::Draw(wxDC& dc, int x, int y)
 {
 //+-------------------------------------------------------------+
 void Card::Draw(wxDC& dc, int x, int y)
 {
-       wxBrush* backgroundBrush = dc.GetBackground();
-       dc.SetBrush(wxWHITE_BRUSH);
-       dc.SetPen(wxBLACK_PEN);
+       wxBrush backgroundBrush( dc.GetBackground() );
+       dc.SetBrush(wxWHITE_BRUSH);
+       dc.SetPen(wxBLACK_PEN);
        dc.DrawRoundedRectangle(x, y, CardWidth, CardHeight, 4);
        if (m_wayUp == facedown)
        {
        dc.DrawRoundedRectangle(x, y, CardWidth, CardHeight, 4);
        if (m_wayUp == facedown)
        {
-               dc.SetBackground(wxRED_BRUSH);
+               dc.SetBackground(wxRED_BRUSH);
                dc.SetBackgroundMode(wxSOLID);
                wxBrush* brush = wxTheBrushList->FindOrCreateBrush(
                                                        "BLACK", wxCROSSDIAG_HATCH
                                                        );
                dc.SetBackgroundMode(wxSOLID);
                wxBrush* brush = wxTheBrushList->FindOrCreateBrush(
                                                        "BLACK", wxCROSSDIAG_HATCH
                                                        );
-               dc.SetBrush(brush);
+               dc.SetBrush(brush);
 
                dc.DrawRoundedRectangle(
                                x + 4, y + 4,
 
                dc.DrawRoundedRectangle(
                                x + 4, y + 4,
@@ -193,7 +193,7 @@ void Card::Draw(wxDC& dc, int x, int y)
        else
        {
                wxMemoryDC memoryDC;
        else
        {
                wxMemoryDC memoryDC;
-               memoryDC.SelectObject(m_symbolBmap);
+               memoryDC.SelectObject(m_symbolBmap);
 
 //             dc.SetBackgroundMode(wxTRANSPARENT);
 
 
 //             dc.SetBackgroundMode(wxTRANSPARENT);
 
@@ -324,10 +324,10 @@ void Card::Draw(wxDC& dc, int x, int y)
                case 11:
                case 12:
                case 13:
                case 11:
                case 12:
                case 13:
-                       memoryDC.SelectObject(m_pictureBmap);
+                       memoryDC.SelectObject(m_pictureBmap);
                        dc.Blit(x + 5, y - 5 + CardHeight / 4, 40, 45,
                                &memoryDC, 40 * (m_pipValue - 11), 0, wxCOPY);
                        dc.Blit(x + 5, y - 5 + CardHeight / 4, 40, 45,
                                &memoryDC, 40 * (m_pipValue - 11), 0, wxCOPY);
-                       memoryDC.SelectObject(m_symbolBmap);
+                       memoryDC.SelectObject(m_symbolBmap);
                        dc.Blit(x + 32, y - 3 + CardHeight / 4, 11, 11,
                                &memoryDC, 11 * m_suit, 14, wxCOPY);
                        dc.Blit(x + 7, y + 27 + CardHeight / 4, 11, 11,
                        dc.Blit(x + 32, y - 3 + CardHeight / 4, 11, 11,
                                &memoryDC, 11 * m_suit, 14, wxCOPY);
                        dc.Blit(x + 7, y + 27 + CardHeight / 4, 11, 11,
@@ -336,7 +336,7 @@ void Card::Draw(wxDC& dc, int x, int y)
                }
 
        }
                }
 
        }
-       dc.SetBackground(backgroundBrush);
+       dc.SetBackground( backgroundBrush );
 } // Card:Draw()
 
 
 } // Card:Draw()
 
 
@@ -349,9 +349,9 @@ void Card::Draw(wxDC& dc, int x, int y)
 //+-------------------------------------------------------------+
 void Card::DrawNullCard(wxDC& dc, int x, int y)
 {
 //+-------------------------------------------------------------+
 void Card::DrawNullCard(wxDC& dc, int x, int y)
 {
-       wxPen* pen = wxThePenList->FindOrCreatePen(*FortyApp::TextColour(), 1, wxSOLID);
+       wxPen* pen = wxThePenList->FindOrCreatePen(FortyApp::TextColour(), 1, wxSOLID);
        dc.SetBrush(FortyApp::BackgroundBrush());
        dc.SetBrush(FortyApp::BackgroundBrush());
-       dc.SetPen(pen);
+       dc.SetPen(*pen);
        dc.DrawRoundedRectangle(x, y, CardWidth, CardHeight, 4);
 } // Card::DrawNullCard()
 
        dc.DrawRoundedRectangle(x, y, CardWidth, CardHeight, 4);
 } // Card::DrawNullCard()