{
dc.SetFont(* m_font);
m_game->Redraw(dc);
-
+#if 0
// if player name not set (and selection dialog is not displayed)
// then ask the player for their name
if (m_player.Length() == 0 && !m_playerDialog)
((wxFrame*)GetParent())->Close(TRUE);
}
}
+#endif
}
+void FortyCanvas::ShowPlayerDialog()
+{
+ // if player name not set (and selection dialog is not displayed)
+ // then ask the player for their name
+ if (m_player.Length() == 0 && !m_playerDialog)
+ {
+ m_playerDialog = new PlayerSelectionDialog(this, m_scoreFile);
+ m_playerDialog->ShowModal();
+ m_player = m_playerDialog->GetPlayersName();
+ if (m_player.Length() > 0)
+ {
+ // user entered a name - lookup their score
+ int wins, games, score;
+ m_scoreFile->ReadPlayersScore(m_player, wins, games, score);
+ m_game->NewPlayer(wins, games, score);
+
+ wxClientDC dc(this);
+ dc.SetFont(* m_font);
+ m_game->DisplayScore(dc);
+ m_playerDialog->Destroy();
+ m_playerDialog = 0;
+ Refresh(false);
+ }
+ else
+ {
+ // user cancelled the dialog - exit the app
+ ((wxFrame*)GetParent())->Close(TRUE);
+ }
+ }
+}
+
/*
Called when the main frame is closed
*/
void EnableHelpingHand(bool enable) { m_helpingHand = enable; }
void EnableRightButtonUndo(bool enable) { m_rightBtnUndo = enable; }
void LayoutGame();
+ void ShowPlayerDialog();
DECLARE_EVENT_TABLE()
#include "forty.h"
#include "card.h"
#include "scoredg.h"
-#ifdef wx_x
-#include "cards.xbm"
-#endif
-
-class FortyFrame: public wxFrame
-{
-public:
- FortyFrame(wxFrame* frame, char* title, int x, int y, int w, int h,bool largecards);
- virtual ~FortyFrame();
-
- void OnCloseWindow(wxCloseEvent& event);
-
- // Menu callbacks
- void NewGame(wxCommandEvent& event);
- void Exit(wxCommandEvent& event);
- void About(wxCommandEvent& event);
- void Undo(wxCommandEvent& event);
- void Redo(wxCommandEvent& event);
- void Scores(wxCommandEvent& event);
- void ToggleRightButtonUndo(wxCommandEvent& event);
- void ToggleHelpingHand(wxCommandEvent& event);
- void ToggleCardSize(wxCommandEvent& event);
-
- DECLARE_EVENT_TABLE()
-
-private:
- enum MenuCommands { NEW_GAME = 10, SCORES, EXIT,
- UNDO, REDO,
- RIGHT_BUTTON_UNDO, HELPING_HAND, LARGE_CARDS,
- ABOUT };
-
- wxMenuBar* m_menuBar;
- FortyCanvas* m_canvas;
-};
BEGIN_EVENT_TABLE(FortyFrame, wxFrame)
EVT_MENU(NEW_GAME, FortyFrame::NewGame)
// Show the frame
frame->Show(TRUE);
+ frame->GetCanvas()->ShowPlayerDialog();
+
return TRUE;
}
static wxBrush* m_backgroundBrush;
};
+class FortyCanvas;
+class FortyFrame: public wxFrame
+{
+public:
+ FortyFrame(wxFrame* frame, char* title, int x, int y, int w, int h,bool largecards);
+ virtual ~FortyFrame();
+
+ void OnCloseWindow(wxCloseEvent& event);
+
+ // Menu callbacks
+ void NewGame(wxCommandEvent& event);
+ void Exit(wxCommandEvent& event);
+ void About(wxCommandEvent& event);
+ void Undo(wxCommandEvent& event);
+ void Redo(wxCommandEvent& event);
+ void Scores(wxCommandEvent& event);
+ void ToggleRightButtonUndo(wxCommandEvent& event);
+ void ToggleHelpingHand(wxCommandEvent& event);
+ void ToggleCardSize(wxCommandEvent& event);
+
+ FortyCanvas* GetCanvas() { return m_canvas; }
+
+ DECLARE_EVENT_TABLE()
+
+private:
+ enum MenuCommands { NEW_GAME = 10, SCORES, EXIT,
+ UNDO, REDO,
+ RIGHT_BUTTON_UNDO, HELPING_HAND, LARGE_CARDS,
+ ABOUT };
+
+ wxMenuBar* m_menuBar;
+ FortyCanvas* m_canvas;
+};
+
#endif
#include <string.h>
#include "card.h"
#include "pile.h"
+#include "forty.h"
+#include "canvas.h"
#include "wx/app.h"
//+-------------------------------------------------------------+
void Pile::Redraw(wxDC& dc )
{
- wxWindow *frame = wxTheApp->GetTopWindow();
+ FortyFrame *frame = (FortyFrame*) wxTheApp->GetTopWindow();
wxWindow *canvas = (wxWindow *) NULL;
if (frame)
{
- wxNode *node = frame->GetChildren().First();
- if (node) canvas = (wxWindow*)node->Data();
+ canvas = frame->GetCanvas();
}
if (m_topCard >= 0)
First steps
-----------
-- Download wxX11-x.y.z.tgz, where x.y.z is the version number.
+- Download wxWindows-X-x.y.z.tgz, where x.y.z is the version number.
Download documentation in a preferred format, such as
wxWindows-HTML.zip or wxWindows-PDF.zip.
linked from the wxWindows web page.
The library produced by the install process will be called
-libwx_x11.a (static) and libwx_x11-2.3.so.0.0.0 (shared) so that
-once a binary incompatible version of wxWindows/X11 comes out
-we'll augment the library version number to avoid linking problems.
+libwx_x11univ[d].a (static) and libwx_x11univ[d]-2.3.so.0.0.0
+(shared) so that once a binary incompatible version of
+wxWindows/X11 comes out we'll augment the library version number
+to avoid linking problems.
Please send problems concerning installation, feature requests,
bug reports or comments to the wxWindows users list. Information
Status
======
-This is new port and doesn't yet compile, but do please join in
-and help. It's actually quite a simple port since most of the hard work
-is done by the wxUniversal widgets.
+Many of the samples are running.
+
+Some remaining issues:
+
+- some refresh efficiency issues
+- progress dialog not working (see dialogs sample)
+- clipboard implementation missing
+- drag and drop implementation missing
+- wxToggleButton implementation missing
+- wxSpinCtrl implementation missing
+- tooltips implementation missing
+- code common to the Motif and X11 ports needs to be
+ merged
+- need thread safety in event loop
Regards,
{
wxWindowDisabler disableAll;
- wxBusyInfo info("Sleep^H^H^H^H^HWorkiing, please wait...", this);
+ wxBusyInfo info("Working, please wait...", this);
for ( int i = 0; i < 30; i++ )
{
wxInfoFrame::wxInfoFrame(wxWindow *parent, const wxString& message)
- : wxFrame(parent, -1, wxT(""),
+ : wxFrame(parent, -1, wxT("Busy"),
wxDefaultPosition, wxDefaultSize,
+#if defined(__WXX11__)
+ wxTHICK_FRAME | wxFRAME_TOOL_WINDOW)
+#else
wxSIMPLE_BORDER | wxFRAME_TOOL_WINDOW)
+#endif
{
wxPanel *panel = new wxPanel( this );
wxStaticText *text = new wxStaticText(panel, -1, message);
// Update the display (especially on X, GTK)
wxYield();
+ wxYield();
#ifdef __WXMAC__
MacUpdateImmediately();
m_msg->SetLabel(newmsg);
wxYield();
+ wxYield();
}
if ( (m_elapsed || m_remaining || m_estimated) && (value != 0) )
m_msg->SetLabel(_("Done."));
}
+ wxYield();
wxYield();
(void)ShowModal();
{
// update the display
wxYield();
+ wxYield();
}
#ifdef __WXMAC__
#include "wx/log.h"
#include "wx/intl.h"
#include "wx/evtloop.h"
+#include "wx/timer.h"
#include "wx/univ/theme.h"
#include "wx/univ/renderer.h"
while (wxTheApp && wxTheApp->Pending())
wxTheApp->Dispatch();
+#if wxUSE_TIMER
+ wxTimer::NotifyTimers();
+#endif
+ ProcessIdle();
+
s_inYield = FALSE;
return TRUE;
slen = strlen(text);
XCharStruct overall_return;
- (void)XTextExtents(xfont, text.c_str(), slen, &direction,
+ (void)XTextExtents(xfont, (char*) text.c_str(), slen, &direction,
&ascent, &descent, &overall_return);
cx = overall_return.width;
if (XPending((Display*) wxGetDisplay()) == 0)
{
+#if wxUSE_NANOX
+ GR_TIMEOUT timeout = 10; // Milliseconds
+ // Wait for next event, or timeout
+ GrGetNextEventTimeout(& event, timeout);
+
+ // Fall through to ProcessEvent.
+ // we'll assume that ProcessEvent will just ignore
+ // the event if there was a timeout and no event.
+
+#else
struct timeval tv;
tv.tv_sec=0;
tv.tv_usec=10000; // TODO make this configurable
// An event was pending, so get it
XNextEvent((Display*) wxGetDisplay(), & event);
}
+#endif
} else
{
XNextEvent((Display*) wxGetDisplay(), & event);
wxCHECK_RET( xwindow, wxT("invalid window") );
-#if 1
+#if !wxUSE_NANOX
XWindowAttributes attr;
Status status = XGetWindowAttributes( wxGlobalDisplay(), xwindow, &attr );