applied patch #935127: "wxDIALOG_MODAL and wxDIALOG_MODELESS cleaning"; some cosmetic cleanup

git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@27430 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
This commit is contained in:
Dimitri Schoolwerth 2004-05-25 12:44:56 +00:00
parent be5a51fb59
commit 2a21ac1590
19 changed files with 585 additions and 618 deletions

View File

@ -182,7 +182,7 @@ void MyApp::PropertyListTest(bool useDialog)
if (useDialog)
{
propDialog = new PropListDialog(view, NULL, _T("Property Sheet Test"),
wxDefaultPosition, wxSize(400, 500), wxDEFAULT_DIALOG_STYLE|wxDIALOG_MODELESS);
wxDefaultPosition, wxSize(400, 500));
m_childWindow = propDialog;
}
else
@ -230,7 +230,7 @@ void MyApp::PropertyFormTest(bool useDialog)
if (useDialog)
{
propDialog = new PropFormDialog(view, NULL, _T("Property Form Test"),
wxDefaultPosition, wxSize(380, 250), wxDEFAULT_DIALOG_STYLE|wxDIALOG_MODAL);
wxDefaultPosition, wxSize(380, 250));
m_childWindow = propDialog;
}
else

File diff suppressed because it is too large Load Diff

View File

@ -1643,7 +1643,7 @@ bool wxListOfStringsListValidator::EditStringList(wxWindow *parent, wxStringList
wxBeginBusyCursor();
wxPropertyStringListEditorDialog *dialog = new wxPropertyStringListEditorDialog(parent,
title, wxPoint(10, 10), wxSize(400, 400), wxDEFAULT_DIALOG_STYLE|wxDIALOG_MODAL);
title, wxPoint(10, 10), wxSize(400, 400));
dialog->m_stringList = stringList;

View File

