Warning fixes found under hardest mode of OpenWatcom. Seems clean in Borland, MinGW and DMC.
git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@29684 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
This commit is contained in:
@@ -654,7 +654,7 @@ bool DatabaseDemoApp::OnInit()
|
|||||||
// WARNING: Be certain that you do not free this handle
|
// WARNING: Be certain that you do not free this handle
|
||||||
// directly with SQLFreeEnv(). Use either the
|
// directly with SQLFreeEnv(). Use either the
|
||||||
// method ::FreeHenv() or delete the DbConnectInf.
|
// method ::FreeHenv() or delete the DbConnectInf.
|
||||||
DbConnectInf = new wxDbConnectInf(NULL, params.ODBCSource, params.UserName,
|
DbConnectInf = new wxDbConnectInf(NULL, params.ODBCSource, params.UserName,
|
||||||
params.Password, params.DirPath);
|
params.Password, params.DirPath);
|
||||||
|
|
||||||
if (!DbConnectInf || !DbConnectInf->GetHenv())
|
if (!DbConnectInf || !DbConnectInf->GetHenv())
|
||||||
@@ -963,7 +963,7 @@ void DatabaseDemoFrame::BuildEditorDialog()
|
|||||||
wxMessageBox(wxT("Unable to initialize the editor dialog for some reason"),wxT("Error..."),wxOK | wxICON_EXCLAMATION);
|
wxMessageBox(wxT("Unable to initialize the editor dialog for some reason"),wxT("Error..."),wxOK | wxICON_EXCLAMATION);
|
||||||
Close();
|
Close();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
wxMessageBox(wxT("Unable to create the editor dialog for some reason"),wxT("Error..."),wxOK | wxICON_EXCLAMATION);
|
wxMessageBox(wxT("Unable to create the editor dialog for some reason"),wxT("Error..."),wxOK | wxICON_EXCLAMATION);
|
||||||
@@ -985,24 +985,24 @@ void DatabaseDemoFrame::BuildParameterDialog(wxWindow *parent)
|
|||||||
* Constructor note: If no wxDb object is passed in, a new connection to the database
|
* Constructor note: If no wxDb object is passed in, a new connection to the database
|
||||||
* is created for this instance of Ccontact. This can be a slow process depending
|
* is created for this instance of Ccontact. This can be a slow process depending
|
||||||
* on the database engine being used, and some database engines have a limit on the
|
* on the database engine being used, and some database engines have a limit on the
|
||||||
* number of connections (either hard limits, or license restricted) so care should
|
* number of connections (either hard limits, or license restricted) so care should
|
||||||
* be used to use as few connections as is necessary.
|
* be used to use as few connections as is necessary.
|
||||||
*
|
*
|
||||||
* IMPORTANT: Objects which share a wxDb pointer are ALL acted upon whenever a member
|
* IMPORTANT: Objects which share a wxDb pointer are ALL acted upon whenever a member
|
||||||
* function of pDb is called (i.e. CommitTrans() or RollbackTrans(), so if modifying
|
* function of pDb is called (i.e. CommitTrans() or RollbackTrans(), so if modifying
|
||||||
* or creating a table objects which use the same pDb, know that all the objects
|
* or creating a table objects which use the same pDb, know that all the objects
|
||||||
* will be committed or rolled back when any of the objects has this function call made.
|
* will be committed or rolled back when any of the objects has this function call made.
|
||||||
*/
|
*/
|
||||||
Ccontact::Ccontact (wxDb *pwxDb) : wxDbTable(pwxDb ? pwxDb : wxDbGetConnection(wxGetApp().DbConnectInf),
|
Ccontact::Ccontact (wxDb *pwxDb) : wxDbTable(pwxDb ? pwxDb : wxDbGetConnection(wxGetApp().DbConnectInf),
|
||||||
CONTACT_TABLE_NAME, CONTACT_NO_COLS, wxT(""),
|
CONTACT_TABLE_NAME, CONTACT_NO_COLS, wxEmptyString,
|
||||||
!wxDB_QUERY_ONLY, wxGetApp().DbConnectInf->GetDefaultDir())
|
!wxDB_QUERY_ONLY, wxGetApp().DbConnectInf->GetDefaultDir())
|
||||||
{
|
{
|
||||||
// This is used to represent whether the database connection should be released
|
// This is used to represent whether the database connection should be released
|
||||||
// when this instance of the object is deleted. If using the same connection
|
// when this instance of the object is deleted. If using the same connection
|
||||||
// for multiple instance of database objects, then the connection should only be
|
// for multiple instance of database objects, then the connection should only be
|
||||||
// released when the last database instance using the connection is deleted
|
// released when the last database instance using the connection is deleted
|
||||||
freeDbConn = !pwxDb;
|
freeDbConn = !pwxDb;
|
||||||
|
|
||||||
if (GetDb())
|
if (GetDb())
|
||||||
GetDb()->SetSqlLogging(sqlLogON);
|
GetDb()->SetSqlLogging(sqlLogON);
|
||||||
|
|
||||||
@@ -1053,7 +1053,7 @@ Ccontact::~Ccontact()
|
|||||||
|
|
||||||
/*
|
/*
|
||||||
* Handles setting up all the connections for the interface from the wxDbTable
|
* Handles setting up all the connections for the interface from the wxDbTable
|
||||||
* functions to interface to the data structure used to store records in
|
* functions to interface to the data structure used to store records in
|
||||||
* memory, and for all the column definitions that define the table structure
|
* memory, and for all the column definitions that define the table structure
|
||||||
*/
|
*/
|
||||||
void Ccontact::SetupColumns()
|
void Ccontact::SetupColumns()
|
||||||
@@ -1080,7 +1080,7 @@ void Ccontact::SetupColumns()
|
|||||||
|
|
||||||
bool Ccontact::CreateIndexes(bool recreate)
|
bool Ccontact::CreateIndexes(bool recreate)
|
||||||
{
|
{
|
||||||
// This index could easily be accomplished with an "orderBy" clause,
|
// This index could easily be accomplished with an "orderBy" clause,
|
||||||
// but is done to show how to construct a non-primary index.
|
// but is done to show how to construct a non-primary index.
|
||||||
wxString indexName;
|
wxString indexName;
|
||||||
wxDbIdxDef idxDef[2];
|
wxDbIdxDef idxDef[2];
|
||||||
@@ -1134,12 +1134,12 @@ bool Ccontact::FetchByName(const wxString &name)
|
|||||||
* An instance of Ccontact is created - "Contact" - which is used to hold the Ccontact
|
* An instance of Ccontact is created - "Contact" - which is used to hold the Ccontact
|
||||||
* object that is currently being worked with.
|
* object that is currently being worked with.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
BEGIN_EVENT_TABLE(CeditorDlg, wxPanel)
|
BEGIN_EVENT_TABLE(CeditorDlg, wxPanel)
|
||||||
EVT_BUTTON(wxID_ANY, CeditorDlg::OnButton)
|
EVT_BUTTON(wxID_ANY, CeditorDlg::OnButton)
|
||||||
EVT_CLOSE(CeditorDlg::OnCloseWindow)
|
EVT_CLOSE(CeditorDlg::OnCloseWindow)
|
||||||
END_EVENT_TABLE()
|
END_EVENT_TABLE()
|
||||||
|
|
||||||
CeditorDlg::CeditorDlg(wxWindow *parent) : wxPanel (parent, 0, 0, 537, 480)
|
CeditorDlg::CeditorDlg(wxWindow *parent) : wxPanel (parent, 0, 0, 537, 480)
|
||||||
{
|
{
|
||||||
// Since the ::OnCommand() function is overridden, this prevents the widget
|
// Since the ::OnCommand() function is overridden, this prevents the widget
|
||||||
@@ -1180,7 +1180,7 @@ void CeditorDlg::OnButton(wxCommandEvent &event)
|
|||||||
void CeditorDlg::OnCommand(wxWindow& win, wxCommandEvent& WXUNUSED(event))
|
void CeditorDlg::OnCommand(wxWindow& win, wxCommandEvent& WXUNUSED(event))
|
||||||
{
|
{
|
||||||
wxString widgetName;
|
wxString widgetName;
|
||||||
|
|
||||||
widgetName = win.GetName();
|
widgetName = win.GetName();
|
||||||
|
|
||||||
if (!widgetPtrsSet)
|
if (!widgetPtrsSet)
|
||||||
@@ -1221,10 +1221,10 @@ void CeditorDlg::OnCommand(wxWindow& win, wxCommandEvent& WXUNUSED(event))
|
|||||||
|
|
||||||
if (Ok && wxGetApp().Contact->Delete())
|
if (Ok && wxGetApp().Contact->Delete())
|
||||||
{
|
{
|
||||||
// NOTE: Deletions are not finalized until a CommitTrans() is performed.
|
// NOTE: Deletions are not finalized until a CommitTrans() is performed.
|
||||||
// If the commit were not performed, the program will continue to
|
// If the commit were not performed, the program will continue to
|
||||||
// show the table contents as if they were deleted until this instance
|
// show the table contents as if they were deleted until this instance
|
||||||
// of Ccontact is deleted. If the Commit wasn't performed, the
|
// of Ccontact is deleted. If the Commit wasn't performed, the
|
||||||
// database will automatically Rollback the changes when the database
|
// database will automatically Rollback the changes when the database
|
||||||
// connection is terminated
|
// connection is terminated
|
||||||
wxGetApp().Contact->GetDb()->CommitTrans();
|
wxGetApp().Contact->GetDb()->CommitTrans();
|
||||||
@@ -1300,7 +1300,7 @@ void CeditorDlg::OnCommand(wxWindow& win, wxCommandEvent& WXUNUSED(event))
|
|||||||
tStr = wxT("ODBC error during Query()\n\n");
|
tStr = wxT("ODBC error during Query()\n\n");
|
||||||
wxMessageBox(wxDbLogExtendedErrorMsg(tStr.c_str(),wxGetApp().Contact->GetDb(),__TFILE__,__LINE__),
|
wxMessageBox(wxDbLogExtendedErrorMsg(tStr.c_str(),wxGetApp().Contact->GetDb(),__TFILE__,__LINE__),
|
||||||
wxT("ODBC Error..."),wxOK | wxICON_EXCLAMATION);
|
wxT("ODBC Error..."),wxOK | wxICON_EXCLAMATION);
|
||||||
|
|
||||||
SetMode(mView);
|
SetMode(mView);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
@@ -1352,7 +1352,7 @@ void CeditorDlg::OnCommand(wxWindow& win, wxCommandEvent& WXUNUSED(event))
|
|||||||
wxGetApp().Contact->whereStr = wxT("NAME = (SELECT MIN(NAME) FROM ");
|
wxGetApp().Contact->whereStr = wxT("NAME = (SELECT MIN(NAME) FROM ");
|
||||||
wxGetApp().Contact->whereStr += CONTACT_TABLE_NAME;
|
wxGetApp().Contact->whereStr += CONTACT_TABLE_NAME;
|
||||||
}
|
}
|
||||||
|
|
||||||
// Append the query where string (if there is one)
|
// Append the query where string (if there is one)
|
||||||
wxGetApp().Contact->qryWhereStr = qryWhere;
|
wxGetApp().Contact->qryWhereStr = qryWhere;
|
||||||
if (wxStrlen(qryWhere))
|
if (wxStrlen(qryWhere))
|
||||||
@@ -1470,7 +1470,7 @@ void CeditorDlg::OnCommand(wxWindow& win, wxCommandEvent& WXUNUSED(event))
|
|||||||
|
|
||||||
bool CeditorDlg::Initialize()
|
bool CeditorDlg::Initialize()
|
||||||
{
|
{
|
||||||
// Create the data structure and a new database connection.
|
// Create the data structure and a new database connection.
|
||||||
// (As there is not a pDb being passed in the constructor, a new database
|
// (As there is not a pDb being passed in the constructor, a new database
|
||||||
// connection is created)
|
// connection is created)
|
||||||
wxGetApp().Contact = new Ccontact();
|
wxGetApp().Contact = new Ccontact();
|
||||||
@@ -1481,10 +1481,10 @@ bool CeditorDlg::Initialize()
|
|||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
// Check if the table exists or not. If it doesn't, ask the user if they want to
|
// Check if the table exists or not. If it doesn't, ask the user if they want to
|
||||||
// create the table. Continue trying to create the table until it exists, or user aborts
|
// create the table. Continue trying to create the table until it exists, or user aborts
|
||||||
while (!wxGetApp().Contact->GetDb()->TableExists((wxChar *)CONTACT_TABLE_NAME,
|
while (!wxGetApp().Contact->GetDb()->TableExists((wxChar *)CONTACT_TABLE_NAME,
|
||||||
wxGetApp().DbConnectInf->GetUserID(),
|
wxGetApp().DbConnectInf->GetUserID(),
|
||||||
wxGetApp().DbConnectInf->GetDefaultDir()))
|
wxGetApp().DbConnectInf->GetDefaultDir()))
|
||||||
{
|
{
|
||||||
wxString tStr;
|
wxString tStr;
|
||||||
@@ -1522,7 +1522,7 @@ bool CeditorDlg::Initialize()
|
|||||||
wxMessageBox(wxDbLogExtendedErrorMsg(tStr.c_str(),wxGetApp().Contact->GetDb(),__TFILE__,__LINE__),
|
wxMessageBox(wxDbLogExtendedErrorMsg(tStr.c_str(),wxGetApp().Contact->GetDb(),__TFILE__,__LINE__),
|
||||||
wxT("ODBC Error..."),wxOK | wxICON_EXCLAMATION);
|
wxT("ODBC Error..."),wxOK | wxICON_EXCLAMATION);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
#endif
|
#endif
|
||||||
if (!wxGetApp().Contact->GetDb()->TableExists(CONTACT_TABLE_NAME,
|
if (!wxGetApp().Contact->GetDb()->TableExists(CONTACT_TABLE_NAME,
|
||||||
wxGetApp().Contact->GetDb()->GetUsername(),
|
wxGetApp().Contact->GetDb()->GetUsername(),
|
||||||
@@ -1593,14 +1593,14 @@ bool CeditorDlg::Initialize()
|
|||||||
pDataTypesBtn = new wxButton(this, EDITOR_DIALOG_DATATYPES, wxT("Data&types"), wxPoint(430, 337), wxSize( 70, 35), 0, wxDefaultValidator, wxT("DataTypesBtn"));
|
pDataTypesBtn = new wxButton(this, EDITOR_DIALOG_DATATYPES, wxT("Data&types"), wxPoint(430, 337), wxSize( 70, 35), 0, wxDefaultValidator, wxT("DataTypesBtn"));
|
||||||
pDbDiagsBtn = new wxButton(this, EDITOR_DIALOG_DB_DIAGS, wxT("DB Dia&gs"), wxPoint(430, 387), wxSize( 70, 35), 0, wxDefaultValidator, wxT("DbDiagsBtn"));
|
pDbDiagsBtn = new wxButton(this, EDITOR_DIALOG_DB_DIAGS, wxT("DB Dia&gs"), wxPoint(430, 387), wxSize( 70, 35), 0, wxDefaultValidator, wxT("DbDiagsBtn"));
|
||||||
|
|
||||||
// Now that all the widgets on the panel are created, its safe to allow ::OnCommand() to
|
// Now that all the widgets on the panel are created, its safe to allow ::OnCommand() to
|
||||||
// handle all widget processing
|
// handle all widget processing
|
||||||
widgetPtrsSet = true;
|
widgetPtrsSet = true;
|
||||||
|
|
||||||
// Setup the orderBy and where clauses to return back a single record as the result set,
|
// Setup the orderBy and where clauses to return back a single record as the result set,
|
||||||
// as there will only be one record being shown on the dialog at a time, this optimizes
|
// as there will only be one record being shown on the dialog at a time, this optimizes
|
||||||
// network traffic by only returning a one row result
|
// network traffic by only returning a one row result
|
||||||
|
|
||||||
wxGetApp().Contact->SetOrderByClause(wxT("NAME")); // field name to sort by
|
wxGetApp().Contact->SetOrderByClause(wxT("NAME")); // field name to sort by
|
||||||
|
|
||||||
// The wxString "whereStr" is not a member of the wxDbTable object, it is a member variable
|
// The wxString "whereStr" is not a member of the wxDbTable object, it is a member variable
|
||||||
@@ -1608,9 +1608,9 @@ bool CeditorDlg::Initialize()
|
|||||||
// length string, and then after the string is built, the wxDbTable member variable "where" is
|
// length string, and then after the string is built, the wxDbTable member variable "where" is
|
||||||
// assigned the pointer to the constructed string.
|
// assigned the pointer to the constructed string.
|
||||||
//
|
//
|
||||||
// The constructed where clause below has a sub-query within it "SELECT MIN(NAME) FROM %s"
|
// The constructed where clause below has a sub-query within it "SELECT MIN(NAME) FROM %s"
|
||||||
// to achieve a single row (in this case the first name in alphabetical order).
|
// to achieve a single row (in this case the first name in alphabetical order).
|
||||||
|
|
||||||
if (wxGetApp().Contact->GetDb()->Dbms() != dbmsPOSTGRES &&
|
if (wxGetApp().Contact->GetDb()->Dbms() != dbmsPOSTGRES &&
|
||||||
wxGetApp().Contact->GetDb()->Dbms() != dbmsMY_SQL)
|
wxGetApp().Contact->GetDb()->Dbms() != dbmsMY_SQL)
|
||||||
{
|
{
|
||||||
@@ -1622,8 +1622,8 @@ bool CeditorDlg::Initialize()
|
|||||||
else
|
else
|
||||||
wxGetApp().Contact->SetWhereClause(wxT(""));
|
wxGetApp().Contact->SetWhereClause(wxT(""));
|
||||||
|
|
||||||
// Perform the Query to get the result set.
|
// Perform the Query to get the result set.
|
||||||
// NOTE: If there are no rows returned, that is a valid result, so Query() would return true.
|
// NOTE: If there are no rows returned, that is a valid result, so Query() would return true.
|
||||||
// Only if there is a database error will Query() come back as false
|
// Only if there is a database error will Query() come back as false
|
||||||
if (!wxGetApp().Contact->Query())
|
if (!wxGetApp().Contact->Query())
|
||||||
{
|
{
|
||||||
@@ -1636,8 +1636,8 @@ bool CeditorDlg::Initialize()
|
|||||||
|
|
||||||
// Since Query succeeded, now get the row that was returned
|
// Since Query succeeded, now get the row that was returned
|
||||||
if (!wxGetApp().Contact->GetNext())
|
if (!wxGetApp().Contact->GetNext())
|
||||||
// If the GetNext() failed at this point, then there are no rows to retrieve,
|
// If the GetNext() failed at this point, then there are no rows to retrieve,
|
||||||
// so clear the values in the members of "Contact" so that PutData() blanks the
|
// so clear the values in the members of "Contact" so that PutData() blanks the
|
||||||
// widgets on the dialog
|
// widgets on the dialog
|
||||||
wxGetApp().Contact->Initialize();
|
wxGetApp().Contact->Initialize();
|
||||||
/*
|
/*
|
||||||
@@ -1817,9 +1817,9 @@ bool CeditorDlg::GetData()
|
|||||||
|
|
||||||
if (!invalid)
|
if (!invalid)
|
||||||
{
|
{
|
||||||
wxGetApp().Contact->JoinDate.month = mm;
|
wxGetApp().Contact->JoinDate.month = (SQLUSMALLINT)mm;
|
||||||
wxGetApp().Contact->JoinDate.day = dd;
|
wxGetApp().Contact->JoinDate.day = (SQLUSMALLINT)dd;
|
||||||
wxGetApp().Contact->JoinDate.year = yyyy;
|
wxGetApp().Contact->JoinDate.year = (SQLSMALLINT)yyyy;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
@@ -1836,7 +1836,7 @@ bool CeditorDlg::GetData()
|
|||||||
wxStrcpy(wxGetApp().Contact->Country,pCountryTxt->GetValue());
|
wxStrcpy(wxGetApp().Contact->Country,pCountryTxt->GetValue());
|
||||||
wxStrcpy(wxGetApp().Contact->PostalCode,pPostalCodeTxt->GetValue());
|
wxStrcpy(wxGetApp().Contact->PostalCode,pPostalCodeTxt->GetValue());
|
||||||
|
|
||||||
wxGetApp().Contact->Contributions = wxAtoi(pContribTxt->GetValue());
|
wxGetApp().Contact->Contributions = (UCHAR)wxAtoi(pContribTxt->GetValue());
|
||||||
wxGetApp().Contact->LinesOfCode = wxAtol(pLinesTxt->GetValue());
|
wxGetApp().Contact->LinesOfCode = wxAtol(pLinesTxt->GetValue());
|
||||||
|
|
||||||
wxGetApp().Contact->NativeLanguage = (enum Language) pNativeLangChoice->GetSelection();
|
wxGetApp().Contact->NativeLanguage = (enum Language) pNativeLangChoice->GetSelection();
|
||||||
@@ -1870,7 +1870,7 @@ bool CeditorDlg::Save()
|
|||||||
|
|
||||||
if (mode == mCreate)
|
if (mode == mCreate)
|
||||||
{
|
{
|
||||||
RETCODE result = wxGetApp().Contact->Insert();
|
RETCODE result = (RETCODE)wxGetApp().Contact->Insert();
|
||||||
|
|
||||||
failed = (result != DB_SUCCESS);
|
failed = (result != DB_SUCCESS);
|
||||||
if (failed)
|
if (failed)
|
||||||
@@ -2054,7 +2054,7 @@ CparameterDlg::CparameterDlg(wxWindow *parent) : wxDialog (parent, PARAMETER_DIA
|
|||||||
pParamSaveBtn = new wxButton(this, PARAMETER_DIALOG_SAVE, wxT("&Save"), wxPoint(310, 21), wxSize( 70, 35), 0, wxDefaultValidator, wxT("ParamSaveBtn"));
|
pParamSaveBtn = new wxButton(this, PARAMETER_DIALOG_SAVE, wxT("&Save"), wxPoint(310, 21), wxSize( 70, 35), 0, wxDefaultValidator, wxT("ParamSaveBtn"));
|
||||||
pParamCancelBtn = new wxButton(this, PARAMETER_DIALOG_CANCEL, wxT("C&ancel"), wxPoint(310, 66), wxSize( 70, 35), 0, wxDefaultValidator, wxT("ParamCancelBtn"));
|
pParamCancelBtn = new wxButton(this, PARAMETER_DIALOG_CANCEL, wxT("C&ancel"), wxPoint(310, 66), wxSize( 70, 35), 0, wxDefaultValidator, wxT("ParamCancelBtn"));
|
||||||
|
|
||||||
// Now that all the widgets on the panel are created, its safe to allow ::OnCommand() to
|
// Now that all the widgets on the panel are created, its safe to allow ::OnCommand() to
|
||||||
// handle all widget processing
|
// handle all widget processing
|
||||||
widgetPtrsSet = true;
|
widgetPtrsSet = true;
|
||||||
|
|
||||||
@@ -2074,13 +2074,13 @@ void CparameterDlg::OnCloseWindow(wxCloseEvent& event)
|
|||||||
if (!saved)
|
if (!saved)
|
||||||
{
|
{
|
||||||
bool Ok = (wxMessageBox(wxT("No changes have been saved.\n\nAre you sure you wish exit the parameter screen?"),wxT("Confirm"),wxYES_NO|wxICON_QUESTION) == wxYES);
|
bool Ok = (wxMessageBox(wxT("No changes have been saved.\n\nAre you sure you wish exit the parameter screen?"),wxT("Confirm"),wxYES_NO|wxICON_QUESTION) == wxYES);
|
||||||
|
|
||||||
if (!Ok)
|
if (!Ok)
|
||||||
{
|
{
|
||||||
event.Veto();
|
event.Veto();
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
wxGetApp().params = savedParamSettings;
|
wxGetApp().params = savedParamSettings;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -2107,7 +2107,7 @@ void CparameterDlg::OnButton( wxCommandEvent &event )
|
|||||||
void CparameterDlg::OnCommand(wxWindow& win, wxCommandEvent& WXUNUSED(event))
|
void CparameterDlg::OnCommand(wxWindow& win, wxCommandEvent& WXUNUSED(event))
|
||||||
{
|
{
|
||||||
wxString widgetName;
|
wxString widgetName;
|
||||||
|
|
||||||
widgetName = win.GetName();
|
widgetName = win.GetName();
|
||||||
|
|
||||||
if (!widgetPtrsSet)
|
if (!widgetPtrsSet)
|
||||||
@@ -2172,7 +2172,7 @@ bool CparameterDlg::GetData()
|
|||||||
}
|
}
|
||||||
else
|
else
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
tStr = pParamUserNameTxt->GetValue();
|
tStr = pParamUserNameTxt->GetValue();
|
||||||
if (tStr.Length() > (sizeof(wxGetApp().params.UserName)-1))
|
if (tStr.Length() > (sizeof(wxGetApp().params.UserName)-1))
|
||||||
{
|
{
|
||||||
@@ -2248,9 +2248,9 @@ BEGIN_EVENT_TABLE(CqueryDlg, wxDialog)
|
|||||||
EVT_CLOSE(CqueryDlg::OnCloseWindow)
|
EVT_CLOSE(CqueryDlg::OnCloseWindow)
|
||||||
END_EVENT_TABLE()
|
END_EVENT_TABLE()
|
||||||
|
|
||||||
|
|
||||||
// CqueryDlg() constructor
|
// CqueryDlg() constructor
|
||||||
CqueryDlg::CqueryDlg(wxWindow *parent, wxDb *pDb, wxChar *tblName[],
|
CqueryDlg::CqueryDlg(wxWindow *parent, wxDb *pDb, wxChar *tblName[],
|
||||||
const wxString &pWhereArg) :
|
const wxString &pWhereArg) :
|
||||||
wxDialog (parent, QUERY_DIALOG, wxT("Query"), wxDefaultPosition, wxSize(480, 360))
|
wxDialog (parent, QUERY_DIALOG, wxT("Query"), wxDefaultPosition, wxSize(480, 360))
|
||||||
{
|
{
|
||||||
@@ -2363,11 +2363,6 @@ CqueryDlg::CqueryDlg(wxWindow *parent, wxDb *pDb, wxChar *tblName[],
|
|||||||
} // CqueryDlg() constructor
|
} // CqueryDlg() constructor
|
||||||
|
|
||||||
|
|
||||||
CqueryDlg::~CqueryDlg()
|
|
||||||
{
|
|
||||||
} // CqueryDlg::~CqueryDlg() destructor
|
|
||||||
|
|
||||||
|
|
||||||
void CqueryDlg::OnButton(wxCommandEvent &event)
|
void CqueryDlg::OnButton(wxCommandEvent &event)
|
||||||
{
|
{
|
||||||
wxWindow *win = (wxWindow*) event.GetEventObject();
|
wxWindow *win = (wxWindow*) event.GetEventObject();
|
||||||
@@ -2630,10 +2625,10 @@ void CqueryDlg::ProcessAddBtn()
|
|||||||
|
|
||||||
// Build the expression and append it to the where clause window
|
// Build the expression and append it to the where clause window
|
||||||
wxString s = pQueryCol1Choice->GetStringSelection();
|
wxString s = pQueryCol1Choice->GetStringSelection();
|
||||||
|
|
||||||
if (pQueryNotCheck->GetValue() && (oper != qryOpEQ))
|
if (pQueryNotCheck->GetValue() && (oper != qryOpEQ))
|
||||||
s += wxT(" NOT");
|
s += wxT(" NOT");
|
||||||
|
|
||||||
switch(oper)
|
switch(oper)
|
||||||
{
|
{
|
||||||
case qryOpEQ:
|
case qryOpEQ:
|
||||||
@@ -2712,8 +2707,8 @@ void CqueryDlg::ProcessCountBtn()
|
|||||||
|
|
||||||
if (!dbTable) // wxDbTable object needs to be created and opened
|
if (!dbTable) // wxDbTable object needs to be created and opened
|
||||||
{
|
{
|
||||||
dbTable = new wxDbTable(pDB, masterTableName, 0, wxT(""),
|
dbTable = new wxDbTable(pDB, masterTableName, 0, wxEmptyString,
|
||||||
!wxDB_QUERY_ONLY,
|
!wxDB_QUERY_ONLY,
|
||||||
wxGetApp().DbConnectInf->GetDefaultDir());
|
wxGetApp().DbConnectInf->GetDefaultDir());
|
||||||
if (!dbTable)
|
if (!dbTable)
|
||||||
{
|
{
|
||||||
@@ -3155,13 +3150,13 @@ bool DbGridFrame::Initialize()
|
|||||||
grid->RegisterDataType(wxGRID_VALUE_CHOICEINT,
|
grid->RegisterDataType(wxGRID_VALUE_CHOICEINT,
|
||||||
new wxGridCellEnumRenderer,
|
new wxGridCellEnumRenderer,
|
||||||
new wxGridCellEnumEditor);
|
new wxGridCellEnumEditor);
|
||||||
|
|
||||||
wxString NativeLangChoice( wxString::Format(wxT("%s:%s,%s,%s,%s,%s"),wxGRID_VALUE_CHOICEINT,
|
wxString NativeLangChoice( wxString::Format(wxT("%s:%s,%s,%s,%s,%s"),wxGRID_VALUE_CHOICEINT,
|
||||||
wxT("English"),
|
wxT("English"),
|
||||||
wxT("French"),
|
wxT("French"),
|
||||||
wxT("German"),
|
wxT("German"),
|
||||||
wxT("Spanish"),
|
wxT("Spanish"),
|
||||||
wxT("Other") ));
|
wxT("Other") ));
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
// Columns must match the sequence specified in SetColDef() calls
|
// Columns must match the sequence specified in SetColDef() calls
|
||||||
@@ -3179,7 +3174,7 @@ bool DbGridFrame::Initialize()
|
|||||||
new wxDbGridColInfo(10,wxGRID_VALUE_NUMBER,wxT("Lines Of Code"),
|
new wxDbGridColInfo(10,wxGRID_VALUE_NUMBER,wxT("Lines Of Code"),
|
||||||
#ifdef CHOICEINT
|
#ifdef CHOICEINT
|
||||||
new wxDbGridColInfo(11,NativeLangChoice, wxT("Native Language"),NULL))))))))))));
|
new wxDbGridColInfo(11,NativeLangChoice, wxT("Native Language"),NULL))))))))))));
|
||||||
#else
|
#else
|
||||||
new wxDbGridColInfo(11,wxGRID_VALUE_NUMBER,wxT("Native Language"),NULL))))))))))));
|
new wxDbGridColInfo(11,wxGRID_VALUE_NUMBER,wxT("Native Language"),NULL))))))))))));
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
@@ -68,7 +68,7 @@ void DisplayDbDiagnostics(wxDb *pDb);
|
|||||||
|
|
||||||
//
|
//
|
||||||
// This class contains the actual data members that are used for transferring
|
// This class contains the actual data members that are used for transferring
|
||||||
// data back and forth from the database to the program.
|
// data back and forth from the database to the program.
|
||||||
//
|
//
|
||||||
// NOTE: The object described in this class is just for example purposes, and has no
|
// NOTE: The object described in this class is just for example purposes, and has no
|
||||||
// real meaning other than to show each type of field being used by the database
|
// real meaning other than to show each type of field being used by the database
|
||||||
@@ -99,10 +99,10 @@ class CstructContact : public wxObject
|
|||||||
// all combined in this one class.
|
// all combined in this one class.
|
||||||
//
|
//
|
||||||
class Ccontact : public wxDbTable, public CstructContact
|
class Ccontact : public wxDbTable, public CstructContact
|
||||||
{
|
{
|
||||||
private:
|
private:
|
||||||
// Used to keep track of whether this class had a wxDb instance
|
// Used to keep track of whether this class had a wxDb instance
|
||||||
// passed in to it or not. If an existing wxDb instance was not
|
// passed in to it or not. If an existing wxDb instance was not
|
||||||
// passed in at Ccontact creation time, then when the Ccontact
|
// passed in at Ccontact creation time, then when the Ccontact
|
||||||
// instance is deleted, the connection will be freed as Ccontact
|
// instance is deleted, the connection will be freed as Ccontact
|
||||||
// created its own connection when it was created.
|
// created its own connection when it was created.
|
||||||
@@ -114,7 +114,7 @@ class Ccontact : public wxDbTable, public CstructContact
|
|||||||
void SetupColumns();
|
void SetupColumns();
|
||||||
|
|
||||||
public:
|
public:
|
||||||
// Used in places where we need to construct a WHERE clause to
|
// Used in places where we need to construct a WHERE clause to
|
||||||
// be passed to the SetWhereClause() function. From example,
|
// be passed to the SetWhereClause() function. From example,
|
||||||
// where building the WHERE clause requires using ::Printf()
|
// where building the WHERE clause requires using ::Printf()
|
||||||
// to build the string.
|
// to build the string.
|
||||||
@@ -151,7 +151,7 @@ typedef struct Cparameters
|
|||||||
|
|
||||||
// Define a new frame type
|
// Define a new frame type
|
||||||
class DatabaseDemoFrame: public wxFrame
|
class DatabaseDemoFrame: public wxFrame
|
||||||
{
|
{
|
||||||
private:
|
private:
|
||||||
CeditorDlg *pEditorDlg;
|
CeditorDlg *pEditorDlg;
|
||||||
CparameterDlg *pParamDlg;
|
CparameterDlg *pParamDlg;
|
||||||
@@ -169,7 +169,7 @@ class DatabaseDemoFrame: public wxFrame
|
|||||||
void OnAbout(wxCommandEvent& event);
|
void OnAbout(wxCommandEvent& event);
|
||||||
#if wxUSE_GRID
|
#if wxUSE_GRID
|
||||||
void OnDbGridTable( wxCommandEvent& );
|
void OnDbGridTable( wxCommandEvent& );
|
||||||
#endif
|
#endif
|
||||||
void CreateDataTable(bool recreate);
|
void CreateDataTable(bool recreate);
|
||||||
void BuildEditorDialog();
|
void BuildEditorDialog();
|
||||||
void BuildParameterDialog(wxWindow *parent);
|
void BuildParameterDialog(wxWindow *parent);
|
||||||
@@ -212,26 +212,26 @@ class DatabaseDemoApp: public wxApp
|
|||||||
// Pointer to the main database connection used in the program. This
|
// Pointer to the main database connection used in the program. This
|
||||||
// pointer would normally be used for doing things as database lookups
|
// pointer would normally be used for doing things as database lookups
|
||||||
// for user login names and passwords, getting workstation settings, etc.
|
// for user login names and passwords, getting workstation settings, etc.
|
||||||
//
|
//
|
||||||
// ---> IMPORTANT <---
|
// ---> IMPORTANT <---
|
||||||
//
|
//
|
||||||
// For each database object created which uses this wxDb pointer
|
// For each database object created which uses this wxDb pointer
|
||||||
// connection to the database, when a CommitTrans() or RollBackTrans()
|
// connection to the database, when a CommitTrans() or RollBackTrans()
|
||||||
// will commit or rollback EVERY object which uses this wxDb pointer.
|
// will commit or rollback EVERY object which uses this wxDb pointer.
|
||||||
//
|
//
|
||||||
// To allow each table object (those derived from wxDbTable) to be
|
// To allow each table object (those derived from wxDbTable) to be
|
||||||
// individually committed or rolled back, you MUST use a different
|
// individually committed or rolled back, you MUST use a different
|
||||||
// instance of wxDb in the constructor of the table. Doing so creates
|
// instance of wxDb in the constructor of the table. Doing so creates
|
||||||
// more overhead, and will use more database connections (some DBs have
|
// more overhead, and will use more database connections (some DBs have
|
||||||
// connection limits...), so use connections sparringly.
|
// connection limits...), so use connections sparringly.
|
||||||
//
|
//
|
||||||
// It is recommended that one "main" database connection be created for
|
// It is recommended that one "main" database connection be created for
|
||||||
// the entire program to use for READ-ONLY database accesses, but for each
|
// the entire program to use for READ-ONLY database accesses, but for each
|
||||||
// table object which will do a CommitTrans() or RollbackTrans() that a
|
// table object which will do a CommitTrans() or RollbackTrans() that a
|
||||||
// new wxDb object be created and used for it.
|
// new wxDb object be created and used for it.
|
||||||
wxDb *READONLY_DB;
|
wxDb *READONLY_DB;
|
||||||
|
|
||||||
// Contains the ODBC connection information used by
|
// Contains the ODBC connection information used by
|
||||||
// all database connections
|
// all database connections
|
||||||
wxDbConnectInf *DbConnectInf;
|
wxDbConnectInf *DbConnectInf;
|
||||||
|
|
||||||
@@ -259,13 +259,13 @@ class CeditorDlg : public wxPanel
|
|||||||
{
|
{
|
||||||
private:
|
private:
|
||||||
// Used to indicate whether all of the widget pointers (defined
|
// Used to indicate whether all of the widget pointers (defined
|
||||||
// below) have been initialized to point to the memory for
|
// below) have been initialized to point to the memory for
|
||||||
// the named widget. Used as a safeguard from using the widget
|
// the named widget. Used as a safeguard from using the widget
|
||||||
// before it has been initialized.
|
// before it has been initialized.
|
||||||
bool widgetPtrsSet;
|
bool widgetPtrsSet;
|
||||||
|
|
||||||
// Used when the EDIT button has been pressed to maintain the
|
// Used when the EDIT button has been pressed to maintain the
|
||||||
// original name that was displayed in the editor before the
|
// original name that was displayed in the editor before the
|
||||||
// EDIT button was pressed, so that if CANCEL is pressed, a
|
// EDIT button was pressed, so that if CANCEL is pressed, a
|
||||||
// FetchByName() can be done to retrieve the original data
|
// FetchByName() can be done to retrieve the original data
|
||||||
// to repopulate the dialog.
|
// to repopulate the dialog.
|
||||||
@@ -318,7 +318,7 @@ class CeditorDlg : public wxPanel
|
|||||||
// retrieved from the editor dialog
|
// retrieved from the editor dialog
|
||||||
bool Save();
|
bool Save();
|
||||||
|
|
||||||
// Database functions for changing the data that is to
|
// Database functions for changing the data that is to
|
||||||
// be displayed on the dialog. GetNextRec()/GetPrevRec()
|
// be displayed on the dialog. GetNextRec()/GetPrevRec()
|
||||||
// provide database independent methods that do not require
|
// provide database independent methods that do not require
|
||||||
// backward scrolling cursors to obtain the record that
|
// backward scrolling cursors to obtain the record that
|
||||||
@@ -326,7 +326,7 @@ class CeditorDlg : public wxPanel
|
|||||||
bool GetNextRec();
|
bool GetNextRec();
|
||||||
bool GetPrevRec();
|
bool GetPrevRec();
|
||||||
bool GetRec(const wxString &whereStr);
|
bool GetRec(const wxString &whereStr);
|
||||||
|
|
||||||
DECLARE_EVENT_TABLE()
|
DECLARE_EVENT_TABLE()
|
||||||
}; // CeditorDlg
|
}; // CeditorDlg
|
||||||
|
|
||||||
@@ -381,14 +381,14 @@ class CparameterDlg : public wxDialog
|
|||||||
{
|
{
|
||||||
private:
|
private:
|
||||||
// Used to indicate whether all of the widget pointers (defined
|
// Used to indicate whether all of the widget pointers (defined
|
||||||
// below) have been initialized to point to the memory for
|
// below) have been initialized to point to the memory for
|
||||||
// the named widget. Used as a safeguard from using the widget
|
// the named widget. Used as a safeguard from using the widget
|
||||||
// before it has been initialized.
|
// before it has been initialized.
|
||||||
bool widgetPtrsSet;
|
bool widgetPtrsSet;
|
||||||
|
|
||||||
enum DialogModes mode;
|
enum DialogModes mode;
|
||||||
|
|
||||||
// Have the parameters been saved yet, or do they
|
// Have the parameters been saved yet, or do they
|
||||||
// need to be saved to update the params on disk
|
// need to be saved to update the params on disk
|
||||||
bool saved;
|
bool saved;
|
||||||
|
|
||||||
@@ -480,7 +480,7 @@ class CqueryDlg : public wxDialog
|
|||||||
|
|
||||||
public:
|
public:
|
||||||
// Used to indicate whether all of the widget pointers (defined
|
// Used to indicate whether all of the widget pointers (defined
|
||||||
// below) have been initialized to point to the memory for
|
// below) have been initialized to point to the memory for
|
||||||
// the named widget. Used as a safeguard from using the widget
|
// the named widget. Used as a safeguard from using the widget
|
||||||
// before it has been initialized.
|
// before it has been initialized.
|
||||||
bool widgetPtrsSet;
|
bool widgetPtrsSet;
|
||||||
@@ -515,7 +515,7 @@ class CqueryDlg : public wxDialog
|
|||||||
wxTextCtrl *pFocusTxt;
|
wxTextCtrl *pFocusTxt;
|
||||||
|
|
||||||
CqueryDlg(wxWindow *parent, wxDb *pDb, wxChar *tblName[], const wxString &pWhereArg);
|
CqueryDlg(wxWindow *parent, wxDb *pDb, wxChar *tblName[], const wxString &pWhereArg);
|
||||||
~CqueryDlg();
|
~CqueryDlg(){};
|
||||||
|
|
||||||
void OnButton( wxCommandEvent &event );
|
void OnButton( wxCommandEvent &event );
|
||||||
void OnCommand(wxWindow& win, wxCommandEvent& event);
|
void OnCommand(wxWindow& win, wxCommandEvent& event);
|
||||||
@@ -572,7 +572,7 @@ wxChar * const langDBINF_OUTER_JOINS = wxT("Outer Joins = ");
|
|||||||
wxChar * const langDBINF_STORED_PROC = wxT("Stored Procedures = ");
|
wxChar * const langDBINF_STORED_PROC = wxT("Stored Procedures = ");
|
||||||
wxChar * const langDBINF_MAX_HDBC = wxT("Max # of Db connections = ");
|
wxChar * const langDBINF_MAX_HDBC = wxT("Max # of Db connections = ");
|
||||||
wxChar * const langDBINF_MAX_HSTMT = wxT("Max # of cursors (per db connection) = ");
|
wxChar * const langDBINF_MAX_HSTMT = wxT("Max # of cursors (per db connection) = ");
|
||||||
wxChar * const langDBINF_UNLIMITED = wxT("Unlimited or Unknown");
|
wxChar * const langDBINF_UNLIMITED = wxT("Unlimited or Unknown");
|
||||||
wxChar * const langDBINF_API_LVL = wxT("ODBC API conformance level = ");
|
wxChar * const langDBINF_API_LVL = wxT("ODBC API conformance level = ");
|
||||||
wxChar * const langDBINF_CLI_LVL = wxT("Client (SAG) conformance level = ");
|
wxChar * const langDBINF_CLI_LVL = wxT("Client (SAG) conformance level = ");
|
||||||
wxChar * const langDBINF_SQL_LVL = wxT("SQL conformance level = ");
|
wxChar * const langDBINF_SQL_LVL = wxT("SQL conformance level = ");
|
||||||
|
@@ -15,7 +15,7 @@
|
|||||||
Member functions for the classes defined in LISTDB.H
|
Member functions for the classes defined in LISTDB.H
|
||||||
|
|
||||||
This class is used to present a generic ListBox lookup window for
|
This class is used to present a generic ListBox lookup window for
|
||||||
use with any of the object creation/selection choice widgets. This
|
use with any of the object creation/selection choice widgets. This
|
||||||
dialog window will present a (possibly) scrolling list of values
|
dialog window will present a (possibly) scrolling list of values
|
||||||
that come from a data table source. Based on the object type passed
|
that come from a data table source. Based on the object type passed
|
||||||
in the constructor, a ListBox is built to present the user with a
|
in the constructor, a ListBox is built to present the user with a
|
||||||
@@ -28,7 +28,7 @@
|
|||||||
For each object (database) type that is to be used, an overridden
|
For each object (database) type that is to be used, an overridden
|
||||||
constructor should be written to appropriately link to the proper
|
constructor should be written to appropriately link to the proper
|
||||||
data table/object for building the list.
|
data table/object for building the list.
|
||||||
|
|
||||||
The data table record access is all handled through the routines
|
The data table record access is all handled through the routines
|
||||||
in this module, interfacing with the methods defined in wxDbTable.
|
in this module, interfacing with the methods defined in wxDbTable.
|
||||||
|
|
||||||
@@ -36,7 +36,7 @@
|
|||||||
have opened the table prior to passing them in the dialog
|
have opened the table prior to passing them in the dialog
|
||||||
constructor, and the 'where' query should already have been set
|
constructor, and the 'where' query should already have been set
|
||||||
and performed before creating this dialog instance.
|
and performed before creating this dialog instance.
|
||||||
|
|
||||||
// SYNOPSIS STOP
|
// SYNOPSIS STOP
|
||||||
*/
|
*/
|
||||||
|
|
||||||
@@ -108,7 +108,7 @@ const wxChar *GetExtendedDBErrorMsg2(wxDb *pDb, wxChar *ErrFile, int ErrLine)
|
|||||||
|
|
||||||
msg.Append (wxT("\nODBC errors:\n"));
|
msg.Append (wxT("\nODBC errors:\n"));
|
||||||
msg += wxT("\n");
|
msg += wxT("\n");
|
||||||
|
|
||||||
// Display errors for this connection
|
// Display errors for this connection
|
||||||
int i;
|
int i;
|
||||||
for (i = 0; i < DB_MAX_ERROR_HISTORY; i++)
|
for (i = 0; i < DB_MAX_ERROR_HISTORY; i++)
|
||||||
@@ -131,7 +131,7 @@ const wxChar *GetExtendedDBErrorMsg2(wxDb *pDb, wxChar *ErrFile, int ErrLine)
|
|||||||
|
|
||||||
// Clookup constructor
|
// Clookup constructor
|
||||||
Clookup::Clookup(wxChar *tblName, wxChar *colName, wxDb *pDb, const wxString &defDir)
|
Clookup::Clookup(wxChar *tblName, wxChar *colName, wxDb *pDb, const wxString &defDir)
|
||||||
: wxDbTable(pDb, tblName, 1, wxT(""), !wxDB_QUERY_ONLY,
|
: wxDbTable(pDb, tblName, 1, wxEmptyString, !wxDB_QUERY_ONLY,
|
||||||
defDir)
|
defDir)
|
||||||
{
|
{
|
||||||
|
|
||||||
@@ -143,7 +143,7 @@ Clookup::Clookup(wxChar *tblName, wxChar *colName, wxDb *pDb, const wxString &de
|
|||||||
// Clookup2 constructor
|
// Clookup2 constructor
|
||||||
Clookup2::Clookup2(wxChar *tblName, wxChar *colName1, wxChar *colName2,
|
Clookup2::Clookup2(wxChar *tblName, wxChar *colName1, wxChar *colName2,
|
||||||
wxDb *pDb, const wxString &defDir)
|
wxDb *pDb, const wxString &defDir)
|
||||||
: wxDbTable(pDb, tblName, (1 + (wxStrlen(colName2) > 0)), wxT(""),
|
: wxDbTable(pDb, tblName, (UWORD)(1 + (wxStrlen(colName2) > 0)), wxEmptyString,
|
||||||
!wxDB_QUERY_ONLY, defDir)
|
!wxDB_QUERY_ONLY, defDir)
|
||||||
{
|
{
|
||||||
wxASSERT(pDb);
|
wxASSERT(pDb);
|
||||||
@@ -153,10 +153,10 @@ Clookup2::Clookup2(wxChar *tblName, wxChar *colName1, wxChar *colName2,
|
|||||||
|
|
||||||
int i = 0;
|
int i = 0;
|
||||||
|
|
||||||
SetColDefs (i, colName1, DB_DATA_TYPE_VARCHAR, lookupCol1, SQL_C_CHAR, LOOKUP_COL_LEN+1, false, false);
|
SetColDefs ((UWORD)i, colName1, DB_DATA_TYPE_VARCHAR, lookupCol1, SQL_C_CHAR, LOOKUP_COL_LEN+1, false, false);
|
||||||
|
|
||||||
if (wxStrlen(colName2) > 0)
|
if (wxStrlen(colName2) > 0)
|
||||||
SetColDefs (++i, colName2, DB_DATA_TYPE_VARCHAR, lookupCol2, SQL_C_CHAR, LOOKUP_COL_LEN+1, false, false);
|
SetColDefs ((UWORD)(++i), colName2, DB_DATA_TYPE_VARCHAR, lookupCol2, SQL_C_CHAR, LOOKUP_COL_LEN+1, false, false);
|
||||||
|
|
||||||
} // Clookup2()
|
} // Clookup2()
|
||||||
|
|
||||||
@@ -175,7 +175,7 @@ ClookUpDlg::ClookUpDlg(wxWindow *parent, wxChar *windowTitle, wxChar *tableName,
|
|||||||
: wxDialog (parent, LOOKUP_DIALOG, wxT("Select..."), wxDefaultPosition, wxSize(400, 290))
|
: wxDialog (parent, LOOKUP_DIALOG, wxT("Select..."), wxDefaultPosition, wxSize(400, 290))
|
||||||
{
|
{
|
||||||
wxBeginBusyCursor();
|
wxBeginBusyCursor();
|
||||||
|
|
||||||
wxStrcpy(ListDB_Selection,wxT(""));
|
wxStrcpy(ListDB_Selection,wxT(""));
|
||||||
widgetPtrsSet = false;
|
widgetPtrsSet = false;
|
||||||
lookup = 0;
|
lookup = 0;
|
||||||
@@ -267,12 +267,12 @@ ClookUpDlg::ClookUpDlg(wxWindow *parent, wxChar *windowTitle, wxChar *tableName,
|
|||||||
//
|
//
|
||||||
ClookUpDlg::ClookUpDlg(wxWindow *parent, wxChar *windowTitle, wxChar *tableName,
|
ClookUpDlg::ClookUpDlg(wxWindow *parent, wxChar *windowTitle, wxChar *tableName,
|
||||||
wxChar *dispCol1, wxChar *dispCol2, wxChar *where, wxChar *orderBy,
|
wxChar *dispCol1, wxChar *dispCol2, wxChar *where, wxChar *orderBy,
|
||||||
wxDb *pDb, const wxString &defDir, bool distinctValues,
|
wxDb *pDb, const wxString &defDir, bool distinctValues,
|
||||||
wxChar *selectStmt, int maxLenCol1, bool allowOk)
|
wxChar *selectStmt, int maxLenCol1, bool allowOk)
|
||||||
: wxDialog (parent, LOOKUP_DIALOG, wxT("Select..."), wxDefaultPosition, wxSize(400, 290))
|
: wxDialog (parent, LOOKUP_DIALOG, wxT("Select..."), wxDefaultPosition, wxSize(400, 290))
|
||||||
{
|
{
|
||||||
wxBeginBusyCursor();
|
wxBeginBusyCursor();
|
||||||
|
|
||||||
wxStrcpy(ListDB_Selection,wxT(""));
|
wxStrcpy(ListDB_Selection,wxT(""));
|
||||||
wxStrcpy(ListDB_Selection2,wxT(""));
|
wxStrcpy(ListDB_Selection2,wxT(""));
|
||||||
widgetPtrsSet = false;
|
widgetPtrsSet = false;
|
||||||
|
@@ -91,7 +91,7 @@ void MyCanvas::OnEraseBackground(wxEraseEvent& event)
|
|||||||
{
|
{
|
||||||
wxSize sz = GetClientSize();
|
wxSize sz = GetClientSize();
|
||||||
wxRect rect(0, 0, sz.x, sz.y);
|
wxRect rect(0, 0, sz.x, sz.y);
|
||||||
|
|
||||||
if (event.GetDC())
|
if (event.GetDC())
|
||||||
{
|
{
|
||||||
wxGetApp().TileBitmap(rect, *(event.GetDC()), wxGetApp().GetBackgroundBitmap());
|
wxGetApp().TileBitmap(rect, *(event.GetDC()), wxGetApp().GetBackgroundBitmap());
|
||||||
@@ -195,7 +195,7 @@ void MyCanvas::OnMouseEvent(wxMouseEvent& event)
|
|||||||
#else
|
#else
|
||||||
wxIcon icon(wxICON(dragicon));
|
wxIcon icon(wxICON(dragicon));
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
m_dragImage = new wxDragImage(icon, wxCursor(wxCURSOR_HAND));
|
m_dragImage = new wxDragImage(icon, wxCursor(wxCURSOR_HAND));
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
@@ -205,19 +205,19 @@ void MyCanvas::OnMouseEvent(wxMouseEvent& event)
|
|||||||
|
|
||||||
// The offset between the top-left of the shape image and the current shape position
|
// The offset between the top-left of the shape image and the current shape position
|
||||||
wxPoint beginDragHotSpot = m_dragStartPos - m_draggedShape->GetPosition();
|
wxPoint beginDragHotSpot = m_dragStartPos - m_draggedShape->GetPosition();
|
||||||
|
|
||||||
// Now we do this inside the implementation: always assume
|
// Now we do this inside the implementation: always assume
|
||||||
// coordinates relative to the capture window (client coordinates)
|
// coordinates relative to the capture window (client coordinates)
|
||||||
|
|
||||||
//if (fullScreen)
|
//if (fullScreen)
|
||||||
// beginDragHotSpot -= ClientToScreen(wxPoint(0, 0));
|
// beginDragHotSpot -= ClientToScreen(wxPoint(0, 0));
|
||||||
|
|
||||||
if (!m_dragImage->BeginDrag(beginDragHotSpot, this, fullScreen))
|
if (!m_dragImage->BeginDrag(beginDragHotSpot, this, fullScreen))
|
||||||
{
|
{
|
||||||
delete m_dragImage;
|
delete m_dragImage;
|
||||||
m_dragImage = (wxDragImage*) NULL;
|
m_dragImage = (wxDragImage*) NULL;
|
||||||
m_dragMode = TEST_DRAG_NONE;
|
m_dragMode = TEST_DRAG_NONE;
|
||||||
|
|
||||||
} else
|
} else
|
||||||
{
|
{
|
||||||
m_dragImage->Move(event.GetPosition());
|
m_dragImage->Move(event.GetPosition());
|
||||||
@@ -287,7 +287,7 @@ void MyCanvas::EraseShape(DragShape* shape, wxDC& dc)
|
|||||||
|
|
||||||
wxRect rect2(shape->GetRect());
|
wxRect rect2(shape->GetRect());
|
||||||
dc.SetClippingRegion(rect2.x, rect2.y, rect2.width, rect2.height);
|
dc.SetClippingRegion(rect2.x, rect2.y, rect2.width, rect2.height);
|
||||||
|
|
||||||
wxGetApp().TileBitmap(rect, dc, wxGetApp().GetBackgroundBitmap());
|
wxGetApp().TileBitmap(rect, dc, wxGetApp().GetBackgroundBitmap());
|
||||||
|
|
||||||
dc.DestroyClippingRegion();
|
dc.DestroyClippingRegion();
|
||||||
@@ -334,19 +334,19 @@ MyFrame::MyFrame()
|
|||||||
file_menu->Append( wxID_ABOUT, _T("&About..."));
|
file_menu->Append( wxID_ABOUT, _T("&About..."));
|
||||||
file_menu->AppendCheckItem( TEST_USE_SCREEN, _T("&Use whole screen for dragging"), _T("Use whole screen"));
|
file_menu->AppendCheckItem( TEST_USE_SCREEN, _T("&Use whole screen for dragging"), _T("Use whole screen"));
|
||||||
file_menu->Append( wxID_EXIT, _T("E&xit"));
|
file_menu->Append( wxID_EXIT, _T("E&xit"));
|
||||||
|
|
||||||
wxMenuBar *menu_bar = new wxMenuBar();
|
wxMenuBar *menu_bar = new wxMenuBar();
|
||||||
menu_bar->Append(file_menu, _T("&File"));
|
menu_bar->Append(file_menu, _T("&File"));
|
||||||
|
|
||||||
SetIcon(wxICON(mondrian));
|
SetIcon(wxICON(mondrian));
|
||||||
SetMenuBar( menu_bar );
|
SetMenuBar( menu_bar );
|
||||||
|
|
||||||
#if wxUSE_STATUSBAR
|
#if wxUSE_STATUSBAR
|
||||||
CreateStatusBar(2);
|
CreateStatusBar(2);
|
||||||
int widths[] = { -1, 100 };
|
int widths[] = { -1, 100 };
|
||||||
SetStatusWidths( 2, widths );
|
SetStatusWidths( 2, widths );
|
||||||
#endif // wxUSE_STATUSBAR
|
#endif // wxUSE_STATUSBAR
|
||||||
|
|
||||||
m_canvas = new MyCanvas( this, wxID_ANY, wxPoint(0,0), wxSize(10,10) );
|
m_canvas = new MyCanvas( this, wxID_ANY, wxPoint(0,0), wxSize(10,10) );
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -359,7 +359,7 @@ void MyFrame::OnAbout( wxCommandEvent &WXUNUSED(event) )
|
|||||||
{
|
{
|
||||||
(void)wxMessageBox( _T("wxDragImage demo\n")
|
(void)wxMessageBox( _T("wxDragImage demo\n")
|
||||||
_T("Julian Smart (c) 2000"),
|
_T("Julian Smart (c) 2000"),
|
||||||
_T("About wxDragImage Demo"),
|
_T("About wxDragImage Demo"),
|
||||||
wxICON_INFORMATION | wxOK );
|
wxICON_INFORMATION | wxOK );
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -447,7 +447,7 @@ bool MyApp::TileBitmap(const wxRect& rect, wxDC& dc, wxBitmap& bitmap)
|
|||||||
{
|
{
|
||||||
int w = bitmap.GetWidth();
|
int w = bitmap.GetWidth();
|
||||||
int h = bitmap.GetHeight();
|
int h = bitmap.GetHeight();
|
||||||
|
|
||||||
int i, j;
|
int i, j;
|
||||||
for (i = rect.x; i < rect.x + rect.width; i += w)
|
for (i = rect.x; i < rect.x + rect.width; i += w)
|
||||||
{
|
{
|
||||||
@@ -473,10 +473,6 @@ DragShape::DragShape(const wxBitmap& bitmap)
|
|||||||
m_show = true;
|
m_show = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
DragShape::~DragShape()
|
|
||||||
{
|
|
||||||
}
|
|
||||||
|
|
||||||
bool DragShape::HitTest(const wxPoint& pt) const
|
bool DragShape::HitTest(const wxPoint& pt) const
|
||||||
{
|
{
|
||||||
wxRect rect(GetRect());
|
wxRect rect(GetRect());
|
||||||
@@ -489,7 +485,7 @@ bool DragShape::Draw(wxDC& dc, int op)
|
|||||||
{
|
{
|
||||||
wxMemoryDC memDC;
|
wxMemoryDC memDC;
|
||||||
memDC.SelectObject(m_bitmap);
|
memDC.SelectObject(m_bitmap);
|
||||||
|
|
||||||
dc.Blit(m_pos.x, m_pos.y, m_bitmap.GetWidth(), m_bitmap.GetHeight(),
|
dc.Blit(m_pos.x, m_pos.y, m_bitmap.GetWidth(), m_bitmap.GetHeight(),
|
||||||
& memDC, 0, 0, op, true);
|
& memDC, 0, 0, op, true);
|
||||||
|
|
||||||
|
@@ -123,7 +123,7 @@ class DragShape: public wxObject
|
|||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
DragShape(const wxBitmap& bitmap);
|
DragShape(const wxBitmap& bitmap);
|
||||||
~DragShape();
|
~DragShape(){};
|
||||||
|
|
||||||
//// Operations
|
//// Operations
|
||||||
|
|
||||||
|
@@ -674,11 +674,12 @@ void MyCanvas::DrawDefault(wxDC& dc)
|
|||||||
wxMemoryDC memdc2;
|
wxMemoryDC memdc2;
|
||||||
memdc2.SelectObject(bitmap2);
|
memdc2.SelectObject(bitmap2);
|
||||||
|
|
||||||
wxBrush yellowBrush(wxColour(255, 255, 0), wxSOLID);
|
wxColour clr(255, 255, 0);
|
||||||
|
wxBrush yellowBrush(clr, wxSOLID);
|
||||||
memdc2.SetBackground(yellowBrush);
|
memdc2.SetBackground(yellowBrush);
|
||||||
memdc2.Clear();
|
memdc2.Clear();
|
||||||
|
|
||||||
wxPen yellowPen(wxColour(255, 255, 0), 1, wxSOLID);
|
wxPen yellowPen(clr, 1, wxSOLID);
|
||||||
|
|
||||||
// Now draw a white rectangle with red outline. It should
|
// Now draw a white rectangle with red outline. It should
|
||||||
// entirely eclipse the yellow background.
|
// entirely eclipse the yellow background.
|
||||||
@@ -951,7 +952,8 @@ void MyCanvas::OnPaint(wxPaintEvent &WXUNUSED(event))
|
|||||||
|
|
||||||
if ( m_owner->m_textureBackground) {
|
if ( m_owner->m_textureBackground) {
|
||||||
if ( ! m_owner->m_backgroundBrush.Ok() ) {
|
if ( ! m_owner->m_backgroundBrush.Ok() ) {
|
||||||
wxBrush b(wxColour(0,128,0), wxSOLID);
|
wxColour clr(0,128,0);
|
||||||
|
wxBrush b(clr, wxSOLID);
|
||||||
dc.SetBackground(b);
|
dc.SetBackground(b);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@@ -198,9 +198,9 @@ void MyCanvas::OnChar( wxKeyEvent &event )
|
|||||||
case WXK_RIGHT: m_text += wxT( "<RIGHT>" ); break;
|
case WXK_RIGHT: m_text += wxT( "<RIGHT>" ); break;
|
||||||
case WXK_DOWN: m_text += wxT( "<DOWN>" ); break;
|
case WXK_DOWN: m_text += wxT( "<DOWN>" ); break;
|
||||||
case WXK_RETURN: m_text += wxT( "<ENTER>" ); break;
|
case WXK_RETURN: m_text += wxT( "<ENTER>" ); break;
|
||||||
default: m_text += event.m_keyCode; break;
|
default: m_text += (wxChar)event.m_keyCode; break;
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void MyCanvas::OnPaint( wxPaintEvent &WXUNUSED(event) )
|
void MyCanvas::OnPaint( wxPaintEvent &WXUNUSED(event) )
|
||||||
@@ -215,7 +215,7 @@ void MyCanvas::OnPaint( wxPaintEvent &WXUNUSED(event) )
|
|||||||
|
|
||||||
dc.SetTextForeground(*wxBLUE);
|
dc.SetTextForeground(*wxBLUE);
|
||||||
dc.DrawText(_T("This text is drawn from OnPaint"), 65, 65);
|
dc.DrawText(_T("This text is drawn from OnPaint"), 65, 65);
|
||||||
|
|
||||||
wxString tmp;
|
wxString tmp;
|
||||||
tmp.Printf( _T("Hit any key to display more text: %s"), m_text.c_str() );
|
tmp.Printf( _T("Hit any key to display more text: %s"), m_text.c_str() );
|
||||||
int w,h;
|
int w,h;
|
||||||
|
@@ -32,8 +32,10 @@
|
|||||||
#include "wx/splitter.h"
|
#include "wx/splitter.h"
|
||||||
#include "wx/textfile.h"
|
#include "wx/textfile.h"
|
||||||
|
|
||||||
|
#ifdef __WXMAC__
|
||||||
#undef wxFontDialog
|
#undef wxFontDialog
|
||||||
#include "wx/mac/fontdlg.h"
|
#include "wx/mac/fontdlg.h"
|
||||||
|
#endif
|
||||||
|
|
||||||
// ----------------------------------------------------------------------------
|
// ----------------------------------------------------------------------------
|
||||||
// private classes
|
// private classes
|
||||||
@@ -57,7 +59,7 @@ class MyCanvas: public wxWindow
|
|||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
MyCanvas( wxWindow *parent );
|
MyCanvas( wxWindow *parent );
|
||||||
virtual ~MyCanvas();
|
virtual ~MyCanvas(){};
|
||||||
|
|
||||||
// accessors for the frame
|
// accessors for the frame
|
||||||
const wxFont& GetTextFont() const { return m_font; }
|
const wxFont& GetTextFont() const { return m_font; }
|
||||||
@@ -714,10 +716,6 @@ MyCanvas::MyCanvas( wxWindow *parent )
|
|||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
MyCanvas::~MyCanvas()
|
|
||||||
{
|
|
||||||
}
|
|
||||||
|
|
||||||
void MyCanvas::OnPaint( wxPaintEvent &WXUNUSED(event) )
|
void MyCanvas::OnPaint( wxPaintEvent &WXUNUSED(event) )
|
||||||
{
|
{
|
||||||
wxPaintDC dc(this);
|
wxPaintDC dc(this);
|
||||||
@@ -784,7 +782,7 @@ void MyCanvas::OnPaint( wxPaintEvent &WXUNUSED(event) )
|
|||||||
{
|
{
|
||||||
for ( int j = 0; j < 32; j++ )
|
for ( int j = 0; j < 32; j++ )
|
||||||
{
|
{
|
||||||
wxChar c = 32 * (i + 1) + j;
|
wxChar c = (wxChar)(32 * (i + 1) + j);
|
||||||
|
|
||||||
long charWidth, charHeight;
|
long charWidth, charHeight;
|
||||||
dc.GetTextExtent(c, &charWidth, &charHeight);
|
dc.GetTextExtent(c, &charWidth, &charHeight);
|
||||||
|
@@ -722,7 +722,8 @@ void GridFrame::SetCellBgColour( wxCommandEvent& WXUNUSED(ev) )
|
|||||||
{
|
{
|
||||||
// Check the new Refresh function by passing it a rectangle
|
// Check the new Refresh function by passing it a rectangle
|
||||||
// which exactly fits the grid.
|
// which exactly fits the grid.
|
||||||
wxRect r(wxPoint(0, 0), grid->GetSize());
|
wxPoint pt(0, 0);
|
||||||
|
wxRect r(pt, grid->GetSize());
|
||||||
grid->SetDefaultCellBackgroundColour(col);
|
grid->SetDefaultCellBackgroundColour(col);
|
||||||
grid->Refresh(true, &r);
|
grid->Refresh(true, &r);
|
||||||
}
|
}
|
||||||
@@ -1349,10 +1350,6 @@ wxString BugsGridTable::GetColLabelValue( int col )
|
|||||||
return headers[col];
|
return headers[col];
|
||||||
}
|
}
|
||||||
|
|
||||||
BugsGridTable::BugsGridTable()
|
|
||||||
{
|
|
||||||
}
|
|
||||||
|
|
||||||
// ----------------------------------------------------------------------------
|
// ----------------------------------------------------------------------------
|
||||||
// BugsGridFrame
|
// BugsGridFrame
|
||||||
// ----------------------------------------------------------------------------
|
// ----------------------------------------------------------------------------
|
||||||
|
@@ -232,7 +232,7 @@ private:
|
|||||||
class BugsGridTable : public wxGridTableBase
|
class BugsGridTable : public wxGridTableBase
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
BugsGridTable();
|
BugsGridTable(){};
|
||||||
|
|
||||||
virtual int GetNumberRows();
|
virtual int GetNumberRows();
|
||||||
virtual int GetNumberCols();
|
virtual int GetNumberCols();
|
||||||
|
@@ -203,7 +203,7 @@ public:
|
|||||||
{
|
{
|
||||||
unsigned char *cmap = new unsigned char [256];
|
unsigned char *cmap = new unsigned char [256];
|
||||||
for ( int i = 0; i < 256; i++ )
|
for ( int i = 0; i < 256; i++ )
|
||||||
cmap[i] = i;
|
cmap[i] = (unsigned char)i;
|
||||||
image.SetPalette(wxPalette(256, cmap, cmap, cmap));
|
image.SetPalette(wxPalette(256, cmap, cmap, cmap));
|
||||||
|
|
||||||
delete cmap;
|
delete cmap;
|
||||||
@@ -538,7 +538,7 @@ MyCanvas::MyCanvas( wxWindow *parent, wxWindowID id,
|
|||||||
tmp << i ;
|
tmp << i ;
|
||||||
wxLogError(tmp);
|
wxLogError(tmp);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
my_horse_ani [i] = wxBitmap( image );
|
my_horse_ani [i] = wxBitmap( image );
|
||||||
}
|
}
|
||||||
#endif // wxUSE_ICO_CUR
|
#endif // wxUSE_ICO_CUR
|
||||||
@@ -549,7 +549,7 @@ MyCanvas::MyCanvas( wxWindow *parent, wxWindowID id,
|
|||||||
wxFile file(dir + _T("horse.bmp"));
|
wxFile file(dir + _T("horse.bmp"));
|
||||||
if ( file.IsOpened() )
|
if ( file.IsOpened() )
|
||||||
{
|
{
|
||||||
off_t len = file.Length();
|
size_t len = (size_t)file.Length();
|
||||||
void *data = malloc(len);
|
void *data = malloc(len);
|
||||||
if ( file.Read(data, len) != len )
|
if ( file.Read(data, len) != len )
|
||||||
wxLogError(_T("Reading bitmap file failed"));
|
wxLogError(_T("Reading bitmap file failed"));
|
||||||
@@ -713,7 +713,7 @@ void MyCanvas::OnPaint( wxPaintEvent &WXUNUSED(event) )
|
|||||||
// For testing transparency
|
// For testing transparency
|
||||||
dc.SetBrush( *wxRED_BRUSH );
|
dc.SetBrush( *wxRED_BRUSH );
|
||||||
dc.DrawRectangle( 20, 2220, 560, 68 );
|
dc.DrawRectangle( 20, 2220, 560, 68 );
|
||||||
|
|
||||||
dc.DrawText(_T("XPM bitmap"), 30, 2230 );
|
dc.DrawText(_T("XPM bitmap"), 30, 2230 );
|
||||||
if ( m_bmpSmileXpm.Ok() )
|
if ( m_bmpSmileXpm.Ok() )
|
||||||
dc.DrawBitmap(m_bmpSmileXpm, 30, 2250, true);
|
dc.DrawBitmap(m_bmpSmileXpm, 30, 2250, true);
|
||||||
@@ -721,8 +721,8 @@ void MyCanvas::OnPaint( wxPaintEvent &WXUNUSED(event) )
|
|||||||
dc.DrawText(_T("XPM icon"), 110, 2230 );
|
dc.DrawText(_T("XPM icon"), 110, 2230 );
|
||||||
if ( m_iconSmileXpm.Ok() )
|
if ( m_iconSmileXpm.Ok() )
|
||||||
dc.DrawIcon(m_iconSmileXpm, 110, 2250);
|
dc.DrawIcon(m_iconSmileXpm, 110, 2250);
|
||||||
|
|
||||||
// testing icon -> bitmap conversion
|
// testing icon -> bitmap conversion
|
||||||
wxBitmap to_blit( m_iconSmileXpm );
|
wxBitmap to_blit( m_iconSmileXpm );
|
||||||
if (to_blit.Ok())
|
if (to_blit.Ok())
|
||||||
{
|
{
|
||||||
@@ -737,7 +737,7 @@ void MyCanvas::OnPaint( wxPaintEvent &WXUNUSED(event) )
|
|||||||
dc.SetUserScale( 2, 2 );
|
dc.SetUserScale( 2, 2 );
|
||||||
dc.DrawBitmap( to_blit, (int)(300/2), (int)(2250/2), true );
|
dc.DrawBitmap( to_blit, (int)(300/2), (int)(2250/2), true );
|
||||||
dc.SetUserScale( 1.0, 1.0 );
|
dc.SetUserScale( 1.0, 1.0 );
|
||||||
|
|
||||||
dc.DrawText( _T("Blit"), 400, 2230);
|
dc.DrawText( _T("Blit"), 400, 2230);
|
||||||
wxMemoryDC blit_dc;
|
wxMemoryDC blit_dc;
|
||||||
blit_dc.SelectObject( to_blit );
|
blit_dc.SelectObject( to_blit );
|
||||||
@@ -822,7 +822,7 @@ void MyCanvas::CreateAntiAliasedBitmap()
|
|||||||
original.GetBlue( x*2, y*2+1 ) +
|
original.GetBlue( x*2, y*2+1 ) +
|
||||||
original.GetBlue( x*2+1, y*2+1 );
|
original.GetBlue( x*2+1, y*2+1 );
|
||||||
blue = blue/4;
|
blue = blue/4;
|
||||||
anti.SetRGB( x, y, red, green, blue );
|
anti.SetRGB( x, y, (unsigned char)red, (unsigned char)green, (unsigned char)blue );
|
||||||
}
|
}
|
||||||
my_anti = new wxBitmap(anti);
|
my_anti = new wxBitmap(anti);
|
||||||
}
|
}
|
||||||
|
@@ -251,15 +251,15 @@ void MyFrame::OnAbout(wxCommandEvent& WXUNUSED(event))
|
|||||||
localeInfo.Printf(_("Language: %s\nSystem locale name:\n%s\nCanonical locale name: %s\n"),
|
localeInfo.Printf(_("Language: %s\nSystem locale name:\n%s\nCanonical locale name: %s\n"),
|
||||||
locale.c_str(), sysname.c_str(), canname.c_str() );
|
locale.c_str(), sysname.c_str(), canname.c_str() );
|
||||||
|
|
||||||
wxMessageDialog
|
wxMessageDialog dlg(
|
||||||
(
|
this,
|
||||||
this,
|
wxString(_("I18n sample\n(c) 1998, 1999 Vadim Zeitlin and Julian Smart"))
|
||||||
wxString(_("I18n sample\n(c) 1998, 1999 Vadim Zeitlin and Julian Smart"))
|
+ wxT("\n\n")
|
||||||
+ wxT("\n\n")
|
+ localeInfo,
|
||||||
+ localeInfo,
|
_("About Internat"),
|
||||||
_("About Internat"),
|
wxOK | wxICON_INFORMATION
|
||||||
wxOK | wxICON_INFORMATION
|
);
|
||||||
).ShowModal();
|
dlg.ShowModal();
|
||||||
}
|
}
|
||||||
|
|
||||||
void MyFrame::OnPlay(wxCommandEvent& WXUNUSED(event))
|
void MyFrame::OnPlay(wxCommandEvent& WXUNUSED(event))
|
||||||
|
@@ -132,7 +132,7 @@ void MyCanvas::OnJoystickEvent(wxJoystickEvent& event)
|
|||||||
ymax += abs(ymin);
|
ymax += abs(ymin);
|
||||||
pt.y += abs(ymin);
|
pt.y += abs(ymin);
|
||||||
}
|
}
|
||||||
|
|
||||||
// Scale to canvas size
|
// Scale to canvas size
|
||||||
int cw, ch;
|
int cw, ch;
|
||||||
GetSize(&cw, &ch);
|
GetSize(&cw, &ch);
|
||||||
@@ -178,11 +178,6 @@ MyFrame::MyFrame(wxFrame *parent, const wxString& title, const wxPoint& pos,
|
|||||||
canvas = new MyCanvas(this);
|
canvas = new MyCanvas(this);
|
||||||
}
|
}
|
||||||
|
|
||||||
MyFrame::~MyFrame()
|
|
||||||
{
|
|
||||||
// Empty
|
|
||||||
}
|
|
||||||
|
|
||||||
void MyFrame::OnQuit(wxCommandEvent& WXUNUSED(event))
|
void MyFrame::OnQuit(wxCommandEvent& WXUNUSED(event))
|
||||||
{
|
{
|
||||||
Close(true);
|
Close(true);
|
||||||
|
@@ -45,7 +45,7 @@ public:
|
|||||||
MyCanvas *canvas;
|
MyCanvas *canvas;
|
||||||
MyFrame(wxFrame *parent, const wxString& title,
|
MyFrame(wxFrame *parent, const wxString& title,
|
||||||
const wxPoint& pos, const wxSize& size, const long style);
|
const wxPoint& pos, const wxSize& size, const long style);
|
||||||
~MyFrame();
|
~MyFrame(){};
|
||||||
void OnActivate(wxActivateEvent& event);
|
void OnActivate(wxActivateEvent& event);
|
||||||
void OnQuit(wxCommandEvent& event);
|
void OnQuit(wxCommandEvent& event);
|
||||||
|
|
||||||
|
@@ -37,10 +37,6 @@
|
|||||||
|
|
||||||
IMPLEMENT_APP(MyApp)
|
IMPLEMENT_APP(MyApp)
|
||||||
|
|
||||||
MyApp::MyApp()
|
|
||||||
{
|
|
||||||
}
|
|
||||||
|
|
||||||
bool MyApp::OnInit()
|
bool MyApp::OnInit()
|
||||||
{
|
{
|
||||||
// Create the main frame window
|
// Create the main frame window
|
||||||
@@ -61,7 +57,7 @@ BEGIN_EVENT_TABLE(MyFrame, wxFrame)
|
|||||||
|
|
||||||
EVT_MENU(LAYOUT_TEST_SIZER, MyFrame::TestFlexSizers)
|
EVT_MENU(LAYOUT_TEST_SIZER, MyFrame::TestFlexSizers)
|
||||||
EVT_MENU(LAYOUT_TEST_NB_SIZER, MyFrame::TestNotebookSizers)
|
EVT_MENU(LAYOUT_TEST_NB_SIZER, MyFrame::TestNotebookSizers)
|
||||||
EVT_MENU(LAYOUT_TEST_GB_SIZER, MyFrame::TestGridBagSizer)
|
EVT_MENU(LAYOUT_TEST_GB_SIZER, MyFrame::TestGridBagSizer)
|
||||||
END_EVENT_TABLE()
|
END_EVENT_TABLE()
|
||||||
|
|
||||||
// Define my frame constructor
|
// Define my frame constructor
|
||||||
@@ -365,7 +361,7 @@ enum {
|
|||||||
GBS_SHOW_BTN,
|
GBS_SHOW_BTN,
|
||||||
GBS_MOVE_BTN1,
|
GBS_MOVE_BTN1,
|
||||||
GBS_MOVE_BTN2,
|
GBS_MOVE_BTN2,
|
||||||
|
|
||||||
GBS_MAX,
|
GBS_MAX,
|
||||||
};
|
};
|
||||||
|
|
||||||
@@ -385,11 +381,11 @@ MyGridBagSizerFrame::MyGridBagSizerFrame(const wxChar *title, int x, int y )
|
|||||||
m_panel = p;
|
m_panel = p;
|
||||||
m_gbs = new wxGridBagSizer();
|
m_gbs = new wxGridBagSizer();
|
||||||
|
|
||||||
|
|
||||||
m_gbs->Add( new wxStaticText(p, wxID_ANY, gbsDescription),
|
m_gbs->Add( new wxStaticText(p, wxID_ANY, gbsDescription),
|
||||||
POS(0,0), SPAN(1, 7),
|
POS(0,0), SPAN(1, 7),
|
||||||
wxALIGN_CENTER | wxALL, 5);
|
wxALIGN_CENTER | wxALL, 5);
|
||||||
|
|
||||||
m_gbs->Add( TEXTCTRL("pos(1,0)"), POS(1,0) );
|
m_gbs->Add( TEXTCTRL("pos(1,0)"), POS(1,0) );
|
||||||
m_gbs->Add( TEXTCTRL("pos(1,1)"), POS(1,1) );
|
m_gbs->Add( TEXTCTRL("pos(1,1)"), POS(1,1) );
|
||||||
m_gbs->Add( TEXTCTRL("pos(2,0)"), POS(2,0) );
|
m_gbs->Add( TEXTCTRL("pos(2,0)"), POS(2,0) );
|
||||||
@@ -401,7 +397,7 @@ MyGridBagSizerFrame::MyGridBagSizerFrame(const wxChar *title, int x, int y )
|
|||||||
m_gbs->Add( TEXTCTRL("pos(5,4)"), POS(5,4), wxDefaultSpan, wxEXPAND );
|
m_gbs->Add( TEXTCTRL("pos(5,4)"), POS(5,4), wxDefaultSpan, wxEXPAND );
|
||||||
m_gbs->Add( TEXTCTRL("pos(6,5)"), POS(6,5), wxDefaultSpan, wxEXPAND );
|
m_gbs->Add( TEXTCTRL("pos(6,5)"), POS(6,5), wxDefaultSpan, wxEXPAND );
|
||||||
m_gbs->Add( TEXTCTRL("pos(7,6)"), POS(7,6) );
|
m_gbs->Add( TEXTCTRL("pos(7,6)"), POS(7,6) );
|
||||||
|
|
||||||
//m_gbs->Add( TEXTCTRL("bad position"), POS(4,3) ); // Test for assert
|
//m_gbs->Add( TEXTCTRL("bad position"), POS(4,3) ); // Test for assert
|
||||||
//m_gbs->Add( TEXTCTRL("bad position"), POS(5,3) ); // Test for assert
|
//m_gbs->Add( TEXTCTRL("bad position"), POS(5,3) ); // Test for assert
|
||||||
|
|
||||||
@@ -410,28 +406,28 @@ MyGridBagSizerFrame::MyGridBagSizerFrame(const wxChar *title, int x, int y )
|
|||||||
m_moveBtn2 = new wxButton(p, GBS_MOVE_BTN2, _T("Move this to (3,6)"));
|
m_moveBtn2 = new wxButton(p, GBS_MOVE_BTN2, _T("Move this to (3,6)"));
|
||||||
m_gbs->Add( m_moveBtn1, POS(10,2) );
|
m_gbs->Add( m_moveBtn1, POS(10,2) );
|
||||||
m_gbs->Add( m_moveBtn2, POS(10,3) );
|
m_gbs->Add( m_moveBtn2, POS(10,3) );
|
||||||
|
|
||||||
m_hideBtn = new wxButton(p, GBS_HIDE_BTN, _T("Hide this item -->"));
|
m_hideBtn = new wxButton(p, GBS_HIDE_BTN, _T("Hide this item -->"));
|
||||||
m_gbs->Add(m_hideBtn, POS(12, 3));
|
m_gbs->Add(m_hideBtn, POS(12, 3));
|
||||||
|
|
||||||
m_hideTxt = new wxTextCtrl(p, wxID_ANY, _T("pos(12,4), size(150, -1)"),
|
m_hideTxt = new wxTextCtrl(p, wxID_ANY, _T("pos(12,4), size(150, -1)"),
|
||||||
wxDefaultPosition, wxSize(150,-1));
|
wxDefaultPosition, wxSize(150,-1));
|
||||||
m_gbs->Add( m_hideTxt, POS(12,4) );
|
m_gbs->Add( m_hideTxt, POS(12,4) );
|
||||||
|
|
||||||
m_showBtn = new wxButton(p, GBS_SHOW_BTN, _T("<-- Show it again"));
|
m_showBtn = new wxButton(p, GBS_SHOW_BTN, _T("<-- Show it again"));
|
||||||
m_gbs->Add(m_showBtn, POS(12, 5));
|
m_gbs->Add(m_showBtn, POS(12, 5));
|
||||||
m_showBtn->Disable();
|
m_showBtn->Disable();
|
||||||
|
|
||||||
m_gbs->Add(10,10, POS(14,0));
|
m_gbs->Add(10,10, POS(14,0));
|
||||||
|
|
||||||
m_gbs->AddGrowableRow(3);
|
m_gbs->AddGrowableRow(3);
|
||||||
m_gbs->AddGrowableCol(2);
|
m_gbs->AddGrowableCol(2);
|
||||||
|
|
||||||
p->SetSizerAndFit(m_gbs);
|
p->SetSizerAndFit(m_gbs);
|
||||||
SetClientSize(p->GetSize());
|
SetClientSize(p->GetSize());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
void MyGridBagSizerFrame::OnHideBtn(wxCommandEvent&)
|
void MyGridBagSizerFrame::OnHideBtn(wxCommandEvent&)
|
||||||
{
|
{
|
||||||
m_gbs->Hide(m_hideTxt);
|
m_gbs->Hide(m_hideTxt);
|
||||||
@@ -460,14 +456,14 @@ void MyGridBagSizerFrame::OnMoveBtn(wxCommandEvent& event)
|
|||||||
m_gbs->SetItemPosition(btn, m_lastPos);
|
m_gbs->SetItemPosition(btn, m_lastPos);
|
||||||
btn->SetLabel(_T("Move this to (3,6)"));
|
btn->SetLabel(_T("Move this to (3,6)"));
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
if ( m_gbs->CheckForIntersection(wxGBPosition(3,6), wxGBSpan(1,1)) )
|
if ( m_gbs->CheckForIntersection(wxGBPosition(3,6), wxGBSpan(1,1)) )
|
||||||
wxMessageBox(
|
wxMessageBox(
|
||||||
_T("wxGridBagSizer will not allow items to be in the same cell as\n\
|
_T("wxGridBagSizer will not allow items to be in the same cell as\n\
|
||||||
another item, so this operation will fail. You will also get an assert\n\
|
another item, so this operation will fail. You will also get an assert\n\
|
||||||
when compiled in debug mode."), _T("Warning"), wxOK | wxICON_INFORMATION);
|
when compiled in debug mode."), _T("Warning"), wxOK | wxICON_INFORMATION);
|
||||||
|
|
||||||
if ( m_gbs->SetItemPosition(btn, wxGBPosition(3,6)) )
|
if ( m_gbs->SetItemPosition(btn, wxGBPosition(3,6)) )
|
||||||
{
|
{
|
||||||
m_lastPos = curPos;
|
m_lastPos = curPos;
|
||||||
|
@@ -13,7 +13,7 @@
|
|||||||
class MyApp: public wxApp
|
class MyApp: public wxApp
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
MyApp();
|
MyApp(){};
|
||||||
bool OnInit();
|
bool OnInit();
|
||||||
};
|
};
|
||||||
|
|
||||||
@@ -26,7 +26,7 @@ public:
|
|||||||
void TestFlexSizers(wxCommandEvent& event);
|
void TestFlexSizers(wxCommandEvent& event);
|
||||||
void TestNotebookSizers(wxCommandEvent& event);
|
void TestNotebookSizers(wxCommandEvent& event);
|
||||||
void TestGridBagSizer(wxCommandEvent& event);
|
void TestGridBagSizer(wxCommandEvent& event);
|
||||||
|
|
||||||
void OnAbout(wxCommandEvent& event);
|
void OnAbout(wxCommandEvent& event);
|
||||||
void OnQuit(wxCommandEvent& event);
|
void OnQuit(wxCommandEvent& event);
|
||||||
|
|
||||||
@@ -62,7 +62,7 @@ public:
|
|||||||
void OnHideBtn(wxCommandEvent&);
|
void OnHideBtn(wxCommandEvent&);
|
||||||
void OnShowBtn(wxCommandEvent&);
|
void OnShowBtn(wxCommandEvent&);
|
||||||
void OnMoveBtn(wxCommandEvent&);
|
void OnMoveBtn(wxCommandEvent&);
|
||||||
|
|
||||||
private:
|
private:
|
||||||
wxGridBagSizer* m_gbs;
|
wxGridBagSizer* m_gbs;
|
||||||
wxPanel* m_panel;
|
wxPanel* m_panel;
|
||||||
@@ -73,7 +73,7 @@ private:
|
|||||||
wxButton* m_moveBtn1;
|
wxButton* m_moveBtn1;
|
||||||
wxButton* m_moveBtn2;
|
wxButton* m_moveBtn2;
|
||||||
wxGBPosition m_lastPos;
|
wxGBPosition m_lastPos;
|
||||||
|
|
||||||
DECLARE_EVENT_TABLE()
|
DECLARE_EVENT_TABLE()
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@@ -2,7 +2,7 @@
|
|||||||
// Name: styles.cpp
|
// Name: styles.cpp
|
||||||
// Author: Robert Roebling
|
// Author: Robert Roebling
|
||||||
// Created: 04/07/02
|
// Created: 04/07/02
|
||||||
// Copyright:
|
// Copyright:
|
||||||
/////////////////////////////////////////////////////////////////////////////
|
/////////////////////////////////////////////////////////////////////////////
|
||||||
|
|
||||||
#ifdef __GNUG__
|
#ifdef __GNUG__
|
||||||
@@ -41,17 +41,17 @@ MyFrame::MyFrame( wxWindow *parent, wxWindowID id, const wxString &title,
|
|||||||
CreateStatusBar(1);
|
CreateStatusBar(1);
|
||||||
SetStatusText( _T("Welcome to Styles!") );
|
SetStatusText( _T("Welcome to Styles!") );
|
||||||
#endif // wxUSE_STATUSBAR
|
#endif // wxUSE_STATUSBAR
|
||||||
|
|
||||||
wxImage image;
|
wxImage image;
|
||||||
image.LoadFile( _T("marble.jpg"), wxBITMAP_TYPE_JPEG );
|
image.LoadFile( _T("marble.jpg"), wxBITMAP_TYPE_JPEG );
|
||||||
|
|
||||||
wxBitmap bitmap( image );
|
wxBitmap bitmap( image );
|
||||||
#ifdef __WXUNIVERSAL__
|
#ifdef __WXUNIVERSAL__
|
||||||
SetBackground( bitmap, 0, wxTILE );
|
SetBackground( bitmap, 0, wxTILE );
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
new wxStaticText( this, wxID_ANY, _T("This is text"), wxPoint( 20,50 ) );
|
new wxStaticText( this, wxID_ANY, _T("This is text"), wxPoint( 20,50 ) );
|
||||||
|
|
||||||
new wxCheckBox( this, wxID_ANY, _T("This is a checkbox"), wxPoint( 20,70 ) );
|
new wxCheckBox( this, wxID_ANY, _T("This is a checkbox"), wxPoint( 20,70 ) );
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -64,7 +64,7 @@ void MyFrame::CreateMyMenuBar()
|
|||||||
|
|
||||||
wxMenuBar *menu_bar = new wxMenuBar();
|
wxMenuBar *menu_bar = new wxMenuBar();
|
||||||
menu_bar->Append( file_menu, _T("&File") );
|
menu_bar->Append( file_menu, _T("&File") );
|
||||||
|
|
||||||
SetMenuBar( menu_bar );
|
SetMenuBar( menu_bar );
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -88,20 +88,16 @@ void MyFrame::OnCloseWindow( wxCloseEvent &WXUNUSED(event) )
|
|||||||
|
|
||||||
IMPLEMENT_APP(MyApp)
|
IMPLEMENT_APP(MyApp)
|
||||||
|
|
||||||
MyApp::MyApp()
|
|
||||||
{
|
|
||||||
}
|
|
||||||
|
|
||||||
bool MyApp::OnInit()
|
bool MyApp::OnInit()
|
||||||
{
|
{
|
||||||
wxInitAllImageHandlers();
|
wxInitAllImageHandlers();
|
||||||
|
|
||||||
SetVendorName(_T("Free world"));
|
SetVendorName(_T("Free world"));
|
||||||
SetAppName(_T("Styles"));
|
SetAppName(_T("Styles"));
|
||||||
|
|
||||||
MyFrame *frame = new MyFrame( NULL, wxID_ANY, _T("Styles"), wxPoint(20,20), wxSize(500,340) );
|
MyFrame *frame = new MyFrame( NULL, wxID_ANY, _T("Styles"), wxPoint(20,20), wxSize(500,340) );
|
||||||
frame->Show( true );
|
frame->Show( true );
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@@ -36,16 +36,16 @@ public:
|
|||||||
const wxPoint& pos = wxDefaultPosition,
|
const wxPoint& pos = wxDefaultPosition,
|
||||||
const wxSize& size = wxDefaultSize,
|
const wxSize& size = wxDefaultSize,
|
||||||
long style = wxDEFAULT_FRAME_STYLE );
|
long style = wxDEFAULT_FRAME_STYLE );
|
||||||
|
|
||||||
private:
|
private:
|
||||||
void CreateMyMenuBar();
|
void CreateMyMenuBar();
|
||||||
|
|
||||||
private:
|
private:
|
||||||
void OnAbout( wxCommandEvent &event );
|
void OnAbout( wxCommandEvent &event );
|
||||||
void OnQuit( wxCommandEvent &event );
|
void OnQuit( wxCommandEvent &event );
|
||||||
|
|
||||||
void OnCloseWindow( wxCloseEvent &event );
|
void OnCloseWindow( wxCloseEvent &event );
|
||||||
|
|
||||||
private:
|
private:
|
||||||
DECLARE_EVENT_TABLE()
|
DECLARE_EVENT_TABLE()
|
||||||
};
|
};
|
||||||
@@ -57,8 +57,8 @@ private:
|
|||||||
class MyApp: public wxApp
|
class MyApp: public wxApp
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
MyApp();
|
MyApp(){};
|
||||||
|
|
||||||
virtual bool OnInit();
|
virtual bool OnInit();
|
||||||
virtual int OnExit();
|
virtual int OnExit();
|
||||||
};
|
};
|
||||||
|
@@ -2,7 +2,7 @@
|
|||||||
// Name: wxedit.cpp
|
// Name: wxedit.cpp
|
||||||
// Author: Robert Roebling
|
// Author: Robert Roebling
|
||||||
// Created: 04/07/02
|
// Created: 04/07/02
|
||||||
// Copyright:
|
// Copyright:
|
||||||
/////////////////////////////////////////////////////////////////////////////
|
/////////////////////////////////////////////////////////////////////////////
|
||||||
|
|
||||||
#ifdef __GNUG__
|
#ifdef __GNUG__
|
||||||
@@ -34,20 +34,20 @@
|
|||||||
|
|
||||||
BEGIN_EVENT_TABLE(MyFrame,wxFrame)
|
BEGIN_EVENT_TABLE(MyFrame,wxFrame)
|
||||||
EVT_MENU(ID_ABOUT, MyFrame::OnAbout)
|
EVT_MENU(ID_ABOUT, MyFrame::OnAbout)
|
||||||
|
|
||||||
EVT_MENU(ID_NEW, MyFrame::OnNew)
|
EVT_MENU(ID_NEW, MyFrame::OnNew)
|
||||||
EVT_MENU(ID_OPEN, MyFrame::OnOpen)
|
EVT_MENU(ID_OPEN, MyFrame::OnOpen)
|
||||||
EVT_MENU(ID_SAVE, MyFrame::OnSave)
|
EVT_MENU(ID_SAVE, MyFrame::OnSave)
|
||||||
EVT_MENU(ID_SAVEAS, MyFrame::OnSaveAs)
|
EVT_MENU(ID_SAVEAS, MyFrame::OnSaveAs)
|
||||||
EVT_MENU(ID_QUIT, MyFrame::OnQuit)
|
EVT_MENU(ID_QUIT, MyFrame::OnQuit)
|
||||||
|
|
||||||
EVT_MENU(ID_COPY, MyFrame::OnCopy)
|
EVT_MENU(ID_COPY, MyFrame::OnCopy)
|
||||||
EVT_MENU(ID_CUT, MyFrame::OnCut)
|
EVT_MENU(ID_CUT, MyFrame::OnCut)
|
||||||
EVT_MENU(ID_PASTE, MyFrame::OnPaste)
|
EVT_MENU(ID_PASTE, MyFrame::OnPaste)
|
||||||
EVT_MENU(ID_DELETE, MyFrame::OnDelete)
|
EVT_MENU(ID_DELETE, MyFrame::OnDelete)
|
||||||
|
|
||||||
EVT_MENU_RANGE(ID_LAST_1, ID_LAST_3, MyFrame::OnLastFiles)
|
EVT_MENU_RANGE(ID_LAST_1, ID_LAST_3, MyFrame::OnLastFiles)
|
||||||
|
|
||||||
EVT_CLOSE(MyFrame::OnCloseWindow)
|
EVT_CLOSE(MyFrame::OnCloseWindow)
|
||||||
EVT_UPDATE_UI(wxID_ANY,MyFrame::OnUpdateUI)
|
EVT_UPDATE_UI(wxID_ANY,MyFrame::OnUpdateUI)
|
||||||
END_EVENT_TABLE()
|
END_EVENT_TABLE()
|
||||||
@@ -62,26 +62,26 @@ MyFrame::MyFrame( wxWindow *parent, wxWindowID id, const wxString &title,
|
|||||||
CreateStatusBar(1);
|
CreateStatusBar(1);
|
||||||
SetStatusText( _T("Welcome to wxEdit!") );
|
SetStatusText( _T("Welcome to wxEdit!") );
|
||||||
#endif // wxUSE_STATUSBAR
|
#endif // wxUSE_STATUSBAR
|
||||||
|
|
||||||
// Create edit control. Since it is the only
|
// Create edit control. Since it is the only
|
||||||
// control in the frame, it will be resized
|
// control in the frame, it will be resized
|
||||||
// to file it out.
|
// to file it out.
|
||||||
m_text = new wxTextCtrl( this, wxID_ANY, _T(""), wxDefaultPosition, wxDefaultSize, wxTE_MULTILINE );
|
m_text = new wxTextCtrl( this, wxID_ANY, _T(""), wxDefaultPosition, wxDefaultSize, wxTE_MULTILINE );
|
||||||
|
|
||||||
// Read .ini file for file history etc.
|
// Read .ini file for file history etc.
|
||||||
wxConfig *conf = (wxConfig*) wxConfig::Get();
|
wxConfig *conf = (wxConfig*) wxConfig::Get();
|
||||||
|
|
||||||
int entries = 0;
|
int entries = 0;
|
||||||
conf->Read( _T("/History/Count"), &entries );
|
conf->Read( _T("/History/Count"), &entries );
|
||||||
|
|
||||||
for (int i = 0; i < entries; i++)
|
for (int i = 0; i < entries; i++)
|
||||||
{
|
{
|
||||||
wxString tmp;
|
wxString tmp;
|
||||||
tmp.Printf( _T("/History/File%d"), (int)i );
|
tmp.Printf( _T("/History/File%d"), (int)i );
|
||||||
|
|
||||||
wxString res;
|
wxString res;
|
||||||
conf->Read( tmp, &res );
|
conf->Read( tmp, &res );
|
||||||
|
|
||||||
if (!res.empty())
|
if (!res.empty())
|
||||||
AddToHistory( res );
|
AddToHistory( res );
|
||||||
}
|
}
|
||||||
@@ -90,19 +90,19 @@ MyFrame::MyFrame( wxWindow *parent, wxWindowID id, const wxString &title,
|
|||||||
void MyFrame::MakeHistory()
|
void MyFrame::MakeHistory()
|
||||||
{
|
{
|
||||||
wxMenuBar *mb = GetMenuBar();
|
wxMenuBar *mb = GetMenuBar();
|
||||||
|
|
||||||
wxASSERT( mb );
|
wxASSERT( mb );
|
||||||
|
|
||||||
int max = m_history.GetCount();
|
int max = m_history.GetCount();
|
||||||
if (max > HISTORY_ENTRIES)
|
if (max > HISTORY_ENTRIES)
|
||||||
max = HISTORY_ENTRIES;
|
max = HISTORY_ENTRIES;
|
||||||
|
|
||||||
for (int i = 0; i < max; i++)
|
for (int i = 0; i < max; i++)
|
||||||
{
|
{
|
||||||
wxMenu *menu = NULL;
|
wxMenu *menu = NULL;
|
||||||
mb->FindItem( ID_LAST_1 + i, &menu );
|
mb->FindItem( ID_LAST_1 + i, &menu );
|
||||||
wxASSERT( menu );
|
wxASSERT( menu );
|
||||||
|
|
||||||
wxFileName fname( m_history[(size_t)i] );
|
wxFileName fname( m_history[(size_t)i] );
|
||||||
menu->SetLabel( ID_LAST_1 + i, fname.GetFullName() );
|
menu->SetLabel( ID_LAST_1 + i, fname.GetFullName() );
|
||||||
}
|
}
|
||||||
@@ -112,12 +112,12 @@ void MyFrame::AddToHistory( const wxString &fname )
|
|||||||
{
|
{
|
||||||
// Fill menu with history index
|
// Fill menu with history index
|
||||||
int index = m_history.Index( fname );
|
int index = m_history.Index( fname );
|
||||||
|
|
||||||
if (index != wxNOT_FOUND)
|
if (index != wxNOT_FOUND)
|
||||||
m_history.RemoveAt( (size_t) index );
|
m_history.RemoveAt( (size_t) index );
|
||||||
|
|
||||||
m_history.Insert( fname, 0 );
|
m_history.Insert( fname, 0 );
|
||||||
|
|
||||||
// Update menu
|
// Update menu
|
||||||
MakeHistory();
|
MakeHistory();
|
||||||
}
|
}
|
||||||
@@ -140,17 +140,17 @@ void MyFrame::CreateMyMenuBar()
|
|||||||
edit_menu->Append( ID_PASTE, _T("Paste") );
|
edit_menu->Append( ID_PASTE, _T("Paste") );
|
||||||
edit_menu->AppendSeparator();
|
edit_menu->AppendSeparator();
|
||||||
edit_menu->Append( ID_DELETE, _T("Delete") );
|
edit_menu->Append( ID_DELETE, _T("Delete") );
|
||||||
|
|
||||||
wxMenu *history_menu = new wxMenu;
|
wxMenu *history_menu = new wxMenu;
|
||||||
history_menu->Append( ID_LAST_1, _T("No file.") );
|
history_menu->Append( ID_LAST_1, _T("No file.") );
|
||||||
history_menu->Append( ID_LAST_2, _T("No file.") );
|
history_menu->Append( ID_LAST_2, _T("No file.") );
|
||||||
history_menu->Append( ID_LAST_3, _T("No file.") );
|
history_menu->Append( ID_LAST_3, _T("No file.") );
|
||||||
|
|
||||||
wxMenuBar *menu_bar = new wxMenuBar();
|
wxMenuBar *menu_bar = new wxMenuBar();
|
||||||
menu_bar->Append( file_menu, _T("&File") );
|
menu_bar->Append( file_menu, _T("&File") );
|
||||||
menu_bar->Append( edit_menu, _T("&Edit") );
|
menu_bar->Append( edit_menu, _T("&Edit") );
|
||||||
menu_bar->Append( history_menu, _T("&History") );
|
menu_bar->Append( history_menu, _T("&History") );
|
||||||
|
|
||||||
SetMenuBar( menu_bar );
|
SetMenuBar( menu_bar );
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -176,16 +176,16 @@ void MyFrame::OnLastFiles( wxCommandEvent &event )
|
|||||||
|
|
||||||
if (!m_filename.empty())
|
if (!m_filename.empty())
|
||||||
AddToHistory( m_filename );
|
AddToHistory( m_filename );
|
||||||
|
|
||||||
size_t index = event.GetId() - ID_LAST_1;
|
size_t index = event.GetId() - ID_LAST_1;
|
||||||
|
|
||||||
if( index < m_history.GetCount() )
|
if( index < m_history.GetCount() )
|
||||||
{
|
{
|
||||||
m_filename = m_history[index];
|
m_filename = m_history[index];
|
||||||
|
|
||||||
m_text->Clear();
|
m_text->Clear();
|
||||||
m_text->LoadFile( m_filename );
|
m_text->LoadFile( m_filename );
|
||||||
|
|
||||||
#if wxUSE_STATUSBAR
|
#if wxUSE_STATUSBAR
|
||||||
SetStatusText( m_filename );
|
SetStatusText( m_filename );
|
||||||
#endif // wxUSE_STATUSBAR
|
#endif // wxUSE_STATUSBAR
|
||||||
@@ -206,12 +206,12 @@ void MyFrame::OnNew( wxCommandEvent& WXUNUSED(event) )
|
|||||||
if (!Discard()) return;
|
if (!Discard()) return;
|
||||||
|
|
||||||
m_text->Clear();
|
m_text->Clear();
|
||||||
|
|
||||||
if (!m_filename.empty())
|
if (!m_filename.empty())
|
||||||
AddToHistory( m_filename );
|
AddToHistory( m_filename );
|
||||||
|
|
||||||
m_filename = wxEmptyString;
|
m_filename = wxEmptyString;
|
||||||
|
|
||||||
#if wxUSE_STATUSBAR
|
#if wxUSE_STATUSBAR
|
||||||
SetStatusText( _T("") );
|
SetStatusText( _T("") );
|
||||||
#endif // wxUSE_STATUSBAR
|
#endif // wxUSE_STATUSBAR
|
||||||
@@ -257,7 +257,7 @@ void MyFrame::OnOpen( wxCommandEvent& WXUNUSED(event) )
|
|||||||
|
|
||||||
m_filename = dialog.GetPath();
|
m_filename = dialog.GetPath();
|
||||||
m_text->LoadFile( m_filename );
|
m_text->LoadFile( m_filename );
|
||||||
|
|
||||||
#if wxUSE_STATUSBAR
|
#if wxUSE_STATUSBAR
|
||||||
SetStatusText( m_filename );
|
SetStatusText( m_filename );
|
||||||
#endif // wxUSE_STATUSBAR
|
#endif // wxUSE_STATUSBAR
|
||||||
@@ -278,7 +278,7 @@ void MyFrame::OnSaveAs( wxCommandEvent& WXUNUSED(event) )
|
|||||||
{
|
{
|
||||||
m_filename = dialog.GetPath();
|
m_filename = dialog.GetPath();
|
||||||
m_text->SaveFile( m_filename );
|
m_text->SaveFile( m_filename );
|
||||||
|
|
||||||
#if wxUSE_STATUSBAR
|
#if wxUSE_STATUSBAR
|
||||||
SetStatusText( m_filename );
|
SetStatusText( m_filename );
|
||||||
#endif // wxUSE_STATUSBAR
|
#endif // wxUSE_STATUSBAR
|
||||||
@@ -300,12 +300,12 @@ void MyFrame::OnQuit( wxCommandEvent& WXUNUSED(event) )
|
|||||||
bool MyFrame::Save()
|
bool MyFrame::Save()
|
||||||
{
|
{
|
||||||
wxCommandEvent event;
|
wxCommandEvent event;
|
||||||
|
|
||||||
if (m_filename.empty())
|
if (m_filename.empty())
|
||||||
OnSaveAs( event );
|
OnSaveAs( event );
|
||||||
else
|
else
|
||||||
m_text->SaveFile( m_filename );
|
m_text->SaveFile( m_filename );
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -315,19 +315,19 @@ bool MyFrame::Discard()
|
|||||||
{
|
{
|
||||||
wxMessageDialog dialog( this, _T("Text has been\nmodified! Save?"),
|
wxMessageDialog dialog( this, _T("Text has been\nmodified! Save?"),
|
||||||
_T("wxEdit"), wxYES_NO|wxCANCEL|wxICON_EXCLAMATION );
|
_T("wxEdit"), wxYES_NO|wxCANCEL|wxICON_EXCLAMATION );
|
||||||
|
|
||||||
int ret = dialog.ShowModal();
|
int ret = dialog.ShowModal();
|
||||||
|
|
||||||
if (ret == wxID_CANCEL)
|
if (ret == wxID_CANCEL)
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
if (ret == wxID_YES)
|
if (ret == wxID_YES)
|
||||||
{
|
{
|
||||||
if (!Save())
|
if (!Save())
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -353,7 +353,7 @@ void MyFrame::OnUpdateUI( wxUpdateUIEvent &event )
|
|||||||
m_text->GetSelection(& selFrom, & selTo);
|
m_text->GetSelection(& selFrom, & selTo);
|
||||||
event.Enable( selFrom != selTo );
|
event.Enable( selFrom != selTo );
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
break;
|
break;
|
||||||
@@ -363,29 +363,29 @@ void MyFrame::OnUpdateUI( wxUpdateUIEvent &event )
|
|||||||
void MyFrame::OnCloseWindow( wxCloseEvent& WXUNUSED(event) )
|
void MyFrame::OnCloseWindow( wxCloseEvent& WXUNUSED(event) )
|
||||||
{
|
{
|
||||||
// Save changes?
|
// Save changes?
|
||||||
if (!Discard()) return;
|
if (!Discard()) return;
|
||||||
|
|
||||||
// Add current to history
|
// Add current to history
|
||||||
if (!m_filename.empty())
|
if (!m_filename.empty())
|
||||||
AddToHistory( m_filename );
|
AddToHistory( m_filename );
|
||||||
|
|
||||||
// Write .ini file
|
// Write .ini file
|
||||||
wxConfig *conf = (wxConfig*) wxConfig::Get();
|
wxConfig *conf = (wxConfig*) wxConfig::Get();
|
||||||
|
|
||||||
int max = HISTORY_ENTRIES;
|
int max = HISTORY_ENTRIES;
|
||||||
if (m_history.GetCount() < (size_t)max)
|
if (m_history.GetCount() < (size_t)max)
|
||||||
max = m_history.GetCount();
|
max = m_history.GetCount();
|
||||||
|
|
||||||
conf->Write( _T("/History/Count"), max );
|
conf->Write( _T("/History/Count"), max );
|
||||||
|
|
||||||
for (int i = 0; i < max; i++)
|
for (int i = 0; i < max; i++)
|
||||||
{
|
{
|
||||||
wxString tmp;
|
wxString tmp;
|
||||||
tmp.Printf( _T("/History/File%d"), (int)i );
|
tmp.Printf( _T("/History/File%d"), (int)i );
|
||||||
|
|
||||||
conf->Write( tmp, m_history[(size_t)i] );
|
conf->Write( tmp, m_history[(size_t)i] );
|
||||||
}
|
}
|
||||||
|
|
||||||
// Flush and delete config
|
// Flush and delete config
|
||||||
delete wxConfig::Set( NULL );
|
delete wxConfig::Set( NULL );
|
||||||
|
|
||||||
@@ -399,18 +399,14 @@ void MyFrame::OnCloseWindow( wxCloseEvent& WXUNUSED(event) )
|
|||||||
|
|
||||||
IMPLEMENT_APP(MyApp)
|
IMPLEMENT_APP(MyApp)
|
||||||
|
|
||||||
MyApp::MyApp()
|
|
||||||
{
|
|
||||||
}
|
|
||||||
|
|
||||||
bool MyApp::OnInit()
|
bool MyApp::OnInit()
|
||||||
{
|
{
|
||||||
SetVendorName(_T("Free world"));
|
SetVendorName(_T("Free world"));
|
||||||
SetAppName(_T("wxEdit"));
|
SetAppName(_T("wxEdit"));
|
||||||
|
|
||||||
MyFrame *frame = new MyFrame( NULL, wxID_ANY, _T("wxEdit"), wxPoint(20,20), wxSize(500,340) );
|
MyFrame *frame = new MyFrame( NULL, wxID_ANY, _T("wxEdit"), wxPoint(20,20), wxSize(500,340) );
|
||||||
frame->Show( true );
|
frame->Show( true );
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@@ -50,15 +50,15 @@ public:
|
|||||||
const wxPoint& pos = wxDefaultPosition,
|
const wxPoint& pos = wxDefaultPosition,
|
||||||
const wxSize& size = wxDefaultSize,
|
const wxSize& size = wxDefaultSize,
|
||||||
long style = wxDEFAULT_FRAME_STYLE );
|
long style = wxDEFAULT_FRAME_STYLE );
|
||||||
|
|
||||||
private:
|
private:
|
||||||
void CreateMyMenuBar();
|
void CreateMyMenuBar();
|
||||||
|
|
||||||
private:
|
private:
|
||||||
wxTextCtrl *m_text;
|
wxTextCtrl *m_text;
|
||||||
wxString m_filename;
|
wxString m_filename;
|
||||||
wxArrayString m_history;
|
wxArrayString m_history;
|
||||||
|
|
||||||
private:
|
private:
|
||||||
void OnAbout( wxCommandEvent &event );
|
void OnAbout( wxCommandEvent &event );
|
||||||
void OnNew( wxCommandEvent &event );
|
void OnNew( wxCommandEvent &event );
|
||||||
@@ -66,23 +66,23 @@ private:
|
|||||||
void OnSave( wxCommandEvent &event );
|
void OnSave( wxCommandEvent &event );
|
||||||
void OnSaveAs( wxCommandEvent &event );
|
void OnSaveAs( wxCommandEvent &event );
|
||||||
void OnQuit( wxCommandEvent &event );
|
void OnQuit( wxCommandEvent &event );
|
||||||
|
|
||||||
void OnCopy( wxCommandEvent &event );
|
void OnCopy( wxCommandEvent &event );
|
||||||
void OnCut( wxCommandEvent &event );
|
void OnCut( wxCommandEvent &event );
|
||||||
void OnPaste( wxCommandEvent &event );
|
void OnPaste( wxCommandEvent &event );
|
||||||
void OnDelete( wxCommandEvent &event );
|
void OnDelete( wxCommandEvent &event );
|
||||||
|
|
||||||
void OnLastFiles( wxCommandEvent &event );
|
void OnLastFiles( wxCommandEvent &event );
|
||||||
|
|
||||||
void MakeHistory();
|
void MakeHistory();
|
||||||
void AddToHistory( const wxString &fname );
|
void AddToHistory( const wxString &fname );
|
||||||
|
|
||||||
bool Save();
|
bool Save();
|
||||||
bool Discard();
|
bool Discard();
|
||||||
|
|
||||||
void OnUpdateUI( wxUpdateUIEvent &event );
|
void OnUpdateUI( wxUpdateUIEvent &event );
|
||||||
void OnCloseWindow( wxCloseEvent &event );
|
void OnCloseWindow( wxCloseEvent &event );
|
||||||
|
|
||||||
private:
|
private:
|
||||||
DECLARE_EVENT_TABLE()
|
DECLARE_EVENT_TABLE()
|
||||||
};
|
};
|
||||||
@@ -94,8 +94,8 @@ private:
|
|||||||
class MyApp: public wxApp
|
class MyApp: public wxApp
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
MyApp();
|
MyApp(){};
|
||||||
|
|
||||||
virtual bool OnInit();
|
virtual bool OnInit();
|
||||||
virtual int OnExit();
|
virtual int OnExit();
|
||||||
};
|
};
|
||||||
|
@@ -34,11 +34,6 @@
|
|||||||
|
|
||||||
IMPLEMENT_APP(MyApp)
|
IMPLEMENT_APP(MyApp)
|
||||||
|
|
||||||
// Testing of ressources
|
|
||||||
MyApp::MyApp()
|
|
||||||
{
|
|
||||||
}
|
|
||||||
|
|
||||||
bool MyApp::OnInit(void)
|
bool MyApp::OnInit(void)
|
||||||
{
|
{
|
||||||
// Create the main frame window
|
// Create the main frame window
|
||||||
|
@@ -17,7 +17,7 @@
|
|||||||
class MyApp: public wxApp
|
class MyApp: public wxApp
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
MyApp(void) ;
|
MyApp(void){};
|
||||||
bool OnInit(void);
|
bool OnInit(void);
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@@ -373,10 +373,6 @@ TestGLCanvas::TestGLCanvas(wxWindow *parent, wxWindowID id,
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
TestGLCanvas::~TestGLCanvas()
|
|
||||||
{
|
|
||||||
}
|
|
||||||
|
|
||||||
void TestGLCanvas::OnPaint( wxPaintEvent& WXUNUSED(event) )
|
void TestGLCanvas::OnPaint( wxPaintEvent& WXUNUSED(event) )
|
||||||
{
|
{
|
||||||
// This is a dummy, to avoid an endless succession of paint messages.
|
// This is a dummy, to avoid an endless succession of paint messages.
|
||||||
|
@@ -29,7 +29,7 @@ public:
|
|||||||
const wxSize& size = wxDefaultSize, long style = 0,
|
const wxSize& size = wxDefaultSize, long style = 0,
|
||||||
const wxString& name = _T("TestGLCanvas"), int *gl_attrib = NULL);
|
const wxString& name = _T("TestGLCanvas"), int *gl_attrib = NULL);
|
||||||
|
|
||||||
~TestGLCanvas();
|
~TestGLCanvas(){};
|
||||||
|
|
||||||
void OnPaint(wxPaintEvent& event);
|
void OnPaint(wxPaintEvent& event);
|
||||||
void OnSize(wxSizeEvent& event);
|
void OnSize(wxSizeEvent& event);
|
||||||
|
@@ -63,7 +63,7 @@ static wxInt32 read_short(FILE *f)
|
|||||||
// when using the direct evaluation in the return statement
|
// when using the direct evaluation in the return statement
|
||||||
wxInt32 first = read_char(f) ;
|
wxInt32 first = read_char(f) ;
|
||||||
wxInt32 second = read_char(f) ;
|
wxInt32 second = read_char(f) ;
|
||||||
|
|
||||||
return (first<<8) | second ;
|
return (first<<8) | second ;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -91,7 +91,7 @@ static int read_string(FILE *f, char *s)
|
|||||||
do {
|
do {
|
||||||
c = read_char(f);
|
c = read_char(f);
|
||||||
if (cnt < LW_MAX_NAME_LEN)
|
if (cnt < LW_MAX_NAME_LEN)
|
||||||
s[cnt] = c;
|
s[cnt] = (char)c;
|
||||||
else
|
else
|
||||||
s[LW_MAX_NAME_LEN-1] = 0;
|
s[LW_MAX_NAME_LEN-1] = 0;
|
||||||
cnt++;
|
cnt++;
|
||||||
@@ -170,7 +170,7 @@ static void read_surf(FILE *f, int nbytes, lwObject *lwo)
|
|||||||
static void read_pols(FILE *f, int nbytes, lwObject *lwo)
|
static void read_pols(FILE *f, int nbytes, lwObject *lwo)
|
||||||
{
|
{
|
||||||
int guess_cnt = lwo->face_cnt;
|
int guess_cnt = lwo->face_cnt;
|
||||||
|
|
||||||
while (nbytes > 0) {
|
while (nbytes > 0) {
|
||||||
lwFace *face;
|
lwFace *face;
|
||||||
int i;
|
int i;
|
||||||
@@ -188,17 +188,17 @@ static void read_pols(FILE *f, int nbytes, lwObject *lwo)
|
|||||||
|
|
||||||
/* allocate space for points */
|
/* allocate space for points */
|
||||||
face->index = (int*) calloc(sizeof(int)*face->index_cnt,1);
|
face->index = (int*) calloc(sizeof(int)*face->index_cnt,1);
|
||||||
|
|
||||||
/* read points in */
|
/* read points in */
|
||||||
for (i=0; i<face->index_cnt; i++) {
|
for (i=0; i<face->index_cnt; i++) {
|
||||||
face->index[i] = read_short(f);
|
face->index[i] = read_short(f);
|
||||||
nbytes -= 2;
|
nbytes -= 2;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* read surface material */
|
/* read surface material */
|
||||||
face->material = read_short(f);
|
face->material = read_short(f);
|
||||||
nbytes -= 2;
|
nbytes -= 2;
|
||||||
|
|
||||||
/* skip over detail polygons */
|
/* skip over detail polygons */
|
||||||
if (face->material < 0) {
|
if (face->material < 0) {
|
||||||
int det_cnt;
|
int det_cnt;
|
||||||
|
@@ -2,7 +2,7 @@
|
|||||||
// Name: ownerdrw.cpp
|
// Name: ownerdrw.cpp
|
||||||
// Purpose: Owner-draw sample, for Windows
|
// Purpose: Owner-draw sample, for Windows
|
||||||
// Author: Vadim Zeitlin
|
// Author: Vadim Zeitlin
|
||||||
// Modified by:
|
// Modified by:
|
||||||
// Created: 13.11.97
|
// Created: 13.11.97
|
||||||
// RCS-ID: $Id$
|
// RCS-ID: $Id$
|
||||||
// Copyright: (c) 1998 Vadim Zeitlin <zeitlin@dptmaths.ens-cachan.fr>
|
// Copyright: (c) 1998 Vadim Zeitlin <zeitlin@dptmaths.ens-cachan.fr>
|
||||||
@@ -41,7 +41,7 @@ class OwnerDrawnFrame : public wxFrame
|
|||||||
public:
|
public:
|
||||||
// ctor & dtor
|
// ctor & dtor
|
||||||
OwnerDrawnFrame(wxFrame *frame, wxChar *title, int x, int y, int w, int h);
|
OwnerDrawnFrame(wxFrame *frame, wxChar *title, int x, int y, int w, int h);
|
||||||
~OwnerDrawnFrame();
|
~OwnerDrawnFrame(){};
|
||||||
|
|
||||||
// notifications
|
// notifications
|
||||||
void OnQuit (wxCommandEvent& event);
|
void OnQuit (wxCommandEvent& event);
|
||||||
@@ -61,12 +61,12 @@ private:
|
|||||||
wxMenuItem *pAboutItem;
|
wxMenuItem *pAboutItem;
|
||||||
};
|
};
|
||||||
|
|
||||||
enum
|
enum
|
||||||
{
|
{
|
||||||
Menu_Quit = 1,
|
Menu_Quit = 1,
|
||||||
Menu_First = 100,
|
Menu_First = 100,
|
||||||
Menu_Test1, Menu_Test2, Menu_Test3,
|
Menu_Test1, Menu_Test2, Menu_Test3,
|
||||||
Menu_Bitmap, Menu_Bitmap2,
|
Menu_Bitmap, Menu_Bitmap2,
|
||||||
Menu_Submenu, Menu_Sub1, Menu_Sub2, Menu_Sub3,
|
Menu_Submenu, Menu_Sub1, Menu_Sub2, Menu_Sub3,
|
||||||
Menu_Toggle, Menu_About,
|
Menu_Toggle, Menu_About,
|
||||||
Control_First = 1000,
|
Control_First = 1000,
|
||||||
@@ -79,7 +79,7 @@ BEGIN_EVENT_TABLE(OwnerDrawnFrame, wxFrame)
|
|||||||
EVT_MENU(Menu_Quit, OwnerDrawnFrame::OnQuit)
|
EVT_MENU(Menu_Quit, OwnerDrawnFrame::OnQuit)
|
||||||
EVT_LISTBOX(Control_Listbox, OwnerDrawnFrame::OnListboxSelect)
|
EVT_LISTBOX(Control_Listbox, OwnerDrawnFrame::OnListboxSelect)
|
||||||
EVT_CHECKLISTBOX(Control_Listbox, OwnerDrawnFrame::OnCheckboxToggle)
|
EVT_CHECKLISTBOX(Control_Listbox, OwnerDrawnFrame::OnCheckboxToggle)
|
||||||
EVT_COMMAND(Control_Listbox, wxEVT_COMMAND_LISTBOX_DOUBLECLICKED,
|
EVT_COMMAND(Control_Listbox, wxEVT_COMMAND_LISTBOX_DOUBLECLICKED,
|
||||||
OwnerDrawnFrame::OnListboxDblClick)
|
OwnerDrawnFrame::OnListboxDblClick)
|
||||||
END_EVENT_TABLE()
|
END_EVENT_TABLE()
|
||||||
|
|
||||||
@@ -176,13 +176,13 @@ void OwnerDrawnFrame::InitMenu()
|
|||||||
file_menu->Append(pItem);
|
file_menu->Append(pItem);
|
||||||
|
|
||||||
file_menu->AppendSeparator();
|
file_menu->AppendSeparator();
|
||||||
pItem = new wxMenuItem(file_menu, Menu_Toggle, _T("&Disable/Enable\tCtrl+D"),
|
pItem = new wxMenuItem(file_menu, Menu_Toggle, _T("&Disable/Enable\tCtrl+D"),
|
||||||
_T("enables/disables the About-Item"), wxITEM_NORMAL);
|
_T("enables/disables the About-Item"), wxITEM_NORMAL);
|
||||||
pItem->SetFont(*wxNORMAL_FONT);
|
pItem->SetFont(*wxNORMAL_FONT);
|
||||||
file_menu->Append(pItem);
|
file_menu->Append(pItem);
|
||||||
|
|
||||||
// Of course Ctrl+RatherLongAccel will not work in this example:
|
// Of course Ctrl+RatherLongAccel will not work in this example:
|
||||||
pAboutItem = new wxMenuItem(file_menu, Menu_About, _T("&About\tCtrl+RatherLongAccel"),
|
pAboutItem = new wxMenuItem(file_menu, Menu_About, _T("&About\tCtrl+RatherLongAccel"),
|
||||||
_T("display program information"), wxITEM_NORMAL);
|
_T("display program information"), wxITEM_NORMAL);
|
||||||
pAboutItem->SetBitmap(bmpInfo);
|
pAboutItem->SetBitmap(bmpInfo);
|
||||||
pAboutItem->SetDisabledBitmap(bmpInfo_mono);
|
pAboutItem->SetDisabledBitmap(bmpInfo_mono);
|
||||||
@@ -224,7 +224,7 @@ OwnerDrawnFrame::OwnerDrawnFrame(wxFrame *frame, wxChar *title,
|
|||||||
wxPanel *pPanel = new wxPanel(this);
|
wxPanel *pPanel = new wxPanel(this);
|
||||||
|
|
||||||
// check list box
|
// check list box
|
||||||
static const wxChar* aszChoices[] = { _T("Hello"), _T("world"), _T("and"),
|
static const wxChar* aszChoices[] = { _T("Hello"), _T("world"), _T("and"),
|
||||||
_T("goodbye"), _T("cruel"), _T("world"),
|
_T("goodbye"), _T("cruel"), _T("world"),
|
||||||
_T("-------"), _T("owner-drawn"), _T("listbox") };
|
_T("-------"), _T("owner-drawn"), _T("listbox") };
|
||||||
|
|
||||||
@@ -256,7 +256,7 @@ OwnerDrawnFrame::OwnerDrawnFrame(wxFrame *frame, wxChar *title,
|
|||||||
|
|
||||||
// normal (but owner-drawn) listbox
|
// normal (but owner-drawn) listbox
|
||||||
static const wxChar* aszColors[] = { _T("Red"), _T("Blue"), _T("Pink"),
|
static const wxChar* aszColors[] = { _T("Red"), _T("Blue"), _T("Pink"),
|
||||||
_T("Green"), _T("Yellow"),
|
_T("Green"), _T("Yellow"),
|
||||||
_T("Black"), _T("Violet") };
|
_T("Black"), _T("Violet") };
|
||||||
|
|
||||||
astrChoices = new wxString[WXSIZEOF(aszColors)];
|
astrChoices = new wxString[WXSIZEOF(aszColors)];
|
||||||
@@ -279,17 +279,17 @@ OwnerDrawnFrame::OwnerDrawnFrame(wxFrame *frame, wxChar *title,
|
|||||||
|
|
||||||
#if defined(__WXMSW__) && !defined(__WXUNIVERSAL__)
|
#if defined(__WXMSW__) && !defined(__WXUNIVERSAL__)
|
||||||
|
|
||||||
struct { unsigned int r, g, b; } aColors[] =
|
struct { unsigned char r, g, b; } aColors[] =
|
||||||
{
|
{
|
||||||
{255,0,0}, {0,0,255}, {255,128,192},
|
{255,0,0}, {0,0,255}, {255,128,192},
|
||||||
{0,255,0}, {255,255,128},
|
{0,255,0}, {255,255,128},
|
||||||
{0,0,0}, {128,0,255}
|
{0,0,0}, {128,0,255}
|
||||||
};
|
};
|
||||||
|
|
||||||
for ( ui = 0; ui < WXSIZEOF(aszColors); ui++ )
|
for ( ui = 0; ui < WXSIZEOF(aszColors); ui++ )
|
||||||
{
|
{
|
||||||
pListBox->GetItem(ui)->SetTextColour(wxColor(aColors[ui].r,
|
pListBox->GetItem(ui)->SetTextColour(wxColor(aColors[ui].r,
|
||||||
aColors[ui].g,
|
aColors[ui].g,
|
||||||
aColors[ui].b));
|
aColors[ui].b));
|
||||||
// yellow on white is horrible...
|
// yellow on white is horrible...
|
||||||
if ( ui == 4 )
|
if ( ui == 4 )
|
||||||
@@ -307,10 +307,6 @@ OwnerDrawnFrame::OwnerDrawnFrame(wxFrame *frame, wxChar *title,
|
|||||||
Show(true);
|
Show(true);
|
||||||
}
|
}
|
||||||
|
|
||||||
OwnerDrawnFrame::~OwnerDrawnFrame()
|
|
||||||
{
|
|
||||||
}
|
|
||||||
|
|
||||||
void OwnerDrawnFrame::OnQuit(wxCommandEvent& WXUNUSED(event))
|
void OwnerDrawnFrame::OnQuit(wxCommandEvent& WXUNUSED(event))
|
||||||
{
|
{
|
||||||
Close(true);
|
Close(true);
|
||||||
|
@@ -29,10 +29,6 @@ wxBitmap *g_TestBitmap = (wxBitmap *) NULL;
|
|||||||
|
|
||||||
IMPLEMENT_APP(MyApp)
|
IMPLEMENT_APP(MyApp)
|
||||||
|
|
||||||
MyApp::MyApp()
|
|
||||||
{
|
|
||||||
}
|
|
||||||
|
|
||||||
bool MyApp::OnInit(void)
|
bool MyApp::OnInit(void)
|
||||||
{
|
{
|
||||||
wxImage::AddHandler(new wxPNGHandler);
|
wxImage::AddHandler(new wxPNGHandler);
|
||||||
@@ -119,9 +115,9 @@ void MyFrame::OnSaveFile(wxCommandEvent& WXUNUSED(event))
|
|||||||
wxT("png"), wxT("PNG files (*.png)|*.png") );
|
wxT("png"), wxT("PNG files (*.png)|*.png") );
|
||||||
|
|
||||||
if (f == _T("")) return;
|
if (f == _T("")) return;
|
||||||
|
|
||||||
wxBitmap *backstore = new wxBitmap( 150, 150 );
|
wxBitmap *backstore = new wxBitmap( 150, 150 );
|
||||||
|
|
||||||
wxMemoryDC memDC;
|
wxMemoryDC memDC;
|
||||||
memDC.SelectObject( *backstore );
|
memDC.SelectObject( *backstore );
|
||||||
memDC.Clear();
|
memDC.Clear();
|
||||||
@@ -132,11 +128,11 @@ void MyFrame::OnSaveFile(wxCommandEvent& WXUNUSED(event))
|
|||||||
memDC.DrawLine( 0, 0, 0, 10 );
|
memDC.DrawLine( 0, 0, 0, 10 );
|
||||||
memDC.SetTextForeground( *wxWHITE );
|
memDC.SetTextForeground( *wxWHITE );
|
||||||
memDC.DrawText( _T("This is a memory dc."), 10, 10 );
|
memDC.DrawText( _T("This is a memory dc."), 10, 10 );
|
||||||
|
|
||||||
memDC.SelectObject( wxNullBitmap );
|
memDC.SelectObject( wxNullBitmap );
|
||||||
|
|
||||||
backstore->SaveFile( f, wxBITMAP_TYPE_PNG, (wxPalette*)NULL );
|
backstore->SaveFile( f, wxBITMAP_TYPE_PNG, (wxPalette*)NULL );
|
||||||
|
|
||||||
delete backstore;
|
delete backstore;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -173,10 +169,6 @@ MyCanvas::MyCanvas(wxWindow *parent, const wxPoint& pos, const wxSize& size):
|
|||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
MyCanvas::~MyCanvas(void)
|
|
||||||
{
|
|
||||||
}
|
|
||||||
|
|
||||||
// Define the repainting behaviour
|
// Define the repainting behaviour
|
||||||
void MyCanvas::OnPaint(wxPaintEvent& WXUNUSED(event))
|
void MyCanvas::OnPaint(wxPaintEvent& WXUNUSED(event))
|
||||||
{
|
{
|
||||||
|
@@ -19,7 +19,7 @@
|
|||||||
class MyApp: public wxApp
|
class MyApp: public wxApp
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
MyApp(void) ;
|
MyApp(void){};
|
||||||
bool OnInit(void);
|
bool OnInit(void);
|
||||||
};
|
};
|
||||||
|
|
||||||
@@ -46,7 +46,7 @@ class MyCanvas: public wxScrolledWindow
|
|||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
MyCanvas(wxWindow *parent, const wxPoint& pos, const wxSize& size);
|
MyCanvas(wxWindow *parent, const wxPoint& pos, const wxSize& size);
|
||||||
~MyCanvas(void) ;
|
~MyCanvas(void){};
|
||||||
|
|
||||||
void OnPaint(wxPaintEvent& event);
|
void OnPaint(wxPaintEvent& event);
|
||||||
DECLARE_EVENT_TABLE()
|
DECLARE_EVENT_TABLE()
|
||||||
|
@@ -66,10 +66,6 @@ IMPLEMENT_APP(MyApp)
|
|||||||
// Writes a header on a page. Margin units are in millimetres.
|
// Writes a header on a page. Margin units are in millimetres.
|
||||||
bool WritePageHeader(wxPrintout *printout, wxDC *dc, wxChar *text, float mmToLogical);
|
bool WritePageHeader(wxPrintout *printout, wxDC *dc, wxChar *text, float mmToLogical);
|
||||||
|
|
||||||
MyApp::MyApp()
|
|
||||||
{
|
|
||||||
}
|
|
||||||
|
|
||||||
// The `main program' equivalent, creating the windows and returning the
|
// The `main program' equivalent, creating the windows and returning the
|
||||||
// main frame
|
// main frame
|
||||||
bool MyApp::OnInit(void)
|
bool MyApp::OnInit(void)
|
||||||
@@ -340,10 +336,6 @@ MyCanvas::MyCanvas(wxFrame *frame, const wxPoint& pos, const wxSize& size, long
|
|||||||
SetBackgroundColour(* wxWHITE);
|
SetBackgroundColour(* wxWHITE);
|
||||||
}
|
}
|
||||||
|
|
||||||
MyCanvas::~MyCanvas(void)
|
|
||||||
{
|
|
||||||
}
|
|
||||||
|
|
||||||
// Define the repainting behaviour
|
// Define the repainting behaviour
|
||||||
void MyCanvas::OnDraw(wxDC& dc)
|
void MyCanvas::OnDraw(wxDC& dc)
|
||||||
{
|
{
|
||||||
|
@@ -17,7 +17,7 @@
|
|||||||
class MyApp: public wxApp
|
class MyApp: public wxApp
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
MyApp() ;
|
MyApp(){};
|
||||||
bool OnInit();
|
bool OnInit();
|
||||||
int OnExit();
|
int OnExit();
|
||||||
|
|
||||||
@@ -59,7 +59,7 @@ class MyCanvas: public wxScrolledWindow
|
|||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
MyCanvas(wxFrame *frame, const wxPoint& pos, const wxSize& size, long style = wxRETAINED);
|
MyCanvas(wxFrame *frame, const wxPoint& pos, const wxSize& size, long style = wxRETAINED);
|
||||||
~MyCanvas(void) ;
|
~MyCanvas(void){};
|
||||||
|
|
||||||
virtual void OnDraw(wxDC& dc);
|
virtual void OnDraw(wxDC& dc);
|
||||||
void OnEvent(wxMouseEvent& event);
|
void OnEvent(wxMouseEvent& event);
|
||||||
|
@@ -735,11 +735,6 @@ wxLayoutLine::wxLayoutLine(wxLayoutLine *prev, wxLayoutList *llist)
|
|||||||
llist->IncNumLines();
|
llist->IncNumLines();
|
||||||
}
|
}
|
||||||
|
|
||||||
wxLayoutLine::~wxLayoutLine()
|
|
||||||
{
|
|
||||||
// kbList cleans itself
|
|
||||||
}
|
|
||||||
|
|
||||||
wxPoint
|
wxPoint
|
||||||
wxLayoutLine::RecalculatePosition(wxLayoutList *llist)
|
wxLayoutLine::RecalculatePosition(wxLayoutList *llist)
|
||||||
{
|
{
|
||||||
@@ -777,14 +772,15 @@ wxLayoutLine::FindObject(CoordType xpos, CoordType *offset) const
|
|||||||
wxASSERT(offset);
|
wxASSERT(offset);
|
||||||
wxLayoutObjectList::iterator
|
wxLayoutObjectList::iterator
|
||||||
i,
|
i,
|
||||||
found = NULLIT;
|
found(NULL),
|
||||||
|
nulled(NULL);
|
||||||
CoordType x = 0, len;
|
CoordType x = 0, len;
|
||||||
|
|
||||||
/* We search through the objects. As we don't like returning the
|
/* We search through the objects. As we don't like returning the
|
||||||
object that the cursor is behind, we just remember such an
|
object that the cursor is behind, we just remember such an
|
||||||
object in "found" so we can return it if there is really no
|
object in "found" so we can return it if there is really no
|
||||||
further object following it. */
|
further object following it. */
|
||||||
for(i = m_ObjectList.begin(); i != NULLIT; i++)
|
for(i = m_ObjectList.begin(); i != nulled; i++)
|
||||||
{
|
{
|
||||||
len = (**i).GetLength();
|
len = (**i).GetLength();
|
||||||
if( x <= xpos && xpos <= x + len )
|
if( x <= xpos && xpos <= x + len )
|
||||||
@@ -809,10 +805,10 @@ wxLayoutLine::FindObjectScreen(wxDC &dc, wxLayoutList *llist,
|
|||||||
|
|
||||||
llist->ApplyStyle(GetStyleInfo(), dc);
|
llist->ApplyStyle(GetStyleInfo(), dc);
|
||||||
|
|
||||||
wxLayoutObjectList::iterator i;
|
wxLayoutObjectList::iterator i, nulled(NULL);
|
||||||
CoordType x = 0, cx = 0, width;
|
CoordType x = 0, cx = 0, width;
|
||||||
|
|
||||||
for(i = m_ObjectList.begin(); i != NULLIT; i++)
|
for(i = m_ObjectList.begin(); i != nulled; i++)
|
||||||
{
|
{
|
||||||
wxLayoutObject *obj = *i;
|
wxLayoutObject *obj = *i;
|
||||||
if ( obj->GetType() == WXLO_TYPE_CMD )
|
if ( obj->GetType() == WXLO_TYPE_CMD )
|
||||||
@@ -883,7 +879,8 @@ wxLayoutLine::Insert(CoordType xpos, wxLayoutObject *obj)
|
|||||||
|
|
||||||
CoordType offset;
|
CoordType offset;
|
||||||
wxLOiterator i = FindObject(xpos, &offset);
|
wxLOiterator i = FindObject(xpos, &offset);
|
||||||
if(i == NULLIT)
|
wxLayoutObjectList::iterator nulled(NULL);
|
||||||
|
if(i == nulled)
|
||||||
{
|
{
|
||||||
if(xpos == 0 ) // aha, empty line!
|
if(xpos == 0 ) // aha, empty line!
|
||||||
{
|
{
|
||||||
@@ -940,7 +937,8 @@ wxLayoutLine::Insert(CoordType xpos, const wxString& text)
|
|||||||
|
|
||||||
CoordType offset;
|
CoordType offset;
|
||||||
wxLOiterator i = FindObject(xpos, &offset);
|
wxLOiterator i = FindObject(xpos, &offset);
|
||||||
if(i != NULLIT && (**i).GetType() == WXLO_TYPE_TEXT)
|
wxLayoutObjectList::iterator nulled(NULL);
|
||||||
|
if(i != nulled && (**i).GetType() == WXLO_TYPE_TEXT)
|
||||||
{
|
{
|
||||||
wxLayoutObjectText *tobj = (wxLayoutObjectText *) *i;
|
wxLayoutObjectText *tobj = (wxLayoutObjectText *) *i;
|
||||||
tobj->GetText().insert(offset, text);
|
tobj->GetText().insert(offset, text);
|
||||||
@@ -964,9 +962,10 @@ wxLayoutLine::Delete(CoordType xpos, CoordType npos)
|
|||||||
wxASSERT(npos >= 0);
|
wxASSERT(npos >= 0);
|
||||||
MarkDirty(xpos);
|
MarkDirty(xpos);
|
||||||
wxLOiterator i = FindObject(xpos, &offset);
|
wxLOiterator i = FindObject(xpos, &offset);
|
||||||
|
wxLayoutObjectList::iterator nulled(NULL);
|
||||||
while(npos > 0)
|
while(npos > 0)
|
||||||
{
|
{
|
||||||
if(i == NULLIT) return npos;
|
if(i == nulled) return npos;
|
||||||
// now delete from that object:
|
// now delete from that object:
|
||||||
if((**i).GetType() != WXLO_TYPE_TEXT)
|
if((**i).GetType() != WXLO_TYPE_TEXT)
|
||||||
{
|
{
|
||||||
@@ -1020,10 +1019,10 @@ wxLayoutLine::DeleteWord(CoordType xpos)
|
|||||||
MarkDirty(xpos);
|
MarkDirty(xpos);
|
||||||
|
|
||||||
wxLOiterator i = FindObject(xpos, &offset);
|
wxLOiterator i = FindObject(xpos, &offset);
|
||||||
|
wxLayoutObjectList::iterator nulled(NULL);
|
||||||
for(;;)
|
for(;;)
|
||||||
{
|
{
|
||||||
if(i == NULLIT) return false;
|
if(i == nulled) return false;
|
||||||
if((**i).GetType() != WXLO_TYPE_TEXT)
|
if((**i).GetType() != WXLO_TYPE_TEXT)
|
||||||
{
|
{
|
||||||
// This should only happen when at end of line, behind a non-text
|
// This should only happen when at end of line, behind a non-text
|
||||||
@@ -1094,7 +1093,7 @@ wxLayoutLine::Draw(wxDC &dc,
|
|||||||
wxLayoutList *llist,
|
wxLayoutList *llist,
|
||||||
const wxPoint & offset) const
|
const wxPoint & offset) const
|
||||||
{
|
{
|
||||||
wxLayoutObjectList::iterator i;
|
wxLayoutObjectList::iterator i, nulled(NULL);
|
||||||
wxPoint pos = offset;
|
wxPoint pos = offset;
|
||||||
pos = pos + GetPosition();
|
pos = pos + GetPosition();
|
||||||
|
|
||||||
@@ -1111,7 +1110,7 @@ wxLayoutLine::Draw(wxDC &dc,
|
|||||||
else
|
else
|
||||||
llist->EndHighlighting(dc);
|
llist->EndHighlighting(dc);
|
||||||
|
|
||||||
for(i = m_ObjectList.begin(); i != NULLIT; i++)
|
for(i = m_ObjectList.begin(); i != nulled; i++)
|
||||||
{
|
{
|
||||||
if(highlight == -1) // partially highlight line
|
if(highlight == -1) // partially highlight line
|
||||||
{
|
{
|
||||||
@@ -1142,7 +1141,7 @@ wxLayoutLine::Layout(wxDC &dc,
|
|||||||
int cx,
|
int cx,
|
||||||
bool WXUNUSED(suppressSIupdate))
|
bool WXUNUSED(suppressSIupdate))
|
||||||
{
|
{
|
||||||
wxLayoutObjectList::iterator i;
|
wxLayoutObjectList::iterator i, nulled(NULL);
|
||||||
|
|
||||||
// when a line becomes dirty, we redraw it from the place where it was
|
// when a line becomes dirty, we redraw it from the place where it was
|
||||||
// changed till the end of line (because the following wxLayoutObjects are
|
// changed till the end of line (because the following wxLayoutObjects are
|
||||||
@@ -1177,7 +1176,7 @@ wxLayoutLine::Layout(wxDC &dc,
|
|||||||
}
|
}
|
||||||
|
|
||||||
m_StyleInfo = llist->GetStyleInfo(); // save current style
|
m_StyleInfo = llist->GetStyleInfo(); // save current style
|
||||||
for(i = m_ObjectList.begin(); i != NULLIT; i++)
|
for(i = m_ObjectList.begin(); i != nulled; i++)
|
||||||
{
|
{
|
||||||
wxLayoutObject *obj = *i;
|
wxLayoutObject *obj = *i;
|
||||||
obj->Layout(dc, llist);
|
obj->Layout(dc, llist);
|
||||||
@@ -1313,7 +1312,8 @@ wxLayoutLine::Break(CoordType xpos, wxLayoutList *llist)
|
|||||||
|
|
||||||
CoordType offset;
|
CoordType offset;
|
||||||
wxLOiterator i = FindObject(xpos, &offset);
|
wxLOiterator i = FindObject(xpos, &offset);
|
||||||
if(i == NULLIT)
|
wxLayoutObjectList::iterator nulled(NULL);
|
||||||
|
if(i == nulled)
|
||||||
// must be at the end of the line then
|
// must be at the end of the line then
|
||||||
return new wxLayoutLine(this, llist);
|
return new wxLayoutLine(this, llist);
|
||||||
// split this line:
|
// split this line:
|
||||||
@@ -1356,18 +1356,19 @@ wxLayoutLine::Break(CoordType xpos, wxLayoutList *llist)
|
|||||||
bool
|
bool
|
||||||
wxLayoutLine::Wrap(CoordType wrapmargin, wxLayoutList *llist)
|
wxLayoutLine::Wrap(CoordType wrapmargin, wxLayoutList *llist)
|
||||||
{
|
{
|
||||||
|
wxLayoutObjectList::iterator nulled(NULL);
|
||||||
if(GetLength() < wrapmargin)
|
if(GetLength() < wrapmargin)
|
||||||
return false; // nothing to do
|
return false; // nothing to do
|
||||||
|
|
||||||
// find the object which covers the wrapmargin:
|
// find the object which covers the wrapmargin:
|
||||||
CoordType offset;
|
CoordType offset;
|
||||||
wxLOiterator i = FindObject(wrapmargin, &offset);
|
wxLOiterator i = FindObject(wrapmargin, &offset);
|
||||||
wxCHECK_MSG( i != NULLIT, false,
|
wxCHECK_MSG( i != nulled, false,
|
||||||
wxT("Cannot find object covering wrapmargin."));
|
wxT("Cannot find object covering wrapmargin."));
|
||||||
|
|
||||||
// from this object on, the rest of the line must be copied to the
|
// from this object on, the rest of the line must be copied to the
|
||||||
// next one:
|
// next one:
|
||||||
wxLOiterator copyObject = NULLIT;
|
wxLOiterator copyObject = nulled;
|
||||||
// if we split a text-object, we must pre-pend some text to the
|
// if we split a text-object, we must pre-pend some text to the
|
||||||
// next line later on, remember it here:
|
// next line later on, remember it here:
|
||||||
wxString prependText = _T("");
|
wxString prependText = _T("");
|
||||||
@@ -1390,7 +1391,7 @@ wxLayoutLine::Wrap(CoordType wrapmargin, wxLayoutList *llist)
|
|||||||
bool foundSpace = false;
|
bool foundSpace = false;
|
||||||
do
|
do
|
||||||
{
|
{
|
||||||
// while(i != NULLIT && (**i).GetType() != WXLO_TYPE_TEXT)
|
// while(i != nulled && (**i).GetType() != WXLO_TYPE_TEXT)
|
||||||
// i--;
|
// i--;
|
||||||
// try to find a suitable place to split the object:
|
// try to find a suitable place to split the object:
|
||||||
wxLayoutObjectText *tobj = (wxLayoutObjectText *)*i;
|
wxLayoutObjectText *tobj = (wxLayoutObjectText *)*i;
|
||||||
@@ -1431,7 +1432,7 @@ wxLayoutLine::Wrap(CoordType wrapmargin, wxLayoutList *llist)
|
|||||||
if( this == llist->GetCursorLine() && xpos >= breakpos )
|
if( this == llist->GetCursorLine() && xpos >= breakpos )
|
||||||
{
|
{
|
||||||
for(wxLOiterator j = m_ObjectList.begin();
|
for(wxLOiterator j = m_ObjectList.begin();
|
||||||
j != NULLIT && j != i; j++)
|
j != nulled && j != i; j++)
|
||||||
objectCursorPos += (**j).GetLength();
|
objectCursorPos += (**j).GetLength();
|
||||||
}
|
}
|
||||||
// now we know where to break it:
|
// now we know where to break it:
|
||||||
@@ -1449,7 +1450,7 @@ wxLayoutLine::Wrap(CoordType wrapmargin, wxLayoutList *llist)
|
|||||||
wxASSERT(m_Next);
|
wxASSERT(m_Next);
|
||||||
// We need to move this and all following objects to the next
|
// We need to move this and all following objects to the next
|
||||||
// line. Starting from the end of line, to keep the order right.
|
// line. Starting from the end of line, to keep the order right.
|
||||||
if(copyObject != NULLIT)
|
if(copyObject != nulled)
|
||||||
{
|
{
|
||||||
wxLOiterator j;
|
wxLOiterator j;
|
||||||
for(j = m_ObjectList.tail(); j != copyObject; j--)
|
for(j = m_ObjectList.tail(); j != copyObject; j--)
|
||||||
@@ -1558,7 +1559,8 @@ wxLayoutLine::GetWrapPosition(CoordType column)
|
|||||||
{
|
{
|
||||||
CoordType offset;
|
CoordType offset;
|
||||||
wxLOiterator i = FindObject(column, &offset);
|
wxLOiterator i = FindObject(column, &offset);
|
||||||
if(i == NULLIT) return -1; // cannot wrap
|
wxLayoutObjectList::iterator nulled(NULL);
|
||||||
|
if(i == nulled) return -1; // cannot wrap
|
||||||
|
|
||||||
// go backwards through the list and look for space in text objects
|
// go backwards through the list and look for space in text objects
|
||||||
do
|
do
|
||||||
@@ -1582,20 +1584,20 @@ wxLayoutLine::GetWrapPosition(CoordType column)
|
|||||||
column -= (**i).GetLength();
|
column -= (**i).GetLength();
|
||||||
i--;
|
i--;
|
||||||
}
|
}
|
||||||
if( i != NULLIT)
|
if( i != nulled)
|
||||||
offset = (**i).GetLength();
|
offset = (**i).GetLength();
|
||||||
}while(i != NULLIT);
|
}while(i != nulled);
|
||||||
/* If we reached the begin of the list and have more than one
|
/* If we reached the begin of the list and have more than one
|
||||||
object, that one is longer than the margin, so break behind
|
object, that one is longer than the margin, so break behind
|
||||||
it. */
|
it. */
|
||||||
CoordType pos = 0;
|
CoordType pos = 0;
|
||||||
i = m_ObjectList.begin();
|
i = m_ObjectList.begin();
|
||||||
while(i != NULLIT && (**i).GetType() != WXLO_TYPE_TEXT)
|
while(i != nulled && (**i).GetType() != WXLO_TYPE_TEXT)
|
||||||
{
|
{
|
||||||
pos += (**i).GetLength();
|
pos += (**i).GetLength();
|
||||||
i++;
|
i++;
|
||||||
}
|
}
|
||||||
if(i == NULLIT) return -1; //why should this happen?
|
if(i == nulled) return -1; //why should this happen?
|
||||||
|
|
||||||
// now we are behind the one long text object and need to find the
|
// now we are behind the one long text object and need to find the
|
||||||
// first space in it
|
// first space in it
|
||||||
@@ -1613,6 +1615,7 @@ wxLayoutLine::GetWrapPosition(CoordType column)
|
|||||||
void
|
void
|
||||||
wxLayoutLine::Debug() const
|
wxLayoutLine::Debug() const
|
||||||
{
|
{
|
||||||
|
wxLayoutObjectList::iterator nulled(NULL);
|
||||||
wxPoint pos = GetPosition();
|
wxPoint pos = GetPosition();
|
||||||
WXLO_DEBUG((wxT("Line %ld, Pos (%ld,%ld), Height %ld, BL %ld, Font: %d"),
|
WXLO_DEBUG((wxT("Line %ld, Pos (%ld,%ld), Height %ld, BL %ld, Font: %d"),
|
||||||
(long int) GetLineNumber(),
|
(long int) GetLineNumber(),
|
||||||
@@ -1620,7 +1623,7 @@ wxLayoutLine::Debug() const
|
|||||||
(long int) GetHeight(),
|
(long int) GetHeight(),
|
||||||
(long int) m_BaseLine,
|
(long int) m_BaseLine,
|
||||||
(int) m_StyleInfo.family));
|
(int) m_StyleInfo.family));
|
||||||
if(m_ObjectList.begin() != NULLIT)
|
if(m_ObjectList.begin() != nulled)
|
||||||
{
|
{
|
||||||
WXLO_DEBUG(((**m_ObjectList.begin()).DebugDump().c_str()));
|
WXLO_DEBUG(((**m_ObjectList.begin()).DebugDump().c_str()));
|
||||||
}
|
}
|
||||||
@@ -1633,6 +1636,7 @@ wxLayoutLine::Copy(wxLayoutList *llist,
|
|||||||
CoordType from,
|
CoordType from,
|
||||||
CoordType to)
|
CoordType to)
|
||||||
{
|
{
|
||||||
|
wxLayoutObjectList::iterator nulled(NULL);
|
||||||
CoordType firstOffset, lastOffset;
|
CoordType firstOffset, lastOffset;
|
||||||
|
|
||||||
if(to == -1) to = GetLength();
|
if(to == -1) to = GetLength();
|
||||||
@@ -1642,7 +1646,7 @@ wxLayoutLine::Copy(wxLayoutList *llist,
|
|||||||
wxLOiterator last = FindObject(to, &lastOffset);
|
wxLOiterator last = FindObject(to, &lastOffset);
|
||||||
|
|
||||||
// Common special case: only one object
|
// Common special case: only one object
|
||||||
if( first != NULLIT && last != NULLIT && *first == *last )
|
if( first != nulled && last != nulled && *first == *last )
|
||||||
{
|
{
|
||||||
if( (**first).GetType() == WXLO_TYPE_TEXT )
|
if( (**first).GetType() == WXLO_TYPE_TEXT )
|
||||||
{
|
{
|
||||||
@@ -2003,6 +2007,7 @@ wxLayoutList::MoveCursorHorizontally(int n)
|
|||||||
bool
|
bool
|
||||||
wxLayoutList::MoveCursorWord(int n, bool untilNext)
|
wxLayoutList::MoveCursorWord(int n, bool untilNext)
|
||||||
{
|
{
|
||||||
|
wxLayoutObjectList::iterator nulled(NULL);
|
||||||
wxCHECK_MSG( m_CursorLine, false, wxT("no current line") );
|
wxCHECK_MSG( m_CursorLine, false, wxT("no current line") );
|
||||||
wxCHECK_MSG( n == -1 || n == +1, false, wxT("not implemented yet") );
|
wxCHECK_MSG( n == -1 || n == +1, false, wxT("not implemented yet") );
|
||||||
|
|
||||||
@@ -2013,7 +2018,7 @@ wxLayoutList::MoveCursorWord(int n, bool untilNext)
|
|||||||
n != 0;
|
n != 0;
|
||||||
n > 0 ? i++ : i-- )
|
n > 0 ? i++ : i-- )
|
||||||
{
|
{
|
||||||
if ( i == NULLIT )
|
if ( i == nulled )
|
||||||
{
|
{
|
||||||
if ( n > 0 )
|
if ( n > 0 )
|
||||||
{
|
{
|
||||||
@@ -2032,7 +2037,7 @@ wxLayoutList::MoveCursorWord(int n, bool untilNext)
|
|||||||
i = lineCur->GetLastObject();
|
i = lineCur->GetLastObject();
|
||||||
}
|
}
|
||||||
|
|
||||||
if ( i == NULLIT )
|
if ( i == nulled )
|
||||||
{
|
{
|
||||||
// moved to the end/beginning of text
|
// moved to the end/beginning of text
|
||||||
return false;
|
return false;
|
||||||
@@ -2209,6 +2214,7 @@ wxLayoutList::Insert(wxLayoutObject *obj)
|
|||||||
bool
|
bool
|
||||||
wxLayoutList::Insert(wxLayoutList *llist)
|
wxLayoutList::Insert(wxLayoutList *llist)
|
||||||
{
|
{
|
||||||
|
wxLayoutObjectList::iterator nulled(NULL);
|
||||||
wxASSERT(llist);
|
wxASSERT(llist);
|
||||||
bool rc = true;
|
bool rc = true;
|
||||||
|
|
||||||
@@ -2218,7 +2224,7 @@ wxLayoutList::Insert(wxLayoutList *llist)
|
|||||||
)
|
)
|
||||||
{
|
{
|
||||||
for(wxLOiterator i = line->GetFirstObject();
|
for(wxLOiterator i = line->GetFirstObject();
|
||||||
i != NULLIT;
|
i != nulled;
|
||||||
i++)
|
i++)
|
||||||
rc |= Insert(*i);
|
rc |= Insert(*i);
|
||||||
LineBreak();
|
LineBreak();
|
||||||
@@ -2596,6 +2602,7 @@ wxLayoutObject *
|
|||||||
wxLayoutList::FindObjectScreen(wxDC &dc, wxPoint const pos,
|
wxLayoutList::FindObjectScreen(wxDC &dc, wxPoint const pos,
|
||||||
wxPoint *cursorPos, bool *found)
|
wxPoint *cursorPos, bool *found)
|
||||||
{
|
{
|
||||||
|
wxLayoutObjectList::iterator nulled(NULL);
|
||||||
// First, find the right line:
|
// First, find the right line:
|
||||||
wxLayoutLine
|
wxLayoutLine
|
||||||
*line = m_FirstLine,
|
*line = m_FirstLine,
|
||||||
@@ -2646,7 +2653,7 @@ wxLayoutList::FindObjectScreen(wxDC &dc, wxPoint const pos,
|
|||||||
if ( found )
|
if ( found )
|
||||||
*found = didFind && foundinline;
|
*found = didFind && foundinline;
|
||||||
|
|
||||||
return (i == NULLIT) ? NULL : *i;
|
return (i == nulled) ? NULL : *i;
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -3208,10 +3215,6 @@ wxLayoutPrintout::wxLayoutPrintout(wxLayoutList *llist,
|
|||||||
// layout is called in ScaleDC() when we have a DC
|
// layout is called in ScaleDC() when we have a DC
|
||||||
}
|
}
|
||||||
|
|
||||||
wxLayoutPrintout::~wxLayoutPrintout()
|
|
||||||
{
|
|
||||||
}
|
|
||||||
|
|
||||||
float
|
float
|
||||||
wxLayoutPrintout::ScaleDC(wxDC *dc)
|
wxLayoutPrintout::ScaleDC(wxDC *dc)
|
||||||
{
|
{
|
||||||
|
@@ -260,9 +260,6 @@ protected:
|
|||||||
/// Define a list type of wxLayoutObject pointers.
|
/// Define a list type of wxLayoutObject pointers.
|
||||||
KBLIST_DEFINE(wxLayoutObjectList, wxLayoutObject);
|
KBLIST_DEFINE(wxLayoutObjectList, wxLayoutObject);
|
||||||
|
|
||||||
/// An illegal iterator to save typing.
|
|
||||||
#define NULLIT (wxLayoutObjectList::iterator(NULL))
|
|
||||||
|
|
||||||
/// The iterator type.
|
/// The iterator type.
|
||||||
typedef wxLayoutObjectList::iterator wxLOiterator;
|
typedef wxLayoutObjectList::iterator wxLOiterator;
|
||||||
|
|
||||||
@@ -595,7 +592,7 @@ public:
|
|||||||
@param xpos the column number
|
@param xpos the column number
|
||||||
@param offset where to store the difference between xpos and
|
@param offset where to store the difference between xpos and
|
||||||
the object's head
|
the object's head
|
||||||
@return iterator to the object or NULLIT
|
@return iterator to the object or iterator to NULL
|
||||||
*/
|
*/
|
||||||
wxLayoutObjectList::iterator FindObject(CoordType xpos, CoordType
|
wxLayoutObjectList::iterator FindObject(CoordType xpos, CoordType
|
||||||
*offset) const ;
|
*offset) const ;
|
||||||
@@ -607,7 +604,7 @@ public:
|
|||||||
@param xpos the screen x coordinate
|
@param xpos the screen x coordinate
|
||||||
@param offset where to store the difference between xpos and
|
@param offset where to store the difference between xpos and
|
||||||
the object's head
|
the object's head
|
||||||
@return iterator to the object or NULLIT
|
@return iterator to the object or iterator to NULL
|
||||||
*/
|
*/
|
||||||
wxLayoutObjectList::iterator FindObjectScreen(wxDC &dc,
|
wxLayoutObjectList::iterator FindObjectScreen(wxDC &dc,
|
||||||
wxLayoutList *llist,
|
wxLayoutList *llist,
|
||||||
@@ -771,7 +768,7 @@ public:
|
|||||||
|
|
||||||
private:
|
private:
|
||||||
/// Destructor is private. Use DeleteLine() to remove it.
|
/// Destructor is private. Use DeleteLine() to remove it.
|
||||||
~wxLayoutLine();
|
~wxLayoutLine(){};
|
||||||
|
|
||||||
/**@name Functions to let the lines synchronise with each other. */
|
/**@name Functions to let the lines synchronise with each other. */
|
||||||
//@{
|
//@{
|
||||||
@@ -1412,7 +1409,7 @@ public:
|
|||||||
_T("wxLayout Printout"));
|
_T("wxLayout Printout"));
|
||||||
|
|
||||||
/// Destructor.
|
/// Destructor.
|
||||||
~wxLayoutPrintout();
|
~wxLayoutPrintout(){};
|
||||||
|
|
||||||
/** Function which prints the n-th page.
|
/** Function which prints the n-th page.
|
||||||
@param page the page number to print
|
@param page the page number to print
|
||||||
|
@@ -180,10 +180,11 @@ wxLayoutExportStatus::wxLayoutExportStatus(wxLayoutList *list)
|
|||||||
wxLayoutExportObject *wxLayoutExport(wxLayoutExportStatus *status,
|
wxLayoutExportObject *wxLayoutExport(wxLayoutExportStatus *status,
|
||||||
int mode, int flags)
|
int mode, int flags)
|
||||||
{
|
{
|
||||||
|
wxLayoutObjectList::iterator nulled(NULL);
|
||||||
wxASSERT(status);
|
wxASSERT(status);
|
||||||
wxLayoutExportObject * exp;
|
wxLayoutExportObject * exp;
|
||||||
|
|
||||||
if(status->m_iterator == NULLIT) // end of line
|
if(status->m_iterator == nulled) // end of line
|
||||||
{
|
{
|
||||||
if(!status->m_line || status->m_line->GetNextLine() == NULL)
|
if(!status->m_line || status->m_line->GetNextLine() == NULL)
|
||||||
// reached end of list
|
// reached end of list
|
||||||
@@ -191,7 +192,7 @@ wxLayoutExportObject *wxLayoutExport(wxLayoutExportStatus *status,
|
|||||||
}
|
}
|
||||||
exp = new wxLayoutExportObject();
|
exp = new wxLayoutExportObject();
|
||||||
wxLayoutObjectType type;
|
wxLayoutObjectType type;
|
||||||
if(status->m_iterator != NULLIT)
|
if(status->m_iterator != nulled)
|
||||||
{
|
{
|
||||||
type = (** status->m_iterator).GetType();
|
type = (** status->m_iterator).GetType();
|
||||||
if( mode == WXLO_EXPORT_AS_OBJECTS || ! WXLO_IS_TEXT(type)) // simple case
|
if( mode == WXLO_EXPORT_AS_OBJECTS || ! WXLO_IS_TEXT(type)) // simple case
|
||||||
@@ -203,7 +204,7 @@ wxLayoutExportObject *wxLayoutExport(wxLayoutExportStatus *status,
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{ // iterator == NULLIT
|
{ // iterator == nulled
|
||||||
if(mode == WXLO_EXPORT_AS_OBJECTS)
|
if(mode == WXLO_EXPORT_AS_OBJECTS)
|
||||||
{
|
{
|
||||||
exp->type = WXLO_EXPORT_EMPTYLINE;
|
exp->type = WXLO_EXPORT_EMPTYLINE;
|
||||||
@@ -222,7 +223,7 @@ wxLayoutExportObject *wxLayoutExport(wxLayoutExportStatus *status,
|
|||||||
// text must be concatenated
|
// text must be concatenated
|
||||||
for(;;)
|
for(;;)
|
||||||
{
|
{
|
||||||
while(status->m_iterator == NULLIT)
|
while(status->m_iterator == nulled)
|
||||||
{
|
{
|
||||||
if(mode & WXLO_EXPORT_AS_HTML)
|
if(mode & WXLO_EXPORT_AS_HTML)
|
||||||
*str += _T("<br>");
|
*str += _T("<br>");
|
||||||
|
@@ -37,7 +37,7 @@ class MyCanvas: public wxScrolledWindow
|
|||||||
public:
|
public:
|
||||||
MyCanvas() {}
|
MyCanvas() {}
|
||||||
MyCanvas( wxWindow *parent, wxWindowID, const wxPoint &pos, const wxSize &size );
|
MyCanvas( wxWindow *parent, wxWindowID, const wxPoint &pos, const wxSize &size );
|
||||||
~MyCanvas();
|
~MyCanvas(){};
|
||||||
void OnPaint( wxPaintEvent &event );
|
void OnPaint( wxPaintEvent &event );
|
||||||
void OnQueryPosition( wxCommandEvent &event );
|
void OnQueryPosition( wxCommandEvent &event );
|
||||||
void OnAddButton( wxCommandEvent &event );
|
void OnAddButton( wxCommandEvent &event );
|
||||||
@@ -272,10 +272,6 @@ MyCanvas::MyCanvas( wxWindow *parent, wxWindowID id,
|
|||||||
SetCursor( wxCursor( wxCURSOR_IBEAM ) );
|
SetCursor( wxCursor( wxCURSOR_IBEAM ) );
|
||||||
}
|
}
|
||||||
|
|
||||||
MyCanvas::~MyCanvas()
|
|
||||||
{
|
|
||||||
}
|
|
||||||
|
|
||||||
void MyCanvas::OnMouseDown( wxMouseEvent &event )
|
void MyCanvas::OnMouseDown( wxMouseEvent &event )
|
||||||
{
|
{
|
||||||
if (event.LeftDown())
|
if (event.LeftDown())
|
||||||
|
@@ -36,9 +36,9 @@ class MyApp;
|
|||||||
class MyScrolledWindow: public wxScrolledWindow
|
class MyScrolledWindow: public wxScrolledWindow
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
MyScrolledWindow() {}
|
MyScrolledWindow(){};
|
||||||
MyScrolledWindow( wxWindow *parent, wxWindowID id, const wxPoint &pos, const wxSize &size );
|
MyScrolledWindow( wxWindow *parent, wxWindowID id, const wxPoint &pos, const wxSize &size );
|
||||||
~MyScrolledWindow();
|
~MyScrolledWindow(){};
|
||||||
void OnPaint( wxPaintEvent &event );
|
void OnPaint( wxPaintEvent &event );
|
||||||
|
|
||||||
private:
|
private:
|
||||||
@@ -87,10 +87,10 @@ private:
|
|||||||
class MyCanvas: public wxPanel
|
class MyCanvas: public wxPanel
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
MyCanvas() {}
|
MyCanvas(){};
|
||||||
MyCanvas( wxScrolledWindow *parent, MyTopLabels *top, MyRightLabels *right,
|
MyCanvas( wxScrolledWindow *parent, MyTopLabels *top, MyRightLabels *right,
|
||||||
wxWindowID id, const wxPoint &pos, const wxSize &size );
|
wxWindowID id, const wxPoint &pos, const wxSize &size );
|
||||||
~MyCanvas();
|
~MyCanvas(){};
|
||||||
void OnPaint( wxPaintEvent &event );
|
void OnPaint( wxPaintEvent &event );
|
||||||
void ScrollWindow( int dx, int dy, const wxRect *rect );
|
void ScrollWindow( int dx, int dy, const wxRect *rect );
|
||||||
|
|
||||||
@@ -177,10 +177,6 @@ MyScrolledWindow::MyScrolledWindow( wxWindow *parent, wxWindowID id,
|
|||||||
SetSizer( mainsizer );
|
SetSizer( mainsizer );
|
||||||
}
|
}
|
||||||
|
|
||||||
MyScrolledWindow::~MyScrolledWindow()
|
|
||||||
{
|
|
||||||
}
|
|
||||||
|
|
||||||
void MyScrolledWindow::OnPaint( wxPaintEvent &WXUNUSED(event) )
|
void MyScrolledWindow::OnPaint( wxPaintEvent &WXUNUSED(event) )
|
||||||
{
|
{
|
||||||
wxPaintDC dc( this );
|
wxPaintDC dc( this );
|
||||||
@@ -296,10 +292,6 @@ MyCanvas::MyCanvas( wxScrolledWindow *parent, MyTopLabels *top, MyRightLabels *r
|
|||||||
SetCursor( wxCursor( wxCURSOR_IBEAM ) );
|
SetCursor( wxCursor( wxCURSOR_IBEAM ) );
|
||||||
}
|
}
|
||||||
|
|
||||||
MyCanvas::~MyCanvas()
|
|
||||||
{
|
|
||||||
}
|
|
||||||
|
|
||||||
void MyCanvas::OnPaint( wxPaintEvent &WXUNUSED(event) )
|
void MyCanvas::OnPaint( wxPaintEvent &WXUNUSED(event) )
|
||||||
{
|
{
|
||||||
wxPaintDC dc( this );
|
wxPaintDC dc( this );
|
||||||
|
@@ -29,7 +29,7 @@
|
|||||||
# pragma hdrstop
|
# pragma hdrstop
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
// for all others, include the necessary headers
|
// for all others, include the necessary headers
|
||||||
#ifndef WX_PRECOMP
|
#ifndef WX_PRECOMP
|
||||||
# include "wx/wx.h"
|
# include "wx/wx.h"
|
||||||
#endif
|
#endif
|
||||||
@@ -313,7 +313,7 @@ void MyFrame::OnOpenConnection(wxCommandEvent& WXUNUSED(event))
|
|||||||
// // update waitmore if needed.
|
// // update waitmore if needed.
|
||||||
// }
|
// }
|
||||||
// bool success = client->IsConnected();
|
// bool success = client->IsConnected();
|
||||||
//
|
//
|
||||||
// And that's all :-)
|
// And that's all :-)
|
||||||
|
|
||||||
m_text->AppendText(_("\nTrying to connect (timeout = 10 sec) ...\n"));
|
m_text->AppendText(_("\nTrying to connect (timeout = 10 sec) ...\n"));
|
||||||
@@ -328,7 +328,7 @@ void MyFrame::OnOpenConnection(wxCommandEvent& WXUNUSED(event))
|
|||||||
m_text->AppendText(_("Failed ! Unable to connect\n"));
|
m_text->AppendText(_("Failed ! Unable to connect\n"));
|
||||||
wxMessageBox(_("Can't connect to the specified host"), _("Alert !"));
|
wxMessageBox(_("Can't connect to the specified host"), _("Alert !"));
|
||||||
}
|
}
|
||||||
|
|
||||||
UpdateStatusBar();
|
UpdateStatusBar();
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -363,7 +363,7 @@ void MyFrame::OnTest1(wxCommandEvent& WXUNUSED(event))
|
|||||||
m_sock->SetFlags(wxSOCKET_WAITALL);
|
m_sock->SetFlags(wxSOCKET_WAITALL);
|
||||||
|
|
||||||
buf1 = _("Test string (less than 256 chars!)");
|
buf1 = _("Test string (less than 256 chars!)");
|
||||||
len = (wxStrlen(buf1) + 1) * sizeof(wxChar);
|
len = (unsigned char)((wxStrlen(buf1) + 1) * sizeof(wxChar));
|
||||||
buf2 = new wxChar[wxStrlen(buf1) + 1];
|
buf2 = new wxChar[wxStrlen(buf1) + 1];
|
||||||
|
|
||||||
m_text->AppendText(_("Sending a test buffer to the server ..."));
|
m_text->AppendText(_("Sending a test buffer to the server ..."));
|
||||||
@@ -443,7 +443,7 @@ void MyFrame::OnTest2(wxCommandEvent& WXUNUSED(event))
|
|||||||
m_text->AppendText(_("Comparing the two buffers ..."));
|
m_text->AppendText(_("Comparing the two buffers ..."));
|
||||||
if (memcmp(msg1, msg2, len) != 0)
|
if (memcmp(msg1, msg2, len) != 0)
|
||||||
{
|
{
|
||||||
m_text->AppendText(_("failed!\n"));
|
m_text->AppendText(_("failed!\n"));
|
||||||
m_text->AppendText(_("Test 2 failed !\n"));
|
m_text->AppendText(_("Test 2 failed !\n"));
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
|
@@ -73,7 +73,7 @@ class MyFrame: public wxFrame
|
|||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
MyFrame();
|
MyFrame();
|
||||||
virtual ~MyFrame();
|
virtual ~MyFrame(){};
|
||||||
|
|
||||||
// Menu commands
|
// Menu commands
|
||||||
void SplitHorizontal(wxCommandEvent& event);
|
void SplitHorizontal(wxCommandEvent& event);
|
||||||
@@ -121,7 +121,7 @@ class MyCanvas: public wxScrolledWindow
|
|||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
MyCanvas(wxWindow* parent, bool mirror);
|
MyCanvas(wxWindow* parent, bool mirror);
|
||||||
virtual ~MyCanvas();
|
virtual ~MyCanvas(){};
|
||||||
|
|
||||||
virtual void OnDraw(wxDC& dc);
|
virtual void OnDraw(wxDC& dc);
|
||||||
|
|
||||||
@@ -242,10 +242,6 @@ MyFrame::MyFrame()
|
|||||||
#endif // wxUSE_STATUSBAR
|
#endif // wxUSE_STATUSBAR
|
||||||
}
|
}
|
||||||
|
|
||||||
MyFrame::~MyFrame()
|
|
||||||
{
|
|
||||||
}
|
|
||||||
|
|
||||||
// menu command handlers
|
// menu command handlers
|
||||||
|
|
||||||
void MyFrame::Quit(wxCommandEvent& WXUNUSED(event) )
|
void MyFrame::Quit(wxCommandEvent& WXUNUSED(event) )
|
||||||
@@ -419,10 +415,6 @@ MyCanvas::MyCanvas(wxWindow* parent, bool mirror)
|
|||||||
m_mirror = mirror;
|
m_mirror = mirror;
|
||||||
}
|
}
|
||||||
|
|
||||||
MyCanvas::~MyCanvas()
|
|
||||||
{
|
|
||||||
}
|
|
||||||
|
|
||||||
void MyCanvas::OnDraw(wxDC& dcOrig)
|
void MyCanvas::OnDraw(wxDC& dcOrig)
|
||||||
{
|
{
|
||||||
wxMirrorDC dc(dcOrig, m_mirror);
|
wxMirrorDC dc(dcOrig, m_mirror);
|
||||||
|
@@ -97,10 +97,10 @@ class MyPanel: public wxPanel
|
|||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
MyPanel(wxFrame *frame, int x, int y, int w, int h);
|
MyPanel(wxFrame *frame, int x, int y, int w, int h);
|
||||||
virtual ~MyPanel()
|
virtual ~MyPanel()
|
||||||
{
|
{
|
||||||
#if wxUSE_LOG
|
#if wxUSE_LOG
|
||||||
delete wxLog::SetActiveTarget(m_logOld);
|
delete wxLog::SetActiveTarget(m_logOld);
|
||||||
#endif // wxUSE_LOG
|
#endif // wxUSE_LOG
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -200,13 +200,13 @@ public:
|
|||||||
if ( !m_panel->m_textrich->PageUp() )
|
if ( !m_panel->m_textrich->PageUp() )
|
||||||
wxLogMessage(_T("Already at the top"));
|
wxLogMessage(_T("Already at the top"));
|
||||||
}
|
}
|
||||||
|
|
||||||
void OnGetLine(wxCommandEvent& WXUNUSED(event))
|
void OnGetLine(wxCommandEvent& WXUNUSED(event))
|
||||||
{
|
{
|
||||||
long nLine = wxGetNumberFromUser(wxT("Which line would you like to get?"),
|
long nLine = wxGetNumberFromUser(wxT("Which line would you like to get?"),
|
||||||
wxT("Enter which line you would like to get"),
|
wxT("Enter which line you would like to get"),
|
||||||
wxT("Get a line from the tabbed multiline text control") );
|
wxT("Get a line from the tabbed multiline text control") );
|
||||||
|
|
||||||
wxMessageBox(m_panel->m_tab->GetLineText(nLine));
|
wxMessageBox(m_panel->m_tab->GetLineText(nLine));
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -215,8 +215,8 @@ public:
|
|||||||
long nLine = wxGetNumberFromUser(wxT("Which line would you like to get?"),
|
long nLine = wxGetNumberFromUser(wxT("Which line would you like to get?"),
|
||||||
wxT("Enter which line you would like to get"),
|
wxT("Enter which line you would like to get"),
|
||||||
wxT("Get length of a line from the tabbed multiline text control") );
|
wxT("Get length of a line from the tabbed multiline text control") );
|
||||||
|
|
||||||
wxMessageBox(wxString::Format(wxT("Length of line %i is:%i"),
|
wxMessageBox(wxString::Format(wxT("Length of line %i is:%i"),
|
||||||
(int) nLine,
|
(int) nLine,
|
||||||
m_panel->m_tab->GetLineLength(nLine))
|
m_panel->m_tab->GetLineLength(nLine))
|
||||||
);
|
);
|
||||||
@@ -357,10 +357,10 @@ enum
|
|||||||
TEXT_LINE_UP,
|
TEXT_LINE_UP,
|
||||||
TEXT_PAGE_DOWN,
|
TEXT_PAGE_DOWN,
|
||||||
TEXT_PAGE_UP,
|
TEXT_PAGE_UP,
|
||||||
|
|
||||||
TEXT_GET_LINE,
|
TEXT_GET_LINE,
|
||||||
TEXT_GET_LINELENGTH,
|
TEXT_GET_LINELENGTH,
|
||||||
|
|
||||||
TEXT_REMOVE,
|
TEXT_REMOVE,
|
||||||
TEXT_REPLACE,
|
TEXT_REPLACE,
|
||||||
TEXT_SELECT,
|
TEXT_SELECT,
|
||||||
@@ -1552,7 +1552,7 @@ void RichTextFrame::OnChangeFont(wxCommandEvent& WXUNUSED(event))
|
|||||||
|
|
||||||
wxTextAttr attr;
|
wxTextAttr attr;
|
||||||
attr.SetFont(font);
|
attr.SetFont(font);
|
||||||
|
|
||||||
long start, end;
|
long start, end;
|
||||||
m_textCtrl->GetSelection(& start, & end);
|
m_textCtrl->GetSelection(& start, & end);
|
||||||
m_textCtrl->SetStyle(start, end, attr);
|
m_textCtrl->SetStyle(start, end, attr);
|
||||||
@@ -1568,7 +1568,7 @@ void RichTextFrame::OnChangeTextColour(wxCommandEvent& WXUNUSED(event))
|
|||||||
data.SetChooseFull(true);
|
data.SetChooseFull(true);
|
||||||
for (int i = 0; i < 16; i++)
|
for (int i = 0; i < 16; i++)
|
||||||
{
|
{
|
||||||
wxColour colour(i*16, i*16, i*16);
|
wxColour colour((unsigned char)(i*16), (unsigned char)(i*16), (unsigned char)(i*16));
|
||||||
data.SetCustomColour(i, colour);
|
data.SetCustomColour(i, colour);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -1581,7 +1581,7 @@ void RichTextFrame::OnChangeTextColour(wxCommandEvent& WXUNUSED(event))
|
|||||||
|
|
||||||
wxTextAttr attr;
|
wxTextAttr attr;
|
||||||
attr.SetTextColour(col);
|
attr.SetTextColour(col);
|
||||||
|
|
||||||
long start, end;
|
long start, end;
|
||||||
m_textCtrl->GetSelection(& start, & end);
|
m_textCtrl->GetSelection(& start, & end);
|
||||||
m_textCtrl->SetStyle(start, end, attr);
|
m_textCtrl->SetStyle(start, end, attr);
|
||||||
@@ -1597,7 +1597,7 @@ void RichTextFrame::OnChangeBackgroundColour(wxCommandEvent& WXUNUSED(event))
|
|||||||
data.SetChooseFull(true);
|
data.SetChooseFull(true);
|
||||||
for (int i = 0; i < 16; i++)
|
for (int i = 0; i < 16; i++)
|
||||||
{
|
{
|
||||||
wxColour colour(i*16, i*16, i*16);
|
wxColour colour((unsigned char)(i*16), (unsigned char)(i*16), (unsigned char)(i*16));
|
||||||
data.SetCustomColour(i, colour);
|
data.SetCustomColour(i, colour);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -1610,7 +1610,7 @@ void RichTextFrame::OnChangeBackgroundColour(wxCommandEvent& WXUNUSED(event))
|
|||||||
|
|
||||||
wxTextAttr attr;
|
wxTextAttr attr;
|
||||||
attr.SetBackgroundColour(col);
|
attr.SetBackgroundColour(col);
|
||||||
|
|
||||||
long start, end;
|
long start, end;
|
||||||
m_textCtrl->GetSelection(& start, & end);
|
m_textCtrl->GetSelection(& start, & end);
|
||||||
m_textCtrl->SetStyle(start, end, attr);
|
m_textCtrl->SetStyle(start, end, attr);
|
||||||
@@ -1634,7 +1634,7 @@ void RichTextFrame::OnLeftIndent(wxCommandEvent& WXUNUSED(event))
|
|||||||
|
|
||||||
wxTextAttr attr;
|
wxTextAttr attr;
|
||||||
attr.SetLeftIndent(indent);
|
attr.SetLeftIndent(indent);
|
||||||
|
|
||||||
long start, end;
|
long start, end;
|
||||||
m_textCtrl->GetSelection(& start, & end);
|
m_textCtrl->GetSelection(& start, & end);
|
||||||
m_textCtrl->SetStyle(start, end, attr);
|
m_textCtrl->SetStyle(start, end, attr);
|
||||||
@@ -1658,7 +1658,7 @@ void RichTextFrame::OnRightIndent(wxCommandEvent& WXUNUSED(event))
|
|||||||
|
|
||||||
wxTextAttr attr;
|
wxTextAttr attr;
|
||||||
attr.SetRightIndent(indent);
|
attr.SetRightIndent(indent);
|
||||||
|
|
||||||
long start, end;
|
long start, end;
|
||||||
m_textCtrl->GetSelection(& start, & end);
|
m_textCtrl->GetSelection(& start, & end);
|
||||||
m_textCtrl->SetStyle(start, end, attr);
|
m_textCtrl->SetStyle(start, end, attr);
|
||||||
|
@@ -47,7 +47,7 @@ class MyApp : public wxApp
|
|||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
MyApp();
|
MyApp();
|
||||||
virtual ~MyApp();
|
virtual ~MyApp(){};
|
||||||
|
|
||||||
virtual bool OnInit();
|
virtual bool OnInit();
|
||||||
|
|
||||||
@@ -358,10 +358,6 @@ MyApp::MyApp()
|
|||||||
m_waitingUntilAllDone = false;
|
m_waitingUntilAllDone = false;
|
||||||
}
|
}
|
||||||
|
|
||||||
MyApp::~MyApp()
|
|
||||||
{
|
|
||||||
}
|
|
||||||
|
|
||||||
// `Main program' equivalent, creating windows and returning main app frame
|
// `Main program' equivalent, creating windows and returning main app frame
|
||||||
bool MyApp::OnInit()
|
bool MyApp::OnInit()
|
||||||
{
|
{
|
||||||
|
@@ -363,9 +363,9 @@ void MyFrame::OnIdle(wxIdleEvent& event)
|
|||||||
|
|
||||||
void MyFrame::OnSize(wxSizeEvent& event)
|
void MyFrame::OnSize(wxSizeEvent& event)
|
||||||
{
|
{
|
||||||
if ( m_treeCtrl
|
if ( m_treeCtrl
|
||||||
#if wxUSE_LOG
|
#if wxUSE_LOG
|
||||||
&& m_textCtrl
|
&& m_textCtrl
|
||||||
#endif // wxUSE_LOG
|
#endif // wxUSE_LOG
|
||||||
)
|
)
|
||||||
{
|
{
|
||||||
@@ -758,10 +758,6 @@ void MyTreeCtrl::CreateButtonsImageList(int WXUNUSED(size))
|
|||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
MyTreeCtrl::~MyTreeCtrl()
|
|
||||||
{
|
|
||||||
}
|
|
||||||
|
|
||||||
int MyTreeCtrl::OnCompareItems(const wxTreeItemId& item1,
|
int MyTreeCtrl::OnCompareItems(const wxTreeItemId& item1,
|
||||||
const wxTreeItemId& item2)
|
const wxTreeItemId& item2)
|
||||||
{
|
{
|
||||||
@@ -1168,7 +1164,7 @@ void MyTreeCtrl::OnContextMenu(wxContextMenuEvent& event)
|
|||||||
{
|
{
|
||||||
//attempt to guess where to show the menu
|
//attempt to guess where to show the menu
|
||||||
if (item.IsOk())
|
if (item.IsOk())
|
||||||
{
|
{
|
||||||
//if an item was clicked, show menu to the right of it
|
//if an item was clicked, show menu to the right of it
|
||||||
wxRect rect;
|
wxRect rect;
|
||||||
GetBoundingRect(item, rect, true); //true = only the label
|
GetBoundingRect(item, rect, true); //true = only the label
|
||||||
@@ -1184,7 +1180,7 @@ void MyTreeCtrl::OnContextMenu(wxContextMenuEvent& event)
|
|||||||
//event was generated by mouse, use supplied coords
|
//event was generated by mouse, use supplied coords
|
||||||
pt = ScreenToClient(pt);
|
pt = ScreenToClient(pt);
|
||||||
}
|
}
|
||||||
|
|
||||||
ShowMenu(item, pt);
|
ShowMenu(item, pt);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@@ -65,7 +65,7 @@ public:
|
|||||||
MyTreeCtrl(wxWindow *parent, const wxWindowID id,
|
MyTreeCtrl(wxWindow *parent, const wxWindowID id,
|
||||||
const wxPoint& pos, const wxSize& size,
|
const wxPoint& pos, const wxSize& size,
|
||||||
long style);
|
long style);
|
||||||
virtual ~MyTreeCtrl();
|
virtual ~MyTreeCtrl(){};
|
||||||
|
|
||||||
void OnBeginDrag(wxTreeEvent& event);
|
void OnBeginDrag(wxTreeEvent& event);
|
||||||
void OnBeginRDrag(wxTreeEvent& event);
|
void OnBeginRDrag(wxTreeEvent& event);
|
||||||
|
@@ -71,6 +71,9 @@ BEGIN_EVENT_TABLE(MyApp, wxApp)
|
|||||||
EVT_MENU(TYPES_MIME, MyApp::DoMIMEDemo)
|
EVT_MENU(TYPES_MIME, MyApp::DoMIMEDemo)
|
||||||
END_EVENT_TABLE()
|
END_EVENT_TABLE()
|
||||||
|
|
||||||
|
wxString file_name = _T("test_wx.dat");
|
||||||
|
wxString file_name2 = wxString(_T("test_wx2.dat"));
|
||||||
|
|
||||||
bool MyApp::OnInit()
|
bool MyApp::OnInit()
|
||||||
{
|
{
|
||||||
// Create the main frame window
|
// Create the main frame window
|
||||||
@@ -129,7 +132,7 @@ void MyApp::DoStreamDemo(wxCommandEvent& WXUNUSED(event))
|
|||||||
textCtrl.WriteText( _T("Writing to ofstream and wxFileOutputStream:\n") );
|
textCtrl.WriteText( _T("Writing to ofstream and wxFileOutputStream:\n") );
|
||||||
|
|
||||||
wxSTD ofstream std_file_output( "test_std.dat" );
|
wxSTD ofstream std_file_output( "test_std.dat" );
|
||||||
wxFileOutputStream file_output( wxString(_T("test_wx.dat")) );
|
wxFileOutputStream file_output( file_name );
|
||||||
wxBufferedOutputStream buf_output( file_output );
|
wxBufferedOutputStream buf_output( file_output );
|
||||||
wxTextOutputStream text_output( buf_output );
|
wxTextOutputStream text_output( buf_output );
|
||||||
|
|
||||||
@@ -194,7 +197,7 @@ void MyApp::DoStreamDemo(wxCommandEvent& WXUNUSED(event))
|
|||||||
|
|
||||||
buf_output.Sync();
|
buf_output.Sync();
|
||||||
|
|
||||||
wxFileInputStream file_input( wxString(_T("test_wx.dat")) );
|
wxFileInputStream file_input( file_name );
|
||||||
wxBufferedInputStream buf_input( file_input );
|
wxBufferedInputStream buf_input( file_input );
|
||||||
wxTextInputStream text_input( file_input );
|
wxTextInputStream text_input( file_input );
|
||||||
|
|
||||||
@@ -282,13 +285,13 @@ void MyApp::DoStreamDemo2(wxCommandEvent& WXUNUSED(event))
|
|||||||
|
|
||||||
textCtrl.WriteText( _T("Writing number 0 to 9 to buffered wxFileOutputStream:\n\n") );
|
textCtrl.WriteText( _T("Writing number 0 to 9 to buffered wxFileOutputStream:\n\n") );
|
||||||
|
|
||||||
wxFileOutputStream file_output( wxString(_T("test_wx.dat")) );
|
wxFileOutputStream file_output( file_name );
|
||||||
wxBufferedOutputStream buf_output( file_output );
|
wxBufferedOutputStream buf_output( file_output );
|
||||||
for (ch = 0; ch < 10; ch++)
|
for (ch = 0; ch < 10; ch++)
|
||||||
buf_output.Write( &ch, 1 );
|
buf_output.Write( &ch, 1 );
|
||||||
buf_output.Sync();
|
buf_output.Sync();
|
||||||
|
|
||||||
wxFileInputStream file_input( wxString(_T("test_wx.dat")) );
|
wxFileInputStream file_input( file_name );
|
||||||
for (ch2 = 0; ch2 < 10; ch2++)
|
for (ch2 = 0; ch2 < 10; ch2++)
|
||||||
{
|
{
|
||||||
file_input.Read( &ch, 1 );
|
file_input.Read( &ch, 1 );
|
||||||
@@ -299,7 +302,7 @@ void MyApp::DoStreamDemo2(wxCommandEvent& WXUNUSED(event))
|
|||||||
textCtrl.WriteText( _T("Writing number 0 to 9 to buffered wxFileOutputStream, then\n") );
|
textCtrl.WriteText( _T("Writing number 0 to 9 to buffered wxFileOutputStream, then\n") );
|
||||||
textCtrl.WriteText( _T("seeking back to #3 and writing 0:\n\n") );
|
textCtrl.WriteText( _T("seeking back to #3 and writing 0:\n\n") );
|
||||||
|
|
||||||
wxFileOutputStream file_output2( wxString(_T("test_wx2.dat")) );
|
wxFileOutputStream file_output2( file_name2 );
|
||||||
wxBufferedOutputStream buf_output2( file_output2 );
|
wxBufferedOutputStream buf_output2( file_output2 );
|
||||||
for (ch = 0; ch < 10; ch++)
|
for (ch = 0; ch < 10; ch++)
|
||||||
buf_output2.Write( &ch, 1 );
|
buf_output2.Write( &ch, 1 );
|
||||||
@@ -308,7 +311,7 @@ void MyApp::DoStreamDemo2(wxCommandEvent& WXUNUSED(event))
|
|||||||
buf_output2.Write( &ch, 1 );
|
buf_output2.Write( &ch, 1 );
|
||||||
buf_output2.Sync();
|
buf_output2.Sync();
|
||||||
|
|
||||||
wxFileInputStream file_input2( wxString(_T("test_wx2.dat")) );
|
wxFileInputStream file_input2( file_name2 );
|
||||||
for (ch2 = 0; ch2 < 10; ch2++)
|
for (ch2 = 0; ch2 < 10; ch2++)
|
||||||
{
|
{
|
||||||
file_input2.Read( &ch, 1 );
|
file_input2.Read( &ch, 1 );
|
||||||
@@ -326,7 +329,7 @@ void MyApp::DoStreamDemo2(wxCommandEvent& WXUNUSED(event))
|
|||||||
textCtrl.WriteText( _T("Reading number 0 to 9 from buffered wxFileInputStream, then\n") );
|
textCtrl.WriteText( _T("Reading number 0 to 9 from buffered wxFileInputStream, then\n") );
|
||||||
textCtrl.WriteText( _T("seeking back to #3 and reading the 0:\n\n") );
|
textCtrl.WriteText( _T("seeking back to #3 and reading the 0:\n\n") );
|
||||||
|
|
||||||
wxFileInputStream file_input3( wxString(_T("test_wx2.dat")) );
|
wxFileInputStream file_input3( file_name2 );
|
||||||
wxBufferedInputStream buf_input3( file_input3 );
|
wxBufferedInputStream buf_input3( file_input3 );
|
||||||
for (ch2 = 0; ch2 < 10; ch2++)
|
for (ch2 = 0; ch2 < 10; ch2++)
|
||||||
{
|
{
|
||||||
@@ -354,7 +357,7 @@ void MyApp::DoStreamDemo3(wxCommandEvent& WXUNUSED(event))
|
|||||||
|
|
||||||
textCtrl.WriteText( _T("Writing number 0 to 9 to wxFileOutputStream:\n\n") );
|
textCtrl.WriteText( _T("Writing number 0 to 9 to wxFileOutputStream:\n\n") );
|
||||||
|
|
||||||
wxFileOutputStream file_output( wxString(_T("test_wx.dat")) );
|
wxFileOutputStream file_output( file_name );
|
||||||
for (ch = 0; ch < 10; ch++)
|
for (ch = 0; ch < 10; ch++)
|
||||||
file_output.Write( &ch, 1 );
|
file_output.Write( &ch, 1 );
|
||||||
|
|
||||||
@@ -362,7 +365,7 @@ void MyApp::DoStreamDemo3(wxCommandEvent& WXUNUSED(event))
|
|||||||
|
|
||||||
textCtrl.WriteText( _T("Reading 0 to 10 to wxFileInputStream:\n\n") );
|
textCtrl.WriteText( _T("Reading 0 to 10 to wxFileInputStream:\n\n") );
|
||||||
|
|
||||||
wxFileInputStream file_input( wxString(_T("test_wx.dat")) );
|
wxFileInputStream file_input( file_name );
|
||||||
for (ch2 = 0; ch2 < 11; ch2++)
|
for (ch2 = 0; ch2 < 11; ch2++)
|
||||||
{
|
{
|
||||||
file_input.Read( &ch, 1 );
|
file_input.Read( &ch, 1 );
|
||||||
@@ -411,7 +414,7 @@ void MyApp::DoStreamDemo3(wxCommandEvent& WXUNUSED(event))
|
|||||||
|
|
||||||
textCtrl.WriteText( _T("Reading 0 to 10 to wxFFileInputStream:\n\n") );
|
textCtrl.WriteText( _T("Reading 0 to 10 to wxFFileInputStream:\n\n") );
|
||||||
|
|
||||||
wxFFileInputStream ffile_input( wxString(_T("test_wx.dat")) );
|
wxFFileInputStream ffile_input( file_name );
|
||||||
for (ch2 = 0; ch2 < 11; ch2++)
|
for (ch2 = 0; ch2 < 11; ch2++)
|
||||||
{
|
{
|
||||||
ffile_input.Read( &ch, 1 );
|
ffile_input.Read( &ch, 1 );
|
||||||
@@ -459,7 +462,7 @@ void MyApp::DoStreamDemo3(wxCommandEvent& WXUNUSED(event))
|
|||||||
|
|
||||||
textCtrl.WriteText( _T("Reading 0 to 10 to buffered wxFFileInputStream:\n\n") );
|
textCtrl.WriteText( _T("Reading 0 to 10 to buffered wxFFileInputStream:\n\n") );
|
||||||
|
|
||||||
wxFFileInputStream ffile_input2( wxString(_T("test_wx.dat")) );
|
wxFFileInputStream ffile_input2( file_name );
|
||||||
wxBufferedInputStream buf_input( ffile_input2 );
|
wxBufferedInputStream buf_input( ffile_input2 );
|
||||||
for (ch2 = 0; ch2 < 11; ch2++)
|
for (ch2 = 0; ch2 < 11; ch2++)
|
||||||
{
|
{
|
||||||
@@ -516,7 +519,7 @@ void MyApp::DoStreamDemo4(wxCommandEvent& WXUNUSED(event))
|
|||||||
// bigger than buffer
|
// bigger than buffer
|
||||||
textCtrl.WriteText( _T("Writing 2000x 1 to wxFileOutputStream.\n\n") );
|
textCtrl.WriteText( _T("Writing 2000x 1 to wxFileOutputStream.\n\n") );
|
||||||
|
|
||||||
wxFileOutputStream file_output( wxString(_T("test_wx.dat")) );
|
wxFileOutputStream file_output( file_name );
|
||||||
for (int i = 0; i < 2000; i++)
|
for (int i = 0; i < 2000; i++)
|
||||||
{
|
{
|
||||||
char ch = 1;
|
char ch = 1;
|
||||||
@@ -525,7 +528,7 @@ void MyApp::DoStreamDemo4(wxCommandEvent& WXUNUSED(event))
|
|||||||
|
|
||||||
textCtrl.WriteText( _T("Opening with a buffered wxFileInputStream:\n\n") );
|
textCtrl.WriteText( _T("Opening with a buffered wxFileInputStream:\n\n") );
|
||||||
|
|
||||||
wxFileInputStream file_input( wxString(_T("test_wx.dat")) );
|
wxFileInputStream file_input( file_name );
|
||||||
wxBufferedInputStream buf_input( file_input );
|
wxBufferedInputStream buf_input( file_input );
|
||||||
|
|
||||||
textCtrl.WriteText( _T("wxBufferedInputStream.GetLastError() returns: ") );
|
textCtrl.WriteText( _T("wxBufferedInputStream.GetLastError() returns: ") );
|
||||||
@@ -655,13 +658,13 @@ void MyApp::DoStreamDemo5(wxCommandEvent& WXUNUSED(event))
|
|||||||
|
|
||||||
textCtrl.WriteText( _T("Writing number 0 to 9 to wxFileOutputStream:\n\n") );
|
textCtrl.WriteText( _T("Writing number 0 to 9 to wxFileOutputStream:\n\n") );
|
||||||
|
|
||||||
wxFileOutputStream file_output( wxString(_T("test_wx.dat")) );
|
wxFileOutputStream file_output( file_name );
|
||||||
for (ch = 0; ch < 10; ch++)
|
for (ch = 0; ch < 10; ch++)
|
||||||
file_output.Write( &ch, 1 );
|
file_output.Write( &ch, 1 );
|
||||||
|
|
||||||
file_output.Sync();
|
file_output.Sync();
|
||||||
|
|
||||||
wxFileInputStream file_input( wxString(_T("test_wx.dat")) );
|
wxFileInputStream file_input( file_name );
|
||||||
|
|
||||||
ch = file_input.Peek();
|
ch = file_input.Peek();
|
||||||
str.Printf( wxT("First char peeked: %d\n"), (int) ch );
|
str.Printf( wxT("First char peeked: %d\n"), (int) ch );
|
||||||
@@ -730,7 +733,7 @@ void MyApp::DoStreamDemo6(wxCommandEvent& WXUNUSED(event))
|
|||||||
|
|
||||||
textCtrl.WriteText( _T("Writing number 0 to 9 to wxFileOutputStream...\n\n") );
|
textCtrl.WriteText( _T("Writing number 0 to 9 to wxFileOutputStream...\n\n") );
|
||||||
|
|
||||||
wxFileOutputStream file_output( wxString(_T("test_wx.dat")) );
|
wxFileOutputStream file_output( file_name );
|
||||||
for (ch = 0; ch < 10; ch++)
|
for (ch = 0; ch < 10; ch++)
|
||||||
file_output.Write( &ch, 1 );
|
file_output.Write( &ch, 1 );
|
||||||
|
|
||||||
@@ -738,52 +741,52 @@ void MyApp::DoStreamDemo6(wxCommandEvent& WXUNUSED(event))
|
|||||||
|
|
||||||
textCtrl.WriteText( _T("Reading char from wxFileInputStream:\n\n") );
|
textCtrl.WriteText( _T("Reading char from wxFileInputStream:\n\n") );
|
||||||
|
|
||||||
wxFileInputStream file_input( wxString(_T("test_wx.dat")) );
|
wxFileInputStream file_input( file_name );
|
||||||
|
|
||||||
ch = file_input.GetC();
|
ch = file_input.GetC();
|
||||||
size_t pos = file_input.TellI();
|
size_t pos = (size_t)file_input.TellI();
|
||||||
str.Printf( wxT("Read char: %d. Now at position %d\n\n"), (int) ch, (int) pos );
|
str.Printf( wxT("Read char: %d. Now at position %d\n\n"), (int) ch, (int) pos );
|
||||||
textCtrl.WriteText( str );
|
textCtrl.WriteText( str );
|
||||||
|
|
||||||
textCtrl.WriteText( _T("Reading another char from wxFileInputStream:\n\n") );
|
textCtrl.WriteText( _T("Reading another char from wxFileInputStream:\n\n") );
|
||||||
|
|
||||||
ch = file_input.GetC();
|
ch = file_input.GetC();
|
||||||
pos = file_input.TellI();
|
pos = (size_t)file_input.TellI();
|
||||||
str.Printf( wxT("Read char: %d. Now at position %d\n\n"), (int) ch, (int) pos );
|
str.Printf( wxT("Read char: %d. Now at position %d\n\n"), (int) ch, (int) pos );
|
||||||
textCtrl.WriteText( str );
|
textCtrl.WriteText( str );
|
||||||
|
|
||||||
textCtrl.WriteText( _T("Reading yet another char from wxFileInputStream:\n\n") );
|
textCtrl.WriteText( _T("Reading yet another char from wxFileInputStream:\n\n") );
|
||||||
|
|
||||||
ch = file_input.GetC();
|
ch = file_input.GetC();
|
||||||
pos = file_input.TellI();
|
pos = (size_t)file_input.TellI();
|
||||||
str.Printf( wxT("Read char: %d. Now at position %d\n\n"), (int) ch, (int) pos );
|
str.Printf( wxT("Read char: %d. Now at position %d\n\n"), (int) ch, (int) pos );
|
||||||
textCtrl.WriteText( str );
|
textCtrl.WriteText( str );
|
||||||
|
|
||||||
textCtrl.WriteText( _T("Now calling Ungetch( 5 ) from wxFileInputStream...\n\n") );
|
textCtrl.WriteText( _T("Now calling Ungetch( 5 ) from wxFileInputStream...\n\n") );
|
||||||
|
|
||||||
file_input.Ungetch( 5 );
|
file_input.Ungetch( 5 );
|
||||||
pos = file_input.TellI();
|
pos = (size_t)file_input.TellI();
|
||||||
str.Printf( wxT("Now at position %d\n\n"), (int) pos );
|
str.Printf( wxT("Now at position %d\n\n"), (int) pos );
|
||||||
textCtrl.WriteText( str );
|
textCtrl.WriteText( str );
|
||||||
|
|
||||||
textCtrl.WriteText( _T("Reading char from wxFileInputStream:\n\n") );
|
textCtrl.WriteText( _T("Reading char from wxFileInputStream:\n\n") );
|
||||||
|
|
||||||
ch = file_input.GetC();
|
ch = file_input.GetC();
|
||||||
pos = file_input.TellI();
|
pos = (size_t)file_input.TellI();
|
||||||
str.Printf( wxT("Read char: %d. Now at position %d\n\n"), (int) ch, (int) pos );
|
str.Printf( wxT("Read char: %d. Now at position %d\n\n"), (int) ch, (int) pos );
|
||||||
textCtrl.WriteText( str );
|
textCtrl.WriteText( str );
|
||||||
|
|
||||||
textCtrl.WriteText( _T("Reading another char from wxFileInputStream:\n\n") );
|
textCtrl.WriteText( _T("Reading another char from wxFileInputStream:\n\n") );
|
||||||
|
|
||||||
ch = file_input.GetC();
|
ch = file_input.GetC();
|
||||||
pos = file_input.TellI();
|
pos = (size_t)file_input.TellI();
|
||||||
str.Printf( wxT("Read char: %d. Now at position %d\n\n"), (int) ch, (int) pos );
|
str.Printf( wxT("Read char: %d. Now at position %d\n\n"), (int) ch, (int) pos );
|
||||||
textCtrl.WriteText( str );
|
textCtrl.WriteText( str );
|
||||||
|
|
||||||
textCtrl.WriteText( _T("Now calling Ungetch( 5 ) from wxFileInputStream again...\n\n") );
|
textCtrl.WriteText( _T("Now calling Ungetch( 5 ) from wxFileInputStream again...\n\n") );
|
||||||
|
|
||||||
file_input.Ungetch( 5 );
|
file_input.Ungetch( 5 );
|
||||||
pos = file_input.TellI();
|
pos = (size_t)file_input.TellI();
|
||||||
str.Printf( wxT("Now at position %d\n\n"), (int) pos );
|
str.Printf( wxT("Now at position %d\n\n"), (int) pos );
|
||||||
textCtrl.WriteText( str );
|
textCtrl.WriteText( str );
|
||||||
|
|
||||||
@@ -792,7 +795,7 @@ void MyApp::DoStreamDemo6(wxCommandEvent& WXUNUSED(event))
|
|||||||
file_input.SeekI( 3 );
|
file_input.SeekI( 3 );
|
||||||
|
|
||||||
ch = file_input.GetC();
|
ch = file_input.GetC();
|
||||||
pos = file_input.TellI();
|
pos = (size_t)file_input.TellI();
|
||||||
str.Printf( wxT("Read char: %d. Now at position %d\n\n"), (int) ch, (int) pos );
|
str.Printf( wxT("Read char: %d. Now at position %d\n\n"), (int) ch, (int) pos );
|
||||||
textCtrl.WriteText( str );
|
textCtrl.WriteText( str );
|
||||||
}
|
}
|
||||||
@@ -809,7 +812,7 @@ void MyApp::DoStreamDemo7(wxCommandEvent& WXUNUSED(event))
|
|||||||
|
|
||||||
textCtrl.WriteText( _T("Writing number 0 to 9 to wxFileOutputStream...\n\n") );
|
textCtrl.WriteText( _T("Writing number 0 to 9 to wxFileOutputStream...\n\n") );
|
||||||
|
|
||||||
wxFileOutputStream file_output( wxString(_T("test_wx.dat")) );
|
wxFileOutputStream file_output( file_name );
|
||||||
for (ch = 0; ch < 10; ch++)
|
for (ch = 0; ch < 10; ch++)
|
||||||
file_output.Write( &ch, 1 );
|
file_output.Write( &ch, 1 );
|
||||||
|
|
||||||
@@ -817,53 +820,53 @@ void MyApp::DoStreamDemo7(wxCommandEvent& WXUNUSED(event))
|
|||||||
|
|
||||||
textCtrl.WriteText( _T("Reading char from wxBufferedInputStream via wxFileInputStream:\n\n") );
|
textCtrl.WriteText( _T("Reading char from wxBufferedInputStream via wxFileInputStream:\n\n") );
|
||||||
|
|
||||||
wxFileInputStream file_input( wxString(_T("test_wx.dat")) );
|
wxFileInputStream file_input( file_name );
|
||||||
wxBufferedInputStream buf_input( file_input );
|
wxBufferedInputStream buf_input( file_input );
|
||||||
|
|
||||||
ch = buf_input.GetC();
|
ch = buf_input.GetC();
|
||||||
size_t pos = buf_input.TellI();
|
size_t pos = (size_t)buf_input.TellI();
|
||||||
str.Printf( wxT("Read char: %d. Now at position %d\n\n"), (int) ch, (int) pos );
|
str.Printf( wxT("Read char: %d. Now at position %d\n\n"), (int) ch, (int) pos );
|
||||||
textCtrl.WriteText( str );
|
textCtrl.WriteText( str );
|
||||||
|
|
||||||
textCtrl.WriteText( _T("Reading another char from wxBufferedInputStream:\n\n") );
|
textCtrl.WriteText( _T("Reading another char from wxBufferedInputStream:\n\n") );
|
||||||
|
|
||||||
ch = buf_input.GetC();
|
ch = buf_input.GetC();
|
||||||
pos = buf_input.TellI();
|
pos = (size_t)buf_input.TellI();
|
||||||
str.Printf( wxT("Read char: %d. Now at position %d\n\n"), (int) ch, (int) pos );
|
str.Printf( wxT("Read char: %d. Now at position %d\n\n"), (int) ch, (int) pos );
|
||||||
textCtrl.WriteText( str );
|
textCtrl.WriteText( str );
|
||||||
|
|
||||||
textCtrl.WriteText( _T("Reading yet another char from wxBufferedInputStream:\n\n") );
|
textCtrl.WriteText( _T("Reading yet another char from wxBufferedInputStream:\n\n") );
|
||||||
|
|
||||||
ch = buf_input.GetC();
|
ch = buf_input.GetC();
|
||||||
pos = buf_input.TellI();
|
pos = (size_t)buf_input.TellI();
|
||||||
str.Printf( wxT("Read char: %d. Now at position %d\n\n"), (int) ch, (int) pos );
|
str.Printf( wxT("Read char: %d. Now at position %d\n\n"), (int) ch, (int) pos );
|
||||||
textCtrl.WriteText( str );
|
textCtrl.WriteText( str );
|
||||||
|
|
||||||
textCtrl.WriteText( _T("Now calling Ungetch( 5 ) from wxBufferedInputStream...\n\n") );
|
textCtrl.WriteText( _T("Now calling Ungetch( 5 ) from wxBufferedInputStream...\n\n") );
|
||||||
|
|
||||||
buf_input.Ungetch( 5 );
|
buf_input.Ungetch( 5 );
|
||||||
pos = buf_input.TellI();
|
pos = (size_t)buf_input.TellI();
|
||||||
str.Printf( wxT("Now at position %d\n\n"), (int) pos );
|
str.Printf( wxT("Now at position %d\n\n"), (int) pos );
|
||||||
textCtrl.WriteText( str );
|
textCtrl.WriteText( str );
|
||||||
|
|
||||||
textCtrl.WriteText( _T("Reading char from wxBufferedInputStream:\n\n") );
|
textCtrl.WriteText( _T("Reading char from wxBufferedInputStream:\n\n") );
|
||||||
|
|
||||||
ch = buf_input.GetC();
|
ch = buf_input.GetC();
|
||||||
pos = buf_input.TellI();
|
pos = (size_t)buf_input.TellI();
|
||||||
str.Printf( wxT("Read char: %d. Now at position %d\n\n"), (int) ch, (int) pos );
|
str.Printf( wxT("Read char: %d. Now at position %d\n\n"), (int) ch, (int) pos );
|
||||||
textCtrl.WriteText( str );
|
textCtrl.WriteText( str );
|
||||||
|
|
||||||
textCtrl.WriteText( _T("Reading another char from wxBufferedInputStream:\n\n") );
|
textCtrl.WriteText( _T("Reading another char from wxBufferedInputStream:\n\n") );
|
||||||
|
|
||||||
ch = buf_input.GetC();
|
ch = buf_input.GetC();
|
||||||
pos = buf_input.TellI();
|
pos = (size_t)buf_input.TellI();
|
||||||
str.Printf( wxT("Read char: %d. Now at position %d\n\n"), (int) ch, (int) pos );
|
str.Printf( wxT("Read char: %d. Now at position %d\n\n"), (int) ch, (int) pos );
|
||||||
textCtrl.WriteText( str );
|
textCtrl.WriteText( str );
|
||||||
|
|
||||||
textCtrl.WriteText( _T("Now calling Ungetch( 5 ) from wxBufferedInputStream again...\n\n") );
|
textCtrl.WriteText( _T("Now calling Ungetch( 5 ) from wxBufferedInputStream again...\n\n") );
|
||||||
|
|
||||||
buf_input.Ungetch( 5 );
|
buf_input.Ungetch( 5 );
|
||||||
pos = buf_input.TellI();
|
pos = (size_t)buf_input.TellI();
|
||||||
str.Printf( wxT("Now at position %d\n\n"), (int) pos );
|
str.Printf( wxT("Now at position %d\n\n"), (int) pos );
|
||||||
textCtrl.WriteText( str );
|
textCtrl.WriteText( str );
|
||||||
|
|
||||||
@@ -872,7 +875,7 @@ void MyApp::DoStreamDemo7(wxCommandEvent& WXUNUSED(event))
|
|||||||
buf_input.SeekI( 3 );
|
buf_input.SeekI( 3 );
|
||||||
|
|
||||||
ch = buf_input.GetC();
|
ch = buf_input.GetC();
|
||||||
pos = buf_input.TellI();
|
pos = (size_t)buf_input.TellI();
|
||||||
str.Printf( wxT("Read char: %d. Now at position %d\n\n"), (int) ch, (int) pos );
|
str.Printf( wxT("Read char: %d. Now at position %d\n\n"), (int) ch, (int) pos );
|
||||||
textCtrl.WriteText( str );
|
textCtrl.WriteText( str );
|
||||||
}
|
}
|
||||||
|
@@ -102,11 +102,6 @@ MyResizableListCtrl::MyResizableListCtrl( wxWindow *parent, wxWindowID id,
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
MyResizableListCtrl::~MyResizableListCtrl()
|
|
||||||
{
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
void MyResizableListCtrl::ContextSensitiveMenu( wxMouseEvent& event )
|
void MyResizableListCtrl::ContextSensitiveMenu( wxMouseEvent& event )
|
||||||
{
|
{
|
||||||
// Make an instance of a menu.
|
// Make an instance of a menu.
|
||||||
|
@@ -69,7 +69,7 @@ public:
|
|||||||
);
|
);
|
||||||
|
|
||||||
// Destuctor.
|
// Destuctor.
|
||||||
~MyResizableListCtrl();
|
~MyResizableListCtrl(){};
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
|
|
||||||
|
@@ -64,11 +64,6 @@ PreferencesDialog::PreferencesDialog(wxWindow* parent)
|
|||||||
wxXmlResource::Get()->LoadDialog(this, parent, wxT("derived_dialog"));
|
wxXmlResource::Get()->LoadDialog(this, parent, wxT("derived_dialog"));
|
||||||
}
|
}
|
||||||
|
|
||||||
// Destructor. (Empty, as I don't need anything special done when destructing).
|
|
||||||
PreferencesDialog::~PreferencesDialog()
|
|
||||||
{
|
|
||||||
}
|
|
||||||
|
|
||||||
//-----------------------------------------------------------------------------
|
//-----------------------------------------------------------------------------
|
||||||
// Private members (including the event handlers)
|
// Private members (including the event handlers)
|
||||||
//-----------------------------------------------------------------------------
|
//-----------------------------------------------------------------------------
|
||||||
|
@@ -45,7 +45,7 @@ public:
|
|||||||
PreferencesDialog( wxWindow* parent );
|
PreferencesDialog( wxWindow* parent );
|
||||||
|
|
||||||
// Destructor.
|
// Destructor.
|
||||||
~PreferencesDialog();
|
~PreferencesDialog(){};
|
||||||
|
|
||||||
private:
|
private:
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user