2. Open src/wxvc.dsp, set Debug or Release configuration, and
compile. This will produce lib/wxvc.lib or lib/wxvc_debug.lib.
3. Open a sample project file, choose a configuration, and compile.
- Currently only the minimal and mdi samples have project files.
- To create others, copy the .dsp/.dsw files from the minimal
- sample and globally replace 'MinimalVC' and 'minimal' with
- suitable names. Add any other required source files.
+ The project files don't use precompiled headers, to save
+ space, but you can switch PCH compiling on for greater speed.
Using makefiles:
#include "wx/control.h"
#include "wx/event.h"
-#ifdef __MINGW32__
-#undef GetFirstChild()
-#undef GetNextSibling()
+#ifdef __GNUWIN32__
+# ifdef GetFirstChild
+# undef GetFirstChild
+# endif
+
+# ifdef GetNextSibling
+# undef GetNextSibling
+# endif
#endif
// the type for "untyped" data
#else
m_font = wxTheFontList->FindOrCreateFont(10, wxSWISS, wxNORMAL, wxNORMAL);
#endif
- SetBackgroundColour(*FortyApp::BackgroundColour());
+ SetBackgroundColour(FortyApp::BackgroundColour());
AllowDoubleClick(true);
m_handCursor = new wxCursor(wxCURSOR_HAND);
void FortyCanvas::OnDraw(wxDC& dc)
{
- dc.SetFont(m_font);
+ dc.SetFont(* m_font);
m_game->Redraw(dc);
// if player name not set (and selection dialog is not displayed)
wxClientDC dc(this);
PrepareDC(dc);
- dc.SetFont(m_font);
+ dc.SetFont(* m_font);
if (event.LeftDClick())
{
wxClientDC dc(this);
PrepareDC(dc);
- dc.SetFont(m_font);
+ dc.SetFont(* m_font);
m_game->Redraw(dc);
}
else
// the card under the cursor can go somewhere
if (m_game->CanYouGo(x, y) && m_helpingHand)
{
- SetCursor(m_handCursor);
+ SetCursor(* m_handCursor);
}
else
{
- SetCursor(m_arrowCursor);
+ SetCursor(* m_arrowCursor);
}
}
{
wxClientDC dc(this);
PrepareDC(dc);
- dc.SetFont(m_font);
+ dc.SetFont(* m_font);
m_game->Undo(dc);
}
{
wxClientDC dc(this);
PrepareDC(dc);
- dc.SetFont(m_font);
+ dc.SetFont(* m_font);
m_game->Redo(dc);
}
void Card::Erase(wxDC& dc, int x, int y)
{
wxPen* pen = wxThePenList->FindOrCreatePen(
- *FortyApp::BackgroundColour(),
+ FortyApp::BackgroundColour(),
1,
wxSOLID
);
- dc.SetPen(pen);
+ dc.SetPen(* pen);
dc.SetBrush(FortyApp::BackgroundBrush());
dc.DrawRectangle(x, y, CardWidth, CardHeight);
} // Card::Erase()
//+-------------------------------------------------------------+
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.SetBackground(wxRED_BRUSH);
+ dc.SetBackground(* wxRED_BRUSH);
dc.SetBackgroundMode(wxSOLID);
wxBrush* brush = wxTheBrushList->FindOrCreateBrush(
"BLACK", wxCROSSDIAG_HATCH
);
- dc.SetBrush(brush);
+ dc.SetBrush(* brush);
dc.DrawRoundedRectangle(
x + 4, y + 4,
else
{
wxMemoryDC memoryDC;
- memoryDC.SelectObject(m_symbolBmap);
+ memoryDC.SelectObject(* m_symbolBmap);
// dc.SetBackgroundMode(wxTRANSPARENT);
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);
- 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.SetBackground(backgroundBrush);
+ dc.SetBackground(* backgroundBrush);
} // Card:Draw()
//+-------------------------------------------------------------+
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.SetPen(pen);
+ dc.SetPen(*pen);
dc.DrawRoundedRectangle(x, y, CardWidth, CardHeight, 4);
} // Card::DrawNullCard()
{
if (!m_backgroundBrush)
{
- m_backgroundBrush = new wxBrush(*BackgroundColour(), wxSOLID);
+ m_backgroundBrush = new wxBrush(BackgroundColour(), wxSOLID);
}
return *m_backgroundBrush;
{
// set the icon
#ifdef __WXMSW__
- SetIcon(new wxIcon("CardsIcon"));
+ SetIcon(wxIcon("CardsIcon"));
#else
#ifdef GTK_TBD
- SetIcon(new wxIcon(Cards_bits, Cards_width, Cards_height));
+ SetIcon(wxIcon(Cards_bits, Cards_width, Cards_height));
#endif
#endif
void Game::DisplayScore(wxDC& dc)
{
- wxColour* bgColour = FortyApp::BackgroundColour();
- wxPen* pen = wxThePenList->FindOrCreatePen(*bgColour, 1, wxSOLID);
- dc.SetTextBackground(*bgColour);
- dc.SetTextForeground(*FortyApp::TextColour());
+ wxColour bgColour = FortyApp::BackgroundColour();
+ wxPen* pen = wxThePenList->FindOrCreatePen(bgColour, 1, wxSOLID);
+ dc.SetTextBackground(bgColour);
+ dc.SetTextForeground(FortyApp::TextColour());
dc.SetBrush(FortyApp::BackgroundBrush());
- dc.SetPen(pen);
+ dc.SetPen(* pen);
// count the number of cards in foundations
m_currentScore = 0;
char str[10];
sprintf(str, "%d ", m_topCard + 1);
- dc.SetTextBackground(*FortyApp::BackgroundColour());
- dc.SetTextForeground(*FortyApp::TextColour());
+ dc.SetTextBackground(FortyApp::BackgroundColour());
+ dc.SetTextForeground(FortyApp::TextColour());
dc.DrawText(str, m_x + CardWidth + 5, m_y + CardHeight / 2);
}
--- /dev/null
+#
+# File: makefile.unx
+# Author: Julian Smart
+# Created: 1993
+# Updated:
+# Copyright: (c) 1993, AIAI, University of Edinburgh
+#
+# "%W% %G%"
+#
+# Makefile for Forty Thieves example (UNIX).
+
+WXDIR = ../..
+
+# All common UNIX compiler flags and options are now in
+# this central makefile.
+include $(WXDIR)/src/makeg95.env
+
+OBJECTS = $(OBJDIR)/forty.$(OBJSUFF) $(OBJDIR)/canvas.$(OBJSUFF) $(OBJDIR)/card.$(OBJSUFF)\
+ $(OBJDIR)/game.$(OBJSUFF) $(OBJDIR)/pile.$(OBJSUFF) $(OBJDIR)/playerdg.$(OBJSUFF)\
+ $(OBJDIR)/scoredg.$(OBJSUFF) $(OBJDIR)/scorefil.$(OBJSUFF)\
+ $(OBJDIR)/forty_resources.$(OBJSUFF)
+
+all: $(OBJDIR) forty$(GUISUFFIX)$(EXESUFF)
+
+wx:
+
+$(OBJDIR):
+ mkdir $(OBJDIR)
+
+forty$(GUISUFFIX)$(EXESUFF): $(OBJECTS) $(WXLIB)
+ $(CC) $(LDFLAGS) -o forty$(GUISUFFIX)$(EXESUFF) $(OBJECTS) $(LDLIBS)
+
+$(OBJDIR)/forty.$(OBJSUFF): forty.$(SRCSUFF)
+ $(CC) -c $(CPPFLAGS) -o $@ forty.$(SRCSUFF)
+
+$(OBJDIR)/canvas.$(OBJSUFF): canvas.$(SRCSUFF)
+ $(CC) -c $(CPPFLAGS) -o $@ canvas.$(SRCSUFF)
+
+$(OBJDIR)/card.$(OBJSUFF): card.$(SRCSUFF)
+ $(CC) -c $(CPPFLAGS) -o $@ card.$(SRCSUFF)
+
+$(OBJDIR)/playerdg.$(OBJSUFF): playerdg.$(SRCSUFF)
+ $(CC) -c $(CPPFLAGS) -o $@ playerdg.$(SRCSUFF)
+
+$(OBJDIR)/scoredg.$(OBJSUFF): scoredg.$(SRCSUFF)
+ $(CC) -c $(CPPFLAGS) -o $@ scoredg.$(SRCSUFF)
+
+$(OBJDIR)/scorefil.$(OBJSUFF): scorefil.$(SRCSUFF)
+ $(CC) -c $(CPPFLAGS) -o $@ scorefil.$(SRCSUFF)
+
+$(OBJDIR)/pile.$(OBJSUFF): pile.$(SRCSUFF)
+ $(CC) -c $(CPPFLAGS) -o $@ pile.$(SRCSUFF)
+
+$(OBJDIR)/game.$(OBJSUFF): game.$(SRCSUFF)
+ $(CC) -c $(CPPFLAGS) -o $@ game.$(SRCSUFF)
+
+$(OBJDIR)/forty_resources.o: forty.rc
+ $(RESCOMP) -i forty.rc -o $(OBJDIR)/forty_resources.o $(RESFLAGS)
+
+clean:
+ rm -f $(OBJECTS) forty$(GUISUFFIX).exe core *.rsc *.res
wxWindow *canvas = (wxWindow *) NULL;
if (frame)
{
- wxNode *node = frame->GetChildren()->First();
+ wxNode *node = frame->GetChildren().First();
if (node) canvas = (wxWindow*)node->Data();
}
#endif
#if wxUSE_IOSTREAMH
-#if defined(__WXMSW__) && !defined(GNUWIN32)
+#if defined(__WXMSW__) && !defined(__GNUWIN32__)
#include <strstrea.h>
#else
#include <strstream.h>
void ScoreCanvas::OnDraw(wxDC& dc)
{
- dc.SetFont(m_font);
+ dc.SetFont(* m_font);
const char* str = m_text;
unsigned int tab = 0;
}
// Check if the bitmap has the correct depth for this device context
- if (bitmap.Ok() && (bitmap.GetDepth() != GetDepth()))
+// if (bitmap.Ok() && (bitmap.GetDepth() != GetDepth()))
+ // JACS 11/12/98: disabling this since the Forty Thieves sample
+ // shows this not working properly. In fact, if loading from a resource,
+ // the depth should become the screen depth, so why was it being called?
+ if (0)
{
// Make a new bitmap that has the correct depth.
wxBitmap newBitmap = bitmap.GetBitmapForDC(* this);
// Add a property
void wxPropertySheet::AddProperty(wxProperty *property)
{
- m_properties.Append(property->GetName().GetData(), property);
+ m_properties.Append((const char*) property->GetName(), property);
}
// Get property by name
wxProperty *wxPropertySheet::GetProperty(wxString name)
{
- wxNode *node = m_properties.Find(name.GetData());
+ wxNode *node = m_properties.Find((const char*) name);
if (!node)
return NULL;
else
ClearRegistry();
}
-void wxPropertyValidatorRegistry::RegisterValidator(wxString& typeName, wxPropertyValidator *validator)
+void wxPropertyValidatorRegistry::RegisterValidator(const wxString& typeName, wxPropertyValidator *validator)
{
- Put(typeName.GetData(), validator);
+ Put((const char*) typeName, validator);
}
-wxPropertyValidator *wxPropertyValidatorRegistry::GetValidator(wxString& typeName)
+wxPropertyValidator *wxPropertyValidatorRegistry::GetValidator(const wxString& typeName)
{
- return (wxPropertyValidator *)Get(typeName.GetData());
+ return (wxPropertyValidator *)Get((const char*) typeName);
}
void wxPropertyValidatorRegistry::ClearRegistry(void)
wxPropertyValidatorRegistry(void);
~wxPropertyValidatorRegistry(void);
- virtual void RegisterValidator(wxString& roleName, wxPropertyValidator *validator);
- virtual wxPropertyValidator *GetValidator(wxString& roleName);
+ virtual void RegisterValidator(const wxString& roleName, wxPropertyValidator *validator);
+ virtual wxPropertyValidator *GetValidator(const wxString& roleName);
void ClearRegistry(void);
};