@ -6,9 +6,7 @@
// Created: 21/07/97
// RCS-ID: $Id$
// Copyright: (c) 1993-1998 Chris Breeze
// Licence: wxWindows licence
//---------------------------------------------------------------------------
// Last modified: 22nd July 1998 - ported to wxWidgets 2.0
// Licence: wxWindows licence
/////////////////////////////////////////////////////////////////////////////
#ifdef __GNUG__
@ -33,57 +31,55 @@
const int ID_LISTBOX = 101;
BEGIN_EVENT_TABLE(PlayerSelectionDialog, wxDialog)
EVT_SIZE(PlayerSelectionDialog::OnSize)
EVT_BUTTON(wxID_OK, PlayerSelectionDialog::ButtonCallback)
EVT_BUTTON(wxID_CANCEL, PlayerSelectionDialog::ButtonCallback)
EVT_LISTBOX(ID_LISTBOX, PlayerSelectionDialog::SelectCallback)
EVT_SIZE(PlayerSelectionDialog::OnSize)
EVT_BUTTON(wxID_OK, PlayerSelectionDialog::ButtonCallback)
EVT_BUTTON(wxID_CANCEL, PlayerSelectionDialog::ButtonCallback)
EVT_LISTBOX(ID_LISTBOX, PlayerSelectionDialog::SelectCallback)
EVT_CLOSE(PlayerSelectionDialog::OnCloseWindow)
END_EVENT_TABLE()
PlayerSelectionDialog::PlayerSelectionDialog(
wxWindow* parent,
ScoreFile* file
) :
wxDialog(parent, wxID_ANY, _T("Player Selection"),
wxDefaultPosition, wxDefaultSize,
wxDIALOG_MODAL | wxDEFAULT_DIALOG_STYLE),
m_scoreFile(file)
wxWindow* parent,
ScoreFile* file
) :
wxDialog(parent, wxID_ANY, _T("Player Selection"), wxDefaultPosition),
m_scoreFile(file)
{
wxStaticText* msg = new wxStaticText(this, wxID_ANY, _T("Please select a name or type a new one:"));
wxStaticText* msg = new wxStaticText(this, wxID_ANY, _T("Please select a name or type a new one:"));
wxListBox* list = new wxListBox(
this, ID_LISTBOX,
wxDefaultPosition, wxDefaultSize,
0, 0,
wxLB_SINGLE
);
wxArrayString players;
m_scoreFile->GetPlayerList(players);
for (unsigned int i = 0; i < players.Count(); i++)
{
list->Append(players[i]);
}
wxListBox* list = new wxListBox(
this, ID_LISTBOX,
wxDefaultPosition, wxDefaultSize,
0, 0,
wxLB_SINGLE
);
m_textField = new wxTextCtrl(this, wxID_ANY, _T(""), wxDefaultPosition, wxDefaultSize, 0);
wxArrayString players;
m_scoreFile->GetPlayerList(players);
for (unsigned int i = 0; i < players.Count(); i++)
{
list->Append(players[i]);
}
m_OK = new wxButton(this, wxID_OK, _T("OK"));
m_cancel = new wxButton(this, wxID_CANCEL, _T("Cancel"));
m_textField = new wxTextCtrl(this, wxID_ANY, wxEmptyString, wxDefaultPosition, wxDefaultSize);
wxBoxSizer *button_sizer = new wxBoxSizer( wxHORIZONTAL );
button_sizer->Add( m_OK, 0, wxALL, 10 );
button_sizer->Add( m_cancel, 0, wxALL, 10 );
m_OK = new wxButton(this, wxID_OK, _T("OK"));
m_cancel = new wxButton(this, wxID_CANCEL, _T("Cancel"));
wxBoxSizer *topsizer = new wxBoxSizer( wxVERTICAL );
topsizer->Add( msg, 0, wxALL , 10 );
topsizer->Add( list, 1, wxEXPAND | wxLEFT | wxRIGHT, 10 );
topsizer->Add( m_textField, 0, wxEXPAND | wxLEFT | wxRIGHT | wxTOP, 10 );
topsizer->Add( button_sizer, 0, wxALIGN_LEFT );
wxBoxSizer *button_sizer = new wxBoxSizer( wxHORIZONTAL );
button_sizer->Add( m_OK, 0, wxALL, 10 );
button_sizer->Add( m_cancel, 0, wxALL, 10 );
SetSizer( topsizer );
wxBoxSizer *topsizer = new wxBoxSizer( wxVERTICAL );
topsizer->Add( msg, 0, wxALL , 10 );
topsizer->Add( list, 1, wxEXPAND | wxLEFT | wxRIGHT, 10 );
topsizer->Add( m_textField, 0, wxEXPAND | wxLEFT | wxRIGHT | wxTOP, 10 );
topsizer->Add( button_sizer, 0, wxALIGN_LEFT );
SetSizer( topsizer );
topsizer->SetSizeHints( this );
topsizer->SetSizeHints( this );
CentreOnParent();
}
@ -93,58 +89,58 @@ PlayerSelectionDialog::~PlayerSelectionDialog()
void PlayerSelectionDialog::OnSize(wxSizeEvent& WXUNUSED(event))
{
Layout();
Layout();
}
const wxString& PlayerSelectionDialog::GetPlayersName()
{
/*
m_player = "";
Show(true);
m_player = wxEmptyString;
Show(true);
*/
return m_player;
return m_player;
}
void PlayerSelectionDialog::OnCloseWindow(wxCloseEvent& WXUNUSED(event))
{
m_player = _T("");
m_player = wxEmptyString;
EndModal(wxID_CANCEL);
}
void PlayerSelectionDialog::SelectCallback(wxCommandEvent& event)
{
if (event.GetEventType() == wxEVT_COMMAND_LISTBOX_SELECTED)
{
// if (event.IsSelection())
m_textField->SetValue(event.GetString());
}
if (event.GetEventType() == wxEVT_COMMAND_LISTBOX_SELECTED)
{
// if (event.IsSelection())
m_textField->SetValue(event.GetString());
}
}
void PlayerSelectionDialog::ButtonCallback(wxCommandEvent& event)
{
if (event.GetId() == wxID_OK)
{
wxString name = m_textField->GetValue();
if (!name.IsNull() && name.Length() > 0)
{
if (name.Contains(_T('@')))
{
wxMessageBox(_T("Names should not contain the '@' character"), _T("Forty Thieves"));
}
else
{
m_player = name;
EndModal(wxID_OK);
}
}
else
{
wxMessageBox(_T("Please enter your name"), _T("Forty Thieves"));
}
}
else
{
m_player = _T("");
EndModal(wxID_CANCEL);
}
if (event.GetId() == wxID_OK)
{
wxString name = m_textField->GetValue();
if (!name.IsNull() && name.Length() > 0)
{
if (name.Contains(_T('@')))
{
wxMessageBox(_T("Names should not contain the '@' character"), _T("Forty Thieves"));
}
else
{
m_player = name;
EndModal(wxID_OK);
}
}
else
{
wxMessageBox(_T("Please enter your name"), _T("Forty Thieves"));
}
}
else
{
m_player = wxEmptyString;
EndModal(wxID_CANCEL);
}
}

View File

@ -6,9 +6,7 @@
// Created: 21/07/97
// RCS-ID: $Id$
// Copyright: (c) 1993-1998 Chris Breeze
// Licence: wxWindows licence
//---------------------------------------------------------------------------
// Last modified: 22nd July 1998 - ported to wxWidgets 2.0
// Licence: wxWindows licence
/////////////////////////////////////////////////////////////////////////////
#if defined(__GNUG__) && !defined(__APPLE__)
@ -38,49 +36,49 @@
class ScoreCanvas : public wxScrolledWindow
{
public:
ScoreCanvas(wxWindow* parent, ScoreFile* scoreFile, const wxPoint& pos, wxSize& size);
virtual ~ScoreCanvas();
ScoreCanvas(wxWindow* parent, ScoreFile* scoreFile, const wxPoint& pos, wxSize& size);
virtual ~ScoreCanvas();
void OnDraw(wxDC& dc);
void OnDraw(wxDC& dc);
private:
wxFont* m_font;
wxString m_text;
wxFont *m_font;
wxString m_text;
};
ScoreCanvas::ScoreCanvas(wxWindow* parent, ScoreFile* scoreFile, const wxPoint& pos, wxSize& size) :
wxScrolledWindow(parent, -1, pos, size, wxSUNKEN_BORDER)
wxScrolledWindow(parent, wxID_ANY, pos, size, wxSUNKEN_BORDER)
{
SetBackgroundColour(*wxWHITE);
#ifdef __WXGTK__
m_font = wxTheFontList->FindOrCreateFont(12, wxROMAN, wxNORMAL, wxNORMAL);
m_font = wxTheFontList->FindOrCreateFont(12, wxROMAN, wxNORMAL, wxNORMAL);
#else
m_font = wxTheFontList->FindOrCreateFont(10, wxSWISS, wxNORMAL, wxNORMAL);
m_font = wxTheFontList->FindOrCreateFont(10, wxSWISS, wxNORMAL, wxNORMAL);
#endif
wxArrayString players;
scoreFile->GetPlayerList( players);
scoreFile->GetPlayerList( players);
wxString os;
wxString os;
os << wxT("Player\tWins\tGames\tScore\n");
for (unsigned int i = 0; i < players.Count(); i++)
{
int wins, games, score;
scoreFile->ReadPlayersScore(players[i], wins, games, score);
int average = 0;
if (games > 0)
{
average = (2 * score + games) / (2 * games);
}
os << wxT("Player\tWins\tGames\tScore\n");
for (unsigned int i = 0; i < players.Count(); i++)
{
int wins, games, score;
scoreFile->ReadPlayersScore(players[i], wins, games, score);
int average = 0;
if (games > 0)
{
average = (2 * score + games) / (2 * games);
}
os << players[i] << wxT('\t')
<< wins << wxT('\t')
<< games << wxT('\t')
<< average << wxT('\n');
}
os << wxT('\0');
m_text = os;
os << players[i] << wxT('\t')
<< wins << wxT('\t')
<< games << wxT('\t')
<< average << wxT('\n');
}
os << wxT('\0');
m_text = os;
}
ScoreCanvas::~ScoreCanvas()
@ -89,45 +87,45 @@ ScoreCanvas::~ScoreCanvas()
void ScoreCanvas::OnDraw(wxDC& dc)
{
dc.SetFont(* m_font);
dc.SetFont(* m_font);
const wxChar* str = m_text;
unsigned int tab = 0;
unsigned int tabstops[] = { 5, 100, 150, 200 };
const wxChar* str = m_text;
unsigned int tab = 0;
unsigned int tabstops[] = { 5, 100, 150, 200 };
// get the line spacing for the current font
int lineSpacing;
{
long w, h;
dc.GetTextExtent(wxT("Testing"), &w, &h);
lineSpacing = (int)h;
}
// get the line spacing for the current font
int lineSpacing;
{
long w, h;
dc.GetTextExtent(wxT("Testing"), &w, &h);
lineSpacing = (int)h;
}
int y = 0;
while (*str)
{
wxChar text[256];
wxChar* dest = text;
while (*str && *str >= ' ') *dest++ = *str++;
*dest = '\0';
int y = 0;
while (*str)
{
wxChar text[256];
wxChar* dest = text;
dc.DrawText(text, tabstops[tab], y);
while (*str && *str >= ' ') *dest++ = *str++;
*dest = '\0';
if (*str == '\t')
{
if (tab < sizeof(tabstops) / sizeof(tabstops[0]) - 1)
{
tab++;
}
}
else if (*str == '\n')
{
tab = 0;
y += lineSpacing;
}
if (*str) str++;
}
dc.DrawText(text, tabstops[tab], y);
if (*str == '\t')
{
if (tab < sizeof(tabstops) / sizeof(tabstops[0]) - 1)
{
tab++;
}
}
else if (*str == '\n')
{
tab = 0;
y += lineSpacing;
}
if (*str) str++;
}
}
#endif
@ -136,31 +134,30 @@ BEGIN_EVENT_TABLE(ScoreDialog, wxDialog)
END_EVENT_TABLE()
ScoreDialog::ScoreDialog(wxWindow* parent, ScoreFile* file) :
wxDialog(parent, wxID_ANY, _("Scores"),
wxDefaultPosition, wxSize(400, 300),
wxDIALOG_MODAL | wxDEFAULT_DIALOG_STYLE),
m_scoreFile(file)
wxDialog(parent, wxID_ANY, _("Scores"),
wxDefaultPosition, wxSize(400, 300)),
m_scoreFile(file)
{
// create grid with players
wxArrayString players;
file->GetPlayerList(players);
file->GetPlayerList(players);
wxSize sz = wxSize(400, 300);
#if USE_GRID_FOR_SCORE
wxGrid* list = new wxGrid(this, wxID_ANY, wxDefaultPosition, sz, 0);
wxGrid* list = new wxGrid(this, wxID_ANY, wxDefaultPosition, sz, 0);
list->CreateGrid(players.Count(), 4);
for (unsigned int i = 0; i < players.Count(); i++)
{
int wins, games, score;
for (unsigned int i = 0; i < players.Count(); i++)
{
int wins, games, score;
wxString string_value;
file->ReadPlayersScore(players[i], wins, games, score);
int average = 0;
if (games > 0)
{
average = (2 * score + games) / (2 * games);
}
file->ReadPlayersScore(players[i], wins, games, score);
int average = 0;
if (games > 0)
{
average = (2 * score + games) / (2 * games);
}
list->SetCellValue(i,0,players[i]);
string_value.Printf( _T("%u"), wins );
list->SetCellValue(i,1,string_value);
@ -181,7 +178,7 @@ ScoreDialog::ScoreDialog(wxWindow* parent, ScoreFile* file) :
list->EnableDragColSize(false);
list->EnableDragGridSize(false);
#else
ScoreCanvas* list = new ScoreCanvas(this, m_scoreFile, wxDefaultPosition, sz);
ScoreCanvas* list = new ScoreCanvas(this, m_scoreFile, wxDefaultPosition, sz);
#endif
// locate and resize with sizers
@ -193,7 +190,7 @@ ScoreDialog::ScoreDialog(wxWindow* parent, ScoreFile* file) :
GetSizer()->Fit(this);
GetSizer()->SetSizeHints(this);
CentreOnParent();
}
@ -203,7 +200,7 @@ ScoreDialog::~ScoreDialog()
void ScoreDialog::Display()
{
Show(true);
Show(true);
}
void ScoreDialog::OnCloseWindow(wxCloseEvent& WXUNUSED(event))

View File

@ -6,9 +6,7 @@
// Created: 21/07/97
// RCS-ID: $Id$
// Copyright: (c) 1993-1998 Chris Breeze
// Licence: wxWindows licence
//---------------------------------------------------------------------------
// Last modified: 14th May 1998 - ported to wxWidgets 2.0
// Licence: wxWindows licence
/////////////////////////////////////////////////////////////////////////////
#ifdef __GNUG__
@ -41,65 +39,65 @@
ScoreFile::ScoreFile(const wxString& appName)
{
#if 0
wxString filename;
m_configFilename << "/usr/local/share/" << appName << ".scores";
if (access(m_configFilename, F_OK) == 0)
{
if (access(m_configFilename, R_OK | W_OK) != 0)
{
// file is not r/w - use local file instead
m_configFilename = wxFileConfig::GetLocalFileName(appName);
}
}
else
{
int fd = creat(m_configFilename, 0666);
wxString filename;
m_configFilename << "/usr/local/share/" << appName << ".scores";
if (access(m_configFilename, F_OK) == 0)
{
if (access(m_configFilename, R_OK | W_OK) != 0)
{
// file is not r/w - use local file instead
m_configFilename = wxFileConfig::GetLocalFileName(appName);
}
}
else
{
int fd = creat(m_configFilename, 0666);
if (fd < 0)
{
// failed to create file - use local file instead
m_configFilename = wxFileConfig::GetLocalFileName(appName);
}
else
{
// ensure created file has rw-rw-rw permissions
close(fd);
}
}
if (fd < 0)
{
// failed to create file - use local file instead
m_configFilename = wxFileConfig::GetLocalFileName(appName);
}
else
{
// ensure created file has rw-rw-rw permissions
close(fd);
}
}
#endif
m_config = new wxConfig(appName, _T("wxWidgets"), appName, _T(""),
m_config = new wxConfig(appName, _T("wxWidgets"), appName, wxEmptyString,
wxCONFIG_USE_LOCAL_FILE); // only local
}
ScoreFile::~ScoreFile()
{
delete m_config;
delete m_config;
#ifdef __WXGTK__
// ensure score file has rw-rw-rw permissions
// (wxFileConfig sets them to rw-------)
chmod(m_configFilename, 0666);
// ensure score file has rw-rw-rw permissions
// (wxFileConfig sets them to rw-------)
chmod(m_configFilename, 0666);
#endif
}
void ScoreFile::GetPlayerList( wxArrayString &list )
{
m_config->SetPath(_T("/Players"));
int length = m_config->GetNumberOfGroups();
m_config->SetPath(_T("/Players"));
int length = m_config->GetNumberOfGroups();
if (length <= 0) return;
if (length <= 0) return;
wxString player;
long index;
if (m_config->GetFirstGroup(player, index))
{
list.Add( player );
while (m_config->GetNextGroup(player, index))
{
list.Add( player );
}
}
wxString player;
long index;
if (m_config->GetFirstGroup(player, index))
{
list.Add( player );
while (m_config->GetNextGroup(player, index))
{
list.Add( player );
}
}
}
@ -111,73 +109,73 @@ long ScoreFile::CalcCheck(const wxString& name, int p1, int p2, int p3)
size_t i, max = name.length();
for(i = 0; i < max; ++i )
{
check = (check << 1) ^ (long)name[i];
check = ((check >> 23) ^ check) & 0xFFFFFF;
}
check = (check << 1) ^ (long)p1;
check = ((check >> 23) ^ check) & 0xFFFFFF;
check = (check << 1) ^ (long)p2;
check = ((check >> 23) ^ check) & 0xFFFFFF;
check = (check << 1) ^ (long)p3;
check = ((check >> 23) ^ check) & 0xFFFFFF;
{
check = (check << 1) ^ (long)name[i];
check = ((check >> 23) ^ check) & 0xFFFFFF;
}
check = (check << 1) ^ (long)p1;
check = ((check >> 23) ^ check) & 0xFFFFFF;
check = (check << 1) ^ (long)p2;
check = ((check >> 23) ^ check) & 0xFFFFFF;
check = (check << 1) ^ (long)p3;
check = ((check >> 23) ^ check) & 0xFFFFFF;
return check;
}
wxString ScoreFile::GetPreviousPlayer() const
{
wxString result;
m_config->SetPath(_T("/General"));
m_config->Read(_T("LastPlayer"), &result);
return result;
wxString result;
m_config->SetPath(_T("/General"));
m_config->Read(_T("LastPlayer"), &result);
return result;
}
void ScoreFile::ReadPlayersScore(
const wxString& player,
int& wins,
int& games,
int& score)
const wxString& player,
int& wins,
int& games,
int& score)
{
long check = 0;
long myWins = 0, myGames = 0, myScore = 0;
long check = 0;
long myWins = 0, myGames = 0, myScore = 0;
games = wins = score = 0;
games = wins = score = 0;
m_config->SetPath(_T("/Players"));
m_config->SetPath(player);
if (m_config->Read(_T("Score"), &myScore, 0L) &&
m_config->Read(_T("Games"), &myGames, 0L) &&
m_config->Read(_T("Wins"), &myWins, 0L) &&
m_config->Read(_T("Check"), &check, 0L))
{
if (check != CalcCheck(player, myGames, myWins, myScore))
{
wxMessageBox(_T("Score file corrupted"), _T("Warning"),
m_config->SetPath(_T("/Players"));
m_config->SetPath(player);
if (m_config->Read(_T("Score"), &myScore, 0L) &&
m_config->Read(_T("Games"), &myGames, 0L) &&
m_config->Read(_T("Wins"), &myWins, 0L) &&
m_config->Read(_T("Check"), &check, 0L))
{
if (check != CalcCheck(player, myGames, myWins, myScore))
{
wxMessageBox(_T("Score file corrupted"), _T("Warning"),
wxOK | wxICON_EXCLAMATION);
}
else
{
games = myGames;
wins = myWins;
score = myScore;
}
}
WritePlayersScore(player, wins, games, score);
}
else
{
games = myGames;
wins = myWins;
score = myScore;
}
}
WritePlayersScore(player, wins, games, score);
}
void ScoreFile::WritePlayersScore(const wxString& player, int wins, int games, int score)
{
if (player)
{
m_config->SetPath(_T("/General"));
m_config->Write(_T("LastPlayer"), wxString(player)); // Without wxString tmp, thinks it's bool in VC++
{
m_config->SetPath(_T("/General"));
m_config->Write(_T("LastPlayer"), wxString(player)); // Without wxString tmp, thinks it's bool in VC++
m_config->SetPath(_T("/Players"));
m_config->SetPath(player);
m_config->Write(_T("Score"), (long)score);
m_config->Write(_T("Games"), (long)games);
m_config->Write(_T("Wins"), (long)wins);
m_config->Write(_T("Check"), CalcCheck(player, games, wins, score));
}
m_config->SetPath(_T("/Players"));
m_config->SetPath(player);
m_config->Write(_T("Score"), (long)score);
m_config->Write(_T("Games"), (long)games);
m_config->Write(_T("Wins"), (long)wins);
m_config->Write(_T("Check"), CalcCheck(player, games, wins, score));
}
}

View File

@ -78,14 +78,11 @@ END_EVENT_TABLE()
// --------------------------------------------------------------------------
LifeSamplesDialog::LifeSamplesDialog(wxWindow *parent)
: wxDialog(parent, -1,
_("Sample games"),
wxDefaultPosition,
wxDefaultSize,
wxDEFAULT_DIALOG_STYLE | wxDIALOG_MODAL)
: wxDialog(parent, wxID_ANY, _("Sample games"),
wxDefaultPosition, wxDefaultSize)
{
m_value = 0;
// create and populate the list of available samples
m_list = new wxListBox( this, ID_LISTBOX,
wxDefaultPosition,
@ -97,11 +94,11 @@ LifeSamplesDialog::LifeSamplesDialog(wxWindow *parent)
m_list->Append(g_patterns[i].m_name);
// descriptions
wxStaticBox *statbox = new wxStaticBox( this, -1, _("Description"));
wxStaticBox *statbox = new wxStaticBox( this, wxID_ANY, _("Description"));
m_life = new Life();
m_life->SetPattern(g_patterns[0]);
m_canvas = new LifeCanvas( this, m_life, FALSE );
m_text = new wxTextCtrl( this, -1,
m_canvas = new LifeCanvas( this, m_life, false );
m_text = new wxTextCtrl( this, wxID_ANY,
g_patterns[0].m_description,
wxDefaultPosition,
wxSize(300, 60),
@ -118,14 +115,13 @@ LifeSamplesDialog::LifeSamplesDialog(wxWindow *parent)
wxBoxSizer *sizer3 = new wxBoxSizer( wxVERTICAL );
sizer3->Add( CreateTextSizer(_("Select one configuration")), 0, wxALL, 10 );
sizer3->Add( new wxStaticLine(this, -1), 0, wxGROW | wxLEFT | wxRIGHT, 10 );
sizer3->Add( new wxStaticLine(this, wxID_ANY), 0, wxGROW | wxLEFT | wxRIGHT, 10 );
sizer3->Add( sizer2, 1, wxGROW | wxALL, 5 );
sizer3->Add( new wxStaticLine(this, -1), 0, wxGROW | wxLEFT | wxRIGHT, 10 );
sizer3->Add( new wxStaticLine(this, wxID_ANY), 0, wxGROW | wxLEFT | wxRIGHT, 10 );
sizer3->Add( CreateButtonSizer(wxOK | wxCANCEL), 0, wxCENTRE | wxALL, 10 );
// activate
SetSizer(sizer3);
SetAutoLayout(TRUE);
sizer3->SetSizeHints(this);
sizer3->Fit(this);
Centre(wxBOTH | wxCENTRE_ON_SCREEN);
@ -164,35 +160,31 @@ void LifeSamplesDialog::OnListBox(wxCommandEvent& event)
// --------------------------------------------------------------------------
LifeAboutDialog::LifeAboutDialog(wxWindow *parent)
: wxDialog(parent, -1,
_("About Life!"),
wxDefaultPosition,
wxDefaultSize,
wxDEFAULT_DIALOG_STYLE | wxDIALOG_MODAL)
: wxDialog(parent, wxID_ANY, _("About Life!"),
wxDefaultPosition, wxDefaultSize)
{
// logo
wxBitmap bmp = wxBITMAP(life);
#if !defined(__WXGTK__) && !defined(__WXMOTIF__) && !defined(__WXMAC__)
bmp.SetMask(new wxMask(bmp, *wxBLUE));
#endif
wxStaticBitmap *sbmp = new wxStaticBitmap(this, -1, bmp);
wxStaticBitmap *sbmp = new wxStaticBitmap(this, wxID_ANY, bmp);
// layout components
wxBoxSizer *sizer = new wxBoxSizer( wxVERTICAL );
sizer->Add( sbmp, 0, wxCENTRE | wxALL, 10 );
sizer->Add( new wxStaticLine(this, -1), 0, wxGROW | wxLEFT | wxRIGHT, 5 );
sizer->Add( new wxStaticLine(this, wxID_ANY), 0, wxGROW | wxLEFT | wxRIGHT, 5 );
sizer->Add( CreateTextSizer(_("Life! version 2.2 for wxWidgets\n\n\
(c) 2000 Guillermo Rodriguez Garcia\n\n\
<guille@iies.es>\n\n\
Portions of the code are based in XLife;\n\
XLife is (c) 1989 by Jon Bennett et al.")),
0, wxCENTRE | wxALL, 20 );
sizer->Add( new wxStaticLine(this, -1), 0, wxGROW | wxLEFT | wxRIGHT, 5 );
sizer->Add( new wxStaticLine(this, wxID_ANY), 0, wxGROW | wxLEFT | wxRIGHT, 5 );
sizer->Add( CreateButtonSizer(wxOK), 0, wxCENTRE | wxALL, 10 );
// activate
SetSizer(sizer);
SetAutoLayout(TRUE);
sizer->SetSizeHints(this);
sizer->Fit(this);
Centre(wxBOTH | wxCENTRE_ON_SCREEN);

View File

@ -44,7 +44,7 @@ class LifeCanvas : public wxWindow
{
public:
// ctor and dtor
LifeCanvas(wxWindow* parent, Life* life, bool interactive = TRUE);
LifeCanvas(wxWindow* parent, Life* life, bool interactive = true);
~LifeCanvas();
// view management

View File

@ -39,7 +39,7 @@ bool MyApp::OnInit(void)
{
// Create the main window
#if USE_TABBED_DIALOG
dialog = new MyDialog((wxFrame *) NULL, -1, (char *) "Tabbed Dialog", wxPoint(-1, -1), wxSize(365, 390), wxDIALOG_MODAL|wxDEFAULT_DIALOG_STYLE);
dialog = new MyDialog((wxFrame *) NULL, wxID_ANY, (char *) "Tabbed Dialog", wxPoint(-1, -1), wxSize(365, 390));
dialog->ShowModal();

View File

@ -36,7 +36,7 @@ IMPLEMENT_APP(MyApp)
bool MyApp::OnInit(void)
{
// Create the main frame window
dialog = new MyDialog(NULL, wxID_ANY, wxT("wxTaskBarIcon Test Dialog"), wxDefaultPosition, wxSize(365, 290), wxDIALOG_MODELESS|wxDEFAULT_DIALOG_STYLE);
dialog = new MyDialog(NULL, wxID_ANY, wxT("wxTaskBarIcon Test Dialog"), wxDefaultPosition, wxSize(365, 290));
dialog->Show(true);

View File

@ -171,7 +171,7 @@ void MyFrame::OnToggleBell(wxCommandEvent& event)
MyDialog::MyDialog( wxWindow *parent, const wxString& title,
const wxPoint& pos, const wxSize& size, const long WXUNUSED(style) ) :
wxDialog(parent, VALIDATE_DIALOG_ID, title, pos, size, wxDEFAULT_DIALOG_STYLE|wxDIALOG_MODAL|wxRESIZE_BORDER)
wxDialog(parent, VALIDATE_DIALOG_ID, title, pos, size, wxDEFAULT_DIALOG_STYLE|wxRESIZE_BORDER)
{
// Sizers automatically ensure a workable layout.
wxBoxSizer *mainsizer = new wxBoxSizer( wxVERTICAL );

View File

@ -144,8 +144,7 @@ void wxGenericColourDialog::OnCloseWindow(wxCloseEvent& WXUNUSED(event))
bool wxGenericColourDialog::Create(wxWindow *parent, wxColourData *data)
{
if ( !wxDialog::Create(parent, -1, wxT("Colour"),
wxPoint(0, 0), wxSize(900, 900),
wxDEFAULT_DIALOG_STYLE | wxDIALOG_MODAL) )
wxPoint(0, 0), wxSize(900, 900)) )
return FALSE;
dialogParent = parent;

View File

@ -82,8 +82,7 @@ wxNumberEntryDialog::wxNumberEntryDialog(wxWindow *parent,
long max,
const wxPoint& pos)
: wxDialog(parent, -1, caption,
pos, wxDefaultSize,
wxDEFAULT_DIALOG_STYLE | wxDIALOG_MODAL )
pos, wxDefaultSize)
{
m_value = value;
m_max = max;

View File

@ -107,7 +107,6 @@ wxGenericPrintDialog::wxGenericPrintDialog(wxWindow *parent,
: wxDialog(parent, -1, _("Print"),
wxPoint(0, 0), wxSize(600, 600),
wxDEFAULT_DIALOG_STYLE |
wxDIALOG_MODAL |
wxTAB_TRAVERSAL)
{
if ( data )
@ -121,7 +120,6 @@ wxGenericPrintDialog::wxGenericPrintDialog(wxWindow *parent,
: wxDialog(parent, -1, _("Print"),
wxPoint(0, 0), wxSize(600, 600),
wxDEFAULT_DIALOG_STYLE |
wxDIALOG_MODAL |
wxTAB_TRAVERSAL)
{
if ( data )
@ -133,7 +131,7 @@ wxGenericPrintDialog::wxGenericPrintDialog(wxWindow *parent,
void wxGenericPrintDialog::Init(wxWindow * WXUNUSED(parent))
{
// wxDialog::Create(parent, -1, _("Print"), wxPoint(0, 0), wxSize(600, 600),
// wxDEFAULT_DIALOG_STYLE | wxDIALOG_MODAL | wxTAB_TRAVERSAL);
// wxDEFAULT_DIALOG_STYLE | wxTAB_TRAVERSAL);
wxBoxSizer *mainsizer = new wxBoxSizer( wxVERTICAL );
@ -405,7 +403,7 @@ wxDC *wxGenericPrintDialog::GetPrintDC()
// ----------------------------------------------------------------------------
wxGenericPrintSetupDialog::wxGenericPrintSetupDialog(wxWindow *parent, wxPrintData* data):
wxDialog(parent, -1, _("Print Setup"), wxPoint(0, 0), wxSize(600, 600), wxDEFAULT_DIALOG_STYLE|wxDIALOG_MODAL|wxTAB_TRAVERSAL)
wxDialog(parent, -1, _("Print Setup"), wxPoint(0, 0), wxSize(600, 600), wxDEFAULT_DIALOG_STYLE|wxTAB_TRAVERSAL)
{
Init(data);
}
@ -598,7 +596,7 @@ wxGenericPageSetupDialog::wxGenericPageSetupDialog( wxWindow *parent,
_("Page Setup"),
wxPoint(0, 0),
wxSize(600, 600),
wxDIALOG_MODAL|wxDEFAULT_DIALOG_STYLE|wxTAB_TRAVERSAL )
wxDEFAULT_DIALOG_STYLE|wxTAB_TRAVERSAL )
{
if (data)
m_pageData = *data;

View File

@ -144,8 +144,8 @@ wxProgressDialog::wxProgressDialog(wxString const &title,
if ( maximum > 0 )
{
// note that we can't use wxGA_SMOOTH because it happens to also mean
// wxDIALOG_MODAL and will cause the dialog to be modal. Have an extra
// note that we can't use wxGA_SMOOTH because it happens to
// cause the dialog to be modal. Have an extra
// style argument to wxProgressDialog, perhaps.
m_gauge = new wxGauge(this, -1, m_maximum,
wxDefaultPosition, wxDefaultSize,

View File

@ -177,12 +177,6 @@ bool wxDialog::IsModal() const
void wxDialog::SetModal( bool WXUNUSED(flag) )
{
/*
if (flag)
m_windowStyle |= wxDIALOG_MODAL;
else
if (m_windowStyle & wxDIALOG_MODAL) m_windowStyle -= wxDIALOG_MODAL;
*/
wxFAIL_MSG( wxT("wxDialog:SetModal obsolete now") );
}

View File

@ -133,7 +133,7 @@ wxFileDialog::wxFileDialog( wxWindow *parent, const wxString& message,
m_needParent = FALSE;
if (!PreCreation( parent, pos, wxDefaultSize ) ||
!CreateBase( parent, -1, pos, wxDefaultSize, style | wxDIALOG_MODAL, wxDefaultValidator, wxT("filedialog") ))
!CreateBase( parent, wxID_ANY, pos, wxDefaultSize, style, wxDefaultValidator, wxT("filedialog") ))
{
wxFAIL_MSG( wxT("wxXX creation failed") );
return;

View File

@ -177,12 +177,6 @@ bool wxDialog::IsModal() const
void wxDialog::SetModal( bool WXUNUSED(flag) )
{
/*
if (flag)
m_windowStyle |= wxDIALOG_MODAL;
else
if (m_windowStyle & wxDIALOG_MODAL) m_windowStyle -= wxDIALOG_MODAL;
*/
wxFAIL_MSG( wxT("wxDialog:SetModal obsolete now") );
}

View File

@ -133,7 +133,7 @@ wxFileDialog::wxFileDialog( wxWindow *parent, const wxString& message,
m_needParent = FALSE;
if (!PreCreation( parent, pos, wxDefaultSize ) ||
!CreateBase( parent, -1, pos, wxDefaultSize, style | wxDIALOG_MODAL, wxDefaultValidator, wxT("filedialog") ))
!CreateBase( parent, wxID_ANY, pos, wxDefaultSize, style, wxDefaultValidator, wxT("filedialog") ))
{
wxFAIL_MSG( wxT("wxXX creation failed") );
return;